src/net/java/sip/communicator/service/protocol/SingleCallInProgressPolicy.java
/**
     * Notifies this instance that an incoming <tt>Call</tt> has been received.
     *
     * @param ev a <tt>CallEvent</tt> which describes the received incoming
     * <tt>Call</tt>
     */
Notifies this instance that an incoming Call has been received.
@param ev a CallEvent which describes the received incoming
Call
Notifies this instance that an incoming Call has been received . @param ev a CallEvent which describes the received incoming Call
private void incomingCallReceived(CallEvent ev)
    {
        Call call = ev.getSourceCall();
        if (CallState.CALL_INITIALIZATION.equals(call.getCallState()))
        {
            ConfigurationService config
                = ProtocolProviderActivator.getConfigurationService();
            if (config.getBoolean(PNAME_CALL_WAITING_DISABLED, false))
            {
                boolean rejectCallWithBusyHere = false;
                synchronized (calls)
                {
                    for (Call otherCall : calls)
                    {
                        if (!call.equals(otherCall)
                                && CallState.CALL_IN_PROGRESS.equals(
                                        otherCall.getCallState()))
                        {
                            rejectCallWithBusyHere = true;
                            break;
                        }
                    }
                }
                if (rejectCallWithBusyHere)
                {
                    rejectCallWithBusyHere(call);
                    return;
                }
            }
            ProtocolProviderService provider = call.getProtocolProvider();
            if (config.getBoolean(PNAME_REJECT_IN_CALL_ON_DND, false)
                    || provider.getAccountID().getAccountPropertyBoolean(
                            ACCOUNT_PROPERTY_REJECT_IN_CALL_ON_DND,
                            false))
            {
                OperationSetPresence presence
                    = provider.getOperationSet(OperationSetPresence.class);
                if(presence == null)
                {
                    OperationSetCusaxUtils cusaxOpSet
                        = provider.getOperationSet(
                                OperationSetCusaxUtils.class);
                    if(cusaxOpSet != null)
                    {
                        ProtocolProviderService linkedCusaxProvider
                            = cusaxOpSet.getLinkedCusaxProvider();
                        if(linkedCusaxProvider != null)
                        {
                            presence
                                = linkedCusaxProvider.getOperationSet(
                                        OperationSetPresence.class);
                        }
                    }
                }
                if(presence != null)
                {
                    int presenceStatus
                        = (presence == null)
                            ? PresenceStatus.AVAILABLE_THRESHOLD
                            : presence.getPresenceStatus().getStatus();
                    if (presenceStatus > PresenceStatus.ONLINE_THRESHOLD
                        && presenceStatus <=
                                PresenceStatus.EXTENDED_AWAY_THRESHOLD)
                    {
                        rejectCallWithBusyHere(call);
                        return;
                    }
                }
            }
        }
        handleCallEvent(CallEvent.CALL_RECEIVED, call);
    }
private void incomingCallReceived ( CallEvent ev ) { Call call = ev . getSourceCall ( ) ; if ( CallState . CALL_INITIALIZATION . equals ( call . getCallState ( ) ) ) { ConfigurationService config = ProtocolProviderActivator . getConfigurationService ( ) ; if ( config . getBoolean ( PNAME_CALL_WAITING_DISABLED , false ) ) { boolean rejectCallWithBusyHere = false ; synchronized ( calls ) { for ( Call otherCall : calls ) { if ( ! call . equals ( otherCall ) && CallState . CALL_IN_PROGRESS . equals ( otherCall . getCallState ( ) ) ) { rejectCallWithBusyHere = true ; break ; } } } if ( rejectCallWithBusyHere ) { rejectCallWithBusyHere ( call ) ; return ; } } ProtocolProviderService provider = call . getProtocolProvider ( ) ; if ( config . getBoolean ( PNAME_REJECT_IN_CALL_ON_DND , false ) || provider . getAccountID ( ) . getAccountPropertyBoolean ( ACCOUNT_PROPERTY_REJECT_IN_CALL_ON_DND , false ) ) { OperationSetPresence presence = provider . getOperationSet ( OperationSetPresence . class ) ; if ( presence == null ) { OperationSetCusaxUtils cusaxOpSet = provider . getOperationSet ( OperationSetCusaxUtils . class ) ; if ( cusaxOpSet != null ) { ProtocolProviderService linkedCusaxProvider = cusaxOpSet . getLinkedCusaxProvider ( ) ; if ( linkedCusaxProvider != null ) { presence = linkedCusaxProvider . getOperationSet ( OperationSetPresence . class ) ; } } } if ( presence != null ) { int presenceStatus = ( presence == null ) ? PresenceStatus . AVAILABLE_THRESHOLD : presence . getPresenceStatus ( ) . getStatus ( ) ; if ( presenceStatus > PresenceStatus . ONLINE_THRESHOLD && presenceStatus <= PresenceStatus . EXTENDED_AWAY_THRESHOLD ) { rejectCallWithBusyHere ( call ) ; return ; } } } } handleCallEvent ( CallEvent . CALL_RECEIVED , call ) ; }
Notifies this instance that an incoming <tt>Call</tt> has been received.
Notifies this instance that an incoming <tt > Call< / tt > has been received .
// check whether we should hangup this call saying we are busy // already on call // if our provider has no presence op set, lets search for // connected provider which will have // There is no presence OpSet. Let's check the connected // CUSAX provider if available // we found the provider, let's take its presence // opset // between AVAILABLE and EXTENDED AWAY (>20, <= 31) are // the busy statuses as DND and On the phone