src/net/java/sip/communicator/service/protocol/media/AbstractOperationSetTelephonyConferencing.java
/**
     * Adds a <tt>user</tt> element to <tt>confInfo</tt> which describes
     * <tt>callPeer</tt>, or the local peer if <tt>remote</tt> is <tt>false</tt>.
     *
     * @param confInfo the <tt>ConferenceInformationDocument</tt> to which to
     * add a <tt>user</tt> element
     * @param callPeer the <tt>CallPeer</tt> which should be described
     * @param remote <tt>true</tt> to describe <tt>callPeer</tt>, or
     * <tt>false</tt> to describe the local peer.
     */
Adds a user element to confInfo which describes
callPeer, or the local peer if remote is false.

@param confInfo the ConferenceInformationDocument to which to
add a user element
@param callPeer the CallPeer which should be described
@param remote true to describe callPeer, or
false to describe the local peer.
Adds a user element to confInfo which describes callPeer or the local peer if remote is false . @param confInfo the ConferenceInformationDocument to which to add a user element @param callPeer the CallPeer which should be described @param remote true to describe callPeer or false to describe the local peer .
private void addPeerToConferenceInfo(
            ConferenceInfoDocument confInfo,
            MediaAwareCallPeer<?,?,?> callPeer,
            boolean remote)
    {
        String entity
            = remote ? callPeer.getEntity() : getLocalEntity(callPeer);
        ConferenceInfoDocument.User user = confInfo.addNewUser(entity);
        String displayName
            = remote ? callPeer.getDisplayName() : getLocalDisplayName();
        user.setDisplayText(displayName);
        ConferenceInfoDocument.Endpoint endpoint = user.addNewEndpoint(entity);
        endpoint.setStatus(
            remote
                ? getEndpointStatus(callPeer)
                : ConferenceInfoDocument.EndpointStatusType.connected);
        CallPeerMediaHandler<?> mediaHandler
            = callPeer.getMediaHandler();
        for (MediaType mediaType : MediaType.values())
        {
            MediaStream stream = mediaHandler.getStream(mediaType);
            if (stream != null || !remote)
            {
                long srcId = -1;
                if (remote)
                {
                    srcId = getRemoteSourceID(callPeer, mediaType);
                }
                else if (stream != null)
                {
                    srcId = stream.getLocalSourceID();
                }
                else 
                {
                    /*
                     * 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)
                {
                    direction
                        = callPeer.getDirection(mediaType).getReverseDirection();
                }
                else
                {
                    if (mediaType == MediaType.AUDIO &&
                            callPeer.getMediaHandler()
                                    .isLocalAudioTransmissionEnabled())
                        direction = direction.or(MediaDirection.SENDONLY);
                    else if (mediaType == MediaType.VIDEO &&
                            callPeer.isLocalVideoStreaming())
                        direction = direction.or(MediaDirection.SENDONLY);
                    if (callPeer.getDirection(mediaType).allowsReceiving())
                        direction = direction.or(MediaDirection.RECVONLY);
                }
                if ((srcId != -1) || (direction != MediaDirection.INACTIVE))
                {
                    ConferenceInfoDocument.Media media
                        = endpoint.addNewMedia(mediaType.toString());
                    media.setType(mediaType.toString());
                    if (srcId != -1)
                        media.setSrcId(Long.toString(srcId));
                    media.setStatus(direction.toString());
                }
            }
        }
    }
private void addPeerToConferenceInfo ( ConferenceInfoDocument confInfo , MediaAwareCallPeer < ? , ? , ? > callPeer , boolean remote ) { String entity = remote ? callPeer . getEntity ( ) : getLocalEntity ( callPeer ) ; ConferenceInfoDocument . User user = confInfo . addNewUser ( entity ) ; String displayName = remote ? callPeer . getDisplayName ( ) : getLocalDisplayName ( ) ; user . setDisplayText ( displayName ) ; ConferenceInfoDocument . Endpoint endpoint = user . addNewEndpoint ( entity ) ; endpoint . setStatus ( remote ? getEndpointStatus ( callPeer ) : ConferenceInfoDocument . EndpointStatusType . connected ) ; CallPeerMediaHandler < ? > mediaHandler = callPeer . getMediaHandler ( ) ; for ( MediaType mediaType : MediaType . values ( ) ) { MediaStream stream = mediaHandler . getStream ( mediaType ) ; if ( stream != null || ! remote ) { long srcId = - 1 ; if ( remote ) { srcId = getRemoteSourceID ( callPeer , mediaType ) ; } else if ( stream != null ) { srcId = stream . getLocalSourceID ( ) ; } else { /*
                     * 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 ) { direction = callPeer . getDirection ( mediaType ) . getReverseDirection ( ) ; } else { if ( mediaType == MediaType . AUDIO && callPeer . getMediaHandler ( ) . isLocalAudioTransmissionEnabled ( ) ) direction = direction . or ( MediaDirection . SENDONLY ) ; else if ( mediaType == MediaType . VIDEO && callPeer . isLocalVideoStreaming ( ) ) direction = direction . or ( MediaDirection . SENDONLY ) ; if ( callPeer . getDirection ( mediaType ) . allowsReceiving ( ) ) direction = direction . or ( MediaDirection . RECVONLY ) ; } if ( ( srcId != - 1 ) || ( direction != MediaDirection . INACTIVE ) ) { ConferenceInfoDocument . Media media = endpoint . addNewMedia ( mediaType . toString ( ) ) ; media . setType ( mediaType . toString ( ) ) ; if ( srcId != - 1 ) media . setSrcId ( Long . toString ( srcId ) ) ; media . setStatus ( direction . toString ( ) ) ; } } } }
Adds a <tt>user</tt> element to <tt>confInfo</tt> which describes
 <tt>callPeer</tt>, or the local peer if <tt>remote</tt> is <tt>false</tt>.
Adds a <tt > user< / tt > element to <tt > confInfo< / tt > which describes <tt > callPeer< / tt > or the local peer if <tt > remote< / tt > is <tt > false< / tt > .
// stream == null && !remote