<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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Microsoft YaHei UI";
        panose-1:2 11 5 3 2 2 4 2 2 4;}
@font-face
        {font-family:"\@Microsoft YaHei UI";}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* 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;}
code
        {mso-style-priority:99;
        font-family:"Courier New",serif;}
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;}
@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">please keep the list in CC.
<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">Not sure what you mean by multi-process safe. The functions are safe to use in a kamailio multi-process context, relevant sections should be protected by internal locks etc..<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">Regarding query location manually by SQL client, its better to use the provided functions from the usrloc/registrar module instead.<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>
<div>
<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>
</div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><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> riffs@sina.cn <riffs@sina.cn>
<br>
<b>Sent:</b> Thursday, December 1, 2022 10:47 AM<br>
<b>To:</b> Henning Westerholt <hw@gilawa.com><br>
<b>Subject:</b> Re: Re: [SR-Users] uac_req_send() multi-process synchronization problem<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">To confirm that. Are reg_fetch_contacts and unregister_ruid multi-process safe?<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">
<hr size="1" width="210" style="width:157.5pt" noshade="" style="color:#B5C4DF" align="left">
</span></div>
<div>
<div style="margin-left:7.5pt;margin-top:7.5pt;margin-right:7.5pt;margin-bottom:7.5pt">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><a href="mailto:riffs@sina.cn">riffs@sina.cn</a><o:p></o:p></span></p>
</div>
</div>
</div>
<blockquote style="margin-left:6.0pt;margin-right:inherit">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"> <o:p></o:p></span></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">From:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> <a href="mailto:riffs@sina.cn">riffs@sina.cn</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">Date:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> 2022-12-01 16:35<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">To:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> <a href="mailto:hw@gilawa.com">Henning
 Westerholt</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">Subject:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> Re: RE: [SR-Users]
 uac_req_send() multi-process synchronization problem<o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">Hello <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">Thank you for your reply very much.  My LOCATION is stored in the MYSQL database, and I also set the
</span><code><b><span style="font-size:10.0pt;color:black;background:#EFF8F8">event_callback</span></b></code><strong><span style="font-size:11.5pt;font-family:"Helvetica",sans-serif;color:black;background:#EFF8F8"> parameter of TCPOPS</span></strong><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">.<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">modparam(</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">tcpops</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">event_callback</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">ksr_tcpops_event</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">At the same time.I also deleted the contact inside the function</span><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">function</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">ksr_tcpops_event</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#777777">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">evname</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">)</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">    </span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">local</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">tcpconnid</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">=</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">KSR</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">.pv.</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">get</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">$conid</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">or</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">0</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">       </span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">if</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"> (</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">evname</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">==</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">tcp:reset</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">" or</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">evname</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">==</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">tcp:closed</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">and</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"> (</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">tonumber</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">tcpconnid</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">~=</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#9C5D27">0</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)  </span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">then</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">        </span>
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">local</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">sql</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">=</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">string.format</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">select
 * from location where tcpconnid=%s</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">tcpconnid</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">        </span>
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">local</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">count</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">rows</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">=</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">execute_select</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">sql</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">        </span>
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">if</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">count</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">></span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#9C5D27">0</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">then</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#777777"> </span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">           
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">KSR</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">.registrar.</span><b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">unregister_ruid</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">location</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">rows</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">[</span><span style="font-size:12.0pt;font-family:Consolas;color:#9C5D27">1</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">].contact,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">rows</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">[</span><span style="font-size:12.0pt;font-family:Consolas;color:#9C5D27">1</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">].ruid)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">        </span>
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">end</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">    </span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">end</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#333333">    </span><span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">return</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">
</span><span style="font-size:12.0pt;font-family:Consolas;color:#9C5D27">1</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<span style="font-size:12.0pt;font-family:Consolas;color:#4B69C6">end</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333"><o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">When I use use_req_send(), I use the following sql statement to query location<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;line-height:16.5pt;background:whitesmoke">
<b><span style="font-size:12.0pt;font-family:Consolas;color:#AA3731">string.format</span></b><span style="font-size:12.0pt;font-family:Consolas;color:#333333">(</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#448C27">select
 * from location where username='%s'</span><span style="font-size:12.0pt;font-family:Consolas;color:#777777">"</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">,
</span><span style="font-size:12.0pt;font-family:Consolas;color:#7A3E9D">reciever</span><span style="font-size:12.0pt;font-family:Consolas;color:#333333">)<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">I think because the query sql is executed before the execution of unregister_ruid completes, the location of user A can still
 be queried.<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">If unregister_ruid and reg_fetch_contacts are multi-process safe. I use reg_fetch_contacts query location to avoid this problem. Is
 that so?<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">thanks very much<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black">
<hr size="1" width="210" style="width:157.5pt" noshade="" style="color:#B5C4DF" align="left">
</span></div>
<div>
<div style="margin-left:7.5pt;margin-top:7.5pt;margin-right:7.5pt;margin-bottom:7.5pt">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.0pt;font-family:"Verdana",sans-serif;color:black"><a href="mailto:riffs@sina.cn">riffs@sina.cn</a><o:p></o:p></span></p>
</div>
</div>
</div>
<blockquote style="margin-left:6.0pt;margin-right:inherit">
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:10.5pt;font-family:"Microsoft YaHei UI",sans-serif;color:black"> <o:p></o:p></span></p>
</div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">From:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> <a href="mailto:hw@gilawa.com">Henning
 Westerholt</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">Date:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> 2022-11-30 18:18<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">To:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> <a href="mailto:sr-users@lists.kamailio.org">Kamailio
 (SER) - Users Mailing List</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">CC:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> <a href="mailto:riffs@sina.cn"><span style="font-family:"Microsoft YaHei UI",sans-serif">刘建峰</span></a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;background:#EFEFEF"><b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black">Subject:</span></b><span style="font-size:9.0pt;font-family:"Tahoma",sans-serif;color:black"> RE: [SR-Users] uac_req_send()
 multi-process synchronization problem<o:p></o:p></span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span style="color:black;mso-fareast-language:EN-US">Hello,</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">not sure if I fully understand the problem. But regarding another user is registered with the same IP address as a previous
 user, there are several mitigations.</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">To give two options: you could choose a really short re-registration time, you could use TCP and when you lose the connection
 you delete the contact.</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">Cheers,</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">Henning</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">--
</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">Henning Westerholt –
</span><span style="color:black;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 style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">Kamailio services –
</span><span style="color:black;mso-fareast-language:EN-US"><a href="https://gilawa.com/"><span lang="EN-GB" style="color:#0563C1">https://gilawa.com</span></a></span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><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;text-align:justify"><b><span style="color:black">From:</span></b><span style="color:black"> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org">sr-users-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>???<br>
<b>Sent:</b> Wednesday, November 30, 2022 2:57 AM<br>
<b>To:</b> <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<b>Subject:</b> [SR-Users] uac_req_send() multi-process synchronization problem</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span style="font-size:10.5pt;font-family:DengXian;color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN">When I use uac_req_send() to send a MESSAGE to the client. Will the following occur? The
 result of the message sent to user A is that B has received it. From the logs, the address of user A in the location table is the same as the IP address and port of user B, and the information of user A in the location table is not deleted in time. I took
 the address of user A directly from the location table without using KSR.registrar.reg_fetch_contacts(). If I use KSR.registrar.reg_fetch_contacts() can this be avoided. This is a multi-process synchronization problem, after user A registers, the IP port information
 in the address is 172.16.22.222:12345, and then user A disconnects the link because of some abnormal conditions, but it is not normal to cancel the registration, the socket link has failed, but it has not had time to delete the location, at this time user
 B registers, whether will it get the same IP port information as user A 172.16.22.222 : 12345, if possible? User A's location still exists, Using KSR.registrar.reg_fetch_contacts() TO query user A's location, and then using uac_req_send() to send a message
 to user A, User B will receive the MESSAGE. Whether this problem occurs?</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="ZH-CN" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN">从</span><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN">
 Windows </span><span lang="ZH-CN" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN">版</span><span lang="EN-US" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN"><a href="https://go.microsoft.com/fwlink/?LinkId=550986"><span lang="ZH-CN">邮件</span></a></span><span lang="ZH-CN" style="font-size:10.5pt;font-family:DengXian;color:black;mso-fareast-language:ZH-CN">发送</span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-align:justify"><span lang="EN-US" style="font-size:12.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"> </span><span style="font-size:10.5pt;font-family:DengXian;color:black"><o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</body>
</html>