Пример #1
0
static int load_module(void)
{
	CHECK_PJSIP_MODULE_LOADED();

	if (aco_info_init(&notify_cfg)) {
		return AST_MODULE_LOAD_DECLINE;
	}

	aco_option_register_custom(&notify_cfg, "^.*$", ACO_REGEX, notify_options,
				   "", notify_option_handler, 0);

	if (aco_process_config(&notify_cfg, 0)) {
		aco_info_destroy(&notify_cfg);
		return AST_MODULE_LOAD_DECLINE;
	}

	ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
	ast_manager_register_xml("PJSIPNotify", EVENT_FLAG_SYSTEM, manager_notify);

	return AST_MODULE_LOAD_SUCCESS;
}
Пример #2
0
int ast_ari_config_init(void)
{
	if (aco_info_init(&cfg_info)) {
		aco_info_destroy(&cfg_info);
		return -1;
	}

	aco_option_register(&cfg_info, "enabled", ACO_EXACT, general_options,
		"yes", OPT_BOOL_T, 1,
		FLDSET(struct ast_ari_conf_general, enabled));
	aco_option_register_custom(&cfg_info, "pretty", ACO_EXACT,
		general_options, "no",  encoding_format_handler, 0);
	aco_option_register(&cfg_info, "auth_realm", ACO_EXACT, general_options,
		"Asterisk REST Interface", OPT_CHAR_ARRAY_T, 0,
		FLDSET(struct ast_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 ast_ari_conf_general, allowed_origins));
	aco_option_register(&cfg_info, "websocket_write_timeout", ACO_EXACT, general_options,
		AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR, OPT_INT_T, PARSE_IN_RANGE,
		FLDSET(struct ast_ari_conf_general, write_timeout), 1, INT_MAX);

	aco_option_register(&cfg_info, "type", ACO_EXACT, user, NULL,
		OPT_NOOP_T, 0, 0);
	aco_option_register(&cfg_info, "read_only", ACO_EXACT, user,
		"no", OPT_BOOL_T, 1,
		FLDSET(struct ast_ari_conf_user, read_only));
	aco_option_register(&cfg_info, "password", ACO_EXACT, user,
		"", OPT_CHAR_ARRAY_T, 0,
		FLDSET(struct ast_ari_conf_user, password), ARI_PASSWORD_LEN);
	aco_option_register_custom(&cfg_info, "password_format", ACO_EXACT,
		user, "plain",  password_format_handler, 0);

	return process_config(0);
}