[SR-Users] Set CLI.
Andrew Pogrebennyk
andrew.pogrebennyk at portaone.com
Fri Jul 29 13:31:59 CEST 2011
Hello Henrik,
On 28.07.2011 19:08, Henrik Aagaard Sørensen wrote:
> Is it possible to set CLI via the usr_preferences table in Kamailio?
> Or any other way?
> So that certain subscribers get there from-number overwritten with a
> specific one.
Sure, you can script it in any way you like.
This is a working example from my system:
if (avp_db_load("$au", "$avp(s:allowed_cli)")) {
if (!avp_check("$avp(s:allowed_cli)", "eq/$fU/gi")) {
xlog("L_INFO", "User $au is denied CLI=$fU\n");
sl_send_reply("403", "Forbidden");
exit;
}
}
You see, I'm rejecting calls with a CLI that is not allowed.
To override CLI you may use something like this, probably this should be
put directly before call to t_relay():
# Replace from if needed
if(is_avp_set("$avp(s:allowed_cli)")) {
uac_replace_from("","$avp(s:allowed_cli)");
xlog("L_INFO", "$ci : replaced from to $avp(s:allowed_cli)\n");
}
--
Sincerely,
Andrew Pogrebennyk
More information about the sr-users
mailing list