<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
/* Style Definitions */
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;}
span.E-MailFormatvorlage19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
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]-->
</head>
<body lang="DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">it should sync the existing records on startup, in fact it even logs some messages related to that.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Maybe just give a more recent version a try, e.g. one of the later 5.5.x releases.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">-- <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Henning Westerholt –
</span><span style="mso-fareast-language:EN-US"><a href="https://skalatan.de/blog/"><span lang="EN-GB" style="color:#0563C1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Kamailio services –
</span><span style="mso-fareast-language:EN-US"><a href="https://gilawa.com/"><span lang="EN-GB" style="color:#0563C1">https://gilawa.com</span></a></span><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<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 <sr-users-bounces@lists.kamailio.org>
<b>On Behalf Of </b>Benedito Marques<br>
<b>Sent:</b> Thursday, July 21, 2022 8:37 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Subject:</b> [SR-Users] Cannot load usrloc table at startup using DMQ_USRLOC sync feature<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I have an scenario with two kamailios, and no databases. At the first, I authenticate one subscriber successfully and save in memory usrloc:<br>
<br>
<br>
/etc/kamailio # kamailio --version<br>
version: kamailio 5.4.4 (x86_64/linux)<br>
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST,
HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED<br>
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: unknown<br>
compiled on 16:13:18 Feb 15 2021 with gcc 9.3.0<br>
/etc/kamailio #<br>
/etc/kamailio #<br>
<br>
---<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><br>
/etc/kamailio # cat /etc/os-release<br>
NAME="Alpine Linux"<br>
ID=alpine<br>
VERSION_ID=3.12.3<br>
PRETTY_NAME="Alpine Linux v3.12"<br>
HOME_URL="<a href="https://alpinelinux.org/">https://alpinelinux.org/</a>"<br>
BUG_REPORT_URL="<a href="https://bugs.alpinelinux.org/">https://bugs.alpinelinux.org/</a>"<br>
<br>
---<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><br>
# Handle SIP registrations<br>
route[REGISTRAR] {<br>
if (!is_method("REGISTER")) return;<br>
<br>
if (!save("location","0x05")) {<br>
sl_reply_error();<br>
}<br>
exit;<br>
}<br>
<br>
<br>
--<br>
<br>
<br>
/etc/kamailio # kamcmd ul.dump<br>
{<br>
Domains: {<br>
Domain: {<br>
Domain: location<br>
Size: 1024<br>
AoRs: {<br>
Info: {<br>
AoR: <a href="mailto:1014@my.domain">1014@my.domain</a><br>
HashID: -1989102610<br>
Contacts: {<br>
Contact: {<br>
Address: <a href="sip:1014@10.0.0.2:7071;ob">
sip:1014@10.0.0.2:7071;ob</a><br>
Expires: 299<br>
Q: -1.000000<br>
Call-ID: d5cf6d5f293647a59ba64ba996a793b0<br>
CSeq: 43689<br>
User-Agent: MicroSIP/3.20.7<br>
Received: sip:<a href="http://10.0.0.2:7071">10.0.0.2:7071</a><br>
Path: [not set]<br>
State: CS_NEW<br>
Flags: 1<br>
CFlags: 0<br>
Socket: [not set]<br>
Methods: 8159<br>
Ruid: uloc-62d95ca2-3c-1<br>
Instance: [not set]<br>
Reg-Id: 0<br>
Server-Id: 0<br>
Tcpconn-Id: -1<br>
Keepalive: 0<br>
Last-Keepalive: 1658412252<br>
KA-Roundtrip: 0<br>
Last-Modified: 1658412252<br>
}<br>
}<br>
}<br>
}<br>
Stats: {<br>
Records: 1<br>
Max-Slots: 1<br>
}<br>
}<br>
}<br>
}<br>
/etc/kamailio # <br>
<br>
<br>
<br>
<b>The problem is</b>: when I start the second kamailio server, the current usrloc users are not replicated to it, so in the second server the usrloc is empty:<br>
<br>
<br>
<br>
/etc/kamailio # kamcmd ul.dump<br>
{<br>
Domains: {<br>
Domain: {<br>
Domain: location<br>
Size: 1024<br>
AoRs: {<br>
}<br>
Stats: {<br>
Records: 0<br>
Max-Slots: 0<br>
}<br>
}<br>
}<br>
}<br>
<br>
<br>
<br>
<b>The modules loaded:</b><br>
<br>
- dmq.so<br>
- dmq_usrloc.so<br>
<br>
<b>Params (sync enabled):</b><br>
<br>
modparam("dmq_usrloc", "enable", 1)<br>
modparam("dmq_usrloc", "sync", 1)<br>
modparam("dmq_usrloc", "usrloc_domain", "location")<br>
modparam("dmq_usrloc", "usrloc_delete", 1)<br>
modparam("dmq_usrloc", "replicate_socket_info", 0)<br>
<br>
<br>
<b>Obs</b>: The DMQ replication is working perfectly. So, if I register another user in server 1, server 2 receives the KDMQ message and the new user appears on usrloc. The real problem is to load pre registered users at startup.<br>
<br>
<b>Log messages from second server at startup:</b><br>
<br>
<br>
0(51) DEBUG: <core> [core/sr_module.c:873]: init_mod(): dmq_usrloc<br>
0(51) INFO: dmq_usrloc [dmq_usrloc.c:81]: mod_init(): dmq usrloc replication mode = 1<br>
0(51) DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <ul_bind_usrloc> in module usrloc [/usr/lib/kamailio/modules/usrloc.so]<br>
0(51) DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <bind_dmq> in module dmq [/usr/lib/kamailio/modules/dmq.so]<br>
0(51) DEBUG: dmq_usrloc [usrloc_sync.c:286]: usrloc_dmq_initialize(): loaded dmq api<br>
0(51) DEBUG: dmq_usrloc [usrloc_sync.c:299]: usrloc_dmq_initialize(): dmq peer registered<br>
0(51) DEBUG: dmq_usrloc [dmq_usrloc.c:111]: mod_init(): dmq_usrloc initialized<br>
<br>
0(51) DEBUG: <core> [core/sr_module.c:804]: init_mod_child(): idx 0 rank -127: dmq_usrloc [main]<br>
0(51) DEBUG: dmq_usrloc [dmq_usrloc.c:127]: child_init(): child_init PROC_INIT<br>
<br>
7(62) DEBUG: dmq_usrloc [usrloc_sync.c:552]: usrloc_dmq_request_sync(): requesting sync from dmq peers<br>
0(51) DEBUG: <core> [core/sr_module.c:804]: init_mod_child(): idx 0 rank 0: dialog [main]<br>
7(62) DEBUG: dmq_usrloc [usrloc_sync.c:568]: usrloc_dmq_request_sync(): sending serialized data {"action":3}<br>
7(62) DEBUG: dmq_usrloc [usrloc_sync.c:317]: usrloc_dmq_send(): sending dmq broadcast...<br>
<br>
7(62) DEBUG: dmq [dmq_funcs.c:166]: bcast_dmq_message1(): skipping node sip:<a href="http://10.0.2.38:5090">10.0.2.38:5090</a><br>
7(62) DEBUG: dmq [dmq_funcs.c:166]: bcast_dmq_message1(): skipping node sip:<a href="http://10.0.2.30:5090">10.0.2.30:5090</a><br>
7(62) DEBUG: dmq [dmq_funcs.c:166]: bcast_dmq_message1(): skipping node sip:<a href="http://0.0.0.0:5090">0.0.0.0:5090</a><br>
<br>
<br>
<br>
<br>
<b>List nodes at SERVER 1:</b><br>
<br>
<br>
/etc/kamailio # kamcmd dmq.list_nodes<br>
{<br>
host: 10.0.1.36<br>
port: 5090<br>
resolved_ip: 10.0.1.36<br>
status: active<br>
last_notification: 0<br>
local: 0<br>
}<br>
{<br>
host: 10.0.1.35<br>
port: 5090<br>
resolved_ip: 10.0.1.35<br>
status: active<br>
last_notification: 0<br>
local: 0<br>
}<br>
{<br>
host: 0.0.0.0<br>
port: 5090<br>
resolved_ip: 0.0.0.0<br>
status: active<br>
last_notification: 0<br>
local: 1<br>
}<br>
<br>
<br>
<br>
<b>List nodes at SERVER 2:</b><br>
<br>
<br>
/etc/kamailio # kamcmd dmq.list_nodes<br>
{<br>
host: 10.0.1.35<br>
port: 5090<br>
resolved_ip: 10.0.1.35<br>
status: active<br>
last_notification: 0<br>
local: 0<br>
}<br>
{<br>
host: 10.0.1.36<br>
port: 5090<br>
resolved_ip: 10.0.1.36<br>
status: active<br>
last_notification: 0<br>
local: 0<br>
}<br>
{<br>
host: 0.0.0.0<br>
port: 5090<br>
resolved_ip: 0.0.0.0<br>
status: active<br>
last_notification: 0<br>
local: 1<br>
}<br>
<br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt">-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black;background:white"><br>
</span><span style="font-size:10.0pt;font-family:"Times New Roman",serif;color:black;background:white">Att,<br>
Benedito Marques</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>