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 <[email protected]>
> *To:* OpenSIPS users mailling list <[email protected]>
> *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
> > [email protected] <mailto:[email protected]>
> > 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
> [email protected] <mailto:[email protected]>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [email protected]
> 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
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users