use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class ConferenceManager method getConferenceInfo.
private static String getConferenceInfo(int format) {
synchronized (conferenceList) {
if (conferenceList.size() == 0) {
if (format != 0) {
return ("\n\n\n\n");
}
return "";
}
String s = "";
for (int i = 0; i < conferenceList.size(); i++) {
ConferenceManager conferenceManager = (ConferenceManager) conferenceList.get(i);
String id = conferenceManager.getId();
String displayName = conferenceManager.getDisplayName();
if (format != 1) {
if (displayName != null) {
id += " '" + displayName + "'";
}
} else {
if (displayName == null) {
if (id.length() >= 14) {
id = id.substring(0, 13);
}
} else {
id = "'" + displayName + "'";
}
}
s += "Conference Id: " + id + " ";
s += conferenceManager.getMediaInfo().toString();
s += " Members=" + conferenceManager.getMemberList().size();
if (conferenceManager.isPermanent()) {
s += " persistent";
}
String recordingFile = conferenceManager.getWGManager().getRecordingFile();
if (recordingFile != null) {
s += " Recording to " + recordingFile;
}
s += "\n";
if (format == 0) {
continue;
}
/*
* Copy the member list so we can avoid unnecessary
* synchronization
*/
ArrayList memberList = (ArrayList) conferenceManager.getMemberList().clone();
for (int n = 0; n < memberList.size(); n++) {
ConferenceMember member = (ConferenceMember) memberList.get(n);
MemberSender memberSender = member.getMemberSender();
MemberReceiver memberReceiver = member.getMemberReceiver();
String info = " ";
MediaInfo transmitMediaInfo = memberSender.getMediaInfo();
if (transmitMediaInfo != null) {
info += transmitMediaInfo.toString();
}
MediaInfo receiveMediaInfo = memberReceiver.getMediaInfo();
if (receiveMediaInfo != null) {
if (transmitMediaInfo.getEncoding() != receiveMediaInfo.getEncoding() || transmitMediaInfo.getSampleRate() != receiveMediaInfo.getSampleRate() || transmitMediaInfo.getChannels() != receiveMediaInfo.getChannels()) {
/*
* The member is transmitting at a different
* media setting than it is receiving.
*/
info += " Transmit:" + memberReceiver.getMediaInfo();
}
}
CallParticipant cp = member.getCallParticipant();
if (cp.isMuted()) {
info += " MUTED";
}
if (cp.isConferenceMuted()) {
info += " CONFERENCE_MUTED";
}
if (cp.isConferenceSilenced()) {
info += " MAIN_CONFERENCE_SILENCED";
}
if (memberReceiver.doNotRecord() == true) {
info += " RECORDED NOT ALLOWED";
}
if (memberReceiver.getFromRecordingFile() != null) {
info += " Recording from member in " + memberReceiver.getFromRecordingFile();
}
if (cp.isRecorder()) {
String toRecordingFile = memberSender.getCallParticipant().getToRecordingFile();
if (toRecordingFile != null) {
info += " Recording to member in " + toRecordingFile;
} else {
info += " Recorder";
}
}
if (cp.speexEncode()) {
info += " SpeexEncode";
}
//
if (memberSender.getSendAddress() != null) {
String gateway = "";
String address = memberSender.getSendAddress().toString();
int ix = address.indexOf("/");
if (ix >= 0) {
address = address.substring(ix + 1);
if ((ix = address.indexOf(":")) >= 0) {
address = address.substring(0, ix);
}
}
if (address.equals("10.6.4.192")) {
gateway = " Menlo Park Gateway";
} else if (address.equals("129.148.75.22")) {
gateway = " Burlington Gateway";
} else if (address.equals("10.1.224.22")) {
gateway = " Broomfield Gateway";
}
info += gateway;
}
if (format == 2) {
info += conferenceManager.getWGManager().getWhisperGroupInfo(member);
}
cp = member.getCallParticipant();
id = cp.toString();
if (format == 1) {
id = cp.toConsiseString();
}
s += " " + id + info + "\n";
}
s += "\n";
}
return s + "\n";
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class TwoPartyCallHandler method run.
/*
* start a two party call
*/
public void run() {
OutgoingCallHandler callHandler1 = new OutgoingCallHandler(callEventListener, cp);
synchronized (this) {
// call first party
callHandler1.start();
/*
* Wait for first party to answer.
*/
if (callHandler1.waitForCallToBeAnswered() == false) {
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());
OutgoingCallHandler callHandler2 = new OutgoingCallHandler(callEventListener, cp2);
synchronized (this) {
/*
* Each call has to know about the other so that when
* one hangs up, the other call is terminated.
*/
callHandler1.setOtherCall(callHandler2);
callHandler2.setOtherCall(callHandler1);
// call second party
callHandler2.start();
if (callHandler2.waitForCallToBeAnswered() == true) {
/*
* Second party answered, stop treatment to first party.
*/
callHandler1.stopCallAnsweredTreatment();
callHandler1.stopCallEstablishedTreatment();
}
}
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class WhisperGroup method toAbbreviatedString.
public String toAbbreviatedString(boolean showMembers) {
String id = this.id;
if (id.length() >= 14) {
id = id.substring(0, 13);
}
String s = id + ":";
s += (Math.round(attenuation * 1000) / 1000D);
if (isTransient) {
s += " Transient";
}
if (isLocked) {
s += " Locked";
}
if (noCommonMix) {
s += " NoCommonMix";
}
if (showMembers == false) {
return s;
}
s += " ";
for (int j = 0; j < members.size(); j++) {
ConferenceMember member = (ConferenceMember) members.get(j);
CallParticipant cp = member.getCallParticipant();
id = cp.toConsiseString();
s += "'" + id;
if (whisperers.contains(member)) {
s += "+";
}
s += "' ";
}
return s;
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class WhisperGroup method toString.
public String toString() {
String s = id + ":";
s += mediaInfo + " ";
s += (Math.round(attenuation * 1000) / 1000D);
if (isTransient) {
s += " Transient";
}
if (isLocked) {
s += " Locked";
}
s += " ";
for (int i = 0; i < members.size(); i++) {
ConferenceMember member = (ConferenceMember) members.get(i);
CallParticipant cp = member.getCallParticipant();
s += cp.getCallId();
if (whisperers.contains(member)) {
s += "+";
}
s += " ";
}
return s;
}
use of com.sun.voip.CallParticipant in project Openfire by igniterealtime.
the class CallHandler method hangupOwner.
public static void hangupOwner(String ownerId, 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 (cp.getCallOwner().equals(ownerId)) {
callsToCancel.add(call);
}
}
}
cancel(callsToCancel, reason, false);
}
Aggregations