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

[reSIProcate-users] Parse a INVITE message


Hello,

I'm trying to parse a INVITE SIP message to get the To header, From headre, URI, tag....etc
Here my code to parse the URI From header:

{
char* txt = (char*)buf->get_data(); //To get the INVITE message
resip::SipMessage* msg = new resip::SipMessage();

size_t lentxt = strlen(txt);
char* buffer = new char[lentxt + 5];
msg->addBuffer(buffer);
memcpy(buffer,txt, lentxt);
msg = msg->make(buffer,false);

printf(msg->header(resip::h_From).uri().user().data());
}

The printf give me everything that was after the From Header and not just the URI as I asked:

admin@xxxxxxxxxxxx:5060>;tag=42559c3a
To: "111"<sip:111@xxxxxxxxxxxx:5060>
Call-ID: ZWI2NTZhYWYzMzY1Y2ZiMjJiYWU4ZWM1YdMTg5Y2Y.
CSeq: 1 INVITE
Via: SIP/2.0/UDP 172.16.21.19:16084;rport=16084;branch=z9hGfK-d87543-c65c9a07513afd65-1--d87543-
Max-Forwards: 70
User-Agent: X-Lite release 1006e stamp 34025
Contact: <sip:admin@xxxxxxxxxxxx:16084>
....

It's my first attempt with ReSip, do you know how I can just get the URI ?


Regards