<div dir="auto">Your contact header looks wrong. Hint: look in the oracle sbc ms teams docs.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 7 May 2020, 18:24 James Hogbin, <<a href="mailto:james@ip-sentinel.com">james@ip-sentinel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>My set up<br>
<br>
Teams <—> <a href="http://sbc.ip-sentinel.com" target="_blank" rel="noreferrer">sbc.ip-sentinel.com</a> <—> <a href="http://pbx.ip-sentinel.com" target="_blank" rel="noreferrer">pbx.ip-sentinel.com</a><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" target="_blank" rel="noreferrer"><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" rel="noreferrer">+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" rel="noreferrer">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" <<a href="http://sip:opensips@10.0.0.5:5091" target="_blank" rel="noreferrer">sip:opensips@10.0.0.5:5091</a>>;tag=eect23Z290N9p<br>
 To: <<a href="http://sip:08435577721@10.0.0.5:5091" target="_blank" rel="noreferrer">sip:08435577721@10.0.0.5:5091</a>><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" <<a href="http://sip:+442030114146@10.0.0.5:5091" target="_blank" rel="noreferrer">sip:+442030114146@10.0.0.5:5091</a>>;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:<a href="http://sbc.ip-sentinel.com:5091" target="_blank" rel="noreferrer">sbc.ip-sentinel.com:5091</a><br>
alias = udp:<a href="http://sbc.ip-sentinel.com:5060" target="_blank" rel="noreferrer">sbc.ip-sentinel.com:5060</a><br>
alias = tcp:<a href="http://sbc.ip-sentinel.com:5060" target="_blank" rel="noreferrer">sbc.ip-sentinel.com:5060</a><br>
advertised_address=137.117.136.143<br>
listen=udp:<a href="http://10.0.0.5:5060" target="_blank" rel="noreferrer">10.0.0.5:5060</a><br>
listen=tcp:<a href="http://10.0.0.5:5060" target="_blank" rel="noreferrer">10.0.0.5:5060</a><br>
listen=tls:<a href="http://10.0.0.5:5091" target="_blank" rel="noreferrer">10.0.0.5:5091</a><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", "<a href="http://137.117.136.143:5060" target="_blank" rel="noreferrer">137.117.136.143:5060</a>");<br>
                add_rr_param(";r2=on");<br>
                $rd="<a href="http://sip.pstnhub.microsoft.com" target="_blank" rel="noreferrer">sip.pstnhub.microsoft.com</a>";<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="<a href="http://pbx.ip-sentinel.com" target="_blank" rel="noreferrer">pbx.ip-sentinel.com</a>";<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) = "<a href="http://pstnhub.microsoft.com" target="_blank" rel="noreferrer">pstnhub.microsoft.com</a>";<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>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank" rel="noreferrer">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>