public SipRequestEvent(SipContext context) { this.Request = context.Request; this.LocalEndPoint = context.LocalEndPoint; this.RemoteEndPoint = context.RemoteEndPoint; this.IsSent = context.IsSent; }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response != null) { if (sipContext.Response.CSeq.Command == SipMethods.Invite) { if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { if (_receivedRingingResponse == null) { _receivedRingingResponse = sipContext.Response; } } else if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x487_Request_Terminated) { /**/ waitHandles[0].Set(); } } else if (sipContext.Response.CSeq.Command == SipMethods.Cancel && sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x200_Ok) { /*receive ok to cancel*/ waitHandles[1].Set(); } } }
public SipResponseEvent(SipContext context) { this.Response = context.Response; this.LocalEndPoint = context.LocalEndPoint; this.RemoteEndPoint = context.RemoteEndPoint; this.IsSent = context.IsSent; }
public override SipRequestEvent Build() { var ctx = new SipContext(); ctx.Request = _request; return(new SipRequestEvent(ctx)); }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Request.RequestLine.Method == SipMethods.Invite) { _waitingforInviteReceived.Set(); } }
protected SipResponseEvent CreateFinalResponseEvent() { var statusLine = new SipStatusLineBuilder().WithStatusCode(200).WithReason("OK").Build(); var r = new SipResponseBuilder().WithStatusLine(statusLine).Build(); var c = new SipContext(); c.Response = r; return(new SipResponseEvent(c)); }
protected override void GivenOverride() { /*fire ringing response to forec the dialog to go into early state*/ var c = new SipContext(); _response = CreateRingingResponse(); c.Response = _response; _contextSource.FireNewContextReceivedEvent(c); }
protected override void When() { /*create ringing response*/ var c = new SipContext(); _response = CreateRingingResponse(); c.Response = _response; _contextSource.FireNewContextReceivedEvent(c); }
protected SipResponseEvent CreateProvisionalResponseEvent(int statusCode = 180, string reason = "Ringing") { var statusLine = new SipStatusLineBuilder().WithStatusCode(statusCode).WithReason(reason).Build(); var r = new SipResponseBuilder().WithStatusLine(statusLine).Build(); var c = new SipContext(); c.Response = r; return(new SipResponseEvent(c)); }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { if (_receivedRingingResponse == null) { _receivedRingingResponse = sipContext.Response; } } }
protected override void When() { /*fire ok response*/ var c = new SipContext(); _response = CreateOkResponse(); _response.To.Tag = "different"; c.Response = _response; _contextSource.FireNewContextReceivedEvent(c); }
protected override void OnTestClientUaReceive(SipContext sipContext) { _counter++; if (_counter == 2) { _wait.Set(); } /*continue test execution*/ //_wait.Set(); move to statechanged, as this is the last event in code. }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { _receivedRingingResponse = sipContext.Response; } if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x200_Ok) { _waitingforOkReceived.Set(); } }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Request.RequestLine.Method == SipMethods.Invite) { _receivedInvite = sipContext.Request; _waitingforInviteReceived.Set(); } else if (sipContext.Request.RequestLine.Method == SipMethods.Ack) { _receivedAck = sipContext.Request; _waitingForAckReceived.Set(); } }
private SipContext CreateSipContext(SipMessage message, Datagram datagram) { var request = message as SipRequest; var response = message as SipResponse; var c = new SipContext(); c.Request = request; c.Response = response; c.RemoteEndPoint = datagram.RemoteEndPoint; c.LocalEndPoint = datagram.LocalEndPoint; return(c); }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { lock (_lock) { _ringingReceivedCounter++; if (_ringingReceivedCounter > (_longtimeSpan / _periodicity)) { _wait.Set(); } } } }
private void OnRequestReceived(SipRequest request, SipContext context) { // last thread should signal main test lock (_failedThreads) { Interlocked.Decrement(ref _currentThreadCount); Console.WriteLine(request.CSeq.Sequence + " done, left: " + _currentThreadCount); if (_currentThreadCount == 0) { _threadsDoneEvent.Set(); } } }
/// <summary> /// fakes a new incoming message received from the socket that is already build up to a sipcontext. /// Directly invokes the SipProvider's OnNext method. /// </summary> /// <param name="sipContext"></param> internal void FireNewContextReceivedEvent(SipContext sipContext) { /*let the SipProvider know*/ try { NewContextReceived(this, new SipContextReceivedEventArgs { Context = sipContext }); } catch (Exception e) { UnhandledException(this, new ExceptionEventArgs() { Exception = e }); } }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { _receivedRingingResponse = sipContext.Response; } if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x200_Ok) { _waitingforOkReceived.Set(); } if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x200_Ok && sipContext.Response.CSeq.Command == SipMethods.Bye) { _receivedOkByeResponse = sipContext.Response; _waitForByeReceived.Set(); } }
protected override void OnTestClientUaReceive(SipContext sipContext) { if (sipContext.Response != null && sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing) { _receivedRingingResponse = sipContext.Response; } if (sipContext.Response != null && sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x200_Ok) { _waitingforOkReceived.Set(); } if (sipContext.Request != null && sipContext.Request.RequestLine.Method == SipMethods.Bye) { _receivedBye = sipContext.Request; _waitForByeReceived.Set(); } }
protected abstract void OnTestClientUaReceive(SipContext sipContext);
private void OnRequestReceived(SipRequest request, SipContext context) { _requestReceived.Set(); }
private void OnRecievedResponse(SipResponse sipResponse, SipContext sipContext) { }
public void ProcessRequest(SipRequest sipRequest, SipContext context) { lock (_locker) Requests.Add(sipRequest); _onRecievedRequest(sipRequest, context); }
public void ProcessResponse(SipResponse sipResponse, SipContext context) { lock (_locker) Responses.Add(sipResponse); _onRecievedResponse(sipResponse, context); }
protected override void OnTestClientUaReceive(SipContext sipContext) { }