예제 #1
0
 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();
         }
     }
 }
예제 #3
0
 public SipResponseEvent(SipContext context)
 {
     this.Response = context.Response;
     this.LocalEndPoint = context.LocalEndPoint;
     this.RemoteEndPoint = context.RemoteEndPoint;
     this.IsSent = context.IsSent;
 }
예제 #4
0
 public SipResponseEvent(SipContext context)
 {
     this.Response       = context.Response;
     this.LocalEndPoint  = context.LocalEndPoint;
     this.RemoteEndPoint = context.RemoteEndPoint;
     this.IsSent         = context.IsSent;
 }
예제 #5
0
 public SipRequestEvent(SipContext context)
 {
     this.Request        = context.Request;
     this.LocalEndPoint  = context.LocalEndPoint;
     this.RemoteEndPoint = context.RemoteEndPoint;
     this.IsSent         = context.IsSent;
 }
예제 #6
0
        public override SipRequestEvent Build()
        {
            var ctx = new SipContext();

            ctx.Request = _request;
            return(new SipRequestEvent(ctx));
        }
예제 #7
0
 protected override void OnTestClientUaReceive(SipContext sipContext)
 {
     if (sipContext.Request.RequestLine.Method == SipMethods.Invite)
     {
         _waitingforInviteReceived.Set();
     }
 }
예제 #8
0
        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);
        }
예제 #10
0
        protected override void When()
        {
            /*create ringing response*/
            var c = new SipContext();

            _response  = CreateRingingResponse();
            c.Response = _response;
            _contextSource.FireNewContextReceivedEvent(c);
        }
예제 #11
0
        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));
        }
예제 #12
0
 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);
        }
예제 #14
0
        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.
        }
예제 #15
0
        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();
            }
        }
예제 #16
0
 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();
     }
 }
예제 #17
0
        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);
        }
예제 #18
0
 protected override void OnTestClientUaReceive(SipContext sipContext)
 {
     if (sipContext.Response.StatusLine.ResponseCode == SipResponseCodes.x180_Ringing)
     {
         lock (_lock)
         {
             _ringingReceivedCounter++;
             if (_ringingReceivedCounter > (_longtimeSpan / _periodicity))
             {
                 _wait.Set();
             }
         }
     }
 }
예제 #19
0
        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();
                }
            }
        }
예제 #20
0
 /// <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();
     }
 }
예제 #22
0
        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();
            }
        }
예제 #23
0
 protected abstract void OnTestClientUaReceive(SipContext sipContext);
예제 #24
0
 private void OnRequestReceived(SipRequest request, SipContext context)
 {
     _requestReceived.Set();
 }
예제 #25
0
 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);
 }
예제 #28
0
 protected override void OnTestClientUaReceive(SipContext sipContext)
 {
 }