Steven Kokinos
2004-Apr-15 07:53 UTC
[Asterisk-Users] external voicemail access - solved (mostly)
thanks to those who replied. I have managed to get the functionality I was looking for working with a series of Macros. However, it doesn't work as simply as I would like. There are two issues I've run into: (1)Goto provides no way to pass variables between one context and another. (2)I can't find any way to Goto a specific point within a Macro when calling it. Mostly this is a result of the background command listening for extensions in the current context. If background is run from within a Macro, then it will terminate the macro and return to the current context to execute whatever user input was just captured. In order to get the behavior I'm looking for (user calls into voicemail, presses * to be prompted for a password and check messages, press # to skip the greeting and leave a message) I had to have 3 macros: (1)vm - leave voicemail (2)vm-nogreet - simply provide a beep (3)checkmessage Ideally this would be one larger macro, where the starting point could be specified as well as passing the arguments along. [macro-vm] exten => s,1,Answer exten => s,2,Background(${VMAILPATH}/${ARG2}/${ARG1}/unavail) exten => s,3,VoiceMail2(s${ARG1}) exten => s,4,Hangup [macro-vm-nogreet] exten => s,1,Answer exten => s,2,VoiceMail2(s${ARG1}) exten => s,3,Hangup [macro-checkmessage] exten => s,1,VoiceMailMain2(${ARG1}) exten => s,2,Hangup In the inbound context I do the following (xxxxxxx is the rest of the phone number): [line-in] exten => xxxxxx1638,1,Dial(${P1}&${P2}&${P3},25,Tr) exten => xxxxxx1638,2,Macro(vm,${P1_VM},${P1_VM_CONTEXT}) exten => xxxxxx1638,3,Hangup exten => *,1,Macro(checkmessage,${P1_VM}) exten => i,1,Macro(vm-nogreet,${P1_VM},${P1_VM_CONTEXT}) This does everything in a fairly general way. However, if anyone knows how to address my points above this could be done much cleaner in a single macro (and if there is a way to keep background isolated within the macro it would be easier still). One note - this will actually interrupt the greeting and send to the "beep" for voicemail regardless of what the user presses, as long as it isn't the * key. Since background will always bounce to here I thought it would be better to force someone to leave voicemail than get a fast busy with an inadvertent button press. -Steve