[asterisk-bugs] [JIRA] (ASTERISK-26069) Asterisk truncates To: header, dropping the closing '>'

Freddi Hansen (JIRA) noreply at issues.asterisk.org
Sun May 29 15:59:56 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=230820#comment-230820 ] 

Freddi Hansen commented on ASTERISK-26069:
------------------------------------------

Hi I had the same problem with Zoiper, the quick solution for you until someone fixes this is to chan_sip.c. 
search for "static void initreqprep".
change
struct ast_str *invite = ast_str_alloca(256)  to struct ast_str *invite = ast_str_alloca(512)
and
char to[256]; to char to[512];
this change took care of that warning for me.

If you want the Zoiper windows push function to work and you use realtime then you must also explain the 'fullcontact' field in sip_peers to 512.
b.r.
Freddi



> Asterisk truncates To: header, dropping the closing '>'
> -------------------------------------------------------
>
>                 Key: ASTERISK-26069
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26069
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/General
>    Affects Versions: 13.9.1
>         Environment: Ubuntu 14.04 ia32
>            Reporter: Vasil Kolev
>         Attachments: asterisk-broken-to-header.pcap
>
>
> As part of the development of push notifications for Windows phone for the Zoiper softphone, we've discovered that after some version (this AFAIK worked with 1.4), Asterisk starts truncating the To: header if it finds it too large. This leads to nasty issues, for example broken SIP packets in some cases.
> Asterisk 11.9 didn't give a very useful message:
> failed to extend from 256 to 427
> Asterisk 13.9.1 gives the following:
> [May 27 16:02:21] ERROR[25411][C-0000001b]: chan_sip.c:14348 initreqprep: The To header was truncated in call '25b40e7f1e385c1e498e17d35ef28515 at 10.8.1.11:5060'. This call setup will fail.
> which is a bit more useful, but doesn't help with the problem itself. I'll attach a packet capture with the problem, where it's visible that asterisk sends an invite with a To: header that looks like this:
> To: <sip:push1 at 10.8.3.92:50068;transport=TCP;rinstance=4015b61ba94093b5;X-PUSH-URI=http://e.notify.live.net/u/1/db5/H2QAAABZevVMbUI_okG-i5MjqfgHM8pKQ4-e3m7bKOGXxA9bBxPEXLj0gYK50BliT1FrnU8xtXJzYYPmTvQ1DIXqNfHK-MtAo3b9ppbBsGz6GjYHA-p-yAZ6R2r2xql6ViL727I/d2luZG9
> (e.g. the closing '>' is missing). The contact is also truncated (there are some more bytes to it).
> AFAIK in the code there are some static arrays to hold these headers, which creates the issue.
> The RFCs don't have any limitation on these headers, and there are also drafts that use these fields extensively (see for example https://datatracker.ietf.org/doc/draft-ivanov-sipcore-pnsip/ ). This also seems to be a regression from previous versions, and not something we've found as an issue with other SIP gateways.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list