[SR-Users] How to find whether or not certain header exists?

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 26 09:57:02 CEST 2014


Hello,

you can use:

if(is_present_hf("aaa")) ...

Also, it should work like:

if($hdr("aaa") != $null) ...

The is_present_hf() should be slightly faster as it just walks through 
the list of headers, not parsing the header body and not returning its 
value.

Cheers,
Daniel

On 26/06/14 06:35, Allen Zhang wrote:
>
> Hi,
>
> If I normally receive a INVITE that has a header ‘aaa’ with value 
> ‘bbb’, but it’s possible that some INVITEs don’t have this header.
>
> How do I determine in the config file if the header exists?
>
> To check the value of the header I do if($hdr(aaa) == "bbb"). But what 
> if the header doesn’t exist?
>
> Cheer,
>
> Allen
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140626/7fb99514/attachment.html>


More information about the sr-users mailing list