<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hello,</p>
<p>thanks for sharing this experience, should be useful for others
searching for similar issues.<br>
</p>
I want to add that you can add the special regexp chars directly
around the $ci, like:<br>
<br>
sht_rm_name_re("calls=>^$ci$$");<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div class="moz-cite-prefix">On 15/11/16 12:14, Grant Bagdasarian
wrote:<br>
</div>
<blockquote
cite="mid:aed3a033909d47f0aec5b020a404a551@CM-EX-V01.cm.local"
type="cite">
<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;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 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]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="NL">Hello Community,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="NL"><o:p> </o:p></span></p>
<p class="MsoNormal">We were facing a weird issue in one of our
Kamailio servers where custom htable entries were removed
which did not belong to a particular call.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Background Information:<o:p></o:p></p>
<p class="MsoNormal">We use htable to store the call-id and a
uuid when an INVITE message is received and remove these
entries when the call is completed/failed (so on CANCEL, BYE,
4XX, 5XX, 6XX, etc).<o:p></o:p></p>
<p class="MsoNormal">In this case the function sht_rm_name_re
was causing incremented call-id’s belonging to different calls
to be removed from the htable, since the removal is based on
regex and not the exact key.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On INVITE we do this:<o:p></o:p></p>
<p class="MsoNormal">$var(reference) = $uuid(g);<o:p></o:p></p>
<p class="MsoNormal">$sht(calls=>$ci) = $ci;<o:p></o:p></p>
<p class="MsoNormal">$sht(calls=>$ci::reference) =
$var(reference);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On BYE/4XX,5XX,6XX, etc we did this:<o:p></o:p></p>
<p class="MsoNormal">sht_rm_name_re("calls=>$ci");<o:p></o:p></p>
<p class="MsoNormal">sht_rm_name_re("calls=>$ci::reference");<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">SIPP generates incremented call-id’s, like
this: <a moz-do-not-send="true" href="mailto:1-14875@1.0.0.1">
1-14875@1.0.0.1</a>. <o:p></o:p></p>
<p class="MsoNormal">When you generate enough calls, for
instance 30 calls, the 21<sup>st</sup> call will have the
call-id
<a moz-do-not-send="true" href="mailto:21-14875@1.0.0.1">21-14875@1.0.0.1</a>.<o:p></o:p></p>
<p class="MsoNormal">If for instance the BYE for the call-id <a
moz-do-not-send="true" href="mailto:1-14875@1.0.0.1">
1-14875@1.0.0.1</a> arrives before <a
moz-do-not-send="true" href="mailto:21-14875@1.0.0.1">21-14875@1.0.0.1</a>
, both htable entries will be removed by the sht_rm_name_re
function, since it matches based on regex.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">To fix this we made sure the function
matches on the exact keys by doing this:<o:p></o:p></p>
<p class="MsoNormal">$var(callid) = '^' + $ci + '$';<o:p></o:p></p>
<p class="MsoNormal">$var(callid_reference) = '^' + $ci +
'::reference' + '$';<o:p></o:p></p>
<p class="MsoNormal">sht_rm_name_re("calls=>$var(callid)");<o:p></o:p></p>
<p class="MsoNormal">sht_rm_name_re("calls=>$var(callid_reference)");<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hope this may help someone in the future
facing the same issue.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Grant Bagdasarian<o:p></o:p></p>
<p class="MsoNormal">CM<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
</body>
</html>