Ejemplo n.º 1
0
            /// <summary>
            /// Creates ACK request for pending INVITE.
            /// </summary>
            /// <returns>Returns created ACK request.</returns>
            private SIP_Request CreateAck()
            {
                /* RFC 3261 13.2.2.4.
                 *  The header fields of the ACK are constructed
                 *  in the same way as for any request sent within a dialog (see Section 12) with the
                 *  exception of the CSeq and the header fields related to authentication. The sequence
                 *  number of the CSeq header field MUST be the same as the INVITE being acknowledged,
                 *  but the CSeq method MUST be ACK. The ACK MUST contain the same credentials as the INVITE.
                 *
                 *  ACK must have same branch.
                 */

                SIP_Request ackRequest = m_pDialog.CreateRequest(SIP_Methods.ACK);

                ackRequest.Via.AddToTop(m_pInvite.Via.GetTopMostValue().ToStringValue());
                ackRequest.CSeq = new SIP_t_CSeq(m_pInvite.CSeq.SequenceNumber, SIP_Methods.ACK);
                // Authorization
                foreach (SIP_HeaderField h in m_pInvite.Authorization.HeaderFields)
                {
                    ackRequest.Authorization.Add(h.Value);
                }
                // Proxy-Authorization
                foreach (SIP_HeaderField h in m_pInvite.ProxyAuthorization.HeaderFields)
                {
                    ackRequest.Authorization.Add(h.Value);
                }

                return(ackRequest);
            }