コード例 #1
0
        protected override void Given()
        {
            //setup the Request property of the inc inviteserver
            ReceivedRequest = CreateInviteRequest();
            var tfb = new TimerFactoryStubBuilder();
            InviteStx = new Mock<ISipServerTransaction>();
            InviteStx.Setup((tx) => tx.Request).Returns(ReceivedRequest);

            //create the dialog;
            ServerDialog = new SipInviteServerDialog(InviteStx.Object,
                                                   DialogTable,
                                                   TimerFactory,
                                                   new SipHeaderFactory(),
                                                   new SipMessageFactory(), new SipAddressFactory(),
                                                   Sender.Object,
                                                   Listener.Object,
                                                   TestConstants.IpEndPoint1);

            GivenOverride();
        }
コード例 #2
0
ファイル: SipProvider.cs プロジェクト: HNeukermans/Hallo
        public SipInviteServerDialog CreateServerDialog(ISipServerTransaction transaction)
        {
            var inviteTx = transaction as SipInviteServerTransaction;

            Check.Require(transaction, "transaction");
            Check.IsTrue(inviteTx != null, "The transaction must be of type 'SipInviteServerTransaction'");
            Check.Require(inviteTx.Request, "The request can not be null");
            Check.Require(inviteTx.Request.From, "The From header can not be null");
            Check.NotNullOrEmpty(inviteTx.Request.From.Tag, "From tag");

            var dialog = new SipInviteServerDialog(
                transaction,
                _dialogTable,
                _stack.GetTimerFactory(),
                _stack.CreateHeaderFactory(),
                _stack.CreateMessageFactory(),
                _stack.CreateAddressFactory(),
                this,
                _sipListener,
                _contextSource.ListeningPoint);

            //setting the dialog is done out of the transaction.
            //(otherwise you need to interface the SetDialog method, both on InviteClient & InviteServer transaction)
            //thus creating again two separate interfaces or adding the method on existing interface thereby poluting.
            inviteTx.SetDialog(dialog);
            return dialog;
        }