[SR-Users] Problem with callid as htable key

jenus at cyberchaos.nl jenus at cyberchaos.nl
Tue Oct 16 09:47:43 CEST 2018


Hello,

I'm running kamailio 5.1.4 and running into a issue with htable. I use 
it to store some dialog data so i can use it in a http route. When i use 
the callid as a key it creates a issue for callid's starting with eq. 
Here some example code that i use to reproduce the issue:


modparam("htable", "htable", "ht_test=>size=16;autoexpire=10")

$var(htable-val) = $_s($dlg(h_entry)) + "::" + $_s($dlg(h_id)) + "::" + 
$Ts;
xlog("L_WARN", "HT_TEST: Adding $var(htable-val) to ht_test with key 
eq1234");
$var(htid) = "eq1234";
$sht(ht_test=>$var(htid)) =  $var(htable-val);
$var(htable-val) = $null;

if ($shtcn(ht_test=>$var(htid)) > 0)
{
        xlog("L_WARN", "HT_TEST: Key eq1234 found!");
} else {
        xlog("L_WARN", "HT_TEST: Key eq1234 NOT found!");
}
$var(htid) = $null;

Results in :

Oct 16 09:36:31 sip03 /usr/sbin/kamailio[22344]: WARNING: <script>: 
HT_TEST: Adding 531::926::1539675391 to ht_test with key eq1234
Oct 16 09:36:31 sip03 /usr/sbin/kamailio[22344]: WARNING: <script>: 
HT_TEST: Key eq1234 NOT found!


When i prefix eq with a 1 it works fine:

modparam("htable", "htable", "ht_test=>size=16;autoexpire=10")

$var(htable-val) = $_s($dlg(h_entry)) + "::" + $_s($dlg(h_id)) + "::" + 
$Ts;
xlog("L_WARN", "HT_TEST: Adding $var(htable-val) to ht_test with key 
eq1234");
$var(htid) = "1eq1234";
$sht(ht_test=>$var(htid)) =  $var(htable-val);
$var(htable-val) = $null;

if ($shtcn(ht_test=>$var(htid)) > 0)
{
        xlog("L_WARN", "HT_TEST: Key eq1234 found!");
} else {
        xlog("L_WARN", "HT_TEST: Key eq1234 NOT found!");
}
$var(htid) = $null;

Results in:

Oct 16 09:37:25 sip03 /usr/sbin/kamailio[22555]: WARNING: <script>: 
HT_TEST: Adding 3050::1098::1539675445 to ht_test with key eq1234
Oct 16 09:37:25 sip03 /usr/sbin/kamailio[22555]: WARNING: <script>: 
HT_TEST: Key eq1234 found!


Am i running into a bug? Or are there some restrictions on the key's i 
can use? I'm still going trough the logs to check if there are more 
callid's that have a issue with matching.


Thanks,

Jan Hazenberg



More information about the sr-users mailing list