[Asterisk-Users] Phone ringing and not going to voicemail?

Matt mhoppes at gmail.com
Thu Mar 17 13:13:28 MST 2005


extensions.conf:

; Asterisk Management Portal (AMP)
; Copyright (C) 2004 Coalescent Systems Inc

; dialparties.agi (http://www.sprackett.com/asterisk/)
; Asterisk::AGI (http://asterisk.gnuinter.net/)
; gsm (http://www.ibiblio.org/pub/Linux/utils/compress/!INDEX.short.html)
; loligo sounds (http://www.loligo.com/asterisk/sounds/)
; mpg123 (http://voip-info.org/wiki-Asterisk+config+musiconhold.conf)


; include extension contexts generated from AMP
#include extensions_additional.conf

; Customizations to this dialplan should be made in extensions_custom.conf
; See extensions_custom.conf.sample for an example
#include extensions_custom.conf

[from-pstn]
include => ext-did
exten => s,1,GotoIf($[${IN_OVERRIDE} = forcereghours]?from-pstn-reghours,s,1:)
exten => s,2,GotoIf($[${IN_OVERRIDE} = forceafthours]?from-pstn-afthours,s,1:)
exten => s,3,GotoIfTime(${REGTIME}|${REGDAYS}|*|*?from-pstn-reghours,s,1:)
exten => s,4,Goto(from-pstn-afthours,s,1)

[from-pstn-reghours]
exten => s,1,GotoIf($[${FAX_RX} =
disabled]?from-pstn-reghours-nofax,s,1:2)	; if fax detection is
disabled, then jump to from-pstn-nofax - else continue
exten => s,2,Answer	
exten => s,3,Wait(1)
exten => s,4,SetVar(intype=${INCOMING})
exten => s,5,Cut(intype=intype,-,1) 
exten => s,6,GotoIf($[${intype} = EXT]?7:9)		; If INCOMING starts with
EXT, then assume its an extension
exten => s,7,Wait(3) 							;wait 3 more second to make sure this
isn't a fax before dialing someone
exten => s,8,Goto(ext-local,${INCOMING:4},1)
exten => s,9,GotoIf($[${intype} = GRP]?10:12) 	; If INCOMING starts
with GRP, then assume its a ring group
exten => s,10,Wait(3)
exten => s,11,Goto(ext-group,${INCOMING:4},1)
exten => s,12,Goto(${INCOMING},s,1) 			; not EXT or GR1 - it's an auto attendant
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => h,1,Hangup

[from-pstn-reghours-nofax]
exten => s,1,SetVar(intype=${INCOMING})
exten => s,2,Cut(intype=intype,-,1) 
exten => s,3,GotoIf($[${intype} = EXT]?4:5)		; If INCOMING starts with
EXT, then assume its an extension
exten => s,4,Goto(ext-local,${INCOMING:4},1)
exten => s,5,GotoIf($[${intype} = GRP]?6:7) 	; If INCOMING starts with
GRP, then assume its a ring group
exten => s,6,Goto(ext-group,${INCOMING:4},1)
exten => s,7,Answer        						; answer call before auto attendant
exten => s,8,Wait(1)							
exten => s,9,Goto(${INCOMING},s,1) 				; not EXT or GR1 - it's an auto attendant
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => h,1,Hangup

[from-pstn-afthours]
exten => s,1,GotoIf($[${FAX_RX} =
disabled]?from-pstn-afthours-nofax,s,1:2)	; if fax detection is
disabled, then jump to from-pstn-nofax - else continue
exten => s,2,Answer	
exten => s,3,Wait(1)
exten => s,4,SetVar(intype=${AFTER_INCOMING})
exten => s,5,Cut(intype=intype,-,1) 
exten => s,6,GotoIf($[${intype} = EXT]?7:9)		; If INCOMING starts with
EXT, then assume its an extension
exten => s,7,Wait(3) 							;wait 3 more second to make sure this
isn't a fax before dialing someone
exten => s,8,Goto(ext-local,${AFTER_INCOMING:4},1)
exten => s,9,GotoIf($[${intype} = GRP]?10:12) 	; If INCOMING starts
with GRP, then assume its a ring group
exten => s,10,Wait(3)
exten => s,11,Goto(ext-group,${AFTER_INCOMING:4},1)
exten => s,12,Goto(${AFTER_INCOMING},s,1) 			; not EXT or GR1 - it's
an auto attendant
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => h,1,Hangup

[from-pstn-afthours-nofax]
exten => s,1,SetVar(intype=${AFTER_INCOMING})
exten => s,2,Cut(intype=intype,-,1) 
exten => s,3,GotoIf($[${intype} = EXT]?4:5)		; If INCOMING starts with
EXT, then assume its an extension
exten => s,4,Goto(ext-local,${AFTER_INCOMING:4},1)
exten => s,5,GotoIf($[${intype} = GRP]?6:7) 	; If INCOMING starts with
GRP, then assume its a ring group
exten => s,6,Goto(ext-group,${AFTER_INCOMING:4},1)
exten => s,7,Answer        						; answer call before auto attendant
exten => s,8,Wait(1)							
exten => s,9,Goto(${AFTER_INCOMING},s,1) 				; not EXT or GR1 - it's
an auto attendant
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => h,1,Hangup

; ############################################################################
; Macros [macro]
; ############################################################################

; Rings one or more extensions.  Handles things like call forwarding and DND
; We don't call dial directly for anything internal anymore.
; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, ...
; Use a Macro call such as the following: 
;  Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,...)
[macro-dial]
exten => s,1,AGI,dialparties.agi
exten => s,22,Macro(hangupcall)             ; The call was answered
and then hungup
exten => s,23,Wait(1)
exten => s,24,Voicemail(b${ARG3})           ; The call was internal to
extension, and was busy
exten => o,1,Background(one-moment-please)	; 0 during vm message will hangup
exten => o,2,Hangup

; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
exten => s,1,GotoIf($[${ARG1} = novm]?novm,1)
exten => s,2,SetMusicOnHold(default)
exten => s,3,Setvar(FROMCONTEXT=exten-vm)
exten => s,4,Macro(dial,${RINGTIMER},${DIAL_OPTIONS},${ARG2})
exten => s,5,Wait(1)
exten => s,6,Voicemail(u${ARG1})      ; no answer to voicemail
exten => s,7,Macro(hangupcall)
exten => s,106,Wait(1)
exten => s,107,Voicemail(b${ARG1})
exten => o,1,Background(one-moment-please)	; 0 during vm message will hangup
exten => o,2,Hangup
exten => a,1,Goto(app-directory,*411,1)
exten => a,2,Hangup
exten => novm,1,Macro(dial,120,${DIAL_OPTIONS},${ARG2})
exten => novm,2,Wait(1)
exten => novm,3,Playback(vm-nobodyavail)
exten => novm,4,Playback(allison7/pls-try-call-later)
exten => novm,5,Hangup

[macro-vm]
exten => s,1,Voicemail(u${ARG1})      ; no answer to voicemail
exten => s,2,Hangup
exten => o,1,Background(one-moment-please)	; 0 during vm message will hangup
exten => o,2,Hangup
exten => a,1,Goto(app-directory,*411,1)
exten => a,2,Hangup

; For some reason, if I don't run setCIDname, CALLERIDNAME will be
blank in my AGI
; ARGS: none
[macro-fixcid]
exten => s,1,SetCIDName(${CALLERIDNAME})

; Ring groups of phones
; ARGS: comma separated extension list
[macro-rg-group];
exten => s,1,Setvar(GRP=${GROUP})   ;my original choice of variable
GROUP is now overwritten by SetGroup.  Copy contents to GRP
exten => s,2,SetGroup(${CALLERIDNUM})
exten => s,3,Setvar(FROMCONTEXT=rg-group)
exten => s,4,SetCIDName(${PRE}${CALLERIDNAME})
exten => s,5,Macro(dial,${RINGTIMER},${DIAL_OPTIONS},${GRP})

;
; Outgoing channel(s) are busy ... inform the client
;
[macro-outisbusy]
exten => s,1,Playback(allison7/all-circuits-busy-now)
exten => s,2,Playback(allison7/pls-try-call-later)
exten => s,3,Macro(hangupcall)

; 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

[macro-faxreceive]
exten => s,1,SetVar(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => s,2,SetVar(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,rxfax(${FAXFILE})
exten => s,103,SetVar(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

; dialout and strip the prefix
[macro-dialout]
exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) 	;check for
CID override for exten
exten => s,2,SetCallerID(${ECID${CALLERIDNUM}})
exten => s,3,Goto(6)
exten => s,4,GotoIf($[foo${OUTCID_${ARG1}} = foo]?6) 		;check for CID
override for trunk
exten => s,5,SetCallerID(${OUTCID_${ARG1}})
exten => s,6,SetVar(length=${LEN(${DIAL_OUT_${ARG1}})})
exten => s,7,Dial(${OUT_${ARG1}}/${ARG2:${length}})
exten => s,8,Congestion
exten => s,108,Macro(outisbusy)


; dialout using default OUT trunk - no prefix
[macro-dialout-default]
exten => s,1,GotoIf($[foo${ECID${CALLERIDNUM}} = foo]?4) 	;check for
CID override for exten
exten => s,2,SetCallerID(${ECID${CALLERIDNUM}})
exten => s,3,Goto(6)
exten => s,4,GotoIf($[foo${OUTCID} = foo]?6) 	;check for CID override for trunk
exten => s,5,SetCallerID(${OUTCID})
exten => s,6,Dial(${OUT}/${ARG1})
exten => s,7,Congestion
exten => s,107,Macro(outisbusy)


; ############################################################################
; Applications [app]
; ############################################################################
;
[app-directory]
exten => #,1,Wait(1)
exten => #,2,GotoIf($[${DIRECTORY} = first]?4:)
exten => #,3,Directory(default|ext-local)
exten => #,4,Directory(default|ext-local|f)
exten => #,5,Hangup
exten => *411,1,Wait(1)
exten => *411,2,GotoIf($[${DIRECTORY} = first]?4:)
exten => *411,3,Directory(default|ext-local)
exten => *411,4,Directory(default|ext-local|f)
exten => *411,5,Hangup
exten => h,1,Hangup

[app-dnd]
exten => *78,1,Answer
exten => *78,2,Wait(1)
exten => *78,3,DBput(DND/${CALLERIDNUM}=YES)
exten => *78,4,Playback(allison7/do-not-disturb)
exten => *78,5,Playback(activated)
exten => *78,6,Macro(hangupcall)
exten => *79,1,Answer
exten => *79,2,Wait(1)
exten => *79,3,DBdel(DND/${CALLERIDNUM})
exten => *79,4,Playback(allison7/do-not-disturb)
exten => *79,5,Playback(de-activated)
exten => *79,6,Macro(hangupcall)

[app-messagecenter]
exten => *98,1,Answer
exten => *98,2,Wait(1)
exten => *98,3,VoiceMailMain(default)
exten => *98,4,Macro(hangupcall)
exten => _*98X.,1,Answer			; can dial *98<exten> to skip 'mailbox'
prompt.  Useful for speedial.
exten => _*98X.,2,Wait(1)
exten => _*98X.,3,VoiceMailMain(${EXTEN:3}@default)
exten => _*98X.,4,Macro(hangupcall)

[app-callwaiting]
exten => *70,1,Answer
exten => *70,2,Wait(1)
exten => *70,3,DBput(CW/${CALLERIDNUM}=ENABLED)
exten => *70,4,Playback(callwaiting)
exten => *70,5,Playback(activated)
exten => *70,6,Macro(hangupcall)
exten => *71,1,Answer
exten => *71,2,Wait(1)
exten => *71,3,DBdel(CW/${CALLERIDNUM})
exten => *71,4,Playback(callwaiting)
exten => *71,5,Playback(de-activated)
exten => *71,6,Macro(hangupcall)

[app-callforward]
; dialed call forward app - forwards calling extension
exten => _*72.,1,DBput(CF/${CALLERIDNUM}=${EXTEN:3})
exten => _*72.,2,Answer
exten => _*72.,3,Wait(1)
exten => _*72.,4,Playback(loligo/call-fwd-unconditional)
exten => _*72.,5,Playback(loligo/for)
exten => _*72.,6,Playback(loligo/extension)
exten => _*72.,7,SayDigits(${CALLERIDNUM})
exten => _*72.,8,Playback(loligo/is-set-to)
exten => _*72.,9,SayDigits(${EXTEN:3})
exten => _*72.,10,Macro(hangupcall)
; prompting call forward app - forwards entered extension
exten => *72,1,Answer
exten => *72,2,Wait(1)
exten => *72,3,BackGround(allison7/please-enter-your)
exten => *72,4,Playback(extension)
exten => *72,5,Read(fromext,then-press-pound)
exten => *72,6,Wait(1)
exten => *72,7,BackGround(ent-target-attendant)
exten => *72,8,Read(toext,then-press-pound)
exten => *72,9,Wait(1)
exten => *72,10,DBput(CF/${fromext}=${toext})
exten => *72,11,Playback(call-fwd-unconditional)
exten => *72,12,Playback(for)
exten => *72,13,Playback(extension)
exten => *72,14,SayDigits(${fromext})
exten => *72,15,Playback(is-set-to)
exten => *72,16,SayDigits(${toext})
exten => *72,17,Macro(hangupcall)
; cancels dialed extension call forward
exten => _*73.,1,DBdel(CF/${EXTEN:3})
exten => _*73.,2,Answer
exten => _*73.,3,Wait(1)
exten => _*73.,4,SayDigits(${EXTEN:3})
exten => _*73.,5,Playback(call-fwd-cancelled)
exten => _*73.,6,Macro(hangupcall)
; cancels call forward for calling extension
exten => *73,1,DBdel(CF/${CALLERIDNUM})
exten => *73,2,Answer
exten => *73,3,Wait(1)
exten => *73,4,Playback(loligo/call-fwd-cancelled)
exten => *73,5,Macro(hangupcall)
; dialed call forward on busy app - forwards calling extension when busy
exten => _*90.,1,DBput(CFB/${CALLERIDNUM}=${EXTEN:3})
exten => _*90.,2,Answer
exten => _*90.,3,Wait(1)
exten => _*90.,4,Playback(loligo/call-fwd-on-busy)
exten => _*90.,5,Playback(loligo/for)
exten => _*90.,6,Playback(loligo/extension)
exten => _*90.,7,SayDigits(${CALLERIDNUM})
exten => _*90.,8,Playback(loligo/is-set-to)
exten => _*90.,9,SayDigits(${EXTEN:3})
exten => _*90.,10,Macro(hangupcall)
; cancels call forward on busy for calling extension
exten => *91,1,DBdel(CFB/${CALLERIDNUM})
exten => *91,2,Answer
exten => *91,3,Wait(1)
exten => *91,4,Playback(call-fwd-on-busy)
exten => *91,5,Playback(de-activated)
exten => *91,6,Macro(hangupcall)
exten => h,1,Hangup

[app-calltrace]
; We can't have our timeouts or dial digits collide with other applications
; or extensions, so we build the app in pieces
exten => *69,1,Goto(app-calltrace-perform,s,1)

[app-calltrace-perform]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Background(allison7/info-about-last-call)
exten => s,4,Background(allison7/telephone-number)
exten => s,5,Dbget(lastcaller=CALLTRACE/${CALLERIDNUM})
exten => s,6,GotoIf($[${lastcaller}]?7:13)
exten => s,7,SayDigits(${lastcaller})
exten => s,8,DigitTimeout(3)
exten => s,9,ResponseTimeout(7)
exten => s,10,Background(loligo/to-call-this-number)
exten => s,11,Background(allison7/press-1)
exten => s,12,Goto(15)
exten => s,13,Playback(loligo/from-unknown-caller)
exten => s,14,Macro(hangupcall)
exten => s,15,NoOp
exten => 1,1,Goto(from-internal,${lastcaller},1);
exten => i,1,Playback(vm-goodbye)
exten => i,2,Macro(hangupcall)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Macro(hangupcall)


; ############################################################################
; Outbound Trunk Contexts [outbound]
; ############################################################################

[outbound-local]
exten => _NXXXXXX,1,Macro(dialout-default,${EXTEN})
exten => _NXXNXXXXXX,1,Macro(dialout-default,${EXTEN})

[outbound-tollfree]
exten => _1800NXXXXXX,1,Macro(dialout-default,${EXTEN})
exten => _1888NXXXXXX,1,Macro(dialout-default,${EXTEN})
exten => _1877NXXXXXX,1,Macro(dialout-default,${EXTEN})
exten => _1866NXXXXXX,1,Macro(dialout-default,${EXTEN})

[outbound-ld]
exten => _1NXXNXXXXXX,1,Macro(dialout-default,${EXTEN})

[outbound-international]
exten => _011.,1,Macro(dialout-default,${EXTEN})

[outbound-emerg]
exten => 911,1,Macro(dialout-default,${EXTEN})

[outbound-info]
exten => 411,1,Macro(dialout-default,${EXTEN})
exten => 311,1,Macro(dialout-default,${EXTEN})


; ############################################################################
; Inbound Contexts [from]
; ############################################################################

[from-sip-external]

;give external sip users congestion and hangup
exten => _.,1,AbsoluteTimeout(15)
exten => _.,2,Congestion 
exten => _.,3,Hangup

[from-internal]
;allow phones to use applications
include => app-directory
include => app-dnd
include => app-callforward
include => app-callwaiting
include => app-messagecenter
include => app-calltrace
include => parkedcalls
include => from-internal-custom
;allow phones to dial other extensions
include => ext-fax
include => ext-local
include => ext-group
include => ext-zapbarge
include => ext-meetme
include => ext-record
include => ext-test
;allow phones to access trunks
include => outbound-emerg
include => outbound-info
include => outbound-local
include => outbound-tollfree
include => outbound-ld
include => outbound-international
include => outbound-trunks
exten => h,1,Macro(hangupcall)

; ############################################################################
; Extension Contexts [ext]
; ############################################################################

[ext-zapbarge]
exten => 888,1,SetGroup(${CALLERIDNUM})
exten => 888,2,Answer
exten => 888,3,Wait(1)
exten => 888,4,ZapBarge
exten => 888,5,Hangup

[ext-meetme]
exten => _8X,1,Answer
exten => _8X,2,Wait(1)
exten => _8X,3,GotoIf($[${CALLERIDNUM} = ${EXTEN:1}]?5:4)
exten => _8X,4,MeetMe2(${EXTEN}|sM)
exten => _8X,5,MeetMe2(${EXTEN}|asM)

exten => _8XX,1,Answer
exten => _8XX,2,Wait(1)
exten => _8XX,3,GotoIf($[${CALLERIDNUM} = ${EXTEN:1}]?5:4)
exten => _8XX,4,MeetMe2(${EXTEN}|sM)
exten => _8XX,5,MeetMe2(${EXTEN}|asM)

exten => _8XXX,1,Answer
exten => _8XXX,2,Wait(1)
exten => _8XXX,3,GotoIf($[${CALLERIDNUM} = ${EXTEN:1}]?5:4)
exten => _8XXX,4,MeetMe2(${EXTEN}|sM)
exten => _8XXX,5,MeetMe2(${EXTEN}|asM)

exten => _8XXXX,1,Answer
exten => _8XXXX,2,Wait(1)
exten => _8XXXX,3,GotoIf($[${CALLERIDNUM} = ${EXTEN:1}]?5:4)
exten => _8XXXX,4,MeetMe2(${EXTEN}|sM)
exten => _8XXXX,5,MeetMe2(${EXTEN}|asM)


[ext-fax]
exten => in_fax,1,GotoIf($[${FAX_RX} = system]?2:analog_fax,1)
exten => in_fax,2,Macro(faxreceive)
exten => in_fax,3,system(tiff2ps -2eaz -w 8.5 -h 11 ${FAXFILE} |
ps2pdf - ${FAXFILE}.pdf)
exten => in_fax,4,system(mime-construct --to ${EMAILADDR} --subject
"Fax from ${CALLERIDNUM} ${CALLERIDNAME}" --attachment
${CALLERIDNUM}.pdf --type application/pdf --file ${FAXFILE}.pdf)
exten => in_fax,5,system(rm ${FAXFILE} ${FAXFILE}.pdf)
exten => in_fax,6,Hangup
exten => analog_fax,1,GotoIf($[${FAX_RX} = disabled]?3:2)  ;if fax is
disabled, just hang up
exten => analog_fax,2,Dial(${FAX_RX},20,d)
exten => analog_fax,3,Hangup
;exten => out_fax,1,wait(7)
exten => out_fax,1,txfax(${TXFAX_NAME}|caller)
exten => out_fax,2,Hangup
exten => h,1,Hangup()

[ext-record]
exten => *77,1,Wait(2)
exten => *77,2,Record(ivrrecording:wav) 
exten => *77,3,Wait(2)
exten => *77,4,Hangup
exten => *99,1,Playback(ivrrecording) 
exten => *99,2,Wait(2) 
exten => *99,3,Hangup 

;this is where parked calls go if they time-out.  Should probably re-ring
[default]
include => ext-local
exten => s,1,Playback(vm-goodbye)
exten => s,2,Macro(hangupcall)

[ext-test]
exten => 7777,1,Goto(from-pstn,s,1)
exten => 666,1,Goto(ext-fax,in_fax,1)
exten => h,1,Macro(hangupcall)


As you can see the extensions are not listed in here.



More information about the asterisk-users mailing list