Beispiel #1
0
 void ICapiSerializable.Read(BinaryReader reader) {
     byte lenght = reader.ReadByte();
     Debug.Assert(lenght == Length);
     _b1 = (B1Protocol)reader.ReadInt16();
     _b2 = (B2Protocol)reader.ReadInt16();
     _b3 = (B3Protocol)reader.ReadInt16();
 }
Beispiel #2
0
        void ICapiSerializable.Read(BinaryReader reader)
        {
            byte lenght = reader.ReadByte();

            Debug.Assert(lenght == Length);
            _b1 = (B1Protocol)reader.ReadInt16();
            _b2 = (B2Protocol)reader.ReadInt16();
            _b3 = (B3Protocol)reader.ReadInt16();
        }
Beispiel #3
0
 /// <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;
     }
 }
Beispiel #4
0
        public void Answer(Reject reject, B1Protocol b1, B2Protocol b2, B3Protocol b3)
        {
            Debug.Assert(_status == ConnectionStatus.D_ConnectPending);
            if (_connectIndication == null || _status != ConnectionStatus.D_ConnectPending)
            {
                throw new NotSupportedException("Connection is not in the right state.");
            }
            ConnectResponse response = new ConnectResponse(_connectIndication);

            _connectIndication    = null;
            response.Reject       = reject;
            response.BPtotocol.B1 = b1;
            response.BPtotocol.B2 = b2;
            response.BPtotocol.B3 = b3;
            _application.SendMessage(response);
        }
Beispiel #5
0
        /// <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;
            }
        }
Beispiel #6
0
        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;
            }
        }
Beispiel #7
0
        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;
            }
        }
Beispiel #8
0
 public void Answer(Reject reject, B1Protocol b1, B2Protocol b2, B3Protocol b3) {
     Debug.Assert(_status == ConnectionStatus.D_ConnectPending);
     if (_connectIndication == null || _status != ConnectionStatus.D_ConnectPending) {
         throw new NotSupportedException("Connection is not in the right state.");
     }
     ConnectResponse response = new ConnectResponse(_connectIndication);
     _connectIndication = null;
     response.Reject = reject;
     response.BPtotocol.B1 = b1;
     response.BPtotocol.B2 = b2;
     response.BPtotocol.B3 = b3;
     _application.SendMessage(response);
 }