Пример #1
0
        public SipInviteServerDialog(
             ISipTransaction transaction, 
             SipDialogTable dialogTable,
             ITimerFactory timerFactory,
             SipHeaderFactory headerFactory,
             SipMessageFactory messageFactory,
             SipAddressFactory addressFactory,
             ISipMessageSender messageSender,
             ISipListener listener,
            IPEndPoint listeningPoint)
            : base(headerFactory, messageFactory, addressFactory, messageSender, listener, listeningPoint, transaction)
        {
            Check.Require(transaction, "transaction");
            Check.Require(dialogTable, "dialogTable");
            Check.Require(timerFactory, "timerFactory");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            _dialogTable = dialogTable;
            _state = DialogState.Null;
            _timerFactory = timerFactory;

            //(only ?) localtag is set on firstresponse
            //localtarget is not defined, because is has no use, (every user agent knows it local address)

            _retransmitOkTimer = _timerFactory.CreateInviteCtxRetransmitTimer(OnOkReTransmit);
            //_endWaitForAckTimer = _timerFactory.CreateInviteCtxTimeOutTimer(OnWaitForAckTimeOut);

            if (_logger.IsInfoEnabled) _logger.Info("ServerDialog[Id={0}] created.", GetId());
        }
Пример #2
0
        //want follow the jain-sip implementation. I just use a guid. SipUtil.CreateCallId();
        //public SipCallIdHeader GetNewCallId()
        //{
        //    String callId = SipUtil.GenerateCallIdentifier(this.getListeningPoint()
        //            .getIPAddress());
        //    SipCallIdHeader callid = new SipCallIdHeader();

        //    return callid;
        //}

        internal SipProvider(SipStack stack, ISipContextSource contextSource)
        {
            Check.Require(stack, "stack");
            Check.Require(contextSource, "contextSource");

            _stack         = stack;
            _contextSource = contextSource;
            contextSource.NewContextReceived += (s, e) => OnNewContextReceived(e.Context);
            contextSource.UnhandledException += (s, e) => OnContextSourceUnhandledException(e.Exception);

            _ctxTable    = new SipClientTransactionTable();
            _stxTable    = new SipServerTransactionTable();
            _dialogTable = new SipDialogTable();
        }
Пример #3
0
        //want follow the jain-sip implementation. I just use a guid. SipUtil.CreateCallId();
        //public SipCallIdHeader GetNewCallId()
        //{
        //    String callId = SipUtil.GenerateCallIdentifier(this.getListeningPoint()
        //            .getIPAddress());
        //    SipCallIdHeader callid = new SipCallIdHeader();
        //    return callid;
        //}
        internal SipProvider(SipStack stack, ISipContextSource contextSource)
        {
            Check.Require(stack, "stack");
            Check.Require(contextSource, "contextSource");

            _stack = stack;
            _contextSource = contextSource;
            contextSource.NewContextReceived +=(s,e) => OnNewContextReceived(e.Context);
            contextSource.UnhandledException += (s, e) => OnContextSourceUnhandledException(e.Exception);

            _ctxTable = new SipClientTransactionTable();
            _stxTable = new SipServerTransactionTable();
            _dialogTable = new SipDialogTable();
        }
        public SipInviteClientDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            InvitingRequest = CreateInviteRequest();

            InviteCtx = new Mock<ISipClientTransaction>();
            InviteCtx.Setup((tx) => tx.Request).Returns(InvitingRequest);

            var tfb = new TimerFactoryStubBuilder();

            TimerFactory = tfb.Build();
        }
        public SipInviteClientDialogSpecificationBase()
        {
            _toTag   = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId  = SipUtil.CreateCallId();
            _cSeq    = 2;

            Sender          = new Mock <ISipMessageSender>();
            Listener        = new Mock <ISipListener>();
            DialogTable     = new SipDialogTable();
            InvitingRequest = CreateInviteRequest();

            InviteCtx = new Mock <ISipClientTransaction>();
            InviteCtx.Setup((tx) => tx.Request).Returns(InvitingRequest);

            var tfb = new TimerFactoryStubBuilder();

            TimerFactory = tfb.Build();
        }
        public SipInviteServerDialogSpecificationBase()
        {
            _toTag = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId = SipUtil.CreateCallId();
            _cSeq = 2;

            Sender = new Mock<ISipMessageSender>();
            Listener = new Mock<ISipListener>();
            DialogTable = new SipDialogTable();
            ReceivedRequest = CreateInviteRequest();

            InviteStx = new Mock<ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            var tfb = new TimerFactoryStubBuilder()
               .WithInviteCtxRetransmitTimerInterceptor(OnCreateRetransmitOkTimer)
               .WithInviteCtxTimeOutTimerInterceptor(OnCreateTimeOutTimer);

            TimerFactory = tfb.Build();
        }
Пример #7
0
        public SipInviteClientDialog(
             ISipTransaction transaction, 
             SipDialogTable dialogTable, 
             SipHeaderFactory headerFactory,
             SipMessageFactory messageFactory,
             SipAddressFactory addressFactory,
             ISipMessageSender messageSender,
             ISipListener listener,
             IPEndPoint listeningPoint)
            : base(headerFactory, messageFactory, addressFactory, messageSender, listener, listeningPoint, transaction)
        {
            Check.Require(transaction, "transaction");
             Check.Require(dialogTable, "dialogTable");
             Check.Require(transaction.Request, "transaction.Request");

             _logger = NLog.LogManager.GetCurrentClassLogger();

             _dialogTable = dialogTable;
             _state = DialogState.Null;
             _topMostVia = (SipViaHeader)transaction.Request.Vias.GetTopMost().Clone();
        }
        public SipInviteServerDialogSpecificationBase()
        {
            _toTag   = SipUtil.CreateTag();
            _fromTag = SipUtil.CreateTag();
            _callId  = SipUtil.CreateCallId();
            _cSeq    = 2;

            Sender          = new Mock <ISipMessageSender>();
            Listener        = new Mock <ISipListener>();
            DialogTable     = new SipDialogTable();
            ReceivedRequest = CreateInviteRequest();

            InviteStx = new Mock <ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            var tfb = new TimerFactoryStubBuilder()
                      .WithInviteCtxRetransmitTimerInterceptor(OnCreateRetransmitOkTimer)
                      .WithInviteCtxTimeOutTimerInterceptor(OnCreateTimeOutTimer);

            TimerFactory = tfb.Build();
        }