[reSIProcate] How got the customization header value?

Byron Campen bcampen at estacado.net
Sat Jan 5 12:28:30 CST 2008


	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 at gmail.com>:
> 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 at estacado.net>:
> 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 at sip.test.net: 
>> 5060>;tag=87625ddffbb24ccca3705354d9b0edc4.8c6c
>> From: "user1"< sip:user1 at sip.test.net:5060>;tag=32493031
>> Call-ID: OWM3ZTNkNGRjMzI4YTdmZTVlY2RhNDQ5OGQ0YTA4OWY.
>> CSeq: 2 REGISTER
>> Contact: <sip:  
>> user1 at 192.168.1.188:49892;rinstance=bdd2255bddaf9c63>;expires=3600;re 
>> ceived="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 at resiprocate.org
>> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel
>
>
>
>
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel at resiprocate.org
> https://list.resiprocate.org/mailman/listinfo/resiprocate-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20080105/117a82ee/attachment.htm>


More information about the resiprocate-devel mailing list