Trouble making 'a' extension for VoiceMailMain() work

I’m just getting my feet wet with Asterisk, trying to replace an older existing voicemail server that uses incoming DID calls to voicemail and IVR applications. In doing so, I’d like to keep the functionality as close to the older system as possible. I’m running AstLinux, and have configured a test SIP peer with Voip.MS, and have a working incoming DID number that I can route to the appropriate mailbox.
What I’m trying to accomplish is the following:
When an outside caller dials the DID number, I need the server to play the normal voicemail user’s greeting and take a messeage (VoiceMail() function). However, if the mailbox owner dials in on the same number, while he’s listening to his greeting, if he presses the ‘*’ key, it will allow him to log into his mailbox (VoiceMailMain() function).
It seems as though this should be easy enough, but I can’t seem to figure out the proper way to accomplish this. Currently, my extensions.conf looks like this:

[inbound]
exten => _NXXNXXXXXX,1,Answer
exten => _NXXNXXXXXX,n,NoOp(inbound-phone-call)
exten => _NXXNXXXXXX,n,Voicemail(${EXTEN})
exten => _NXXNXXXXXX,n,a,VoiceMailMain(${EXTEN})

I’m assumiong that I’m not properly using the ‘a’ extension for the VoiceMailMain() function, or just not properly routing to that function at all. If someone can help me better understand the best way to accomplish this, it would be greatly appreciated.

Thanks.

You are using the “a” application, with some excess characters. There is no a application.

From ’ https://www.voip-info.org/wiki-asterisk+standard+extensions ':

{a: Called when user presses ‘*’ during a voicemail greeting
h: Hangup extension
i: invalid extension
o: Operator extension, used for operator exit by pressing zero in voicemail
s: Start extension in context
t: Timeout extension
T: AbsoluteTimeout() extension}

Also, from ’ https://www.voip-info.org/wiki/view/Asterisk+cmd+VoiceMail ':

{Also. during the prompt if the caller presses:
’*’ - the call jumps to extension ‘a’ in the current voicemail context.
Example:
Exten => a, 1, VoicemailMain(@default)
Exten => a, 2, Hangup}

This is the operation I’m trying to use, but I can’t seem to get it to work.

Your code does not have the a in the same field as the recipe you have just quoted.

I recommend doing this in a subroutine and not inside a context with a pattern match.

The value of ${EXTEN} in the ‘a’ extension of your context is going to be ‘a’ not the number you dialed so you need to pass a variable in with what box to check.

Thank you for the help, I’ll give it a try.

Does anybody know if the ’ * jump to a extension’ feature works with the VoicemMail() application in Asterisk 11.25.1?

From the Asterisk wiki for Asterisk 11:

The Voicemail application will exit if any of the following DTMF digits are received:
0 - Jump to the o extension in the current dialplan context.

    • Jump to the a extension in the current dialplan context.

In my system, pressing ‘0’ or ‘*’ only shows that Asterisk ‘hears’ the digits, but doesn’t seem to act on either of them.

Found the problem! In voicemail.conf, there is a setting called ‘exitcontext’ It was set to ‘vm-operator’. I found this on the voip-info.org site:

exitcontext
Optional context to drop the user into after he/she has pressed * or 0 to exit voicemail. If not set, pressing * or 0 will return the caller to the last context they were in before being sent to voicemail (assuming that context has a ‘a’ or ‘o’ extension).

After commenting out this setting, pressing ‘ * ‘ will drop me right into the proper mailbox asking for a password.

Thanks again for all your help and ideas on this.

1 Like