|
@@ -38,6 +38,11 @@
|
|
|
# - start RTPProxy:
|
|
|
# rtpproxy -l _your_public_ip_ -s udp:localhost:7722
|
|
|
#
|
|
|
+# *** To enable PSTN gateway routing execute:
|
|
|
+# - define WITH_PSTN
|
|
|
+# - set the value of pstn.gw_ip
|
|
|
+# - check route[PSTN] for regexp routing condition
|
|
|
+#
|
|
|
# *** To enhance accounting execute:
|
|
|
# - enable mysql
|
|
|
# - define WITH_ACCDB
|
|
@@ -88,6 +93,26 @@ port=5060
|
|
|
#listen=udp:10.0.0.10:5060
|
|
|
|
|
|
|
|
|
+####### Custom Parameters #########
|
|
|
+
|
|
|
+# These parameters can be modified runtime via RPC interface
|
|
|
+# - see the documentation of 'cfg_rpc' module.
|
|
|
+#
|
|
|
+# Format: group.id = value 'desc' description
|
|
|
+# Access: $sel(cfg_get.group.id) or @cfg_get.group.id
|
|
|
+#
|
|
|
+
|
|
|
+#!ifdef WITH_PSTN
|
|
|
+# PSTN GW Routing
|
|
|
+#
|
|
|
+# - pstn.gw_ip: valid IP or hostname as string value, example:
|
|
|
+# pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address"
|
|
|
+#
|
|
|
+# - by default is empty to avoid misrouting
|
|
|
+pstn.gw_ip = "" desc "PSTN GW Address"
|
|
|
+#!endif
|
|
|
+
|
|
|
+
|
|
|
####### Modules Section ########
|
|
|
|
|
|
#set module path
|
|
@@ -316,6 +341,8 @@ route{
|
|
|
route(AUTH);
|
|
|
|
|
|
# record routing for dialog forming requests (in case they are routed)
|
|
|
+ # - remove preloaded route headers
|
|
|
+ remove_hf("Route");
|
|
|
if (is_method("INVITE|SUBSCRIBE"))
|
|
|
record_route();
|
|
|
|
|
@@ -356,6 +383,8 @@ route{
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
+ route(PSTN);
|
|
|
+
|
|
|
# apply DB based aliases (uncomment to enable)
|
|
|
##alias_db_lookup("dbaliases");
|
|
|
|
|
@@ -511,6 +540,36 @@ route[RTPPROXY] {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+# PSTN GW routing
|
|
|
+route[PSTN] {
|
|
|
+#!ifdef WITH_PSTN
|
|
|
+ # check if PSTN GW IP is defined
|
|
|
+ if (strempty($sel(cfg_get.pstn.gw_ip))) {
|
|
|
+ xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ # route to PSTN dialed numbers starting with '+' or '00'
|
|
|
+ # (international format)
|
|
|
+ # - update the condition to match your dialing rules for PSTN routing
|
|
|
+ if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
|
|
|
+ return;
|
|
|
+
|
|
|
+ # only local users allowed to call
|
|
|
+ if(from_uri!=myself) {
|
|
|
+ sl_send_reply("403", "Not Allowed");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
|
|
|
+
|
|
|
+ route(RELAY);
|
|
|
+ exit;
|
|
|
+#!endif
|
|
|
+
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
# Sample branch router
|
|
|
branch_route[BRANCH_ONE] {
|
|
|
xdbg("new branch at $ru\n");
|