Make directory spell name if available

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-05-03 04:36:46 +00:00
parent 131a8c8f53
commit 0e89f839e1

View File

@@ -125,6 +125,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
{ {
/* Read in the first three digits.. "digit" is the first digit, already read */ /* Read in the first three digits.. "digit" is the first digit, already read */
char ext[NUMDIGITS + 1]; char ext[NUMDIGITS + 1];
char name[80] = "";
struct ast_variable *v; struct ast_variable *v;
int res; int res;
int found=0; int found=0;
@@ -152,6 +153,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
strsep(&stringp, ","); strsep(&stringp, ",");
pos = strsep(&stringp, ","); pos = strsep(&stringp, ",");
if (pos) { if (pos) {
strncpy(name, pos, sizeof(name) - 1);
/* Grab the last name */ /* Grab the last name */
if (strrchr(pos, ' ')) if (strrchr(pos, ' '))
pos = strrchr(pos, ' ') + 1; pos = strrchr(pos, ' ') + 1;
@@ -188,7 +190,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
res = ast_waitstream(chan, AST_DIGIT_ANY); res = ast_waitstream(chan, AST_DIGIT_ANY);
ast_stopstream(chan); ast_stopstream(chan);
} else { } else {
res = ast_say_digit_str(chan, v->name, AST_DIGIT_ANY, chan->language); res = ast_say_character_str(chan, strlen(name) ? name : v->name, AST_DIGIT_ANY, chan->language);
} }
ahem: ahem:
if (!res) if (!res)