audioGroup = vm.createAudioGroup(group, setup);
}
PresenceInfo[] calleeList = msg.getCalleeList();
PresenceInfo caller = msg.getCaller();
if (msg.getChatType() != null) {
Player player = vm.getPlayer(caller.getCallID());
if (player == null) {
logger.warning("No Player for " + caller.getCallID());
return;
}
boolean added = addPlayerToAudioGroup(audioGroup, player, caller, msg.getChatType());
if (added) {
sender.send(new VoiceChatJoinAcceptedMessage(group, caller, msg.getChatType()));
}
if (added == false && (calleeList == null || calleeList.length == 0)) {
endVoiceChat(vm, audioGroup);
return;
}
}
logger.info("Request to join AudioGroup " + group + " caller " + caller);
if (calleeList == null || calleeList.length == 0) {
return;
}
for (int i = 0; i < calleeList.length; i++) {
PresenceInfo info = calleeList[i];
String callID = info.getCallID();
Player player = vm.getPlayer(callID);
if (player == null) {
logger.warning("No player for callID " + callID);
continue;
}
if (info.getClientID() == null) {
/*
* This is an outworlder. We automatically join them to the group
* The InCallDialog can be used to change the privacy setting
* and to remove the outworlder from the chat.
*/
addPlayerToAudioGroup(audioGroup, player, info, msg.getChatType());
sender.send(new VoiceChatJoinAcceptedMessage(group, info, msg.getChatType()));
continue;
}
AudioGroupPlayerInfo playerInfo = audioGroup.getPlayerInfo(player);
if (playerInfo != null && sameChatType(playerInfo.chatType, msg.getChatType())) {
logger.fine("Player " + info
+ " is already in audio group " + audioGroup);
if (playerInfo.isTransientMember == false) {
continue;
}
}
WonderlandClientID id =
CommsManagerFactory.getCommsManager().getWonderlandClientID(info.getClientID());
if (id == null) {
logger.warning("No WonderlandClientID for " + info);
continue;
}