From miconda@gmail.com Fri Mar 15 08:33:55 2013 From: Daniel-Constantin Mierla To: sr-users@lists.kamailio.org Subject: Re: [SR-Users] search_hf returns always true Date: Fri, 15 Mar 2013 08:33:48 +0100 Message-ID: <5142CEDC.3070701@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0239009170==" --===============0239009170== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: