I am in the process of cleaning up and consolidating how the various
components of a SIP URI (or name-addr, actually) are accessed.  This
work was discussed here long ago but has never been finished.  I expect
that it will be incorporated into sipX version 4.2.  (It will definitely
not be put into 4.0.)

As we discussed previously, the fundamental interface fix is that all of
the accessors and modifiers of individual components of the Url object
will return/accept the component value in the "unescaped" form.  This
allows the user of the Url object to be oblivious to the particular
quoting requirements of each component, and always see components in
their "canonical" form.

For instance, if we set up

        Url urlA("sip:[email protected]");
        Url urlB("sip:%66%[email protected]");

then 'urlA.getUserId(string)' and 'urlB.getUserId(string)' would both
set 'string' to 'foo'.  Similarly,

        Url url("sip:[email protected]");
        url.setUserId("<><>");

will cause 'url.toString()' to return 'sip:%3c%3e%[email protected]'.

Some of the accessors/modifiers already work this way, but others do
not, and the current interface is inconsistent.  None of the users of
the Url object (that I know of) take into account the possibility that
components may have quoting.

The gory details of this fix are straightforward but tedious, but there
is one place where some user-visible decisions need to be made, viz.,
how the display-name part of a name-addr is best represented.

RFC 3261 does not suggest a 'canonical' way to present display-names,
unlike the other components.  The unambiguous way to write a
display-name is with "...":

        "Foo Bar"<sip:[email protected]>
        "Foo Bar" <sip:[email protected]>

Clearly, the value of the display-name component here should be
'Foo Bar'.

But the unquoted form allows embedded whitespace, as well as whitespace
between the non-whitespace characters and the '<':

        Foo Bar<sip:[email protected]>
        Foo Bar <sip:[email protected]>

My inclination is that the internal whitespace should be considered
significant but the whitespace just before '<' should not be.  (Note
that the syntax allows multiple whitespace characters, and tabs are
allowed as well as spaces.)

Similarly, when generating the string representation of the name-addr,
the Url object can choose whether to put whitespace between the
display-name and the '<'.  My inclination is to always generate a single
space between the two, but that does have the disadvantage that
name-addrs would contain spaces where they would not be required to:

        Foo <sip:[email protected]>
in preference to
        Foo<sip:[email protected]>

Comments?

Dale


_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev

Reply via email to