Skip to content

Commit

Permalink
Transnexus Module Updates:
Browse files Browse the repository at this point in the history
- Now supports LCR - Contacts are followed if they are outside of the clearip domain
- Fixed an issue that prevented the dSIPRouter carrier route from being followed
- Fixed a bug that stopped the Transnexus module from being enabled during dSIPRouter startup
  • Loading branch information
mackhendricks committed May 5, 2022
1 parent 3ce7eca commit 2a362b9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
12 changes: 6 additions & 6 deletions gui/modules/api/kamailio/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def reloadKamailio():
'params': ['teleblock', 'media_port', str(settings.TELEBLOCK_MEDIA_PORT)]})

# Settings for TransNexus
reload_cmds.append(
{'method': 'cfg.sets', 'jsonrpc': '2.0', 'id': 1,
'params': ['transnexus', 'authservice_enabled', str(settings.TRANSNEXUS_AUTHSERVICE_ENABLED)]})
reload_cmds.append(
{'method': 'cfg.sets', 'jsonrpc': '2.0', 'id': 1,
'params': ['transnexus', 'authservice_host', str(settings.TRANSNEXUS_AUTHSERVICE_HOST)]})
reload_cmds.append(
{'method': 'cfg.sets', 'jsonrpc': '2.0', 'id': 1,
'params': ['transnexus', 'authservice_enabled', str(settings.TRANSNEXUS_AUTHSERVICE_ENABLED)]})
reload_cmds.append(
{'method': 'cfg.sets', 'jsonrpc': '2.0', 'id': 1,
'params': ['transnexus', 'authservice_host', str(settings.TRANSNEXUS_AUTHSERVICE_HOST)]})

for cmdset in reload_cmds:
r = requests.get('http://127.0.0.1:5060/api/kamailio', json=cmdset)
Expand Down
1 change: 1 addition & 0 deletions kamailio/kamailio_dsiprouter.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ loadmodule "permissions.so"
#!endif
#!ifdef WITH_UAC
loadmodule "uac.so"
loadmodule "uac_redirect.so"
#!endif
#!endif

Expand Down
33 changes: 25 additions & 8 deletions kamailio/kamailio_transnexus.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
route[TRANSNEXUS_OUTBOUND] {
# Only route if request is coming from an Endpoint
if (!allow_source_address(FLT_PBX)) {
if (!is_method("INVITE") and !allow_source_address(FLT_CARRIER)) {
xlog("L_INFO", "[TRANSNEXUS_OUTBOUND] <$ci> $si not allowed to talk with Transnexus \n");
return;
}
Expand All @@ -12,6 +12,7 @@ route[TRANSNEXUS_OUTBOUND] {

#Send call to clearip server
$ru = "sip:" + $rU + "@" + $sel(cfg_get.transnexus.authservice_host) + ";transport=tcp";
$du = $ru;

#Set a failure route to get the 302
if (is_method("INVITE")) {
Expand All @@ -27,16 +28,32 @@ failure_route[TRANSNEXUS_OUTBOUND_FAILURE] {

if (t_check_status("302|403|503")) {
xlog("L_INFO", "Transnexus Outbound Failure Logic");
#Send call to Carrier
#$ru = "sip:" + $rU + "@" + "206.147.88.37" + ":" + "5060;transport=UDP";
$ru = $avp(dr_current_ruri);


#Append Identity Header
if $avp(Identity) != ""
append_hf("Identity: $avp(Identity)\r\n");
#Send call outbound
t_relay();
exit;
}

#Check if contact contains
if($hdr(Contact)=~"clearip.com") {

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

#Get Redirects from Transnexus
get_redirects("*");

#Route to redirects
t_relay();
}
}
}

onreply_route[TRANSNEXUS_OUTBOUND_REPLY] {
Expand Down

0 comments on commit 2a362b9

Please sign in to comment.