示例#1
0
        private void HandleHandsetMsg(object sender, HandsetMsgArgs args)
        {
            HandsetNotifyMsg notify = args.Message as HandsetNotifyMsg;

            if (notify == null)
            {
                return;
            }

            switch (notify.MsgNotifyCode)
            {
            case HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_CALLSTATE:
                HandsetNotifyCallStateMsg statemsg = notify as HandsetNotifyCallStateMsg;
                HandleCallStateMsg(statemsg);
                break;

            case HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_INFO:
                HandsetNotifyInfoMsg info = notify as HandsetNotifyInfoMsg;
                if (info != null)
                {
                    OnHandsetAddrInfoUpdated(info);
                }
                break;

            case HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_ONLINE:
                RunSIPUA(CaptureDevice, PlaybakDevice);
                break;
            }
        }
示例#2
0
        private void OnReceiveMsg(object sender, ReceivedMessageEventArgs args)
        {
            HandsetMsg msg;

            HandsetNotifyMsg notify = JsonConvert.DeserializeObject <HandsetNotifyMsg>(args.Message);

            switch (notify.MsgNotifyCode)
            {
            case HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_INFO:
                msg = JsonConvert.DeserializeObject <HandsetNotifyInfoMsg>(args.Message);
                break;

            case HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_CALLSTATE:
                msg = JsonConvert.DeserializeObject <HandsetNotifyCallStateMsg>(args.Message);
                break;

            default:
                msg = notify;
                break;
            }

            if (msg != null && MsgReceived != null)
            {
                MsgReceived(this, new HandsetMsgArgs(msg));
            }
        }
示例#3
0
        public MainForm(string[] args)
        {
            InitializeComponent();
            regStateButton.BackColor = Color.DarkGray;

            _accountId     = -1;
            _callId        = -1;
            _recordId      = -1;
            _runBackground = false;

            ParseArgs(args);

            labelIncomeMsgQueu.Text = _pipeName;

            if (!string.IsNullOrEmpty(_pipeName))
            {
                _pipe = new NamedPipeClient(_pipeName);
                _pipe.OnReceivedMessage += OnReceiveMsg;
                _pipe.Start();

                HandsetNotifyMsg msg = new HandsetNotifyMsg();
                msg.MsgNotifyCode = HANDSETMSG_NOTIFY_CODE.MSG_NOTIFY_ONLINE;
                SendMessage(msg);
            }

            if (_runBackground)
            {
                this.WindowState = FormWindowState.Minimized;
            }
        }