Custom feature codes to read back the feature status of extensions
Created by: wiseoldowl,Last modification on 18 Mar 2007 [16:11 UTC]
Custom feature codes to read back the feature status of extensions
This code can be dropped into extensions_custom.conf and will read back to the caller the status of various features on the caller's extension (if *108 is dialed) or on any specified extension (if *109+extension is dialed - if you only dial *109 you are prompted to enter the extension). See the comments in the code for additional details. This code was originally created by philippel (a.k.a. p_lindheimer), and modified slightly to add Call Forward On Unavailable / No Answer. Also, the invocation feature codes were changed to *108 and *109 - if you want to change them to *+ a 2 digit code, be sure to change the {EXTEN:4} back to {EXTEN:3} in the two places it appears (in the *109 section below).
Addendum: This code calls a file: /var/lib/asterisk/sounds/custom/quarter-second-silence.wav which is simply one-quarter second of silence in a .wav format file (8000 Hz, 16 bit, mono format). If you don't have this file and don't wish to create it, search and replace all instances of custom/quarter-second-silence with silence/1
Also, the code has been modified since the original posting to combine consecutive multiple Playback statements into single statements.
;------------------------------------------------------------------------------------------- ; REPORT BACK ON EXTENSION STATUS ; ; Settings Currently Supported: ; CW: Call Waiting ; DND: Do Not Disturb ; CFB: Call Forward On Busy ; CFU: Call Forward On Unavailable / No Answer ; CF: Call Forward Unconditional ; ; get status of a specific extentsion by dialing *109xxx where xxx is the extension ; status is desired for. (Can be any number of supported extension digits) exten => _*109.,1,Set(uext=${EXTEN:4}) exten => _*109.,n,Noop(STATUS ON EXTENSION: ${EXTEN:4}) exten => _*109.,n,Answer exten => _*109.,n,Wait(1) exten => _*109.,n,Goto(custom-check-status,s,1) ; get status from specific extension, prompted after dialing exten => *109,1,Answer exten => *109,n,Wait(1) exten => *109,n,BackGround(please-enter-the) exten => *109,n,Playback(extension) exten => *109,n,Read(uext,then-press-pound) exten => *109,n,Wait(1) exten => *109,n,Goto(custom-check-status,s,1) ; playback extension settings for current or prompted phone exten => *108,1,Answer exten => *108,n,Set(uext=${CALLERIDNUM}) exten => *108,n,Goto(custom-check-status,s,1) ; this function is passed an extension number and will read back the ; status on the target extension ; ; TARGET EXTENSION ${uext} ; ; Settings Currently Supported: ; CW: Call Waiting ; DND: Do Not Disturb ; CFB: Call Forward On Busy ; CFU: Call Forward On Unavailable / No Answer ; CF: Call Forward Unconditional [custom-check-status] ; Announce Extension Being Reported on exten => s,1,Noop(REPORTING STATUS ON EXT: ${uext}) exten => s,n,Playback(status&for&extension) exten => s,n,SayDigits(${uext}) exten => s,n,Playback(is) ; CW: Call Waiting Status exten => s,n,Noop(CW RESULTS: ${DB_EXISTS(CW/${uext})} : ${DB_RESULT}) exten => s,n,Playback(custom/quarter-second-silence&call-waiting) exten => s,n,GotoIf($[${DB_EXISTS(CW/${uext})}]?cwenabled:cwdisabled) exten => s,n(cwenabled),Playback(activated) exten => s,n,Goto(dndcheck) exten => s,n(cwdisabled),Playback(de-activated) ; DND: Do Not Disturb Status exten => s,n(dndcheck),Noop(DND RESULTS: ${DB_EXISTS(DND/${uext})} : ${DB_RESULT}) exten => s,n,Playback(custom/quarter-second-silence&do-not-disturb) exten => s,n,GotoIf($[${DB_EXISTS(DND/${uext})}]?dndenabled:dnddisabled) exten => s,n(dndenabled),Playback(activated) exten => s,n,Goto(cfbcheck) exten => s,n(dnddisabled),Playback(de-activated) ; CFB: Call Forward on Busy Status exten => s,n(cfbcheck),Noop(CFB RESULTS: ${DB_EXISTS(CFB/${uext})} : ${DB_RESULT}) exten => s,n,Playback(custom/quarter-second-silence&call-fwd-on-busy) exten => s,n,GotoIf($[${DB_EXISTS(CFB/${uext})}]?cfbenabled:cfbdisabled) exten => s,n(cfbenabled),Playback(activated&and&is-set-to) exten => s,n,SayDigits(${DB_RESULT}) exten => s,n,Goto(cfucheck) exten => s,n(cfbdisabled),Playback(de-activated) ; CFU: Call Forward on Unavailable Status exten => s,n(cfucheck),Noop(CFU RESULTS: ${DB_EXISTS(CFU/${uext})} : ${DB_RESULT}) exten => s,n,Playback(custom/quarter-second-silence&call-fwd-no-ans) exten => s,n,GotoIf($[${DB_EXISTS(CFU/${uext})}]?cfuenabled:cfudisabled) exten => s,n(cfuenabled),Playback(activated&and&is-set-to) exten => s,n,SayDigits(${DB_RESULT}) exten => s,n,Goto(cfcheck) exten => s,n(cfudisabled),Playback(de-activated) ; CF: Call Forward Unconditional Status exten => s,n(cfcheck),Noop(CF RESULTS: ${DB_EXISTS(CF/${uext})} : ${DB_RESULT}) exten => s,n,Playback(custom/quarter-second-silence&call-fwd-unconditional) exten => s,n,GotoIf($[${DB_EXISTS(CF/${uext})}]?cfenabled:cfdisabled) exten => s,n(cfenabled),Playback(activated&and&is-set-to) exten => s,n,SayDigits(${DB_RESULT}) exten => s,n,Goto(endcheck) exten => s,n(cfdisabled),Playback(de-activated) ; CALL STATUS END - GOODBYE! exten => s,n,Playback(custom/quarter-second-silence&goodbye) exten => s,n,Hangup ;------