Exemple #1
0
        public override void onCallState(OnCallStateParam prm)
        {
            base.onCallState(prm);
            //lock (locker)
            {
                var ci = getInfo();

                if (ci == null)
                {
                    return;
                }

                if (ci.state == pjsip_inv_state.PJSIP_INV_STATE_INCOMING ||
                    LastState == pjsip_inv_state.PJSIP_INV_STATE_INCOMING)
                {
                    CallType = Type.INBOUND;
                }
                if (ci.state.In(pjsip_inv_state.PJSIP_INV_STATE_EARLY, pjsip_inv_state.PJSIP_INV_STATE_CALLING))
                {
                    CallType = Type.OUTBOUND;
                }

                NotifyCallState(ci.state);
                if (ci.state == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED)
                {
                    if (LastState == pjsip_inv_state.PJSIP_INV_STATE_INCOMING)
                    {
                        CallType = Type.MISSED;
                    }
                    /* Delete the call */
                    Dispose();
                }
                LastState = ci.state;
            }
        }
        private void NotifyCallState(Call call, pjsip_inv_state state)
        {
            if (call.State == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED)
            {
                // Update Call Log
                CallLogManager.CallLogs.Add(new CallLog(call).EndLog());
                if (CallLogPath != null)
                {
                    CallLogManager.SaveToFile(CallLogPath);
                }
            }

            /*if(
             *  (call.State.In(pjsip_inv_state.PJSIP_INV_STATE_CONNECTING,pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) && call.LastState == pjsip_inv_state.PJSIP_INV_STATE_INCOMING)
             ||
             || call.State == pjsip_inv_state.PJSIP_INV_STATE_CALLING)
             ||{
             || // Hold all active (non 'spying' calls)
             || holdAllCalls(false, new Dictionary<int,Call>() { {call.ID, call} } );
             ||}*/

            // Make sure someone is listening to event
            if (CallStateChange == null)
            {
                return;
            }
            CallStateChange(null, new CallStateEventArgs(call, state));
        }
Exemple #3
0
 private void NotifyCallState(pjsip_inv_state state)
 {
     // Make sure someone is listening to event
     if (CallStateChange == null)
     {
         return;
     }
     CallStateChange(null, new CallStateEventArgs(this, state));
 }
Exemple #4
0
        private void NotifyCallState(Call call, pjsip_inv_state state)
        {
            if (!calls.ContainsKey(call.ID))
            {
                calls.Add(call.ID, call);
            }
            if (state == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED)
            {
                calls.Remove(call.ID);
            }

            // Make sure someone is listening to event
            if (CallStateChange == null)
            {
                return;
            }
            CallStateChange(null, new CallStateEventArgs(call, state));
        }
 public CallStateEventArgs(Call call, pjsip_inv_state state)
 {
     Call  = call;
     State = state;
 }