[SR-Users] search_hf returns always true

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 15 08:33:48 CET 2013


Hello,

after a quick look over the code, I haven't spotted any issue.

Do you call the function for the sip request or for sip reply?

Can you attach the ngrep of the sip message you test for? I can use it 
to test locally, re-injecting with protoshoot.

Cheers,
Daniel

On 3/14/13 10:16 PM, Ajay Sabat wrote:
>
> 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
>
>
>
> _______________________________________________
> 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
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130315/62b95930/attachment-0001.htm>


More information about the sr-users mailing list