private void setupAudioChannelOutbound(MediaDescriptionField remoteAudio) throws IOException {
        // Negotiate audio codecs
        this.audioChannel.negotiateFormats(remoteAudio);
        if (!this.audioChannel.containsNegotiatedFormats()) {
            throw new IOException("Audio codecs were not supported");
        }

        // connect to remote peer - RTP
        String remoteRtpAddress = remoteAudio.getConnection().getAddress();
        int remoteRtpPort = remoteAudio.getPort();

        // only connect is calls are plain old SIP
        // For WebRTC cases, the ICE Agent must connect upon candidate selection
        boolean connectNow = !(this.outbound && audioChannel.isIceEnabled());
        if (connectNow) {
            this.audioChannel.connectRtp(remoteRtpAddress, remoteRtpPort);
            // connect to remote peer - RTCP
            boolean remoteRtcpMux = remoteAudio.isRtcpMux();
            if (remoteRtcpMux) {
                this.audioChannel.connectRtcp(remoteRtpAddress, remoteRtpPort);
            } else {
                RtcpAttribute remoteRtcp = remoteAudio.getRtcp();
                if (remoteRtcp == null) {
                    // No specific RTCP port, so default is RTP port + 1
                    this.audioChannel.connectRtcp(remoteRtpAddress, remoteRtpPort + 1);
                } else {
                    // Specific RTCP address and port contained in SDP
                    String remoteRtcpAddress = remoteRtcp.getAddress();
                    if (remoteRtcpAddress == null) {
                        // address is optional in rtcp attribute
                        // will match RTP address if not defined
                        remoteRtcpAddress = remoteRtpAddress;
                    }
                    int remoteRtcpPort = remoteRtcp.getPort();
                    this.audioChannel.connectRtcp(remoteRtcpAddress, remoteRtcpPort);
                }
            }
        }
    }
private void setupAudioChannelOutbound ( MediaDescriptionField remoteAudio ) throws IOException { this . audioChannel . negotiateFormats ( remoteAudio ) ; if ( ! this . audioChannel . containsNegotiatedFormats ( ) ) { throw new IOException ( "Audio codecs were not supported" ) ; } String remoteRtpAddress = remoteAudio . getConnection ( ) . getAddress ( ) ; int remoteRtpPort = remoteAudio . getPort ( ) ; boolean connectNow = ! ( this . outbound && audioChannel . isIceEnabled ( ) ) ; if ( connectNow ) { this . audioChannel . connectRtp ( remoteRtpAddress , remoteRtpPort ) ; boolean remoteRtcpMux = remoteAudio . isRtcpMux ( ) ; if ( remoteRtcpMux ) { this . audioChannel . connectRtcp ( remoteRtpAddress , remoteRtpPort ) ; } else { RtcpAttribute remoteRtcp = remoteAudio . getRtcp ( ) ; if ( remoteRtcp == null ) { this . audioChannel . connectRtcp ( remoteRtpAddress , remoteRtpPort + 1 ) ; } else { String remoteRtcpAddress = remoteRtcp . getAddress ( ) ; if ( remoteRtcpAddress == null ) { remoteRtcpAddress = remoteRtpAddress ; } int remoteRtcpPort = remoteRtcp . getPort ( ) ; this . audioChannel . connectRtcp ( remoteRtcpAddress , remoteRtcpPort ) ; } } } }
Reads the remote SDP answer and sets up the proper media channels.

@param remoteAudio The description of the remote audio channel.

@throws IOException When binding the audio data channel or when failing to negotiate codecs.