[OpenSIPS-Users] check for NULL values

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Nov 15 06:55:44 EST 2018


Hi Pasan,

Indeed, the logs show that the TO hdr is successfully parsed - are you 
100% sure about the reported line ? maybe it is not the $tu related ? 
try to activate the script_trace() 
[http://www.opensips.org/Documentation/Script-CoreFunctions-2-4#toc42] 
function to see when exactly the error is generated. Maybe you can 
actually print $tu before, to see what you get.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
   http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 11/15/2018 10:04 AM, Pasan Meemaduma wrote:
> Hi Bogdan,
>
> I'm not seeing any other related error msg prior to this. I'm calling 
> this test in request route for a REGISTER request. Before the error 
> pops up I could see the received msg successfully parse by opensips 
> and can see value of To uri
>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_msg: SIP 
> Request:
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_msg:  
> method:  <REGISTER>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_msg:  
> uri:     <sip:xx.xx.xx.xx>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_msg:  
> version: <SIP/2.0>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=2
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_via_param: 
> found param type 232, <branch> = <z9hG4bK-24790813>; state=16
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_via: end of 
> header reached, state=5
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> via found, flags=2
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> this is the first via
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:receive_msg: 
> After parse_msg...
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:receive_msg: 
> preparing to run routing scripts...
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=100
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:_parse_to: end of 
> header reached, state=10
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:_parse_to: 
> display={XXXXXXXXXX}, ruri={sip:XXXXXXXXXX at xx.xx.xx.x}
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: 
> <To> [48]; uri=[sip:XXXXXXXXXX at x.x.x.x]
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to 
> body [XXXXXXXXXX <sip:XXXXXXXXXX at x.x.x.x>#015#012]
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: 
> cseq <CSeq>: <79474> <REGISTER>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: 
> DBG:maxfwd:is_maxfwd_present: value = 70
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_to_param: 
> tag=46474fbe5728f700o0
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:_parse_to: end of 
> header reached, state=29
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:_parse_to: 
> display={XXXXXXXXXX}, ruri={sip:XXXXXXXXXX at x.x.x.x}
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=200
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: 
> content_length=0
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: 
> found end of header
>
> and following are the line that I get before the error If I set log 
> level to 6
>
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=ffffffffffffffff
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=ffffffffffffffff
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:parse_headers: 
> flags=ffffffffffffffff
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: ERROR:core:comp_scriptvar: 
> cannot get left var value
> Nov 15 18:19:19  /usr/sbin/opensips[21608]: WARNING:core:do_action: 
> error in expression at /etc/opensips/opensips.cfg:807
>
>
>
>
> On Wednesday, 14 November 2018, 7:19:44 PM GMT+5:30, Bogdan-Andrei 
> Iancu <bogdan at opensips.org> wrote:
>
>
> Hi Pasan,
>
> It should be fine if $tu would translate to NULL. The script handles 
> this case. But I'm afraid you have something else there, like another 
> deeper error that prevents the $tu variable to be evaluated.
>
> Do you see any other errors before the mentioned ones ? what is the 
> type of route where you do the test ?
>
> Regards,
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>    http://www.opensips-solutions.com
> OpenSIPS Bootcamp 2018
>    http://opensips.org/training/OpenSIPS_Bootcamp_2018/
> On 11/13/2018 10:56 AM, Pasan Meemaduma via Users wrote:
>> Hey,
>>
>> Anyone have a suggestion for this?
>>
>> On Thursday, 8 November 2018, 8:09:50 AM GMT+5:30, Pasan Meemaduma 
>> <pasandev at ymail.com> <mailto:pasandev at ymail.com> wrote:
>>
>>
>> Hi Guys,
>>
>> I have a check for NULL for $tu var in the script, But when the value 
>> is missing I'm getting the following error.
>>
>> ERROR:core:comp_scriptvar: cannot get left var value
>>
>> WARNING:core:do_action: error in expression at 
>> /etc/opensips/opensips.cfg:806
>>
>> and line 806 contains following.
>>
>>     if ( $tu != NULL ) {
>>         remove("location","$tu");
>>     }
>>
>> any suggestion on how to test for NULL values without getting above 
>> error. I'm using opensips 2.3.5
>>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org <mailto: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/20181115/2d6b1acb/attachment-0001.html>


More information about the Users mailing list