Re: [SR-Users] Keep Number of Messages per Source

2014-08-13 Thread AliReza Khoshgoftar Monfared
Thanks very much Daniel and Alex, I switched to the atomic increase ("$var(x) = $shtinc(a=>x);"), My attempt to get automatic expiration and resetting of values to 0 by doing "modparam("htable", "htable", "message_counters=>size=10; autoexpire=10;initval=0;updateexpire=0;")" was not successful (v

Re: [SR-Users] Keep Number of Messages per Source

2014-08-13 Thread Daniel-Constantin Mierla
On 13/08/14 16:24, Alex Balashov wrote: On 08/13/2014 10:21 AM, AliReza Khoshgoftar Monfared wrote: 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 mess

Re: [SR-Users] Keep Number of Messages per Source

2014-08-13 Thread Alex Balashov
On 08/13/2014 10:21 AM, AliReza Khoshgoftar Monfared wrote: 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 resi

Re: [SR-Users] Keep Number of Messages per Source

2014-08-13 Thread AliReza Khoshgoftar Monfared
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

Re: [SR-Users] Keep Number of Messages per Source

2014-08-13 Thread Daniel-Constantin Mierla
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 th

Re: [SR-Users] Keep Number of Messages per Source

2014-08-12 Thread AliReza Khoshgoftar Monfared
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

Re: [SR-Users] Keep Number of Messages per Source

2014-08-12 Thread Alex Balashov
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 addres

[SR-Users] Keep Number of Messages per Source

2014-08-12 Thread AliReza Khoshgoftar Monfared
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 cour