Beispiel #1
0
        private SIPRequest GetByeRequest()
        {
            SIPRequest    byeRequest    = new SIPRequest(SIPMethodsEnum.BYE, RemoteTarget);
            SIPFromHeader byeFromHeader = SIPFromHeader.ParseFromHeader(LocalUserField.ToString());
            SIPToHeader   byeToHeader   = SIPToHeader.ParseToHeader(RemoteUserField.ToString());
            int           cseq          = CSeq + 1;

            SIPHeader byeHeader = new SIPHeader(byeFromHeader, byeToHeader, cseq, CallId);

            byeHeader.CSeqMethod            = SIPMethodsEnum.BYE;
            byeRequest.Header               = byeHeader;
            byeRequest.Header.Routes        = RouteSet;
            byeRequest.Header.ProxySendFrom = ProxySendFrom;
            byeRequest.Header.Vias.PushViaHeader(SIPViaHeader.GetDefaultSIPViaHeader());

            return(byeRequest);
        }
Beispiel #2
0
        /// <summary>
        /// Builds a basic SIP request with the header fields set to correctly identify it as an
        /// in dialog request. Calling this method also increments the dialog's local CSeq counter.
        /// This is safe to do even if the request does not end up being sent.
        /// </summary>
        /// <param name="method">The method of the SIP request to create.</param>
        /// <returns>An in dialog SIP request.</returns>
        public SIPRequest GetInDialogRequest(SIPMethodsEnum method)
        {
            CSeq++;

            SIPRequest    inDialogRequest = new SIPRequest(method, RemoteTarget);
            SIPFromHeader fromHeader      = SIPFromHeader.ParseFromHeader(LocalUserField.ToString());
            SIPToHeader   toHeader        = SIPToHeader.ParseToHeader(RemoteUserField.ToString());
            int           cseq            = CSeq;

            SIPHeader header = new SIPHeader(fromHeader, toHeader, cseq, CallId);

            header.CSeqMethod                    = method;
            inDialogRequest.Header               = header;
            inDialogRequest.Header.Routes        = RouteSet;
            inDialogRequest.Header.ProxySendFrom = ProxySendFrom;
            inDialogRequest.Header.Vias.PushViaHeader(SIPViaHeader.GetDefaultSIPViaHeader());

            return(inDialogRequest);
        }
Beispiel #3
0
        private SIPRequest GetByeRequest(SIPEndPoint localSIPEndPoint)
        {
            SIPRequest    byeRequest    = new SIPRequest(SIPMethodsEnum.BYE, RemoteTarget);
            SIPFromHeader byeFromHeader = SIPFromHeader.ParseFromHeader(LocalUserField.ToString());
            SIPToHeader   byeToHeader   = SIPToHeader.ParseToHeader(RemoteUserField.ToString());
            int           cseq          = CSeq + 1;

            SIPHeader byeHeader = new SIPHeader(byeFromHeader, byeToHeader, cseq, CallId);

            byeHeader.CSeqMethod            = SIPMethodsEnum.BYE;
            byeRequest.Header               = byeHeader;
            byeRequest.Header.Routes        = RouteSet;
            byeRequest.Header.ProxySendFrom = ProxySendFrom;

            SIPViaHeader viaHeader = new SIPViaHeader(localSIPEndPoint, CallProperties.CreateBranchId());

            byeRequest.Header.Vias.PushViaHeader(viaHeader);

            return(byeRequest);
        }