Last active
April 19, 2022 19:56
-
-
Save lgaetz/b65d7ec29d2e2cba46909051dfcb39cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; FreePBX custom dialplan that creates a prefix dial code that | |
; will keep an asterisk channel open for 3600 seconds to monitor | |
; the device state of the target local extension and call back once | |
; the target extension is idle | |
; License GNU GPL3 | |
; | |
; Latest version: https://gist.github.com/lgaetz/b65d7ec29d2e2cba46909051dfcb39cf | |
; | |
; History | |
; 2022-03-23 Crude but working proof of concept | |
[watcher] | |
exten => _X.,1,Noop(Entering user defined context watcher in extensions_custom.conf) | |
exten => _X.,n(start),Wait(10) | |
exten => _X.,n,Noop(Extension state of ${callee} is: ${EXTENSION_STATE(${callee}@ext-local)})}) | |
exten => _X.,n,GotoIf($["${EXTENSION_STATE(${callee}@ext-local)}"!="NOT_INUSE"]?start) | |
exten => _X.,n,Goto(from-internal,${caller},1) | |
[from-internal-custom] | |
exten => _**45XXXX,1,Noop(Entering user defined context from-internal-custom in extensions_custom.conf) | |
exten => _**45XXXX,n,Macro(user-callerid) | |
exten => _**45XXXX,n,Set(caller=${AMPUSER}) | |
exten => _**45XXXX,n,Set(callee=${EXTEN:4}) | |
exten => _**45XXXX,n,Originate(local/${caller}@watcher,exten,from-internal,${callee},1,3600,av(caller=${AMPUSER}^callee=${EXTEN:4})) | |
; exten => _**45XXXX,n,Answer ; in this section we can play a recording to the caller indicating watch is set | |
; exten => _**45XXXX,n,Wait(.5) | |
; exten => _**45XXXX,n,Playback(enabled) | |
exten => _**45XXXX,n,Hangup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version 1 - proof of concept.