<html><body>My set up<BR>
<BR>
Teams <—> sbc.ip-sentinel.com <—> pbx.ip-sentinel.com<BR>
<BR>
I can create a call with audio from Teams -> PBX<BR>
I can hang up that call from Teams but not the PBX<BR>
I cannot route a call from PBX to teams. Although the initial TLS handshake does happen<BR>
<BR>
I’m pretty sure it’s something basic to do with headers on ACK & BYE but I just cannot spot what I’ve done wrong<BR>
<BR>
This is the initial outbound message from opensips to teams which looks OK<BR>
<br>
<p style="font-family: Open Sans,sans-serif;">
<b><span style="font-family: Open Sans,sans-serif; font-size:10.0pt;color:#888888">James Hogbin</span></b>
<b><span style="font-family: Open Sans,sans-serif;font-size:8.0pt;color:#888888;"><br>Director</span></b>
</p>
<table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="http://ip-sentinel.com"><IMG border="0" alt="IP Sentinel Logo" src="cid:120050717211601929@uk-mta-141.uk.mimecast.lan" ></A></td></tr></table>
<span style="font-family: Open Sans,sans-serif;font-size:8.0pt;color:#222222;"><br>t. <a href="tel:+442030114150" target="_blank">+44 (0)20 3011 4150</a><br></span><span style="font-family: Open Sans,sans-serif;font-size:8.0pt;color:#222222;">m. +44 7786910895<br></span><span style="font-family: Open Sans,sans-serif;font-size:8.0pt;color:#222222">w. <a href="https://www.ip-sentinel.com/" target="_blank">https://www.ip-sentinel.com</a><br></span><table>
<tbody><tr>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
</tbody></table>
<br>
<BR>
INVITE sip:+448435577721@sip.pstnhub.microsoft.com:5061;transport=tls SIP/2.0<BR>
Record-Route: <sip:sbc.ip-sentinel.com:5091;transport=tls;ftag=eect23Z290N9p;lr;r2=on><BR>
Record-Route: <sip:137.117.136.143:5060;ftag=eect23Z290N9p;lr;r2=on><BR>
Via: SIP/2.0/TLS 137.117.136.143:5091;branch=z9hG4bK48f8.81967713.0;i=e67586f7<BR>
Via: SIP/2.0/TLS 13.80.245.144:5081;rport=41795;received=10.0.0.4;branch=z9hG4bKac61XQKeXDXHB<BR>
Max-Forwards: 68<BR>
From: "James Hogbin" <sip:opensips@10.0.0.5:5091>;tag=eect23Z290N9p<BR>
To: <sip:08435577721@10.0.0.5:5091><BR>
Call-ID: 0109ad37-0b1f-1239-bdba-000d3aada04e<BR>
CSeq: 19879884 INVITE<BR>
Contact: <sip:gw+c6ff36e8-d3de-4fe0-9f1b-9da2888c43a9@13.80.245.144:5081;transport=tls;transport=tls;gw=c6ff36e8-d3de-4fe0-9f1b-9da2888c43a9><BR>
User-Agent: FreeSWITCH<BR>
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY<BR>
Supported: timer, path, replaces<BR>
Allow-Events: talk, hold, conference, refer<BR>
Content-Type: application/sdp<BR>
Content-Disposition: session<BR>
Content-Length: 1339<BR>
X-FS-Support: update_display,send_info<BR>
Remote-Party-ID: "James Hogbin" <sip:+442030114146@10.0.0.5:5091>;party=calling;screen=yes;privacy=off<BR>
#015<BR>
v=0<BR>
o=FreeSWITCH 1588835231 1588835232 IN IP4 137.117,136.143<BR>
s=FreeSWITCH<BR>
c=IN IP4 137.117,136.143<BR>
t=0 0<BR>
m=audio 10432 RTP/SAVP 9 0 8 101 13<BR>
a=rtpmap:9 G722/8000<BR>
a=rtpmap:0 PCMU/8000<BR>
a=rtpmap:8 PCMA/8000<BR>
a=rtpmap:101 telephone-event/8000<BR>
a=fmtp:101 0-16<BR>
a=rtpmap:13 CN/8000<BR>
[stuff removed]<BR>
a=ptime:20<BR>
m=audio 13446 RTP/AVP 9 0 8 101 13<BR>
a=rtpmap:9 G722/8000<BR>
a=rtpmap:0 PCMU/8000<BR>
a=rtpmap:8 PCMA/8000<BR>
a=rtpmap:101 telephone-event/8000<BR>
a=fmtp:101 0-16<BR>
a=rtpmap:13 CN/8000<BR>
a=ptime:20<BR>
a=nortpproxy:yes<BR>
<BR>
opensips.cfg Source_address(0) is my PBX address= <BR>
<BR>
alias = tls:sbc.ip-sentinel.com:5091<BR>
alias = udp:sbc.ip-sentinel.com:5060<BR>
alias = tcp:sbc.ip-sentinel.com:5060<BR>
advertised_address=137.117.136.143<BR>
listen=udp:10.0.0.5:5060<BR>
listen=tcp:10.0.0.5:5060<BR>
listen=tls:10.0.0.5:5091<BR>
<BR>
####### Routing Logic ########<BR>
<BR>
# main request routing logic<BR>
<BR>
route{<BR>
#xlog("L_INFO", "route SIP Message $mb");<BR>
force_rport();<BR>
<BR>
if (!mf_process_maxfwd_header(10)) {<BR>
send_reply(483,"Too Many Hops");<BR>
exit;<BR>
}<BR>
<BR>
if (is_method("OPTIONS")) {<BR>
#xlog("[MS TEAMS] OPTIONS In\n");<BR>
send_reply(200, "OK");<BR>
exit;<BR>
}<BR>
<BR>
# CANCEL processing<BR>
if (is_method("CANCEL")) {<BR>
if (t_check_trans())<BR>
t_relay();<BR>
exit;<BR>
}<BR>
<BR>
# absorb retransmissions, but do not create transaction<BR>
t_check_trans();<BR>
<BR>
if (has_totag()) {<BR>
<BR>
# sequential request within a dialog should<BR>
# take the path determined by record-routing<BR>
<BR>
if(is_method("INVITE") && !check_source_address(0)) {<BR>
xlog("[INFO] In dialog Method=$rm, RURI=$ruri, SI=$si ,DU=$du\n");<BR>
t_relay();<BR>
}<BR>
if ( !loose_route() ) {<BR>
# we do record-routing for all our traffic, so we should not<BR>
# receive any sequential requests without Route hdr.<BR>
send_reply(404, "Not here");<BR>
exit;<BR>
}<BR>
# route it out to whatever destination was set by loose_route()<BR>
# in $du (destination URI).<BR>
route(relay);<BR>
exit;<BR>
}<BR>
<BR>
# account only INVITEs<BR>
if (is_method("INVITE")) {<BR>
do_accounting("log");<BR>
}<BR>
<BR>
if (is_method("INVITE") && !has_totag() && check_source_address(0)) {<BR>
xlog("[ROUTE]Incoming call to MS: RURI=$ruri, SI=$si, M=$rm\n");<BR>
strip(1);<BR>
prefix("+44");<BR>
record_route_preset("sbc.ip-sentinel.com:5091;transport=tls", "137.117.136.143:5060");<BR>
add_rr_param(";r2=on");<BR>
$rd="sip.pstnhub.microsoft.com";<BR>
$rp=5061;<BR>
route(relay);<BR>
} else if (is_method("INVITE") && ! has_totag() && !check_source_address(0)) {<BR>
record_route();<BR>
xlog("[ROUTE]Incoming call from MS: RURI=$ruri, SI=$si, M=$rm\n");<BR>
$rd="pbx.ip-sentinel.com";<BR>
$rp=5081;<BR>
route(relay);<BR>
}<BR>
<BR>
if (!is_myself("$rd")) {<BR>
append_hf("P-hint: outbound\r\n");<BR>
route(relay);<BR>
}<BR>
<BR>
# requests for my domain<BR>
if (is_method("PUBLISH|SUBSCRIBE")) {<BR>
send_reply(503, "Service Unavailable");<BR>
exit;<BR>
}<BR>
<BR>
if ($rU==NULL) {<BR>
# request with no Username in RURI<BR>
send_reply(484,"Address Incomplete");<BR>
exit;<BR>
}<BR>
<BR>
# do lookup with method filtering<BR>
if (!lookup("location","m")) {<BR>
t_reply(404, "Not Found");<BR>
exit;<BR>
}<BR>
<BR>
# when routing via usrloc, log the missed calls also<BR>
do_accounting("log","missed");<BR>
route(relay);<BR>
}<BR>
<BR>
route[relay] {<BR>
xlog("[INFO] route[relay] SIP Message \n$mb\n");<BR>
# for INVITEs enable some additional helper routes<BR>
if (is_method("INVITE") && ! has_totag() ) {<BR>
<BR>
t_newtran();<BR>
t_on_reply("handle_nat");<BR>
t_on_failure("missed_call");<BR>
<BR>
# if we have an application/sdp on our body, so we execute<BR>
# the rtpproxy_offer<BR>
if(has_body("application/sdp")){<BR>
xlog("[RTPPROXY] route[relay] we have sdp on this message\n$rm\n");<BR>
rtpproxy_offer("co", "137.117,136.143");<BR>
}<BR>
<BR>
}<BR>
<BR>
xlog("[INFO] Method=$rm, RURI=$ruri, SI=$si ,DU=$du\n");<BR>
if (!t_relay()) {<BR>
send_reply(500,"Internal Error");<BR>
}<BR>
exit;<BR>
}<BR>
<BR>
onreply_route[handle_nat] {<BR>
xlog("[INFO] onreply_route[handle_nat]: RR=$rr, RS=$rs, SI=$si\n$mb\n");<BR>
# we receive a reply, we need to check about application/sdp<BR>
# on our body, if we have, we answer that<BR>
if(is_method("ACK") && has_body("application/sdp")){<BR>
xlog("[RTPPROXY] onreply_route[handle_nat] ACK rtpproxy_answer\n");<BR>
rtpproxy_answer("co", "137.117,136.143");<BR>
}<BR>
}<BR>
<BR>
failure_route[missed_call] {<BR>
if (t_was_cancelled()) {<BR>
exit;<BR>
}<BR>
}<BR>
<BR>
local_route {<BR>
$var(dst) = "pstnhub.microsoft.com";<BR>
if (is_method("OPTIONS") && ($(ru{s.index, $var(dst)}) != NULL)) {<BR>
append_hf("Contact: <sip:sbc.ip-sentinel.com:5091;transport=tls>\r\n");<BR>
#xlog("[MS TEAMS] OPTIONS Out\n");<BR>
}<BR>
}<BR>
<p style="font-family: Open Sans, Arial, sans-serif;padding: 5px;background:#D5EAFF">
<span style="font-family: Open Sans,sans-serif;font-size:8.0pt;color:red">IP Sentinel Disclaimer <br></span>
<span style="font-family: Open Sans,sans-serif;font-size:6.0pt;color:black">The information contained in this e-mail, and any attachment, is confidential and is intended solely for the use of the intended recipient. Access, copying or re-use of the e-mail or any attachment, or any information contained therein, by any other person is not authorized. Unintended recipients are prohibited from taking action on the basis of information in this e-mail. If you are not the intended recipient or have received this email in error, please notify the sender immediately by return email and delete the email from your computer.
E-mail messages may contain computer viruses or other defects, may not be accurately replicated on other systems, or may be intercepted, deleted or interfered with without the knowledge of the sender or the intended recipient. We do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of computer viruses or other defects.
. IP Sentinel Ltd is a limited company registered in England and Wales under Registered Number 08648097. Registered Office: Newnhams Wood, Horsted Keynes, West Sussex, RH17 7BT. </span>
</p><span style="font-size:1.0pt;color:white">Q3dhRSrm_disclaimer</span>
</body></html>