Hi, based on Daniels example from:
http://blog.miconda.eu/2010/01/best-of-new-in-kamailio-300-19-htable.html
...
modparam("htable", "htable", "acalls=>size=8;")
...
route {
...
if(is_method("INVITE") && !has_totag())
{
# a new call
if($shtcv(ht=>^$fU$)>=3)
{
send_reply("403", "limit exceeded");
exit;
}
$sht(acalls=>$ci) = $fU;
t_on_failure("NEW_INVITE");
}
if(is_method("BYE"))
{
$sht(acalls=>$ci) = $null;
}
...
}
failure_route[NEW_INVITE] {
$sht(acalls=>$ci) = $null;
}
I use this htable variant to share data between two dialogs (store Contact
from one dialog, and re-write other R-URI with it). Referenced by call-id:
...
$avp(referenceID) = $ci + "-" + $avp(direction);
$sht(a=>$avp(referenceID)) = $ct;
...
...
$avp(referenceID) = $ci + "-" + $avp(direction);
avp(newru) = $sht(a=>$avp(referenceID));
avp_subst("$avp(newru)", "/(<)(.*)(>)/\2/");
xlog("L_NOTICE", ">>>>>>>> ReWrite ru
with:$avp(newru)\n");
$ru = $avp(newru);
...
Is this the best method to share data between two dialogs? Because you have
to take
care yourself with failure_route and so on, to free (set back to $null)
them. Or is there
a more elegant way for that task?
Best
Kristijan