; BigBlueButton extensions.
; In your /etc/asterisk/extensions.conf, add the following line at the end
; of the file
; #include "bbb_extensions.conf"
;
; BigBlueButton: Setup sample conference
[bigbluebutton]
exten => _.,1,Goto(start-dialplan,s,1)
exten => _.,n,Hangup

[start-dialplan]
exten => s,1,Set(TRIES=1)
exten => s,n,Wait(2)
exten => s,n,Answer
exten => s,n,Goto(prompt,s,1)

[prompt]
exten => s,1,Read(CONF_NUM,conf-getconfno,6,,3,10)
exten => s,n,Goto(bbb-conference,${CONF_NUM},1)

; No need to check if conference is valid as they won't be able to login
; if the conference is invalid.
;
[bbb-voip]
exten => _XXXX.,1,Playback(conf-placeintoconf)
; exten => _XXXX.,n,MeetMe(${EXTEN},cdMsT)
exten => _XXXX.,n,Konference(${EXTEN},H)



[bbb-conference]
include => echo-test

exten => _XXXX.,1,Agi(agi://localhost/findConference?conference=${EXTEN})
exten => _XXXX.,n,GotoIf($[${EXTEN} = ${CONFERENCE_FOUND}]?valid:invalid)
exten => _XXXX.,n(valid),Playback(conf-placeintoconf)
; exten => _XXXX.,n,MeetMe(${CONFERENCE_FOUND},cdMsT)
exten => _XXXX.,n,Konference(${CONFERENCE_FOUND},H)
exten => _XXXX.,n(invalid),Goto(handle-invalid-conference,s,1)

[handle-invalid-conference]
exten => s,1,Playback(conf-invalid)
exten => s,n,GotoIf($[${TRIES} < 3]?try-again:do-not-try-again)
exten => s,n(try-again),Set(TRIES=$[${TRIES} + 1])
exten => s,n,Goto(prompt,s,1)
exten => s,n(do-not-try-again),Hangup

[echo-test]
;
; Create an extension, 600, for evaluating echo latency.
;
exten => 600,1,Answer                   ; Do the echo test
exten => 600,n,Playback(demo-echotest)  ; Let them know what's going on
exten => 600,n,Echo                     ; Do the echo test
exten => 600,n,Playback(demo-echodone)  ; Let them know it's over
exten => 600,n,Goto(s,6)                ; Start over

