[asterisk-commits] mmichelson: branch mmichelson/features_config r390032 - /team/mmichelson/feat...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 12:37:09 CDT 2013


Author: mmichelson
Date: Wed May 29 12:37:05 2013
New Revision: 390032

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390032
Log:
The bridge now registers dynamic features based on the features_config API.


Modified:
    team/mmichelson/features_config/main/features.c

Modified: team/mmichelson/features_config/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/features_config/main/features.c?view=diff&rev=390032&r1=390031&r2=390032
==============================================================================
--- team/mmichelson/features_config/main/features.c (original)
+++ team/mmichelson/features_config/main/features.c Wed May 29 12:37:05 2013
@@ -4014,6 +4014,20 @@
 		app_data, ast_free_ptr, 1);
 }
 
+static int setup_dynamic_feature(void *obj, void *arg, void *data, int flags)
+{
+	struct ast_applicationmap_item *item = obj;
+	struct ast_bridge_features *features = arg;
+	int *res = data;
+
+	/* BUGBUG need to pass to add_dynamic_dtmf_hook the applicationmap name (item->name) so the DYNAMIC_FEATURENAME can be set on the channel when it is run. */
+	*res |= add_dynamic_dtmf_hook(features, item->activate_on_self ? AST_FEATURE_FLAG_ONSELF :
+			AST_FEATURE_FLAG_ONPEER, item->dtmf, item->app, item->app_data,
+			item->moh_class);
+
+	return 0;
+}
+
 /*!
  * \internal
  * \brief Setup bridge dynamic features.
@@ -4027,47 +4041,16 @@
  */
 static int setup_bridge_features_dynamic(struct ast_bridge_features *features, struct ast_channel *chan)
 {
-	const char *feat;
-	char *dynamic_features = NULL;
-	char *tok;
-	int res;
-
-	ast_channel_lock(chan);
-	feat = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES");
-	if (!ast_strlen_zero(feat)) {
-		dynamic_features = ast_strdupa(feat);
-	}
-	ast_channel_unlock(chan);
-	if (!dynamic_features) {
+	RAII_VAR(struct ao2_container *, applicationmap, NULL, ao2_cleanup);
+	int res = 0;
+
+	applicationmap = ast_get_chan_applicationmap(chan);
+	if (!applicationmap) {
 		return 0;
 	}
 
-/* BUGBUG need to pass to add_dynamic_dtmf_hook the applicationmap name (feature->sname) so the DYNAMIC_FEATURENAME can be set on the channel when it is run. */
-	res = 0;
-	while ((tok = strsep(&dynamic_features, "#"))) {
-		struct feature_group *fg;
-		struct ast_call_feature *feature;
-
-		AST_RWLIST_RDLOCK(&feature_groups);
-		fg = find_group(tok);
-		if (fg) {
-			struct feature_group_exten *fge;
-
-			AST_LIST_TRAVERSE(&fg->features, fge, entry) {
-				res |= add_dynamic_dtmf_hook(features, fge->feature->flags, fge->exten,
-					fge->feature->app, fge->feature->app_args, fge->feature->moh_class);
-			}
-		}
-		AST_RWLIST_UNLOCK(&feature_groups);
-
-		ast_rdlock_call_features();
-		feature = find_dynamic_feature(tok);
-		if (feature) {
-			res |= add_dynamic_dtmf_hook(features, feature->flags, feature->exten,
-				feature->app, feature->app_args, feature->moh_class);
-		}
-		ast_unlock_call_features();
-	}
+	ao2_callback_data(applicationmap, 0, setup_dynamic_feature, features, &res);
+
 	return res;
 }
 




More information about the asterisk-commits mailing list