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

Re: [reSIProcate-users] How to parse headers


This is the only way to access the raw buffer, but you need to realize that once a header is parsed, the underlying buffer is no longer valid (the _real_ value of the header is now encapsulated in the members of whatever subclass of LazyParser you're working with). If all you want is a string representation of the header field value, you have to use operator<<, or Data::from(), like so:

Data toHfv = Data::from(msg.header(h_To));

Best regards,
Byron Campen

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.

_______________________________________________
resiprocate-users mailing list

Attachment: smime.p7s
Description: S/MIME cryptographic signature