[SR-Users] subscriber specific dialplan

Bayram Karagoz karagoz.bayram at gmail.com
Wed Feb 1 12:15:36 CET 2012


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 at 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?
>



-- 
*Bayram KARAGOZ*
System Administrator

bayram at bayramkaragoz.org

www.bayramkaragoz.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120201/d73c6f09/attachment-0001.htm>


More information about the sr-users mailing list