Beispiel #1
0
 public void SetByCallState(IStateMachine callState)
 {
     SetIcon(callState);
       switch (callState.StateId)
       {
      case EStateId.ACTIVE:
         //_tray.ShowBalloonTip(10, "ACTIVE", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.ALERTING:
         _tray.ShowBalloonTip(10, "ALERTING", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.CONNECTING:
         //_tray.ShowBalloonTip(10, "CONNECTING", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.HOLDING:
         _tray.ShowBalloonTip(10, "HOLDING", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.IDLE:
         //_tray.ShowBalloonTip(10, "IDLE", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.INCOMING:
         _tray.ShowBalloonTip(10, "INCOMING", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.NULL:
         //_tray.ShowBalloonTip(10, "NULL", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.RELEASED:
         //_tray.ShowBalloonTip(10, "RELEASED", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
      case EStateId.TERMINATED:
         //_tray.ShowBalloonTip(10, "TERMINATED", callState.CallingName + " " + callState.CallingNumber, ToolTipIcon.Info);
         break;
       }
 }
Beispiel #2
0
        /// <summary>
        /// Make call click handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOutCall_Click(object sender, EventArgs e)
        {
            // check number of calls (allow only 1)
              if (_manager.Count > 0) return;

              // create call (local loop)
              outcall = _manager.createOutboundCall("sip:127.0.0.1");
        }
Beispiel #3
0
 private void callButton_Click(object sender, EventArgs e)
 {
     if (_currentCall.Incoming)
     {
       CallManager.onUserAnswer(_currentCall.Session);
     }
     else
     {
       _currentCall = CallManager.createOutboundCall(textBoxNumber.Text);
     }
 }
Beispiel #4
0
 private void CallStateRefresh(int sessionId)
 {
     callState = ITSCommResources.CallManager.getCall(sessionId);
     if (EStateId.RELEASED == callState.StateId)
         ReleaseCall();
     if (EStateId.IDLE == callState.StateId)
     { }
     if (EStateId.NULL == callState.StateId)
     {
         OnAccountStateChange.Invoke(ITSCommResources.Configurator.Accounts[0].RegState);
         if (0 < ITSCommResources.CallManager.getNoCallsInState(EStateId.HOLDING))
         {
             callState = ITSCommResources.CallManager.getCallInState(EStateId.HOLDING);
         }
     }
     OnCallStateRefresh.Invoke(callState.StateId);
 }
Beispiel #5
0
 public void RegisterAccount()
 {
     SubscribeEvents();
     int s = ITSCommResources.CallManager.Initialize();
     ITSCommResources.Registrar.registerAccounts();
     callState = ITSCommResources.CallManager.getCall(-1);
 }
Beispiel #6
0
 public void MakeCall(string number)
 {
     callState = ITSCommResources.CallManager.createOutboundCall(number);
 }
Beispiel #7
0
        private void CallStateRefreshed(int sessionId)
        {
            callState = SipekResources.CallManager.getCall(sessionId);
              RefreshUIByStatus();

              if (callState.StateId == EStateId.NULL)
              {
             _mainDispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(delegate()
             {
                btnCall.Content = "Call";
                btnCall.Background = converter.ConvertFromString("#FD890404") as Brush;
             }));
              }
              else if (callState.StateId == EStateId.INCOMING || callState.StateId == EStateId.ALERTING)
              {
             _mainDispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(delegate()
             {
                btnCall.Content = "Accept";
                btnCall.Background = converter.ConvertFromString("#FF890404") as Brush;
             }));
              }

              if (callState.StateId == EStateId.RELEASED)
              {
             ReleaseCall();
              }

              if (callState != null)
             _mainDispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(delegate()
             {
                Account.Tag = callState.StateId.ToString();
                Account.Background = converter.ConvertFromString("#Fd890404") as Brush;
             }));

              Notify.SetByCallState(callState);
        }
 void incommingCallForm_AnswerClick(int sessionId, string number, string info)
 {
     _call = sipResource.CallManager.getCall(sessionId);
     if (string.IsNullOrEmpty(info))
     {
         numberLabel.Text = number;
     }
     else
     {
         numberLabel.Text = info + "\n" + number;
     }
     sipResource.CallManager.onUserAnswer(sessionId);
 }
Beispiel #9
0
    /// <summary>
    /// Shutdown telephony and VoIP stack
    /// </summary>
    public void Shutdown()
    {
      IStateMachine [] callarr = new IStateMachine[CallList.Count];
      CallList.Values.CopyTo(callarr, 0);
      for (int i = 0; i < callarr.Length; i++)
      {
        callarr[i].destroy();
      }

      this.CallList.Clear();

      StackProxy.shutdown();
      _initialized = false;
      
      CallStateRefresh = null;
      IncomingCallNotification = null;

      ICallProxyInterface.CallStateChanged -= OnCallStateChanged;
      ICallProxyInterface.CallIncoming -= OnIncomingCall;
      ICallProxyInterface.CallNotification -= OnCallNotification;
      StackProxy.CallReplaced -= OnCallReplaced;
    }
Beispiel #10
0
        /* private void OnCallStateChanged(int callId, ESessionState callState, string info)
        {
            IStateMachine state = CallManager.CallList[callId];

            number = state.CallingNumber;

            textBoxCallState.Text = number;
                        
            string contact = contacts.lookup(number);
            if (contact != "")
                number = contact + " (" + number + ")";

            notifyIcon1.BalloonTipTitle = "Eingehender Anruf";
            notifyIcon1.BalloonTipText = "Von: " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);
        } */

        private void OnIncomingCall(int sessionId, string number, string info)
        {
            incall = CallManager.getCall(sessionId);
            string contact = contacts.lookup(number);
            if (contact != "")
                number = contact + " (" + number + ")";
            
            textBoxCallState.Text = incall.StateId.ToString();
            textBoxLastCallNumber.Text = number;
            textBoxLastCallDate.Text = DateTime.Now.ToString();

            notifyIcon1.BalloonTipTitle = "Eingehender Anruf";
            notifyIcon1.BalloonTipText = "Von: " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);

            /*
            // Send Busy
            ICallProxyInterface proxy = CallManager.StackProxy.createCallProxy();
            proxy.serviceRequest((int)EServiceCodes.SC_CFB, "");
            proxy.endCall();
             */
        }
Beispiel #11
0
        void CallManager_CallStateRefresh(int sessionId)
        {
            llamada=CallManager.getCall(sessionId);
            if (lblEstado.InvokeRequired)
                lblEstado.Invoke(new ThreadStart(delegate
                    {

                        MuestraDatosLlamada();
                    }));
            else
                MuestraDatosLlamada();
        }
Beispiel #12
0
 /// <summary>
 /// Incoming call callback. Just assign incall.
 /// </summary>
 /// <param name="sessionId"></param>
 /// <param name="number"></param>
 /// <param name="info"></param>
 void _manager_IncomingCallNotification(int sessionId, string number, string info)
 {
     // assign incoming call instance to member variable
       incall = _manager.getCall(sessionId);
 }
Beispiel #13
0
 void SetIcon(IStateMachine callState)
 {
     _blinking = EStateId.INCOMING == callState.StateId;
       switch (callState.StateId)
       {
      case EStateId.ACTIVE:
         _tray.Icon = Properties.Resources.Circle_Red;
         break;
      case EStateId.ALERTING:
         _tray.Icon = Properties.Resources.Circle_Orange;
         break;
      case EStateId.CONNECTING:
         _tray.Icon = Properties.Resources.Circle_Green;
         break;
      case EStateId.HOLDING:
         _tray.Icon = Properties.Resources.Circle_Blue;
         break;
      case EStateId.IDLE:
         _tray.Icon = Properties.Resources.Circle_Grey;
         break;
      case EStateId.INCOMING:
         _tray.Icon = Properties.Resources.Circle_Orange;
         break;
      case EStateId.NULL:
         _tray.Icon = Properties.Resources.Circle_Grey;
         break;
      case EStateId.RELEASED:
         _tray.Icon = Properties.Resources.Circle_Green;
         break;
      case EStateId.TERMINATED:
         _tray.Icon = Properties.Resources.Circle_Green;
         break;
       }
 }
Beispiel #14
0
 public CIdleState(IStateMachine sm) 
   : base(sm)
 {
   Id = EStateId.IDLE;
 }
Beispiel #15
0
 private void IncomingCall(int sessionId, string number, string info)
 {
     callState = ITSCommResources.CallManager.getCall(sessionId);
     OnIncomingCall.Invoke(callStateID, number, info + sessionId);
 }
Beispiel #16
0
        /* private void OnCallStateChanged(int callId, ESessionState callState, string info)
        {
            IStateMachine state = CallManager.CallList[callId];

            number = state.CallingNumber;

            textBoxCallState.Text = number;
                        
            string contact = contacts.lookup(number);
            if (contact != "")
                number = contact + " (" + number + ")";

            notifyIcon1.BalloonTipTitle = "Eingehender Anruf";
            notifyIcon1.BalloonTipText = "Von: " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);
        } */

        private void OnIncomingCall(int sessionId, string number, string info)
        {
            incall = CallManager.getCall(sessionId);
            //string contact = contacts.lookup(number);
            //if (contact != "")
            //  number = contact + " (" + number + ")";

            CallStatus.Content = incall.StateId.ToString();
            
            // TODO put the code here to put the call in the DB
            Database  db =  new Database();
            string name = incall.CallingName;
            db.AddCall(name, number);
            DataContext = new CallViewModel();
            //textBoxLastCallNumber.Text = number;
            //textBoxLastCallDate.Text = DateTime.Now.ToString();

            notifyIcon1.BalloonTipTitle = "New Call";
            notifyIcon1.BalloonTipText = "From: " + name + " " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);

            /*
            // Send Busy
            ICallProxyInterface proxy = CallManager.StackProxy.createCallProxy();
            proxy.serviceRequest((int)EServiceCodes.SC_CFB, "");
            proxy.endCall();
             */
        }
Beispiel #17
0
        private void CallManager_IncomingCallNotification(int sessionId, string number, string info)
        {
            llamada = CallManager.getCall(sessionId);
            if (lblEstado.InvokeRequired)
                lblEstado.Invoke(new ThreadStart(delegate
                {

                    MuestraDatosLlamada();
                }));
            else
                MuestraDatosLlamada();
        }
Beispiel #18
0
 /// <summary>
 /// Abstract state construction.
 /// </summary>
 /// <param name="sm">reference to call state machine</param>
 public IAbstractState(IStateMachine sm)
 {
   _smref = sm;
 }
Beispiel #19
0
 private void buttonMakeCall_Click(object sender, EventArgs e)
 {
     _call = CallManager.createOutboundCall(textBoxDial.Text);
 }
        private void callButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(callDestinationTextBox.Text) && isDefaultAccountRegistered())
            {
                switch (action)
                {
                    case ActionToExecute.Call:
                        _call = SipResource.CallManager.createOutboundCall(numberLabel.Text);
                        break;
                    case ActionToExecute.Transfer:
                        sipResource.CallManager.onUserTransfer(_call.Session, numberLabel.Text);
                        accountLabel.Text = string.Empty;
                        action = ActionToExecute.Call;
                        break;
                    default:
                        break;
                }

            }
        }
Beispiel #21
0
 void sync_IncomingCall(int sessionId, string number, string info)
 {
     _currentCall = CallManager.getCall(sessionId);
     statusBar1.Text += " call from " + number;
 }
 private void redialButton_Click(object sender, EventArgs e)
 {
     if (_call != null && _call.StateId == EStateId.IDLE)
     {
         CCallRecord record = sipResource.CallLogger.getList().Peek();
         //OnCallKeyPress(record.Number);
         _call = sipResource.CallManager.createOutboundCall(record.Number);
     }
 }
Beispiel #23
0
 private void CallManager_IncomingCallNotification(int sessionId, string number, string info)
 {
     callState = SipekResources.CallManager.getCall(sessionId);
       OnIncomingCall(sessionId, number, info);
 }