Hi,<br><br>I need to authenticate and register users that are stored on the opensips db AND a different database.  For that I have the following code<br><br>    if (is_method(&quot;REGISTER&quot;) &amp;&amp; $fu=~&quot;^sip:[0-9]{10}@&quot;)<br>
    {<br>        # authenticate the REGISTER based on a different DB<br>        xlog(&quot;getting valid credentials for calling card $fu&quot;);<br>        avp_db_query(&quot;select userpass from anothertable where username=&#39;$au&#39;&quot;, &quot;$avp(s:password)&quot;, &quot;1&quot;);<br>
        $var(username)=$au; <b># line 392</b><br>        xlog(&quot;credentials for user $var(username) : $avp(s:password)&quot;);<br>        if(!pv_www_authorize(&quot;&quot;))<br>        {<br>                        www_challenge(&quot;&quot;, &quot;0&quot;);<br>
                        xlog(&quot;registration from $fu has been challenged&quot;);<br>                        exit;<br>        }<br>        xlog(&quot;$fu authorized!!!&quot;);<br>        if (!db_check_to())<br>        {<br>
                sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>                exit;<br>        }<br><br>        if (!save(&quot;location&quot;))<br>                sl_reply_error();<br><br>        xlog(&quot;location saved for $fu&quot;);<br>
        exit;<br>    }<br>    if (is_method(&quot;REGISTER&quot;) &amp;&amp; $fu=~&quot;^sip:[0-9]{9}@&quot;)<br>    {<br>        # authenticate the REGISTER requests (uncomment to enable auth)<br>        if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;))<br>
        {<br>            www_challenge(&quot;&quot;, &quot;0&quot;);<br>            xlog(&quot;registration from $fu has been challenged&quot;);<br>            exit;<br>        }<br>        <br>        if (!db_check_to()) <br>
        {<br>            sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>            exit;<br>        }<br><br>        if (!save(&quot;location&quot;))<br>            sl_reply_error();<br><br>        xlog(&quot;location saved for $fu&quot;);<br>
        exit;<br>    }<br><br>if the username part of the From header has 10 digits the script will try to authenticate against the other DB, but it won&#39;t go further than the pv_www_authorize line because on the logs I get the following.<br>
<br>Jul 13 21:28:00 opensips /usr/sbin/opensips[3139]: getting valid credentials for user sip:9999999999@xx.xx.xx.xx<br>Jul 13 21:28:00 opensips /usr/sbin/opensips[3139]: ERROR:core:do_assign: no value in right expression<br>
Jul 13 21:28:00 opensips /usr/sbin/opensips[3139]: ERROR:core:do_assign: error at line: 397<br>Jul 13 21:28:00 opensips /usr/sbin/opensips[3139]: credentials for user 0 : &lt;null&gt;<br>Jul 13 21:28:01 opensips /usr/sbin/opensips[3141]: getting valid credentials for user sip:9999999999@xx.xx.xx.xx<br>
Jul 13 21:28:01 opensips /usr/sbin/opensips[3141]: credentials for user 9999999999 : 9999999999<br><br>I don&#39;t know if I&#39;m doing something really wrong or maybe the ERROR message has something to do with this auth failure.  Please can someone clarify this issue.<br>
Thanks,<br><br><br>Kind regards,<br><br>