<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Pasan,<br>
      <br>
      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.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2018
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
    <div class="moz-cite-prefix">On 11/16/2018 07:20 AM, Pasan Meemaduma
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:2053587817.1497481.1542345628843@mail.yahoo.com">
      <div class="ydp73616616yahoo-style-wrap"
        style="font-family:Helvetica Neue, Helvetica, Arial,
        sans-serif;font-size:16px;">
        <div>Hi Bogdan,</div>
        <div><br>
        </div>
        <div>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.<br>
        </div>
        <div><br>
        </div>
        <div><span>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@x.x.x.x</a>,
            T=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@x.x.x.x</a> <a class="moz-txt-link-abbreviated" href="mailto:ID=cd7921be-54514c80@v.v.v.v#012">ID=cd7921be-54514c80@v.v.v.v#012</a>)<br>
            Nov 16 16:06:46  /usr/sbin/opensips[16582]:
            ERROR:core:comp_scriptvar: cannot get left var value<br>
            Nov 16 16:06:46  /usr/sbin/opensips[16582]:
            WARNING:core:do_action: error in expression at
            /etc/opensips/opensips.cfg:814<br>
            <span>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@x.x.x.x</a>,
              T=<a class="moz-txt-link-freetext" href="sip:XXX@x.x.x.x">sip:XXX@x.x.x.x</a> <a class="moz-txt-link-abbreviated" href="mailto:ID=4afba829-fef90105@v.v.v.v#012">ID=4afba829-fef90105@v.v.v.v#012</a>)<br>
              <br>
            </span><span><span> /etc/opensips/opensips.cfg:814</span></span><br>
            <span>    if ( $tu != NULL ) {<br>
                      remove("location","$tu");<br>
                  }<br>
              <br>
            </span><br>
          </span> <br>
        </div>
        <div><br>
        </div>
      </div>
      <div id="yahoo_quoted_3078722934" class="yahoo_quoted">
        <div style="font-family:'Helvetica Neue', Helvetica, Arial,
          sans-serif;font-size:13px;color:#26282a;">
          <div> On Thursday, 15 November 2018, 5:25:54 PM GMT+5:30,
            Bogdan-Andrei Iancu <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a> wrote: </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>
            <div id="yiv6826873149">
              <div> <tt>Hi Pasan,<br clear="none">
                  <br clear="none">
                  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() [<a rel="nofollow" shape="rect"
                    class="yiv6826873149moz-txt-link-freetext"
                    target="_blank"
href="http://www.opensips.org/Documentation/Script-CoreFunctions-2-4#toc42"
                    moz-do-not-send="true">http://www.opensips.org/Documentation/Script-CoreFunctions-2-4#toc42</a>]
                  function to see when exactly the error is generated.
                  Maybe you can actually print $tu before, to see what
                  you get.<br clear="none">
                  <br clear="none">
                  Regards,<br clear="none">
                </tt>
                <pre class="yiv6826873149moz-signature">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com" moz-do-not-send="true">http://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2018
  <a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-freetext" target="_blank" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/" moz-do-not-send="true">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
                <div class="yiv6826873149yqt2782136675"
                  id="yiv6826873149yqt55121">
                  <div class="yiv6826873149moz-cite-prefix">On
                    11/15/2018 10:04 AM, Pasan Meemaduma wrote:<br
                      clear="none">
                  </div>
                  <blockquote type="cite">
                    <div
                      class="yiv6826873149ydp537a978cyahoo-style-wrap"
                      style="font-family:Helvetica Neue, Helvetica,
                      Arial, sans-serif;font-size:16px;">
                      <div>Hi Bogdan,</div>
                      <div><br clear="none">
                      </div>
                      <div>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</div>
                      <div><br clear="none">
                      </div>
                      <span>Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_msg: SIP Request:<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_msg:  method:  <REGISTER><br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_msg:  uri:     <a rel="nofollow"
                          shape="rect"
                          class="yiv6826873149moz-txt-link-rfc2396E"
                          moz-do-not-send="true"><sip:xx.xx.xx.xx></a><br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_msg:  version: <SIP/2.0><br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_headers: flags=2<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_via_param: found param type 232,
                        <branch> = <z9hG4bK-24790813>;
                        state=16<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_via: end of header reached,
                        state=5<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_headers: via found, flags=2<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_headers: this is the first via<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:receive_msg: After parse_msg...<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:receive_msg: preparing to run routing
                        scripts...<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_headers: flags=100<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:_parse_to: end of header reached,
                        state=10<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:_parse_to: display={XXXXXXXXXX}, ruri={<a
                          rel="nofollow" shape="rect"
                          class="yiv6826873149moz-txt-link-freetext"
                          moz-do-not-send="true">sip:XXXXXXXXXX@xx.xx.xx.x</a>}<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:get_hdr_field: <To> [48]; uri=[<a
                          rel="nofollow" shape="rect"
                          class="yiv6826873149moz-txt-link-freetext"
                          moz-do-not-send="true">sip:XXXXXXXXXX@x.x.x.x</a>]<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:get_hdr_field: to body [XXXXXXXXXX <a
                          rel="nofollow" shape="rect"
                          class="yiv6826873149moz-txt-link-rfc2396E"
                          moz-do-not-send="true"><sip:XXXXXXXXXX@x.x.x.x></a>#015#012]<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:get_hdr_field: cseq <CSeq>:
                        <79474> <REGISTER><br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:maxfwd:is_maxfwd_present: value = 70<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_to_param: tag=46474fbe5728f700o0<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:_parse_to: end of header reached,
                        state=29<br clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:_parse_to: display={XXXXXXXXXX}, ruri={<a
                          rel="nofollow" shape="rect"
                          class="yiv6826873149moz-txt-link-freetext"
                          moz-do-not-send="true">sip:XXXXXXXXXX@x.x.x.x</a>}<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:parse_headers: flags=200<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:get_hdr_field: content_length=0<br
                          clear="none">
                        Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                        DBG:core:get_hdr_field: found end of header<br
                          clear="none">
                        <br clear="none">
                      </span>
                      <div>and following are the line that I get before
                        the error If I set log level to 6</div>
                      <div><br clear="none">
                      </div>
                      <div><span>Nov 15 18:19:19 
                          /usr/sbin/opensips[21608]:
                          DBG:core:parse_headers: flags=ffffffffffffffff<br
                            clear="none">
                          Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                          DBG:core:parse_headers: flags=ffffffffffffffff<br
                            clear="none">
                          Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                          DBG:core:parse_headers: flags=ffffffffffffffff<br
                            clear="none">
                          Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                          ERROR:core:comp_scriptvar: cannot get left var
                          value<br clear="none">
                          Nov 15 18:19:19  /usr/sbin/opensips[21608]:
                          WARNING:core:do_action: error in expression at
                          /etc/opensips/opensips.cfg:807<br clear="none">
                          <br clear="none">
                        </span><br clear="none">
                        <span></span></div>
                      <span></span>
                      <div> <br clear="none">
                      </div>
                      <div><br clear="none">
                      </div>
                    </div>
                    <div class="yiv6826873149yahoo_quoted"
                      id="yiv6826873149yahoo_quoted_2792727600">
                      <div style="font-family:'Helvetica Neue',
                        Helvetica, Arial,
                        sans-serif;font-size:13px;color:#26282a;">
                        <div> On Wednesday, 14 November 2018, 7:19:44 PM
                          GMT+5:30, Bogdan-Andrei Iancu <a
                            rel="nofollow" shape="rect"
                            class="yiv6826873149moz-txt-link-rfc2396E"
                            ymailto="mailto:bogdan@opensips.org"
                            target="_blank"
                            href="mailto:bogdan@opensips.org"
                            moz-do-not-send="true"><bogdan@opensips.org></a>
                          wrote: </div>
                        <div><br clear="none">
                        </div>
                        <div><br clear="none">
                        </div>
                        <div>
                          <div id="yiv6826873149">
                            <div> <tt>Hi Pasan,<br clear="none">
                                <br clear="none">
                                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.<br clear="none">
                                <br clear="none">
                                Do you see any other errors before the
                                mentioned ones ? what is the type of
                                route where you do the test ?<br
                                  clear="none">
                                <br clear="none">
                                Regards,<br clear="none">
                              </tt>
                              <pre class="yiv6826873149moz-signature">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-freetext" target="_blank" href="http://www.opensips-solutions.com" moz-do-not-send="true">http://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2018
  <a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-freetext" target="_blank" href="http://opensips.org/training/OpenSIPS_Bootcamp_2018/" moz-do-not-send="true">http://opensips.org/training/OpenSIPS_Bootcamp_2018/</a>
</pre>
                              <div class="yiv6826873149yqt7013559868"
                                id="yiv6826873149yqtfd58933">
                                <div
                                  class="yiv6826873149moz-cite-prefix">On
                                  11/13/2018 10:56 AM, Pasan Meemaduma
                                  via Users wrote:<br clear="none">
                                </div>
                                <blockquote type="cite">
                                  <div
                                    class="yiv6826873149ydp1ea07ddayahoo-style-wrap"
                                    style="font-family:Helvetica Neue,
                                    Helvetica, Arial,
                                    sans-serif;font-size:16px;">
                                    <div>Hey,</div>
                                    <div><br clear="none">
                                    </div>
                                    <div>Anyone have a suggestion for
                                      this?<br clear="none">
                                    </div>
                                    <div><br clear="none">
                                    </div>
                                  </div>
                                  <div class="yiv6826873149yahoo_quoted"
id="yiv6826873149yahoo_quoted_2106585655">
                                    <div style="font-family:'Helvetica
                                      Neue', Helvetica, Arial,
                                      sans-serif;font-size:13px;color:#26282a;">
                                      <div> On Thursday, 8 November
                                        2018, 8:09:50 AM GMT+5:30, Pasan
                                        Meemaduma <a rel="nofollow"
                                          shape="rect"
                                          class="yiv6826873149moz-txt-link-rfc2396E"
ymailto="mailto:pasandev@ymail.com" target="_blank"
                                          href="mailto:pasandev@ymail.com"
                                          moz-do-not-send="true"><pasandev@ymail.com></a>
                                        wrote: </div>
                                      <div><br clear="none">
                                      </div>
                                      <div><br clear="none">
                                      </div>
                                      <div>
                                        <div id="yiv6826873149">
                                          <div>
                                            <div
                                              class="yiv6826873149ydp12152f82yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
                                              sans-serif;font-size:16px;">Hi
                                              Guys,</div>
                                            <div
                                              class="yiv6826873149ydp12152f82yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
                                              sans-serif;font-size:16px;"><br
                                                clear="none">
                                            </div>
                                            <div
                                              class="yiv6826873149ydp12152f82yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
                                              sans-serif;font-size:16px;">I
                                              have a check for NULL for
                                              $tu var in the script, But
                                              when the value is missing
                                              I'm getting the following
                                              error.</div>
                                            <div
                                              class="yiv6826873149ydp12152f82yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
                                              sans-serif;font-size:16px;"><br
                                                clear="none">
                                            </div>
                                            <div
                                              class="yiv6826873149ydp12152f82yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
                                              sans-serif;font-size:16px;"><span>ERROR:core:comp_scriptvar:
                                                cannot get left var
                                                value<br clear="none">
                                                <br clear="none">
                                              </span>
                                              <div><span>WARNING:core:do_action:
                                                  error in expression at
/etc/opensips/opensips.cfg:806</span></div>
                                              <div><span><br
                                                    clear="none">
                                                </span></div>
                                              <div><span>and line 806
                                                  contains following.</span></div>
                                              <div><span><br
                                                    clear="none">
                                                </span></div>
                                              <div><span><span>    if (
                                                    $tu != NULL ) {<br
                                                      clear="none">
                                                           
                                                    remove("location","$tu");<br
                                                      clear="none">
                                                        }<br
                                                      clear="none">
                                                    <br clear="none">
                                                  </span></span>
                                                <div><span>any
                                                    suggestion on how to
                                                    test for NULL values
                                                    without getting
                                                    above error. I'm
                                                    using opensips 2.3.5</span></div>
                                                <div><span><br
                                                      clear="none">
                                                  </span></div>
                                                <div><span></span><br
                                                    clear="none">
                                                </div>
                                                <div><br clear="none">
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <br clear="none">
                                  <fieldset
                                    class="yiv6826873149mimeAttachmentHeader"></fieldset>
                                  <br clear="none">
                                  <pre>_______________________________________________
Users mailing list
<a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-abbreviated" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org" moz-do-not-send="true">Users@lists.opensips.org</a>
<a rel="nofollow" shape="rect" class="yiv6826873149moz-txt-link-freetext" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                                </blockquote>
                                <br clear="none">
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br clear="none">
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>