<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>it seems that the ACK comes in, but my guess is that the R-URI is
      not properly set. From the logs it looks like same value as for To
      header URI, while it should be the address in Contact header of
      200ok for INVITE.</p>
    <p>Load the sipdump module and that will save all the sip traffic in
      a text file, making it easier to see what comes/goes on both
      directions, no matter is over tls or not. If you use kamailio
      devel version (master branch), then sipdump module can also store
      traffic in pcap file (tls traffic saved as udp for simplicity, but
      it is easy to spot from headers or meta data extra header).</p>
    <p>You can send the sipdump file here for investigation, so we can
      see if some headers or r-uri are not correct.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 01.09.20 11:15, sip user wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CALwUm-iY2LiO+yLWJ38Z=eY1et4bASbRyuTmJbcqAS+JZ=hK0w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hi Daniel, thanks for answered to me...</div>
        <div><br>
        </div>
        <div>With debug=3 I see that:</div>
        <div><br>
        </div>
        <div>kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:610]: parse_msg(): SIP Request:<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:612]: parse_msg():  method:
           <ACK><br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:614]: parse_msg():  uri:    
          <a class="moz-txt-link-rfc2396E" href="sip:+34590@FQND:5061;user=phone;transport=tls"><sip:+34590@FQND:5061;user=phone;transport=tls></a><br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:616]: parse_msg():  version:
          <SIP/2.0><br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/parse_addr_spec.c:185]: parse_to_param(): add
          param: tag=92e2fd8688a9d17b927d9be2f84faa55-8079<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/parse_addr_spec.c:864]: parse_addr_spec(): end of
          header reached, state=29<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:171]: get_hdr_field(): <TO>
          [94]; uri=[<a class="moz-txt-link-freetext" href="sip:+34590@FQND:5061;user=phone">sip:+34590@FQND:5061;user=phone</a>]<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:174]: get_hdr_field(): to body
          [<a class="moz-txt-link-rfc2396E" href="sip:+34590@FQND:5061;user=phone"><sip:+34590@FQND:5061;user=phone></a>], to tag
          [92e2fd8688a9d17b927d9be2f84faa55-8079]<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:152]: get_hdr_field(): cseq
          <CSEQ>: <1> <ACK><br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/parse_via.c:1303]: parse_via_param(): Found param
          type 232, <branch> = <z9hG4bKf4784e39>; state=16<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/parse_via.c:2639]: parse_via(): end of header
          reached, state=5<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:498]: parse_headers(): Via found,
          flags=2<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:500]: parse_headers(): this is the
          first via<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/receive.c:240]: receive_msg(): --- received sip message
          - request - call-id: [d3649f52dc0057768ec6c18733de8206] -
          cseq: [1 ACK]<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:185]: get_hdr_field():
          content_length=0<br>
          kamailio[1096]:  9(1109) DEBUG: <core>
          [core/parser/msg_parser.c:89]: get_hdr_field(): found end of
          header<br>
          kamailio[1096]:  9(1109) DEBUG: {1 1 ACK
          d3649f52dc0057768ec6c18733de8206} <core>
          [core/receive.c:295]: receive_msg(): preparing to run routing
          scripts...<br>
          kamailio[1096]:  9(1109) DEBUG: {1 1 ACK
          d3649f52dc0057768ec6c18733de8206} sl [sl_funcs.c:397]:
          sl_filter_ACK(): too late to be a local ACK!</div>
        <div><br>
        </div>
        <div>So, I understand that ACK comes from Teams, right? So
          kamailio routing problem?</div>
        <div><br>
        </div>
        <div>Thanks
          <div class="gmail-yj6qo gmail-ajU">
            <div id="gmail-:nd" class="gmail-ajR" tabindex="0"><img
                class="gmail-ajT"
                src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif"
                moz-do-not-send="true"></div>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">El mar., 25 ago. 2020 a las
          15:32, Daniel-Constantin Mierla (<<a
            href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>)
          escribió:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Hello,</p>
            <p>run with debug=3 in kamailio.cfg and see if the ACK comes
              to Kamailio, if yes, then some routing issue in
              kamailio.cfg. If does not come, you will have to check the
              headers to see if MS Teams expects something else there,
              typically is about Record-Route domains...</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 20.08.20 12:25, sip user wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Hi, I'm connecting Teams with kamailio server. From
                  Kamailio to teams I have no problems, but from teams
                  to Kamailio yes. Drop the call..</div>
                <div><br>
                </div>
                <div>With ngrep I see that:</div>
                <div><br>
                </div>
                <div>
                  <div>INVITE <a moz-do-not-send="true">sip:1005@CLIENT_IP:55766;transport=UDP;rinstance=d47edf336726e940</a>
                    SIP/2.0.<br>
                    Record-Route: <a moz-do-not-send="true"><sip:FQND_IP;r2=on;lr></a>.<br>
                    Record-Route: <a moz-do-not-send="true"><sip:FQND_IP:5061;transport=tls;r2=on;lr></a>.<br>
                    FROM: "Javier Gonz..lez
                    Mu..oz"<a moz-do-not-send="true"><sip:+324@sip.pstnhub.microsoft.com:5061;user=phone></a>;tag=c17bb1eb7f8649d4a89d8d4a876ac32b.<br>
                    TO: <a moz-do-not-send="true"><sip:+34560@FQND:5061;user=phone></a>.<br>
                    CSEQ: 1 INVITE.<br>
                    CALL-ID: c1364913e582553a9a9c2544c3583b0a.<br>
                    MAX-FORWARDS: 69.<br>
                    Via: SIP/2.0/UDP
92.222.217.64;branch=z9hG4bK7bb5.0fbae76a37829205e04279f220a26af2.0;i=a1.<br>
                    VIA: SIP/2.0/TLS
                    52.114.76.76:5061;branch=z9hG4bKd216a55.<br>
                    RECORD-ROUTE: <a moz-do-not-send="true"><sip:sip-du-a-eu.pstnhub.microsoft.com:5061;transport=tls;lr></a>.<br>
                    CONTACT:
                    <a moz-do-not-send="true"><sip:api-du-a-euno.pstnhub.microsoft.com:443;x-i=b0b53fc5-76ef-4619-9a68-13e0a4eea92d;x-c=c1364913e582553a9a9c2544c3583b0a/d/8/6c25eb3789a14bf188ce6b05b5e27891></a>.<br>
                    CONTENT-LENGTH: 1091.<br>
                    MIN-SE: 300.<br>
                    SUPPORTED: timer.<br>
                    USER-AGENT: Microsoft.PSTNHub.SIPProxy v.2020.7.31.1
                    i.EUNO.0.<br>
                    CONTENT-TYPE: application/sdp.<br>
                    ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFY.<br>
                    P-ASSERTED-IDENTITY: <a href="tel:+324"
                      target="_blank" moz-do-not-send="true"><tel:+324></a>,<a
                      moz-do-not-send="true"><sip:EMAIL></a>.<br>
                    PRIVACY: id.<br>
                    SESSION-EXPIRES: 3600.<br>
                    .<br>
                    v=0.<br>
                    o=- 165103 0 IN IP4 127.0.0.1.<br>
                    s=session.<br>
                    c=IN IP4 52.113.44.8.<br>
                    b=CT:10000000.<br>
                    t=0 0.<br>
                    m=audio 50452 RTP/SAVP 104 9 103 111 18 0 8 97 101
                    13 118.<br>
                    c=IN IP4 52.113.44.8.<br>
                    a=rtcp:50453.<br>
                    a=ice-ufrag:FZTb.<br>
                    a=ice-pwd:yD3P7nr+xNq0VYdv7xpB1F+Y.<br>
                    a=rtcp-mux.<br>
                    a=candidate:1 1 UDP 2130706431 52.113.44.8 50452 typ
                    srflx raddr 10.0.33.240 rport 50<br>
                  </div>
                </div>
                <div><br>
                </div>
                <div>U CLIENT_IP:55766 -> FQND_IP:5060 #2<br>
                  SIP/2.0 180 Ringing.<br>
                  Via: SIP/2.0/UDP
                  FQND_IP;branch=z9hG4bK7bb5.0fbae76a37829205e04279f220a26af2.0;i=a1.<br>
                  Via: SIP/2.0/TLS
                  52.114.76.76:5061;branch=z9hG4bKd216a55.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:FQND_IP;lr;r2=on></a>.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:FQND_IP:5061;transport=tls;r2=on;lr></a>.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:sip-du-a-eu.pstnhub.microsoft.com:5061;transport=tls;lr></a>.<br>
                  Contact:
                  <a moz-do-not-send="true"><sip:1005@CLIENT_IP:55766;transport=UDP;rinstance=d47edf336726e940></a>.<br>
                  To: <a moz-do-not-send="true"><sip:+34560@FQND:5061;user=phone></a>;tag=de4e6b45.<br>
                  From: "Javier Gonz..lez
                  Mu..oz"<a moz-do-not-send="true"><sip:+324@sip.pstnhub.microsoft.com:5061;user=phone></a>;tag=c17bb1eb7f8649d4a89d8d4a876ac32b.<br>
                  Call-ID: c1364913e582553a9a9c2544c3583b0a.<br>
                  CSeq: 1 INVITE.<br>
                  User-Agent: 3CXPhone 6.0.26523.0.<br>
                  Content-Length: 0.<br>
                </div>
                <div><br>
                </div>
                <div>U CLIENT_IP:55766 -> FQND_IP:5060 #3<br>
                  SIP/2.0 200 OK.<br>
                  Via: SIP/2.0/UDP
                  FQND_IP;branch=z9hG4bK7bb5.0fbae76a37829205e04279f220a26af2.0;i=a1.<br>
                  Via: SIP/2.0/TLS
                  52.114.76.76:5061;branch=z9hG4bKd216a55.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:FQND_IP;lr;r2=on></a>.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:FQND_IP:5061;transport=tls;r2=on;lr></a>.<br>
                  Record-Route: <a moz-do-not-send="true"><sip:sip-du-a-eu.pstnhub.microsoft.com:5061;transport=tls;lr></a>.<br>
                  Contact:
                  <a moz-do-not-send="true"><sip:1005@CLIENT_IP:55766;transport=UDP;rinstance=d47edf336726e940></a>.<br>
                  To: <a moz-do-not-send="true"><sip:+34560@FQND:5061;user=phone></a>;tag=de4e6b45.<br>
                  From: "Javier Gonz..lez
                  Mu..oz"<a moz-do-not-send="true"><sip:+324@sip.pstnhub.microsoft.com:5061;user=phone></a>;tag=c17bb1eb7f8649d4a89d8d4a876ac32b.<br>
                  Call-ID: c1364913e582553a9a9c2544c3583b0a.<br>
                  CSeq: 1 INVITE.<br>
                  Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER,
                  SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE.<br>
                  Content-Type: application/sdp.<br>
                  Supported: replaces.<br>
                  User-Agent: 3CXPhone 6.0.26523.0.<br>
                  Content-Length: 1067.<br>
                  .<br>
                  v=0.<br>
                  o=3cxVCE 324945090 117647850 IN IP4 .<br>
                  s=3cxVCE Audio Call.<br>
                  t=0 0.<br>
                  m=audio 0 RTP/SAVP 104 9 103 111 18 0 8 97 101 13 118.<br>
                  c=IN IP4 52.113.44.8.<br>
                  a=rtpmap:104 SILK/16000.<br>
                  a=rtpmap:9 G722/8000.<br>
                  a=rtpmap:103 SILK/8000.<br>
                  a=rtpmap:111 SIREN/16000.<br>
                  a=fmtp:111 bitrate=16000.<br>
                  a=rtpmap:18 G729/8000.<br>
                  a=fmtp:18 annexb=no.<br>
                  a=rtpmap:0 PCMU/8000.<br>
                  a=rtpmap:8 PCMA/8000.<br>
                  a=rtpmap:97 RED/8000.<br>
                  a=rtpmap:101 telephone-event/8000.<br>
                  a=fmtp:101 0-16.<br>
                  a=rtpmap:13 CN/8000.<br>
                  a=rtpmap:118 CN/16000.<br>
                  a=rtcp:50453.<br>
                  a=ice-ufrag:FZTb.<br>
                  a=ice-pwd:yD3P7nr+xNq0VYdv7xpB1F+Y.<br>
                  a=rtcp-mux.<br>
                  a=candidate:1 1 UDP 213<br>
                </div>
                <div><br>
                </div>
                <div>I never received ACK..</div>
                <div><br>
                </div>
                <div>In my configuration:</div>
                <div><br>
                </div>
                <div>Kamailio.cfg:</div>
                <div><br>
                </div>
                <div>#!KAMAILIO<br>
                  #!define WITH_TLS</div>
                <div><br>
                </div>
                <div>event_route[tm:local-request] {<br>
                  <br>
                          if(is_method("OPTIONS") && $ru =~ "<a
                    href="http://pstnhub.microsoft.com" target="_blank"
                    moz-do-not-send="true">pstnhub.microsoft.com</a>") {<br>
                                 append_hf("Contact: <a
                    moz-do-not-send="true"><sip:FQND:5061;transport=tls></a>\r\n");<br>
                          }<br>
                          xlog("L_INFO", "Sent out tm request: $mb\n");<br>
                  }</div>
                <div><br>
                </div>
                <div>request_route{</div>
                <div><br>
                </div>
                <div>       remove_hf("Route");<br>
                          if (is_method("INVITE|SUBSCRIBE")) {<br>
                                  xlog("L_INFO","$fU is trying to call
                  to $rU con valores $tu\n");<br>
                                  $rU="1005";<br>
                          }</div>
                <div>}</div>
                <div><br>
                </div>
                <div>What I'm doing wrong?</div>
                <div><br>
                </div>
                <div>I don't understand why not received ACK..</div>
                <div><br>
                </div>
                <div>Could anyone help me?</div>
                <div><br>
                </div>
                <div>Thanks</div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank" moz-do-not-send="true">https://www.paypal.me/dcmierla</a></pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>