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.
2011/7/28 Henrik Aagaard Sørensen henrikaagaardsorensen@gmail.com:
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.
You can use whatever mechanism you prefer to store users CLI's (so their AoR username would be replaced by kamailio when, for example, routing a call to a PSTN gateway). It can be a extra column in subscriber table, an entry in usr_preferences or anything (LDAP, custom DB table....).
Then you can add a P-Asserted-Identity header with retrieved CLI before routing the INVITE to a PSTN gateway, or you can replace the
From URI using the UAC module.
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"); }