[OpenSIPS-Users] www_authorize return codes
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Tue Jul 6 22:40:45 CEST 2010
The script is a bit buggy....
just before the "Switch" you have an "exit;", so the switch will never
be executed..... Try:
www_authorize("", "subscriber");
$var(x) = $retcode;
if ($var(x) < 0) {
switch ($retcode) {
case -5:
xlog("L_INFO","Error");
break;
case -4:
xlog("L_INFO","Please send new Register with auth
info");
www_challenge("", "0");
exit;
case -2:
xlog("L_INFO","Wrong password");
break;
case -1:
xlog("L_INFO","User doesnt exist");
break;
default:
xlog("L_INFO","Default");
}
sl_send_reply("403","Forbidden");
exit;
}
Regards,
Bogdan
Bruce Borrett wrote:
> Hi Bogdan
>
> Here is the www_auth block from my config:
>
> if (!www_authorize("", "subscriber"))
> {
> www_challenge("", "0");
> exit;
> switch ($retcode)
> {
> case -5:
> xlog("L_INFO","Error");
> break;
> case -4:
> xlog("L_INFO","Please send new Register with auth
> info");
> www_challenge("", "0");
> exit;
> case -2:
> xlog("L_INFO","Wrong password");
> break;
> case -1:
> xlog("L_INFO","User doesnt exist");
> break;
> default:
> xlog("L_INFO","Default");
> }
> }
>
> Thanks,
> Bruce
>
> ------------------------------------------------------------------------
> *From:* Bogdan-Andrei Iancu <bogdan at voice-system.ro>
> *To:* OpenSIPS users mailling list <users at lists.opensips.org>
> *Sent:* Tue, 6 July, 2010 20:13:03
> *Subject:* Re: [OpenSIPS-Users] www_authorize return codes
>
> Hi Bruce,
>
> no, they did not change. Post your switch to see if correct or not.
>
> Regards,
> Bogdan
>
> Bruce Borrett wrote:
> > Hi all
> >
> > I cant get switch to catch any return codes for www_authorize. The
> > default catch works, but -5 through -1 as stated in the docs do not
> > work, I also tried positive 1 through 5... Have these codes changed?
> >
> > Thanks in advance..
> >
> > Regards,
> > Bruce
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >
>
>
> --
> Bogdan-Andrei Iancu
> OpenSIPS Bootcamp
> 20 - 24 September 2010, Frankfurt, Germany
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
--
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro
More information about the Users
mailing list