[SR-Users] Htable sht_rm_name_re usage

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 18 09:30:59 CET 2016


Hello,

thanks for sharing this experience, should be useful for others
searching for similar issues.

I want to add that you can add the special regexp chars directly around
the $ci, like:

sht_rm_name_re("calls=>^$ci$$");

Cheers,
Daniel

On 15/11/16 12:14, Grant Bagdasarian wrote:
>
> Hello Community,
>
>  
>
> 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.
>
>  
>
> Background Information:
>
> 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).
>
> 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.
>
>  
>
> On INVITE we do this:
>
> $var(reference) = $uuid(g);
>
> $sht(calls=>$ci) = $ci;
>
> $sht(calls=>$ci::reference) = $var(reference);
>
>  
>
> On BYE/4XX,5XX,6XX, etc we did this:
>
> sht_rm_name_re("calls=>$ci");
>
> sht_rm_name_re("calls=>$ci::reference");
>
>  
>
> SIPP generates incremented call-id’s, like this: 1-14875 at 1.0.0.1
> <mailto:1-14875 at 1.0.0.1>.
>
> When you generate enough calls, for instance 30 calls, the 21^st call
> will have the call-id 21-14875 at 1.0.0.1 <mailto:21-14875 at 1.0.0.1>.
>
> If for instance the BYE for the call-id 1-14875 at 1.0.0.1
> <mailto:1-14875 at 1.0.0.1> arrives before 21-14875 at 1.0.0.1
> <mailto:21-14875 at 1.0.0.1> , both htable entries will be removed by the
> sht_rm_name_re function, since it matches based on regex.
>
>  
>
> To fix this we made sure the function matches on the exact keys by
> doing this:
>
> $var(callid) = '^' + $ci + '$';
>
> $var(callid_reference) = '^' + $ci + '::reference' + '$';
>
> sht_rm_name_re("calls=>$var(callid)");
>
> sht_rm_name_re("calls=>$var(callid_reference)");
>
>  
>
> Hope this may help someone in the future facing the same issue.
>
>  
>
> Regards,
>
>  
>
> Grant Bagdasarian
>
> CM
>
>  
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161118/6b342383/attachment.html>


More information about the sr-users mailing list