]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_confbridge: Default the template option to a compatible default profile. 42/242/6
authorKevin Harwell <kharwell@digium.com>
Thu, 23 Apr 2015 20:05:07 +0000 (15:05 -0500)
committerKevin Harwell <kharwell@digium.com>
Fri, 24 Apr 2015 17:20:22 +0000 (12:20 -0500)
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

apps/confbridge/conf_config_parser.c

index 1b1437b96a1143587aa6de6a38368eac38619dcf..98838de0a1bd02cf86297af1b89d0805baef9699 100644 (file)
@@ -343,12 +343,17 @@ static const struct ast_datastore_info confbridge_datastore = {
        .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);
@@ -405,11 +410,21 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data
        tmpvar.value = value;
        tmpvar.file = "CONFBRIDGE";
        if (!strcasecmp(args.type, "bridge")) {
+               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;
                }
        } else if (!strcasecmp(args.type, "user")) {
+               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;