Adding extra functionality to app_voicemail.c

I had to look at the source to know this: When a caller is hearing a person’s voicemail prompt, pressing “*” will exit the VM system and redirect the caller to the “a” extension.

How do I somehow return a variable to the dialplan which contains the value of the voicemail box the caller was previously in?

v1.0.9, app_voicemail.c, line 1407:

				/* Check for a '*' here in case the caller wants to escape from voicemail to something
		other than the operator -- an automated attendant or mailbox login for example */
		if (res == '*') {
			strncpy(chan->exten, "a", sizeof(chan->exten) - 1);
			if (!ast_strlen_zero(vmu->exit)) {
				strncpy(chan->context, vmu->exit, sizeof(chan->context) - 1);
			} else if (ausemacro && !ast_strlen_zero(chan->macrocontext)) {
				strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1);
			}
			chan->priority = 0;
			free_user(vmu);
			return 0;
		}

Why? It is in the wiki here:

voip-info.org/tiki-index.php … +VoiceMail

[quote=“rightbrain”]How do I somehow return a variable to the dialplan which contains the value of the voicemail box the caller was previously in?

v1.0.9, app_voicemail.c, line 1407:

/* Check for a '*' here in case the caller wants to escape from voicemail to something other than the operator -- an automated attendant or mailbox login for example */ if (res == '*') { strncpy(chan->exten, "a", sizeof(chan->exten) - 1); if (!ast_strlen_zero(vmu->exit)) { strncpy(chan->context, vmu->exit, sizeof(chan->context) - 1); } else if (ausemacro && !ast_strlen_zero(chan->macrocontext)) { strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1); } chan->priority = 0; free_user(vmu); return 0; } [/quote]

If you are interested in making modifications, you should use this as a reference:

asterisk.org/doxygen/