Hello,
do you need to have the counter per exact address in the dispatcher? Or you want to have it per IP (address) of FreeSwitch?
If you just need the number of the calls, I would go with htable module, having two options here:
a) store in table items (callid, srcipaddr, like $sht(acalls=>$ci) = $si;) when getting 200OK for INVITE, delete the item by callid when BYE is received ($sht(acalls=>$ci) = $null). This would require dumping the entire hash table via rpc and count by value. You can set some auto expires value to the max call lifetime you allow on your service
b) store the counter per ip addrress, so on 200OK you do $shtinc(acalls=>$si). Based on direction (see rr module for how to detect the direction), you have to decremented it on BYE based either on source IP or next hop IP. On this option, you have to be careful with cross BYEs (caller and callee hanging up at the same time, resulting in two BYEs crossing kamailio for same call) -- you can use another hash table to store that counter was decremented based on call-id, with the item stored for short time, like auto expires 2 minutes.
The internal htable module can be replaced with a redis storage by using ndb_redis.
For the future, I can add an rpc command to dump those numbers directly from dispatcher module when using with algorithm 10.
Cheers, Daniel
On 07.06.18 09:04, Tim Bowyer wrote:
Thanks for the prompt reply Alex!
Trying to get my head around the best way to use the module. By the looks I need to statically create profiles which will be used as counting groups. Since each destination is dynamically created thus named with a fairly random ID, I can't see how this could work.
Have tried using variables but I get a heap of errors. The process will only start if I use static profile names.
Is there another sneaky way to get around this? When a new container is spun up, a new entry is added to the dispatcher table and the dispatcher reloaded. Likewise to trigger a container to start draining calls we remove from dispatcher then reload before waiting for all calls to finish and stop the container.
Cheers,
Tim Bowyer
-----Original Message----- From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Alex Balashov Sent: Thursday, 7 June 2018 10:42 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Monitoring Dispatcher
It sounds like the dialog module might be your best bet.
On June 6, 2018 10:40:38 PM EDT, Tim Bowyer timbo@timbo.net.au wrote:
Hi All,
Currently trying to work out the best way to keep track of how many calls are being sent to any given dispatcher destination. I remember being able to do this years ago with the load balancer module in OpenSIPS: opensipsctl fifo lb_list.
Dispatching algorithm '10' seems to be the best fit for my requirements, as I'm essentially wanting to send calls to a large quantity of FreeSwitch docker containers acting as fax receiving nodes. Equal weight, just filling them in some balanced fashion.
Any hints or ideas would be much appreciated!
Kind regards,
Tim Bowyer
-- Alex
-- Sent via mobile, please forgive typos and brevity.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users