示例#1
0
 /// <summary>
 /// Ответ на входящий вызов
 /// </summary>
 private void Answer()
 {
     if (ring != null)
     {
         ring.Stop = true;
         ring      = null;
     }
     if (currentCall != null)
     {
         CallOpParam prm = new CallOpParam();
         prm.statusCode = pjsip_status_code.PJSIP_SC_OK;
         currentCall.answer(prm);
         SetCallButtonState(CallButtonState.Hungup);
     }
 }
示例#2
0
 /// <summary>
 /// Обработка разрыва соединения
 /// </summary>
 /// <param name="call"></param>
 private void CallDisconnect(PjsipCall call)
 {
     if (InvokeRequired)
     {
         CallDisconnected cd = new CallDisconnected(CallDisconnect);
         Invoke(cd, new object[] { call });
     }
     else
     {
         currentCall.Dispose();
         currentCall = null;
         SetCallButtonState(string.IsNullOrWhiteSpace(tbNumber.Text) ?
                            CallButtonState.Disable : CallButtonState.Call);
         if (ring != null)
         {
             ring.Stop = true;
             ring      = null;
         }
     }
 }
示例#3
0
 /// <summary>
 /// Обработка входящего вызова
 /// </summary>
 /// <param name="acc"></param>
 /// <param name="callId"></param>
 private void IncomingCall(PjsipAccount acc, PjsipCall call, int callId)
 {
     if (InvokeRequired)
     {
         AccountIncomingCall ic = new AccountIncomingCall(IncomingCall);
         Invoke(ic, new object[] { acc, call, callId });
     }
     else
     {
         try
         {
             if (currentCall != null && currentCall.IsOnline)
             {
                 CallOpParam prm = new CallOpParam();
                 prm.statusCode = pjsip_status_code.PJSIP_SC_BUSY_HERE;
                 call.answer(prm);
                 call.Dispose();
             }
             else
             {
                 SelectAccount(acc);
                 currentCall = call;
                 currentCall.OnCallIncoming     = CallIncomingInfo;
                 currentCall.OnCallDisconnected = CallDisconnect;
                 SetCallButtonState(CallButtonState.Ring);
                 ring = new PjsipRing();
             }
         }
         catch
         {
             if (currentCall != null)
             {
                 Hungup();
             }
         }
     }
 }