Linux – Limit simultaneous call per user in Asterisk

asterisklinuxSecurity

I want to limit simultaneous calls per extensions in Asterisk for security reasons. For example when a user is on the call no body else would be able to make a call by that extension.

How can I achieve this?

Best Answer

There isn't an easy answer to this, but a number of people have suggested solutions. Basically you need to count the outbound channels yourself, as suggested here:

http://www.remiphilippe.fr/2010/05/29/simultaneous-call-limitation-on-asterisk/

The script looks like this, after groups have been enabled as a macro:

[globals]
MAXCALLS=2

[macro-voipcall]
; Limit the number of outgoing calls
; Set Group
exten => s,1,Set(GROUP()=OUTBOUND_GROUP)
; Are we exceeding the limit?
exten => s,2,GotoIf($[${GROUP_COUNT()} > ${MAXCALLS}]?999)
; No? Then dial
exten => s,3,Dial(${ARG1})
; Yes? Then deny
exten => s,999,Set(DIALSTATUS=CHANUNAVAIL)
  • This is taken from the site above; I can't take credit for it, and haven't tested the script, but it seems sound!