]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Let directory application browse through the multi-company directory entries
authorMartin Pycko <martinp@digium.com>
Fri, 1 Aug 2003 23:14:37 +0000 (23:14 +0000)
committerMartin Pycko <martinp@digium.com>
Fri, 1 Aug 2003 23:14:37 +0000 (23:14 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1246 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_directory.c

index 949676d8621715ab3f9c31c60f5525dc188b645e..8c18c81a5e08628e159b6428aebab23930b1df8b 100755 (executable)
@@ -129,6 +129,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
        int found=0;
        char *start, *pos, *conv,*stringp=NULL;
        char fn[256];
+       char fn2[256];
        if (!context || !strlen(context)) {
                ast_log(LOG_WARNING, "Directory must be called with an argument (context in which to interpret extensions)\n");
                return -1;
@@ -171,12 +172,20 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
                        }
                        if (v) {
                                /* We have a match -- play a greeting if they have it */
-                               snprintf(fn, sizeof(fn), "%s/vm/%s/greet", (char *)ast_config_AST_SPOOL_DIR, v->name);
+                               /* Check for the VoiceMail2 greeting first */
+                               snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/greet", (char *)ast_config_AST_SPOOL_DIR, context, v->name);
+                               /* Otherwise, check for an old-style Voicemail greeting */
+                               snprintf(fn2, sizeof(fn2), "%s/vm/%s/greet", (char *)ast_config_AST_SPOOL_DIR, v->name);
                                if (ast_fileexists(fn, NULL, chan->language) > 0) {
                                        res = ast_streamfile(chan, fn, chan->language);
                                        if (!res)
                                                res = ast_waitstream(chan, AST_DIGIT_ANY);
                                        ast_stopstream(chan);
+                               } else if (ast_fileexists(fn2, NULL, chan->language) > 0) {
+                                       res = ast_streamfile(chan, fn2, chan->language);
+                                       if (!res)
+                                               res = ast_waitstream(chan, AST_DIGIT_ANY);
+                                       ast_stopstream(chan);
                                } else {
                                        res = ast_say_digit_str(chan, v->name, AST_DIGIT_ANY, chan->language);
                                }