check for NULL values

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

check for NULL values

OpenSIPS - Users mailing list
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

OpenSIPS - Users mailing list
Hey,

Anyone have a suggestion for this?

On Thursday, 8 November 2018, 8:09:50 AM GMT+5:30, Pasan Meemaduma <[hidden email]> 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

Robert Dyck
In reply to this post by OpenSIPS - Users mailing list

Just a guess. Try

 

if $tu {
        remove("location","$tu");
    }

Not tested. A nonzero value may evaluate as TRUE.

 

On Tuesday, November 13, 2018 12:56:42 AM PST 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 <[hidden email]> wrote:



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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

Bogdan-Andrei Iancu-2
In reply to this post by OpenSIPS - Users mailing list
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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

OpenSIPS - Users mailing list
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:[hidden email]}
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: <To> [48]; uri=[sip:[hidden email]]
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to body [XXXXXXXXXX <sip:[hidden email]>#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:[hidden email]}
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 <[hidden email]> 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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

Bogdan-Andrei Iancu-2
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:     <a class="moz-txt-link-rfc2396E" href="sip:xx.xx.xx.xx"><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={<a class="moz-txt-link-freetext" href="sip:XXXXXXXXXX@xx.xx.xx.x">sip:XXXXXXXXXX@...}
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: <To> [48]; uri=[<a class="moz-txt-link-freetext" href="sip:XXXXXXXXXX@x.x.x.x">sip:XXXXXXXXXX@...]
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to body [XXXXXXXXXX <a class="moz-txt-link-rfc2396E" href="sip:XXXXXXXXXX@x.x.x.x"><sip:XXXXXXXXXX@...>#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={<a class="moz-txt-link-freetext" href="sip:XXXXXXXXXX@x.x.x.x">sip:XXXXXXXXXX@...}
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 [hidden email] 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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

OpenSIPS - Users mailing list
Hi Bogdan,

I tried scrip_trace function and it also indicate same behavior, I can see the value of $tu but it still gives the error. Interesting thing is, it evaluates to true and invokes the remove() function as well.

Nov 16 16:06:46  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:814][reg-debug][core if] -> (REGISTER from Y.Y.Y.Y F=sip:[hidden email], T=sip:[hidden email] ID=[hidden email]#012)
Nov 16 16:06:46  /usr/sbin/opensips[16582]: ERROR:core:comp_scriptvar: cannot get left var value
Nov 16 16:06:46  /usr/sbin/opensips[16582]: WARNING:core:do_action: error in expression at /etc/opensips/opensips.cfg:814
Nov 16 16:06:52  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:815][reg-debug][module remove] -> (REGISTER from Y.Y.Y.Y F=sip:[hidden email], T=sip:[hidden email] ID=[hidden email]#012)

/etc/opensips/opensips.cfg:814
    if ( $tu != NULL ) {
        remove("location","$tu");
    }




On Thursday, 15 November 2018, 5:25:54 PM GMT+5:30, Bogdan-Andrei Iancu <[hidden email]> wrote:


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:[hidden email]}
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: <To> [48]; uri=[sip:[hidden email]]
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to body [XXXXXXXXXX <sip:[hidden email]>#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:[hidden email]}
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 [hidden email] 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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

Bogdan-Andrei Iancu-2
Hi Pasan,

That is really weird I would say. Could you "pack" the minimal script to get this error (plus the pcap of the REGISTER) ? you can send them off list to me.

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/16/2018 07:20 AM, Pasan Meemaduma wrote:
Hi Bogdan,

I tried scrip_trace function and it also indicate same behavior, I can see the value of $tu but it still gives the error. Interesting thing is, it evaluates to true and invokes the remove() function as well.

Nov 16 16:06:46  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:814][reg-debug][core if] -> (REGISTER from Y.Y.Y.Y F=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@..., T=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@... [hidden email])
Nov 16 16:06:46  /usr/sbin/opensips[16582]: ERROR:core:comp_scriptvar: cannot get left var value
Nov 16 16:06:46  /usr/sbin/opensips[16582]: WARNING:core:do_action: error in expression at /etc/opensips/opensips.cfg:814
Nov 16 16:06:52  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:815][reg-debug][module remove] -> (REGISTER from Y.Y.Y.Y F=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@..., T=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@... [hidden email])

/etc/opensips/opensips.cfg:814
    if ( $tu != NULL ) {
        remove("location","$tu");
    }




On Thursday, 15 November 2018, 5:25:54 PM GMT+5:30, Bogdan-Andrei Iancu [hidden email] wrote:


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:[hidden email]}
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: <To> [48]; uri=[sip:[hidden email]]
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to body [XXXXXXXXXX <sip:[hidden email]>#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:[hidden email]}
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 [hidden email] 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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: check for NULL values

OpenSIPS - Users mailing list
Hi Bogdan,

I'll try to get that done. I'm seeing this on a production server. I'll try to get the info you requested.
On Monday, 19 November 2018, 7:41:54 PM GMT+5:30, Bogdan-Andrei Iancu <[hidden email]> wrote:


Hi Pasan,

That is really weird I would say. Could you "pack" the minimal script to get this error (plus the pcap of the REGISTER) ? you can send them off list to me.

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/16/2018 07:20 AM, Pasan Meemaduma wrote:
Hi Bogdan,

I tried scrip_trace function and it also indicate same behavior, I can see the value of $tu but it still gives the error. Interesting thing is, it evaluates to true and invokes the remove() function as well.

Nov 16 16:06:46  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:814][reg-debug][core if] -> (REGISTER from Y.Y.Y.Y F=sip:[hidden email], T=sip:[hidden email] [hidden email])
Nov 16 16:06:46  /usr/sbin/opensips[16582]: ERROR:core:comp_scriptvar: cannot get left var value
Nov 16 16:06:46  /usr/sbin/opensips[16582]: WARNING:core:do_action: error in expression at /etc/opensips/opensips.cfg:814
Nov 16 16:06:52  /usr/sbin/opensips[16582]: [Script Trace][/etc/opensips/opensips.cfg:815][reg-debug][module remove] -> (REGISTER from Y.Y.Y.Y F=sip:[hidden email], T=sip:[hidden email] [hidden email])

/etc/opensips/opensips.cfg:814
    if ( $tu != NULL ) {
        remove("location","$tu");
    }




On Thursday, 15 November 2018, 5:25:54 PM GMT+5:30, Bogdan-Andrei Iancu [hidden email] wrote:


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:[hidden email]}
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: <To> [48]; uri=[sip:[hidden email]]
Nov 15 18:19:19  /usr/sbin/opensips[21608]: DBG:core:get_hdr_field: to body [XXXXXXXXXX <sip:[hidden email]>#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:[hidden email]}
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 [hidden email] 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 [hidden email] 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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users