[asterisk-commits] russell: trunk r82595 - in /trunk: ./ res/res_features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 17 11:58:24 CDT 2007


Author: russell
Date: Mon Sep 17 11:58:23 2007
New Revision: 82595

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82595
Log:
Merged revisions 82594 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82594 | russell | 2007-09-17 11:46:59 -0500 (Mon, 17 Sep 2007) | 5 lines

Handle the case where there are multiple dynamic features with the same digit
mapping, but won't always match the activated on/by access controls.  In that
case, the code needs to keep trying features for a match.
(reported by Atis on the asterisk-dev list, patched by me)

........

Modified:
    trunk/   (props changed)
    trunk/res/res_features.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=82595&r1=82594&r2=82595
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Mon Sep 17 11:58:23 2007
@@ -549,6 +549,7 @@
 #define FEATURE_RETURN_PASSDIGITS	 21
 #define FEATURE_RETURN_STOREDIGITS	 22
 #define FEATURE_RETURN_SUCCESS	 	 23
+#define FEATURE_RETURN_KEEPTRYING    24
 
 #define FEATURE_SENSE_CHAN	(1 << 0)
 #define FEATURE_SENSE_PEER	(1 << 1)
@@ -1287,23 +1288,6 @@
 	return fg;
 }
 
-/*! 
- * \brief Find a feature extension 
- * \param fg, code
- * \retval feature group extension on success.
- * \retval NULL on failure.
-*/
-static struct feature_group_exten *find_group_exten(struct feature_group *fg, const char *code) {
-	struct feature_group_exten *fge = NULL;
-
-	AST_LIST_TRAVERSE(&fg->features, fge, entry) {
-		if(!strcasecmp(fge->exten, code))
-			break;
-	}
-
-	return fge;
-}
-
 void ast_rdlock_call_features(void)
 {
 	ast_rwlock_rdlock(&features_lock);
@@ -1347,7 +1331,7 @@
 
 	if (sense == FEATURE_SENSE_CHAN) {
 		if (!ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLER))
-			return FEATURE_RETURN_PASSDIGITS;
+			return FEATURE_RETURN_KEEPTRYING;
 		if (ast_test_flag(feature, AST_FEATURE_FLAG_ONSELF)) {
 			work = chan;
 			idle = peer;
@@ -1357,7 +1341,7 @@
 		}
 	} else {
 		if (!ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLEE))
-			return FEATURE_RETURN_PASSDIGITS;
+			return FEATURE_RETURN_KEEPTRYING;
 		if (ast_test_flag(feature, AST_FEATURE_FLAG_ONSELF)) {
 			work = peer;
 			idle = chan;
@@ -1473,10 +1457,20 @@
 
 		fg = find_group(tok);
 
-		if (fg && (fge = find_group_exten(fg, code))) {
-			res = fge->feature->operation(chan, peer, config, code, sense, fge->feature);
-			AST_RWLIST_UNLOCK(&feature_groups);
-			continue;
+		if (fg) {
+			AST_LIST_TRAVERSE(&fg->features, fge, entry) {
+				if (strcasecmp(fge->exten, code))
+					continue;
+
+				res = fge->feature->operation(chan, peer, config, code, sense, fge->feature);
+				if (res != FEATURE_RETURN_KEEPTRYING) {
+					AST_RWLIST_UNLOCK(&feature_groups);
+					break;
+				}
+				res = FEATURE_RETURN_PASSDIGITS;
+			}
+			if (fge)
+				break;
 		}
 
 		AST_RWLIST_UNLOCK(&feature_groups);
@@ -1491,8 +1485,11 @@
 		if (!strcmp(feature->exten, code)) {
 			ast_verb(3, " Feature Found: %s exten: %s\n",feature->sname, tok);
 			res = feature->operation(chan, peer, config, code, sense, feature);
-			AST_LIST_UNLOCK(&feature_list);
-			break;
+			if (res != FEATURE_RETURN_KEEPTRYING) {
+				AST_LIST_UNLOCK(&feature_list);
+				break;
+			}
+			res = FEATURE_RETURN_PASSDIGITS;
 		} else if (!strncmp(feature->exten, code, strlen(code)))
 			res = FEATURE_RETURN_STOREDIGITS;
 




More information about the asterisk-commits mailing list