<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">Hi,<br>
      <br>
      On 3.2, are you sure you actually have the ongoing connection? Try
      running the list_tcp_conns MI cmd just before trying to push the
      MESSAGE out. Be sure that the remote point (proto:ip:port) of the
      connection matches the destination of your MESSAGE (so the
      connection gets re-used).<br>
      <br>
      <a class="moz-txt-link-freetext" href="https://www.opensips.org/Documentation/Interface-CoreMI-3-2#toc4">https://www.opensips.org/Documentation/Interface-CoreMI-3-2#toc4</a><br>
      <br>
      Regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 27-30 Sept 2022, Athens
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2022Athens/">https://www.opensips.org/events/Summit-2022Athens/</a></pre>
    <div class="moz-cite-prefix">On 9/29/22 5:09 PM, jacky z wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOB03Ds2CRzBz6cvVi3ENz2sw=APWRsEM+k9xxNKumrFja=2=Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">Also tried version 3.2.2. The same issue. The
          existing TCP connection can't be found when there is a Message
          request, either from msilo dump or opensips-cli command. A
          message sent directly is normal when the receiver side
          registers with a living TCP socket. Guess this would also
          affect other behavior where an existing TCP connection needs
          to be found. From the log, the connection ID is zero. Very
          strange behavior. I would like to debug, but not familiar with
          the source code structure. For example how a TCP connection is
          looked for and which file handles this. Guess it is not
          difficult to fix, hope the Opensips team can help. Thank you! <br>
        </div>
        <br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Tue, Sep 27, 2022 at
            10:56 PM jacky z <<a href="mailto:zjack0992@gmail.com"
              moz-do-not-send="true">zjack0992@gmail.com</a>> wrote:<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 dir="ltr">Who can help on this? It is difficult to
              understand why the live tcp connection can't be found with
              opensips 3.2. It works well with opensips 3.1. Thanks!<br>
            </div>
            <br>
            <div class="gmail_quote">
              <div dir="ltr" class="gmail_attr">On Mon, Sep 26, 2022 at
                3:54 PM jacky z <<a href="mailto:zjack0992@gmail.com"
                  target="_blank" moz-do-not-send="true">zjack0992@gmail.com</a>>
                wrote:<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 dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">Hi Team,<br>
                      <div><br>
                      </div>
                      <div>We use MI command to send messages to a user
                        successfully with opensips 3.1, but after we
                        upgraded to 3.2.8, the message can't be sent
                        with opensips-cli command.</div>
                      <div><br>
                      </div>
                      <div>We compared the logs and found that when the
                        command was run on 3.2.8, the tcp connection
                        couldn't be found though we can confirm there
                        was a tcp connection. Another strange behavior
                        is that it did not lookup the location table for
                        the ruri and it seems the message route was not
                        called. On 3.2.8, if we specify the ruri in the
                        command with the actual ip address and port we
                        manually found in the location table, the
                        message can be sent. We also found the msilo
                        module can't send messages on 3.2.8 but it works
                        well on 3.1.</div>
                      <div><br>
                      </div>
                      <div>Here is the command we used:</div>
                      <div><br>
                      </div>
                      <div>opensips-cli -x mi t_uac_dlg method=MESSAGE
                        ruri=<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.domain.com:5061;transport=TLS">"sip:12345@sip.domain.com:5061;transport=TLS"</a>
                        headers="From:
                        <a class="moz-txt-link-freetext" href="sip:6789@sip.domain.com:5061;transport=tls\r\nTo">sip:6789@sip.domain.com:5061;transport=tls\r\nTo</a>:
<a class="moz-txt-link-freetext" href="sip:12345@sip.domain.com:5061;transport=TLS\r\nContact">sip:12345@sip.domain.com:5061;transport=TLS\r\nContact</a>:
                        <a class="moz-txt-link-freetext" href="sip:6789@sip.domain.com:5061;transport=tls\r\nContent-Type">sip:6789@sip.domain.com:5061;transport=tls\r\nContent-Type</a>:
                        text/plain\r\n" body="this is a message"<br>
                      </div>
                      <div><br>
                      </div>
                      <div>Here are the logs on 3.1 and 3.2.8
                        respectively,</div>
                      <div><br>
                      </div>
                      <div>
                        <div>Logs for OPENSIPS 3.2</div>
                        <div><br>
                        </div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_msg: SIP Request:</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_msg:  method:  <MESSAGE></div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_msg:  uri:   
                           <a class="moz-txt-link-rfc2396E" href="sip:6989229721@sip.domain.com:5061;transport=TLS"><sip:6989229721@sip.domain.com:5061;transport=TLS></a></div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_msg:  version: <SIP/2.0></div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_headers: flags=ffffffffffffffff</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_via_param: found param type
                          232, <branch> =
                          <z9hG4bKaaa.9835bef.0>; state=16</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_via: end of header reached,
                          state=5</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_headers: via found,
                          flags=ffffffffffffffff</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_headers: this is the first via</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:_parse_to: end of header reached,
                          state=9</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:_parse_to: display={}, ruri={<a
                            href="http://sip:6989229721@sip.domain.com:5061"
                            target="_blank" moz-do-not-send="true">sip:6989229721@sip.domain.com:5061</a>}</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:get_hdr_field: <To> [37]; uri=[<a
href="http://sip:6989229721@sip.domain.com:5061" target="_blank"
                            moz-do-not-send="true">sip:6989229721@sip.domain.com:5061</a>]</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:get_hdr_field: to body [<a
                            href="http://sip:6989229721@sip.domain.com:5061#015%23012"
                            target="_blank" moz-do-not-send="true">sip:6989229721@sip.domain.com:5061#015#012</a>]</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:get_hdr_field: cseq <CSeq>:
                          <10> <MESSAGE></div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:get_hdr_field: content_length=28</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:get_hdr_field: found end of header</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_headers: flags=ffffffffffffffff</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:parse_headers: flags=78</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:proto_tls:proto_tls_send: no open tcp
                          connection found, opening new one, async = 0</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:probe_max_sock_buff: getsockopt: snd
                          is initially 16384</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:probe_max_sock_buff: using snd buffer
                          of 416 kb</div>
                        <div>Sep 26 07:21:13 opensips[3477]:
                          DBG:core:init_sock_keepalive: TCP keepalive
                          enabled on socket 103</div>
                        <div>Sep 26 07:21:14 opensips[3477]:
                          ERROR:core:tcp_connect_blocking_timeout:
                          connect timed out, 1000079 us elapsed out of
                          1000000 us</div>
                        <div>Sep 26 07:21:14 opensips[3477]:
                          ERROR:core:tcp_sync_connect_fd:
                          tcp_blocking_connect failed</div>
                        <div>Sep 26 07:21:14 opensips[3477]:
                          ERROR:proto_tls:proto_tls_send: connect failed</div>
                        <div>Sep 26 07:21:14 opensips[3477]:
                          ERROR:tm:msg_send: send() to <a
                            href="http://12.34.56.78:5061"
                            target="_blank" moz-do-not-send="true">12.34.56.78:5061</a>
                          for proto tls/3 failed</div>
                        <div>Sep 26 07:21:14 opensips[3477]:
                          ERROR:tm:t_uac: attempt to send to
                          '<a class="moz-txt-link-freetext" href="sip:6989229721@sip.domain.com:5061;transport=TLS">sip:6989229721@sip.domain.com:5061;transport=TLS</a>'
                          failed</div>
                        <div><br>
                        </div>
                        <div>Logs for OPENSIPS 3.1</div>
                        <div><br>
                        </div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]: DBG:core:parse_msg:
                          SIP Request:</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_msg:  method:  <MESSAGE></div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_msg:  uri:   
                           <a class="moz-txt-link-rfc2396E" href="sip:3293543374@sip.domain.com:5061;transport=TLS"><sip:3293543374@sip.domain.com:5061;transport=TLS></a></div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_msg:  version: <SIP/2.0></div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_headers: flags=ffffffffffffffff</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_via_param: found param type
                          232, <branch> =
                          <z9hG4bK08a6.250aa504.0>; state=16</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]: DBG:core:parse_via:
                          end of header reached, state=5</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_headers: via found,
                          flags=ffffffffffffffff</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_headers: this is the first via</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]: DBG:core:_parse_to:
                          end of header reached, state=9</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]: DBG:core:_parse_to:
                          display={}, ruri={<a
                            href="http://sip:3293543374@sip.domain.com:5061"
                            target="_blank" moz-do-not-send="true">sip:3293543374@sip.domain.com:5061</a>}</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:get_hdr_field: <To> [38]; uri=[<a
href="http://sip:3293543374@sip.domain.com:5061" target="_blank"
                            moz-do-not-send="true">sip:3293543374@sip.domain.com:5061</a>] </div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:get_hdr_field: to body [<a
                            href="http://sip:3293543374@sip.domain.com:5061#015%23012"
                            target="_blank" moz-do-not-send="true">sip:3293543374@sip.domain.com:5061#015#012</a>]</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:get_hdr_field: cseq <CSeq>:
                          <10> <MESSAGE></div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:get_hdr_field: content_length=28</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:get_hdr_field: found end of header</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_headers: flags=ffffffffffffffff</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11569]:
                          DBG:core:parse_headers: flags=78</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:core:tcp_conn_get: con found in state 0</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:core:tcp_conn_get: tcp connection found
                          (0x7fd4544ee2f0), acquiring fd</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:core:tcp_conn_get: c= 0x7fd4544ee2f0,
                          n=16, Usock=75</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11571]:
                          DBG:core:handle_worker: read response=
                          7fd4544ee2f0, 1, fd -1 from 2 (11558)</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:core:tcp_conn_get: after receive_fd: c=
                          0x7fd4544ee2f0 n=8 fd=102</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:proto_tls:proto_tls_send: sending via fd
                          102...</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:proto_tls:tls_update_fd: New fd is 102</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:proto_tls:tls_write: write was successful
                          (534 bytes)</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:proto_tls:proto_tls_send: after write: c=
                          0x7fd4544ee2f0 n=534 fd=102</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:proto_tls:proto_tls_send: buf=#012MESSAGE
<a class="moz-txt-link-freetext" href="sip:3293543374@sip.domain.com:5061;transport=TLS">sip:3293543374@sip.domain.com:5061;transport=TLS</a> SIP/2.0#015#012Via:
                          SIP/2.0/TLS
                          sip.domain.com:5061;branch=z9hG4bK08a6.250aa504.0#015#012To:
                          <a
                            href="http://sip:3293543374@sip.domain.com:5061#015%23012From"
                            target="_blank" moz-do-not-send="true">sip:3293543374@sip.domain.com:5061#015#012From</a>:
                          <<a
                            href="http://sip:3293543374@sip.domain.com:5061"
                            target="_blank" moz-do-not-send="true">sip:3293543374@sip.domain.com:5061</a>>;tag=fb020df94c5e77218c43e857503e9580-89dd#015#012CSeq:
                          10 MESSAGE#015#012Call-ID: <a
                            href="http://70bcd9894ae296f3-11558@172.31.14.229#015%23012Max-Forwards"
                            target="_blank" moz-do-not-send="true">70bcd9894ae296f3-11558@172.31.14.229#015#012Max-Forwards</a>:
                          70#015#012Content-Length:
                          28#015#012User-Agent: OpenSIPS (3.1.11
                          (x86_64/linux))#015#012Contact:
                          <a class="moz-txt-link-freetext" href="sip:3293543374@sip.domain.com:5061;transport=tls#015#012Content-Type">sip:3293543374@sip.domain.com:5061;transport=tls#015#012Content-Type</a>:
                          text/plain#015#012#015#012{"type":"11",
                          "cont":"test"}</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:tm:insert_timer_unsafe: [0]:
                          0x7fd4545590c0 (42)</div>
                        <div>Sep 26 07:32:00 ip-172-31-14-229
                          /usr/sbin/opensips[11558]:
                          DBG:mi_fifo:mi_fifo_server: got mi response =
                          [0xffffffffffffffff]</div>
                      </div>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                      <div>Thanks!</div>
                      <div><br>
                      </div>
                      <div>jacky</div>
                    </div>
                  </div>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>