;-------------------------------------------------------------------------------------------- ; Dail plan for Asterisk and Asterisk Gui Take 1 ; ; Please email changes to r.neese@gmail.com ;-------------------------------------------------------------------------------------------- ;Some functions have not been mapped in asterisk as of yet and I dont know what the plans for ;them are. So you can remap an of the unused functions for new fuctions. I just hope that ;any code you add you relist this somewhere where others can find it and use it. This is my ;work to make a fully functional dialplan for the asterisk-gui & the asterisk pbx. If you see ;anything wrong please take the time and fix it, And repost it. I did my best to keep it ;orderly I tried to fallow the NANPA lay out but I added some things. I hope this helps in ;the long run. ; ;Enjoy ; ;I have split it into parts as you will see as you read just to try and keep it clean. ; ;all the agi's used in this dial plan are at the bottom of the page. ; ;This code was developed on FreeBSD and might need the path's reset for Linux installs. ; ;------------------------------------------------------------------- ; Begining of extensions.conf File ;------------------------------------------------------------------- ;------------------------------------------------------------------- ;General Settings ;------------------------------------------------------------------- [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 'save dialplan' too ; writeprotect = no ; ; 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 an extensions 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 ; ; If priorityjumping is set to 'yes', then applications that support ; 'jumping' to a different priority based on the result of their operations ; will do so (this is backwards compatible behavior with pre-1.2 releases ; of Asterisk). Individual applications can also be requested to do this ; by passing a 'j' option in their arguments. ; ;priorityjumping=yes ; ; 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" ; 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)} ; ;--------------------------------------------------------------------------------------------- ;Start DialPlan Basics ;--------------------------------------------------------------------------------------------- ; Any category other than "General" and "Globals" represent ; extension contexts, which are collections of extensions. ; ; Extension names may be numbers, letters, or combinations ; thereof. If an extension name is prefixed by a '_' ; character, it is interpreted as a pattern rather than a ; literal. In patterns, some characters have special meanings: ; ; X - any digit from 0-9 ; Z - any digit from 1-9 ; N - any digit from 2-9 ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) ; . - wildcard, matches anything remaining (e.g. _9011. matches ; anything starting with 9011 excluding 9011 itself) ; ! - wildcard, causes the matching process to complete as soon as ; it can unambiguously determine that no other matches are possible ; ; For example the extension _NXXXXXX would match normal 7 digit dialings, ; while _1NXXNXXXXXX would represent an area code plus phone number ; preceded by a one. ; ; Each step of an extension is ordered by priority, which must ; always start with 1 to be considered a valid extension. The priority ; "next" or "n" means the previous priority plus one, regardless of whether ; the previous priority was associated with the current extension or not. ; The priority "same" or "s" means the same as the previously specified ; priority, again regardless of whether the previous entry was for the ; same extension. Priorities may be immediately followed by a plus sign ; and another integer to add that amount (most useful with 's' or 'n'). ; Priorities may then also have an alias, or label, in ; parenthesis after their name which can be used in goto situations ; ; Contexts contain several lines, one for each step of each ; extension, which can take one of two forms as listed below, ; with the first form being preferred. One may include another ; context in the current one as well, optionally with a ; date and time. Included contexts are included in the order ; they are listed. ; ;----------------------------------------------------------------------------- ; Magic Extensions to be used within a context ;----------------------------------------------------------------------------- ; s = start ; t = This gets jumped to on timeout waiting for keypress ; i = This gets jumped to on an invalid extension ; h = This gets jumped to when a call in a given context is hung up ; fax = This gets jumped to on fax tone detection ;----------------------------------------------------------------------------- ; Dial Options ;----------------------------------------------------------------------------- ; Dial jumps to priority n+101 on Congestion if n+101 exists ; 't' -- Allow the user to dial # then an extension to transfer ; 'T' -- to allow the calling user to transfer the call ; 'r' -- indicate ringing to the calling party, pass no audio until answer ; 'm' -- provide hold music to the calling party until answered ; 'd' -- data-quality (modem) call (minimum delay) ; 'c' -- clear-channel data call (PRI-PRI only) ; 'H' -- allow caller to hang up by hitting * ; 'C' -- reset call detail record for this call ; 'P[(x)]' -- privacy mode, using 'x' as database if provided ; 'g' -- goes on in context if the destination channel hangs up ;---------------------------------------------------------------------------- ; ; ; Note the 'g2' in the TRUNK variable below. It specifies which group (defined ; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in ; the specified group. The four possible options are: ; ; g: select the lowest-numbered non-busy Zap channel ; (aka. ascending sequential hunt group). ; G: select the highest-numbered non-busy Zap channel ; (aka. descending sequential hunt group). ; r: use a round-robin search, starting at the next highest channel than last ; time (aka. ascending rotary hunt group). ; R: use a round-robin search, starting at the next lowest channel than last ; time (aka. descending rotary hunt group). ; ;----------------------------------------------------- ;Start Globals ;----------------------------------------------------- [globals] ;CONSOLE=Console/dsp ; Console interface for demo ;CONSOLE=Zap/1 ;CONSOLE=Phone/phone0 ;IAXINFO=guest ; IAXtel username/password ;IAXINFO=myuser:mypass ;TRUNK=Zap/g2 ; ;TRUNKMSD = 1 ; MSD digits to strip (usually 1 or 0) ;iaxtel = IAX2/iaxtel ;sipphone = SIP/sipphone ; ;TRUNK=IAX2/user:pass@provider ; ; ; Sip/Voip Provider. Context for each diff provider. ; Read andused to fill in dial strings for outbound Dialing. ; LINE= USERID= USERPASS= SIPCOMPANYNAME= PROTOCOL=SIP or IAX2 ; ;SipPhone.com SIPLINE= ;your SipPhonecom Number Here SIPUSERID= ;Your User ID here SIPPASS= ;Your Password here PROTOCOL= ;IAXTEL user info IAXLINE= IAXTELUSER= IAXCOMPANYNAME= IAXTELPASS= PROTOCOL= ; ;FreeWorld Dialup user info FWDLINE; FWDUSERID; FWDCOMPANYNAME= FWDPASSWD= PROTOCOL= ;----------------------------------------------------- ;Start DialPlan ;----------------------------------------------------- ;------------------------------------------------------ ; Start - inbound call mapping ;------------------------------------------------------ [inbound] ; ;This Exten Goes to Automated attendant after putting ;caller ID into the Database ;exten => s,1,Set(BD(Last/Caller=${CALLERIDNUM}) ;exten => s,2,Goto(system-ivr,s,1) ; ;New way to map exten. This test for active features. exten => s,1,Set(${DB(Last/Caller=${CALLERIDNUM})}) exten => s.n,Macro(,$[exten}) ; ; ;This exten Dial your ZAP lines ;exten => s,1,Set(DB(Last/Caller=${CALLERIDNUM}) ;exten => s,n,Dial(ZAP/###,30,r) ;replace ### with exten nmbr ;------------------------------------------------------ ; Basic IVR With Default Queues & Time Checking & Fax ;------------------------------------------------------ [system-ivr] ; exten => s,1,GotoIfTime(*|*|1|jan?holiday,s,1) exten => s,n,GotoIfTime(*|*|4|jul?holiday,s,1) exten => s,n,GotoIfTime(*|*|11|nov?holiday,s,1) exten => s,n,GotoIfTime(*|*|24|nov?holiday,s,1) exten => s,n,GotoIfTime(*|*|25|dec?holiday,s,1) exten => s,n,GotoIfTime(08:00-17:00on-fri|*|*?day,s,1) exten => s,n,GotoIfTime(17:01-07:99|mon-fri|*|*?night,s,1) exten => s,n,GotoIfTime(09:00-16:00|sat|*|*?day,s,1) exten => s,n,Goto(night,s,1); ; ;------------------------------------------------------------------- ; Basic Inbound - IVR Menu ;------------------------------------------------------------------- ; exten => i,1,Background(pbx-invalid) ; "That's not valid, try again" exten => i,2,Wait(1) exten => i,3,Goto(s,9) ; exten => t,1,Playback(pls-wait-connect-call) exten => t,n,Goto(operator-queue,s,1) ; ; ;1 Sales Dept exten => 1,1,GotoIfTime(08:00-16:59|mon-fri|*|*?selection,3,6) exten => 1,2,GotoIf(Time(17:00-07:29|mon-fri|*|*?selection,3,3) exten => 1,3,Playback(sales-closed) exten => 1,4,Playback(vm-goodbye) exten => 1,5,Hangup exten => 1,6,BackGround(for-quality-purposes) exten => 1,7,Playback(this-call-may-be) exten => 1,8,Playback(recorded) exten => 1,9,Playback(pls-wait-connect-call) exten => 1,10,SetMusicOnHold,default exten => 1,11,SetCallerID,1 exten => 1,12,SetCallerIDName,Sales exten => 1,13,Goto,queues|200|1 ; ;2 Billing Dept exten => 2,1,GotoIfTime(08:00-16:59|mon-fri|*|*?selection,4,6) exten => 2,2,GotoIfTime(17:00-07:29|mon-fri|*|*?selection,4,3) exten => 2,3,Playback(billing-closed) exten => 2,4,Playback(vm-goodbye) exten => 2,5,Hangup exten => 2,6,Playback(for-quality-purposes) exten => 2,7,Playback(this-call-may-be) exten => 2,8,Playback(recorded) exten => 2,9,Playback(pls-wait-connect-call) exten => 2,10,SetMusicOnHold,default exten => 2,11,SetCallerID,2 exten => 2,12,SetCallerIDName,Sales exten => 2,13,Goto,queues|201|1 ; ;3 Technical Support Dept exten => 3,1,GotoIfTime(08:30-17:29|mon-fri|*|*?selection,5,6) exten => 3,2,GotoIfTime(17:30-08:29|mon-fri|*|*?selection,5,3) exten => 3,3,Playback(tech-closed) exten => 3,4,Playback(vm-goodbye) exten => 3,5,Hangup exten => 3,6,Playback(for-quality-purposes&this-call-may-be&recorded)) exten => 3,10,SetMusicOnHold,default exten => 3,11,SetCallerID,3 exten => 3,12,SetCallerIDName,TechSupport exten => 3,13,Goto,queues|202|1 ; ;4 exten => 4,1,Playback,(systemstat) exten => 4,n,Hangup ;5 exten => 5,1,Background(vm-goodbye) exten => 5,n,Hangup ; ;6 exten => 6,1,Playback(vm-goodbye) exten => 6,n,Hangup ; ;7 exten => 7,1,Playback(vm-goodbye) exten => 7,n,Hangup ; ;8 exten => 8,1,Playback(vm-goodbye) exten => 8,n,Hangup ; ;9 Fax Extension exten => 9,1,Set(CALLEDFAX=>${EXTEN}) exten => 9,2,Answer exten => 9,3,Goto(fax,${EXTEN},1) ; ;exten => fax,1,Goto(ext-fax,in_fax,1) ; [custom-fax] exten => s,1,Goto(ext-fax,in_fax,1) ; ;----------------------------------------------------- ;Basic Sip / IAX2 Outbound Proviver setup ;change provider to your sip/iax2 provider ;----------------------------------------------------- [provider] ; change provider to your sip/iax2 provider ;switch => Realtime/dialplan@pbx-db-name ;US LD & Canada 11 digit Dialing exten => _1NXXNXXXXXX,1,Set(CALLERID(name)=) exten => _1NXXNXXXXXX,n,Set(CALLERID(number)=|a) exten => _1XXXXXXXXXX,n,DIAL(SIP or IAX2/username@provider/${EXTEN}) exten => _1NXXNXXXXXX,n,Congestion exten => _1NXXNXXXXXX,n,Hangup ; ;10 digit us dialing exten => _NXXNXXXXXX,1,Set(CALLERID(name)=) exten => _NXXNXXXXXX,n,Set(CALLERID(number)=|a) exten => _NXXNXXXXXX,n,DIAL(SIP or IAX2/username@provider/${EXTEN}) exten => _NXXNXXXXXX,n,Congestion exten => _NXXNXXXXXX,n,Hangup ; ;us local 7 digit dialing exten => _NXXXXXX,1,Set(CALLERID(name)=) exten => _NXXXXXX,n,Set(CALLERID(number)=|a) exten => _NXXXXXX,n,DIAL(SIP or IAX2 /username@provider/###${EXTEN}) ; ### change to areacode for 7 digit dialing exten => _NXXXXXX,n,Congestion exten => _NXXXXXX,n,Hangup ; ;International Dialing exten => _011.,1,Set(CALLERID(name)=) exten => _011.,n,Set(CALLERID(number)=|a) exten => _011.,n,DIAL(SIP or IAX2 /username@provider/${EXTEN}) exten => _011.,n,Congestion exten => _011.,n,Hangup ; ;------------------------------------------ ;Iaxtel.com outbound Setup ;------------------------------------------ [iaxtel] ;switch => Realtime/dialplan@pbx-db-name exten => _1700NXXXXXX,1,Set(CALLERID(name)=) exten => _1700NXXXXXX,n,Set(CALLERID(number)=|a) exten => _1700NXXXXXX,n,Dial(IAX2/${IAXTELUSER}:{IAXTELPASS}@iaxtelcom/${EXTEN}@iaxtel) exten => _1700NXXXXXX,n,Congestion exten => _1700NXXXXXX,n,Hangup ; exten => _700NXXXXXX,1,Set(CALLERID(name)=) exten => _700NXXXXXX,n,Set(CALLERID(number)=|a) exten => _700NXXXXXX,n,Dial(IAX2/${IAXTELUSER}:{IAXTELPASS}@iaxtelcom/${EXTEN}@iaxtel) exten => _700NXXXXXX,n,Congestion exten => _700NXXXXXX,n,Hangup ; [toll-free] ;switch => Realtime/dialplan@pbx-db-name exten => _1800NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _1800NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _1800NXXXXXX,2,Congestion exten => _1800NXXXXXX,103,Congestion exten => _1888NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _1888NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _1888NXXXXXX,2,Congestion exten => _1888NXXXXXX,103,Congestion exten => _1877NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _1877NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _1877NXXXXXX,2,Congestion exten => _1877NXXXXXX,103,Congestion exten => _1866NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _1866NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _1866NXXXXXX,2,Congestion exten => _1866NXXXXXX,103,Congestion exten => _800NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _800NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _800NXXXXXX,2,Congestion exten => _800NXXXXXX,103,Congestion exten => _888NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _888NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _888NXXXXXX,2,Congestion exten => _888NXXXXXX,103,Congestion exten => _877NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _877NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _877NXXXXXX,2,Congestion exten => _877NXXXXXX,103,Congestion exten => _866NXXXXXX,1,Dial(${provider}/${EXTEN}) exten => _866NXXXXXX,102,Dial(${IAXTELUSER}:{IAXTELPASS}@iaxtel.com/${EXTEN}@iaxtel) exten => _866NXXXXXX,2,Congestion exten => _866NXXXXXX,103,Congestion ; ;--------------------------------------------- ;Spipphone.com Ooutboune Setup ;--------------------------------------------- [sipphone] ;switch => Realtime/dialplan@pbx-db-name exten => _1747NXXXXXX,1,Set(CALLERID(name)=) exten => _1747NXXXXXX,n,Set(CALLERID(number)=|a) exten => _1747NXXXXXX,n,Dial(SIP/${EXTEN:1}@sipphone) exten => _1747NXXXXXX,n,Playback(invalid) exten => _1747NXXXXXX,n,Congestion exten => _1747NXXXXXX,n,Hangup ; exten => _747NXXXXXX,1,Set(CALLERID(name)=) exten => _747NXXXXXX,n,Set(CALLERID(number)=|a) exten => _747NXXXXXX,n,Dial(SIP/${EXTEN:1}@sipphone) exten => _747NXXXXXX,n,Playback(invalid) exten => _747NXXXXXX,n,Congestion exten => _747NXXXXXX,n,Hangup ; ;-------------------------------------------- ;Free world Dialup outbound ;-------------------------------------------- [fwddialup] ;switch => Realtime/dialplan@pbx-db-name exten => _#6.,1,Set(CALLERID(name)=) exten => _#6.,n,Set(CALLERID(number)=|a) exten => _#6.,n,Dial(SIP or IAX2/${FWDNUMBER}:${FWDPASSWORD}@iax2fwdnetnet/${EXTEN:2},60,r) exten => _#6.,n,Congestion; exten => _#6.,n,Hangup ; ;--------------------------------------------- ; 900/976 Blocking ;--------------------------------------------- [sex-block] exten => _900NXXXXXX,1,Playback(ss-noservice) exten => _1NXX976XXXX,1,Playback(ss-noservice) exten => _NXX976XXXX,1,Playback(ss-noservice) exten => _976XXXX,1,Playback(ss-noservice) ; ;------------------------------------------------ ;Vertical Service Code & Definitions ;----------------------------------------------------- ;This is Nanpa vertical service codes + Codes I added to the setup for functionality. Some of these functions have not been mapped in ;asterisk. Some of them can be remapped or changed, but for the most part the layout fallows Nanpa. ;----------------------------------------------------- ; # - Company directory ;----------------------------------------------------- [app-directory] exten => #,1,Answer exten => #,n,Wait(1) exten => #,n,AGI(directory,${DIR-CONTEXT},from-did-direct,${DIRECTORY:0:1}${DIRECTORY_OPTS}o) exten => #,n,Playback(vm-goodbye) exten => #,n,Hangup ; Taken from Freepbx for GXP2000 phones. ;----------------------------------------------------- ;Remote Line Pickup ** is used so that gxp2000 can use this function. ;----------------------------------------------------- [app-pickup] exten => _**.,1,Noop(Attempt to Pickup ${EXTEN:2} by ${CALLERID(num)}) exten => _**.,n,Pickup(${EXTEN:2}) ;-------------------------------------------------------------------------------------------------------------------------------- ;Inward Voice Activated Services (*00 English, *01 French) ;IVAS enables a subscribing business to provide automated voice activated routing for inbound English or French speaking calls ;(i.e., separate codes for the same service in each language). IVAS will initially consist of the following services: ; ;* Voice Activated Premier Dialing (VAPD) which allows customers to contact subscribing businesses by speaking the business ; name or service. ; ;* Voice Activated Blue Pages (VABP) which allows customers to request access to government services. ; ;* Voice Activated Auto Attendant (VAAA) which provides enhancements to Auto Attendant applications by providing a voice ; recognition interface in place of Touch Tone. ; ;* Voice Activated Audio Text (VAAT) provides users ability to request specific information from a business. ; ;* Voice Activated Interactive Voice Response (VAIVR) which allows the caller to interact with a subscriber's specific ; application in a prescribed manner. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Deactivation/Activation of In-Session Activation (ISA) on a per line basis (*02) ;Allows a subscriber to deactivate or activate (i.e., toggle) the In-Session Activation feature on a per line basis. ISA ;is feature that gives the caller a menu of call completion services using voice prompts when the call encounters a busy ;or no-answer condition. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Deactivation of In-Session Activation (ISA) on a per call basis (*03) ;Allows a subscriber to deactivate the In-Session Activation feature on a per call basis. When the call is completed, ISA ;reverts back to the active state. ISA is a feature that gives the caller a menu of call completion services using voice ;prompts when the call encounters a busy or no-answer condition. ;-------------------------------------------------------------------------------------------------------------------------------- ;---------------------------------------------------- ; *1 - System Status recorded file ;---------------------------------------------------- [sysstat] ; *1 - System Status exten => *1,1,Answer exten => *1,n,Wait(.5) exten => *1,n,Playback(/usr/local/share/asterisk/sounds/custom/systemstatus) exten => *1,n,Wait(.5) exten => *1,n,Macro(hangupcall) ; ; *1* - System status record exten => *1*,1,Answer exten => *1*,n,Wait(2) exten => *1*,n,Record(/usr/local/share/sounds/custom/systemstatus:gsm) exten => *1*,n,Wait(2) exten => *1*,n,Playback(/usr/local/share/asterisk/sounds/custom/systemstatus) exten => *1*,n,Wait(2) exten => *1*,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *2 - Say Phone Number ;----------------------------------------------------------- [say-exten] exten => *2,1,Answer exten => *2,n,Playback(your-exten-num-is) exten => *2,n,SayDigits(${CALLERID(number)}) exten => *2,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *3 - Say Date and Time ;----------------------------------------------------------- [say-date] exten => *3,1,Answer exten => *3,2,Playback(at-tone-time-exactly) exten => *3,3,SayUnixTime(,,IMp) exten => *3,4,Playback(beep) exten => *3,5,Macro(hangupcall) ; ;----------------------------------------------------------- ; *4 - Echo Test ;----------------------------------------------------------- [app-echo] exten => *4,1,Answer exten => *4,n,Playback(demo-echotest) exten => *4,n,Playback(beep) exten => *4,n,Echo exten => *4,n,Playback(demo-echodone) exten => *4,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *5 - Milliwatt Tone ;----------------------------------------------------------- [app-milliwatt] exten => *5,1,Answer exten => *5,n,Milliwatt exten => *5,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *6 - Record Promt Test Format Gsm ;----------------------------------------------------------- [rec-playback] exten => *6,1,Answer exten => *6,n,Wait(1) exten => *6,n,Record(record:gsm) exten => *6,n,Wait(1) exten => *6,n,Playback(record) exten => *6,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *7 - Music On Hold ;----------------------------------------------------------- [moh] exten => *7,1,Answer exten => *7,n,MusicOnHold(default) exten => *7,n,Macro(hangupcall) ; ;------------------------------------ ;*8 Says Time & plays Tone & Repeat's ;------------------------------------ [repeating-clock] ; repeates time. exten => *8,1,ringing exten => *8,2,Set(FutureTime=$[${EPOCH} + 8]) exten => *8,3,Set(FutureTimeMod=$[${FutureTime} % 10]) exten => *8,4,Set(FutureTime=$[${FutureTime} - ${FutureTimeMod}]) exten => *8,5,Set(MaxConnectTime=$[${FutureTime} + 180]) exten => *8,6,Set(FutureTimeMod=$[${FutureTime} - ${EPOCH}]) exten => *8,7,GotoIf($["${FutureTimeMod}" < "0"]?10:8) exten => *8,8,wait(1) exten => *8,9,goto(6) exten => *8,10,Answer exten => *8,11,Set(FutureTime=$[${FutureTime} + 10]) exten => *8,12,Set(FutureTimeMod=$[${FutureTime} % 60]) exten => *8,13,wait(1) exten => *8,14,playback(at-tone-time-exactly) exten => *8,15,SayUnixTime(${FutureTime},,I) exten => *8,16,SayUnixTime(${FutureTime},,M) exten => *8,17,GotoIf($["${FutureTimeMod}" = "0"]?18:20) exten => *8,18,SayUnixTime(${FutureTime},,p) exten => *8,19,goto(23) exten => *8,20,playback(and) exten => *8,21,SayUnixTime(${FutureTime},,S) exten => *8,22,playback(seconds) exten => *8,23,Set(FutureTimeMod=$[${FutureTime} - ${EPOCH}]) exten => *8,24,GotoIf($["${FutureTimeMod}" < "1"]?27:25) exten => *8,25,wait(1) exten => *8,26,goto(23) exten => *8,27,playback(beep) exten => *8,28,Set(FutureTimeMod=$[${MaxConnectTime} - ${EPOCH}]) exten => *8,29,GotoIf($["${FutureTimeMod}" < "1"]?30:11) exten => *8,30,Macro(hangupcall) ; ;----------------------------------------------------------- ; *9 - Wakeupcall ; Avaible for local mapping requires php to be installed ; agi code below wapeup.php and wakeconfirm.agi ;----------------------------------------------------------- [app-wakeup] exten => *9,1,Macro(user-callerid) exten => *9,n,Answer exten => *9,n,Wait(1) exten => *9,n,AGI(wakeup.php) exten => *9,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *10 - Reginal & Local Weather Requires flite/festival and ;and a sql database for zipcodes and php and the Nevr vitels ;Weather by zipcode script ;----------------------------------------------------------- ;[app-weather] ;exten => *10,1,Macro(user-callerid) ;exten => *10,n,Answer ;exten => *10,n,Wait(1) ;exten => *10,n,Set(TIMEOUT(digit)=7) ;exten => *10,n,Set(TIMEOUT(response)=10) ;exten => *10,n,Flite('At the beep enter the five digit zip code for the weather report you wish to retrieve.') ;exten => *10,n,Read(ZIPCODE,beep,5,,,) ;exten => *10,n,Flite('Please hold a moment while we contact the National Weather Service for your report.') ;exten => *10,n,AGI(nv-weather-zip.php|${ZIPCODE}) ;exten => *10,n,Noop(Wave file: ${TMPWAVE}) ;exten => *10,n,Playback(${TMPWAVE}) ;exten => *10,n,Macro(hangupcall) ; ;---------------------------------------------------------- ; *11 - ;---------------------------------------------------------- ;----------------------------------------------------------- ; *12 - Current Company Job Listings not yet working ;----------------------------------------------------------- ;[jobs-postings] ;exten => *12,1,Answer ;exten => *12,n,Playback(current-job-postings) ;exten => *12,n,System(/usr/local/bin/curl -s ) ;exten => *12,n,Wait(1) ;exten => *12,n,MP3Player(/tmp/.mp3) ;exten => *12,n,System(rm /tmp/ .mp3 -f) ;exten => *12,n,Playback(vm-goodbye) ;exten => *12,n,Macro(hangupcall) ; ;------------------------------------------------------------ ;Intercom ;------------------------------------------------------------ [ext-intercom] exten => _*13.,1,Set(dialnumber=${EXTEN:3}) exten => _*13.,n,dbGet(user-intercom=SIP/${dialnumber}/intercom) exten => _*13.,n,GotoIf($["${user-intercom}" = "disabled" ]?nointercom) exten => _*13.,n,Set(__SIPADDHEADER=Call-Info: \;answer-after=0) exten => _*13.,n,Set(__ALERT_INFO=Ring Answer) exten => _*13.,n,Set(__SIP_URI_OPTIONS=intercom=true) exten => _*13.,n,Dial(Local/${dialnumber}@from-internal/n) exten => _*13.,n,Busy(20) exten => _*13.,n,Macro(hangupcall) exten => _*13.,n(nointercom),Noop(Intercom disallowed by ${dialnumber}) exten => _*13.,n,Playback(intercom&for&extension) exten => _*13.,n,SayDigits(${dialnumber}) exten => _*13.,n,Playback(is&disabled) exten => _*13.,n,Congestion(20) exten => _*13.,n,Macro(hangupcall) ; ;------------------------------------------------------------ ;Enable Intercom Per exten ;------------------------------------------------------------ exten => *14,1,Answer exten => *14,n,Wait(1) exten => *14,n,Macro(user-callerid) exten => *14,n,Set(DB(SIP/${CALLERID(number)}/intercom)=enabled) exten => *14,n,Playback(intercom&enabled) exten => *14,n,Macro(hangupcall) ; ;------------------------------------------------------------ ;Disable Intercom Per exten ;------------------------------------------------------------ exten => *15,1,Answer exten => *15,n,Wait(1) exten => *15,n,Macro(user-callerid) exten => *15,n,Set(DB(SIP/${CALLERID(number)}/intercom)=disabled) exten => *15,n,Playback(intercom&disabled) exten => *15,n,Macro(hangupcall) ; ;----------------------------------------------------------- ; *16 ChanSpy Used to monitor users calls. Uses the Macro ; Provided below for checking username and passwords for access ;----------------------------------------------------------- [chanspy] exten => *16,1,Goto(app-chanspy,s,1) [app-chanspy] exten => s,1,Set(LOOPCOUNT=0) exten => s,n,Answer exten => s,n,Wait(1) exten => s,n(begin),Set(TIMEOUT(digit)=3) exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,Playback(please-enter&your&extension) exten => s,n,Read(ext_num,then-press-pound,,) exten => s,n,Wait(1) exten => s,n,Playback(pls-enter-chanspy-password) exten => s,n,Read(ext_pwd,then-press-pound,,) exten => s,n,Wait(1) exten => s,n,AGI(chk_chanspy_pwd.agi|/usr/local/etc/asterisk/chanspy.conf|${ext_num}|${ext_pwd}) exten => s,n,GotoIf($["${result}" = "0"]?D:pwd-chanspy,i,1) exten => s,n,Set(CALLERIDNUM=${ext_num}) exten => s,n(d),BackGround(please-enter-the&extension&you&with&to&monitor) exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds exten => _.,1,ChanSpy(SIP/${EXTEN}|q) exten => i,1,PlayBack(invalid&extension) exten => i,n,Goto(loop,1) exten => t,1,Goto(loop,1) exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1]) exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1) exten => loop,n,Goto(custom-chanspy,s,begin) exten => hang,1,Playback(vm-goodbye) exten => hang,n,Macro(hangupcall) ;----------------------------------------------------------- ; *20 - *29 - Inturnal and Extenal Meet-Me Conference Rooms. ;Requires zaptel&ztdummy. for timing. ;----------------------------------------------------------- [internal-conf] exten => _*2X,1,Answer exten => _*2X,n,Wait(1) exten => _*2X,n,MeetMe({$ARG1},pdcMs) exten => _*2X,n,4,Playback(vm-goodbye) exten => _*2X,n,5,Macro(hangupcall) ; ;------------------------------------------------------------- ;*31 - *33 BlackList ;------------------------------------------------------------ [blacklist] exten => *31,1,Goto(app-blacklist-add,s,1) exten => *32,1,Goto(app-blacklist-remove,s,1) exten => *33,1,Goto(app-blacklist-last,s,1) ; [app-blacklist-check] exten => s,1,LookupBlacklist() exten => s,n,GotoIf($["${LOOKUPBLSTATUS}"="FOUND"]?blacklisted) exten => s,n,Return() exten => s,n(blacklisted),Answer exten => s,n,Wait(1) exten => s,n,Zapateller() exten => s,n,Zapateller() exten => s,n,Playback(ss-noservice) exten => s,n,Hangup ; [app-blacklist-add] exten => s,1,Answer exten => s,n,Wait(1) exten => s,n,Playback(enter-num-blacklist) exten => s,n,Set(TIMEOUT(digit)=5) exten => s,n,Set(TIMEOUT(response)=60) exten => s,n,Read(blacknr,then-press-pound,,,,) exten => s,n,SayDigits(${blacknr}) exten => s,n,Playback(if-correct-press) exten => s,n,Playback(digits/1) exten => s,n(end),Noop(Waiting for input) exten => 1,1,Set(DB(blacklist/${blacknr})=1) exten => 1,n,Playback(num-was-successfully) exten => 1,n,Playback(added) exten => 1,n,Wait(1) exten => 1,n,Hangup ; [app-blacklist-last] exten => s,1,Answer exten => s,n,Wait(1) exten => s,n,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})}) exten => s,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo) exten => s,n,Playback(privacy-to-blacklist-last-caller) exten => s,n,Playback(telephone-number) exten => s,n,SayDigits(${lastcaller}) exten => s,n,Set(TIMEOUT(digit)=3) exten => s,n,Set(TIMEOUT(response)=7) exten => s,n,Playback(if-correct-press) exten => s,n,Playback(digits/1) exten => s,n,Goto(end) exten => s,n(noinfo),Playback(unidentified-no-callback) exten => s,n,Hangup exten => s,n(end),Noop(Waiting for input) exten => 1,1,Set(DB(blacklist/${lastcaller})=1) exten => 1,n,Playback(num-was-successfully) exten => 1,n,Playback(added) exten => 1,n,Wait(1) exten => 1,n,Hangup ; [app-blacklist-remove] exten => s,1,Answer exten => s,n,Wait(1) exten => s,n,Playback(entr-num-rmv-blklist) exten => s,n,Set(TIMEOUT(digit)=5) exten => s,n,Set(TIMEOUT(response)=60) exten => s,n,Read(blacknr,then-press-pound,,,,) exten => s,n,SayDigits(${blacknr}) exten => s,n,Playback(if-correct-press) exten => s,n,Playback(digits/1) exten => s,n(end),Noop(Waiting for input) exten => 1,1,dbDel(blacklist/${blacknr}) exten => 1,n,Playback(num-was-successfully) exten => 1,n,Playback(removed) exten => 1,n,Wait(1) exten => 1,n,Hangup ; ;------------------------------------------------------------- ; Dictation Record ;------------------------------------------------------------- [dictate-record] exten => *34,1,Answer exten => *34,n,Macro(user-callerid) exten => *34,n,Noop(CallerID is ${CALLERID(num)}) exten => *34,n,Dictate(/usr/local/share/asterisk/sounds/dictate/${CALLERID(num)}) exten => *34,n,Macro(hangupcall) ; ;--------------------------------------------------------------- ;Dictation Send ;--------------------------------------------------------------- [dictate-send] exten => *35,1,Answer exten => *35,n,Macro(user-callerid) exten => *35,n,Noop(CallerID is ${CALLERID(num)}) exten => *35,n,Read(DICTFILE,enter-filename-short,,) exten => *35,n,Set(DICTEMAIL=${DB(SIP/${CALLERID(num)}/dictate/email)}) exten => *35,n,Set(DICTFMT=${DB(SIP/${CALLERID(num)}/dictate/format)}) exten => *35,n,Set(NAME=${DB(SIP/${CALLERID(num)}/cidname)}) exten => *35,n,Playback(dictation-being-processed) exten => *35,n,System(/usr/local/share/asterisk/bin/audio-email.pl --file /usr/local/share/asterisk/sounds/dictate/${CALLERID(num)}/${DICTFILE}.raw --attachment dict-${DICTFILE} --format ${DICTFMT} --to ${DICTEMAIL} --subject "Dictation from ${NAME} Attached") exten => *35,n,Playback(dictation-sent) exten => *35,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Change Forward-To Number for Customer/Programmable Call Forwarding Busy Line (*40) ;Access Code followed by directory number is used to change the forwarded-to number for Call Forwarding Busy Line (CFBL). The state ;of CFBL is not changed when this access code is used. This feature will utilize the activation code of *90 and deactivation code *91 ;with the following exceptions:activation will not require/allow the identification of a forwarded-to directory number and deactivation ;will not clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [CPCFD] exten => _*40.,1,Answer exten => _*40.,n,Wait(1) exten => _*40.,n,Macro(user-callerid) exten => _*40.,n,Set(DB(CPCFB/${CALLERID(number)})=${EXTEN:3}) exten => _*40.,n,Playback(call-fwd-no-ans&for&extension) exten => _*40.,n,SayDigits(${CALLERID(number)}) exten => _*40.,n,Playback(is-set-to) exten => _*40.,n,SayDigits(${EXTEN:3}) exten => _*40.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Six-Way Conference Calling Activation (*41) ;Allows the subscriber to originate a six-way conference call. Customers will enter this code prior to the first directory number ;added into the conference. Each subsequent member of the conference is added with a flash hook. This code is used to eliminate ;action conflicts with other flash hook originated features. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Change Forward-To Number for Customer Programmable Call Forwarding Don't Answer (*42) ;Access Code followed by directory number is used to change the forwarded-to number for Call Forwarding Don't Answer (CFDA). The ;state of CFDA is not ;changed when this access code is used. This feature will utilize the activation code of *92 and deactivation ;code *93 with the following exceptions:activation will not require/allow the identification of a forwarded-to directory number and ;deactivation will not clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [CPCFDA] exten => _*42.,1,Answer exten => _*42.,n,Wait(1) exten => _*42.,n,Macro(user-callerid) exten => _*42.,n,Set(DB(CPCFDA/${CALLERID(number)})=${EXTEN:3}) exten => _*42.,n,Playback(call-fwd-no-ans&for&extension) exten => _*42.,n,SayDigits(${CALLERID(number)}) exten => _*42.,n,Playback(is-set-to) exten => _*42.,n,SayDigits(${EXTEN:3}) exten => _*42.,n,Macro(hangupcall, ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Drop last member of Six-Way Conference Call (*43) ;Provides the subscriber establishing a six-way conference to terminate the last party added to the call. This frees the port for ;an additional party when the last party wasn't reachable. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Voice Activated Dialing (*44) ;Access to the Voice Activated Dialing (VAD) directory. Customers will dial this code to access their VAD directory in order to add, ;delete or review the names and numbers ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Voice Dialing Extended Dial Tone (*45) ;Extend dial tone for Voice Activated Dialing (VAD). Customers will dial this code to extend the length of time in which dial ;tone is heard after going off-hook so that various Customer Premise Equipment (CPE, i.e., fax and modems) will work properly. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;French Voice Activated Network Control (*46) ;Provides the subscriber access to Voice Activated Network Control (VANC) via the French language. Subscribers will dial this ;code to access VANC so that they can say a name or command in French that will be activated, deactivated or provide access ;to a service, e.g., Call Forwarding, Call Trace, etc. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Override Feature Authorization (*47) ;Allows a subscriber to override a Feature Authorization activated on a line which restricts 1+ calls from that line. Feature ;Authorization may be overriden by dialing *47 and a Personal Identification Number ;(PIN) and then dialing a 1+ call after ;receiving a second dial tone. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Override Do Not Disturb (*48) ;Allows a subscriber to override the Do Not Disturb feature which has been activated on a line. After receiving a message ;indicating the station is in a Do Not Disturb condition, the subscriber may override the condition by dialing *48 and then ;a Personal Identification Number (PIN) thus allowing the call to be completed in the normal manner. ;-------------------------------------------------------------------------------------------------------------------------------- [app-dnd-overide] exten => _*48.,1,Dial(SIP/${ARG1}:3|20|r) ; 20sec timeout exten => _*48.,n,Voicemail(u${ARG1}) exten => _*48.,n,Hangup ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Long Distance Signal (*49) ;Extended period activation/deactivation (toggle) of basic 1FR/1MR long distance signal ringing/call waiting tones. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Voice Activated Network Control (*50) ;Access to Voice Activated Network Control (VANC). Customers will dial this code to access VANC so that they can say a name or ;command that will be activated, deactivated or to access a service. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Who Called Me? (*51) ;Provides the subscriber with the directory number (DN), date, and time of unanswered calls. ;-------------------------------------------------------------------------------------------------------------------------------- [app-whocall] exten => *51,1,Macro(user-callerid) exten => *51,2,Answer exten => *51,3,Wait(1) exten => *51,4,Background(info-about-last-call) exten => *51,5,Background(telephone-number) exten => *51,6,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})}) exten => *51,7,GotoIf($[${lastcaller}]?8:10) exten => *51,8,SayDigits(${lastcaller}) exten => *51,9,Macro(hangupcall) exten => *51,10,Playback(from-unknown-caller) exten => *51,11,Playback(unidentified-no-callback) exten => *51,12,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Single Line Variety Package (SVP) - Call Hold (*52) ;Gives the subscriber the capability of placing a call on hold so that the call may be continued from another extension. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Single Line Variety Package (SVP) - Distinctive Ring B (*53) ;Allows a subscriber to select, by way of distinctive ringing, the particular person or extension that the subscriber wishes to alert. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Single Line Variety Package (SVP) - Distinctive Ring C (*54) ;Allows a subscriber to select, by way of distinctive ringing, the particular person or extension that the subscriber wishes to alert. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Single Line Variety Package (SVP) - Distinctive Ring D (*55) ;Allows a subscriber to select, by way of distinctive ringing, the particular person or extension that the subscriber wishes to alert. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Change Forward-To Number for ISDN Call Forwarding (*56) ;Access code followed by directory number (DN) is used to change the Forward-To number for Call Forwarding Variable feature button. ;The state of Call ;Forwarding Variable feature button is not changed when this access code is utilized. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Customer Originated Trace (*57) ;Provides the recipient of an obscene, harassing, or threatening call the ability to request an auto-trace of the last call received. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;ISDN MBKS Manual Exclusion (*58 Activationn) ;Access code allows a Multibutton Key Set (MBKS) user or an analog set user whose telephone number is shared on another ISDN MBKS to inhibit other stations from picking up a call on hold or bridging onto a call that is active at the station. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Rejection (*60 Activation) ;Allows the subscriber to have incoming calls from a limited number of calling parties rejected by the terminating switching system. ;-------------------------------------------------------------------------------------------------------------------------------- [scra] exten => _*60.,1,Macro(user-callerid) exten => _*60.,n,Set(DB(BLACKLIST/${CALLERID(number)})=${EXTEN:3}) exten => _*60.,n,Answer exten => _*60.,n,Wait(1) exten => _*60.,n,Playback(blacklist-add&for&extension) exten => _*60.,n,SayDigits(${CALLERID(number)}) exten => _*60.,n,Playback(is-set-to) exten => _*60.,n,SayDigits(${EXTEN:3}) exten => _*60.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Distinctive Ringing/Call Waiting (*61 Activation) ;Allows the subscriber to have incoming calls from a limited number of calling parties identified using distinctive alerting treatment. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Waiting (*62) ;Provides the subscriber the ability to provide a Call Waiting signal to a predetermined list of directory numbers specified by ;the subscriber. Callers not on the predetermined list will receive busy tone. ;-------------------------------------------------------------------------------------------------------------------------------- exten => *62,1,Answer exten => *62,n,Wait(1) exten => *62,n,Macro(user-callerid) exten => *62,n,Set(DB(SCW/${CALLERID(number)})=ENABLED) exten => *62,n,Playback(selective-call-waiting&activated) exten => *62,n,Macro(hangupcall) exten => _*62.,1,Macro(user-callerid) exten => _*62.,n,Set(DB(SCW/${CALLERID(number)})=${EXTEN:3}) exten => _*62.,n,Answer exten => _*62.,n,Wait(1) exten => _*62.,n,Playback(selective-call-waiting-unconditional&for&extension) exten => _*62.,n,SayDigits(${CALLERID(number)}) exten => _*62.,n,Playback(is-set-to) exten => _*62.,n,SayDigits(${EXTEN:3}) exten => _*62.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Forwarding (*63 Activation) ;Allows the subscriber to have incoming calls from a limited number of calling parties forwarded to a prespecified remote station. ;-------------------------------------------------------------------------------------------------------------------------------- [scfa] exten => *63,1,Answer exten => *63,n,Wait(1) exten => *63,n,Macro(user-callerid) exten => *63,n,Set(DB(SCF/${CALLERID(number)})=ENABLED) exten => *63,n,Playback(selective-call-waiting&activated) exten => *63,n,Macro(hangupcall) exten => _*63.,1,Set(DB(SCF/${CALLERIDNUM})=${EXTEN:3})}) exten => _*63.,n,Answer exten => _*63,n,Wait(1) exten => _*63.,n,Playback(selective-call-forwarding&for&extension) exten => _*63.,n,SayDigits(${CALLERIDNUM}) exten => _*63.,n,Playback(is-set-to) exten => _*63.,n,SayDigits(${EXTEN:3}) exten => _*63.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Acceptance (*64 Activation) ;Provides the subscriber the ability to block calls from all but a predetermined list of directory numbers specified by the ;subscriber. Unaccepted callers may receive an announcement or be routed to a predetermined directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [scaa] exten => *64,1,Answer exten => *64,n,Wait(1) exten => *64,n,Macro(user-callerid) exten => *64,n,Set(DB(SCA/${CALLERID(number)})=ENABLED) exten => *64,n,Playback(selective-call-accept&activated) exten => *64,n,Macro(hangupcall) exten => _*64.,1,Macro(user-callerid) exten => _*64.,n,Set(DB(SCA/${CALLERID(number)})=${EXTEN:3}) exten => _*64.,n,Answer exten => _*64.,n,Wait(1) exten => _*64.,n,Playback(selective-call-accept&for&extension) exten => _*64.,n,SayDigits(${CALLERID(number)}) exten => _*64.,n,Playback(is-set-to) exten => _*64.,n,SayDigits(${EXTEN:3}) exten => _*64.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Calling Number Delivery (*65 Activation) ;Provides the subscriber with the directory number (DN) of the calling party during the ringing cycle. ;-------------------------------------------------------------------------------------------------------------------------------- [cnda] exten => *65,1,Macro(user-callerid) exten => *65,n,Set(DB(CIDB/${CALLERIDNUM}=YES) exten => *65,n,Answer exten => *65,n,Wait() exten => *65,n,Playback(caller-id-blk&activated) exten => *65,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Automatic Callback (*66 Activation) ;Allows a subscriber to automatically place a call to the last station called by the subscriber when that station becomes idle. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Calling Number Delivery Blocking (*67) ;Allows the subscriber to temporarily change the permanent public/private status indicator of his/her directory number (DN) and ;thus control its availability to the called party. ;-------------------------------------------------------------------------------------------------------------------------------- [cndd] exten => *67,1,Answer exten => *67,n,Wait(1) exten => *67,n,Macro(user-callerid) exten => *67,1,Set(DB(CIDB/${CALLERIDNUM}=YES) exten => *67,n,Answer exten => *67,n,Wait(1) exten => *67,n,Playback(caller-ib-blockin&activated) exten => *67,n,Macro(hangupcall) ; ;--------------------------------------------------------------------------------------------------------------------------------- ;Call Forwarding Busy Line/Don't Answer (*68 Activation) ;Allows a subscriber to forward calls intended for the subscriber's busy line, or idle line after a predetermined number of rings, ;to another directory number entered by the subscriber at the time of activation. ;--------------------------------------------------------------------------------------------------------------------------------- [cfbdaa] exten => *68,1,Answer exten => *68,n,Wait(1) exten => *68,n,Playback(call-fwd-on-busy&please-enter-your&extension) exten => *68,n,Read(fromext,then-press-pound) exten => *68,n,Set(fromext=$/{IF($["foo${fromext}"="foo"]?${CALLERID(number)}:${fromext})}) exten => *68,n,Wait(1) exten => *68,n(startread),Playback(ent-target-attendant) exten => *68,n,Read(toext,then-press-pound) exten => *68,n,GotoIf($["foo${toext}"="foo"]?startread) exten => *68,n,Wait(1) exten => *68,n,Set(DB(CFBDA${fromext})=${toext}) exten => *68,n,Playback(call-fwd-on-busy&for&extension) exten => *68,n,SayDigits(${fromext}) exten => *68,n,Playback(is-set-to) exten => *68,n,SayDigits(${toext}) exten => *68,n,Macro(hangupcall) exten => _*68.,1,Answer exten => _*68.,n,Wait(1) exten => _*68.,n,Macro(user-callerid) exten => _*68.,n,Set(DB(CFBDA/${CALLERID(number)})=${EXTEN:3}) exten => _*68.,n,Playback(call-fwd-on-busy&for&extension) exten => _*68.,n,SayDigits(${CALLERID(number)}) exten => _*68.,n,Playback(is-set-to) exten => _*68.,n,SayDigits(${EXTEN:3}) exten => _*68.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Automatic Recall (*69 Activation) aka lcr ;Allows a subscriber to automatically place a call to the last station that called the subscriber, when that station becomes idle. ;-------------------------------------------------------------------------------------------------------------------------------- [lcr] exten => *69,1,Macro(user-callerid) exten => *69,n,Answer exten => *69,n,Wait(1) exten => *69,n,Playback(info-about-last-call&telephone-number) exten => *69,n,Set(lastcaller=${DB(CALLTRACE/${CALLERID(number)})}) exten => *69,n,GotoIf($[ $[ "${lastcaller}" = "" ] | $[ "${lastcaller}" = "unknown" ] ]?noinfo) exten => *69,n,SayDigits(${lastcaller}) exten => *69,n,Set(TIMEOUT(digit)=3) exten => *69,n,Set(TIMEOUT(response)=7) exten => *69,n,Background(to-call-this-number&press-1) exten => *69,n,Goto(fin) exten => *69,n(noinfo),Playback(from-unknown-caller&unidentified-no-callback) exten => *69,n,Macro(hangupcall) exten => *69,n(fin),Noop(Waiting for input) exten => 1,1,Goto(from-internal,${lastcaller},1) exten => i,1,Playback(vm-goodbye) exten => i,n,Macro(hangupcall) exten => t,1,Playback(vm-goodbye) exten => t,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Cancel Call Waiting (*70) ;Provides the subscriber the ability to enable the Call Waiting feature for the duration of a telephone call. ;-------------------------------------------------------------------------------------------------------------------------------- [cwa] exten => *70,1,Answer exten => *70,n,Wait(1) exten => *70,n,Macro(user-callerid) exten => *70,n,Set(DB(CW/${CALLERID(number)})=ENABLED) exten => *70,n,Playback(call-waiting&activated) exten => *70,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Cancel Call Waiting (*71) ;Provides the subscriber the ability to disable the Call Waiting feature for the duration of a telephone call. ;-------------------------------------------------------------------------------------------------------------------------------- [cwd] exten => *71,1,Answer exten => *71,n,Wait(1) exten => *71,n,Macro(user-callerid) exten => *71,n,dbDel(CW/${CALLERID(number)}) exten => *71,n,Playback(call-waiting&de-activated) exten => *71,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Call Forwarding (*72 Activation) ;Allows a subscriber to redirect calls intended for his/her station (base station) to another station (remote station). ;-------------------------------------------------------------------------------------------------------------------------------- [cfa] exten => *72,1,Answer exten => *72,n,Wait(1) exten => *72,n,Playback(call-fwd-unconditional) exten => *72,n,Playback(please-enter-your&extension) exten => *72,n,Read(fromext,then-press-pound) exten => *72,n,Set(fromext=${IF($["foo${fromext}"="foo"]?${CALLERID(number)}:${fromext})}) exten => *72,n,Wait(1) exten => *72,n(startread),Playback(ent-target-attendant) exten => *72,n,Read(toext,then-press-pound) exten => *72,n,GotoIf($["foo${toext}"="foo"]?startread) exten => *72,n,Wait(1) exten => *72,n,Set(DB(CF/${fromext})=${toext}) exten => *72,n,Playback(call-fwd-unconditional&for&extension) exten => *72,n,SayDigits(${fromext}) exten => *72,n,Playback(is-set-to) exten => *72,n,SayDigits(${toext}) exten => *72,n,Macro(hangupcall) exten => _*72.,1,Answer exten => _*72.,n,Wait(1) exten => _*72.,n,Macro(user-callerid) exten => _*72.,n,Set(DB(CF/${CALLERID(number)})=${EXTEN:3}) exten => _*72.,n,Playback(call-fwd-unconditional&for&extension) exten => _*72.,n,SayDigits(${CALLERID(number)}) exten => _*72.,n,Playback(is-set-to) exten => _*72.,n,SayDigits(${EXTEN:3}) exten => _*72.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Call Forwarding (*73 Deactivation) ;Allows a subscriber to redirect calls intended for his/her station (base station) to another station (remote station). ;-------------------------------------------------------------------------------------------------------------------------------- [cfd] exten => *73,1,Answer exten => *73,n,Wait(1) exten => *73,n,Macro(user-callerid) exten => *73,n,dbDel(CF/${CALLERID(number)}) exten => *73,n,Playback(call-fwd-unconditional&de-activated) exten => *73,n,Macro(hangupcall) exten => _*73,1,Answer exten => _*73,n,Wait(1) exten => _*73,n,Set(fromext=${EXTEN:3}) exten => _*73,n,dbDel(CF/${fromext}) exten => _*73,n,Playback(call-fwd-unconditional&for&extension) exten => _*73,n,SayDigits(${fromext}) exten => _*73,n,Playback(cancelled) exten => _*73,n,Macro(hangupcall) ; exten => #73,1,Answer exten => #73,n,Wait(1) exten => #73,n,Playback(please-enter-your&extension) exten => #73,n,Read(fromext,then-press-pound) exten => #73,n,Wait(1) exten => #73,n,dbDel(CF/${fromext}) exten => #73,n,Playback(call-fwd-unconditional&for&extension) exten => #73,n,SayDigits(${fromext}) exten => #73,n,Playback(cancelled) exten => #73,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Speed Calling (*74 Speed Calling 8-Change List) ;Allows a subscriber to assign his/her own speed calling codes directly and immediately from his/her own telephone by dialing ;a change speed calling list access code, an abbreviated code, and a new telephone number. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Speed Calling (*75 Speed Calling 30-Change List) ;Allows a subscriber to assign his/her own speed calling codes directly and immediately from his/her own telephone by dialing ;a change speed calling list access code, an abbreviated code, and a new telephone number. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Advanced Call Waiting Deluxe (*76) ;Allows a subscriber to specify, in advance of incoming calls, the termination treatment on incoming calls that arrive while ;the subscriber is engaged in another conversation. ;-------------------------------------------------------------------------------------------------------------------------------- [acwdd] exten => *76,1,Answer exten => *76,n,Wait(1) exten => *76,n,Macro(user-callerid) exten => *76,n,DBdel(ACW/${CALLERID(number)}) exten => *76,n,Playback(selective-call-waiting) exten => *76,n,Playback(de-activated) exten => *76,n,Macro(hangupcall) exten => **76,1,Answer exten => #76,n,Wait(1) exten => #76,n,Playback(please-enter-your&extension) exten => #76,n,Read(fromext,then-press-pound) exten => #76,n,Wait(1) exten => #76,n,dbDel(ACW/${fromext}) exten => #76,n,Playback(selective-call-waiting&for&extension) exten => #76,n,SayDigits(${fromext}) exten => #76,n,Playback(cancelled) exten => #76,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Anonymous Call Rejection (*77 Activation) ;Allows Customers to reject calls from parties who have a privacy feature that prevents the delivery of their calling ;number to the called party. ;-------------------------------------------------------------------------------------------------------------------------------- [acra] exten => *77,1,Answer exten => *77,n,Wait(1) exten => *77,n,Macro(user-callerid) exten => *77,n,Set(DB(ACR/${CALLERIDNUM}=>YES) exten => *77,n,Playback(anon-call-rej&activated) exten => *77.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Do Not Disturb (*78 Activation) ;Provides the subscriber the opportunity of having all calls intercepted by the CO switch whenever the line is programmed ;for Do Not Disturb. The calling party will receive a message indicating the station is in Do Not Disturb condition. ;-------------------------------------------------------------------------------------------------------------------------------- [dnda] exten => *78,1,Answer exten => *78,n,Wait(1) exten => *78,n,Macro(user-callerid) exten => *78,n,Set(DB(DND/${CALLERIDNUM})=YES)}) exten => *78,n,Playback(do-not-disturb&activated) exten => _*82.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Do Not Disturb (*79 Deactivation) ;Provides the subscriber the opportunity of having all calls intercepted by the CO switch whenever the line is programmed for ;Do Not Disturb. The calling party will receive a message indicating the station is in Do Not Disturb condition. ;-------------------------------------------------------------------------------------------------------------------------------- [dndd] exten => *79,1,Answer exten => *79,n,Wait(1) exten => *79,n,Macro(user-callerid) exten => *79,n,DBdel(DND/${CALLERIDNUM}) exten => *79,n,Playback(do-not-disturb&de-activated) exten => *79,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Rejection (*80 Deactivation) ;Allows the subscriber to have incoming calls from a limited number of calling parties rejected by the terminating switching system. ;-------------------------------------------------------------------------------------------------------------------------------- [scrd] exten => _*80.,1,Answer exten => _*80.,n,Wait(1) exten => _*80.,n,Macro(user-callerid) exten => _*80.,n,DBdel(BLACKLIST/${CALLERID(number)}) exten => _*80.,n,Playback(blacklist-remove) exten => _*80.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Distinctive Ringing/Call Waiting (*81 Deactivation) ;Allows the subscriber to have incoming calls from a limited number of calling parties identified using distinctive alerting treatment. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Line Blocking Deactivation (*82 Deactivation) ;Line Blocking Deactivation allows a caller to dial a delivery feature access code before dialing a complete telephone number to ;temporarily override the presentation status of both the caller's directory number and the calling name. If the caller enters the ;delivery code, then the calling identity presentation status will be shown as "public" for both caller directory number and ;calling name. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Forwarding (*83 Deactivation) ;Allows the subscriber to have incoming calls from a limited number of calling parties forwarded to a prespecified remote station. ;-------------------------------------------------------------------------------------------------------------------------------- [scfd] exten => *83,1,Answer exten => *83,n,Wait(1) exten => *83,n,DBdel(SCF/${CALLERIDNUM}) exten => *83,n,Playback(selective-call-fwd) exten => *83,n,Wait(1) exten => *83,n,Playback(deactivated) exten => *83.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Selective Call Acceptance (*84 Deactivation) ;Provides the subscriber the ability to block calls from all but a predetermined list of directory numbers specified by the ;subscriber. Unaccepted callers may receive an announcement or be routed to a predetermined directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [scad] exten => *84,1,Answer exten => *84,n,Wait(1) exten => *84,n,Macro(user-callerid) exten => *84,n,DBdel(SCA/${CALLERID(number)}) exten => *84,n,Playback(selective-call-accept) exten => *84,n,Playback(de-activated) exten => *84,n,Macro(hangupcall) ; exten => *84*,1,Answer exten => *84*,n,Wait(1) exten => *84*,n,Playback(please-enter-your&extension) exten => *84*,n,Read(fromext,then-press-pound) exten => *84*,n,Wait(1) exten => *84*,n,dbDel(SCA/${fromext}) exten => *84*,n,Playback(selective-call-accept&for&extension) exten => *84*,n,SayDigits(${fromext}) exten => *84*,n,Playback(cancelled) exten => *84*,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Calling Number Delivery (*85 Deactivation) ;Provides the subscriber with the directory number (DN) of the calling party during the ringing cycle. ;-------------------------------------------------------------------------------------------------------------------------------- [cidbd] exten => *85,1,Answer exten => *85,n,Wait(1) exten => *85,n,Macro(user-callerid) exten => *85,1,DBdel(CIDB/${CALLERIDNUM}) exten => *85,n,Answer exten => *85,n,Wait(1) exten => *85,n,Playback(caller-id-blocking&de-activated) exten => *85,n,Hangup ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Automatic Callback (*86 Deactivation) ;Allows a subscriber to automatically place a call to the last station called by the subscriber when that station becomes idle. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Anonymous Call Rejection (*87 Deactivation) ;Allows Customers to reject calls from parties who have a privacy feature that prevents the delivery of their calling number ;to the called party. ;-------------------------------------------------------------------------------------------------------------------------------- [acrd] exten => *87,1,Answer exten => *87,n,Wait(1) exten => *87,n,Macro(user-callerid) exten => *87,n,DBdel(ACR/${CALLERIDNUM}) exten => *87,n,Playback(anon-call-rej) exten => *87,n,Playback(deactivated) exten => *87,n,Hangup ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Call Forwarding Busy Line/Don't Answer (*88 Deactivation) ;Allows a subscriber to forward calls intended for the subscriber's busy line, or idle line after a predetermined number of rings, ;to another directory number entered by the subscriber at the time of activation. ;-------------------------------------------------------------------------------------------------------------------------------- [cfbdad] exten => *88,1,Answer exten => *88,n,Wait(1) exten => *88,n,Macro(user-callerid) exten => *88,n,dbDel(CFBDA/${CALLERID(number)}) exten => *88,n,Playback(call-fwd-on-busy&de-activated) exten => *88,n,Macro(hangupcall) ; exten => _*88.,1,Answer exten => _*88.,n,Wait(1) exten => _*88.,n,Set(fromext=${EXTEN:3}) exten => _*88.,n,dbDel(CFB/${fromext}) exten => _*88.,n,Playback(call-fwd-on-busy&for&extension) exten => _*88.,n,SayDigits(${fromext}) exten => _*88.,n,Playback(cancelled) exten => _*88.,n,Macro(hangupcall) ; exten => #88,1,Answer exten => #88,n,Wait(1) exten => #88,n,Playback(please-enter-your&extension) exten => #88,n,Read(fromext,then-press-pound) exten => #88,n,Wait(1) exten => #88,n,dbDel(CFBDA/${fromext}) exten => #88,n,Playback(call-fwd-on-busy&for&extension) exten => #88,n,SayDigits(${fromext}) exten => #88,n,Playback(cancelled) exten => #88,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Automatic Recall (*89 Deactivation) ;Allows a subscriber to automatically place a call to the last station that called the subscriber, when that station becomes idle. ;-------------------------------------------------------------------------------------------------------------------------------- ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Customer Programmable Call Forwarding Busy Line (*90 Activation, *91 Deactivation) ;Allows subscriber of the feature to forward calls intended for the subscriber's busy line to another directory number entered ;by the subscriber at the time of activation. Deactivation will clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [cpcfba] exten => *90,1,Answer exten => *90,n,Wait(1) exten => *90,n,Playback(call-fwd-on-busy) exten => *90,n,Playback(please-enter-your&extension) exten => *90,n,Read(fromext,then-press-pound) exten => *90,n,Set(fromext=$/{IF($["foo${fromext}"="foo"]?${CALLERID(number)}:${fromext})}) exten => *90,n,Wait(1) exten => *90,n,(startread),Playback(ent-target-attendant) exten => *90,n,Read(toext,then-press-pound) exten => *90,n,GotoIf($["foo${toext}"="foo"]?startread) exten => *90,n,Wait(1) exten => *90,n,Set(DB(CPCFB/${fromext})=${toext}) exten => *90,n,Playback(call-fwd-on-busy&for&extension) exten => *90,n,SayDigits(${fromext}) exten => *90,n,Playback(is-set-to) exten => *90,n,SayDigits(${toext}) exten => *90,n,Macro(hangupcall) ; exten => _*90.,1,Answer exten => _*90.,n,Wait(1) exten => _*90.,n,Macro(user-callerid) exten => _*90.,n,Set(DB(CPCFB/${CALLERID(number)})=${EXTEN:3}) exten => _*90.,n,Playback(call-fwd-on-busy&for&extension) exten => _*90.,n,SayDigits(${CALLERID(number)}) exten => _*90.,n,Playback(is-set-to) exten => _*90.,n,SayDigits(${EXTEN:3}) exten => _*90.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Customer Programmable Call Forwarding Busy Line (*90 Activation, *91 Deactivation) ;Allows subscriber of the feature to forward calls intended for the subscriber's busy line to another directory number entered ;by the subscriber at the time of activation. Deactivation will clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [cpcfbd] exten => *91,1,Answer exten => *91,n,Wait(1) exten => *91,n,Macro(user-callerid) exten => *91,n,dbDel(CPCFB/${CALLERID(number)}) exten => *91,n,Playback(call-fwd-on-busy&de-activated) exten => *91,n,Macro(hangupcall) ; exten => _*91.,1,Answer exten => _*91.,n,Wait(1) exten => _*91.,n,Set(fromext=${EXTEN:3}) exten => _*91.,n,dbDel(CPCFB/${fromext}) exten => _*91.,n,Playback(cust-call-fwd-on-busy&for&extension) exten => _*91.,n,SayDigits(${fromext}) exten => _*91.,n,Playback(cancelled) exten => _*91.,n,Macro(hangupcall) ; exten => *91*,1,Answer exten => #91,n,Wait(1) exten => #91,n,Playback(please-enter-your&extension) exten => #91,n,Read(fromext,then-press-pound) exten => #91,n,Wait(1) exten => #91,n,dbDel(CPCFB/${fromext}) exten => #91,n,Playback(cust-call-fwd-on-busy&for&extension) exten => #91,n,SayDigits(${fromext}) exten => #91,n,Playback(cancelled) exten => #91,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Customer Programmable Call Forwarding Don't Answer (*92 Activation) ;Allows subscriber of the feature to forward calls intended for the subscriber's idle line, after a predetermined number of rings, ;to another directory number entered by the subscriber at the time of activation. Deactivation will clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [cpcfdaa] exten => *92,1,Answer exten => *92,n,Wait(1) exten => *92,n,Playback(cust-pro-call-fwd-no-ans) exten => *92,n,Playback(please-enter-your&extension) exten => *92,n,Read(fromext,then-press-pound) exten => *92,n,Set(fromext=$/{IF($["foo${fromext}"="foo"]?${CALLERID(number)}:${fromext})}) exten => *92,n,Wait(1) exten => *92,n(startread),Playback(ent-target-attendant) exten => *92,n,Read(toext,then-press-pound) exten => *92,n,GotoIf($["foo${toext}"="foo"]?startread) exten => *92,n,Wait(1) exten => *92,n,Set(DB(CPCFN/${fromext})=${toext}) exten => *92,n,Playback(call-fwd-no-ans&for&extension) exten => *92,n,SayDigits(${fromext}) exten => *92,n,Playback(is-set-to) exten => *92,n,SayDigits(${toext}) exten => *92,n,Macro(hangupcall) ; exten => _*92.,1,Answer exten => _*92.,n,Wait(1) exten => _*92.,n,Macro(user-callerid) exten => _*92.,n,Set(DB(CPCFNA/${CALLERID(number)})=${EXTEN:3}) exten => _*92.,n,Playback(call-fwd-no-ans&for&extension) exten => _*92.,n,SayDigits(${CALLERID(number)}) exten => _*92.,n,Playback(is-set-to) exten => _*92.,n,SayDigits(${EXTEN:3}) exten => _*92.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------------------------------------------------------------- ;Customer Programmable Call Forwarding Don't Answer (*93 Deactivation) ;Allows subscriber of the feature to forward calls intended for the subscriber's idle line, after a predetermined number of rings, ;to another directory number entered by the subscriber at the time of activation. Deactivation will clear the forwarded-to directory number. ;-------------------------------------------------------------------------------------------------------------------------------- [cpcfdad] exten => *93,1,Answer exten => *93,n,Wait(1) exten => *93,n,Macro(user-callerid) exten => *93,n,dbDel(CPCFNA/${CALLERID(number)}) exten => *93,n,Playback(call-fwd-no-ans&de-activated) exten => *93,n,Macro(hangupcall) ; exten => _*93.,1,Answer exten => _*93.,n,Wait(1) exten => _*93.,n,Set(fromext=${EXTEN:3}) exten => _*93.,n,dbDel(CPCFN/${fromext}) exten => _*93.,n,Playback(cust-pro-call-fwd-no-ans&for&extension) exten => _*93.,n,SayDigits($/{fromext/}) exten => _*93.,n,Playback(cancelled) exten => _*93.,n,Macro(hangupcall) ; exten => #93,1,Answer exten => #93,n,Wait(1) exten => #93,n,Playback(please-enter-your&extension) exten => #93,n,Read(fromext,then-press-pound) exten => #93,n,Wait(1) exten => #93,n,dbDel(CPCFNA/${fromext}) exten => #93,n,Playback(cust-pro-call-fwd-unconditional&for&extension) exten => #93,n,SayDigits(${fromext}) exten => #93,n,Playback(cancelled) exten => #93,n,Macro(hangupcall) ; ;------------------------------------------------------------------------------- ; *95 - Disable VoiceMail on a Line ;------------------------------------------------------------------------------- [vm-disable] exten => *95,1,Answer exten => *95,n,DBdel(VM/${CALLERIDNUM}) exten => *95,n,Wait(1) exten => *95,n,Playback(deactivated) exten => *95,n,Macro(hangupcall) ; ;------------------------------------------------------------------------------- ; *96 - Enable VoiceMail on a Line ;------------------------------------------------------------------------------- [vm-enable] exten => *96,1,Answer exten => *96,n,Set(DB(VM/${CALLERIDNUM})=YES) exten => *96,n,Wait(.5) exten => *96,n,Playback(activated) exten => *96,n,Macro(hangupcall) ; ;------------------------------------------------------------------------------- ; *97 - *98 Voicemail Checking / Retriving ;------------------------------------------------------------------------------- [voicemail] exten => *97,1,Answer exten => *97,2,Wait(1) exten => *97,3,VoiceMailMain exten => *97,4,Macro(hangupcall) ; exten => _*97X.,1,Answer exten => _*97X.,2,Wait(1) exten => _*97X.,3,VoiceMailMain(${EXTEN:3} exten => _*97X.,4,Macro(hangupcall) ; exten => *98,1,Answer exten => *98,2,Wait(1) exten => *98,3,Macro(user-callerid) exten => *98,4,VoicemailMain(${CALLERIDNUM} exten => *98,5,Macro(hangupcall) ; ;------------------------------------------------------------------ ; *99 -Login and wait for calls while offhook When calls arrive, ; You will hear a beeping tone and the caller will join automatically ;------------------------------------------------------------------ ;[offhook] exten => *99,1,Answer exten => *99,n,SetMusicOnHold(default) exten => *99,n,Wait,1 exten => *99,n,AgentLogin ; ;--------------------------------------------------------- ; */#100 - */#199 -Queue Agents Login ; Turn on=*1xx Turn off=#1xx ;---------------------------------------------------------- ;[agentlogin] exten => *100,1,AddQueueMember(sales|SIP/${CALLERIDNUM}) exten => *100,n,Playback(agent-loginok) exten => *100,n,Hangup exten => #100,1,RemoveQueueMember(sales|SIP/${CALLERIDNUM}) exten => #100,n,Playback(agent-loggedoff) exten => #100,n,Hangup ; exten => *101,1,AddQueueMember(billing|SIP/${CALLERIDNUM}) exten => *101,n,Playback(agent-loginok) exten => *101,n,Hangup exten => #101,1,RemoveQueueMember(billing|SIP/${CALLERIDNUM}) exten => #101,n,Playback(agent-loggedoff) exten => #101,n,Hangup ; exten => *102,1,AddQueueMember(techsupport|SIP/${CALLERIDNUM}) exten => *102,n,Playback(agent-loginok) exten => *102,n,Hangup exten => #102,1,RemoveQueueMember(techsupport|SIP/${CALLERIDNUM}) exten => #102,n,Playback(agent-loggedoff) exten => #102,n,Hangup ; exten => *103,1,AddQueueMember(techsupport611|SIP/${CALLERIDNUM}) exten => *103,n,Playback(agent-loginok) exten => *103,n,Hangup exten => #103,1,RemoveQueueMember(techsupport611|SIP/${CALLERIDNUM}) exten => #103,n,Playback(agent-loggedoff) exten => #103,n,Hangup ; ;-------------------------------------------------------- ;211 Community Information and Referral Services ; Available for Reassignment ;-------------------------------------------------------- [211] exten => 211,1,Macro(user-callerid) exten => 211,n,Playback(ss-noservice) exten => 211,n,Congestion exten => 211,n,Macro(hangupcall) ; ;------------------------------------------- ;311 - non-emerg not yet setup for Non Emerg ;------------------------------------------- [311] exten => 311,1,Macro(user-callerid) ;exten => 311,n,Dial(LOCAL/local non emergancy nmbr here) ;exten => 311,n,Congestion exten => 311,n,Playback(ss-noservice) exten => 311,n,Congestion exten => 311,n,Macro(hangupcall) ; ;--------------------------- ; 411 - Information services ;--------------------------- [411] ;exten => 411,1,Macro(user-callerid) ;exten => 411,n,Dial(Local/SIP/ZAP/IAX2/411,30,r) ;exten => 411,n,Congestion ;exten => 411,n,Playback(ss-noservice) ;exten => 411,n,Macro(hangupcall) ; exten => *411,1,Answer exten => *411,n,Wait(1) exten => *411,n,Goto(pbdirectory,1) exten => pbdirectory,1,AGI(pbdirectory) exten => pbdirectory,n,GotoIf($["${dialnumber}"=""]?hangup,1) exten => pbdirectory,n,Noop(Got number to dial: ${dialnumber}) exten => pbdirectory,n,Dial(Local/${dialnumber}@from-internal/n) exten => hangup,1,Hangup ; exten => #,1,Answer exten => #,n,Wait(1) exten => #,n,AGI(directory,${DIR-CONTEXT},from-did-direct,${DIRECTORY:0:1}${DIRECTORY_OPTS}) exten => #,n,Playback(vm-goodbye) exten => #,n,Hangup exten => i,1,Playback(privacy-incorrect) ; ;--------------------------------------------------------------------------- ; Create an extension, 500, for dialing the ; Digium Asterisk demo. ;--------------------------------------------------------------------------- [demo] exten => 500,1,Playback(demo-abouttotry) ; Let them know what's going on exten => 500,n,Dial(IAX2/guest@misery.digium.com/s@default) ; Call the Asterisk demo exten => 500,n,Playback(demo-nogo) ; Couldn't connect to the demo site exten => 500,n,Goto(s,6) ; Return to the start over message. ; ;--------------------------------------------------------------------------- ;511 Traffic and Transportation Information (US); Available for Reassignment ;--------------------------------------------------------------------------- [511] exten => 511,1,Macro(user-callerid) exten => 511,n,Answer exten => 511,n,Playback(ss-noservice) exten => 511,n,Macro(hangupcall) ; ;------------------------------------- ; 611 - [Repair Service / TechSupport] ;------------------------------------- [611] exten => 611,1,Macro(user-callerid) exten => 611,n,Answer exten => 611,n,GotoIfTime(*|*|1|jan?611|HOLIDAY1) exten => 611,n,GotoIfTime(*|*|4|jul?611|HOLIDAY2) exten => 611,n,GotoIfTime(*|*|11|nov?611|HOLIDAY3) exten => 611,n,GotoIfTime(*|*|22|nov?611|HOLIDAY4) exten => 611,n,GotoIfTime(*|*|25|dec?611|HOLIDAY5) exten => 611,n,Goto(611,START) exten => 611,n(HOLIDAY1),Playback(office-closed&newyears) exten => 611,n,Goto(611,HOURS)) exten => 611,n(HOLIDAY2),Playback(office-closed&4th-july) exten => 611,n,Goto(611,HOURS)) exten => 611,n(HOLIDAY3),Playback(office-closed&vetrans) exten => 611,n,Goto(611,HOURS) exten => 611,n(HOLIDAY4),Playback(office-closed&thanksgiving) exten => 611,n,Goto(611,HOURS) exten => 611,n(HOLIDAY5),Playback(office-closed&x-mas) exten => 611,n(HOURS),Playback(office-hours&vm-goodbye)) exten => 611,n,Macro(hangupcall)) exten => 611,n(CLOSED),Playback(office-closed&our-business-hours-are&office-hours) exten => 611,n,Voicemail(u611) exten => 611,n,Macro(hangupcall) exten => 611,n(START),GotoIfTime(22:00-08:00|*|*|*?611|CLOSED) exten => 611,n,Set(TIMEOUT(digit)=7) exten => 611,n,Set(TIMEOUT(response)=10) exten => 611,n,SayDigits(611) exten => 611,n,Playback(repair&and&technical-support&for-quality-purposes&this-call-may-be&recorded) exten => 611,n(ID),Playback(pls-enter-your-acct-nbr) exten => 611,n,Read(acct,then-press-pound) exten => 611,n,SayDigits(${acct}) exten => 611,n,Background(if-correct-press) exten => 611,n,SayDigits(1) exten => 611,n,Background(if-incorrect-press) exten => 611,n,SayDigits(2) exten => 611,n,Read(res,then-press-pound) exten => 611,n,GotoIf($["${res}"="1"]?ACCT:ID) exten => 611,n(ACCT),Set(CALLERID(name)=${CALLERIDNAME}) exten => 611,n,Set(CALLERID(number)=${acct}) exten => 611,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID}) exten => 611,n,SetMusicOnHold(default) exten => 611,n,GotoIfTime(08:00-17:00|mon-fri|*|*?611|DAY) exten => 611,n,GotoIfTime(17:00-22:00|mon-fri|*|*?611|NIGHT) exten => 611,n,GotoIfTime(09:00-13:00|sat|*|*?611|NIGHT) exten => 611,n,Goto(611,closed) exten => 611,n(DAY),Queue(techsupport|t|||300) exten => 611,n(VM),Voicemail(u611) exten => 611,n,Macro(hangupcall) exten => 611,n(NIGHT),Queue(611|t|||300) exten => 611,n,Goto(611,VM) ; ;---------------------------------------------------------------------------------------- ;Call Parking ;---------------------------------------------------------------------------------------- [parking] exten => 700,1,Answer exten => 700,n,SetMusicOnHold(default) exten => 700,n,ParkAndAnnounce(PARKED|60|SIP/${EXTEN}|70|4) exten => _70X,1,ParkedCall(${EXTEN}) ; ;---------------------------------------------------------------------------------------- ;711 is the national number to access relay services from anywhere in the United States. ;Dial 711 to be connected with a Relay Colorado operator. ;---------------------------------------------------------------------------------------- ; 711 - [State Relay TTY/TDD/Voice Service] ;------------------------------------------ [relay] exten => 711,1,Macro(user-callerid) ;exten => 711,n,Dial(SIP/711) ;exten => 711,n,Congestion exten => 711,n,Playback(ss-noservice) exten => 711,n,Congestion exten => 711,n,Macro(hangupcall) ; ;----------------------------------------------------------------------------- ;Access to One Call Services to Protect Pipeline and Utilities from Excavation ;Damage (US); Available for Reassignment ;----------------------------------------------------------------------------- ;811 - Reassigned to [Quick-dial TollFree Directory] ;--------------------------------------------------- [] exten => 811,1,Macro(user-callerid) exten => 811,n,Dial(SIP or IAX2/user@provider/8005551212,30,r) exten => 811,n,Hangup ; ;--------------------------------------------- ; 911 Emergancy ;--------------------------------------------- [911] exten => 911,1,Macro(user-callerid) ;exten => 911,n,Dial(SIP/${EXTEN}) ;exten => 911,n,Congestion exten => 911,n,Playback(no-911-1) exten => 911,n,Congestion exten => 911,n,Macro(hangupcall) ; ;-------------------------------------------------- ;Basic Queues Sales / Billing / Technical Support ;-------------------------------------------------- [basic-queues] ;Sales exten => 100,1,Playback(sales&for-quality-purposes&this-call-may-be-monitored-or-recorded) exten => 100,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID) exten => 100,n(USERCID),Macro(user-callerid,) exten => 100,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME}) exten => 100,n(ID),Playback(pls-enter-account) exten => 100,n,Read(acct,then-press-pound) exten => 100,n,SayDigits(${acct}) exten => 100,n,Background(if-this-is-correct-press) exten => 100,n,SayDigits(1) exten => 100,n,Background(if-this-is-incorrect-press) exten => 100,n,SayDigits(2) exten => 100,n,Read(res,then-press-pound,) exten => 100,n,GotoIf($["${res}"="1"]?ACCT:ID) exten => 100,n(ACCT),Set(CALLERID(number)=${acct}) exten => 100,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID}) exten => 100,n,Queue(100|t|||300) exten => 100,n,Voicemail(u100) ; ;Billing exten => 101,1,Playback(billing&for-quality-purposes&this-call-may-be-monitored-or-recorded) exten => 101,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID) exten => 101,n(USERCID),Macro(user-callerid,) exten => 101,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME}) exten => 101,n(ID),Playback(pls-enter-account) exten => 101,n,Read(acct,then-press-pound) exten => 101,n,SayDigits(${acct}) exten => 101,n,Background(if-this-is-correct-press) exten => 101,n,SayDigits(1) exten => 101,n,Background(if-this-is-incorrect-press) exten => 101,n,SayDigits(2) exten => 101,n,Read(res,then-press-pound,) exten => 101,n,GotoIf($["${res}"="1"]?ACCT:ID) exten => 101,n(ACCT),Set(CALLERID(number)=${acct}) exten => 101,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID}) exten => 101,n,Queue(101|t|||300) exten => 101,n,Voicemail(u101) ; ;Technical Support exten => 102,1,Playback(technical-support&for-quality-purposes&this-call-may-be-monitored-or-recorded) exten => 102,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID) exten => 102,n(USERCID),Macro(user-callerid,) exten => 102,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME}) exten => 102,n(ID),Playback(pls-enter-account) exten => 102,n,Read(acct,then-press-pound) exten => 102,n,SayDigits(${acct}) exten => 102,n,Background(if-this-is-correct-press) exten => 102,n,SayDigits(1) exten => 102,n,Background(if-this-is-incorrect-press) exten => 102,n,SayDigits(2) exten => 102,n,Read(res,then-press-pound,) exten => 102,n,GotoIf($["${res}"="1"]?ACCT:ID) exten => 102,n(ACCT),Set(CALLERID(number)=${acct}) exten => 102,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID}) exten => 102,n,Queue(102|t|||300) exten => 102,n,Voicemail(u102) ; ;------------------------------------------------------------------------------ ; Macros used by Vertical Service Codes & System ;------------------------------------------------------------------------------ [macro-user-unavail] ; Used for exten without voicemail. exten => s,1,Playback(the-party-you-are-calling) exten => s,2,Playback(is-curntly-unavail) exten => s,3,Playback(pls-try-call-later) exten => s,4,Playback(goodbye) exten => s,5,Hangup ; [macro-caller-id] ;Checks the status of inbound CallerID and directs the call. exten => s,1,System(test "${CALLERIDNAME}" = "O") exten => s,2,GotoIf($[${CALLERIDNUM} = O]?3:102) exten => s,3,SetCallerIDName("No Caller ID") exten => s,4,Macro(no-callerid,s,1) ;Sends Callers with no id to no-callerid macro below. exten => s,102,Macro(std-exten,s,12) ;landing point with caller id ; [macro-no-callerid] exten => s,1,Answer exten => s,2,Playback(no-callerid) exten => s,3,Playback(vm-goodbye) exten => s,4,Congestion exten => s,5,Hangup ; ; What to do on hangup. [macro-hangupcall] exten => s,1,ResetCDR(w) exten => s,2,NoCDR() exten => s,3,Wait(5) exten => s,4,Hangup ; ; Outgoing channel(s) are busy ... inform the client ; [macro-busy] exten => s,1,Playback(all-circuits-busy-now) exten => s,2,Playback(pls-try-call-later) exten => s,3,Macro(hangupcall) ; [macro-fixcid] exten => s,1,SetCIDName(${CALLERIDNAME}) [macro-invalid] exten => i,1,Answer exten => i,2,Playback(the-number-u-dialed,noanswer) exten => i,3,SayDigits(${ARG1}) exten => i,4,Playback(not-yet-assigned,noanswer) exten => i,4,Congestion exten => i,5,Hangup [macro-unavail-novm] exten => t,1,Playback(the-party-you-are-calling) exten => t,2,Playback(is-curntly-unavail) exten => t,3,Playback(pls-try-call-later) exten => t,4,Playback(goodbye) exten => t,5,Hangup [macro-fastCongestion] ; I use this to send people I dont want to deal with exten => s,1,Answer exten => s,2,Wait 1 exten => s,3,Playback(all-circuits-Congestion) exten => s,4,Wait(30) exten => s,5,Hangup [macro-hangupcall] exten => s,1,ResetCDR(w) exten => s,2,NoCDR() exten => s,3,Wait(5) exten => s,4,Hangup ; [macro-add-caller-id] exten => s,1,Answer exten => s,2,Read(EXTENSION|enter-extension-num|4) exten => s,3,Read(DIALCID|enter-new-outbound-cid|10) exten => s,4,Set(${DB(CID/${EXTENSION}=${DIALCID})}) exten => s,5,Saydigits(${EXTENSION}) exten => s,6,Playback(has-been-set-to) exten => s,7,Saydigits(${DIALCID}) exten => s,8,Playback(auth-thankyou) exten => s,9,Set(AGAIN=0) exten => s,10,Read(AGAIN|enter-another-value|1) ; one for yes, any other num; exten => s,11,GotoIf($[${AGAIN} = 1]?2:12) exten => s,12,Playback(goodbye) exten => s,13,Hangup() ; [macro-fax] exten => 9,1,Macro(faxreceive) ; requires fax addon and spandsp exten => h,1,System(/usr/local/share/asterisk/scripts/fax,sh "${CALLERIDNUM}" "${CALLEDFAX}" "${EXTNAME}" "${EXTEMAIL}" "${FAXFILE}" "${EXTCOMPANY}") ; [macro-faxreceive] exten => s,1,Set(FAXFILE=/var/spool/asterisk/fax/${CALLEDFAX}/${UNIQUEID}) exten => s,2,Set(${DB(EXTEMAIL=${MACRO_EXTEN}/xEmail)}); exten => s,3,NoOP() exten => s,4,Set(${DB(EXTNAME=${MACRO_EXTEN}/xName)}) exten => s,5,NoOP() exten => s,6,Set($DB(EXTCOMPANY=${MACRO_EXTEN}/xCompany)}) exten => s,7,rxfax(${FAXFILE}.tif) exten => s,103,Set(EXTMAIL=fax@company.com) exten => s,104,Goto(7) exten => s,105,Set(EXTNAME=Unknown) exten => s,106,Goto(7) exten => s,107,Set(EXTCOMPANY=Company) exten => s,108,Goto(7) ; [macro-festival]; Requiers festival to be installed and configured exten => s,1,Answer exten => s,2,Festival('') exten => s,3,Hangup ; [macro-record-on] exten => s,1,AGI(set-timestampagi) exten => s,2,Set(CALLFILENAME=${timestamp}-${ARG2}-${ARG1}) exten => s,3,Monitor(gsm,${CALLFILENAME}) ; [macro-record-cleanup] exten => s,1,GotoIf($[${CALLFILENAME} = ${NULL}]?6:2) exten => s,2,Set(CFBASE=/var/spool/asterisk/monitor/${CALLFILENAME}) ; wmix takes the two seperate wavs and mixes them into a single stream ; It is available in my wavetools rpm exten => s,3,System(/usr/bin/wmix ${CFBASE}-inwav ${CFBASE}-outwav > ${CFBASE}) exten => s,4,System(/bin/rm ${CFBASE}-inwav ${CFBASE}-outwav) ; toast compresses the wav files into a gsm file ; It is available in my gsm rpm exten => s,5,System(/usr/bin/toast -F ${CFBASE}) exten => s,6,NoOp ; ;Pulled From Freepbx. ; This macro is for dev purposes and just dumps channel/app variables. Useful when designing new contexts. [macro-dumpvars] exten => s,1,Noop(ACCOUNTCODE=${ACCOUNTCODE}) exten => s,2,Noop(ANSWEREDTIME=${ANSWEREDTIME}) exten => s,3,Noop(BLINDTRANSFER=${BLINDTRANSFER}) exten => s,4,Noop(CALLERID=${CALLERID}) exten => s,5,Noop(CALLERIDNAME=${CALLERIDNAME}) exten => s,6,Noop(CALLERIDNUM=${CALLERIDNUM}) exten => s,7,Noop(CALLINGPRES=${CALLINGPRES}) exten => s,8,Noop(CHANNEL=${CHANNEL}) exten => s,9,Noop(CONTEXT=${CONTEXT}) exten => s,10,Noop(DATETIME=${DATETIME}) exten => s,11,Noop(DIALEDPEERNAME=${DIALEDPEERNAME}) exten => s,12,Noop(DIALEDPEERNUMBER=${DIALEDPEERNUMBER}) exten => s,13,Noop(DIALEDTIME=${DIALEDTIME}) exten => s,14,Noop(DIALSTATUS=${DIALSTATUS}) exten => s,15,Noop(DNID=${DNID}) exten => s,16,Noop(EPOCH=${EPOCH}) exten => s,17,Noop(EXTEN=${EXTEN}) exten => s,18,Noop(HANGUPCAUSE=${HANGUPCAUSE}) exten => s,19,Noop(INVALID_EXTEN=${INVALID_EXTEN}) exten => s,20,Noop(LANGUAGE=${LANGUAGE}) exten => s,21,Noop(MEETMESECS=${MEETMESECS}) exten => s,22,Noop(PRIORITY=${PRIORITY}) exten => s,23,Noop(RDNIS=${RDNIS}) exten => s,24,Noop(SIPDOMAIN=${SIPDOMAIN}) exten => s,25,Noop(SIP_CODEC=${SIP_CODEC}) exten => s,26,Noop(SIPCALLID=${SIPCALLID}) exten => s,27,Noop(SIPUSERAGENT=${SIPUSERAGENT}) exten => s,28,Noop(TIMESTAMP=${TIMESTAMP}) exten => s,29,Noop(TXTCIDNAME=${TXTCIDNAME}) exten => s,30,Noop(UNIQUEID=${UNIQUEID}) exten => s,31,Noop(TOUCH_MONITOR=${TOUCH_MONITOR}) exten => s,32,Noop(MACRO_CONTEXT=${MACRO_CONTEXT}) exten => s,33,Noop(MACRO_EXTEN=${MACRO_EXTEN}) exten => s,34,Noop(MACRO_PRIORITY=${MACRO_PRIORITY}) ; ;------------------------------------------------------------------------ ; This is where all calls go that don't have any other destination provided ;------------------------------------------------------------------------ [invalid-number] exten => _X.,1,Wait(1) exten => _X.,n,Playback(silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer) exten => _X.,n,Wait(1) exten => _X.,n,Congestion(20) exten => _X.,n,Hangup() ; [invalid-feature] exten => _*.,1,Wait(1) exten => _*.,n,Playback(silence/1&feature-not-avail-line&silence/1&cannot-complete-as-dialed&check-number-dial-again,noanswer) exten => _*.,n,Wait(1) exten => _*.,n,Congestion(20) exten => _*.,n,Macro(hangupcall) ; ;-------------------------------------------------------------------------- ;Applications ;-------------------------------------------------------------------------- [app-blackhole] include => app-blackhole-custom exten => hangup,1,Noop(Blackhole Dest: Hangup) exten => hangup,n,Hangup exten => zapateller,1,Noop(Blackhole Dest: Play SIT Tone) exten => zapateller,n,Answer exten => zapateller,n,Zapateller() exten => musiconhold,1,Noop(Blackhole Dest: Put caller on hold forever) exten => musiconhold,n,Answer exten => musiconhold,n,MusicOnHold() exten => congestion,1,Noop(Blackhole Dest: Congestion) exten => congestion,n,Answer exten => congestion,n,Playtones(congestion) exten => congestion,n,Congestion(20) exten => congestion,n,Hangup exten => busy,1,Noop(Blackhole Dest: Busy) exten => busy,n,Answer exten => busy,n,Playtones(busy) exten => busy,n,Busy(20) exten => busy,n,Hangup ; ;------------------------------------------------------------ ; Disa using voicemail passowords via agi ;------------------------------------------------------------ [app-disa] exten => s,1,Macro(user-callerid,) exten => s,n,Set(LOOPCOUNT=0) exten => s,n,Answer exten => s,n,Wait(1) exten => s,n(begin),Set(TIMEOUT(digit)=7) exten => s,n,Set(TIMEOUT(response)=10) exten => s,n,Playback(please-enter-the&extension) exten => s,n,Read(ext_num,then-press-pound,,) exten => s,n,Wait(1) exten => s,n,Playback(pls-enter-vm-password) exten => s,n,Read(ext_pwd,then-press-pound,,) exten => s,n,Wait(1) exten => s,n,AGI(chk_vm_pwd.agi|/etc/asterisk/voicemail.conf|${ext_num}|${ext_pwd}) exten => s,n,GotoIf($["${result}" = "0"]?custom-disa,s,D:custom-disa,i,1) exten => s,n,Set(CALLERIDNUM=${ext_num}) exten => s,n(D),DISA(no-password|from-internal) exten => h,1,Hangup exten => i,1,Playback(invalid) exten => i,n,Goto(loop,1) exten => t,1,Goto(loop,1) exten => loop,1,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1]) exten => loop,n,GotoIf($[${LOOPCOUNT} > 2]?hang,1) exten => loop,n,Goto(custom-disa,s,begin) exten => hang,1,Playback(vm-goodbye) exten => hang,n,Hangup ; ;---------------------------------------------------------------- ; Make a wish Hotline for Special Kids in Need... ;---------------------------------------------------------------- [make-a-wish] exten = NXXXXXX,1,Goto(app-wish-record,s,1) exten = NXXXXXX,1,Goto(app-wish-playback,s,1) ; [app-wish-record] exten = s,1,Ringing exten = s,2,Wait(4) exten = s,3,Answer exten = s,4,Playback(wish-welcome) exten = s,5,Set(${DB(MessageCount=wish/${CALLERIDNUM})}) exten = s,6,Set(${DB(MessageCount=$[${MessageCount} + 1])}) exten = s,7,Set(${DB(wish/${CALLERIDNUM}=${MessageCount})}) exten = s,8,Record(wish/${CALLERIDNUM}-${MessageCount}:ulaw|10|60) exten = s,9,Playback(wish-done) exten = s,10,Hangup exten = s,106,Set(${DB(MessageCount=1)}) exten = s,107,Goto(s,7) ; [app-wish-playback] exten = s,1,Ringing exten = s,2,Wait(4) exten = s,3,Answer exten = s,4,Set(${DB(MessageCount=wish/${CALLERIDNUM})}) exten = s,5,Set(${DB(CurrentMessage=1)}) exten = s,6,Playback(wish-recorded) exten = s,7,Playback(wish/${CALLERIDNUM}-${CurrentMessage}) exten = s,8,Set(${DB(CurrentMessage=$[${CurrentMessage} + 1])}) exten = s,9,GotoIf(${DB([${CurrentMessage} ${MessageCount}]?12:10)}) exten = s,10,Playback(beep) exten = s,11,Goto(s,7) exten = s,12,Playback(wish-goodbye) exten = s,13,Hangup exten = s,105,Playback(wish-notrecorded) exten = s,106,Hangup ; ------------------------------------------------------------------------------- ; Pront recording and and special prompt recording + enable disable ;------------------------------------------------------------------------------- [prompts] exten => *00*,1,Goto(prompt-management,s,1) exten => *01*,1,Goto(special-message,s,1) ;----------------------------------------------------- ; Prompt management used for IVR prompt recording. ;----------------------------------------------------- ; Flexible prompt recording ;----------------------------------------------------- [prompt-management] ; exten => s,1,Answer exten => s,n,Wait(1) exten => s,n,DigitTimeout(5) exten => s,n,Read(PROMPT_NUMBER|enter-prompt-number|3) exten => s,n,SayDigits(${PROMPT_NUMBER}) exten => s,n,BackGround(T-to-hear-cur-ancmnt) exten => s,n,BackGround(press-1) exten => s,n,BackGround(T-to-rec-ancmnt) exten => s,n,BackGround(press-2) ; exten => t,1,Playback(goodbye) exten => t,n,Hangup ; exten => i,1,Playback(pbx-invalid) exten => i,n,Goto(s,5) ; exten => 1,1,Playback(beep) exten => 1,n,Playback(bsky-prompt-${PROMPT_NUMBER}) exten => 1,n,Playback(beep) exten => 1,n,Goto(s,6) ; exten => 2,1,Goto(prompt-management-record,s,1) exten => **,1,Playback(goodbye) exten => **,n,Hangup ; [prompt-management-record] ; New prompt recording exten => s,1,Playback(vm-intro) exten => s,n,Record(tmp-newprompt:wav) exten => s,n,Playback(beep) exten => s,n,BackGround(tmp-newprompt) exten => s,n,BackGround(save-announce-press) exten => s,n,BackGround(digits/1) exten => s,n,BackGround(to-rerecord-announce) exten => s,n,BackGround(digits/2) ; exten => i,1,Playback(invalid) exten => i,n,Goto(s,3) ; exten => t,1,Goto(s,3) ; exten => 1,1,System(cp -f /usr/local/share/asterisk/sounds/tmp-newprompt.wav /usr/local/share/asterisk/sounds/prompt-${PROMPT_NUMBER}.wav) exten => 1,n,Playback(your-msg-has-been-saved) exten => 1,n,Goto(app-prompt-management,s,4) ; exten => 2,1,Goto(s,1) ; exten => *,1,Goto(app-prompt-management,s,4) ; ;------------------------------------------------------- ; Special announcement admin (Easy IVR) ;------------------------------------------------------- ; Record/replay/turn on/off the special message ; played before ACD queue calls ;------------------------------------------------------- [special-message] ; exten => s,1,Answer exten => s,n,Wait(1) exten => s,n,DigitTimeout(5) exten => s,n,BackGround(T-to-hear-cur-ancmnt) exten => s,n,BackGround(press-1) exten => s,n,BackGround(T-to-rec-ancmnt) exten => s,n,BackGround(press-2) exten => s,n,BackGround(T-to-enable-ancmnt) exten => s,n,BackGround(press-3) exten => s,n,BackGround(T-to-disable-ancmnt) exten => s,n,BackGround(press-4) ; exten => t,1,Playback(goodbye) exten => t,2,Hangup ; exten => i,1,Playback(pbx-invalid) exten => i,2,Goto(s,4) ; exten => 1,1,Playback(special-message) exten => 1,2,Goto(s,4) ; exten => 2,1,Goto(special-message-record,s,1) ; exten => 3,1,Set($DB(SpecialMessage/1=1)}) exten => 3,n,Playback(enabled) exten => 3,n,Goto(s,4) ; exten => 4,1,DBdel(SpecialMessage/1) exten => 4,n,Playback(disabled) exten => 4,n,Goto(s,4) ; exten => *,1,Playback(goodbye) exten => *,2,Hangup ; [special-message-record] ; Record the new special message exten => s,1,Playback(vm-intro) exten => s,n,Record(new-special-message:wav) exten => s,n,Playback(beep) exten => s,n,BackGround(new-special-message) exten => s,n,BackGround(save-announce-press) exten => s,n,BackGround(digits/1) exten => s,n,BackGround(to-rerecord-announce) exten => s,n,BackGround(digits/2) exten => i,1,Playback(invalid) exten => i,n,Goto(s,3) ; exten => t,1,Goto(s,3) ; exten => 1,1,System(cp -f /usr/local/share/asterisk/sounds/new-special-message.wav /usr/local/share/asterisk/sounds/special-message.wav) exten => 1,n,Playback(your-msg-has-been-saved) exten => 1,n,Goto(app-special-message,s,1) ; exten => 2,1,Goto(s,1) ; exten => *,1,Goto(special-message,s,1) ; [macro-check-special-message] ; If the flag is set, play the special message, otherwise continue exten => s,1,Set(${DB(SpecialMessage=SpecialMessage/1)}) exten => s,2,Playback(system-status-msg) exten => s,3,Playback(special-message) exten => s,4,Ringing exten => s,5,Wait(4) exten => s,102,Noop ; ;---------------------------------------------------------------------------------- ; Start Dundi-e164 Setup ;---------------------------------------------------------------------------------- ;[dundi-e164-customers] ; ; If you are an ITSP or Reseller, list your customers here ; ;exten => _12564286000,1,Dial(SIP/customer1) ;exten => _12564286001,1,Dial(IAX2/customer2) ; ;[dundi-e164-via-pstn] ; ; If you are freely delivering calls to the PSTN, list them here ; ;exten => _1256428XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Expose all of 256-428 ;exten => _1256325XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Ditto for 256-325 ; [dundi-e164-local] ; ; Context to put your dundi IAX2 or SIP user in for ; full access ; ;include => dundi-e164-canonical ;include => dundi-e164-customers ;include => dundi-e164-via-pstn ; ;[dundi-e164-switch] ; ; Just a wrapper for the switch ; ;switch => DUNDi/e164 ; ;[dundi-e164-lookup] ; ; Locally to lookup, try looking for a local E164 solution ; then try DUNDi if we don't have one ; ;include => dundi-e164-local ;include => dundi-e164-switch ; ; DUNDi can also be implemented as a Macro instead of using ; the Local channel driver ; ;[macro-dundi-e164] ; ; ARG1 is the extension to Dial ; ;exten => s,1,Goto(${ARG1},1) ;include => dundi-e164-lookup ; ;--------------------------------------------------------- ; enum lookup serveice ;---------------------------------------------------------- [Enum164e] ; Home telephone from E164org lookup ;exten => 15552556690,1,Dial(${HOMEPHONES},20) ;exten => 15552556690,2,Voicemail2(u44) ;exten => 15552556690,3,HangUp ; ; Business Line from E164org lookup ;exten => 15552553925,1,Dial(${WORKPHONES},20) ;exten => 15552553925,2,Voicemail(u21) ;exten => 15552553925,3,HangUp ; ;[internal] ;exten => _XXXNXXXXXX,1,Macro(enum-call,localcall,1${EXTEN}) ;exten => _1604NXXXXXX,1,Macro(enum-call,localcall,${EXTEN}) ;exten => _011XXXXNXXXXXX,1,Macro(enum-call,localcall,${EXTEN:3}) ;exten => _0111NXXNXXXXXX,1,Macro(enum-call,NA,${EXTEN:3}) ;exten => _NXXNXXXXXX,1,Prefix(1) ;exten => _1NXXNXXXXXX,1,Macro(enum-call,NA,${EXTEN}) ;exten => _011X,1,Macro(enum-call,international,${EXTEN:3}) ; ;[macro-enum-call] ;exten => s,1,SetCallerID(1XXX5551212) ;exten => s,2,EnumLookup(${ARG2}) ;exten => s,53,Goto(${ARG1},${ARG2},1) ;exten => s,103,Goto(${ARG1},${ARG2},1) ;exten => s,3,GotoIf($[$[${ENUM:0:3} = SIP] | $[${ENUM:0:3} = IAX]]?4:5) ;exten => s,4,Dial(${ENUM}) ;exten => s,5,Goto(${ARG1},${ARG2},1) ;exten => s,105,Goto(${ARG1},${ARG2},1) ;--------------------------------------------------------------------------- ;------------------------------------------------------------- ;system agi's These agis need to be chowned and chmoded ; and copied to the agi-bin dir ;------------------------------------------------------------- chk_vm_pwd.agi for disa --------------------cut here ------------------------------------------ #!/usr/bin/perl # AGI script that searchs for a match on an extension and password in # a voicemail.conf file # # Parameters: | | # # use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); # Set variables according to supplied arquments # Variables sanitation is not an issue as it is being run from extentions.conf $vmconf = $ARGV[0]; $exten = $ARGV[1]; $pwd = $ARGV[2]; # Open VoiceMail configuration file read only open VMCONF, "<$vmconf"; @vmconf_lines = ; close VMCONF; &error_msg("Cannot open $vmconf file read only.") if $#vmconf_lines eq -1; foreach (@vmconf_lines){ next if $_ !~ /^\d/; $_ =~ s/\s//iog; $_ =~ s/=>/=/iog; $_ =~ s/=/\,/; (@line_args) = split(/\,/, $_); if ($exten eq $line_args[0]){ # We got the right extension if ($pwd eq $line_args[1]){ # User provided the right pwd $AGI->set_variable('result','0'); } else { # Wrong password - bye! $AGI->set_variable('result','1'); } } } exit; sub error_msg() { my($err_msg) = @_; $AGI->verbose($err_msg); $AGI->hangup(); die $err_msg; } ----------------------------------------------------------------------------- chk_chanspy_pwd.agi --------------------cut here ------------------------------------------ #!/usr/bin/perl # AGI script that searchs for a match on an extension and password in # a chanspy.conf file # # Parameters: | | # # use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); # Set variables according to supplied arquments # Variables sanitation is not an issue as it is being run from extentions.conf $csconf = $ARGV[0]; $exten = $ARGV[1]; $pwd = $ARGV[2]; # Open chanspy configuration file read only open CSCONF, "<$csconf"; @csconf_lines = ; close CSCONF; &error_msg("Cannot open $csconf file read only.") if $#csconf_lines eq -1; foreach (@csconf_lines){ next if $_ !~ /^\d/; $_ =~ s/\s//iog; $_ =~ s/=>/=/iog; $_ =~ s/=/\,/; (@line_args) = split(/\,/, $_); if ($exten eq $line_args[0]){ # We got the right extension if ($pwd eq $line_args[1]){ # User provided the right pwd $AGI->set_variable('result','0'); } else { # Wrong password - bye! $AGI->set_variable('result','1'); } } } exit; sub error_msg() { my($err_msg) = @_; $AGI->verbose($err_msg); $AGI->hangup(); die $err_msg; } ;-----------------------end---cut----------------------------- ; ;wakeup.php #!/usr/bin/php -q '; // Set to 1 to use the Channel // Set to 0 for Caller ID, Caller IS is assumed just a number ### or "Name Name" <##> // The big difference is using caller ID will call ANY phone with that extension number // Where using Channel will only wake up the one specific phone $parm_chan_ext = 0; // ---------------------------------------------------- // Which application to run when the call is connected. //$parm_application =""; //$parm_application = 'MusicOnHold'; //$parm_data = 'wakeconfirm.agi'; // -- Use this for the ANNOY application $parm_application = 'AGI'; $parm_data = 'wakeconfirm.agi'; // ---------------------------------------------------- //------------------- // END CONFIG PARMS //------------------- GLOBAL $stdin, $stdout, $stdlog, $result, $parm_debug_on, $parm_test_mode; // These setting are on the WIKI pages http://www.voip-info.org ob_implicit_flush(false); set_time_limit(30); error_reporting(0); $stdin = fopen( 'php://stdin', 'r' ); $stdout = fopen( 'php://stdout', 'w' ); // You will see a whole bunch of this its for development or if you change anything and // want to write to a log file in the TMP directory if ($parm_debug_on) { $stdlog = fopen( $parm_error_log, 'w' ); fputs( $stdlog, "---Start---\n" ); } // ASTERISK * Sends in a bunch of variables, This accepts them and puts them in an array // http://www.voip-info.org/tiki-index.php?page=Asterisk%20AGI%20php while ( !feof($stdin) ) { $temp = fgets( $stdin ); if ($parm_debug_on) fputs( $stdlog, $temp ); // Strip off any new-line characters $temp = str_replace( "\n", "", $temp ); $s = explode( ":", $temp ); $agivar[$s[0]] = trim( $s[1] ); if ( ( $temp == "") || ($temp == "\n") ) { break; } } // There are two ways to contact a phone, by its channel or by its local // extension number. This next session will extract both sides // split the Channel SIP/11-3ef4 or Zap/4-1 into is components $channel = $agivar[agi_channel]; if (preg_match('.^([a-zA-Z]+)/([0-9]+)([0-9a-zA-Z-]*).', $channel, $match) ) { $sta = trim($match[2]); $chan = trim($match[1]); } // Go Split the Caller ID into its components $callerid = $agivar[agi_callerid]; // First look for the Extension in <####> if (preg_match('/<([ 0-9]+)>/', $callerid, $match) ) { $cidn = trim($match[1]); } else // Did not find the <##...> look for the first number in the string to use as CID { if (preg_match('/([0-9]+)/', $callerid, $match) ) { $cidn = trim($match[1]); } else $cidn = -1; // I'm saying an error no caller id # found } // Check if we have an outstanding Wakeup Call file if ( $parm_chan_ext ) $dir_check = "$chan.$sta.call"; else $dir_check = "ext.$cidn.call"; if ($parm_debug_on) fputs( $stdlog, "Checking Directory [$parm_call_dir] Check=[$dir_check]\n" ); // I started to think we could have many outstanding wakup calls, but then // it got very confusing on how to delete just one of them. I wasn't about // to prompt each and every one. So I went back to JUST ONE wakeup call // But this will get a list of all of them incase of problems $outc=0; $dir_handle = opendir( $parm_call_dir ); while( $file = readdir($dir_handle ) ) { if ($parm_debug_on) fputs( $stdlog, "File=$file\n" ); // Check if we have an outstanding wakup call if (strstr( $file, $dir_check ) ) $out[$outc++] = $file; } closedir( $dir_handle ); //========================================================================= // This is where we interact with the caller. Answer the phone and so on //========================================================================= $rc = execute_agi( "ANSWER "); sleep(1); // Wait for the channel to get created and RTP packets to be sent // On my system the welcome you would only hear 'elcome' So I paused for 1 second if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE welcome \"\" "); // They have an outstanding wakup call if ( $outc ) { $i = 0; while ( $out[$i] ) { $wtime = strtok( $out[$i], '.' ); if ($parm_debug_on) fputs( $stdlog, "wakeup found=$out[0] saying time $wtime\n" ); say_wakeup( $wtime ); $i++; } } // Check if any outstanding wakeup calls if ( $outc ) { // Start prompting them if they want to create or delete a wakeup call while ( !$rc[result] ) { if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE for-wakeup-call \"12\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE press-1 \"12\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE to-cancel-wakeup \"12\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE press-2 \"12\" "); if ( !$rc[result] ) { $rc = execute_agi( "WAIT FOR DIGIT 15000"); } if ( $rc[result] != -1 ) { if ( $rc[result] == 49 || $rc[result] == 50 ) { ; // Do nothing } else { // This was just for fun, if they press something other than 1 or 2 $rc[result] = 0; $rc = execute_agi( "STREAM FILE you-dialed-wrong-number \"\" "); $rc = execute_agi( "STREAM FILE wrong-try-again-smarty \"\" "); } } } } else // Default to Creating a wakeup call $rc[result] = '49'; // Process which key they pressed // I check most of my Return Codes incase the call is hung up // // Being a phone person, I want to be able to skip the prompts, so I allow for entry over // The prompts. Makes for more code, but make for quicker entry after you know what to key // switch( $rc[result] ) { case '49': // Pressed 1 - This is to schedule a NEW wakeup call { $rc[result] = 0; while ( !$rc[result] ) { $rc = execute_agi( "STREAM FILE please-enter-the \"0123456789\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE time \"0123456789\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE for \"0123456789\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE your \"0123456789\" "); // If we get here, they haven't pressed anything yet. if ( !$rc[result] ) $rc = execute_agi( "GET DATA wakeup-call 5000 4"); if ( $rc[result] != -1 ) { if ($parm_debug_on) fputs( $stdlog, "We have num digits:" . strlen( $rc[result]) . "- $rc[result] \r\n\r\n" ); // This check how many digits, if 2 then they pre-pressed a digit, // Otherwise it will be 4 if ( strlen( $rc[result] ) == 2 ) { $num= $rc[result]-48; while ( strlen($num) < 4 && $rc[result] > 0 ) { $rc = execute_agi( "WAIT FOR DIGIT 15000"); if ( $rc[result] >= 48 && $rc[result] <= 57 ) $num .= $rc[result] - 48; else $rc[result] = 0; } if (strlen($num) == 4 ) $rc[result] = $num; } if ($parm_debug_on) fputs( $stdlog, "Checking Results [$rc[result]] \r\n\r\n" ); // They entered 4 digits, check if its a valid time or they hung up if ( $rc[result] > 2359 || strlen( $rc[result]) < 3 || substr($rc[result],2,2) > 59 || $rc[result] < 0) { $rc[result] = 0; //$rc = execute_agi( "STREAM FILE invalid \"\" "); //$rc = execute_agi( "STREAM FILE time \"\" "); $rc = execute_agi( "STREAM FILE please-try-again \"\" "); } if (strlen( $rc[result] ) == 4 && $rc[result] == 0 ) $rc[result] = -2; // Special 00:00 time } } if ( $rc[result] == -2 ) $rc[result] = '0000'; else if ( $rc[result] == -1 ) exit; // The user hung up // Save the time entered $wtime = $rc[result]; // We don't know who the user is, so if its less than 1300 it could be AM or PM, so prompt // them for am pm if ( $wtime != -1 && $wtime < 1300 ) { $rc[result] = 0; while ( !$rc[result] ) { if ( !$rc[result] ) $rc = execute_agi( "GET DATA 1-for-am-2-for-pm 15000 1"); } switch( $rc[result] ) { case '1': // Set to AM should be under 1159 or less if ( $wtime > 1159 ) $wtime -= 1200; $rc[result] = 0; break; case '2': // Set to PM should be equal or over 1200 if ( $wtime < 1159 ) $wtime += 1200; $rc[result] = 0; break; } } // At this point we have a millitary time in the $wtime variable if ( $parm_chan_ext ) { $wakefile = "$parm_temp_dir/$wtime.$chan.$sta.call"; $callfile = "$parm_call_dir/$wtime.$chan.$sta.call"; } else { $wakefile = "$parm_temp_dir/$wtime.ext.$cidn.call"; $callfile = "$parm_call_dir/$wtime.ext.$cidn.call"; } if ($parm_debug_on) fputs( $stdlog, "Wakeup File [$wakefile]\n" ); // Open up a wakeup file to write it out. $wuc = fopen( $wakefile, 'w'); if ( $wuc ) { // Delete any old Wakeup call files this one will override for ($i=0; $i < $outc; $i++ ) { if( file_exists( "$parm_call_dir/$out[$i]" ) ) { if ($parm_debug_on) fputs( $stdlog, "Unlinking Old File [$parm_call_dir/$out[$i]]\n" ); unlink( "$parm_call_dir/$out[$i]" ); } } // I've noticed that the other WAKEUP example has a different format. This worked for me // Here is where we either make the call to the Extension or the Channel. Extension // is the better way to go, but required the caller ID information. Where Channel // should always get you back to where you were called from, provided its on your system if ( $parm_chan_ext ) fputs( $wuc, "channel: $chan/$sta\n" ); else fputs( $wuc, "channel: Local/$cidn@$agivar[agi_context]\n" ); fputs( $wuc, "maxretries: $parm_maxretries\n"); fputs( $wuc, "retrytime: $parm_retrytime\n"); fputs( $wuc, "waittime: $parm_waittime\n"); fputs( $wuc, "callerid: $parm_wakeupcallerid\n"); fputs( $wuc, "application: $parm_application\n"); fputs( $wuc, "data: $parm_data\n"); fclose( $wuc ); $w = getdate(); $w['hours'] = substr( $wtime, 0, 2 ); $w['minutes'] = substr( $wtime, 2, 2 ); $time_wakeup = mktime( substr( $wtime, 0, 2 ), substr( $wtime, 2, 2 ), 0, $w[mon], $w[mday], $w[year] ); $time_now = time( ); if ($parm_debug_on) fputs( $stdlog, 'time_wakeup=' . date('l dS \of F Y h:i:s A', $time_wakeup) . " ($time_wakeup) | time_now=" . date('l dS \of F Y h:i:s A',$time_now) . " ($time_now)\n" ); if ( $time_wakeup <= $time_now ) $time_wakeup += 86400; // Add One Day on if ($parm_debug_on) fputs( $stdlog, 'Setting WAKEUP file to =' . date('l dS \of F Y h:i:s A', $time_wakeup) . " - $time_wakeup\n" ); touch( $wakefile, $time_wakeup, $time_wakeup ); rename( $wakefile, $callfile ); } else { // Couldn't open the file. Make sure you created the /var/lib/asterisk/wakeups directory if ($parm_debug_on) fputs( $stdlog, "Error opening file [$wakefile]\n" ); $rc = execute_agi( "STREAM FILE something-terribly-wrong \"\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE goodbye \"\" "); if ( !$rc[result] ) $rc = execute_agi( "HANGUP"); exit; } // If we have a caller ID and waking up by extension say the extension number if ( $cidn && $parm_chan_ext == 0 ) { $rc = execute_agi( "STREAM FILE for \"\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE extension \"\" "); if ( !$rc[result] ) $rc = execute_agi( "SAY DIGITS $cidn \"\" "); } say_wakeup( $wtime ); $rc[result] = 0; } break; // This is the END Of a new wakeup call case '50': // Pressed 2 - Delete old wakeup calls { // Go through the list of old files and unlink/delete them for ($i=0; $i < $outc; $i++ ) { if( file_exists( "$parm_call_dir/$out[$i]" ) ) { if ($parm_debug_on) fputs( $stdlog, "Unlinking Wakeup File [$parm_call_dir/$out[$i]]\n" ); unlink( "$parm_call_dir/$out[$i]" ); } } // If Caller ID and recording by Extension then say the extension if ( $cidn && $parm_chan_ext == 0 ) { $rc = execute_agi( "STREAM FILE for \"\" "); if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE extension \"\" "); $L = strlen( $cidn ); for( $i = 0; $i < $L && !$rc[result]; $i++ ) { $cid_digits = substr( $cidn, $i, 1 ); if ( !$rc[result] ) $rc = execute_agi( "SAY NUMBER $cid_digits \"\" "); } } $rc = execute_agi( "STREAM FILE wakeup-call-cancelled \"\" "); } break; } if ( !$rc[result] ) $rc = execute_agi( "STREAM FILE goodbye \"\" "); if ( !$rc[result] ) $rc = execute_agi( "HANGUP"); if ($parm_debug_on) fclose($stdlog); exit; } // ---------------------------------------------- // This will say military time in AM/PM format // ---------------------------------------------- function say_wakeup( $wtime ) { GLOBAL $stdin, $stdout, $stdlog, $parm_debug_on; $pm = 0; if ($wtime > 1159 ) { $wtime -=1200; $pm = 1; } if ($wtime <= 59 ) $wtime += 1200; if ( strlen( $wtime ) == 3 ) $wtime = '0' . $wtime; $h = substr( $wtime, 0, 2 ); $h1 = substr( $wtime, 0, 1 ); $h2 = substr( $wtime, 1, 1 ); $m = substr( $wtime, 2, 2 ); $m1 = substr( $wtime, 2, 1); $m2 = substr( $wtime, 3, 1); if ($parm_debug_on) fputs( $stdlog, "Wakeup time is set to $wtime\n" ); $rc = execute_agi( "STREAM FILE rqsted-wakeup-for \"\" "); if ( !$rc[result] ) { if ( $h1 == 0 ) $rc = execute_agi( "SAY NUMBER $h2 \"\""); else $rc = execute_agi( "SAY NUMBER $h \"\""); if ( !$rc[result] ) { if ($m == 0 ) $rc = execute_agi( "STREAM FILE digits/oclock \"\" "); else { if ( $m1 == 0 ) { $rc = execute_agi( "STREAM FILE digits/oh \"\" "); $rc = execute_agi( "SAY NUMBER $m2 \"\" "); } else $rc = execute_agi( "SAY NUMBER $m \"\""); } if ( !$rc[result] ) { if ( $pm ) $rc = execute_agi( "STREAM FILE digits/p-m \"\" "); else $rc = execute_agi( "STREAM FILE digits/a-m \"\" "); } } } } //-------------------------------------------------- // This function will send out the command and get // the response back //-------------------------------------------------- function execute_agi( $command ) { GLOBAL $stdin, $stdout, $stdlog, $parm_debug_on; fputs( $stdout, $command . "\n" ); fflush( $stdout ); if ($parm_debug_on) fputs( $stdlog, $command . "\n" ); $resp = fgets( $stdin, 4096 ); if ($parm_debug_on) fputs( $stdlog, $resp ); if ( preg_match("/^([0-9]{1,3}) (.*)/", $resp, $matches) ) { if (preg_match('/result=([-0-9a-zA-Z]*)(.*)/', $matches[2], $match)) { $arr['code'] = $matches[1]; $arr['result'] = $match[1]; if (isset($match[3]) && $match[3]) $arr['data'] = $match[3]; return $arr; } else { if ($parm_debug_on) fputs( $stdlog, "Couldn't figure out returned string, Returning code=$matches[1] result=0\n" ); $arr['code'] = $matches[1]; $arr['result'] = 0; return $arr; } } else { if ($parm_debug_on) fputs( $stdlog, "Could not process string, Returning -1\n" ); $arr['code'] = -1; $arr['result'] = -1; return $arr; } } ?> ;---------------------------------------------------------------- ;wakeconfirm.agi ;---------------------------------------------------------------- #!/usr/bin/perl # YAWA - Yet another wakeup agi # use Asterisk::AGI; use Date::Manip; use strict; # Configuration my $pending_dir = "/var/spool/asterisk/wakeups/"; my $local_context = 'wakeup-call'; my $local_extension = '*62'; my $local_priority = 1; my $callerid = "Wakeup Call <*62>"; my $maxretries = 3; my $retrytime = 60; my $waittime = 24; my $input = "0"; # Start agi and get the needed variables my $agi = new Asterisk::AGI; my %stuff = $agi->ReadParse; my ($channel) = $stuff{channel}; $channel =~ s/-.*//; my($chan, $caller) = split(/\//, $channel); my $uniqueid = $stuff{uniqueid}; # Play menu till we get some input. while (!$input) { if(!$input) { $input = $agi->stream_file('this-is-yr-wakeup-call', '1234'); } if(!$input) { $input = $agi->stream_file('to-cancel-wakeup', '1234'); } if(!$input) { $input = $agi->stream_file('press-1', '1234'); } if(!$input) { $input = $agi->stream_file('to-snooze-for', '1234'); } if(!$input) { $input = $agi->stream_file('digits/5', '1234'); } if(!$input) { $input = $agi->stream_file('minutes', '1234'); } if(!$input) { $input = $agi->stream_file('press-2', '1234'); } if(!$input) { $input = $agi->stream_file('to-snooze-for', '1234'); } if(!$input) { $input = $agi->stream_file('digits/10', '1234'); } if(!$input) { $input = $agi->stream_file('minutes', '1234'); } if(!$input) { $input = $agi->stream_file('press-3', '1234'); } if(!$input) { $input = $agi->stream_file('to-snooze-for', '1234'); } if(!$input) { $input = $agi->stream_file('digits/15', '1234'); } if(!$input) { $input = $agi->stream_file('minutes', '1234'); } if(!$input) { $input = $agi->stream_file('press-4', '1234'); } } $input = $input - 48; # stream file returns ascii val # ask the user a math question to verify they're awake if ($input == 1) { $agi->exec('background', 'answer-math'); $agi->exec('wait', '1'); my $num1 = int(rand 99); my $num2 = int(rand 99); my $num3 = $num1 + $num2; $agi->say_number($num1); $agi->exec('background', 'plus'); $agi->say_number($num2); my $answer = $agi->get_data('equals', 15000, length($num3)); if ($answer == $num3) # correct { $agi->exec('background', 'wakeup-call-cancelled'); } else # oops, schedule another call { &createwake(1); $agi->exec('background', 'vm-sorry'); $agi->exec('background', 'rqsted-wakeup-for'); $agi->exec('background', 'digits/5'); $agi->exec('background', 'minutes'); $agi->exec('background', 'vm-from'); $agi->exec('background', 'now'); } } elsif ($input == 2) # snooze for 5 { &createwake(5); $agi->exec('background', 'rqsted-wakeup-for'); $agi->exec('background', 'digits/5'); $agi->exec('background', 'minutes'); $agi->exec('background', 'vm-from'); $agi->exec('background', 'now'); } elsif ($input == 3) # snooze for 10 { &createwake(10); $agi->exec('background', 'rqsted-wakeup-for'); $agi->exec('background', 'digits/10'); $agi->exec('background', 'minutes'); $agi->exec('background', 'vm-from'); $agi->exec('background', 'now'); } elsif ($input == 4) # snooze for 15 { &createwake(15); $agi->exec('background', 'rqsted-wakeup-for'); $agi->exec('background', 'digits/15'); $agi->exec('background', 'minutes'); $agi->exec('background', 'vm-from'); $agi->exec('background', 'now'); } else # pressed the wrong key, schedule another call. { &createwake(1); $agi->exec('background', 'you-dialed-wrong-number'); $agi->exec('background', 'wrong-try-again-smarty'); } # creates wake file using argument for the number of minutes into the future sub createwake { my $date = &UnixDate(DateCalc("today","+ ".$_[0]."minutes"), "%H%M"); my $filename = sprintf("%s%04s.%s.call", $pending_dir, $date, $caller); open(FILE, ">$filename"); printf FILE q{# Channel: %s/%s MaxRetries: %s RetryTime: %s WaitTime: %s Callerid: %s Application: AGI data: wakeconfirm.agi }, $chan, $caller, $maxretries, $retrytime, $waittime, $callerid, ; close(FILE); } ;---------------------------------------------------------------- ; ;------------------------------------------------------------- ; Does not work currently Need fiximg Please help if you can. ;------------------------------------------------------------- ; Request CallBack Allows a user to request a call back from the line that is Busy. ;------------------------------------------------------------ ;[app-callback] ; ;exten => *1,1,Set(${DB(CALLBACK/${SCB}=1) ; put 1 into this exten callback to indicate active ;exten => *1,n,Set(${DB(CALLBACK2/${SCB}=${SCB2}) ; put who is was that called ;exten => *1,n,Playback(conf-muted) ; play some sound to tell the user callback is active ;exten => *1,n,Hangup ; ;exten => h,1,Set(CB=0) ; Set default value for CB (CB =1 callback active) ;exten => h,2,Set(CB=CALLBACK/${CALLERIDNUM}) ; Get CB ;exten => h,3,Set(CB2=CALLBACK2/${CALLERIDNUM}) ; Get Who called ;exten => h,4,NOOP(${CB}) ; Display CB (not really required) ;exten => h,5,GotoIf($["${CB}" = "1"]?6:99) ; Check if CB=1 if it does to the callback stuff at 6 else jump to 99; ;exten => h,6,NOOP ;Wait(2) ;exten => h,7,Set(${DB(CALLBACK/${CALLERIDNUM}=0) ; set CB to 0 cos we don;t want a loop. ;exten => h,8,System(echo "Channel: Local/${CB2}@sip" >/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ; fill the ;exten => h,9,System(echo "Context: sip" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ; call file ;exten => h,10,System(echo "Extension: ${CALLERIDNUM}" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ;with data; ;exten => h,11,System(echo "CallerID: ${CB2}" >>/var/spool/asterisk/outgoing/${UNIQUEID}.callback) ; ; you might want to play with timeouts, and perhaps use waitexten... ; ;exten => s,102,Set(CB=0) ; Set default value for CB (CB =1 callback active) ;exten => s,103,Set(CB=CALLBACK/${CALLERIDNUM}) ; Get CB ;exten => s,104,GotoIf($["${CB}" = "1"]?99:105) ; Check if CB=1 if it does tell them they can't else jump to 99 ;exten => s,105,ResponseTimeout(3) ;exten => s,106,Set(SCB=${ARG2},SCB2=${ARG3}) ;we need to set these because you might exit the macro and we need the values. ;exten => s,107,Background(vm-tocallback,,,callback-activate) ; play sound jump to callback-activate if key pressed ; ;exten => h,99,NoOp ;