Exemplo n.º 1
0
        public void Drop(object sender, ICallInfo callInfo)
        {
            MessageHandler?.Invoke(sender, $"Соединение абонента {callInfo.ClientNumberOfTelephone} c абонентом {callInfo.OutgoingNumber} сброшено, абонент надоступен");
            IPort port = Ports.FirstOrDefault(x => x.Terminal.ClientNumberOfTelephone == callInfo.ClientNumberOfTelephone);

            if (port != null)
            {
                port.RidPort();
            }
            callInfo = null;
        }
Exemplo n.º 2
0
 public void DropCall(object sender, ICallInfo callInfo)
 {
     try
     {
         IPort port1 = PortController_.Ports.FirstOrDefault(x => x.Terminal.ClientNumberOfTelephone == callInfo.ClientNumberOfTelephone);
         IPort port2 = PortController_.Ports.FirstOrDefault(x => x.Terminal.ClientNumberOfTelephone == callInfo.OutgoingNumber);
         port1.RidPort();
         port2.RidPort();
         MessageHandler(this, $"Абонент {callInfo.OutgoingNumber} отклонил вызов от абонента {callInfo.ClientNumberOfTelephone}");
     }
     catch
     {
         throw new Exception("Exception on method DropCall");
     }
 }
Exemplo n.º 3
0
 public void ConnectionCompletion(object sender, ICallInfo callInfo)
 {
     try
     {
         IConnection connection = OnlineConnections.FirstOrDefault(x => x.ClientNumberOfTelephone == callInfo.ClientNumberOfTelephone && x.OutgoingNumber == callInfo.OutgoingNumber);
         if (connection != null)
         {
             connection.FinishConnection   = DateTime.Now;
             connection.DurationConnection = connection.FinishConnection - connection.StartConnection;
             OnlineConnections.Remove(connection);
             СompletedConnections.Add(connection);
             SaveConnection?.Invoke(sender, connection);
             IPort port1 = PortController_.Ports.FirstOrDefault(x => x.Terminal.ClientNumberOfTelephone == callInfo.ClientNumberOfTelephone);
             IPort port2 = PortController_.Ports.FirstOrDefault(x => x.Terminal.ClientNumberOfTelephone == callInfo.OutgoingNumber);
             port1.RidPort();
             port2.RidPort();
             MessageHandler(this, $"Завершено соединение абонента {callInfo.ClientNumberOfTelephone} с абонентом {callInfo.OutgoingNumber}");
         }
     }
     catch
     {
         throw new Exception("Exception on method ConnectionCompletion");
     }
 }