[reSIProcate] How do I change the order of SIP headers?

Chris Rigg cdrigg at comcast.net
Thu Aug 18 18:03:54 CDT 2005


Hey All,

I have a simple little application that sends out a SUBSCRIBE message 
over TLS. When I create the SIP message, I have a specific order to my 
SIP headers -- when it goes out the wire, the order has changed.

I create the message like this:

<CODE>
      Data txt("SUBSCRIBE sip:naim at lcs-im.com;transport=TLS SIP/2.0\r\n"
               "Contact: 
<sip:cdrigg at sip.com:5061;transport=TLS;maddr=bldr-ccm51.sip.com;epid=1234567890>\r\n"
               "Via: SIP/2.0/TLS 
10.94.150.51:5061;branch=z9hG4bKnashds8;rport\r\n"
               "Max-Forwards: 70\r\n"
               "ms-asserted-verification-level: 
ms-source-verified-user=verified\r\n"
               "From: \"Chris\" 
<sip:cdrigg at sip.com>;tag=1928301774;epid=1234567890\r\n"
               "To: <sip:naim at lcs-im.com>\r\n"
               "Call-ID: a84b4c76e66710\r\n"
               "CSeq: 1 SUBSCRIBE\r\n"
               "User-Agent: SIPimp.org/0.2.5 (curses)\r\n"
               "Event: presence\r\n"
               "Accept: application/pidf+xml\r\n"
               "Content-Length: 0\r\n"
               "\r\n");

      auto_ptr<SipMessage> message = 
auto_ptr<SipMessage>(SipMessage::make(txt, false));

      DebugLog ( << "Sending msg:" << *message );
      sipStack.send( *message );
</CODE>

However, when the message actually goes out the wire, the order of my 
SIP headers has been completely shifted around into something this:

SUBSCRIBE sip:naim at lcs-im.com;transport=TLS SIP/2.0
To: <sip:naim at lcs-im.com>
From: "Chris" <sip:cdrigg at sip.com>;tag=1928301774;epid=1234567890
Via: SIP/2.0/TLS 10.94.150.51:5061;branch=z9hG4bKnashds8;rport
Call-ID: a84b4c76e66710
CSeq: 1 SUBSCRIBE
Contact: 
<sip:cdrigg at sip.com:5061;transport=TLS;maddr=bldr-ccm51.sip.com;epid=1234567890>
Max-Forwards: 70
Accept: application/pidf+xml
User-Agent: SIPimp.org/0.2.5 (curses)
Event: presence
Content-Length: 0
ms-asserted-verification-level: ms-source-verified-user=verified

How do I change the order after calling SipMessage::make()? Or how do I 
prevent the stack from changing the order on me?

Thanks,
Chris







More information about the resiprocate-devel mailing list