コード例 #1
0
        protected void RegisterOutgoingRequest(Requests.OutgoingCallRequest request)
        {
            if ((request.Source!=default(PhoneNumber) && request.Target!=default(PhoneNumber))&&
                (GetCallInfo(request.Source) == null && GetConnectionInfo(request.Source) == null))
            {
                var callInfo = new CallInfo()
                {
                    Source = request.Source,
                    Target = request.Target,
                    Started = DateTime.Now
                };

                ITerminal targetTerminal = GetTerminalByPhoneNumber(request.Target);
                IPort targetPort = GetPortByPhoneNumber(request.Target);

                if (targetPort.State == PortState.Free)
                {
                    _connectionCollection.Add(callInfo);
                    targetPort.State = PortState.Busy;
                    targetTerminal.IncomingRequestFrom(request.Source);
                }
                else
                {
                    OnCallInfoPrepared(this, callInfo);
                }
            }
        }
コード例 #2
0
 protected virtual void OnCallInfoPrepared(object sender, CallInfo callInfo)
 {
     if (CallInfoPrepared != null)
     {
         CallInfoPrepared(sender, callInfo);
     }
 }
コード例 #3
0
 protected void InterruptConnection(CallInfo callInfo)
 {
     this._callCollection.Remove(callInfo);
     SetPortStateWhenConnectionInterrupted(callInfo.Source, callInfo.Target);
     OnCallInfoPrepared(this, callInfo);
 }
コード例 #4
0
 protected void MakeCallActive(CallInfo callInfo)
 {
     this._connectionCollection.Remove(callInfo);
     callInfo.Started = DateTime.Now;
     this._callCollection.Add(callInfo);
 }
コード例 #5
0
 protected void InterruptActiveCall(CallInfo callInfo)
 {
     callInfo.Duration = DateTime.Now - callInfo.Started;
     this._callCollection.Remove(callInfo);
     SetPortStateWhenConnectionInterrupted(callInfo.Source, callInfo.Target);
     OnCallInfoPrepared(this, callInfo);
 }