Hi,
Thx for the answer, I tested and worked....but with errors...in relation to return codes of the Authentication's Module...
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
......
May 30 15:29:28 i206529 openser[24649]: Return Code - ANTES (1)
May 30 15:29:28 i206529 openser[24649]: REGISTER (12141)(sip:rio.voip.br) nao autorizado - Return Code DEPOIS.0 (-4)
May 30 15:29:28 i206529 openser[24649]: Enviando 401 - Unauthorized
May 30 15:29:28 i206529 openser[24649]: Process Other Requests Here
May 30 15:29:28 i206529 openser[24649]: REGISTER - Codigo Ret (1)
May 30 15:29:28 i206529 openser[24649]: REGISTER (12141)(sip:rio.voip.br) nao autorizado - Return Code DEPOIS.1 (1)
May 30 15:29:28 i206529 openser[24651]: Return Code - ANTES (1)
May 30 15:29:28 i206529 openser[24651]: REGISTER (12141)(sip:rio.voip.br) nao autorizado - Return Code DEPOIS.0 (-5)
May 30 15:29:28 i206529 openser[24651]: Enviando 401 - Unauthorized
May 30 15:29:28 i206529 openser[24651]: Process Other Requests Here
May 30 15:29:28 i206529 openser[24651]: REGISTER - Codigo Ret (1)
May 30 15:29:28 i206529 openser[24651]: REGISTER (12141)(sip:rio.voip.br) nao autorizado - Return Code DEPOIS.1 (1)
and config script...
........
if (is_method("REGISTER")) {
xlog("L_ALERT", "Chegou um REGISTER ($fU)($ru)($retcode)\n");
route(2);
return;
........
route[2]
xlog("L_ALERT", "Return Code - ANTES ($rc)\n");
if (!www_authorize("rio.voip.br", "subscriber")) {
xlog("L_ALERT", "REGISTER ($fU)($ru) nao autorizado - Return Code DEPOIS.0 ($rc)\n");
log(1, "Enviando 401 - Unauthorized\n");
switch($rc){
case -1:
log(1,"Invalid User\n");
break;
case -2:
log(1, "Invalid Password\n");
break;
case -3:
log(1, "Stale Nonce\n");
break;
case -4:
log(1, "No Credentials\n");
break;
case -5:
log(1, "Generic Error\n");
break;
default:
log(1, "Process Other Requests Here\n");
xlog("L_ALERT","REGISTER - Codigo Ret ($rc)\n");
}
xlog("L_ALERT", "REGISTER ($fU)($ru) nao autorizado - Return Code DEPOIS.1 ($rc)\n");
www_challenge("rio.voip.br", "1");
return;
}
if (!check_to()) {
............
I believe it is due to the use of the functions log() and xlog().....that changed the value of ($rc)....
regards,
Marcio
Hi Marcio,
Actually, the correct pseudo variable is $retcode or $rc.
See: http://www.openser.org/dokuwiki/doku.php/pseudovariables:1.3.x#returned_code
Regards,
Bogdan
Marcio wrote:
Hi.....if (!www_authorize("rio.voip.br <http://rio.voip.br>", "subscriber")) {
I'm grateful for the tip but within the Openser's Config the variable "$retval" is not recognized....
Below the log....
ERROR:core:pv_parse_spec: error searching pvar "retval"
May 28 08:18:57 i206529 openser: ERROR:core:pv_parse_spec: wrong char [
May 28 08:18:57 i206529 openser: CRITICAL:core:yyerror: parse error in config file, line 385, column 12-20: unknown script variable
and the config script...
............................omitted output.......................www_challenge("rio.voip.br <http://rio.voip.br>", "1");
xlog("L_ALERT", "REGISTER ($fU) ($ru) nao autorizado\n");
log(1, "Enviando 401 - Unauthorized (Username)\n");
# perl_exec("chkval"); # check retval but still not working...
switch ($retval){
case 1:
log("process authentication success");
break;
case -1:
log("Non Existent User");
break;
case -2:
log("Invalid Password");
break;
case -3:
log("Stale Nonce");
break;
case -4:
log("No Credentials");
break;
default:
log("Process Other Requests Here");
}2008/5/28 Daniel-Constantin Mierla <miconda@gmail.com <mailto:miconda@gmail.com>>:
return;
........................omitted output................
Any hint of how I can make the Openser's config recognize the pvar "$retval"??
regards,
Marcio
Users@lists.openser.org <mailto:Users@lists.openser.org>
Hello,
On 05/27/08 22:13, Marcio wrote:
Hi,
Who would have tips on how to capture the return codes
negative of the function "www_authorize" ???
I read somewhere that said to use $retval........but ...How
can I to use it ("$retval") ??
-1 - Non existent user;
-2 - invalid passwd;
-3 - stale nonce;
-4 - no credentials;
-5 - error;
Any help will be greatly appreciated.
one mode is with switch statement:
www_authorize(...);
switch($retval)
{
case -1:
........
break;
case -2:
.......
break;
....
}
http://www.openser.org/dokuwiki/doku.php/core-cookbook:devel#switch
Daniel
thx,
Marcio
------------------------------------------------------------------------
_______________________________________________
Users mailing list
http://lists.openser.org/cgi-bin/mailman/listinfo/users
-- http://www.asipto.com
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users@lists.openser.org
http://lists.openser.org/cgi-bin/mailman/listinfo/users