aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-07 00:07:37 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-07 00:07:37 +0000
commit99c687c8c10918a67eac75af7935cd56cbd1505b (patch)
tree1c2e936f39f5178092e232e55e73a9cebf570379 /apps
parent1296b9dcbd3c1bfbf0aa2f80754873cdad2a29f0 (diff)
Don't create a Local channel if the target extension does not exist.
(closes issue #18126) Reported by: junky Patches: followme.diff uploaded by junky (license 177) (partially restructured by me to avoid a possible memory leak) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@297689 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_followme.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 4b93b3b10..92cabd12b 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -801,7 +801,6 @@ static void findmeexec(struct fm_args *tpargs)
break;
while (nm) {
-
if (option_debug > 1)
ast_log(LOG_DEBUG, "Number %s timeout %ld\n", nm->number,nm->timeout);
@@ -815,18 +814,25 @@ static void findmeexec(struct fm_args *tpargs)
rest++;
}
+ /* We check if that context exists, before creating the ast_channel struct needed */
+ if (!ast_exists_extension(caller, tpargs->context, number, 1, caller->cid.cid_num)) {
+ /* XXX Should probably restructure to simply skip this item, instead of returning. XXX */
+ ast_log(LOG_ERROR, "Extension '%s@%s' doesn't exist\n", number, tpargs->context);
+ free(findme_user_list);
+ return;
+ }
+
if (!strcmp(tpargs->context, ""))
snprintf(dialarg, sizeof(dialarg), "%s", number);
else
snprintf(dialarg, sizeof(dialarg), "%s@%s", number, tpargs->context);
-
+
tmpuser = ast_calloc(1, sizeof(*tmpuser));
if (!tmpuser) {
- ast_log(LOG_WARNING, "Out of memory!\n");
free(findme_user_list);
return;
}
-
+
outbound = ast_request("Local", ast_best_codec(caller->nativeformats), dialarg, &dg);
if (outbound) {
ast_set_callerid(outbound, caller->cid.cid_num, caller->cid.cid_name, caller->cid.cid_num);