use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class ConferenceReceiver method removeMember.
public void removeMember(ConferenceMember member) {
CallParticipant cp = member.getCallParticipant();
if (loneReceiverChannel != null) {
synchronized (members) {
if (members.remove(member.getMemberSender().getSendAddress()) != null) {
return;
}
}
}
synchronized (membersToRegister) {
if (selector == null) {
return;
}
membersToUnregister.add(member);
Logger.writeFile("ConferenceReceiver adding member to unregister " + member + " size " + membersToUnregister.size());
selector.wakeup();
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class DirectCallHandler method run.
public void run() {
setState(INITIATED);
ch1 = new DirectOutgoingCallHandler(cp);
ch1.sendInvite(null);
String sdp = null;
try {
sdp = ch1.waitForOK();
} catch (Exception ex) {
setState(FAILED);
return;
}
CallParticipant cp2 = new CallParticipant();
cp2.setCallAnswerTimeout(cp.getCallAnswerTimeout());
cp2.setCallAnsweredTreatment(cp.getSecondPartyTreatment());
cp2.setCallEndTreatment(cp.getSecondPartyCallEndTreatment());
cp2.setCallId(cp.getSecondPartyCallId());
cp2.setConferenceId(cp.getConferenceId());
if (cp.getSecondPartyName() != null) {
cp2.setName(cp.getSecondPartyName());
} else {
cp2.setName(cp.getSecondPartyNumber());
}
cp2.setDisplayName(cp.getName());
if (cp2.getCallId() == null) {
cp2.setCallId(CallHandler.getNewCallId());
}
cp2.setPhoneNumber(cp.getSecondPartyNumber());
cp2.setVoiceDetection(cp.getSecondPartyVoiceDetection());
ch2 = new DirectOutgoingCallHandler(cp2);
ch1.setOtherCall(ch2);
ch2.setOtherCall(ch1);
ch2.sendInvite(sdp);
try {
sdp = ch2.waitForOK();
ch1.sendAck(sdp);
ch2.sendAck(null);
setState(ESTABLISHED);
ch1.waitForTerminate();
ch2.waitForTerminate();
setState(TERMINATED);
} catch (Exception ex) {
setState(FAILED);
if (ch1.getState() != ch1.TERMINATED) {
ch1.sendBye();
}
if (ch2.getState() != ch2.TERMINATED) {
ch2.sendBye();
}
return;
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class CallHandler method setMuted.
public static void setMuted(String callId, boolean isMuted) {
if (callId == null) {
return;
}
synchronized (activeCalls) {
for (int i = 0; i < activeCalls.size(); i++) {
CallHandler call = (CallHandler) activeCalls.elementAt(i);
CallParticipant cp = call.getCallParticipant();
if (match(cp, callId)) {
if (Logger.logLevel >= Logger.LOG_DETAIL) {
String s = "";
if (isMuted == false) {
s = "un";
}
Logger.println(cp.getCallId() + ": " + s + "muted");
}
MemberReceiver memberReceiver = call.getMemberReceiver();
if (memberReceiver != null) {
memberReceiver.setMuted(isMuted);
}
}
}
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class CallHandler method tooManyDuplicateCalls.
/**
* For debugging...
*/
public static boolean tooManyDuplicateCalls(String phoneNumber) {
synchronized (activeCalls) {
int n = 0;
for (int i = 0; i < activeCalls.size(); i++) {
CallHandler call = (CallHandler) activeCalls.elementAt(i);
CallParticipant cp = call.getCallParticipant();
if (cp.getPhoneNumber().equals(phoneNumber)) {
n++;
}
}
if (n > duplicateCallLimit) {
return true;
}
return false;
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class CallHandler method hangup.
/*
* Cancel a specified call. If callid is 0, all calls are cancelled.
*/
public static void hangup(String callId, String reason) {
Vector callsToCancel = new Vector();
synchronized (activeCalls) {
/*
* Make a list of all the calls we want to cancel, then cancel them.
* We have to cancel them while not synchronized or
* we could deadlock.
*/
for (int i = 0; i < activeCalls.size(); i++) {
CallHandler call = (CallHandler) activeCalls.elementAt(i);
CallParticipant cp = call.getCallParticipant();
if (callId.equals("0") || match(cp, callId)) {
callsToCancel.add(call);
}
}
}
cancel(callsToCancel, reason, false);
}
Aggregations