Under asterisk, from your dialplan or an agi script you canput your calls (that has the same purpose)
in the same group.
This can be done using the GROUP* functions under asterisk.
- With GROUP() you can retrieve or set a group for the current channel
- With GROUP_COUNT() you can retrieve the total of live channel in that group
- With GROUP_LIST, you will get a list of group where the current channel is. So you can set put the same channel in multiple group to classify them.
- With GROUP_MATCH_COUNT, you can retrieve the number of live channels in that group matching the specifed regular expression.
Example :
A nice application for this is, if you have multiple inbound DIDs that reach a same context and want to limit calls to DID 8800 to 10 for example. Your dialplan should go like this :
[Call-Limit]
exten => 8800,1,Noop(Recd call to ${EXTEN})
exten => 8800,n,Set(GROUP()=trunk1)
exten => 8800,n,NoOP(Group Count = ${GROUP_COUNT(trunk1)} for Group = trunk1)
exten => 8800,n,GotoIf($[${GROUP_COUNT(trunk1)}<11]?Dial1,999,1:Dial2,999,1)
exten => 8800,n,Wait(120)
exten => 8800,n,Hangup
[Dial1]
exten => 999,1,Wait(120)
exten => h,n,hangup()
[Dial2]
exten => 999,1,Wait(120)
exten => h,n,hangup()
-= Info about function 'GROUP' =-
[Synopsis]
Gets or sets the channel group.
[Description]
can be employed for more fine grained group management. Each channel
can only be member of exactly one group per .
[Syntax]
GROUP([category])
[Arguments]
category
Category name.
-= Info about function 'GROUP_COUNT' =-
[Synopsis]
Counts the number of channels in the specified group.
[Description]
Calculates the group count for the specified group, or uses the channel's
current group if not specifed (and non-empty).
[Syntax]
GROUP_COUNT([groupname][@category])
[Arguments]
groupname
Group name.
category
Category name