Hi,
I'm trying to make when each subscriber dials 7 digits add subscriber based specific prefix to dialed number defined in subscriber or dialplan table. I know that it's possible with avp but I'm not professional about avp. could you send me a successful scenario and config example please?
I'm able to make generic dialplan but don't know how to make subscriber based dialplan. Here is my generic dialplan sample config file and dialplan table;
----
loadmodule "avpops.so" loadmodule "dialplan.so"
#------ avpops params ----- modparam("avpops", "db_url", "mysql://openser:openserrw@localhost/kamailio") modparam("avpops", "avp_table", "usr_preferences") #------ load the dpid field to a pseudo-variable $avp(s:dpid) ------ ### modparam("auth_db", "load_credentials", "$avp(s:rpid)=rpid ;$avp(s:countrycode)=contrycode;$avp(s:areacode)=areacode")
modparam("dialplan", "db_url","mysql://openser:openserrw@localhost /kamailio") ## attribute of the matched line will be store in the $avp(s:dest) modparam("dialplan", "attrs_pvar", "$avp(s:dest)")
if(!dp_translate("0","$rU/$rU")){ send_reply("420", "Invalid Destination"); exit; } xlog("$avp(s:dest)"); if ($avp(s:dest)=="pstn") { #route to pstn prefix("+90454"); enum_query(); $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip); route(RELAY); }
----
# kamctl db show dialplan database engine 'MYSQL' loaded Control engine 'FIFO' loaded +----+------+----+----------+------------------+-----------+--------------------+----------+-------+ | id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp | attrs | +----+------+----+----------+------------------+-----------+--------------------+----------+-------+ | 1 | 0 | 1 | 1 | ^[2-9][0-9]{6}.* | 0 | (^[2-9][0-9]{6}).* | 90212\1 | pstn | +----+------+----+----------+------------------+-----------+--------------------+----------+-------+
2012/1/31 Bayram Karagoz karagoz.bayram@gmail.com
Hi,
I'm trying to make when each subscriber dials 7 digits add subscriber based specific prefix to dialed number defined in subscriber or dialplan table. I know that it's possible with avp but I'm not professional about avp. could you send me a successful scenario and config example please?