[SR-Users] search_hf returns always true

Ajay Sabat Ajay.Sabat at panasonic.aero
Thu Mar 14 22:16:31 CET 2013


Hi,

I want to check whether a parameter exists in a header and I am using the search_hf() function defined in textops module. I am surprised that is always returning true whether the searched pattern exists or not.

To be specific, I need to check if the "received" parameter exists in the top most via header and this is how I do it. The statements inside the if block get executed all the time irrespective of whether the received parameter exists in the top most via or not. Any help what am I doing wrong here?

if (search_hf("Via", "received=", "f")) {
                                xdbg("received param $sel(via.received) in top most via header \n");
                                # perform necessary action
                }

Case 1: no received parameter in via
Via header in response message looks like:
Via: SIP/2.0/UDP 192.168.1.5;branch=z9hG4bK39bc.c1076d93.0
Via: SIP/2.0/UDP 192.168.1.3:5060;rport=5060;branch=z9hG4bK56870034

And the corresponding debug message from Kamailio is:
./sbin/kamailio[22600]: DEBUG: <script>: received param <null> in top most via header

Case 2: received parameter exists
Via header in response message looks like:
Via: SIP/2.0/UDP 192.168.1.5;branch=z9hG4bK006e.18417697.0;received=10.139.90.137
Via: SIP/2.0/UDP 192.168.1.3:5060;rport=5060;branch=z9hG4bK960971659

And the corresponding debug message:
./sbin/kamailio[22600]: DEBUG: <script>: received param 10.139.90.137 in top most via header

Thanks,
Ajay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130314/f4f13f94/attachment.htm>


More information about the sr-users mailing list