aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-01-30 15:03:20 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-01-30 15:03:20 +0000
commita8282b50e1826df08d77e3989b637814415b5865 (patch)
tree03c27ab3cc019e3323dea0a3464f071a18fa1d18 /apps/app_directory.c
parent3e152dc0f17e3948a6d3945f203f62060f987c17 (diff)
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@593 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directory.c')
-rwxr-xr-xapps/app_directory.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index 8618030fc..868badb02 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -25,6 +25,7 @@
#include <pthread.h>
#include <stdio.h>
#include "../asterisk.h"
+#include "../astconf.h"
static char *tdesc = "Extension Directory";
static char *app = "Directory";
@@ -127,13 +128,12 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
struct ast_variable *v;
int res;
int found=0;
- char *start, *pos, *conv;
+ char *start, *pos, *conv,*stringp=NULL;
char fn[256];
memset(ext, 0, sizeof(ext));
ext[0] = digit;
res = 0;
if (ast_readstring(chan, ext + 1, NUMDIGITS - 1, 3000, 3000, "#") < 0) res = -1;
- printf("Res: %d, ext: %s\n", res, ext);
if (!res) {
/* Search for all names which start with those digits */
v = ast_variable_browse(cfg, context);
@@ -143,8 +143,9 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
/* Find a candidate extension */
start = strdup(v->value);
if (start) {
- strtok(start, ",");
- pos = strtok(NULL, ",");
+ stringp=start;
+ strsep(&stringp, ",");
+ pos = strsep(&stringp, ",");
if (pos) {
/* Grab the last name */
if (strrchr(pos, ' '))
@@ -167,7 +168,7 @@ 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", AST_SPOOL_DIR, v->name);
+ snprintf(fn, sizeof(fn), "%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)