logger.fine("got message " + msg);
PhoneCellMO phoneCellMO = (PhoneCellMO) getCell();
if (message instanceof LockUnlockMessage) {
LockUnlockMessage m = (LockUnlockMessage) message;
boolean successful = true;
PhoneInfo phoneInfo = phoneCellMO.getPhoneInfo();
if (m.getPassword() != null) {
String password = System.getProperty("wonderland.phone.password");
if (password == null || password.length() == 0) {
password = phoneInfo.password;
}
successful = m.getPassword().equals(password);
}
if (successful) {
phoneInfo.locked = !phoneInfo.locked;
phoneInfo.keepUnlocked = m.keepUnlocked();
}
logger.fine("locked " + phoneInfo.locked + " successful "
+ successful + " pw " + m.getPassword());
LockUnlockResponseMessage response =
new LockUnlockResponseMessage(phoneCellMO.getCellID(), phoneInfo.locked, successful);
sender.send(response);
return;
}
VoiceManager vm = AppContext.getManager(VoiceManager.class);
CallListing listing = msg.getCallListing();
String externalCallID = getExternalCallID(listing);
Call externalCall = vm.getCall(externalCallID);
Player externalPlayer = null;
if (externalCall != null) {
externalPlayer = externalCall.getPlayer();
}
String softphoneCallID = listing.getSoftphoneCallID();
Call softphoneCall = null;
Player softphonePlayer = null;
AudioGroup audioGroup = null;
String audioGroupId = null;
VoiceManagerParameters parameters = vm.getVoiceManagerParameters();
if (softphoneCallID != null) {
softphoneCall = vm.getCall(softphoneCallID);
if (softphoneCall != null) {
softphonePlayer = softphoneCall.getPlayer();
}
audioGroupId = softphoneCallID + "_" + externalCallID;
audioGroup = vm.getAudioGroup(audioGroupId);
}
logger.fine("EXTERNAL CALLID IS " + externalCallID + " " + msg
+ " softphone callID " + softphoneCallID + " softphone call "
+ softphoneCall + " softphone player " + softphonePlayer);
if (message instanceof PlayTreatmentMessage) {
PlayTreatmentMessage m = (PlayTreatmentMessage) message;
logger.fine("play treatment " + m.getTreatment()
+ " to " + listing.getExternalCallID() + " echo " + m.echo());
if (listing.simulateCalls() == true) {
return;
}
try {
externalCall.playTreatment(m.getTreatment());
} catch (IOException e) {
logger.warning("Unable to play treatment to " + externalCall + ": "
+ e.getMessage());
}
if (m.echo() == false) {
return;
}
logger.fine("echoing treatment to " + softphoneCallID);
try {
softphoneCall.playTreatment(m.getTreatment());
} catch (IOException e) {
logger.warning("Unable to play treatment to " + softphoneCall + ": "
+ e.getMessage());
sender.send(clientID, new CallEndedResponseMessage(
phoneCellMO.getCellID(), listing, true, "Softphone is not connected!"));