Hi All
I have added a column called status to the subscriber table. I want to check that column in the route() function and act according to it's value.
In the global settings I put
# ----- AVP params --------
modparam("avpops", "avp_url", "mysql://openser:ccccc@cccccc/openser")
modparam("avpops","avp_table","subscriber")
modparam("avpops","db_scheme", "scheme1:username_col=username;value_col=status;value_type=string;table= subscriber")
And In the route statement I put
if (avp_db_load("$ru","$avp(s:disabled)/$scheme1"))
{
xlog("L_INFO", "This did match");
}
I am getting this error in the log file
Jun 9 09:12:51 [15789] ERROR:avpops:ops_dbload_avps: incomplet uri sip:xx.xx.xx.xx "Where xx.xx.xx.xx is my correct IP"
And the IF statement is matching everytime.
Thanks for any suggestions.
El Monday 09 June 2008 11:06:09 Ali Jawad escribió:
Hi All
I have added a column called status to the subscriber table. I want to check that column in the route() function and act according to it's value.
In the global settings I put
# ----- AVP params --------
modparam("avpops", "avp_url", "mysql://openser:ccccc@cccccc/openser")
modparam("avpops","avp_table","subscriber")
modparam("avpops","db_scheme", "scheme1:username_col=username;value_col=status;value_type=string;table= subscriber")
You use "username" column (that just stores the USERNAME without @domain)...
And In the route statement I put
if (avp_db_load("$ru","$avp(s:disabled)/$scheme1"))
...but here you look for the entire Request-URI ($ru). Maybe you mean $rU ?
BTW, I think is much better using "group" module for the purpose you want.
Dear Iñaki Thank you for your reply. Can you please provide an example about the Group Module ? Thanks -----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 12:20 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue
El Monday 09 June 2008 11:06:09 Ali Jawad escribió:
Hi All
I have added a column called status to the subscriber table. I want to check that column in the route() function and act according to it's value.
In the global settings I put
# ----- AVP params --------
modparam("avpops", "avp_url", "mysql://openser:ccccc@cccccc/openser")
modparam("avpops","avp_table","subscriber")
modparam("avpops","db_scheme", "scheme1:username_col=username;value_col=status;value_type=string;table= subscriber")
You use "username" column (that just stores the USERNAME without @domain)...
And In the route statement I put
if (avp_db_load("$ru","$avp(s:disabled)/$scheme1"))
...but here you look for the entire Request-URI ($ru). Maybe you mean $rU ?
BTW, I think is much better using "group" module for the purpose you want.
Hi Inaki
I read the group module docs and also your example I used.
if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$ sl_send_reply("403", "Unauthorized, account is disabled"); exit(); };
I used the many xxx to pinpoint it in the log file. The weird thing is that it is matching and I can see the xxxx in the logfile but the user is still registering as if the exit(); is being ignored .I am using version 1.3
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 1:00 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue
El Monday 09 June 2008 11:21:32 Ali Jawad escribió:
Dear Iñaki Thank you for your reply. Can you please provide an example about the Group Module ? Thanks
if (is_user_in("Credentials", "dissabled")) { sl_reply("403: Forbidden"); exit; }
I mean is exit supposed to terminate the session or just exit the if statement. Because my registration script part is just below this if statement. Thx
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Ali Jawad Sent: Monday, June 09, 2008 1:52 PM To: Iñaki Baz Castillo; users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue-Changed to groups
Hi Inaki
I read the group module docs and also your example I used.
if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$ sl_send_reply("403", "Unauthorized, account is disabled"); exit(); };
I used the many xxx to pinpoint it in the log file. The weird thing is that it is matching and I can see the xxxx in the logfile but the user is still registering as if the exit(); is being ignored .I am using version 1.3
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 1:00 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue
El Monday 09 June 2008 11:21:32 Ali Jawad escribió:
Dear Iñaki Thank you for your reply. Can you please provide an example about the Group Module ? Thanks
if (is_user_in("Credentials", "dissabled")) { sl_reply("403: Forbidden"); exit; }
El Monday 09 June 2008 12:54:55 Ali Jawad escribió:
I mean is exit supposed to terminate the session or just exit the if statement. Because my registration script part is just below this if statement. Thx
The exit terminates all the script. If you reply a 403 and do a "exit" the register process must finish.
Dear Inaki
This is my route statement, the is_user_in is matching true, since I can see the xxxxx in the log. However the script does notexit using the exit(); function instead it moves on to the register and allows the softphone to register. Anything wrong you can see here ? Thanks
route {
if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxx"); exit(); };
if(is_method("REGISTER")){ if(!www_authorize("sero.ahwar.net", "subscriber")){ www_challenge("sero.ahwar.net", "1"); return; }
save("location"); return;
} if(does_uri_exist()){ # local uri does exist, is probably a user. xlog("L_INFO","User Exists if(lookup("location")){ route(1); return; } else { if(src_ip!=87.236.144.9) { rewritehost("87.236.144.9"); route(1); } else { sl_send_reply("404", "Shi Bi Hayij"); exit; } } } else { # # probably a call to pstn.... route(2); return; } }
}
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 2:15 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue-Changed to groups
El Monday 09 June 2008 12:54:55 Ali Jawad escribió:
I mean is exit supposed to terminate the session or just exit the if statement. Because my registration script part is just below this if statement. Thx
The exit terminates all the script. If you reply a 403 and do a "exit" the register process must finish.
Adding to the below I am getting
Jun 9 11:49:53 [13850] DBG:group:is_user_in: user is in group 'blocked'
In the log file
And I changed if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxx"); exit(); }; To if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxx"); exit(); } There was a semi colon after the } of the if statement. But still getting the same result
Dear Inaki
This is my route statement, the is_user_in is matching true, since I can see the xxxxx in the log. However the script does notexit using the exit(); function instead it moves on to the register and allows the softphone to register. Anything wrong you can see here ? Thanks
route {
if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxx"); exit(); };
if(is_method("REGISTER")){ if(!www_authorize("sero.ahwar.net", "subscriber")){ www_challenge("sero.ahwar.net", "1"); return; }
save("location"); return;
} if(does_uri_exist()){ # local uri does exist, is probably a user. xlog("L_INFO","User Exists if(lookup("location")){ route(1); return; } else { if(src_ip!=87.236.144.9) { rewritehost("87.236.144.9"); route(1); } else { sl_send_reply("404", "Shi Bi Hayij"); exit; } } } else { # # probably a call to pstn.... route(2); return; } }
}
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 2:15 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue-Changed to groups
El Monday 09 June 2008 12:54:55 Ali Jawad escribió:
I mean is exit supposed to terminate the session or just exit the if statement. Because my registration script part is just below this if statement. Thx
The exit terminates all the script. If you reply a 403 and do a "exit" the register process must finish.
El Monday 09 June 2008 13:25:14 Ali Jawad escribió:
Dear Inaki
This is my route statement, the is_user_in is matching true, since I can see the xxxxx in the log. However the script does notexit using the exit(); function instead it moves on to the register and allows the softphone to register. Anything wrong you can see here ? Thanks
route {
if (is_user_in("Request-URI", "blocked")) { xlog("L_INFO", "xxxxxxxx"); exit(); };
Can you put here a "xlog" and verify if it's executed?
if(is_method("REGISTER")){ if(!www_authorize("sero.ahwar.net", "subscriber")){ www_challenge("sero.ahwar.net", "1"); return; } save("location"); return;
}
if(does_uri_exist()){ # local uri does exist, is probably a user. xlog("L_INFO","User Exists if(lookup("location")){ route(1); return; } else { if(src_ip!=87.236.144.9) { rewritehost("87.236.144.9"); route(1); } else { sl_send_reply("404", "Shi Bi Hayij"); exit; } }
}
else { # # probably a call to pstn.... route(2); return; }
}
}
-----Original Message----- From: users-bounces@lists.openser.org [mailto:users-bounces@lists.openser.org] On Behalf Of Iñaki Baz Castillo Sent: Monday, June 09, 2008 2:15 PM To: users@lists.openser.org Subject: Re: [OpenSER-Users] AVPOPS Issue-Changed to groups
El Monday 09 June 2008 12:54:55 Ali Jawad escribió:
I mean is exit supposed to terminate the session or just exit the if statement. Because my registration script part is just below this if statement. Thx
The exit terminates all the script. If you reply a 403 and do a "exit" the register process must finish.
-- Iñaki Baz Castillo ibc@in.ilimit.es
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users