Skip to content

Instantly share code, notes, and snippets.

@ambiorixg12
Last active March 24, 2021 17:04
Show Gist options
  • Save ambiorixg12/08b09bec19a99157516eaffd6c3d9a7d to your computer and use it in GitHub Desktop.
Save ambiorixg12/08b09bec19a99157516eaffd6c3d9a7d to your computer and use it in GitHub Desktop.
Asterisk Group Count
[count]
exten =>_x.,1,Noop(Received call to extension ${EXTEN})
same=>n,Set(GROUP()=${EXTEN})) ;Create the group
same=>n,GotoIf($[${GROUP_COUNT()} >2]?maxreached) ; verify
same=>n,Set(MYTRUNK=voipms)
same=>n,Dial(SIP/${EXTEN}@${MYTRUNK},30)
same=>n(maxreached),Playback(all-outgoing-lines-unavailable)
same=>n,Playback(pls-try-call-later)
same=>n,Hangup()
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment