<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hey Tito,<br>
      <br>
      You lost me a bit with your scenario.....You say you do t_relay()
      twice in the script for the same request?<br>
      <br>
      Regards,<br>
    </tt>
    <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>

</pre>
    <div class="moz-cite-prefix">On 4/23/20 10:48 PM, Tito Cumpen wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANZPVB6giBtveN1OZ9FCDicAWCvAqWpcUhR7W=GLYaCmXTzNqw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hey Bogdan,
        <div><br>
        </div>
        <div>Yes it seems like it continued down my routing script and
          tried to send it locally as well </div>
        <div>which is why I saw these </div>
        <div>Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
          ERROR:tm:msg_send: send() to <a href="http://127.0.0.1:443/"
            target="_blank" moz-do-not-send="true">127.0.0.1:443</a> for
          proto tls/3 failed  <br>
        </div>
        <div>when using the t_relay command. The remote end was sending
          provisionals but the failure above was causing the internal
          error.<br>
        </div>
        <div><br>
        </div>
        <div>I've found a solution by using
          force_send_socket(tls:MY_IP:443); my tls port</div>
        <br>
        <div><br>
        </div>
        <div>and then rewriting the host port to the destination.</div>
        <div> rewritehostport("SIPAS:port");<br>
        </div>
        <div><br>
        </div>
        <div>should I be using the exit command after a t_relay to avoid
          this?</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Tito</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Apr 23, 2020 at 1:39
          AM Bogdan-Andrei Iancu <<a
            href="mailto:bogdan@opensips.org" moz-do-not-send="true">bogdan@opensips.org</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 bgcolor="#FFFFFF"> <tt>Hi Tito,<br>
              <br>
              Note that the tcp_connect_timeout is in milliseconds, so
              maybe 3 ms is too short for getting back the SYN ACK.<br>
              <br>
              The logs are keep reporting the failed connect. You say
              the connect is ok, the INVITE is sent forward to callee
              and there is also an 180 response? ....and then you get
              the 500 reply ?<br>
              <br>
              Regards,<br>
            </tt>
            <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>

</pre>
            <div>On 4/22/20 2:22 AM, Tito Cumpen wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Bogdan,
                <div><br>
                </div>
                <div>I found out that there was a timer flag for tcp
                  connections that may have been causing an issue</div>
                <div>tcp_connect_timeout=3<br>
                </div>
                <div>Once I removed this line the tls connection was
                  made fine but now I am seeing opensips send an error
                  message to the client</div>
                <div><br>
                </div>
                <div>SIP/2.0 500 Server error occurred (1/SL)<br>
                </div>
                <div>client---opensips---SIP AS</div>
                <div>even though the SIP AS sent a 180 response</div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>Here are the errors from the log</div>
                <div><br>
                </div>
                <div>Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcp_connect_blocking_timeout: poll error:
                  flags 28 - 4 8 16 32<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcp_connect_blocking_timeout: failed to
                  retrieve SO_ERROR [server=<a
                    href="http://127.0.0.1:443" target="_blank"
                    moz-do-not-send="true">127.0.0.1:443</a>] (111)
                  Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:proto_tls:tls_sync_connect: tcp_blocking_connect
                  failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:proto_tls:proto_tls_send: connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:443" target="_blank"
                    moz-do-not-send="true">127.0.0.1:443</a> for proto
                  tls/3 failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:t_forward_nonack: sending request failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcp_connect_blocking_timeout: poll error:
                  flags 28 - 4 8 16 32<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcp_connect_blocking_timeout: failed to
                  retrieve SO_ERROR [server=<a
                    href="http://127.0.0.1:443" target="_blank"
                    moz-do-not-send="true">127.0.0.1:443</a>] (111)
                  Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:proto_tls:tls_sync_connect: tcp_blocking_connect
                  failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:proto_tls:proto_tls_send: connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:443" target="_blank"
                    moz-do-not-send="true">127.0.0.1:443</a> for proto
                  tls/3 failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:t_forward_nonack: sending request failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: poll error: flags 1c<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: failed to retrieve
                  SO_ERROR [server=<a href="http://127.0.0.1:5060"
                    target="_blank" moz-do-not-send="true">127.0.0.1:5060</a>]
                  (111) Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:proto_tcp_send: async TCP connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:5060" target="_blank"
                    moz-do-not-send="true">127.0.0.1:5060</a> for proto
                  tcp/2 failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:t_forward_nonack: sending request failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: poll error: flags 1c<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: failed to retrieve
                  SO_ERROR [server=<a href="http://127.0.0.1:5060"
                    target="_blank" moz-do-not-send="true">127.0.0.1:5060</a>]
                  (111) Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:proto_tcp_send: async TCP connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:5060" target="_blank"
                    moz-do-not-send="true">127.0.0.1:5060</a> for proto
                  tcp/2 failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:t_forward_nonack: sending request failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: poll error: flags 1c<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: failed to retrieve
                  SO_ERROR [server=<a href="http://127.0.0.1:5223"
                    target="_blank" moz-do-not-send="true">127.0.0.1:5223</a>]
                  (111) Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:proto_tcp_send: async TCP connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:5223" target="_blank"
                    moz-do-not-send="true">127.0.0.1:5223</a> for proto
                  tcp/2 failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:t_forward_nonack: sending request failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: poll error: flags 1c<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:tcpconn_async_connect: failed to retrieve
                  SO_ERROR [server=<a href="http://127.0.0.1:5223"
                    target="_blank" moz-do-not-send="true">127.0.0.1:5223</a>]
                  (111) Connection refused<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:core:proto_tcp_send: async TCP connect failed<br>
                  Apr 21 23:12:46 sip1 /sbin/opensips[11376]:
                  ERROR:tm:msg_send: send() to <a
                    href="http://127.0.0.1:5223" target="_blank"
                    moz-do-not-send="true">127.0.0.1:5223</a> for proto
                  tcp/2 failed<br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Tue, Apr 21, 2020
                  at 11:26 AM Tito Cumpen <<a
                    href="mailto:tito@xsvoce.com" target="_blank"
                    moz-do-not-send="true">tito@xsvoce.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">Hey Bogdan,
                    <div><br>
                    </div>
                    <div>Here is the capture I took from using
                      t_relay("tls:domain:port") </div>
                    <div><br>
                    </div>
                    <div>As you can see the client side (opensips) does
                      not proceed with allowing the socket to open.</div>
                    <div><br>
                    </div>
                    <div>Thanks,</div>
                    <div>Tito</div>
                  </div>
                  <br>
                  <div class="gmail_quote">
                    <div dir="ltr" class="gmail_attr">On Tue, Apr 21,
                      2020 at 2:18 AM Bogdan-Andrei Iancu <<a
                        href="mailto:bogdan@opensips.org"
                        target="_blank" moz-do-not-send="true">bogdan@opensips.org</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 bgcolor="#FFFFFF"> <tt>Hi Tito,<br>
                          <br>
                          Well, from OpenSIPS perceptive it is a
                          "Connection refused", so the destination is
                          rejecting the connect.<br>
                          <br>
                          Regards,<br>
                        </tt>
                        <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>

</pre>
                        <br>
                      </div>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>