Skip to content

Commit

Permalink
Added toggle switch to enable or disable transnexus LRN
Browse files Browse the repository at this point in the history
  • Loading branch information
mackhendricks committed May 12, 2022
1 parent 56d2964 commit 43da59b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions kamailio/kamailio_dsiprouter.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ server.api_server = "https://127.0.0.1:5000" desc "URL to the DSIPRouter API Ser
server.api_token = "HAcLvpp1FDdwGU9k58lZF8tmYtYxY3ediZ3A5HiLsf6TQj9ssVSbUZp36ZO2sCaB" desc "API Token for DSIPRouter API Server"

# Transnexus External STIR/SHAKEN Support
transnexus.authservice_lrn_enabled = 0 # Enable LRN for authservice
transnexus.authservice_enabled = 0 # Enabled for all Trunks
transnexus.authservice_host = "outbound.clearip.com:5060" # Default
transnexus.verifyservice_host = "inbound.clearip.com:5060" # Default
Expand Down
22 changes: 14 additions & 8 deletions kamailio/kamailio_transnexus.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ route[TRANSNEXUS_OUTBOUND] {
xlog("L_INFO", "Transnexus Outbound Logic - method: $rm");

#Store the $ru that was selected
$avp(dr_current_ruri) = $ru;
$avp(dr_orig_ruri) = $ru;
$avp(dr_orig_du) = $du;

#Send call to clearip server
$ru = "sip:" + $rU + "@" + $sel(cfg_get.transnexus.authservice_host) + ";transport=tcp";
Expand All @@ -41,22 +42,27 @@ failure_route[TRANSNEXUS_OUTBOUND_FAILURE] {
if $avp(Identity) != ""
append_hf("Identity: $avp(Identity)\r\n");


#Check if contact contains
if($hdr(Contact)=~"clearip.com") {
if ((int)$sel(cfg_get.transnexus.authservice_lrn_enabled)) {

#Send call outbound using dSIPRouter Routes
$ru = $avp(dr_current_ruri);
$du = $ru;
t_relay();
}
else {
#Remove the main branch
$ru = $null;

#Get Redirects from Transnexus
get_redirects("*");
#Route to redirects
t_relay();
exit;


} else {

#Send call outbound using dSIPRouter Routes
$ru = $avp(dr_orig_ruri);
$du = $avp(dr_orig_du);
t_relay();
exit;
}
}
}
Expand Down

0 comments on commit 43da59b

Please sign in to comment.