summaryrefslogtreecommitdiff
path: root/res/stasis_http
diff options
context:
space:
mode:
Diffstat (limited to 'res/stasis_http')
-rw-r--r--res/stasis_http/cli.c1
-rw-r--r--res/stasis_http/config.c10
-rw-r--r--res/stasis_http/internal.h4
3 files changed, 15 insertions, 0 deletions
diff --git a/res/stasis_http/cli.c b/res/stasis_http/cli.c
index 98d082b2c..ac974dc14 100644
--- a/res/stasis_http/cli.c
+++ b/res/stasis_http/cli.c
@@ -71,6 +71,7 @@ static char *ari_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
}
ast_cli(a->fd, "\n");
ast_cli(a->fd, "Auth realm: %s\n", conf->general->auth_realm);
+ ast_cli(a->fd, "Allowed Origins: %s\n", conf->general->allowed_origins);
ast_cli(a->fd, "User count: %d\n", ao2_container_count(conf->users));
return CLI_SUCCESS;
}
diff --git a/res/stasis_http/config.c b/res/stasis_http/config.c
index 2181907d5..7ccfe8e59 100644
--- a/res/stasis_http/config.c
+++ b/res/stasis_http/config.c
@@ -158,6 +158,9 @@ static struct aco_type *user[] = ACO_TYPES(&user_option);
static void conf_destructor(void *obj)
{
struct ari_conf *cfg = obj;
+
+ ast_string_field_free_memory(cfg->general);
+
ao2_cleanup(cfg->general);
ao2_cleanup(cfg->users);
}
@@ -180,6 +183,10 @@ static void *conf_alloc(void)
}
aco_set_defaults(&general_option, "general", cfg->general);
+ if (ast_string_field_init(cfg->general, 64)) {
+ return NULL;
+ }
+
cfg->users = ao2_container_alloc_rbtree(AO2_ALLOC_OPT_LOCK_NOLOCK,
AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, user_sort_cmp, NULL);
@@ -308,6 +315,9 @@ int ari_config_init(void)
"Asterisk REST Interface", OPT_CHAR_ARRAY_T, 0,
FLDSET(struct ari_conf_general, auth_realm),
ARI_AUTH_REALM_LEN);
+ aco_option_register(&cfg_info, "allowed_origins", ACO_EXACT, general_options,
+ "", OPT_STRINGFIELD_T, 0,
+ STRFLDSET(struct ari_conf_general, allowed_origins));
aco_option_register(&cfg_info, "type", ACO_EXACT, user, NULL,
OPT_NOOP_T, 0, 0);
diff --git a/res/stasis_http/internal.h b/res/stasis_http/internal.h
index 659f4a2ae..7cc67cfbf 100644
--- a/res/stasis_http/internal.h
+++ b/res/stasis_http/internal.h
@@ -67,6 +67,10 @@ struct ari_conf_general {
enum ast_json_encoding_format format;
/*! Authentication realm */
char auth_realm[ARI_AUTH_REALM_LEN];
+
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(allowed_origins);
+ );
};
/*! \brief Password format */