[asterisk-users] vmoutcall]

Doug Lytle support at drdos.info
Thu May 24 18:38:11 MST 2007


--> Perhaps someone can share how? 

First you need to give them the option of turning the feature on and 
off.  I do it with the following:

[callback-activate]

; ***********************************************
; Callback activate/deactivate.  If this function
; is enabled and there is a call file in the form
; of ${EXTEN}.call, then Asterisk will call the
; phone number contained within the .call file 150
; seconds after a voicemail has been left.
; ***********************************************

exten => 80*,1,Set(CALLBACK=${DB(vmcallback/${CALLERIDNUM})})
exten => 80*,2,GotoIf($["${CALLBACK}" = "YES"]?80*,3:80*,101)
exten => 80*,3,Set(DB(vmcallback/${CALLERIDNUM})=NO)
exten => 80*,4,Playback(local/stutter)
exten => 80*,5,Playback(de-activated)
exten => 80*,6,Hangup()
exten => 80*,101,Set(DB(vmcallback/${CALLERIDNUM})=YES)
exten => 80*,102,Playback(local/stutter)
exten => 80*,103,Playback(activated)
exten => 80*,104,Hangup()

Then you need to do a database look up every place in your dial plan 
where voice mail may be left, I do it as such:

[macro-sip.extensions]

exten => s,1,Set(CALLBACK=${DB(vmcallback/${ARG1})})
exten => s,n,SetMusicOnHold(cd)
exten => s,n,Dial(SIP/${ARG1},28,tWw)
exten => s,n,NoOP(Dial Status: ${DIALSTATUS})
exten => s,n,NoOP(Hangup Cause: ${HANGUPCAUSE})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,GotoIf($["${CALLBACK}" = 
"YES"]?s-NOANSWER,2:s-NOANSWER,3)
exten => s-NOANSWER,2,System(/usr/local/bin/vm-callout.sh ${ARG1})
exten => s-NOANSWER,3,Voicemail(u${ARG1}@sip)

If CALLBACK=YES, then run the script that copies the call file into the 
outgoing directory.  It uses touch to set the date on the file 150 
seconds into the future.  This prevents the system calling the user 
while voice mail is still being left.

The call file links into the dial plan that loops the message 4 times 
waiting for acknowledgment by pressing 1 to collect voice mail.

[voice-mail-callback]

; ************
; Set timeouts
; ************

exten => s,1,Set(TIMEOUT(response)=6)
exten => s,2,Set(TIMEOUT(digit)=3)
exten => s,3,Wait(1)
exten => s,4,Set(COUNT=0)

; *******************************************
; Play, your attention is required, press 1 to
; collect voice mail
; *******************************************

exten => s,5,Background(attention-required)
exten => s,6,Background(press-1)
exten => s,7,Background(to-collect-voicemail)

; *****************************************
; If 1 is pressed, then play transfer and
; then jump to voice-mail context.
; *****************************************

exten => 1,1,Playback(pbx-transfer)
exten => 1,2,Goto(voice-mail,s,1)

; ****************************************
; Setup a variable to count the number of
; times the message has been played, when
; $COUNT reaches > 3, play you've taken
; to long to dial and hangup.
; ****************************************

exten => t,1,Set(COUNT=$[${COUNT} + 1])
exten => t,2,NoOP(${COUNT})
exten => t,3,GotoIf($[ ${COUNT} > 3 ]?103)
exten => t,4,Goto(voice-mail-callback,s,5)
exten => t,103,Playback(local/tolong-todial)
exten => t,104,Playback(goodbye)
exten => t,105,Hangup()

exten => i,1,Playback(local/sorry-invalid-choice)
exten => i,2,Set(COUNT=$[${COUNT} + 1])
exten => i,3,NoOP(${COUNT})
exten => i,4,Goto(voice-mail-callback,s,5)

exten => h,1,NoOP(Hungup)


Doug




-- 
 
Ben Franklin quote:

"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."




More information about the asterisk-users mailing list