netz39-infra-ansible/templates/platon/extensions.conf.j2

131 lines
4.5 KiB
Text
Raw Permalink Normal View History

2022-08-03 22:37:45 +02:00
; extensions.conf - the Asterisk dial plan
;
; Static extension configuration file, used by
; the pbx_config module. This is where you configure all your
; inbound and outbound calls in Asterisk.
;
; This configuration file is reloaded
; - With the "dialplan reload" command in the CLI
; - With the "reload" command (that reloads everything) in the CLI
;
; The "General" category is for certain variables.
;
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static=yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command "dialplan save" too
;
writeprotect=yes
;
; If autofallthrough is set, then if an extension runs out of
; things to do, it will terminate the call with BUSY, CONGESTION
; or HANGUP depending on Asterisk's best guess. This is the default.
;
; If autofallthrough is not set, then if an extension runs out of
; things to do, Asterisk will wait for a new extension to be dialed
; (this is the original behavior of Asterisk 1.0 and earlier).
;
;autofallthrough=no
;
;
;
; If clearglobalvars is set, global variables will be cleared
; and reparsed on a dialplan reload, or Asterisk reload.
;
; If clearglobalvars is not set, then global variables will persist
; through reloads, and even if deleted from the extensions.conf or
; one of its included files, will remain set to the previous value.
;
; NOTE: A complication sets in, if you put your global variables into
; the AEL file, instead of the extensions.conf file. With clearglobalvars
; set, a "reload" will often leave the globals vars cleared, because it
; is not unusual to have extensions.conf (which will have no globals)
; load after the extensions.ael file (where the global vars are stored).
; So, with "reload" in this particular situation, first the AEL file will
; clear and then set all the global vars, then, later, when the extensions.conf
; file is loaded, the global vars are all cleared, and then not set, because
; they are not stored in the extensions.conf file.
;
clearglobalvars=no
;
; User context is where entries from users.conf are registered. The
; default value is 'default'
;
;userscontext=default
;
; You can include other config files, use the #include command
; (without the ';'). Note that this is different from the "include" command
; that includes contexts within other contexts. The #include command works
; in all asterisk configuration files.
;#include "filename.conf"
;#include <filename.conf>
;#include filename.conf
;
; You can execute a program or script that produces config files, and they
; will be inserted where you insert the #exec command. The #exec command
; works on all asterisk configuration files. However, you will need to
; activate them within asterisk.conf with the "execincludes" option. They
; are otherwise considered a security risk.
;#exec /opt/bin/build-extra-contexts.sh
;#exec /opt/bin/build-extra-contexts.sh --foo="bar"
;#exec </opt/bin/build-extra-contexts.sh --foo="bar">
;#exec "/opt/bin/build-extra-contexts.sh --foo=\"bar\""
;
; The "Globals" category contains global variables that can be referenced
; in the dialplan with the GLOBAL dialplan function:
; ${GLOBAL(VARIABLE)}
; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
; Unix/Linux environmental variables can be reached with the ENV dialplan
; function: ${ENV(VARIABLE)}
;
[globals]
;;; Dialplans
[default]
;; get the caller ID as number
exten => s,1, Set(cid=${CALLERID(number)})
exten => s,n, Verbose(2,Incoming call from ${cid})
exten => s,n, Answer
exten => s,n, Playback(silence/1)
;; welcome message
;exten => s,n, Playback(n39/welcome)
exten => s,n, Playback(custom/n39/hello)
;; get the PIN
exten => s,n, Read(pin)
;; check PIN and CID
exten => s,n, Set(access=${SHELL( /home/{{ gatekeeper_user }}/netz39_rollladensteuerung/raspberry/asterisk/door-phone-auth.sh ${cid} ${pin} /home/{{ gatekeeper_user }}/phone-whitelist.txt )})
exten => s,n, NoOp(Access result: ${access})
exten => s,n, GotoIf($[ "${access}" = "OK" ]?granted:failed)
exten => s,n, Hangup()
;; access granted
exten => s,100(granted), noop()
;exten => s,n, Playback(n39/accessgranted)
exten => s,n, System({{ door_open_command }})
exten => s,n, Playback(custom/n39/granted)
exten => s,n, Goto(done)
;; access failed
exten => s,200(failed), noop()
;exten => s,n, Playback(n39/youcannotpass)
exten => s,n, Playback(custom/n39/denied)
exten => s,n, Goto(done)
;; done
exten => s,300(done), noop()
exten => s,n, Hangup()