#------ 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 |
+----+------+----+----------+------------------+-----------+--------------------+----------+-------+