static int load_module(void) { if (load_config()) { if (ast_register_application_xml(app, alarmreceiver_exec)) return AST_MODULE_LOAD_FAILURE; return AST_MODULE_LOAD_SUCCESS; } else return AST_MODULE_LOAD_DECLINE; }
static int load_module(void) { RAII_VAR(struct stasis_message_router *, router, ast_cdr_message_router(), ao2_cleanup); int res = 0; if (!router) { return AST_MODULE_LOAD_FAILURE; } res |= STASIS_MESSAGE_TYPE_INIT(appcdr_message_type); res |= ast_register_application_xml(nocdr_app, nocdr_exec); res |= ast_register_application_xml(resetcdr_app, resetcdr_exec); res |= stasis_message_router_add(router, appcdr_message_type(), appcdr_callback, NULL); if (res) { return AST_MODULE_LOAD_FAILURE; } return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { int res = 0; const char *val = NULL; struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE }; struct ast_config *cfg; /* Set some defaults */ cfg_buffer_size = 65535; cfg_goto_exten = 0; samplerate = 8000; /* G711a/G711u */ ast_copy_string(cfg_voice, "Allison-8kHz", sizeof(cfg_voice)); res = ast_register_application_xml(app, app_exec) ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; cfg = ast_config_load(SWIFT_CONFIG_FILE, config_flags); if (cfg) { if ((val = ast_variable_retrieve(cfg, "general", "buffer_size"))) { cfg_buffer_size = atoi(val); ast_log(LOG_DEBUG, "Config buffer_size is %d\n", cfg_buffer_size); } if ((val = ast_variable_retrieve(cfg, "general", "goto_exten"))) { if (!strcmp(val, "yes")) { cfg_goto_exten = 1; } else { cfg_goto_exten = 0; ast_log(LOG_DEBUG, "Config goto_exten is %d\n", cfg_goto_exten); } } if ((val = ast_variable_retrieve(cfg, "general", "voice"))) { ast_copy_string(cfg_voice, val, sizeof(cfg_voice)); ast_log(LOG_DEBUG, "Config voice is %s\n", cfg_voice); } ast_config_destroy(cfg); } else { ast_log(LOG_NOTICE, "Failed to load config\n"); } return res; }
static int load_module(void) { return ast_register_application_xml(app, sendtext_exec); }
static int load_module(void) { return ast_register_application_xml(app, waituntil_exec); }
static int load_module(void) { return ast_register_application_xml(app, dumpchan_exec); }
static int load_module(void) { return ast_register_application_xml(app, bridgeadd_exec); }
static int load_module(void) { return ((ast_register_application_xml(app, conf_exec)) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS); }
static int load_module(void) { if (ast_register_application_xml(app, adsi_exec)) return AST_MODULE_LOAD_FAILURE; return AST_MODULE_LOAD_SUCCESS; }
static int load_module(void) { return ast_register_application_xml(app_morsecode, morsecode_exec); }
static int load_module(void) { return ast_register_application_xml(app2, setcallerid_pres_exec); }
AST_COMPAT_STATIC int load_module(void) { int res = 0; apr_hash_index_t *hi; if (apr_initialized == 0) { if (apr_initialize() != APR_SUCCESS) { ast_log(LOG_ERROR, "Unable to initialize APR\n"); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } else { ast_log(LOG_DEBUG, "APR initialized\n"); apr_initialized = 1; } } /* Initialize globals. */ if (globals_init() != 0) { ast_log(LOG_DEBUG, "Unable to initialize globals\n"); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } /* Load the configuration file mrcp.conf. */ #if AST_VERSION_AT_LEAST(1,6,0) struct ast_flags config_flags = { 0 }; struct ast_config *cfg = ast_config_load(MRCP_CONFIG, config_flags); #else struct ast_config *cfg = ast_config_load(MRCP_CONFIG); #endif if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", MRCP_CONFIG); globals_destroy(); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } if (load_mrcp_config(cfg) != 0) { ast_log(LOG_DEBUG, "Unable to load configuration\n"); globals_destroy(); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } /* Link UniMRCP logs to Asterisk. */ ast_log(LOG_NOTICE, "UniMRCP log level = %s\n", globals.unimrcp_log_level); apt_log_priority_e log_priority = apt_log_priority_translate(globals.unimrcp_log_level); if (apt_log_instance_create(APT_LOG_OUTPUT_NONE, log_priority, globals.pool) == FALSE) { /* Already created. */ apt_log_priority_set(log_priority); } apt_log_ext_handler_set(unimrcp_log); /* Create the MRCP client. */ if ((globals.mrcp_client = mod_unimrcp_client_create(globals.pool)) == NULL) { ast_log(LOG_ERROR, "Failed to create MRCP client\n"); if (!apt_log_instance_destroy()) ast_log(LOG_WARNING, "Unable to destroy UniMRCP logger instance\n"); globals_destroy(); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } /* Load the applications. */ load_mrcpsynth_app(); load_mrcprecog_app(); load_synthandrecog_app(); /* Start the client stack. */ if (!mrcp_client_start(globals.mrcp_client)) { ast_log(LOG_ERROR, "Failed to start MRCP client stack processing\n"); if (!mrcp_client_destroy(globals.mrcp_client)) ast_log(LOG_WARNING, "Unable to destroy MRCP client stack\n"); else ast_log(LOG_DEBUG, "MRCP client stack destroyed\n"); globals.mrcp_client = NULL; if (!apt_log_instance_destroy()) ast_log(LOG_WARNING, "Unable to destroy UniMRCP logger instance\n"); globals_destroy(); apr_terminate(); apr_initialized = 0; return AST_MODULE_LOAD_DECLINE; } /* Register the applications. */ for (hi = apr_hash_first(NULL, globals.apps); hi; hi = apr_hash_next(hi)) { const void *key; void *val; const char *name; ast_mrcp_application_t *application; apr_hash_this(hi, &key, NULL, &val); name = (const char *) key; application = (ast_mrcp_application_t *) val; #if AST_VERSION_AT_LEAST(1,6,2) res |= ast_register_application_xml(name, application->exec); #else res |= ast_register_application(name, application->exec, application->synopsis, application->description); #endif } return res; }
static int load_module(void) { return ast_register_application_xml(app, milliwatt_exec); }