예제 #1
0
        protected SipAbstractDialog(SipHeaderFactory headerFactory,
                                    SipMessageFactory messageFactory,
                                    SipAddressFactory addressFactory,
                                    ISipMessageSender messageSender,
                                    ISipListener listener,
                                    IPEndPoint listeningPoint,
                                    ISipTransaction transaction)

        {
            Check.Require(headerFactory, "headerFactory");
            Check.Require(messageFactory, "messageFactory");
            Check.Require(addressFactory, "addressFactory");
            Check.Require(messageSender, "messageSender");
            Check.Require(listener, "listener");
            Check.Require(listeningPoint, "listeningPoint");
            Check.Require(transaction, "transaction");
            Check.Require(transaction.Request, "transaction.Request");
            ValidateRequest(transaction.Request);

            _routeSet         = new List <SipRecordRouteHeader>();
            _createDate       = DateTime.Now;
            _localSequenceNr  = -1;
            _remoteSequenceNr = -1;

            _listener         = listener;
            _listeningPoint   = listeningPoint;
            _headerFactory    = headerFactory;
            _messageFactory   = messageFactory;
            _addressFactory   = addressFactory;
            _messageSender    = messageSender;
            _firstTransaction = transaction;
            _firstRequest     = transaction.Request;
        }
예제 #2
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());
            }
        }
예제 #3
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());
        }
예제 #4
0
        protected SipAbstractDialog(SipHeaderFactory headerFactory,
             SipMessageFactory messageFactory,
             SipAddressFactory addressFactory,
             ISipMessageSender messageSender,
             ISipListener listener,
             IPEndPoint listeningPoint,
             ISipTransaction transaction)
        {
            Check.Require(headerFactory, "headerFactory");
            Check.Require(messageFactory, "messageFactory");
            Check.Require(addressFactory, "addressFactory");
            Check.Require(messageSender, "messageSender");
            Check.Require(listener, "listener");
            Check.Require(listeningPoint, "listeningPoint");
            Check.Require(transaction, "transaction");
            Check.Require(transaction.Request, "transaction.Request");
            ValidateRequest(transaction.Request);

            _routeSet = new List<SipRecordRouteHeader>();
            _createDate = DateTime.Now;
            _localSequenceNr = -1;
            _remoteSequenceNr = -1;

            _listener = listener;
            _listeningPoint = listeningPoint;
            _headerFactory = headerFactory;
            _messageFactory = messageFactory;
            _addressFactory = addressFactory;
            _messageSender = messageSender;
            _firstTransaction = transaction;
            _firstRequest = transaction.Request;
        }
예제 #5
0
        public void AddSipListener(ISipListener sipListener)
        {
            Check.Require(sipListener, "sipListener");

            if (_sipListener.GetType() != typeof(NullListener))
            {
                throw new InvalidOperationException("A listener is already added.");
            }

            _sipListener = sipListener;
        }
        internal SipNonInviteServerTransaction(
            SipServerTransactionTable table, 
            SipRequest request, 
            ISipListener listener, 
            ISipMessageSender messageSender,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Request method can not be 'INVITE'.");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Request method can not be 'ACK'.");

            EndCompletedTimer = _timerFactory.CreateNonInviteStxEndCompletedTimer(OnCompletedEnded);
        }
        internal SipNonInviteServerTransaction(
            SipServerTransactionTable table,
            SipRequest request,
            ISipListener listener,
            ISipMessageSender messageSender,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Request method can not be 'INVITE'.");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Request method can not be 'ACK'.");

            EndCompletedTimer = _timerFactory.CreateNonInviteStxEndCompletedTimer(OnCompletedEnded);
        }
        protected SipAbstractServerTransaction(SipServerTransactionTable table, SipRequest request, ISipListener listener, ISipMessageSender messageSender, ITimerFactory timerFactory)
        {
            Check.Require(table, "table");
            Check.Require(request, "request");
            Check.Require(listener, "listener");
            Check.Require(messageSender, "messageSender");
            Check.Require(timerFactory, "timerFactory");

            _table = table;
            _request = request;
            _listener = listener;
            _messageSender = messageSender;
            _timerFactory = timerFactory;
        }
예제 #9
0
        protected SipAbstractServerTransaction(SipServerTransactionTable table, SipRequest request, ISipListener listener, ISipMessageSender messageSender, ITimerFactory timerFactory)
        {
            Check.Require(table, "table");
            Check.Require(request, "request");
            Check.Require(listener, "listener");
            Check.Require(messageSender, "messageSender");
            Check.Require(timerFactory, "timerFactory");

            _table         = table;
            _request       = request;
            _listener      = listener;
            _messageSender = messageSender;
            _timerFactory  = timerFactory;
        }
예제 #10
0
        internal SipInviteServerTransaction(
            SipServerTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitNonx200FinalResponseTimer = _timerFactory.CreateInviteStxRetransmitTimer(OnReTransmitNonx200FinalResponse);
            EndCompletedTimer = _timerFactory.CreateInviteStxEndCompletedTimer(OnCompletedEnded);
            EndConfirmedTimer = _timerFactory.CreateInviteStxEndConfirmed(OnConfirmedEnded);
            SendTryingTimer   = _timerFactory.CreateInviteStxSendTryingTimer(OnSendTryingTimer);
        }
        SipNonInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Method 'INVITE' is not allowed");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Method 'ACK' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitTimer   = _timerFactory.CreateNonInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer      = _timerFactory.CreateNonInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = _timerFactory.CreateNonInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
예제 #12
0
        public ISipServerTransaction CreateServerTransaction(SipRequest request)
        {
            Check.Require(request, "request");
            Check.IsTrue(SipMethods.IsMethod(request.RequestLine.Method), "Request method is not supported");

            ISipServerTransaction 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)
            {
                var istx = new SipInviteServerTransaction(
                    ServerTransactionTable,
                    this,
                    txListener,
                    request,
                    _stack.GetTimerFactory());
                //istx.Start();
                tx = istx;
            }
            else
            {
                var nistx = new SipNonInviteServerTransaction(
                    ServerTransactionTable,
                    request,
                    txListener,
                    this,
                    _stack.GetTimerFactory());
                //nistx.Start();
                tx = nistx;
            }

            return(tx);
        }
        internal SipNonInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method != SipMethods.Invite, "Method 'INVITE' is not allowed");
            Check.IsTrue(request.RequestLine.Method != SipMethods.Ack, "Method 'ACK' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitTimer = _timerFactory.CreateNonInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer = _timerFactory.CreateNonInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = _timerFactory.CreateNonInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
        internal SipInviteServerTransaction(
            SipServerTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory)
            : base(table, request, listener, messageSender, timerFactory)
        {
            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            ReTransmitNonx200FinalResponseTimer = _timerFactory.CreateInviteStxRetransmitTimer(OnReTransmitNonx200FinalResponse);
            EndCompletedTimer = _timerFactory.CreateInviteStxEndCompletedTimer(OnCompletedEnded);
            EndConfirmedTimer = _timerFactory.CreateInviteStxEndConfirmed(OnConfirmedEnded);
            SendTryingTimer = _timerFactory.CreateInviteStxSendTryingTimer(OnSendTryingTimer);
        }
예제 #15
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();
        }
예제 #16
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();
        }
예제 #17
0
        internal SipInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener,
            SipRequest request,
            ITimerFactory timerFactory,
            SipHeaderFactory headerFactory,
            SipMessageFactory messageFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.Require(headerFactory, "headerFactory");
            Check.Require(messageFactory, "messageFactory");

            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            _headerFactory  = headerFactory;
            _messageFactory = messageFactory;

            ReTransmitTimer   = timerFactory.CreateInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer      = timerFactory.CreateInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = timerFactory.CreateInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
        internal SipInviteClientTransaction(
            SipClientTransactionTable table,
            ISipMessageSender messageSender,
            ISipListener listener, 
            SipRequest request, 
            ITimerFactory timerFactory, 
            SipHeaderFactory headerFactory,
            SipMessageFactory messageFactory)
            : base(table, request, messageSender, listener, timerFactory)
        {
            Check.Require(headerFactory, "headerFactory");
            Check.Require(messageFactory, "messageFactory");

            Check.IsTrue(request.RequestLine.Method == SipMethods.Invite, "Method other then 'INVITE' is not allowed");

            _logger = NLog.LogManager.GetCurrentClassLogger();

            _headerFactory = headerFactory;
            _messageFactory = messageFactory;

            ReTransmitTimer = timerFactory.CreateInviteCtxRetransmitTimer(OnReTransmit);
            TimeOutTimer = timerFactory.CreateInviteCtxTimeOutTimer(OnTimeOut);
            EndCompletedTimer = timerFactory.CreateInviteCtxEndCompletedTimer(OnCompletedEnded);
        }
예제 #19
0
 public SipLogEventPublisher(ISipListener listener)
 {
     _listener = listener;
 }
예제 #20
0
 public void RegisterListener(ISipListener listener)
 {
     _siplistener = listener;
 }
예제 #21
0
 public void UnRegisterListener()
 {
     _siplistener = null;
 }
예제 #22
0
        public void AddSipListener(ISipListener sipListener)
        {
            Check.Require(sipListener, "sipListener");

            if (_sipListener.GetType() != typeof(NullListener)) throw new InvalidOperationException("A listener is already added.");

            _sipListener = sipListener;
        }
예제 #23
0
 public void RegisterListener(ISipListener listener)
 {
     _siplistener = listener;
 }
예제 #24
0
 public void UnRegisterListener()
 {
     _siplistener = null;
 }
예제 #25
0
 public SipLogEventPublisher(ISipListener listener)
 {
     _listener = listener;
 }