[SR-Users] Keep Number of Messages per Source

Alex Balashov abalashov at evaristesys.com
Tue Aug 12 21:58:25 CEST 2014


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



More information about the sr-users mailing list