<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi, Mikhail!<br>
      <br>
      Unfortunately there is no way for OpenSIPS to recover TCP
      connections to the browser. You'll have to modify your sip.js
      client to automatically try to reconnect when the connection with
      OpenSIPS goes down.<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 04/25/2017 01:15 PM, Mikhail Sidorov
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+=KMpGAzV05sDvda_tu-TN3W0CeKisM2wgs0NjT3j11Jg=GCw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi
        <div><br>
        </div>
        <div>I am using opensips 2.2.3 to handle websocket connections
          from web client (sip.js).</div>
        <div>I just started testing recover after opensips restart and
          find that I could not handle t_relay() failure.</div>
        <div><br>
        </div>
        <div>Assume I have a call between 2 webrtc clients and I restart
          opensips during this call. Media handled by freeswitch, so
          call continue without problem.</div>
        <div><br>
        </div>
        <div>Then, one client send BYE. I use loose_route to find
          another party and send him message.</div>
        <div>But here I got error that I could not handle.</div>
        <div>t_on_failure trigger does not fire</div>
        <div>t_relay return success.<br>
        </div>
        <div><br>
        </div>
        <div>Are there any special flags or triggers to handle this
          case?</div>
        <div><br>
        </div>
        <div>Opensips log:</div>
        <div><br>
        </div>
        <div>
          <div>loose_route success</div>
          <div><a class="moz-txt-link-freetext" href="INFO:core:probe_max_sock_buff">INFO:core:probe_max_sock_buff</a>: using snd buffer of 416 kb</div>
          <div><a class="moz-txt-link-freetext" href="INFO:core:init_sock_keepalive">INFO:core:init_sock_keepalive</a>: TCP keepalive enabled on
            socket 16</div>
          <div>ERROR:core:tcp_connect_blocking: poll error: flags 28 - 4
            8 16 32</div>
          <div>ERROR:core:tcp_connect_blocking: failed to retrieve
            SO_ERROR [server=<a moz-do-not-send="true"
              href="http://172.19.235.225:62594">172.19.235.225:62594</a>]
            (111) Connection refused</div>
          <div>ERROR:proto_<a class="moz-txt-link-freetext" href="wss:ws_sync_connect">wss:ws_sync_connect</a>: tcp_blocking_connect
            failed</div>
          <div>ERROR:proto_<a class="moz-txt-link-freetext" href="wss:ws_connect">wss:ws_connect</a>: connect failed</div>
          <div>ERROR:proto_<a class="moz-txt-link-freetext" href="wss:proto_wss_send">wss:proto_wss_send</a>: connect failed</div>
          <div>ERROR:tm:msg_send: send() for proto 6 failed</div>
          <div>ERROR:tm:t_forward_nonack: sending request failed</div>
        </div>
        <div><br>
        </div>
        <div>My configuration:</div>
        <div><br>
        </div>
        <div>
          <div>if (has_totag())</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>xlog("L_ERR",
            "Following ToTag: $tt $proto");</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>#
            sequential requests within a dialog should</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>#
            take the path determined by record-routing</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>if
            (loose_route())</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>#if
            (is_method("INVITE"))</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>#{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>#<span class="gmail-Apple-tab-span" style="white-space:pre">     </span>record_route();</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>#}</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>xlog("L_ERR",
            "loose_route success\n");</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">                      </span>route(relay);</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>}</div>
        </div>
        <div>--------------------------------</div>
        <div>
          <div>route[relay]</div>
          <div>{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>t_on_failure("loose_route");</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>if
            (!t_relay())</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>xlog("L_ERR",
            "t_relay error]");</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>send_reply("500","Internal
            Error");</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>exit;</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>
          <div>failure_route[loose_route]</div>
          <div>{</div>
          <div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>xlog(
            "L_ERR", "loose_route failed" );</div>
        </div>
        <div>...</div>
        <div>}</div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <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>