Skip to content

Commit

Permalink
MSTeams Fixes
Browse files Browse the repository at this point in the history
- Fixed Kamailio option messages for MSTeams so that it works with any domain
- Fixed the Option Message Status Check
- Added styling to the MSTeams Test Connectivity tooltips
  • Loading branch information
mackhendricks committed May 1, 2020
1 parent ab88f69 commit 6e2961f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
24 changes: 15 additions & 9 deletions gui/modules/api/api_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,9 +1614,13 @@ def getOptionMessageStatus(domain):
if response:
response = response.decode('utf8').replace("'", '"')
found_domain = response.find(domain)
if found_domain >= 0 and response.find("FLAGS: AP", found_domain):
return True
return False
if not found_domain:
return False
else:
found_inactive = response.find("FLAGS: IP", found_domain)
if found_inactive > 0:
return False
return True

@api.route("/api/v1/domains/msteams/test/<string:domain>", methods=['GET'])
@api_security
Expand All @@ -1642,12 +1646,14 @@ def testConnectivity(domain):
# Get the IP address of the domain from Google DNS
resolver = dns.resolver.Resolver()
resolver.nameservers = ['8.8.8.8']
answers = resolver.query(domain, 'A')
for a in answers:
# If the External IP and IP from DNS match then it passes the check
if a.to_text() == external_ip_addr:
responsePayload['hostname_check'] = True

try:
answers = resolver.query(domain, 'A')
for a in answers:
# If the External IP and IP from DNS match then it passes the check
if a.to_text() == external_ip_addr:
responsePayload['hostname_check'] = True
except:
pass
# Check if Domain is the root of the CN
# GoDaddy Certs Don't work with Microsoft Direct routing
certInfo = isCertValid(domain,external_ip_addr,5061)
Expand Down
7 changes: 6 additions & 1 deletion gui/static/js/msteams.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ function updateConnectivtyStatus(msg) {
else {
$("#tls_check").addClass("glyphicon glyphicon-remove");
$("#tls_check").css("color","red");
$("#tls_check_row").tooltip({'title': "Cert commonname doesn't match the domain:" + JSON.stringify(msg.tls_check.tls_cert_details), 'placement': 'right', 'trigger': 'manual','tooltipClass': 'tooltipclass'});
if (msg.tls_check.tls_cert_details == '')
error_msg="Certificate was not found";
else
error_msg="Cert commonname doesn't match the domain:" + JSON.stringify(msg.tls_check.tls_cert_details);

$("#tls_check_row").tooltip({'title': error_msg, 'placement': 'right', 'trigger': 'manual','tooltipClass': 'tooltipclass'});
$("#tls_check_row").tooltip('show');
}

Expand Down
13 changes: 7 additions & 6 deletions kamailio/kamailio_dsiprouter.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
##!define WITH_DMQ
#!define WITH_MSTEAMS
#
#!substdef "!INTERNAL_IP_ADDR!68.183.206.180!g"
#!substdef "!INTERNAL_IP_NET!68.183.206.*!g"
#!substdef "!EXTERNAL_IP_ADDR!68.183.206.180!g"
#!substdef "!INTERNAL_IP_ADDR!159.203.32.114!g"
#!substdef "!INTERNAL_IP_NET!159.203.32.*!g"
#!substdef "!EXTERNAL_IP_ADDR!159.203.32.114!g"
#!substdef "!EXTERNAL_FQDN!sbc3.dsiprouter.net!g"
#!substdef "!SIP_PORT!5060!g"
#!substdef "!SIPS_PORT!5061!g"
Expand Down Expand Up @@ -229,7 +229,7 @@ server.pbx_invite_timeout_aftertry = 52000 desc "PBX INVITE timeout value if a S

# DSIPRouter API Server Settings
server.api_server = "http://127.0.0.1:5000" desc "URL to the DSIPRouter API Server"
server.api_token = "admin" desc "API Token for DSIPRouter API Server"
server.api_token = "vmqkMcYFElJjSdPLx6zp4zeEYq1W4NZRmPm1aMcV07x0kYkJVn4XIHiv8qEJ84B0" desc "API Token for DSIPRouter API Server"

####### Modules Section ########

Expand Down Expand Up @@ -2110,8 +2110,9 @@ event_route[xhttp:request] {
event_route[tm:local-request] {

if(is_method("OPTIONS") && $ru =~ "pstnhub.microsoft.com") {
append_hf("Contact: <sip:EXTERNAL_FQDN:SIPS_PORT;transport=tls>\r\n");
xlog("L_INFO", "Sent out tm request: $mb\n");
#append_hf("Contact: <sip:EXTERNAL_FQDN:SIPS_PORT;transport=tls>\r\n");
append_hf("Contact: <sip:$fd:SIPS_PORT;transport=tls>\r\n");
xlog("L_DBG", "Sent out tm request: $mb\n");
}


Expand Down

0 comments on commit 6e2961f

Please sign in to comment.