From e6dcd36fd5e7cd63a3c9fdcf03ae02a9793e250e Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Thu, 8 Aug 2013 11:19:10 +0300 Subject: [PATCH] Fixes an issue with the representation of the local peer in conference-info documents. --- ...ractOperationSetTelephonyConferencing.java | 55 ++++++++++++++----- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java b/src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java index 85a028857..a2e91a34a 100644 --- a/src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java +++ b/src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java @@ -1081,19 +1081,38 @@ private void addPeerToConferenceInfo( for (MediaType mediaType : MediaType.values()) { MediaStream stream = mediaHandler.getStream(mediaType); - if (stream != null) + if (stream != null || !remote) { - ConferenceInfoDocument.Media media - = endpoint.addNewMedia(mediaType.toString()); - long srcId - = remote - ? getRemoteSourceID(callPeer, mediaType) - : stream.getLocalSourceID(); - - if (srcId != -1) - media.setSrcId(Long.toString(srcId)); - - media.setType(mediaType.toString()); + long srcId = -1; + if (remote) + srcId = getRemoteSourceID(callPeer, mediaType); + else if (stream != null) + { + srcId = stream.getLocalSourceID(); + } + else // stream == null && !remote + { + /* + * If we are describing the local peer, but we don't have + * media streams with callPeer (which is the case when we + * send conference-info while the other side is still + * ringing), we can try to obtain our local SSRC from the + * streams we have already set up with the other + * participants in the conference. + */ + for (MediaAwareCallPeer otherCallPeer + : callPeer.getCall().getCallPeerList()) + { + MediaStream otherStream + = otherCallPeer + .getMediaHandler().getStream(mediaType); + if (otherStream != null) + { + srcId = otherStream.getLocalSourceID(); + break; + } + } + } MediaDirection direction = MediaDirection.INACTIVE; if (remote) @@ -1113,10 +1132,16 @@ else if (mediaType == MediaType.VIDEO && direction = direction.or(MediaDirection.RECVONLY); } - if (direction == null) - direction = MediaDirection.INACTIVE; + if ((srcId != -1) || (direction != MediaDirection.INACTIVE)) + { + ConferenceInfoDocument.Media media + = endpoint.addNewMedia(mediaType.toString()); - media.setStatus(direction.toString()); + media.setType(mediaType.toString()); + if (srcId != -1) + media.setSrcId(Long.toString(srcId)); + media.setStatus(direction.toString()); + } } } }