src/net/java/sip/communicator/service/protocol/media/MediaAwareCall.java
/**
     * Creates a new <tt>Recorder</tt> which is to record this <tt>Call</tt>
     * (into a file which is to be specified when starting the returned
     * <tt>Recorder</tt>).
     *
     * @return a new <tt>Recorder</tt> which is to record this <tt>Call</tt>
     * (into a file which is to be specified when starting the returned
     * <tt>Recorder</tt>)
     * @throws OperationFailedException if anything goes wrong while creating
     * the new <tt>Recorder</tt> for this <tt>Call</tt>
     */
Creates a new Recorder which is to record this Call
(into a file which is to be specified when starting the returned
Recorder).

@return a new Recorder which is to record this Call
(into a file which is to be specified when starting the returned
Recorder)
@throws OperationFailedException if anything goes wrong while creating
the new Recorder for this Call
Creates a new Recorder which is to record this Call ( into a file which is to be specified when starting the returned Recorder ) . @return a new Recorder which is to record this Call ( into a file which is to be specified when starting the returned Recorder ) @throws OperationFailedException if anything goes wrong while creating the new Recorder for this Call
public Recorder createRecorder()
        throws OperationFailedException
    {
        final Recorder recorder
            = ProtocolMediaActivator.getMediaService().createRecorder(
                    getDefaultDevice(MediaType.AUDIO));
        if (recorder != null)
        {
            final PropertyChangeListener muteListener
                = new PropertyChangeListener()
            {
                public void propertyChange(PropertyChangeEvent evt)
                {
                    if(evt.getPropertyName()
                        .equals(CallPeer.MUTE_PROPERTY_NAME))
                    {
                        updateRecorderMuteState(recorder);
                    }
                }
            };
            final CallChangeListener callChangeListener
                = new CallChangeListener()
                {
                    /**
                     * When call ends we stop recording.
                     * @param evt the <tt>CallChangeEvent</tt> instance
                     * containing the source
                     */
                    public void callStateChanged(CallChangeEvent evt)
                    {
                        if (!CallChangeEvent.CALL_STATE_CHANGE
                                .equals(evt.getPropertyName()))
                            return;
                        if (CallState.CALL_ENDED.equals(evt.getNewValue()))
                            recorder.stop();
                    }
                    /**
                     * We listen for mute on newly added call peers.
                     * @param evt the <tt>CallPeerEvent</tt> containing
                     * the source call
                     */
                    public void callPeerAdded(CallPeerEvent evt)
                    {
                        updateRecorderMuteState(recorder);
                        evt.getSourceCallPeer()
                            .addPropertyChangeListener(muteListener);
                    }
                    /**
                     * We stop listen for mute on removed call peers.
                     * @param evt the <tt>CallPeerEvent</tt> containing
                     * the source call
                     */
                    public void callPeerRemoved(CallPeerEvent evt)
                    {
                        updateRecorderMuteState(recorder);
                        evt.getSourceCallPeer()
                            .removePropertyChangeListener(muteListener);
                    }
                };
            addCallChangeListener(callChangeListener);
            Iterator<Recorder.Listener> iterListeners =
                ProtocolMediaActivator.getMediaService().getRecorderListeners();
            while(iterListeners.hasNext())
                recorder.addListener(iterListeners.next());
            /*
             * If the recorder gets stopped earlier than this call ends, don't
             * wait for the end of the call because callChangeListener will keep
             * a reference to the stopped recorder.
             */
            recorder.addListener(
                    new Recorder.Listener()
                    {
                        public void recorderStopped(Recorder recorder)
                        {
                            removeCallChangeListener(callChangeListener);
                            Iterator<Recorder.Listener> iter
                                = ProtocolMediaActivator.getMediaService()
                                    .getRecorderListeners();
                            while(iter.hasNext())
                                recorder.removeListener(iter.next());
                        }
                    });
            Iterator<T> iter = getCallPeers();
            while(iter.hasNext())
                iter.next().addPropertyChangeListener(muteListener);
            updateRecorderMuteState(recorder);
        }
        return recorder;
    }
public Recorder createRecorder ( ) throws OperationFailedException { final Recorder recorder = ProtocolMediaActivator . getMediaService ( ) . createRecorder ( getDefaultDevice ( MediaType . AUDIO ) ) ; if ( recorder != null ) { final PropertyChangeListener muteListener = new PropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent evt ) { if ( evt . getPropertyName ( ) . equals ( CallPeer . MUTE_PROPERTY_NAME ) ) { updateRecorderMuteState ( recorder ) ; } } } ; final CallChangeListener callChangeListener = new CallChangeListener ( ) { /**
                     * When call ends we stop recording.
                     * @param evt the <tt>CallChangeEvent</tt> instance
                     * containing the source
                     */ public void callStateChanged ( CallChangeEvent evt ) { if ( ! CallChangeEvent . CALL_STATE_CHANGE . equals ( evt . getPropertyName ( ) ) ) return ; if ( CallState . CALL_ENDED . equals ( evt . getNewValue ( ) ) ) recorder . stop ( ) ; } /**
                     * We listen for mute on newly added call peers.
                     * @param evt the <tt>CallPeerEvent</tt> containing
                     * the source call
                     */ public void callPeerAdded ( CallPeerEvent evt ) { updateRecorderMuteState ( recorder ) ; evt . getSourceCallPeer ( ) . addPropertyChangeListener ( muteListener ) ; } /**
                     * We stop listen for mute on removed call peers.
                     * @param evt the <tt>CallPeerEvent</tt> containing
                     * the source call
                     */ public void callPeerRemoved ( CallPeerEvent evt ) { updateRecorderMuteState ( recorder ) ; evt . getSourceCallPeer ( ) . removePropertyChangeListener ( muteListener ) ; } } ; addCallChangeListener ( callChangeListener ) ; Iterator < Recorder . Listener > iterListeners = ProtocolMediaActivator . getMediaService ( ) . getRecorderListeners ( ) ; while ( iterListeners . hasNext ( ) ) recorder . addListener ( iterListeners . next ( ) ) ; /*
             * If the recorder gets stopped earlier than this call ends, don't
             * wait for the end of the call because callChangeListener will keep
             * a reference to the stopped recorder.
             */ recorder . addListener ( new Recorder . Listener ( ) { public void recorderStopped ( Recorder recorder ) { removeCallChangeListener ( callChangeListener ) ; Iterator < Recorder . Listener > iter = ProtocolMediaActivator . getMediaService ( ) . getRecorderListeners ( ) ; while ( iter . hasNext ( ) ) recorder . removeListener ( iter . next ( ) ) ; } } ) ; Iterator < T > iter = getCallPeers ( ) ; while ( iter . hasNext ( ) ) iter . next ( ) . addPropertyChangeListener ( muteListener ) ; updateRecorderMuteState ( recorder ) ; } return recorder ; }
Creates a new <tt>Recorder</tt> which is to record this <tt>Call</tt>
 (into a file which is to be specified when starting the returned
 <tt>Recorder</tt>).
Creates a new <tt > Recorder< / tt > which is to record this <tt > Call< / tt > ( into a file which is to be specified when starting the returned <tt > Recorder< / tt > ) .
// listens for mute event to update recorder // Make sure the recorder is stopped when this call ends. // add listener for mute event to all current peers