<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><tt>Hi Sebastian,</tt></p>
    <p><tt>Are you using the major (initial) release RPM of 2.3, or the
        latest minor release one? This issue has only been fixed a
        couple of months ago -- the fix is available starting with
        2.3.3.</tt></p>
    <p><tt>Regards,</tt><br>
    </p>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 13.03.2018 21:19, Sebastian Sastre
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAB=UX=CfJKqRF0H3sjA4PGa2V8DUEhT+b6RU77dAFyj-9rWv8g@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default" style="font-family:tahoma,sans-serif">Razvan, </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">You
          are right, It actually looks like a bug with mid_registrar, I
          changed the function from midregistar_save to save only and I
          can now see the received attribute. </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><b>This
            is my registration Route </b></div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">As
          you can see I call the fix_nated_register right before calling
          the save </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:tahoma,sans-serif">
          <div class="gmail_default">route {</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>if
            (is_method("REGISTER")){<span class="gmail-Apple-tab-span" style="white-space:pre">             </span>
              <span class="gmail-Apple-tab-span" style="white-space:pre">            </span></div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>route(user_registration);<span class="gmail-Apple-tab-span" style="white-space:pre">             </span></div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>exit;</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}<span class="gmail-Apple-tab-span" style="white-space:pre">     </span></div>
          <div class="gmail_default">}</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">route[user_registration]{</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>xlog("L_INFO","$var(prefix)
            - [Registration Route]  \n");</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>if
            (!www_authorize("", "subscriber")){</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>
                xlog("L_INFO","$var(prefix) -  Challenge, come back with
            good credentials  \n");</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>
                www_challenge("", "1");</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>
                exit;</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}
               </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>
               </div>
          <div class="gmail_default">    setflag(TCP_PERSIST_REGISTER);</div>
          <div class="gmail_default">   
            setflag(TCP_PERSIST_REGISTRATIONS);    </div>
          <div class="gmail_default">    setbflag(NAT_BFLAG);</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>if
            (!db_check_to()){</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>xlog("L_INFO","$var(prefix)
            -  Forbidden auth ID  \n");</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>sl_send_reply("403","Forbidden
            auth ID"); </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>exit;</div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}
               </div>
          <div class="gmail_default"> </div>
          <div class="gmail_default">    fix_nated_register();        
              </div>
          <div class="gmail_default">    mid_registrar_save("location",
            "mf", "$fu"); </div>
          <div class="gmail_default">    switch ($retcode) {</div>
          <div class="gmail_default">    case 1:</div>
          <div class="gmail_default">        xlog("L_INFO","$var(prefix)
            -  Registration Successfull (Forwarding) \n");</div>
          <div class="gmail_default">        $ru = "sip:<a
              href="http://10.101.10.153:5060" moz-do-not-send="true">10.101.10.153:5060</a>";</div>
          <div class="gmail_default">        t_relay();</div>
          <div class="gmail_default">        break;</div>
          <div class="gmail_default">    case 2:</div>
          <div class="gmail_default">        xlog("L_INFO","$var(prefix)
            -  Registration Successfull (absorbing) \n");</div>
          <div class="gmail_default">        break;</div>
          <div class="gmail_default">    default:</div>
          <div class="gmail_default">        xlog("L_INFO","$var(prefix)
            -  failed to save registration! ($$ci=$ci)\n");</div>
          <div class="gmail_default">        sl_reply_error();</div>
          <div class="gmail_default">        exit;<span class="gmail-Apple-tab-span" style="white-space:pre">     </span></div>
          <div class="gmail_default">    }           <span class="gmail-Apple-tab-span" style="white-space:pre">                               </span></div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>exit; </div>
          <div class="gmail_default"><span class="gmail-Apple-tab-span" style="white-space:pre">              </span></div>
          <div class="gmail_default">}</div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Mar 13, 2018 at 11:43 AM,
          Răzvan Crainea <span dir="ltr"><<a
              href="mailto:razvan@opensips.org" target="_blank"
              moz-do-not-send="true">razvan@opensips.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,
            Sebastian!<br>
            <br>
            The fix_nated_register() doesn't seem to be called for
            REGISTERs, because I don't see any "Received" line in the
            "ul dump" command. Make sure you call fix_nated_register()
            for all the WSS REGISTER messages.<br>
            <br>
            Best regards,<br>
            Răzvan<span class=""><br>
              <br>
              On 03/12/2018 10:28 PM, Sebastian Sastre wrote:<br>
            </span>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
                class="">
                <br>
                I’m experiencing a problem regarding web socket
                registrations. I saw a similar thread but didn’t have a
                resolution so here we go.<br>
                <br>
                Im using the 2.3 Branch with rtpengine , wss and mid
                registrar. Using Sip.js library I can register the
                client without a problem and also able to place calls
                thru an asterisk box without problems. To be exact, my
                setup is<br>
                <br>
                Sip.JS ——> Opensips + rtpengine —-> Asterisk 1.3
                —-> PSTN<br>
                <br>
                <br>
                However, when trying to call the subscriber from
                asterisk (opposite direction), opensips fails to get a
                valid tcp connection. It complagreatins about not
                finding a suitable tcp and timing out to a TCP block
                477/TM transaction.<br>
                <br>
                DBG:proto_<a class="moz-txt-link-freetext" href="wss:proto_wss_send">wss:proto_wss_send</a>: no open tcp connection
                found, opening new one<br>
                DBG:core:probe_max_sock_buff: getsockopt: snd is
                initially 16384<br>
                DBG:core:probe_max_sock_buff: trying : 32768<br>
                DBG:core:probe_max_sock_buff: setting snd:
                set=32768,verify=65536<br>
                DBG:core:probe_max_sock_buff: trying : 65536<br>
                DBG:core:probe_max_sock_buff: setting snd:
                set=65536,verify=131072<br>
                DBG:core:probe_max_sock_buff: trying : 131072<br>
                DBG:core:probe_max_sock_buff: setting snd:
                set=131072,verify=262144<br>
                DBG:core:probe_max_sock_buff: trying : 262144<br>
                DBG:core:probe_max_sock_buff: setting snd:
                set=262144,verify=425984<br>
                <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<br>
                <a class="moz-txt-link-freetext" href="INFO:core:init_sock_keepalive">INFO:core:init_sock_keepalive</a>: TCP keepalive enabled on
                socket 7<br>
                ERROR:core:tcp_connect_blockin<wbr>g: timeout 99198 ms
                elapsed from 100000 s<br>
                ERROR:proto_<a class="moz-txt-link-freetext" href="wss:ws_sync_connec">wss:ws_sync_connec</a><wbr>t:
                tcp_blocking_connect failed<br>
                ERROR:proto_<a class="moz-txt-link-freetext" href="wss:ws_connect">wss:ws_connect</a>: connect failed<br>
                ERROR:proto_<a class="moz-txt-link-freetext" href="wss:proto_wss_send">wss:proto_wss_send</a><wbr>: connect failed<br>
              </span>
              ERROR:tm:msg_send: send() to <a
                href="http://192.0.2.48:443" rel="noreferrer"
                target="_blank" moz-do-not-send="true">192.0.2.48:443</a>
              <<a href="http://192.0.2.48:443" rel="noreferrer"
                target="_blank" moz-do-not-send="true">http://192.0.2.48:443</a>>
              for proto wss/6 failed<span class=""><br>
                ERROR:tm:t_forward_nonack: sending request failed<br>
                <br>
                Whats interesting is that if I execute a constant
                opensipsctl fifo list_tcp_conns, The connection never
                drops.<br>
                <br>
              </span>
              *root@gcwRegistrar151:~$ opensipsctl fifo list_tcp_conns*<br>
              Connection::  ID=1189087375 Type=wss State=0 Source=<a
                href="http://192.168.91.2:60888" rel="noreferrer"
                target="_blank" moz-do-not-send="true">192.168.91.2:60888</a>
              <<a href="http://192.168.91.2:60888" rel="noreferrer"
                target="_blank" moz-do-not-send="true">http://192.168.91.2:60888</a>>
              Destination=<a href="http://10.101.10.151:443"
                rel="noreferrer" target="_blank" moz-do-not-send="true">10.101.10.151:443</a>
              <<a href="http://10.101.10.151:443" rel="noreferrer"
                target="_blank" moz-do-not-send="true">http://10.101.10.151:443</a>>
              Lifetime=2106-02-07 02:28:25<span class=""><br>
                <br>
                <br>
                I tried seting the tcp_persistent_flag before the
                register and the NAT flag as well. Here is the AOR<br>
                <br>
              </span>
              *This is the registration part. *<br>
              *<br>
              *<span class=""><br>
                <br>
                setflag(TCP_PERSIST_REGISTRATI<wbr>ONS);<br>
                fix_nated_register();<br>
                setbflag(NAT_BFLAG);<br>
                <br>
                if (!db_check_to()){<br>
                      xlog("L_INFO","$var(prefix) -  Forbidden auth ID
                 \n");<br>
                sl_send_reply("403","Forbidden auth ID");<br>
                exit;<br>
                }<br>
                <br>
                <br>
                mid_registrar_save("location", "mf");<br>
                     switch ($retcode) {<br>
                     case 1:<br>
                         xlog("L_INFO","$var(prefix) -  Registration
                Successfull (Forwarding) \n");<br>
              </span>
                       $ru = "sip:<a href="http://10.101.10.153:5060"
                rel="noreferrer" target="_blank" moz-do-not-send="true">10.101.10.153:5060</a>
              <<a href="http://10.101.10.153:5060" rel="noreferrer"
                target="_blank" moz-do-not-send="true">http://10.101.10.153:5060</a>>";<span
                class=""><br>
                         t_relay();<br>
                         break;<br>
                     case 2:<br>
                         xlog("L_INFO","$var(prefix) -  Registration
                Successfull (absorbing) \n");<br>
                         break;<br>
                     default:<br>
                         xlog("L_INFO","$var(prefix) -  failed to save
                registration! ($$ci=$ci)\n");<br>
                         sl_reply_error();<br>
                         exit;<br>
                     }<br>
                <br>
                <br>
              </span>
              *And here is the lookup part.*<span class=""><br>
                <br>
                if (mid_registrar_lookup("locatio<wbr>n", "m")){<br>
                xlog("L_INFO","$var(prefix) -  Call is for local user
                $rU , forwarding ... \n");<br>
                route(inbound_call);<br>
                }<br>
                <br>
                Domain:: location hash_size=512<br>
              </span>
              *  AOR:: <a href="mailto:agent@gcwregistrar.domain.com"
                target="_blank" moz-do-not-send="true">agent@gcwregistrar.domain.com</a>
              <mailto:<a href="mailto:agent@gcwregistrar.domain.com"
                target="_blank" moz-do-not-send="true">agent@gcwregistrar.dom<wbr>ain.com</a>>*<br>
                               Contact:: <a
                href="mailto:sip%3Abcd9bu7j@192.0.2.37" target="_blank"
                moz-do-not-send="true">sip:bcd9bu7j@192.0.2.37</a>
              <mailto:<a href="mailto:sip%253Abcd9bu7j@192.0.2.37"
                target="_blank" moz-do-not-send="true">sip%3Abcd9bu7j@192.0.2<wbr>.37</a>>;transport=wss
              Q=<span class=""><br>
                                         ContactID:: 1722063907515827933<br>
                                         Expires:: 352<br>
                                         Callid:: 4oqvt7es6ga8pqd8ei7nt0<br>
                                         Cseq:: 193<br>
                                         User-agent:: SIP.js/0.7.8 BB<br>
                                         State:: CS_NEW<br>
                                         Flags:: 0<br>
                                         Cflags:: NAT_BFLAG<br>
              </span>
                                       Socket:: wss:<a
                href="http://10.101.10.151:443" rel="noreferrer"
                target="_blank" moz-do-not-send="true">10.101.10.151:443</a>
              <<a href="http://10.101.10.151:443" rel="noreferrer"
                target="_blank" moz-do-not-send="true">http://10.101.10.151:443</a>><span
                class=""><br>
                                         Methods:: 5439<br>
                                         SIP_instance::
                <urn:uuid:07e6eb5c-2294-42a1-b<wbr>263-a00642b0c277><br>
                <br>
                <br>
                <br>
                I don’t think its related to the mid registrar since I
                tried just using the regular registrar and the same
                thing happens.<br>
                <br>
                Any ideas?<br>
                <br>
                Thanks<br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
                <br>
              </span>
              ______________________________<wbr>_________________<br>
              Users mailing list<br>
              <a href="mailto:Users@lists.opensips.org" target="_blank"
                moz-do-not-send="true">Users@lists.opensips.org</a><br>
              <a
                href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
              <br>
              <span class="HOEnZb"><font color="#888888">
                </font></span></blockquote>
            <span class="HOEnZb"><font color="#888888">
                <br>
                -- <br>
                Răzvan Crainea<br>
                OpenSIPS Core Developer<br>
                  <a href="http://www.opensips-solutions.com"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://www.opensips-solutions.<wbr>com</a><br>
                OpenSIPS Summit 2018<br>
                  <a
                  href="http://www.opensips.org/events/Summit-2018Amsterdam"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://www.opensips.org/events<wbr>/Summit-2018Amsterdam</a><br>
                <br>
                ______________________________<wbr>_________________<br>
                Users mailing list<br>
                <a href="mailto:Users@lists.opensips.org"
                  target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a><br>
                <a
                  href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </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>