src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
/**
     * Returns the selected crypto suite selected.
     *
     * @param isInitiator True if the local call instance is the initiator of
     * the call. False otherwise.
     * @param sDesControl The SDES based SRTP MediaStream encryption control.
     * @param mediaDescription The description received from the
     * remote peer. This contains the SDES crypto suites available for the
     * remote peer.
     *
     * @return The selected SDES crypto suite supported by both the local and
     * the remote peer. Or null, if there is no crypto suite supported by both
     * of the peers.
     */
Returns the selected crypto suite selected.
@param isInitiator True if the local call instance is the initiator of
the call. False otherwise.
@param sDesControl The SDES based SRTP MediaStream encryption control.
@param mediaDescription The description received from the
remote peer. This contains the SDES crypto suites available for the
remote peer.

@return The selected SDES crypto suite supported by both the local and
the remote peer. Or null, if there is no crypto suite supported by both
of the peers.
Returns the selected crypto suite selected . @param isInitiator True if the local call instance is the initiator of the call . False otherwise . @param sDesControl The SDES based SRTP MediaStream encryption control . @param mediaDescription The description received from the remote peer . This contains the SDES crypto suites available for the remote peer . @return The selected SDES crypto suite supported by both the local and the remote peer . Or null if there is no crypto suite supported by both of the peers .
protected SrtpCryptoAttribute selectSdesCryptoSuite(
            boolean isInitiator,
            SDesControl sDesControl,
            MediaDescription mediaDescription)
    {
        @SuppressWarnings("unchecked")
        Vector<Attribute> attrs = mediaDescription.getAttributes(true);
        Vector<SrtpCryptoAttribute> peerAttributes
            = new Vector<SrtpCryptoAttribute>(attrs.size());
        Attribute a;
        for(int i = 0; i < attrs.size(); ++i)
        {
            try
            {
                a = attrs.get(i);
                if (a.getName().equals("crypto"))
                {
                    peerAttributes.add(
                            SrtpCryptoAttribute.create(a.getValue()));
                }
            }
            catch (Exception e)
            {
                logger.error("received an unparsable sdp attribute", e);
            }
        }
        if(isInitiator)
        {
            return sDesControl.initiatorSelectAttribute(peerAttributes);
        }
        else
        {
            return sDesControl.responderSelectAttribute(peerAttributes);
        }
    }
protected SrtpCryptoAttribute selectSdesCryptoSuite ( boolean isInitiator , SDesControl sDesControl , MediaDescription mediaDescription ) { @ SuppressWarnings ( "unchecked" ) Vector < Attribute > attrs = mediaDescription . getAttributes ( true ) ; Vector < SrtpCryptoAttribute > peerAttributes = new Vector < SrtpCryptoAttribute > ( attrs . size ( ) ) ; Attribute a ; for ( int i = 0 ; i < attrs . size ( ) ; ++ i ) { try { a = attrs . get ( i ) ; if ( a . getName ( ) . equals ( "crypto" ) ) { peerAttributes . add ( SrtpCryptoAttribute . create ( a . getValue ( ) ) ) ; } } catch ( Exception e ) { logger . error ( "received an unparsable sdp attribute" , e ) ; } } if ( isInitiator ) { return sDesControl . initiatorSelectAttribute ( peerAttributes ) ; } else { return sDesControl . responderSelectAttribute ( peerAttributes ) ; } }
Returns the selected crypto suite selected.
Returns the selected crypto suite selected .