[asterisk-commits] app confbridge: Default the template option to a compatible ... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 24 13:07:07 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: app_confbridge: Default the template option to a compatible default profile.
......................................................................


app_confbridge: Default the template option to a compatible default profile.

Confbridge dynamic profiles did not have a default profile unless you
explicitly used Set(CONFBRIDGE(bridge,template)=default_bridge). If a
template was not set prior to the bridge being created then some
options were left with no default values set. This patch makes it so
the default templates are set to the default bridge and user profiles.

ASTERISK-24749 #close
Reported by: philippebolduc

Change-Id: I1bd6e94b38701ac2112d842db68de63d46f60e0a
---
M apps/confbridge/conf_config_parser.c
1 file changed, 29 insertions(+), 3 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index af5dfce..6d6f7ab 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -941,12 +941,17 @@
 	.type = "confbridge",
 	.destroy = func_confbridge_destroy_cb
 };
+
 int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data, const char *value)
 {
 	struct ast_datastore *datastore;
 	struct func_confbridge_data *b_data;
 	char *parse;
 	struct ast_variable tmpvar = { 0, };
+	struct ast_variable template = {
+		.name = "template",
+		.file = "CONFBRIDGE"
+	};
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(type);
 		AST_APP_ARG(option);
@@ -1019,7 +1024,14 @@
 				ast_datastore_free(datastore);
 			}
 			return 0;
-		} else if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
+		}
+
+		if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
+			template.value = DEFAULT_BRIDGE_PROFILE;
+			aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
+		}
+
+		if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
 			b_data->b_usable = 1;
 			return 0;
 		}
@@ -1029,7 +1041,14 @@
 			user_profile_destructor(&b_data->u_profile);
 			memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
 			return 0;
-		} else if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
+		}
+
+		if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
+			template.value = DEFAULT_USER_PROFILE;
+			aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
+		}
+
+		if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
 			b_data->u_usable = 1;
 			return 0;
 		}
@@ -1045,7 +1064,14 @@
 				ast_datastore_free(datastore);
 			}
 			return 0;
-		} else if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
+		}
+
+		if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
+			template.value = DEFAULT_MENU_PROFILE;
+			aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
+		}
+
+		if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
 			b_data->m_usable = 1;
 			return 0;
 		}

-- 
To view, visit https://gerrit.asterisk.org/243
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1bd6e94b38701ac2112d842db68de63d46f60e0a
Gerrit-PatchSet: 6
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list