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 <abalas...@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 list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users