src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
/**
     * Updates the supplied media description with ZRTP hello hash if necessary.
     *
     * @param mediaType the media type.
     * @param localMd the media description to update.
     * @return <tt>true</tt> if ZRTP is added to the media description;
     * <tt>false</tt>, otherwise.
     */
Updates the supplied media description with ZRTP hello hash if necessary.
@param mediaType the media type.
@param localMd the media description to update.
@return true if ZRTP is added to the media description;
false, otherwise.
Updates the supplied media description with ZRTP hello hash if necessary . @param mediaType the media type . @param localMd the media description to update . @return true if ZRTP is added to the media description ; false otherwise .
private boolean updateMediaDescriptionForZrtp(
            MediaType mediaType,
            MediaDescription localMd)
    {
        MediaAwareCallPeer<?, ?, ?> peer = getPeer();
        AccountID accountID = peer.getProtocolProvider().getAccountID();
        boolean b = false;
        if(accountID.getAccountPropertyBoolean(
                    ProtocolProviderFactory.DEFAULT_ENCRYPTION,
                    true)
                && accountID.isEncryptionProtocolEnabled(SrtpControlType.ZRTP)
                && peer.getCall().isSipZrtpAttribute())
        {
            ZrtpControl zrtpControl
                = (ZrtpControl)
                    getSrtpControls().getOrCreate(
                            mediaType,
                            SrtpControlType.ZRTP);
            int numberSupportedVersions
                = zrtpControl.getNumberSupportedVersions();
            try
            {
                for (int i = 0; i < numberSupportedVersions; i++)
                {
                    String helloHash = zrtpControl.getHelloHash(i);
                    if ((helloHash != null) && helloHash.length() > 0)
                    {
                        localMd.setAttribute(
                                SdpUtils.ZRTP_HASH_ATTR,
                                helloHash);
                        /*
                         * Will return true if at least one zrtp-hash has been
                         * set.
                         */
                        b = true;
                    }
                }
            }
            catch (SdpException ex)
            {
                logger.error("Cannot add zrtp-hash to sdp", ex);
            }
        }
        return b;
    }
private boolean updateMediaDescriptionForZrtp ( MediaType mediaType , MediaDescription localMd ) { MediaAwareCallPeer < ? , ? , ? > peer = getPeer ( ) ; AccountID accountID = peer . getProtocolProvider ( ) . getAccountID ( ) ; boolean b = false ; if ( accountID . getAccountPropertyBoolean ( ProtocolProviderFactory . DEFAULT_ENCRYPTION , true ) && accountID . isEncryptionProtocolEnabled ( SrtpControlType . ZRTP ) && peer . getCall ( ) . isSipZrtpAttribute ( ) ) { ZrtpControl zrtpControl = ( ZrtpControl ) getSrtpControls ( ) . getOrCreate ( mediaType , SrtpControlType . ZRTP ) ; int numberSupportedVersions = zrtpControl . getNumberSupportedVersions ( ) ; try { for ( int i = 0 ; i < numberSupportedVersions ; i ++ ) { String helloHash = zrtpControl . getHelloHash ( i ) ; if ( ( helloHash != null ) && helloHash . length ( ) > 0 ) { localMd . setAttribute ( SdpUtils . ZRTP_HASH_ATTR , helloHash ) ; /*
                         * Will return true if at least one zrtp-hash has been
                         * set.
                         */ b = true ; } } } catch ( SdpException ex ) { logger . error ( "Cannot add zrtp-hash to sdp" , ex ) ; } } return b ; }
Updates the supplied media description with ZRTP hello hash if necessary.
Updates the supplied media description with ZRTP hello hash if necessary .