<div dir="ltr">I don't know if anyone has had a chance to look at my problem but I wonder if at least I could get an opinion on the following:<div><br></div><div>1 - Should I be seeing the path saved in the appropriate column in the "location" table?<br></div><div>2 - Am I using mid_registrar_save() and mid_registrar_lookup() with path support correctly in my script?<br></div><div>3 - have I correctly understood how to combine WebRTC with mid-registrar module, path, and AOR throttling so that it should work for calls originating from the main registrar?</div><div><br></div><div>I'm stuck on how to move forward with this</div><div><br></div><div>Cheers,</div><div><br></div><div>Mark</div><div><br></div><div><div>Relevant code snippets...</div><div><br></div><div><font face="monospace">loadmodule "mid_registrar.so"<br>modparam("mid_registrar", "mode", 2) /* 0 = mirror / 1 = ct / 2 = AoR */<br>modparam("mid_registrar", "outgoing_expires", 3600)<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">add_path_received();<br>$avp(returncode) = mid_registrar_save("location","p0v");<br>switch ($avp(returncode)) {<br>    case 1:<br>        route(resolve_registrar);<br>        $ru = "sip:" + $avp(main_registrar) + ":5060";<br>        t_on_failure("1");<br>        t_relay();<br>        break;<br>    case 2:<br>        break;<br>    default:<br>}<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">if (!mid_registrar_lookup("location")) {<br>    t_reply(404, "Not Found");<br>    exit;<br>}</font><br></div><div><br></div><div><br></div><div>NB - route(resolve_registrar) sets the variable $avp(main_registrar) to the IP address of the Asterisk server</div></div><div></div><div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 Jul 2020 at 09:16, Mark Allen <<a href="mailto:mark@allenclan.co.uk">mark@allenclan.co.uk</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>We are working on a test setup, hoping to move to a production system in mid-August. We want to use mid-registrar AOR throttling. Users will connect through OpenSIPS using a combination of SIP and WebRTC endpoints, registering to an extension on an Asterisk main-registrar...<br></div><div><br></div><div><font face="monospace">              +----------+ </font></div><div><font face="monospace"><SIP>    ---> |         </font><span style="font-family:monospace"> |      </span><span style="font-family:monospace">+----------+  </span></div><div><font face="monospace"><SIP>    ---> | OpenSIPS | ---> | Asterisk |</font></div><div><font face="monospace"><WebRTC> ---> |          |      +----------+  </font></div><div><font face="monospace">              +----------+</font></div><div><div><br></div><div>Multiple SIP phones (hardware or softphones) registering via an OpenSIPS 3.1 mid_registration AOR is working fine. A call to the extension number on Asterisk results in all mid-registered SIP extensions ringing and when one answers, the other devices register a missed call. So far, so good.</div></div><div><br></div><div>With 3.0 - we had a problem with WebRTC "phones" (even when just using mid_registrar in "mirroring" mode). Webphone could register and call other phones without a problem. However, calls to the WebPhone failed - there was a problem with the WebSocket addressing giving "476 Unresolvable destination" when the call originates from the main registrar - e.g. one extension calling another. The /var/log/syslog entry said...</div><div><br></div><div><font face="monospace">  ERROR:core:sip_resolvehost: forced proto 6 not matching sips uri<br>  CRITICAL:core:mk_proxy: could not resolve hostname: "4xp44jxl0qq0.invalid"<br>  ERROR:tm:uri2proxy: bad host name in URI <sips:11001 at 4xp44jxl0qq0.invalid;rtcweb-breaker=yes;transport=wss><br>  ERROR:tm:t_forward_nonack: failure to add branches</font><br></div><div><br></div><div>Stas Kobar gave me a way to resolve this  - <a href="http://lists.opensips.org/pipermail/users/2020-July/043443.html" target="_blank">http://lists.opensips.org/pipermail/users/2020-July/043443.html</a>  As we were using 3.0, I used the "path" module and  "add_path_received()" to handle this for WebRTC. This worked for a single device registered to an address. However, as far as I could see, using "path" effectively bypassed the "contact" address held in the OpenSIPS "location" table so it didn't work for AOR throttling.</div><div><br></div><div>I was hoping that, with mid_registrar on 3.1 baking in path support, I could just use "mid_registrar_save('location','p0v')" to store the WebRTC destination path in the "location" table. Then, with a call to the WebRTC endpoint from the main registrar, "mid_registrar_lookup('location')" would use the stored path from the "location" table to send traffic on to the WebRTC phone and it would work fine with AOR throttling. However, that's not happening, and looking at the "location" table, no path seems to be being stored.</div><div><br></div><div>If I register a WebRTC "phone" first, the path is included on the registration SIP message sent from OpenSIPS to Asterisk. If I then register additional SIP phones on OpenSIPS, AOR throttling works, because, when the call originates from Asterisk it includes the "route" HF that points to the WebRTC destination. However, if a SIP phone registers first, Asterisk doesn't get the WebRTC path, so calls fail to reach the WebRTC destination because it tries to use the first registered SIP phone's path.</div><div><br></div><div>So - 2 questions really...<br></div><div><br></div><div>1 - Can I use AOR throttling with WebRTC (I can't guarantee that the WebRTC endpoint will be the first to register or that there will only be one WebRTC endpoint)</div><div><br></div><div>2 - If the answer to 1 is yes, what am I doing wrong?</div><div><br></div><div>Relevant code snippets...</div><div><br></div><div><font face="monospace">loadmodule "mid_registrar.so"<br>modparam("mid_registrar", "mode", 2) /* 0 = mirror / 1 = ct / 2 = AoR */<br>modparam("mid_registrar", "outgoing_expires", 3600)<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">add_path_received();<br>$avp(returncode) = mid_registrar_save("location","p0v");<br>switch ($avp(returncode)) {<br>    case 1:<br>        route(resolve_registrar);<br>        $ru = "sip:" + $avp(main_registrar) + ":5060";<br>        t_on_failure("1");<br>        t_relay();<br>        break;<br>    case 2:<br>        break;<br>    default:<br>}<br></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">if (!mid_registrar_lookup("location")) {<br>    t_reply(404, "Not Found");<br>    exit;<br>}</font><br></div><div><br></div><div><br></div><div>NB - route(resolve_registrar) sets the variable $avp(main_registrar) to the IP address of the Asterisk server</div></div>
</blockquote></div>