[Home]

Summary:ASTERISK-16954: Caller Name does not preserve multiple spaces
Reporter:Trevor Peirce (trev)Labels:chan-sip-message-parsing
Date Opened:2010-11-14 00:43:28.000-0600Date Closed:
Priority:MinorRegression?No
Status:Open/NewComponents:Channels/chan_sip/General
Versions:1.8.7.2 13.18.4 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-27045 Issue with Parsing Contact Header without Brackets and with additional HeaderParameters seperated with semicolon
Environment:Attachments:
Description:When asterisk receives an INVITE with a Caller Name containing multiple spaces, only one space is preserved.

Other SIP user agents / proxies / gateways as well as previous releases of asterisk do preserve multiple spaces.

For example, {{"Victoria<5 spaces>BC" <2505551234>}} becomes {{"Victoria BC" <2505551234>}} which is undesired.
Comments:By: Trevor Peirce (trev) 2010-11-14 00:44:43.000-0600

This bug tracker doesn't preserve spaces either :)  My first example had five spaces between Victoria and BC.

By: Stefan Schmidt (schmidts) 2010-11-16 06:51:23.000-0600

i am not sure but i think this happens here:
http://www.asterisk.org/doxygen/trunk/callerid_8c-source.html#l01010
the question is if this is a RFC violation or not.

I have looked at the RFC 3261 (SIP) which says the display-name is declared in RFC 2822.
RFC2822 says:
Runs of FWS, comment or CFWS that occur between lexical tokens in a
  structured field header are semantically interpreted as a single
  space character.

which means to me asterisk does exactly what the RFC says.



By: Trevor Peirce (trev) 2010-11-16 12:43:10.000-0600

I believe this only comes in to play if you have string with a run of sequences like this:

Header-Name: Some (comment
that goes here) Value

becomes "Some Value" with a single space, not "Some  Value" with two spaces because of the comment.

Furthermore, we are dealing with a quoted-string that contains the Caller Name.  My understanding is that the only case spaces will be removed are the spaces immediately following a CRLF, for example:

Caller-Name: "Bob's
  Pizza"

would become

Caller-Name: "Bob's Pizza"

By: David Woolley (davidw) 2011-12-14 05:32:43.803-0600

The whole of a quoted string is a single lexical token.

(However note that Windows email programs have established a culture of abusing quotes in such fields; RFC 822 was designed so that most headers didn't need quotes, so that you could print the raw header had have it look like a typed memo.)