[Devel] Limiting number of parallel calls
Andreas Granig
andreas.granig at inode.info
Fri Dec 15 12:07:56 CET 2006
Hi,
I'm planning to develop a module for limiting parallel calls per user.
My deployment has some pre-requisites, and it would be rather easy in my
case:
- Proxies are physically distributed
- A common MySQL cluster is used as DB backend
- Session-Timer is used for detecting lost BYEs.
This leads to a simple module built up on dialog support. For INVITEs, a
DB transaction is started, like:
- BEGIN;
- SELECT count FROM call_table WHERE uuid = <uuid> FOR UPDATE;
- check in module if "count" is less than the allowed number of calls
fetched from usr_preferences (passed to the function via AVP)
- UPDATE call_table SET count = count + 1 WHERE uuid = <uuid>;
- COMMIT;
So this would be an atomic procedure across all proxies. Decrementation
is done on BYE, any error in call-establishment or on dialog timeout.
The problem is that this scenario is, well, a little bit specific :o)
So to be useful for others too, it either has to be more generic, or
there have to be different implementations for different system designs.
This leads to the question, how that could be done best.
On systems with only one proxy, it could be implemented in shared
memory. Distributed systems using SIP-replication have a problem here.
So are there any ideas?
Andy
More information about the Devel
mailing list