コード例 #1
0
ファイル: Controller.cs プロジェクト: modulexcite/capi.net
        public IAsyncResult BeginConnect(string callingPartyNumber, string calledPartyNumber, CIPServices service,
            B1Protocol b1, B2Protocol b2, B3Protocol b3, AsyncCallback callback, object state) {
            try {
                ConnectRequest request = new ConnectRequest(_id);
                UInt16 CIPValue = 0;
                int s = (int)service;
                if (s != 0) {
                    do {
                        if ((s & 1) != 0) break;
                        s >>= 1;
                        CIPValue++;
                    } while (CIPValue < 31);
                }

                request.CIPValue = CIPValue;

                request.CalledPartyNumber = calledPartyNumber;
                request.CallingPartyNumber = callingPartyNumber;

                request.BPtotocol.B1 = b1;
                request.BPtotocol.B2 = b2;
                request.BPtotocol.B3 = b3;

                MessageAsyncResult result = new MessageAsyncResult(this, request, callback, state);
                _application.SendRequestMessage(result);
                _status = ControllerStatus.Connecting;
                return result;
            } catch (Exception e) {
                Trace.TraceError("Controller#{0}::BeginListen, Exception = {1}", ValidationHelper.HashString(this), e);
                throw;
            }
        }
コード例 #2
0
ファイル: Controller.cs プロジェクト: modulexcite/capi.net
 /// <summary>
 /// Call calledPartyNumber.
 /// </summary>
 /// <param name="callingPartyNumber">our number</param>
 /// <param name="calledPartyNumber">called party number</param>
 /// <returns></returns>
 public Connection Connect(string callingPartyNumber, string calledPartyNumber, CIPServices service,
     B1Protocol b1, B2Protocol b2, B3Protocol b3) {
     IAsyncResult asyncResult;
     try {
         asyncResult = BeginConnect(callingPartyNumber, calledPartyNumber, service, b1, b2, b3, null, null);
         if (((_timeout != -1) && !asyncResult.IsCompleted) && (!asyncResult.AsyncWaitHandle.WaitOne(_timeout, false) || !asyncResult.IsCompleted)) {
             throw new TimeoutException("Connect");
         }
         return EndConnect(asyncResult);
     } catch (Exception e) {
         Trace.TraceError("Controller#{0}::Call, Exception = {1}", ValidationHelper.HashString(this), e);
         throw;
     }
 }
コード例 #3
0
ファイル: Controller.cs プロジェクト: modulexcite/capi.net
        public IAsyncResult BeginConnect(string callingPartyNumber, string calledPartyNumber, CIPServices service,
                                         B1Protocol b1, B2Protocol b2, B3Protocol b3, AsyncCallback callback, object state)
        {
            try {
                ConnectRequest request  = new ConnectRequest(_id);
                UInt16         CIPValue = 0;
                int            s        = (int)service;
                if (s != 0)
                {
                    do
                    {
                        if ((s & 1) != 0)
                        {
                            break;
                        }
                        s >>= 1;
                        CIPValue++;
                    } while (CIPValue < 31);
                }

                request.CIPValue = CIPValue;

                request.CalledPartyNumber  = calledPartyNumber;
                request.CallingPartyNumber = callingPartyNumber;

                request.BPtotocol.B1 = b1;
                request.BPtotocol.B2 = b2;
                request.BPtotocol.B3 = b3;

                MessageAsyncResult result = new MessageAsyncResult(this, request, callback, state);
                _application.SendRequestMessage(result);
                _status = ControllerStatus.Connecting;
                return(result);
            } catch (Exception e) {
                Trace.TraceError("Controller#{0}::BeginListen, Exception = {1}", ValidationHelper.HashString(this), e);
                throw;
            }
        }
コード例 #4
0
ファイル: Controller.cs プロジェクト: modulexcite/capi.net
        /// <summary>
        /// Call calledPartyNumber.
        /// </summary>
        /// <param name="callingPartyNumber">our number</param>
        /// <param name="calledPartyNumber">called party number</param>
        /// <returns></returns>
        public Connection Connect(string callingPartyNumber, string calledPartyNumber, CIPServices service,
                                  B1Protocol b1, B2Protocol b2, B3Protocol b3)
        {
            IAsyncResult asyncResult;

            try {
                asyncResult = BeginConnect(callingPartyNumber, calledPartyNumber, service, b1, b2, b3, null, null);
                if (((_timeout != -1) && !asyncResult.IsCompleted) && (!asyncResult.AsyncWaitHandle.WaitOne(_timeout, false) || !asyncResult.IsCompleted))
                {
                    throw new TimeoutException("Connect");
                }
                return(EndConnect(asyncResult));
            } catch (Exception e) {
                Trace.TraceError("Controller#{0}::Call, Exception = {1}", ValidationHelper.HashString(this), e);
                throw;
            }
        }