use of com.sun.voip.TreatmentManager in project Openfire by igniterealtime.
the class ConferenceManager method addTreatment.
public void addTreatment(String treatment) throws IOException {
if (!done) {
synchronized (this) {
if (wgManager.hasCommonMix()) {
wgManager.addConferenceTreatment(new TreatmentManager(treatment, 0, mediaInfo.getSampleRate(), mediaInfo.getChannels()));
} else {
synchronized (memberList) {
for (int i = 0; i < memberList.size(); i++) {
ConferenceMember member = (ConferenceMember) memberList.get(i);
member.addTreatment(new TreatmentManager(treatment, 0, mediaInfo.getSampleRate(), mediaInfo.getChannels()));
}
}
}
}
}
}
use of com.sun.voip.TreatmentManager in project Openfire by igniterealtime.
the class NSOutgoingCallAgent method initiateCall.
public void initiateCall() throws IOException {
InetSocketAddress isa = callHandler.getReceiveAddress();
if (isa == null) {
throw new IOException("can't get receiver socket!");
}
setState(CallState.INVITED);
TreatmentManager treatmentManager = null;
if (cp.getInputTreatment() != null) {
if (cp.getInputTreatment().length() > 0) {
try {
/*
* Just make sure we can open the file
*/
treatmentManager = new TreatmentManager(cp.getInputTreatment(), RtpPacket.PCM_ENCODING, mixerMediaPreference.getSampleRate(), mixerMediaPreference.getChannels());
treatmentManager.stopTreatment(false);
} catch (IOException e) {
Logger.println("Invalid input treatment: " + cp.getInputTreatment());
throw new IOException("Invalid input treatment: " + cp.getInputTreatment());
}
}
/*
* This is a special call which is used to play
* an input treatment as its input.
* There is no remote endpoint.
*/
try {
setRemoteMediaInfo(treatmentManager);
} catch (ParseException e) {
throw new IOException(e.getMessage());
}
}
}
use of com.sun.voip.TreatmentManager in project Openfire by igniterealtime.
the class MemberSender method setDtmfKeyToSend.
public void setDtmfKeyToSend(String dtmfKeyToSend) {
if (telephoneEventPayload == 0) {
String treatment;
if (dtmfKeyToSend.equals("*")) {
treatment = "dtmfStar.au";
} else if (dtmfKeyToSend.equals("#")) {
treatment = "dtmfPound.au";
} else {
treatment = "dtmf" + dtmfKeyToSend + ".au";
}
try {
TreatmentManager tm = new TreatmentManager(treatment, 0, conferenceMediaInfo.getSampleRate(), conferenceMediaInfo.getChannels());
callHandler.getMember().addTreatment(tm);
} catch (IOException e) {
Logger.println("Unable to play dtmf key " + dtmfKeyToSend + " " + e.getMessage());
}
return;
}
if (dtmfKeyToSend != null) {
if (this.dtmfKeyToSend != null) {
this.dtmfKeyToSend += dtmfKeyToSend;
return;
}
}
this.dtmfKeyToSend = dtmfKeyToSend;
dtmfSendSequence = 0;
}
use of com.sun.voip.TreatmentManager in project Openfire by igniterealtime.
the class CallHandler method playTreatmentToCall.
public TreatmentManager playTreatmentToCall(String treatment, TreatmentDoneListener treatmentDoneListener) throws IOException {
if (Logger.logLevel >= Logger.LOG_MOREINFO) {
Logger.println("Playing treatment " + treatment + " to " + cp.getCallId());
}
TreatmentManager treatmentManager = new TreatmentManager(treatment, 0, conferenceManager.getMediaInfo().getSampleRate(), conferenceManager.getMediaInfo().getChannels());
if (treatmentDoneListener != null) {
treatmentManager.addTreatmentDoneListener(treatmentDoneListener);
}
addTreatment(treatmentManager);
return treatmentManager;
}
use of com.sun.voip.TreatmentManager in project Openfire by igniterealtime.
the class SipTPCCallAgent method initiateCall.
/*
* Begin Third-Party Call Control.
*/
public void initiateCall() throws IOException {
try {
try {
busyTreatment = new TreatmentManager("busy.au", 0);
} catch (IOException e) {
Logger.println("Invalid busy treatment: " + e.getMessage());
}
Logger.writeFile("Call " + cp + ": Begin SIP third party call");
setState(CallState.INVITED);
InetSocketAddress isa = callHandler.getReceiveAddress();
if (isa == null) {
throw new IOException("can't get receiver socket!");
}
// send INVITE to the CallParticipant
clientTransaction = sipUtil.sendInvite(cp, isa);
if (clientTransaction == null) {
Logger.error("Error placing call: " + cp);
setState(CallState.ENDED, "Reason='Error placing call'");
throw new IOException("Error placing call: " + cp);
}
CallIdHeader callIdHeader = (CallIdHeader) clientTransaction.getRequest().getHeader(CallIdHeader.NAME);
sipCallId = callIdHeader.getCallId();
sipServerCallback = SipServer.getSipServerCallback();
sipServerCallback.addSipListener(sipCallId, this);
} catch (java.text.ParseException e) {
Logger.println("Call " + cp + " Error placing call " + cp + ": " + e.getMessage());
setState(CallState.ENDED, "Reason='Error placing call " + cp + " " + e.getMessage() + "'");
throw new IOException("Error placing call " + cp + " " + e.getMessage());
} catch (InvalidArgumentException e) {
Logger.println("Call " + cp + " Error placing call " + cp + ": " + e.getMessage());
setState(CallState.ENDED, "Reason='Error placing call " + cp + " " + e.getMessage() + "'");
throw new IOException("Error placing call " + cp + " " + e.getMessage());
} catch (SipException e) {
Logger.println("Call " + cp + " Error placing call " + cp + ": " + e.getMessage());
setState(CallState.ENDED, "Reason='Error placing call " + cp + " " + e.getMessage() + "'");
throw new IOException("Error placing call " + cp + " " + e.getMessage());
}
}
Aggregations