src/net/java/sip/communicator/service/protocol/SingleCallInProgressPolicy.java
/**
     * Handles changes in the state of a <tt>Call</tt> this policy applies to in
     * order to detect when new calls become in-progress and when the other
     * calls should be put on hold.
     *
     * @param ev a <tt>CallChangeEvent</tt> value which describes the
     * <tt>Call</tt> and the change in its state
     */
Handles changes in the state of a Call this policy applies to in
order to detect when new calls become in-progress and when the other
calls should be put on hold.

@param ev a CallChangeEvent value which describes the
Call and the change in its state
Handles changes in the state of a Call this policy applies to in order to detect when new calls become in - progress and when the other calls should be put on hold . @param ev a CallChangeEvent value which describes the Call and the change in its state
private void callStateChanged(CallChangeEvent ev)
    {
        Call call = ev.getSourceCall();
        if(logger.isTraceEnabled())
        {
            logger.trace("Call state changed.");
        }
        if (CallState.CALL_INITIALIZATION.equals(ev.getOldValue())
                && CallState.CALL_IN_PROGRESS.equals(call.getCallState()))
        {
            CallConference conference = call.getConference();
            synchronized (calls)
            {
                for (Call otherCall : calls)
                {
                    if (!call.equals(otherCall)
                            && CallState.CALL_IN_PROGRESS.equals(
                                    otherCall.getCallState()))
                    {
                        /*
                         * Only put on hold calls which are visually distinctive
                         * from the specified call i.e. do not put on hold calls
                         * which participate in the same telephony conference as
                         * the specified call.
                         */
                        boolean putOnHold;
                        CallConference otherConference
                            = otherCall.getConference();
                        if (conference == null)
                            putOnHold = (otherConference == null);
                        else
                            putOnHold = (conference != otherConference);
                        if (putOnHold)
                            putOnHold(otherCall);
                    }
                }
            }
        }
        else if (CallState.CALL_ENDED.equals(ev.getNewValue()))
        {
            this.handleCallEvent(CallEvent.CALL_ENDED, call);
        }
        /*
         * Forward to onThePhoneStatusPolicy for which we are proxying the
         * Call-related events.
         */
        onThePhoneStatusPolicy.callStateChanged(ev);
    }
private void callStateChanged ( CallChangeEvent ev ) { Call call = ev . getSourceCall ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Call state changed." ) ; } if ( CallState . CALL_INITIALIZATION . equals ( ev . getOldValue ( ) ) && CallState . CALL_IN_PROGRESS . equals ( call . getCallState ( ) ) ) { CallConference conference = call . getConference ( ) ; synchronized ( calls ) { for ( Call otherCall : calls ) { if ( ! call . equals ( otherCall ) && CallState . CALL_IN_PROGRESS . equals ( otherCall . getCallState ( ) ) ) { /*
                         * Only put on hold calls which are visually distinctive
                         * from the specified call i.e. do not put on hold calls
                         * which participate in the same telephony conference as
                         * the specified call.
                         */ boolean putOnHold ; CallConference otherConference = otherCall . getConference ( ) ; if ( conference == null ) putOnHold = ( otherConference == null ) ; else putOnHold = ( conference != otherConference ) ; if ( putOnHold ) putOnHold ( otherCall ) ; } } } } else if ( CallState . CALL_ENDED . equals ( ev . getNewValue ( ) ) ) { this . handleCallEvent ( CallEvent . CALL_ENDED , call ) ; } /*
         * Forward to onThePhoneStatusPolicy for which we are proxying the
         * Call-related events.
         */ onThePhoneStatusPolicy . callStateChanged ( ev ) ; }
Handles changes in the state of a <tt>Call</tt> this policy applies to in
 order to detect when new calls become in-progress and when the other
 calls should be put on hold.
Handles changes in the state of a <tt > Call< / tt > this policy applies to in order to detect when new calls become in - progress and when the other calls should be put on hold .