Пример #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() {};
            }
Пример #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());
            }
Пример #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();
 }
Пример #5
0
 internal override void Retransmit(SipInviteClientTransaction ctx)
 {
     //do nothing
 }
Пример #6
0
            internal override void Retransmit(SipInviteClientTransaction ctx)
            {
                ctx.ReTransmitTimer.Interval = ctx.ReTransmitTimer.Interval*2;

                ctx.SendRequestInternal();
            }
Пример #7
0
 internal override void Initialize(SipInviteClientTransaction ctx)
 {
     ctx.TimeOutTimer.Start();
     ctx.ReTransmitTimer.Start();
 }
Пример #8
0
 internal abstract void Initialize(SipInviteClientTransaction transaction);
Пример #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;
        }
Пример #10
0
 internal override void Retransmit(SipInviteClientTransaction ctx)
 {
     //do nothing
 }
Пример #11
0
 internal abstract void Retransmit(SipInviteClientTransaction transaction);
Пример #12
0
 internal abstract void Initialize(SipInviteClientTransaction transaction);
Пример #13
0
 internal abstract StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response);
Пример #14
0
 internal abstract StateResult HandleResponse(SipInviteClientTransaction ctx, SipResponse response);
Пример #15
0
 internal abstract void Retransmit(SipInviteClientTransaction transaction);
Пример #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>();
 }
Пример #18
0
 protected override void Given()
 {
     Ctx = new SipInviteClientTransaction(TxTable, MessageSenderMock.Object, ListenerMock.Object, Request, TimerFactory, HeaderFactory, MessageFactory);
     GivenOverride();
 }