Пример #1
0
 protected virtual void OnIncomRespond(object sender, Respond e)
 {
     IncomRespond?.Invoke(sender, e);
 }
Пример #2
0
 public void Answer()
 {
     if (Request == null) return;
     var respond = new Respond(Respond.Accept, this.Request);
     OnIncomRespond(this, respond);
        // OnOnline(this, EventArgs.Empty);
 }
Пример #3
0
 protected virtual void OnIncomRespond(object sender, Respond e)
 {
     IncomRespond?.Invoke(sender, e);
 }
Пример #4
0
        public void IncomingRespond(Respond incomingRespond)
        {
            OnIncomConnection(this, incomingRespond.Request);

            //Console.WriteLine("Current number:" + this.PhoneNumber);
            Console.WriteLine("Incoming Call From: " + incomingRespond.Request.Source);
            Console.WriteLine("Incoming Call To: " + incomingRespond.Request.Target);

            switch (incomingRespond.Code)
            {
                case Respond.Accept:
                    Console.WriteLine("Accepted");
                    OnCallAccepted(this, incomingRespond.Request);
                    break;
                case Respond.Drop:
                    Console.WriteLine("Dropped");
                    OnDropConnection(this, incomingRespond.Request);
                    break;
                default:
                    break;
            }
        }
Пример #5
0
 public void Drop()
 {
     if (this.Request == null) return;
     var respond = new Respond(Respond.Drop, this.Request);
     OnIncomRespond(this, respond);
     //OnOffline(this, EventArgs.Empty);
 }
Пример #6
0
        public void OnIncomingCallRespond(object sender, Respond respond)
        {
            Console.WriteLine("Respond ok");
            Console.WriteLine(respond);

            var registeredCallInfo = GetLastConnectionInfo(respond.Request.Source);
            if (registeredCallInfo == null) return;
            if (registeredCallInfo.Target != respond.Request.Target) return;

            var targetTerminal = GetTerminal(respond.Request.Source);
            targetTerminal.IncomingRespond(respond);
            switch (respond.Code)
            {
                case Respond.Accept:
                    Console.WriteLine("Accept");
                    break;
                case Respond.Drop:
                    Console.WriteLine("Drop");
                    this.InterruptConnection(registeredCallInfo);
                    break;

                default:
                    break;
            }
        }