Skip to content

Commit

Permalink
Added support to bypass TransNexus STIR/SHAKEN when calling emergency…
Browse files Browse the repository at this point in the history
… numbers
  • Loading branch information
mackhendricks committed May 16, 2022
1 parent 43da59b commit 9268975
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
31 changes: 19 additions & 12 deletions kamailio/kamailio_dsiprouter.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#!define WITH_ACCDB
#!define WITH_DROUTE
##!define WITH_DEBUG
##!define WITH_DEBUG_SIP
#!define WITH_DEBUG_SIP
#!define WITH_NAT
#!define WITH_DISPATCHER
#!define WITH_CALLLIMIT
Expand All @@ -31,10 +31,10 @@
####### Defined Constants with String Replacement #########

#!substdef "!DSIP_VERSION!0.643!g"
#!substdef "!INTERNAL_IP_ADDR!159.223.190.36!g"
#!substdef "!INTERNAL_IP_NET!159.223.190.*!g"
#!substdef "!EXTERNAL_IP_ADDR!159.223.190.36!g"
#!substdef "!EXTERNAL_FQDN!nightly.customers.dsiprouter.net!g"
#!substdef "!INTERNAL_IP_ADDR!159.223.169.178!g"
#!substdef "!INTERNAL_IP_NET!159.223.169.*!g"
#!substdef "!EXTERNAL_IP_ADDR!159.223.169.178!g"
#!substdef "!EXTERNAL_FQDN!dev-dsip-master0!g"
#!substdef "!INBOUND_NLB_FQDN!!g"
#!substdef "!OUTBOUND_NLB_FQDN!!g"
#!substdef "!SIP_PORT!5060!g"
Expand All @@ -51,12 +51,12 @@ import_file "kamailio-local.cfg"
#!ifdef WITH_MYSQL
#!ifdef WITH_DBCLUSTER
#!define DBURL "cluster://dbcluster"
#!define SQLCONN_KAM "kam=>mysql://kamailio:VYDAgEsYHw8KVg1xZmWvLiMLRBoA90bG07jLSbNpBa3DQ8eJpSgxg5a9PjRE4yId@localhost:3306/kamailio"
#!define SQLCONN_AST "asterisk=>mysql://kamailio:VYDAgEsYHw8KVg1xZmWvLiMLRBoA90bG07jLSbNpBa3DQ8eJpSgxg5a9PjRE4yId@localhost:3306/kamailio"
#!define SQLCONN_KAM "kam=>mysql://kamailio:ECW6c9vD6innq21UBrRF54A0CGirGxLk9hjeeeGZs6AXHIrgo2gJGW5K8o1gh7PD@localhost:3306/kamailio"
#!define SQLCONN_AST "asterisk=>mysql://kamailio:ECW6c9vD6innq21UBrRF54A0CGirGxLk9hjeeeGZs6AXHIrgo2gJGW5K8o1gh7PD@localhost:3306/kamailio"
#!else
#!define DBURL "mysql://kamailio:VYDAgEsYHw8KVg1xZmWvLiMLRBoA90bG07jLSbNpBa3DQ8eJpSgxg5a9PjRE4yId@localhost:3306/kamailio"
#!define SQLCONN_KAM "kam=>mysql://kamailio:VYDAgEsYHw8KVg1xZmWvLiMLRBoA90bG07jLSbNpBa3DQ8eJpSgxg5a9PjRE4yId@localhost:3306/kamailio"
#!define SQLCONN_AST "asterisk=>mysql://kamailio:VYDAgEsYHw8KVg1xZmWvLiMLRBoA90bG07jLSbNpBa3DQ8eJpSgxg5a9PjRE4yId@localhost:3306/kamailio"
#!define DBURL "mysql://kamailio:ECW6c9vD6innq21UBrRF54A0CGirGxLk9hjeeeGZs6AXHIrgo2gJGW5K8o1gh7PD@localhost:3306/kamailio"
#!define SQLCONN_KAM "kam=>mysql://kamailio:ECW6c9vD6innq21UBrRF54A0CGirGxLk9hjeeeGZs6AXHIrgo2gJGW5K8o1gh7PD@localhost:3306/kamailio"
#!define SQLCONN_AST "asterisk=>mysql://kamailio:ECW6c9vD6innq21UBrRF54A0CGirGxLk9hjeeeGZs6AXHIrgo2gJGW5K8o1gh7PD@localhost:3306/kamailio"
#!endif
#!endif

Expand Down Expand Up @@ -258,7 +258,10 @@ server.pbx_invite_timeout_aftertry = 52000 desc "PBX INVITE timeout value if a S

# DSIPRouter API Server Settings
server.api_server = "https://127.0.0.1:5000" desc "URL to the DSIPRouter API Server"
server.api_token = "HAcLvpp1FDdwGU9k58lZF8tmYtYxY3ediZ3A5HiLsf6TQj9ssVSbUZp36ZO2sCaB" desc "API Token for DSIPRouter API Server"
server.api_token = "ZoMyR23hgZ0Q9wzVeLdmhCHPB9mQ73XaOm5NF0zf1xWkp1YQEWYyrNCxWmqrxL8H" desc "API Token for DSIPRouter API Server"

# Emergency Numbers
server.emergency_numbers = "^([2-9]11|112|999|000|988|933)$" desc "Emergency Numbers"

# Transnexus External STIR/SHAKEN Support
transnexus.authservice_lrn_enabled = 0 # Enable LRN for authservice
Expand Down Expand Up @@ -1117,6 +1120,10 @@ route[NEXTHOP] {
$avp(carrier_groupid) = FLT_OUTBOUND;
#!endif

# Keep track of the original $rU
# var(original_rU) is marked for removal
$var(orig_rU) = $rU;

if (do_routing($avp(carrier_groupid))) {
$avp(dst_gwid) = $(avp(dr_attrs){s.select,0,,});
$avp(dst_gwtype) = $(avp(dr_attrs){s.select,1,,});
Expand Down Expand Up @@ -1830,7 +1837,7 @@ route[LOCATION] {
# N11 Ref: https://nationalnanpa.com/number_resource_info/n11_codes.html
# On 2020-Jul-16 the FCC also adopted 988 as an N11 number
# 988 Adoption Refs: https://www.fcc.gov/document/fcc-designates-988-national-suicide-prevention-lifeline
if ($rU =~ "^([2-9]11|112|999|000|988)$") {
if ($rU =~ $sel(cfg_get.server.emergency_numbers)) {
return;
}

Expand Down
10 changes: 9 additions & 1 deletion kamailio/kamailio_transnexus.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
route[TRANSNEXUS_OUTBOUND] {


xlog("L_INFO", "Transnexus Outbound Logic - original: $var(orig_rU)");

# Return if emergency route
if ( $var(orig_rU) =~ $sel(cfg_get.server.emergency_numbers) ) {
return;
}


# Only route if request is coming from an Endpoint
# and is an INVITE

Expand Down

0 comments on commit 9268975

Please sign in to comment.