Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bertrand-lupart/95915d9941abba3d0d27d0ea2fbf4f33 to your computer and use it in GitHub Desktop.
Save bertrand-lupart/95915d9941abba3d0d27d0ea2fbf4f33 to your computer and use it in GitHub Desktop.
Asterisk extensions.conf fragment implementing MeetMe()'s dynamic pin-protected conferences using ConfBridge()
; You may miss MeetMe() from your old asterisk box
; Here's an asterisk fragment whose goal is to mimic the following MeetMe() line using Confbridge()
; exten => 42,1,MeetMe(,cIxDsM)
; call 42 to create/join dynamic pin-protected ConfBridge() conference
; adapt context and call number to your actual numbering plan
[your-random-context]
exten => 42,1,NoOp()
same => n,Goto(conference,s,1)
same => n,Hangup()
[conference]
exten => s,1,NoOp()
same => n,Answer()
same => n,Read(CONFID,conf-getconfno)
same => n,Set(CONFID=${FILTER(0-9,${CONFID})})
same => n,GotoIf($["${CONFID}" = “”]?hangup)
same => n,Read(CONFPIN,conf-getpin)
same => n,Set(CONFPIN=${FILTER(0-9,${CONFPIN})})
same => n,GotoIf($["${CONFPIN}" = “”]?hangup)
same => n,MacroExclusive(conference_validate,${CONFID},${CONFPIN},CONFSTATUS)
same => n,GotoIf($["${CONFSTATUS}" = "1"]?conf_ok:conf_ko)
same => n(conf_ok),Verbose(3,Conference : ${CONFID} OK, launching...)
same => n,ConfBridge(${CONFID})
same => n,Hangup()
same => n(conf_ko),Verbose(3, Conference: ${CONFID} KO, abort)
same => n,Playback(beeperr)
same => n,Playback(beeperr)
same => n,Playback(beeperr)
same => n,Hangup()
[macro-conference_validate]
exten => s,1,NoOp()
same => n,GotoIf($[${GROUP_COUNT(${ARG1}@conference)} > 0]?pin_check)
same => n,Verbose(3,Conference : Creating ${ARG1} / ${ARG2}")
same => n,Set(DB(conf/${ARG1}/pin)=${ARG2})
same => n,Set(${ARG3}=1)
same => n,Set(GROUP(conference)=${ARG1})
same => n,MacroExit()
same => n(pin_check),Verbose(3,Conference : Checking pin for confbridge ${ARG1})
same => n,GotoIf($["${DB(conf/${ARG1}/pin)}" = "${ARG2}"]?exit_ok:exit_invalid_pin)
same => n(exit_ok),Verbose(3,Conference : Pin OK for ${ARG1})
same => n,Set(${ARG3}=1)
same => n,Set(GROUP(conference)=${ARG1})
same => n,MacroExit()
same => n(exit_invalid_pin),Verbose(3,Conference : PIN KO for ${ARG1} ${DB(conf/${ARG1}/pin)} Vs ${ARG2})
same => n,Playback(conf-invalidpin)
same => n,Goto(exit_ko)
same => n(exit_ko),Verbose(3,Conference : PIN KO for ${ARG1} ${DB(conf/${ARG1}/pin)} Vs ${ARG2})
same => n,Set(${ARG3}=0)
same => n,MacroExit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment