<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font face="monospace">Hi Eric,<br>
      <br>
      First of all, thank you for the detailed bug report! For future
      reference, do not hesitate to open GitHub issues if you run into
      such problematic behaviour [1].<br>
      <br>
      Secondly, I just committed a fix for this on the dev branch, and
      also made a public gist available for 1.11, so you can properly
      test it as well before it gets backported. [2] Thanks in advance
      for any feedback on the patch!<br>
      <br>
      [1] <a class="moz-txt-link-freetext" href="https://github.com/OpenSIPS/opensips/issues">https://github.com/OpenSIPS/opensips/issues</a><br>
      [2] <a class="moz-txt-link-freetext" href="https://gist.github.com/liviuchircu/4d11849693a659760b7e">https://gist.github.com/liviuchircu/4d11849693a659760b7e</a><br>
      <br>
      Best regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 14.03.2015 02:47, Eric Werkhoven
      wrote:<br>
    </div>
    <blockquote
cite="mid:BN1PR04MB502D0520F26456E0ADD71C0D6040@BN1PR04MB502.namprd04.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <div>Hi,</div>
        <div><br>
        </div>
        <div>I've experienced some puzzling behavior with the
          is_present_hf function of the sipmsgops module, version 1.11.
          When checking for the presence of a custom header the function
          sometimes returns true and sometimes false for the same header
          in the same INVITE message. </div>
        <div><br>
        </div>
        <div>Here is the relevant code (debug xlog statements added,
          production code is sparser):</div>
        <div><br>
        </div>
        <div>case 3:</div>
        <div>    xlog("L_INFO","TRACE[$ci]:route[conditions]:condition
          has header existence operator(3) where header $var(field)
          should exist");</div>
        <div>    if (is_present_hf("$var(field)") || $hdr($var(field))
          != NULL) {</div>
        <div>           
          xlog("L_DEBUG","TRACE[$ci]:route[conditions]:we've got a
          $var(field) header with value $hdr($var(field))");</div>
        <div>            if (is_present_hf("$var(field)")) {</div>
        <div>                   
          xlog("L_INFO","TRACE[$ci]:route[conditions]:111111111111111111111111111111111111111111111111we've
          got a $var(field) header with value $hdr($var(field))");</div>
        <div>            }</div>
        <div>            else {</div>
        <div>                   
          xlog("L_INFO","TRACE[$ci]:route[conditions]:111111111111111111111111111111111111111111111111header
          $var(field) not found");</div>
        <div>            }</div>
        <div>    }</div>
        <div>    else {</div>
        <div>           
          xlog("L_DEBUG","TRACE[$ci]:route[conditions]:header
          $var(field) not found");</div>
        <div>            $var(conditions_failed) =
          $var(conditions_failed) + 1;</div>
        <div>    }</div>
        <div>    if (is_present_hf("$var(field)")) {</div>
        <div>           
          xlog("L_INFO","TRACE[$ci]:route[conditions]:222222222222222222222222222222222222222222222222we've
          got a $var(field) header with value $hdr($var(field))");</div>
        <div>    }</div>
        <div>    else {</div>
        <div>           
          xlog("L_INFO","TRACE[$ci]:route[conditions]:222222222222222222222222222222222222222222222222header
          $var(field) not found");</div>
        <div>    }</div>
        <div>    break;</div>
        <div><br>
        </div>
        <div>which produces the following log:</div>
        <div><br>
        </div>
        <div>Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]:
          TRACE[<a class="moz-txt-link-abbreviated" href="mailto:1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX">1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX</a>]:route[conditions]:condition
          has header existence operator(3) where header
          x-livevox-correlation-id should exist</div>
        <div>Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]:
          <a class="moz-txt-link-freetext" href="INFO:sipmsgops:parse_pvs_header">INFO:sipmsgops:parse_pvs_header</a>: using hdr type name
          &lt;x-livevox-correlation-id&gt;</div>
        <div>Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]:
          TRACE[<a class="moz-txt-link-abbreviated" href="mailto:1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX">1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX</a>]:route[conditions]:111111111111111111111111111111111111111111111111we've
          got a x-livevox-correlation-id header with value xlvcorid</div>
        <div>Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]:
          TRACE[<a class="moz-txt-link-abbreviated" href="mailto:1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX">1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX</a>]:route[conditions]:222222222222222222222222222222222222222222222222header
          x-livevox-correlation-id not found</div>
        <div><br>
        </div>
        <div>when handling this message:</div>
        <div><br>
        </div>
        <div>From:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:14075551112@XXX.XXX.XXX.XXX:5060">&lt;sip:14075551112@XXX.XXX.XXX.XXX:5060&gt;</a>;tag=2aaaf56b2208-0-13c4-6009-b6e9b3-2dc5137e-b6e9b3</div>
        <div>To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:+14153739183@XXX.XXX.XXX.XXX">&lt;sip:+14153739183@XXX.XXX.XXX.XXX&gt;</a></div>
        <div>Call-ID:
          <a class="moz-txt-link-abbreviated" href="mailto:1426286197921-2aab3cfb22e0-c813f990-00d0059e@XXX.XXX.XXX.XXX">1426286197921-2aab3cfb22e0-c813f990-00d0059e@XXX.XXX.XXX.XXX</a></div>
        <div>CSeq: 1 INVITE</div>
        <div>Via: SIP/2.0/UDP
XXX.XXX.XXX.XXX:5060;rport;branch=z9hG4bK-b6e9b3-ca80e5c0-3b30eff8-2aaaf4694408</div>
        <div>x-accountid: 2</div>
        <div>x-appid: 24601</div>
        <div>x-joinsid: f652ceb9f649ceb50a1d44d2507891cc</div>
        <div>x-livevox-correlation-id: xlvcorid</div>
        <div>x-sid: 6ae1bd9e681f8da0c51809a87c345c86</div>
        <div>x-vdirect: true</div>
        <div>Max-Forwards: 69</div>
        <div>User-Agent: VCS11.6.67950.0</div>
        <div>Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:14075551112@XXX.XXX.XXX.XXX:5060">&lt;sip:14075551112@XXX.XXX.XXX.XXX:5060&gt;</a></div>
        <div>Content-Type: application/sdp</div>
        <div>Content-Length: 229</div>
        <div><br>
        </div>
        <div>v=0</div>
        <div>o=- 1 1 IN IP4 XXX.XXX.XXX.XXX</div>
        <div>s=XXX.XXX.XXX.XXX</div>
        <div>c=IN IP4 XXX.XXX.XXX.XXX</div>
        <div>t=0 0</div>
        <div>m=audio 12334 RTP/AVP 101 0 8</div>
        <div>a=rtpmap:101 telephone-event/8000</div>
        <div>a=fmtp:101 0-15</div>
        <div>a=rtpmap:0 PCMU/8000</div>
        <div>a=rtpmap:8 PCMA/8000</div>
        <div>a=ptime:20</div>
        <div><br>
        </div>
        <div>This looks like a bug to me, or am I missing something?
          Anyone has an idea how this behavior is possible?</div>
        <div><br>
        </div>
        <div>thanks,</div>
        <div><br>
        </div>
        <div>Eric Werkhoven</div>
        <div>dev-voip, livevox.com​<br>
        </div>
        <p><br>
        </p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>