Robert G. Ristroph
2005-Sep-19 16:34 UTC
[Asterisk-Users] Voicemail() application returning -1 on a hangup
Hi, I am trying to insert a system() call right after the call to Voicemail() in order to notify people that they have received new voicemail. (In case you are interested, I was following the tips here, but I have had to change a few things: http://www.voip-info.org/wiki-Asterisk+tips+callback ). My setup works when someone leaving a message hits # to exit the voicemail after speaking, or lets it time out. However, when they just hangup (which is what 99 percent of people do) Voicemail() returns -1, which apparently stops any further extensions from executing. Here is my vm macro: [macro-vm] exten => s,1,NoOp(At start of macro-vm---Arg1=${ARG1} Arg2=${ARG2}) exten => s,2,Goto(s-${ARG2},1) exten => s-BUSY,1,Voicemail(b${ARG1}) ; Voicemail Busy message exten => s-BUSY,2,Hangup() exten => _s-.,1,NoOp(Before Voicemail-u---Arg1=${ARG1} Arg2=${ARG2}) exten => _s-.,2,Voicemail(u${ARG1}) ; Voicemail Unavailable message exten => _s-.,3,NoOp(After Voicemail-u---Arg1=${ARG1} Arg2=${ARG2}) exten => _s-.,4,system(${SCRIPTS_DIR}/voicemail_callback.sh ${ARG1}) exten => _s-.,5,NoOp(After system----Arg1=${ARG1} Arg2=${ARG2}) exten => _s-.,6,Hangup() ; this catches the error exit (n+101) from Voicemail, such was when a person hangs up after recording a message ; instead of hitting # (this doesn't work) ; exten => _s-.,103,system(${SCRIPTS_DIR}/voicemail_callback.sh ${ARG1}) exten => o,1,Background(one-moment-please) ; 0 during vm message will hangup exten => o,2,GotoIf($["foo${FROM_DID}" "foo"]?from-pstn,s,1:from-pstn,${FROM_DID},1) exten => h,1,system(${SCRIPTS_DIR}/voicemail_callback.sh ${ARG1}) exten => t,1,system(${SCRIPTS_DIR}/voicemail_callback.sh ${ARG1}) exten => a,2,VoiceMailMain(${ARG1}) exten => a,3,Hangup The NoOp after the Voicemail call never runs if you hang up, thus the system() never has a chance to run. The t,1 seems to work for when you time out. The h,1 which I thought might catch it when a person hangs up in Voicemail(), doesn't. The behavior of Voicemail() should allow you to differentiate between a real error (out of disk space for voicemail, for example) and the most common behaviour of message leavers (hanging up when done). Perhaps that should be a bug report. But how can I work around this ? Would it be easy to patch the C code of app_voicemail.c to not have this behavior ? I looked over it but I could not make headway on the first look. --Rob -- Robert G. Ristroph Airlink Systems rristroph@airlinksystems.com (512) 231-1240 x103 ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.