From c0d2b5b16dfbf6c51e14c623845375d587c728d6 Mon Sep 17 00:00:00 2001 From: BJ Weschke Date: Tue, 30 Oct 2007 14:31:45 +0000 Subject: [PATCH] Fix issue where the recorded name wasn't getting removed correctly. (closes issue #11115) Reported by: davevg Patches: followme-v3.diff git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@87514 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_followme.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/app_followme.c b/apps/app_followme.c index 075bc9f1ac..70327b4187 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -78,6 +78,7 @@ static char *descrip = struct number { char number[512]; /*!< Phone Number(s) and/or Extension(s) */ long timeout; /*!< Dial Timeout, if used. */ + char language[MAX_LANGUAGE]; /*!< The language to be used on this dial, if used. */ int order; /*!< The order to dial in */ AST_LIST_ENTRY(number) entry; /*!< Next Number record */ }; @@ -255,7 +256,7 @@ static void profile_set_param(struct call_followme *f, const char *param, const } /*! \brief Add a new number */ -static struct number *create_followme_number(char *number, int timeout, int numorder) +static struct number *create_followme_number(char *number, char *language, int timeout, int numorder) { struct number *cur; char *tmp; @@ -268,6 +269,7 @@ static struct number *create_followme_number(char *number, int timeout, int numo if ((tmp = strchr(number, ','))) *tmp = '\0'; ast_copy_string(cur->number, number, sizeof(cur->number)); + ast_copy_string(cur->language, language, sizeof(cur->language)); cur->order = numorder; if (option_debug) ast_log(LOG_DEBUG, "Created a number, %s, order of , %d, with a timeout of %ld.\n", cur->number, cur->order, cur->timeout); @@ -916,6 +918,7 @@ static int app_exec(struct ast_channel *chan, void *data) struct ast_module_user *u; char *argstr; char namerecloc[255]; + char *fname = NULL; int duration = 0; struct ast_channel *caller; struct ast_channel *outbound; @@ -1011,10 +1014,6 @@ static int app_exec(struct ast_channel *chan, void *data) free(nm); } AST_LIST_TRAVERSE_SAFE_END - - if (!ast_strlen_zero(namerecloc)) - unlink(namerecloc); - if (targs.status != 100) { ast_moh_stop(chan); if (ast_test_flag(&targs.followmeflags, FOLLOWMEFLAG_UNREACHABLEMSG)) @@ -1053,6 +1052,12 @@ static int app_exec(struct ast_channel *chan, void *data) } } outrun: + + if (!ast_strlen_zero(namerecloc)){ + fname = alloca(strlen(namerecloc) + 5); + sprintf(fname, "%s.sln", namerecloc); + unlink(fname); + } ast_module_user_remove(u);