; Asterisk exention configuration

[from-internal]
;Play audio message and hangup if 6010 is dialed
exten = 6010,1,Answer()
same = n,Wait(2)
same = n,Playback(demo-congrats)
same = n,Hangup()

;Send http request, play audio message and hangup if 6011 is dialed
exten = 6011,1,Answer()
same = n,Wait(2)
same = n,Set(CURL_RESULT=${CURL(http://<NoderedIP>:1880/endpoint/<ENDPOINT NAME>?exten=${EXTEN})})
same = n,Playback(activated)
same = n,Hangup()

;Internal extentions (Phone,softphones or other Voip clients)
; The number at the end (,30) sets the dial time out 
exten => 6000,1,Dial(PJSIP/${EXTEN},30)

;Connect to extenal the Homeassistent 'Assistent' service when 6020 is dialed
exten => 6020,1,Dial(PJSIP/HomeAssistant,10)

;IVR,
;send to ivr if 6012 is dialed
exten = 6012,1,Goto(ivr-test,s,1)

;;The following section must be at the end of the file 
[ivr-test]
exten =>s,1,Answer()
same =>n,set(IVRName=TestIVR)
same => n,wait(2)
same => n,Background(basic-pbx-ivr-main)
same => n,WaitExten(10)
;;Nr 1 to 4 are vaild options
exten => _[1-4],1,Set(CURL_RESULT=${CURL(http://<NoderedIP>:1880/endpoint/<ENDPOINT NAME>?${IVRName}=${EXTEN})}
same = n,Playback(activated)
same = n,Playback(goodbye)
same = n,Hangup()
;;If option invalid
exten => i,1,Playback(pm-invalid-option)
exten => i,2,Goto(ivr-test,s,5)
;; If timed out
exten => t,1,Playback(vm-pls-try-again)
exten => t,2,Goto(ivr-test,s,5)
