Hi,<br><br>Thx for the answer, I tested and worked....but with errors...in relation to return codes of the Authentication&#39;s Module...<br><br>In my xlite I just changed the password...should have returned the code (-2)...but returned the codes (-4) and (-5).....pls see below the log....in red<br>
<br>......<br>May 30 15:29:28 i206529 openser[24649]: Return Code - ANTES <span style="color: rgb(255, 0, 0);">(1)</span><br>May 30 15:29:28 i206529 openser[24649]: REGISTER (12141)(sip:<a href="http://rio.voip.br">rio.voip.br</a>) nao autorizado - Return Code DEPOIS.0 <span style="color: rgb(255, 0, 0);">(-4)</span><br>
May 30 15:29:28 i206529 openser[24649]: Enviando 401 - Unauthorized<br>May 30 15:29:28 i206529 openser[24649]: <span style="color: rgb(255, 0, 0);">Process Other Requests Here</span><br>May 30 15:29:28 i206529 openser[24649]: REGISTER - Codigo Ret <span style="color: rgb(255, 0, 0);">(1)</span><br>
May 30 15:29:28 i206529 openser[24649]: REGISTER (12141)(sip:<a href="http://rio.voip.br">rio.voip.br</a>) nao autorizado - Return Code DEPOIS.1 <span style="color: rgb(255, 0, 0);">(1)</span><br>May 30 15:29:28 i206529 openser[24651]: Return Code - ANTES <span style="color: rgb(255, 0, 0);">(1)</span><br>
May 30 15:29:28 i206529 openser[24651]: REGISTER (12141)(sip:<a href="http://rio.voip.br">rio.voip.br</a>) nao autorizado - Return Code DEPOIS.0 <span style="color: rgb(255, 0, 0);">(-5)</span><br>May 30 15:29:28 i206529 openser[24651]: Enviando 401 - Unauthorized<br>
May 30 15:29:28 i206529 openser[24651]: <span style="color: rgb(255, 0, 0);">Process Other Requests Here</span><br>May 30 15:29:28 i206529 openser[24651]: REGISTER - Codigo Ret <span style="color: rgb(255, 0, 0);">(1)</span><br>
May 30 15:29:28 i206529 openser[24651]: REGISTER (12141)(sip:<a href="http://rio.voip.br">rio.voip.br</a>) nao autorizado - Return Code DEPOIS.1 <span style="color: rgb(255, 0, 0);">(1)</span><br><br>and config script...<br>
........<br>if (is_method(&quot;REGISTER&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_ALERT&quot;, &quot;Chegou um REGISTER ($fU)($ru)($retcode)\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; route(2);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>........<br>route[2]<br>&nbsp;&nbsp;&nbsp; xlog(&quot;L_ALERT&quot;, &quot;Return Code - ANTES ($rc)\n&quot;);<br>
<br>&nbsp;&nbsp;&nbsp; if (!www_authorize(&quot;<a href="http://rio.voip.br">rio.voip.br</a>&quot;, &quot;subscriber&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_ALERT&quot;, &quot;REGISTER ($fU)($ru) nao autorizado - Return Code DEPOIS.0 (<span style="color: rgb(255, 0, 0);">$rc)</span>\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;Enviando 401 - Unauthorized\n&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch(<span style="color: rgb(255, 0, 0);">$rc</span>){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case -1:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1,&quot;Invalid User\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case -2:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;Invalid Password\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case -3:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;Stale Nonce\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case -4:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;No Credentials\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case -5:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;Generic Error\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log(1, &quot;<span style="color: rgb(255, 0, 0);">Process Other Requests Here</span>\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_ALERT&quot;,&quot;REGISTER - Codigo Ret ($rc)\n&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog(&quot;L_ALERT&quot;, &quot;REGISTER ($fU)($ru) nao autorizado - Return Code DEPOIS.1 (<span style="color: rgb(255, 0, 0);">$rc</span>)\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge(&quot;<a href="http://rio.voip.br">rio.voip.br</a>&quot;, &quot;1&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (!check_to()) {<br>............<br><br>I believe it is due to the use of the functions log() and xlog().....that changed the value of ($rc)....<br>
<br>regards,<br>Marcio<br><br><br><div class="gmail_quote">2008/5/30 Bogdan-Andrei Iancu &lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi Marcio,<br>
<br>
Actually, the correct pseudo variable is $retcode or $rc.<br>
<br>
See: <a href="http://www.openser.org/dokuwiki/doku.php/pseudovariables:1.3.x#returned_code" target="_blank">http://www.openser.org/dokuwiki/doku.php/pseudovariables:1.3.x#returned_code</a><br>
<br>
Regards,<br>
Bogdan<br>
<br>
Marcio wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
Hi.....<br>
<br>
I&#39;m grateful for the tip but within the Openser&#39;s Config the variable &quot;$retval&quot; &nbsp;is not recognized....<br>
<br>
Below the log....<br>
 &nbsp;ERROR:core:pv_parse_spec: error searching pvar &quot;retval&quot;<br>
May 28 08:18:57 i206529 openser: ERROR:core:pv_parse_spec: wrong char [<br>
May 28 08:18:57 i206529 openser: CRITICAL:core:yyerror: parse error in config file, line 385, column 12-20: unknown script variable<br>
<br>
and the config script...<br>
............................omitted output.......................<br></div>
 &nbsp; &nbsp; &nbsp; &nbsp;if (!www_authorize(&quot;<a href="http://rio.voip.br" target="_blank">rio.voip.br</a> &lt;<a href="http://rio.voip.br" target="_blank">http://rio.voip.br</a>&gt;&quot;, &quot;subscriber&quot;)) {<div>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xlog(&quot;L_ALERT&quot;, &quot;REGISTER ($fU) ($ru) nao autorizado\n&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(1, &quot;Enviando 401 - Unauthorized (Username)\n&quot;);<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; perl_exec(&quot;chkval&quot;); # check retval but still not working...<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;switch ($retval){<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case 1:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;process authentication success&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case -1:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;Non Existent User&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case -2:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;Invalid Password&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case -3:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;Stale Nonce&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;case -4:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;No Credentials&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;default:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;log(&quot;Process Other Requests Here&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br></div>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;www_challenge(&quot;<a href="http://rio.voip.br" target="_blank">rio.voip.br</a> &lt;<a href="http://rio.voip.br" target="_blank">http://rio.voip.br</a>&gt;&quot;, &quot;1&quot;);<div><br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;<br>
........................omitted output................<br>
<br>
Any hint of how I can make the Openser&#39;s config recognize the pvar &quot;$retval&quot;??<br>
<br>
regards,<br>
Marcio<br>
<br></div>
2008/5/28 Daniel-Constantin Mierla &lt;<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a> &lt;mailto:<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>&gt;&gt;:<div><div></div>

<div><br>
<br>
 &nbsp; &nbsp;Hello,<br>
<br>
<br>
 &nbsp; &nbsp;On 05/27/08 22:13, Marcio wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Hi,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Who would have tips on how to capture the return codes<br>
 &nbsp; &nbsp; &nbsp; &nbsp;negative of the function &quot;www_authorize&quot; ???<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I read somewhere that said to use $retval........but ...How<br>
 &nbsp; &nbsp; &nbsp; &nbsp;can I to use it (&quot;$retval&quot;) ??<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-1 - Non existent user;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-2 - invalid passwd;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-3 - stale nonce;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-4 - no credentials;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;-5 - error;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Any help will be greatly appreciated.<br>
<br>
 &nbsp; &nbsp;one mode is with switch statement:<br>
<br>
 &nbsp; &nbsp;www_authorize(...);<br>
 &nbsp; &nbsp;switch($retval)<br>
 &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp;case -1:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;........<br>
 &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp;case -2:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.......<br>
 &nbsp; &nbsp; &nbsp;break;<br>
 &nbsp; &nbsp; &nbsp;....<br>
 &nbsp; &nbsp;}<br>
 &nbsp; &nbsp;<a href="http://www.openser.org/dokuwiki/doku.php/core-cookbook:devel#switch" target="_blank">http://www.openser.org/dokuwiki/doku.php/core-cookbook:devel#switch</a><br>
<br>
 &nbsp; &nbsp;Daniel<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; thx,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Marcio<br>
 &nbsp; &nbsp; &nbsp; &nbsp;------------------------------------------------------------------------<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;_______________________________________________<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Users mailing list<br></div></div>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:Users@lists.openser.org" target="_blank">Users@lists.openser.org</a> &lt;mailto:<a href="mailto:Users@lists.openser.org" target="_blank">Users@lists.openser.org</a>&gt;<div><br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://lists.openser.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.openser.org/cgi-bin/mailman/listinfo/users</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; <br>
<br>
 &nbsp; &nbsp;--  &nbsp; &nbsp;<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.openser.org" target="_blank">Users@lists.openser.org</a><br>
<a href="http://lists.openser.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.openser.org/cgi-bin/mailman/listinfo/users</a><br>
 &nbsp;<br>
</div></blockquote>
<br>
</blockquote></div><br>