[OpenSER-Users] newbie help - handeling 302s and 404s
Jesus Rodriguez
jesusr at voztele.com
Thu Dec 27 11:14:46 CET 2007
Hi Lazer,
>i need a simple config that achieves the following (w/ out a db)
>
>if a user is not registered then all calls should go to a default gw
>192.168.10.1
>
>the default gw will only respond w/ a 302 or a 404
>
>if a 302 is received then openser should forward the call on to the
>new gw listed in the reply
>
>if a 404 is received the call should be forwarded to a different gw
172.16.20.1
>
>if the send gw is done then the call should die.
Try with somehting like this (not tested):
if (!lookup("location")) {
route(5);
exit;
}
route[5] {
rewritehostport("192.168.10.1:5060");
t_on_failure("1");
route(1);
exit;
}
route[1] {
if (!t_relay()) {
sl_reply_error();
};
exit;
}
failure_route[1] {
if (t_check_status("404")) {
rewritehostport("172.16.20.1:5060");
append_branch();
t_relay();
} else {
get_redirects("*");
t_relay();
}
}
Saludos
JesusR.
>here is what i was thinking of but as a newbie i may be off my rocker
>i seem to get an error
>
> ERROR: t_check_status: cannot check status for a reply which has no
>T-state established
>
>but again my whole approach may be wrong.
>
>
> if (!lookup("location")) {
>
>rewritehostport ("192.168.10.1:5060");
>if (t_check_status("(404)|(480)")) {
> log("404 or 480 negative reply\n");
>rewritehostport ("172.16.20.1:5060");
>}
>else{
>t_on_failure("1");
> t_relay();
>}
>
>
> failure_route[1] {
>
> get_redirects("*");
> t_relay();
>}
> }
Saludos
JesusR.
------------------------------------
Jesus Rodriguez
VozTelecom Sistemas, S.L.
jesusr at voztele.com
http://www.voztele.com
Tel. 902360305
-------------------------------------
More information about the Users
mailing list