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

Re: [reSIProcate] How got the customization header value?


You can also add a iter->second.exists(h_Customization) check in there before the emtpy() check, and this will prevent the creation of an empty list for your Customization header. Also, you should probably also check iter->second.header(h_Customization).front().isWellFormed()  since if somebody slips some garbage parameters on your header, and you don't check, an exception will be thrown when you call iter->second.header(h_Customization).front().value().

Best regards,
Byron Campen

I have sovled it, thanks.
 

 ExtensionHeader h_Customization(headerName.c_str());

 if (iter->second.header(h_Customization).empty() == true)
 {
  return false;
 }

 Data value(iter->second.header(h_Customization).front().value());



 
2008/1/5, Karlsson <boost.regex@xxxxxxxxx>:
Can't compile it :
 
error C2664: 'resip::SipMessage::empty' : cannot convert parameter 1 from 'resip::ExtensionHeader' to 'const resip::HeaderBase &'
1>        Reason: cannot convert from 'resip::ExtensionHeader' to 'const resip::HeaderBase'
 
Thanks


2008/1/4, Byron Campen <bcampen@xxxxxxxxxxxx>:
ExtensionHeader h_Balance("Balance");
 
if(!sip.empty(h_Balance))
 
{
 
Data balance(sip.header(h_Balance).begin().value());
 
}
 

 
Best regards,
Byron Campen

For example:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.188:49892 ;branch=z9hG4bK-d87543-7956131ab8501846-1--d87543-;rport=49892;received= 222.247.100.137
To: "user1"< sip:user1@xxxxxxxxxxxx:5060>;tag=87625ddffbb24ccca3705354d9b0edc4.8c6c
From: "user1"< sip:user1@xxxxxxxxxxxx:5060>;tag=32493031
Call-ID: OWM3ZTNkNGRjMzI4YTdmZTVlY2RhNDQ5OGQ0YTA4OWY.
CSeq: 2 REGISTER
Contact: <sip: user1@xxxxxxxxxxxxx:49892;rinstance=bdd2255bddaf9c63>;expires=3600;received="sip: 222.10.100.137:49892 "
Server: OpenSer (1.1.1-notls (i386/linux))
Balance: 123.00
Content-Length: 0


How to get the 123:00 of  "Balance: 123.00" header?


I have checked with Wiki, just saw this:

Extension Header

SIP is an open specification. Elements may add headers that are not generally known. Extension headers are always of type StringCategory and are multiple valued but not comma separated. Extension headers may have parameters, however, not all stacks will consider semi-colons in extension headers significant, so extension header parameters may cause interop problems.

Extension headers are declared, for example:

static const resip::ExtensionHeader h_XFoos("X-Foo");

They are used similarly to built-in headers; the h_XFoos declared above is a header access token.

msg->header(h_XFoos).push_back(StringCategory("value"));


Thanks

_______________________________________________
resiprocate-devel mailing list

 


_______________________________________________
resiprocate-devel mailing list