private void TryToCallPortToExchangeEvent(TryToCallPortToExchangeEventArgs e) { if (TryCallPortToExchangeEventHandler != null) { TryCallPortToExchangeEventHandler(this, e); } }
private void PortOnTryCallPortToExchangeEventHandler(object?sender, TryToCallPortToExchangeEventArgs e) { Port neededPort = GetPortByPhoneNumber(e.OutPhone); if (neededPort.State == PortState.Connect) { CallInfo call = new CallInfo { Duration = null, InPhoneNumber = e.PhoneNumber, OutPhoneNumber = e.OutPhone, StartCall = DateTime.Now, Guid = Guid.NewGuid() }; _callsInfo.Add(call); // Добовляем в биллинговую систему CallExchandeToPortEvent(new CallExchandeToPortEventArgs { CallInfo = call, PortID = GetPortByPhoneNumber(e.OutPhone).PortId }); //звонок начинаем } else { EndToTryCallExchandeToPortEvent(new EndToTryCallExchandeToPortEventArgs { PhoneNumber = e.PhoneNumber, PortID = GetPortByPhoneNumber(e.PhoneNumber).PortId }); //закканчиваем звонок } }