aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-29 13:12:18 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-06-29 13:12:18 +0000
commit30784d4f0c9d9edfc1a44235f5ea1d2d478cdfd2 (patch)
treebf0da8c9e05a798505dbca4bbc7d75fb78b36cfb /apps
parentf0c5eec5e6954f4672077bfd643b9c9bc20eacdb (diff)
Prefer extensions within a macro to those outside (bug #1943)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3348 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_voicemail.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index f68e934c2..3736562e1 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1678,6 +1678,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
int msgnum;
int fd;
int duration = 0;
+ int ausemacro = 0;
+ int ousemacro = 0;
char date[256];
char dir[256];
char fn[256];
@@ -1727,10 +1729,22 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
make_dir(dir, sizeof(dir), vmu->context, ext, "INBOX");
if (mkdir(dir, 0700) && (errno != EEXIST))
ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dir, strerror(errno));
- if (ast_exists_extension(chan, strlen(chan->macrocontext) ? chan->macrocontext : chan->context, "o", 1, chan->callerid))
+
+ /* Check current or macro-calling context for special extensions */
+ if (ast_exists_extension(chan, chan->context, "o", 1, chan->callerid))
+ strcat(ecodes, "0");
+ else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->callerid)) {
strcat(ecodes, "0");
- if (ast_exists_extension(chan, strlen(chan->macrocontext) ? chan->macrocontext : chan->context, "a", 1, chan->callerid))
+ ousemacro = 1;
+ }
+
+ if (ast_exists_extension(chan, chan->context, "a", 1, chan->callerid))
strcat(ecodes, "*");
+ else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "a", 1, chan->callerid)) {
+ strcat(ecodes, "*");
+ ausemacro = 1;
+ }
+
/* Play the beginning intro if desired */
if (!ast_strlen_zero(prefile)) {
if (ast_fileexists(prefile, NULL, NULL) > 0) {
@@ -1768,7 +1782,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
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 (!ast_strlen_zero(chan->macrocontext)) {
+ } else if (ausemacro && !ast_strlen_zero(chan->macrocontext)) {
strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1);
}
chan->priority = 0;
@@ -1781,7 +1795,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
strncpy(chan->exten, "o", sizeof(chan->exten) - 1);
if (!ast_strlen_zero(vmu->exit)) {
strncpy(chan->context, vmu->exit, sizeof(chan->context) - 1);
- } else if (!ast_strlen_zero(chan->macrocontext)) {
+ } else if (ousemacro && !ast_strlen_zero(chan->macrocontext)) {
strncpy(chan->context, chan->macrocontext, sizeof(chan->context) - 1);
}
chan->priority = 0;