Example #1
0
            internal override StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response)
            {
                var statusCode = response.StatusLine.StatusCode;

                if (statusCode >= 100 && statusCode < 200)
                {
                    ctx.ChangeState(SipInviteClientTransaction.ProceedingState);
                    return new StateResult() {InformToUser = true};
                }

                if (statusCode >= 200 && statusCode < 300)
                {
                    ctx.ChangeState(SipInviteClientTransaction.TerminatedState);
                    return new StateResult() {InformToUser = true, Dispose = true};
                }

                if (statusCode >= 300 && statusCode < 700)
                {
                    ctx.ChangeState(SipInviteClientTransaction.CompletedState);
                    ctx.SendAck();
                    return new StateResult() {InformToUser = true};
                }

                return new StateResult() {};
            }
Example #2
0
            internal override StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response)
            {
                var statusCode = response.StatusLine.StatusCode;

                if (statusCode >= 100 && statusCode < 200)
                {
                    return(new StateResult()
                    {
                        InformToUser = true
                    });
                }
                if (statusCode >= 200 && statusCode < 300)
                {
                    ctx.ChangeState(SipInviteClientTransaction.TerminatedState);
                    return(new StateResult()
                    {
                        InformToUser = true, Dispose = true
                    });
                }
                if (statusCode >= 300 && statusCode < 700)
                {
                    ctx.ChangeState(SipInviteClientTransaction.CompletedState);
                    ctx.SendAck();
                    return(new StateResult()
                    {
                        InformToUser = true
                    });
                }

                return(new StateResult());
            }
Example #3
0
 internal override void Initialize(SipInviteClientTransaction ctx)
 {
     ctx.TimeOutTimer.Start();
     ctx.ReTransmitTimer.Start();
 }
 protected override void Given()
 {
     _contextSource = new FakeSipContextSource();
     _sipStack = new SipStack();
     _provider = new SipProvider(_sipStack, _contextSource);
     _inviteRequest = CreateInviteRequest();
     BeforeCreateInviteTransaction();
     _inviteTransaction = _provider.CreateClientTransaction(_inviteRequest).As<SipInviteClientTransaction>();
     _dialog = _provider.CreateClientDialog(_inviteTransaction);
     _inviteTransaction.SendRequest();
     GivenOverride();
 }
Example #5
0
 internal override void Retransmit(SipInviteClientTransaction ctx)
 {
     //do nothing
 }
Example #6
0
            internal override void Retransmit(SipInviteClientTransaction ctx)
            {
                ctx.ReTransmitTimer.Interval = ctx.ReTransmitTimer.Interval*2;

                ctx.SendRequestInternal();
            }
Example #7
0
 internal override void Initialize(SipInviteClientTransaction ctx)
 {
     ctx.TimeOutTimer.Start();
     ctx.ReTransmitTimer.Start();
 }
Example #8
0
 internal abstract void Initialize(SipInviteClientTransaction transaction);
Example #9
0
        public ISipClientTransaction CreateClientTransaction(SipRequest request)
        {
            Check.Require(request, "request");
            Check.IsTrue(SipMethods.IsMethod(request.RequestLine.Method), "Request method is not supported");

            ISipClientTransaction tx;

            if (request.RequestLine.Method == SipMethods.Ack)
            {
                throw new ArgumentException("Can not create a transaction for the 'ACK' request");
            }

            ISipListener txListener = _sipListener;

            SipAbstractDialog dialog;
            if (_dialogTable.TryGetValue(GetDialogId(request, true), out dialog))
            {
                txListener = dialog;
            }

            if(request.RequestLine.Method == SipMethods.Invite)
            {
                tx = new SipInviteClientTransaction(
                    ClientTransactionTable,
                    this,
                    txListener,
                    request,
                    _stack.GetTimerFactory(),
                    _stack.CreateHeaderFactory(),
                    _stack.CreateMessageFactory());
            }
            else
            {
                tx = new SipNonInviteClientTransaction(
                    ClientTransactionTable,
                    this,
                    txListener,
                    request,
                    _stack.GetTimerFactory());
            }

            return tx;
        }
Example #10
0
 internal override void Retransmit(SipInviteClientTransaction ctx)
 {
     //do nothing
 }
Example #11
0
 internal abstract void Retransmit(SipInviteClientTransaction transaction);
Example #12
0
 internal abstract void Initialize(SipInviteClientTransaction transaction);
Example #13
0
 internal abstract StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response);
Example #14
0
 internal abstract StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response);
Example #15
0
 internal abstract void Retransmit(SipInviteClientTransaction transaction);
Example #16
0
            internal override void Retransmit(SipInviteClientTransaction ctx)
            {
                ctx.ReTransmitTimer.Interval = ctx.ReTransmitTimer.Interval * 2;

                ctx.SendRequestInternal();
            }
 private void OnProcessResponse(SipResponseEvent sipResponseEvent)
 {
     _onProcessResponseCount++;
     _sipResponseEvent = sipResponseEvent;
     _transaction = sipResponseEvent.ClientTransaction.As<SipInviteClientTransaction>();
 }
Example #18
0
 protected override void Given()
 {
     Ctx = new SipInviteClientTransaction(TxTable, MessageSenderMock.Object, ListenerMock.Object, Request, TimerFactory, HeaderFactory, MessageFactory);
     GivenOverride();
 }