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

[reSIProcate-users] [Resiprocate] Bad analysis of Refer-To field ==> exception


Hi,

Could you give me your opinion on the following  problem ?

We encountered a problem on a transfer requested using REFER method: when the Express Talk softphone do a transfer, the 'ReferTo' field in the REFER message is as follow:

Refer-To: <sip:1101@xxxxxxxxxxxxxx?Replaces=1276700067-2784-MARIO-LAB-PC%40192.168.204.1;to-tag=d073d535;from-tag=1112>

 

When our application try to retrieve the URI from the Refer message (see code below), an exception is generated (in NameAddr::parse(ParseBuffer& pb), function "skipChar(Symbols::RA_QUOTE[0])". The exception is: [SIP] IWS BaseException.cxx:17 BaseException at ParseBuffer.cxx:86 ParseBuffer.cxx:86, Parse failed expected '>').

 

In fact, after analysis, we found that the problem is due to the function "Uri::parse(ParseBuffer& pb)": at the end of this function the call  to the function " pb.skipToOneOf(Symbols::RA_QUOTE, Symbols::SEMI_COLON)" doesn't work. Before and after this call, the position() value is unchanged:

[SIP] IWS Uri.cxx:854 Uri::parse: pos = ;to-tag=65eeb22a;from-tag=8103>

[SIP] IWS NameAddr.cxx:218 NameAddr::parse: pos= ;to-tag=65eeb22a;from-tag=8103>

 

Do you think that we could modify this code as follows ? It works in our case, but I'm not sure that this correction is valid for all cases.

 

   if (!pb.eof() && *pb.position() == Symbols::QUESTION[0])

   {

      const char* anchor = pb.position();

      pb.skipToOneOf(ParseBuffer::Whitespace, ";>");

      pb.skipToOneOf(Symbols::RA_QUOTE);                       <<== added !!

      pb.data(mEmbeddedHeadersText, anchor);

   }

 

Thanks in advance,

BR,

Jean-Marc.

 

Our source code:

 

      try

      {

        if (sipMessage->header(h_ReferTo).isWellFormed())

          pt_contexte->infoEsig.ReferTo = new Uri(sipMessage->header(h_ReferTo).uri());                                            ===>> Exception generated !!!

        else

          trm_Printf (tre_levFat, iwsv_ptTrInfo, "[IWS:PIP] Error URI: syntax error in 'ReferTo' field");

      }

      catch (BaseException& exception)

      {

        const char *errMsg = exception.getMessage().data();

        trm_Printf (tre_levFat, iwsv_ptTrInfo, "[IWS:PIP] Error URI: exception in 'ReferTo' field %s", errMsg);

      }

 


Jean-Marc Bernadet
Consultant
BU Telecom

http://www.devoteam.com/images/environment.gif
Please consider the environment - do you really need to print this email ?