Summary:ASTERISK-16949: [patch] Incorrect handling of non-ascii characters in Display Name
Reporter:Örn Arnarson (orn)Labels:
Date Opened:2010-11-12 05:14:10.000-0600Date Closed:2011-08-23 23:45:12
Versions:Frequency of
Environment:Attachments:( 0)
( 1) 1.8.0.pcap
( 2) chan_sip.c.caller_name_fix.diff
Description:Asterisk 1.8.0 seems to use URI escape codes in the Display Name / CallerID(name).

I found a discussion on the implementation here:

oej points out here that the Display Name is not part of the URI and should never be escaped, but oddly enough this seems to have been ignored.

The Display Name is confirmed to be displayed incorrectly on the displays on Aastra 6731i, Aastra 6739i, Aastra 6757i, Snom 300 and Linksys SPA-941.


Here is a working INVITE from Asterisk

INVITE sip:1502@;transport=udp SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK73713002;rport
Max-Forwards: 70
From: "SIP ehf/Örn Arnarson" <sip:7712552@>;tag=as2813a8fe
To: <sip:1502@;transport=udp>
Contact: <sip:7712552@>

Here is the an INVITE with the same caller-id information in 1.8.0:

INVITE sip:1502@;transport=udp SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK1ff411d7
Max-Forwards: 70
From: "SIP ehf/%C3%96rn Arnarson" <sip:7712552@>;tag=as701c8835
To: <sip:1502@;transport=udp>
Contact: <sip:7712552@>

Setting callerid(name-charset) does not have any effect on what is transmitted.
Comments:By: Igor Goncharovsky (igorg) 2011-01-24 03:40:45.000-0600

You can make 1.8 working just by setting pedantic=no in sip.conf. As I see even in 1.4 pedantic=yes made name to be url-encoded. May be in 1.6.2 you already have pedantic=no?

By: Örn Arnarson (orn) 2011-01-24 07:25:48.000-0600

pedantic is at its default value (i.e. not specified), so it is at whatever is the default for the version.

But as stated multiple times by oej, this should never be uri-encoded, pedantic=yes or =no, as this is isn't part of the uri. So if you're right and it is uri-encoded with pedantic=yes, I would say that is a bug as well.

* Edit: I have confirmed what you said; pedantic = yes indeed does cause the same behavior. Only one problem I have with that is that I need pedantic in 1.8 to work around another bug which still hasn't been fixed :S

By: Igor Goncharovsky (igorg) 2011-01-24 20:45:22.000-0600

Here is the patch, that exclude name from being url-encoded when from: header created

By: Örn Arnarson (orn) 2011-01-25 04:32:42.000-0600

Thanks. Patch confirmed to work.

By: Walter Doekes (wdoekes) 2011-01-25 05:43:00.000-0600

You did not have pedantic=yes on that 1.6.2 sip trace, did you? After all, 1.6.2 still has that same ast_uri_encode(n...).

By: Örn Arnarson (orn) 2011-01-25 07:10:58.000-0600

No, pedantic wasn't specified in sip.conf in any of the traces, so the value was at its default (no for 1.6, yes for 1.8). That explains the difference between versions.