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

[reSIProcate-users] How to parse headers


string getTo(SipMessage& msg){

const char* temp = msg.header(h_To).getHeaderField().mField;

}

The value for the header field looks like this:

"<sip:amitabh_agent2@xxxxxxx>
Via: SIP/2.0/UDP 148.147.18.71:5060;branch=z9hG4bKD2957346A7938354537e93d.0,SIP/
2.0/UDP 148.147.46.104:5160;psrrposn=1;branch=z9hG4bK-d8754z-fa5cb737df5e5066-1-
--d8754z-;rport
Content-Length: 18
Content-Type: text/plain
Max-Forwards: 69
User-Agent: AvayaSipUA/1.0
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,NOTIFY,MESSAGE

 

My question is how do I get rid of all the noise...I am just interested in "<sip:amitabh_agent2@xxxxxxx>".

Is there a buit in function to do this?. I guess if I could get rid of anything after ";" that would be fine too.

I need to do this for From, To, Call-ID and unknown headers as well.