private void CallStation(object sender, CallRequestNumber e) { var portSource = sender as IPort; var portTarget = Ports[e.Number]; if (portSource != null && portTarget != null && portSource != portTarget && _sessionContainer.IsOpenedSession(portSource, portTarget)) { portTarget.StateCall = PortStateCall.Dialing; _sessionContainer.Add(new Session(portSource, portTarget)); portTarget.IncomingCallPort(portTarget, null); } else { if (portSource == null) { Console.WriteLine("Source port doesn't exist"); } if (portTarget == null) { Console.WriteLine("Target port doesn't exist"); } if (portSource == portTarget) { Console.WriteLine("Port is already in use"); } Console.WriteLine("Connection not made"); } }