public IAsyncResult BeginHangUp(AsyncCallback callback, object state) { try { Message request = null; switch (_status) { case ConnectionStatus.Connected: case ConnectionStatus.B_ConnectPending: _inititator = true; request = new DisconnectB3Request(_ncci); break; case ConnectionStatus.D_Connected: case ConnectionStatus.D_ConnectPending: case ConnectionStatus.B_DisconnectPending: _inititator = true; request = new DisconnectRequest(_plci); break; default: throw Error.NotSupported(); } MessageAsyncResult result = new MessageAsyncResult(this, request, callback, state); _application.SendRequestMessage(result); return(result); } catch (Exception e) { Trace.TraceError("Connection#{0}::BeginHangUp, Exception = {1}", ValidationHelper.HashString(this), e); throw; } }
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; } }