;TODO: ; ; ; <8> Integrate with address system to dial automatically ; <7> Add fax applications ; <6> Make wakeups work for any extension or CID (including outside callers) ; <5> Add house command on timer (turn on A2 for 20 minutes) ; <5> Add house command on pwm (turn on A2 for 20 minutes out of every 60) ; <*> Add call progress indicators ("forwarding to cell", "going to voicemail", etc) ; <*> Add function to report current status (forward, DND, etc) ; <*> Fix message waiting indicator ; <*> Add DND or forward option for # hours before auto-remove (started working ; on this in timeout.conf) ; <*> Why don't forwards from Teliax to Nufone work? ; <3> Add Dictate() application somewhere ; <2> Add feature to call whoever left a voicemail message (part of voicemail system ; but it doesn't work right) ; <2> Add volume control, Boombuster ; <1> BUG: if a double call (Dial(something&something) has one of the somethings ; fail with circuits-busy, the whole call fails ; <1> Add ability to pick up incoming call for other extension ; <1> Block calls from blocked callerID or "private" ; ; Exceptions: ; * Clean up exception cases (invalid, etc) ; - If outgoing network connection doesn't work, ("everyone congested/busy right now"), ; inform of this instead of just going back to the main menu ; * Take into account: ; - If forward fails (provider error or fail to answer) ; - If invalid ext. ; ; Sounds: ; - "Forwarding" when call is forwarded after trying extension ; - build info prompts: provider, forwarding, dnd, your extension ; ; ======================================================================== #include ; Number manipulation and CID routines #include ; Allow incoming users to dial out #include ; Handle the do-not-disturb feature #include ; Application to handle call forwarding #include ; Turn on and off hangup-on-star feature #include ; Interface asterisk with home automation #include ; Convenience macros local to us #include ; Assorted stuff that doesn't fit elsewhere #include ; Record calls, monitor an extension #include ; Deal with outgoing calls #include ; Record files used in menus #include ; Macro for defining each local extension ; ======================================================================== [general] static=yes writeprotect=yes ; ======================================================================== [globals] ; The "Globals" category contains global variables that can be referenced ; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental variable ; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid ; ; For monitor.conf: HEYU_USER=webb HEYU_SERVER=nerdville ; For do_not_disturb.conf: DND_OVERRIDE_EXTENSION=# ; For monitor.conf: MONITORDIR=/var/spool/asterisk/monitor ; For outgoing.conf (Boulder police dispatch): EMERGENCY_NUMBER=13034413333 OUTGOING_CIDNUM=1112223333 OUTGOING_CIDNUM_NOT_TOLLFREE=1112223333 ; The return_to_top macro gotos to ${root_context},greet,1 ; if ${root_context} is set, or uses RETURN_TO_TOP_DEFAULT_CONTEXT ; in place of root_context if root_context is not set. ; In my system, the local extensions drop straight to an extension ; in the internal context, so there's no way to set the root_context ; variable. Incoming calls go through their respective extensions ; for the incoming number, so they have root_context set as expected. RETURN_TO_TOP_DEFAULT_CONTEXT=internal [macro-return_to_top] ; Return to the top menu exten = s,1,GotoIf(["${root_context}xxx" = "xxx"]?2,3) exten = s,2,Goto(${RETURN_TO_TOP_DEFAULT_CONTEXT},greet,1) exten = s,3,Goto(${root_context},greet,1) ; ############################################################################ ; Local Extensions ; ############################################################################ [family] ; Family voicemail extension: send a voicemail to everyone exten = 76,1,Voicemail(77&78) [janet] ; Janet's extension ; ${ARG1} - Extension ; ${ARG2} - Device(s) to ring ; ${ARG3} - Timeout for dialing extension exten = 77,1,Macro(stdexten,77,SIP/sipura2,17) [daniel] ; Daniel's extension exten = 78,1,Macro(stdexten,78,SIP/sipura1,17) [cabin] ; Cabin extension exten = 79,1,Macro(stdexten,79,IAX2/cabin,17) [direct-extensions] ; Direct extensions (skip stdexten macro, go straight to hardware) exten = 77,1,Dial(SIP/sipura2,17) exten = 78,1,Dial(SIP/sipura1,17) exten = 79,1,Dial(IAX2/cabin,17) ; see app-wakeups for why this is here: exten = *252,1,AGI(wakeup.agi) exten = *252,2,Hangup ; ================================================================== ; Applications [app-*] ; ================================================================== [app-change-caller_id] ; Change caller id for this call ; *243 == *CID exten = _*243X.,1,Macro(custom-CALLERIDNUM,${EXTEN},4) exten = _*243X.,2,Playback(beep) [app-change-provider] ; See outgoing.conf ; *TEL to change to Teliax exten = *835,1,Macro(change-provider,Teliax) ; *NUF to change to NuFone exten = *683,1,Macro(change-provider,NuFone) [app-dnd] ; See do_not_disturb.conf ; *363 == #DND exten = *363,1,Macro(dnd-on,${CALLERIDNUM}) exten = #363,1,Macro(dnd-off,${CALLERIDNUM}) [app-forward] ; See forward.conf ; Set forward number: (*367 == *FOR) exten = _*367X.,1,Macro(forward_set_number,${CALLERIDNUM},${EXTEN:4}) ; Cancel forward number: exten = _#367,1,Macro(forward_cancel,${CALLERIDNUM}) ; Forward mode menu: exten = _*367*,1,SetVar(F_EXT=${CALLERIDNUM}) exten = _*367*,2,SetVar(F_CALLER=${CONTEXT}) exten = _*367*,3,Goto(forward_mode_menu,s,1) [app-hangup_on_star] ; See hangup_on_star.conf ; *467 == *HOS (hangup on star) exten = *467,1,Macro(hangup_on_star-on,${CALLERIDNUM}) exten = #467,1,Macro(hangup_on_star-off,${CALLERIDNUM}) [app-monitor] ; See monitor.conf ; *666 == *MON exten = *666,1,Macro(monitor-on,${CALLERIDNUM}) exten = #666,1,Macro(monitor-off,${CALLERIDNUM}) ; Record one call: ; *732 == *REC exten = *732,1,Macro(monitor-once,${CALLERIDNUM}) exten = #732,1,Macro(monitor-off,${CALLERIDNUM}) [app-record] ; This is the extension to reach app-record from the main dialplan ; *777 = *RRRecord exten = *777,1,Goto(app-record-main,s,1) [app-record-series] ; See monitor.conf ; *264 == *ANI exten = *264,1,Goto(record-series,s,1) [app-wakeup] ; This runs the wakeup call PHP application described at: ; http://www.voip-info.org/wiki-Asterisk+tips+Wake-Up+Call+PHP ; I have the August 2005 version, it looks like there have been ; improvements since then, but I don't have time to mess with it ; as long as it works. ; ; Call the wakeup agi from the direct-extensions context so that ; the direct-extensions context will be used when the wakeup ; call is put into outgoing. ; *252 == *ALArm exten = *252,1,Goto(direct-extensions,*252,1) [voicemail_shortcuts] exten = 71,1,VoicemailMain(71) exten = 71,2,Hangup exten = 62,1,VoicemailMain(72) exten = 62,2,Hangup exten = 72,1,VoicemailMain(72) exten = 72,2,Hangup exten = 66,1,VoicemailMain(76) exten = 66,2,Hangup exten = 67,1,VoicemailMain(77) exten = 67,2,Hangup exten = 68,1,VoicemailMain(78) exten = 68,2,Hangup exten = 69,1,VoicemailMain(79) exten = 69,2,Hangup ; =========================================================================== ; Safe (incoming calls) ; =========================================================================== [safe] include = dnd-override include = daniel include = janet include = cabin include = family include = hangup include = timeout include = invalid_extension-safe include = voicemail_shortcuts ; Incoming Calls from internet SIP ; ; Allow SIP calls "sip:caller@danielwebb.us" to pass through here. ; This also requires a SRV DNS record as described at ; http://ruk.ca/wiki/Connecting_Gizmo_to_Asterisk ; http://www.voip-info.org/wiki-DNS+SRV ; The line in my Bind config file db.danielwebb.us is: ; _sip._udp IN SRV 1 0 5060 sip.danielwebb.us. exten = caller,1,Answer exten = caller,2,Goto(greet,1) ; Incoming Calls from 1112223333 exten = 1112223333,1,Answer exten = 1112223333,2,Goto(greet,1) ; Incoming calls common entry point exten = greet,1,SetVar(root_context=safe) exten = greet,2,NoOp(${CALLERIDNUM}) exten = greet,3,Ringing exten = greet,4,Wait(1) exten = greet,5,Goto(greet_message,1) exten = greet_message,1,Background(user_sounds/main-external_greeting) ; Calling card access exten = 0,1,Goto(calling_card-challenge,s,1) ; Allow access as if internal phone (Direct Inward System Access) exten = *123412341234,1,Macro(custom-SetCIDNum,77) exten = *123412341234,2,DISA(no-password|internal) exten = *123412341234,1,Macro(custom-SetCIDNum,78) exten = *123412341234,2,DISA(no-password|internal) ; extension_shortcuts exten = 5,1,Ringing exten = 5,2,Wait(4) exten = 5,3,Playback(user_sounds/ani_greeting) exten = 6,1,Goto(76,1) exten = 7,1,Goto(77,1) exten = 8,1,Goto(78,1) exten = 9,1,Goto(79,1) ; =========================================================================== ; Internal (trusted users) ; =========================================================================== [internal] exten = s,1,SetVar(root_context=internal) exten = s,2,Answer exten = greet,1,background(user_sounds/main-internal_greeting) include = voicemail_shortcuts include = daniel include = janet include = cabin include = family include = outgoing include = dnd-override include = app-change-provider include = app-change-caller_id include = app-dnd include = app-forward include = app-monitor include = app-record include = app-wakeup include = app-hangup_on_star include = app-record-series include = home_automation include = hangup include = timeout include = invalid_extension-internal exten = 50,1,Goto(temp-record-phrase,s,1) exten = 51,1,Goto(temp-listen,s,1) ; Change context to a different extension exten = **76,1,Macro(custom-SetCIDNum,76) exten = **76,2,Playback(beep) exten = **76,3,Goto(greet,1) exten = **77,1,Macro(custom-SetCIDNum,77) exten = **77,2,Playback(beep) exten = **77,3,Goto(greet,1) exten = **78,1,Macro(custom-SetCIDNum,78) exten = **78,2,Playback(beep) exten = **78,3,Goto(greet,1) ; =========================================================================== ; Exceptions: hangup, invalid, etc ; =========================================================================== [hangup] ; Make sure that if we are recording the channel, we properly clean up the ; recorded files after a hangup. exten = h,1,Macro(monitor-end,${local_calleridnum}) exten = h,2,Playback(goodbye) exten = h,3,Hangup [invalid_extension] exten = i,1,answer exten = i,2,wait(1) exten = i,3,playback(invalid) exten = i,4,playback(vm-extension) exten = i,5,sayalpha(${INVALID_EXTEN}) exten = i,6,Goto(11) [invalid_extension-safe] include = invalid_extension exten = i,11,Goto(greet_message,1) [invalid_extension-internal] include = invalid_extension exten = i,11,playback(user_sounds/kiss_my_grits) exten = i,12,Goto(greet,1) [timeout] exten = t,1,Hangup