After reviewing RFC 3261, I see that "The relative order of header fields with 
different field names is not significant."

I am accustomed to seeing 'Content-Length: 0' as the last header field in SIP 
tcpdump captures, so it looked wrong to me when SIPTAG_HEADER_STR() placed the 
custom header after Content-Length.  But I see now that is SIP compliant.

I was probably confused because when I use other Sofia-SIP tag macros, it is to 
modify default headers.  Those seem not to result in the header being added at 
the end of the set of headers, probably because they are modifying an existing 
header in-place.  Just a guess.

As long as the SIP parsers on downstream equipment keep reading past 
'Content-Length: 0' until the terminating empty line with CRLF is encountered 
that marks the end of the header section, the header added by 
SIPTAG_HEADER_STR() should work.

Any day I learn something about SIP is a good day.  :-)

Thanks.

Jim

----- Original Message ----
From: Michael Jerris <m...@jerris.com>
To: Jim Thomas <jimthomasembed...@yahoo.com>; sofia-sip-devel 
<sofia-sip-devel@lists.sourceforge.net>
Sent: Thu, May 20, 2010 8:35:09 AM
Subject: Re: [Sofia-sip-devel] Header created using SIPTAG_HEADER_STR appears 
after Content-Length header

Why is this a problem? 

Mike

On May 19, 2010, at 6:11 PM, Jim Thomas wrote:

> Hello,
> 
> I am experimenting with adding support for SIP 302 to redirect an inbound 
> call when the PBX is configured to forward the call.
> 
> The ITSP requires that the Contact header include the number where the call 
> should be redirected, and a Diversion header must be added that identifies 
> the valid SIP trunk DID associated with the call.
> 
> I tried sending this response to the incoming INVITE:
> 
>  nua_respond(handle, 302, "Moved Temporarily",
>              SIPTAG_CONTACT_STR("sip:9725551...@itsp.com:5060"),
>              SIPTAG_HEADER_STR("Diversion: <sip:9725559...@itsp.com>"),
>              TAG_END());
> 
> Sofia-SIP generates this outgoing response:
> 
>  SIP/2.0 302 Moved Temporarily
>  Via: SIP/2.0/UDP nnn.nnn.nnn.nnn:5060;branch=z9hG4bK39lurp00dgvh0e0fg2s0.1
>  From: "Out of Area" 
><sip:9725553...@itsp.com;user=phone>;tag=437990541-1274304841447-
>  To: "parentAccountFN parentAccountLN" 
><sip:9725559...@itsp.com>;tag=ay1e7NH4a9pDH
>  Call-ID: bw1734014471905101951145...@itsp.com
>  CSeq: 423519092 INVITE
>  Contact: <sip:9725551...@itsp.com:5060>
>  Accept: application/sdp
>  Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, 
>REFER, UPDATE, REGISTER
>  Supported: timer, 100rel
>  Content-Length: 0
>  Diversion: <sip:9725559...@itsp.com>
> 
> The problem is that the Diversion header created using SIPTAG_HEADER_STR() 
> appears *after* the Content-Length header.
> 
> I see this post from Oct 2006:
> 
>  
>http://www.mail-archive.com/sofia-sip-devel@lists.sourceforge.net/msg00928.html
> 
> I would think Sofia-SIP would process SIPTAG_HEADER_STR() by locating the 
> custom header *before* the Content-Length header.
> 
> I am using Sofia-SIP 1.12.10 (thank you for the open source contribution).
> 
> How can I parameterize or otherwise code a custom header such that it appears 
> before the Content-Length header?


      


------------------------------------------------------------------------------

_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to