<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font size="-1">So, my final configuration is:</font></p>
<p><font size="-1">One domain with AWS Route53 same weight
configuration: 50% server1 and 50% server2</font></p>
<p><font size="-1">The user register over the domain.<br>
</font></p>
<p><font size="-1">Two Kamailio Servers with DMQ and DMQ_USRLOC
modules configured; 1.2.3.4 first server IP and 5.6.7.8 second
server IP<br>
</font></p>
<p><font size="-1">Most important configurations <b>Server1</b>:</font></p>
<p><i><b><font size="-1">listen=udp:1.2.3.4:5060<br>
listen=udp:1.2.3.4:5222</font></b></i></p>
<p><i><b><font size="-1"># ---- dmq params ----<br>
modparam("dmq", "server_address", <a class="moz-txt-link-rfc2396E" href="sip:1.2.3.4">"sip:1.2.3.4"</a>)<br>
modparam("dmq", "notification_address", <a class="moz-txt-link-rfc2396E" href="sip:5.6.7.8">"sip:5.6.7.8"</a>)<br>
modparam("dmq", "multi_notify", 0)<br>
modparam("dmq", "num_workers", 4)<br>
modparam("dmq", "ping_interval", 30)<br>
<br>
# ---- dmq_usrloc params ----<br>
modparam("dmq_usrloc", "enable", 1)<br>
modparam("dmq_usrloc", "sync", 1)<br>
modparam("dmq_usrloc", "batch_size", 10)<br>
modparam("dmq_usrloc", "batch_usleep", 1000)<br>
modparam("dmq_usrloc", "batch_msg_size", 60000)<br>
modparam("dmq_usrloc", "batch_msg_contacts", 50)<br>
modparam("dmq_usrloc", "usrloc_domain", "location")<br>
modparam("dmq_usrloc", "replicate_socket_info", 0)<br>
modparam("dmq_usrloc", "usrloc_delete", 1)</font></b></i></p>
<p><font size="-1">before the block begin with:</font></p>
<p><i><b><font size="-1">$avp(oexten) = $rU;<br>
if (!lookup("location")) {</font></b></i></p>
<p><font size="-1">I put<br>
</font></p>
<p><font size="-1"><i><b>if (!dmq_is_from_node()) {</b></i><i><b><br>
</b></i><i><b>
if(reg_fetch_contacts("location", "$ru", "contacto")) {</b></i><i><b><br>
</b></i><i><b>
if($(ulc(contacto=>socket))) == 0 {</b></i><i><b><br>
</b></i><i><b>
rewritehost("5.6.7.8");</b></i><i><b><br>
</b></i><i><b> }</b></i><i><b><br>
</b></i><i><b> route(RELAY);</b></i><i><b><br>
</b></i><i><b> }</b></i><i><b><br>
</b></i><i><b> }</b></i><br>
</font></p>
<p><font size="-1">If the socket value is null (0) means the user is
registered on the second Kamailio so send INVITE to second
Kamailio</font></p>
<p><font size="-1"><i><b>route[AUTH] {</b></i><i><b><br>
</b></i><i><b>#!ifdef WITH_AUTH</b></i><i><b><br>
</b></i><i><b><br>
</b></i><i><b>if (dmq_is_from_node()) {</b></i><i><b><br>
</b></i><i><b> $ru = $tu;</b></i><i><b><br>
</b></i><i><b>return;</b></i><i><b><br>
</b></i><i><b>}</b></i><br>
</font></p>
<p><font size="-1">If INVITE comes from other DMQ node don't need
authentication but I have to change RURI with To URI because I
work in a multidomain setting and I'm using the does_uri_exist
function to know if the request is local or not.</font></p>
<p><font size="-1"><b>Server2</b>:</font></p>
<p><i><b><font size="-1">listen=udp:5.6.7.8:5060<br>
listen=udp:5.6.7.8:5222</font></b></i></p>
<i><b>
</b></i>
<p><i><b><font size="-1"># ---- dmq params ----<br>
modparam("dmq", "server_address", <a class="moz-txt-link-rfc2396E" href="sip:5.6.7.8">"sip:5.6.7.8"</a>)<br>
modparam("dmq", "notification_address", <a class="moz-txt-link-rfc2396E" href="sip:1.2.3.4">"sip:1.2.3.4"</a>)<br>
modparam("dmq", "multi_notify", 0)<br>
modparam("dmq", "num_workers", 4)<br>
modparam("dmq", "ping_interval", 30)<br>
<br>
# ---- dmq_usrloc params ----<br>
modparam("dmq_usrloc", "enable", 1)<br>
modparam("dmq_usrloc", "sync", 1)<br>
modparam("dmq_usrloc", "batch_size", 10)<br>
modparam("dmq_usrloc", "batch_usleep", 1000)<br>
modparam("dmq_usrloc", "batch_msg_size", 60000)<br>
modparam("dmq_usrloc", "batch_msg_contacts", 50)<br>
modparam("dmq_usrloc", "usrloc_domain", "location")<br>
modparam("dmq_usrloc", "replicate_socket_info", 0)<br>
modparam("dmq_usrloc", "usrloc_delete", 1)</font></b></i></p>
<p><font size="-1">before the block begin with:</font></p>
<p><i><b><font size="-1">$avp(oexten) = $rU;<br>
if (!lookup("location")) {</font></b></i></p>
<i><b>
</b></i>
<p><font size="-1"><i><b>if (!dmq_is_from_node()) {</b></i><i><b><br>
</b></i><i><b>
if(reg_fetch_contacts("location", "$ru",
"contacto")) {</b></i><i><b><br>
</b></i><i><b>
if($(ulc(contacto=>socket))) == 0
{</b></i><i><b><br>
</b></i><i><b>
rewritehost("1.2.3.4");</b></i><i><b><br>
</b></i><i><b>
}</b></i><i><b><br>
</b></i><i><b>
route(RELAY);</b></i><i><b><br>
</b></i><i><b>
}</b></i><i><b><br>
</b></i><i><b>
}</b></i><br>
</font></p>
<p><font size="-1">If the socket value is null (0) means the user is
registered on the first Kamailio so send INVITE to first
Kamailio</font></p>
<p><i><b><font size="-1">route[AUTH] {<br>
#!ifdef WITH_AUTH<br>
<br>
if (dmq_is_from_node()) {<br>
$ru = $tu;<br>
return;<br>
}</font></b></i></p>
<p><font size="-1"><font size="-1">If INVITE comes from other DMQ
node don't need authentication but I have to change RURI with
To URI because I work in a multidomain setting and I'm using
the does_uri_exist function to know if the request is local or
not.</font></font></p>
<p><font size="-1"><font size="-1">LIMITATIONS:<br>
</font></font></p>
<ul>
<li>works only with a device for user. If a user registered from
two o more devices I don't know how achieve the same behavior<br>
</li>
<li>works with Two Kamailio due to rewritehost function...</li>
<li>maybe the routing can be better<br>
</li>
</ul>
<p>Regards<br>
</p>
<pre class="moz-signature" cols="72">---
I'm SoCIaL, MayBe</pre>
<div class="moz-cite-prefix">El 31/07/2021 a las 5:23 a. m., Henning
Westerholt escribió:<br>
</div>
<blockquote type="cite"
cite="mid:PAXPR05MB8558D7682340D9259A58DCBAC5ED9@PAXPR05MB8558.eurprd05.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}pre
{mso-style-priority:99;
mso-style-link:"HTML Vorformatiert Zchn";
margin:0cm;
font-size:10.0pt;
font-family:"Courier New";}span.HTMLVorformatiertZchn
{mso-style-name:"HTML Vorformatiert Zchn";
mso-style-priority:99;
mso-style-link:"HTML Vorformatiert";
font-family:Consolas;}span.E-MailFormatvorlage22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"
lang="EN-GB">Great, thanks for the confirmation.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"
lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"
lang="EN-GB">Henning<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"
lang="EN-GB"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b>
sr-users <a class="moz-txt-link-rfc2396E" href="mailto:sr-users-bounces@lists.kamailio.org"><sr-users-bounces@lists.kamailio.org></a>
<b>On Behalf Of </b>Social Boh<br>
<b>Sent:</b> Friday, July 30, 2021 8:36 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.kamailio.org"><sr-users@lists.kamailio.org></a><br>
<b>Subject:</b> Re: [SR-Users] Access via script to
location data in the memory<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<p style="margin-left:35.4pt"><span style="font-size:10.0pt">Works!</span><o:p></o:p></p>
<p style="margin-left:35.4pt"><span style="font-size:10.0pt">I
can access location data presents only in the memory. Now,
next step is using $(ulc(contacto=>socket)) to decide
which Kamailio have to process the call.</span><o:p></o:p></p>
<p style="margin-left:35.4pt"><span style="font-size:10.0pt">Thank
you</span><o:p></o:p></p>
<pre style="margin-left:35.4pt">---<o:p></o:p></pre>
<pre style="margin-left:35.4pt">I'm SoCIaL, MayBe<o:p></o:p></pre>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">El 30/07/2021
a las 11:51 a. m., Henning Westerholt escribió:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Hi,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">just
quickly looked in the registrar code, it uses the standard
usrloc functions to get data from memory or database.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Maybe just
give it a try, I think it should work also in
in-memory/dmq mode.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Cheers,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Henning</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:70.8pt"><b>From:</b>
sr-users <a
href="mailto:sr-users-bounces@lists.kamailio.org"
moz-do-not-send="true">
<sr-users-bounces@lists.kamailio.org></a> <b>On
Behalf Of </b>Social Boh<br>
<b>Sent:</b> Friday, July 30, 2021 6:42 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <a
href="mailto:sr-users@lists.kamailio.org"
moz-do-not-send="true">
<sr-users@lists.kamailio.org></a><br>
<b>Subject:</b> Re: [SR-Users] Access via script to
location data in the memory<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:70.8pt"> <o:p></o:p></p>
<p style="margin-left:70.8pt"><span style="font-size:10.0pt">Hello,</span><o:p></o:p></p>
<p style="margin-left:70.8pt"><span style="font-size:10.0pt">reg_fetch_contacts
use a table (I understood) to looking for data about a
user.
</span><o:p></o:p></p>
<p style="margin-left:70.8pt"><span style="font-size:10.0pt">I'm
using USRLOC module without database.</span><o:p></o:p></p>
<p style="margin-left:70.8pt"><span style="font-size:10.0pt">Regards</span><o:p></o:p></p>
<p style="margin-left:70.8pt"> <o:p></o:p></p>
<pre style="margin-left:70.8pt">---<o:p></o:p></pre>
<pre style="margin-left:70.8pt">I'm SoCIaL, MayBe<o:p></o:p></pre>
<div>
<p class="MsoNormal" style="margin-left:70.8pt">El
30/07/2021 a las 11:18 a. m., Henning Westerholt escribió:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US">Hello,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">have you
looked to the reg_fetch_contact as already pointed out?
Then you can access e.g. the socket with the $ulc PV,
see the end of the registrar docs for an example.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Cheers,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Henning</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">--
</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Henning
Westerholt –
</span><span style="mso-fareast-language:EN-US"><a
href="https://skalatan.de/blog/"
moz-do-not-send="true"><span style="color:#0563C1"
lang="EN-GB">https://skalatan.de/blog/</span></a></span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB">Kamailio
services –
</span><span style="mso-fareast-language:EN-US"><a
href="https://gilawa.com/" moz-do-not-send="true"><span
style="color:#0563C1" lang="EN-GB">https://gilawa.com</span></a>
</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:70.8pt"><span
style="mso-fareast-language:EN-US" lang="EN-GB"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:106.2pt"><b>From:</b>
sr-users <a
href="mailto:sr-users-bounces@lists.kamailio.org"
moz-do-not-send="true">
<sr-users-bounces@lists.kamailio.org></a> <b>On
Behalf Of </b>Social Boh<br>
<b>Sent:</b> Friday, July 30, 2021 6:11 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <a
href="mailto:sr-users@lists.kamailio.org"
moz-do-not-send="true">
<sr-users@lists.kamailio.org></a><br>
<b>Subject:</b> Re: [SR-Users] Access via script to
location data in the memory<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:106.2pt"> <o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">Hello,</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">maybe is better I explain what
I'd like to achieve:</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">I have two Kamailio using DMQ
and DMQ_USRLOC modules so each REGISTER is replicate on
each Kamailio. I'm using DNS weight to distribute the
REGISTERs between the 2 Kamailios.</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">The only difference I have seen
in the location data, with
<b>kamctl ul show</b> command, is the Kamailio receives
REGISTER have socket parameter with transport, ip, y
port like udp:1.2.3.4:5060 where 1.2.3.4 is Kamailio
public IP; the other Kamailio have this field empty.</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">When a call arrive to one
Kamailio, querying the Socket field I can known if I
have to send the INVITE locally or forward the INVITE to
second Kamailio.</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">I don't know if there is other
way to achieve this goal.
</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">I think PATH protocol not apply
here because If I reply the REGISTER to the second
Kamailio adding path header, I don't need DMQ_USRLOC.</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">The idea is to take advantage
of using these DMQ related modules.</span><o:p></o:p></p>
<p style="margin-left:106.2pt"><span
style="font-size:10.0pt">Regards</span><o:p></o:p></p>
<pre style="margin-left:106.2pt">---<o:p></o:p></pre>
<pre style="margin-left:106.2pt">I'm SoCIaL, MayBe<o:p></o:p></pre>
<div>
<p class="MsoNormal" style="margin-left:106.2pt">El
29/07/2021 a las 5:16 p. m., Henning Westerholt
escribió:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre style="margin-left:106.2pt">Hello,<o:p></o:p></pre>
<pre style="margin-left:106.2pt"> <o:p></o:p></pre>
<pre style="margin-left:106.2pt">There are different functions in the registrar module, check them out: <a href="https://kamailio.org/docs/modules/devel/modules/registrar.html#idm576" moz-do-not-send="true">https://kamailio.org/docs/modules/devel/modules/registrar.html#idm576</a><o:p></o:p></pre>
<pre style="margin-left:106.2pt"> <o:p></o:p></pre>
<pre style="margin-left:106.2pt">reg_fetch_contacts(..) might be something you could use.<o:p></o:p></pre>
<pre style="margin-left:106.2pt"> <o:p></o:p></pre>
<pre style="margin-left:106.2pt">Cheers,<o:p></o:p></pre>
<pre style="margin-left:106.2pt"> <o:p></o:p></pre>
<pre style="margin-left:106.2pt">Henning<o:p></o:p></pre>
<pre style="margin-left:106.2pt"> <o:p></o:p></pre>
</blockquote>
</blockquote>
</blockquote>
</div>
</blockquote>
</body>
</html>