[OpenSIPS-Users] indeterminate is_present_hf behavior

Liviu Chircu liviu at opensips.org
Sun Apr 5 16:42:01 CEST 2015


Hi Eric,

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].

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!

[1] https://github.com/OpenSIPS/opensips/issues
[2] https://gist.github.com/liviuchircu/4d11849693a659760b7e

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 14.03.2015 02:47, Eric Werkhoven wrote:
> Hi,
>
> 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.
>
> Here is the relevant code (debug xlog statements added, production 
> code is sparser):
>
> case 3:
>     xlog("L_INFO","TRACE[$ci]:route[conditions]:condition has header 
> existence operator(3) where header $var(field) should exist");
>     if (is_present_hf("$var(field)") || $hdr($var(field)) != NULL) {
> xlog("L_DEBUG","TRACE[$ci]:route[conditions]:we've got a $var(field) 
> header with value $hdr($var(field))");
>             if (is_present_hf("$var(field)")) {
> xlog("L_INFO","TRACE[$ci]:route[conditions]:111111111111111111111111111111111111111111111111we've 
> got a $var(field) header with value $hdr($var(field))");
>             }
>             else {
> xlog("L_INFO","TRACE[$ci]:route[conditions]:111111111111111111111111111111111111111111111111header 
> $var(field) not found");
>             }
>     }
>     else {
> xlog("L_DEBUG","TRACE[$ci]:route[conditions]:header $var(field) not 
> found");
>             $var(conditions_failed) = $var(conditions_failed) + 1;
>     }
>     if (is_present_hf("$var(field)")) {
> xlog("L_INFO","TRACE[$ci]:route[conditions]:222222222222222222222222222222222222222222222222we've 
> got a $var(field) header with value $hdr($var(field))");
>     }
>     else {
> xlog("L_INFO","TRACE[$ci]:route[conditions]:222222222222222222222222222222222222222222222222header 
> $var(field) not found");
>     }
>     break;
>
> which produces the following log:
>
> Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]: 
> TRACE[1426279248727-2aab0be445b0-c8166130-00d1441a at XXX.XXX.XXX.XXX]:route[conditions]:condition 
> has header existence operator(3) where header x-livevox-correlation-id 
> should exist
> Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]: 
> INFO:sipmsgops:parse_pvs_header: using hdr type name 
> <x-livevox-correlation-id>
> Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]: 
> TRACE[1426279248727-2aab0be445b0-c8166130-00d1441a at XXX.XXX.XXX.XXX]:route[conditions]:111111111111111111111111111111111111111111111111we've 
> got a x-livevox-correlation-id header with value xlvcorid
> Mar 13 16:40:48 sipdr400 /usr/local/sbin/opensips[22721]: 
> TRACE[1426279248727-2aab0be445b0-c8166130-00d1441a at XXX.XXX.XXX.XXX]:route[conditions]:222222222222222222222222222222222222222222222222header 
> x-livevox-correlation-id not found
>
> when handling this message:
>
> From: 
> <sip:14075551112 at XXX.XXX.XXX.XXX:5060>;tag=2aaaf56b2208-0-13c4-6009-b6e9b3-2dc5137e-b6e9b3
> To: <sip:+14153739183 at XXX.XXX.XXX.XXX>
> Call-ID: 1426286197921-2aab3cfb22e0-c813f990-00d0059e at XXX.XXX.XXX.XXX
> CSeq: 1 INVITE
> Via: SIP/2.0/UDP 
> XXX.XXX.XXX.XXX:5060;rport;branch=z9hG4bK-b6e9b3-ca80e5c0-3b30eff8-2aaaf4694408
> x-accountid: 2
> x-appid: 24601
> x-joinsid: f652ceb9f649ceb50a1d44d2507891cc
> x-livevox-correlation-id: xlvcorid
> x-sid: 6ae1bd9e681f8da0c51809a87c345c86
> x-vdirect: true
> Max-Forwards: 69
> User-Agent: VCS11.6.67950.0
> Contact: <sip:14075551112 at XXX.XXX.XXX.XXX:5060>
> Content-Type: application/sdp
> Content-Length: 229
>
> v=0
> o=- 1 1 IN IP4 XXX.XXX.XXX.XXX
> s=XXX.XXX.XXX.XXX
> c=IN IP4 XXX.XXX.XXX.XXX
> t=0 0
> m=audio 12334 RTP/AVP 101 0 8
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=rtpmap:0 PCMU/8000
> a=rtpmap:8 PCMA/8000
> a=ptime:20
>
> This looks like a bug to me, or am I missing something? Anyone has an 
> idea how this behavior is possible?
>
> thanks,
>
> Eric Werkhoven
> dev-voip, livevox.com​
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150405/4ef927c2/attachment.htm>


More information about the Users mailing list