<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<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[1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX]: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]: INFO:sipmsgops:parse_pvs_header: using hdr type name <x-livevox-correlation-id></div>
<div>Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]: TRACE[1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX]: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[1426279248727-2aab0be445b0-c8166130-00d1441a@XXX.XXX.XXX.XXX]:route[conditions]:222222222222222222222222222222222222222222222222header x-livevox-correlation-id not found</div>
<div><br>
</div>
<div>when handling this message:</div>
<div><br>
</div>
<div>From: <sip:14075551112@XXX.XXX.XXX.XXX:5060>;tag=2aaaf56b2208-0-13c4-6009-b6e9b3-2dc5137e-b6e9b3</div>
<div>To: <sip:+14153739183@XXX.XXX.XXX.XXX></div>
<div>Call-ID: 1426286197921-2aab3cfb22e0-c813f990-00d0059e@XXX.XXX.XXX.XXX</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: <sip:14075551112@XXX.XXX.XXX.XXX:5060></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>
</body>
</html>