< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] NameAddr parsing


I have found a problem with parsing NameAddr field values that start
with an *.  I have a phone that sends the following header field value
when I dial *98:

To: *98 <sip:*98@xxxxxxxx>

The current NameAddr::parse() code parses this as the special all
contacts  field and does not parse the display name or URI.  

Note: another phone I have sends the following which is correctly
parsed.

To: "*98" <sip:*98@xxxxxxxx>

I have fixed by replacing the following code in NameAddr::parse():

   if (!pb.eof() && *pb.position() == Symbols::STAR[0])
   {
      mAllContacts = true;
      pb.skipChar(Symbols::STAR[0]);
      pb.skipWhitespace();
      // now fall through to parse header parameters
   }
   else
   {

with the following:

   if (!pb.eof() && *pb.position() == Symbols::STAR[0])
   {
      pb.skipChar(Symbols::STAR[0]);
      pb.skipWhitespace();
      if (pb.eof() || *pb.position() == Symbols::SEMI_COLON[0]) {
         mAllContacts = true;
         // fall through to parse header parameters
      }
      else  {
         // this must just be a unquoted display name starting with *
         pb.reset(start);
      }
   }
   if( !mAllContacts )
   {