Hi Daniel,
I am setting the htable as follows:
modparam("htable", "htable",
"message_counters=>size=10;autoexpire=10;initval=0;updateexpire=0;")
* autoexpire=10 to have items expire after 10 seconds (in this example) * updateexpire=0 to force the expiration no matter the items were updated or not
Yet, I can see the values persist.
Another concern is that, if I specify a number of child processes in my config (e.g. children=4), then will it be safe to increment the hash table entries in the route block upon receipt of messages? i.e will the table entries that reside in the shared memory be precise? or do I need to lock/unlock them while updating?
Thanks Alireza
On Wed, Aug 13, 2014 at 4:07 AM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Look at the definition of htable parameter, there you have various ways to set expires for each item in hash table.
Cheers, Daniel
On 13/08/14 05:26, AliReza Khoshgoftar Monfared wrote:
Thanks Alex,
This is exactly the module I needed. Now just another small usage question. How can I reset the value of all entries in my hash table to 0 every, say "10" seconds?
Here is what I tried, but the values seem to persist:
Option 1) in the parameter definition set "initval" to 0 (to have all items 0 initially), "autoexpire" to "10" seconds and "updateexpire" to 0 (to force expiration upon the end of 10 seconds)
Option 2) Create a fake route block executed every 10 seconds (using "rtimer" module), and call "sht_rm_value_re("ha=>.*")" inside it.
None of these seem to be resetting "all" of my entries in the hash table to 0, in fact, I can see that the values persist and continue increment (as I increment them upon receipt of messages). Am I missing sth here?
Thanks Alireza
On Tue, Aug 12, 2014 at 3:58 PM, Alex Balashov abalashov@evaristesys.com wrote:
On 08/12/2014 03:56 PM, AliReza Khoshgoftar Monfared wrote:
Hi List,
I am trying to keep a counter for number of messages received per source ip in my kamailio script.
The basic challenge is to keep this data in a neat structure. Ideally, I want some array with keys named after source IP addresses,
sth like number_of_messages["10.10.10.10"] = 23
Of course, this data structure shall be script-persistent (as opposed to transaction persistent)
Is there any suggestion to do this? (keep a record of # of messages received from each source IP address and log them)?
It sounds to me like you're looking for:
http://kamailio.org/docs/modules/4.1.x/modules/htable.html
The hash tables reside in shared memory, so the data is of global scope and script-persistent.
-- Alex Balashov - Principal Evariste Systems LLC Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
Please be kind to the English language:
http://www.entrepreneur.com/article/232906
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Next Kamailio Advanced Trainings 2014 - http://www.asipto.com Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users