[asterisk-commits] tilghman: branch 1.4 r297689 - /branches/1.4/apps/app_followme.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 6 18:07:42 CST 2010


Author: tilghman
Date: Mon Dec  6 18:07:37 2010
New Revision: 297689

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=297689
Log:
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)

Modified:
    branches/1.4/apps/app_followme.c

Modified: branches/1.4/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_followme.c?view=diff&rev=297689&r1=297688&r2=297689
==============================================================================
--- branches/1.4/apps/app_followme.c (original)
+++ branches/1.4/apps/app_followme.c Mon Dec  6 18:07:37 2010
@@ -801,7 +801,6 @@
 			break;
 
 	while (nm) {
-
 		if (option_debug > 1)	
 			ast_log(LOG_DEBUG, "Number %s timeout %ld\n", nm->number,nm->timeout);
 
@@ -815,18 +814,25 @@
 				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);




More information about the asterisk-commits mailing list