private void Port_OnCall(CallInfo callInfo) { ISubscriber subscriber = _billingSystem.GetSubscriberBy(callInfo.SourcePhoneNumber); ISubscriber targetSubscriber = _billingSystem.GetSubscriberBy(callInfo.TargetPhoneNumber); if (subscriber == null) { throw new NullReferenceException($"Subscriber with phoneNumber {callInfo.SourcePhoneNumber} not found!"); } if (targetSubscriber == null) { throw new NullReferenceException($"Subscriber with phoneNumber {callInfo.TargetPhoneNumber} not found!"); } if (subscriber.State == SubscriberState.Blocked) { subscriber.Port.CallResponce("Your phone number is bloked."); return; } if (targetSubscriber.State == SubscriberState.Blocked) { subscriber.Port.CallResponce("The subscriber you are calling is temporarily blocked."); return; } if (CallController.CheckStatePortsSubscribers(subscriber, targetSubscriber)) { callInfo.LimitCallDuraction = _billingSystem.GetLimitCallDuraction(subscriber); targetSubscriber.Port.InComingCall(callInfo); } }