๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/asterisk/templates/ext_utils.j2

88 lines
2.2 KiB

; Extension utilities
[record-start]
exten => s,1,ExecIf($["${IS_RECORDING}"="1"]?Return())
same => n,Set(UID=${UNIQUEID}.${RAND(1,100000)})
same => n,Set(CDR(actualuniqueid)=${UID})
same => n,MixMonitor({{ asterisk_recordings_dir }}/${UID}.wav,b,oggenc -q 5 -o {{ asterisk_recordings_dir }}/${UID}.ogg {{ asterisk_recordings_dir }}/${UID}.wav && rm {{ asterisk_recordings_dir }}/${UID}.wav)
same => n,Set(__IS_RECORDING=1)
same => n,Return()
[record-stop]
exten => s,1,StopMixMonitor()
same => n,Return()
; Filtering CallerID
[clear-callerid]
exten => s,1,Verbose(Filtering CallerID)
same => n,Set(CALLERID(num)=${FILTER(0-9,${CALLERID(num)})})
same => n,Set(CALLERID(name)=)
same => n,Return()
; Setting up volume control
[volume-setup]
exten => s,1,Set(CURRENT_VOLUME_TX=1)
same => n,Set(CURRENT_VOLUME_RX=1)
same => n,Set(__DYNAMIC_FEATURES=call-controls)
same => n,Return()
[volume-up-tx]
exten => s,1,Set(CURRENT_VOLUME_TX=$[${CURRENT_VOLUME_TX}*1.25])
same => n,Set(VOLUME(TX)=${CURRENT_VOLUME_TX})
same => n,Return()
[volume-up-rx]
exten => s,1,Set(CURRENT_VOLUME_RX=$[${CURRENT_VOLUME_RX}*1.25])
same => n,Set(VOLUME(RX)=${CURRENT_VOLUME_RX})
same => n,Return()
[volume-down-tx]
exten => s,1,Set(CURRENT_VOLUME_TX=$[${CURRENT_VOLUME_TX}*0.75])
same => n,Set(VOLUME(TX)=${CURRENT_VOLUME_TX})
same => n,Return()
[volume-down-rx]
exten => s,1,Set(CURRENT_VOLUME_RX=$[${CURRENT_VOLUME_RX}*0.75])
same => n,Set(VOLUME(RX)=${CURRENT_VOLUME_RX})
same => n,Return()
[volume-increase-all]
exten => s,1,Set(CURRENT_VOLUME_RX=2)
same => n,Set(CURRENT_VOLUME_TX=2)
same => n,Set(VOLUME(RX)=2)
same => n,Set(VOLUME(TX)=2)
same => n,Return()
; An invalid extension has been dialed
[invalid-ext]
exten => s,1,Answer(250)
same => n,Playback(custom/invalid-ext)
same => n,Wait(0.5)
same => n,Hangup()
; An extension has been dialed, but it is currently offline
[offline-ext]
exten => s,1,Answer(250)
same => n,Playback(custom/this-offline)
same => n,Wait(0.5)
same => n,Hangup()
; Output "Busy" signal
[busy]
exten => s,1,Busy(10)
same => n,Wait(1)
same => n,Hangup()
; Output "Congestion" signal
[congestion]
exten => s,1,Congestion(10)
same => n,Wait(1)
same => n,Hangup()