예제 #1
0
        private void btnRedirectToHandset_Click(object sender, RoutedEventArgs e)
        {
            Handset handset = _sysytem.GetIdleHandset();

            if (handset == null)
            {
                return;
            }

            handset.TransferAnswer(_sysytem.AccountId, _channel.CallId, _sysytem.Setting.AccountUser);
        }
예제 #2
0
        /// <summary>
        /// Build and persist a new <see cref="Handset"/>.
        /// </summary>
        /// <param name="handsetNumber">A new <see cref="Handset"/></param>
        /// <returns>The persisted <see cref="Handset"/>.</returns>
        public Handset CreateHandset(string handsetNumber)
        {
            var handset = new Handset
            {
                HandsetNumber = handsetNumber
            };

            this._persistence.GetRepository <Handset>().Add(handset);
            this._persistence.Commit();

            return(handset);
        }
        /// <summary>
        /// Build and persist a new <see cref="Handset"/>.
        /// </summary>
        /// <param name="handsetNumber">A new <see cref="Handset"/></param>
        /// <returns>The persisted <see cref="Handset"/>.</returns>
        public Handset CreateHandset(string handsetNumber)
        {
            var handset = new Handset
            {
                HandsetNumber = handsetNumber
            };

            this._persistence.GetRepository<Handset>().Add(handset);
            this._persistence.Commit();

            return handset;
        }
예제 #4
0
        private void OnHandsetHookStateChanged(object sender, HandsetOffHookArgs args)
        {
            Log.Debug("_____SpnvPage.xaml.cs___OnHandsetHookStateChanged__start");
            Handset handset = sender as Handset;

            if (handset == null)
            {
                return;
            }

            if (_subsystem.LeftHandsetInfo.Id == args.Id)
            {
                _subsystem.LeftHandsetInfo.IsOffHook = args.IsOffhook;
            }
            else
            {
                _subsystem.RightHandsetInfo.IsOffHook = args.IsOffhook;
            }

            if (handset.IsOffHook)
            {
                Channel channel = _subsystem.Channels.GetInboundRingingChannel();
                if (channel == null)
                {
                    return;
                }
                channel.IsRediect2Handset = true;

                this.Dispatcher.Invoke(DispatcherPriority.Normal,
                                       new Action(
                                           () => handset.Answer(_subsystem.AccountId, channel.CallId, _subsystem.Setting.AccountUser)
                                           ));
            }
            else
            {
                this.Dispatcher.Invoke(DispatcherPriority.Normal,
                                       new Action(
                                           () => handset.Hangup()
                                           ));
            }
            Log.Debug("_____SpnvPage.xaml.cs___OnHandsetHookStateChanged__end");
        }