diff options
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 4b4367845..ebab90190 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -13829,7 +13829,6 @@ container_fail: /*! \brief Load IAX2 module, load configuraiton ---*/ static int load_module(void) { - static const char config[] = "iax.conf"; int x = 0; struct iax2_registry *reg = NULL; @@ -13838,14 +13837,6 @@ static int load_module(void) return AST_MODULE_LOAD_FAILURE; } - randomcalltokendata = ast_random(); - ast_custom_function_register(&iaxpeer_function); - ast_custom_function_register(&iaxvar_function); - - iax_set_output(iax_debug_output); - iax_set_error(iax_error_output); - jb_setoutput(jb_error_output, jb_warning_output, NULL); - memset(iaxs, 0, sizeof(iaxs)); for (x = 0; x < ARRAY_LEN(iaxsl); x++) { @@ -13880,10 +13871,26 @@ static int load_module(void) } ast_netsock_init(outsock); + randomcalltokendata = ast_random(); + + iax_set_output(iax_debug_output); + iax_set_error(iax_error_output); + jb_setoutput(jb_error_output, jb_warning_output, NULL); + + if (set_config(config, 0) == -1) { + if (timer) { + ast_timer_close(timer); + } + return AST_MODULE_LOAD_DECLINE; + } + ast_cli_register_multiple(cli_iax2, ARRAY_LEN(cli_iax2)); ast_register_application_xml(papp, iax2_prov_app); - + + ast_custom_function_register(&iaxpeer_function); + ast_custom_function_register(&iaxvar_function); + ast_manager_register( "IAXpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peers, "List IAX Peers" ); ast_manager_register( "IAXpeerlist", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peer_list, "List IAX Peers" ); ast_manager_register( "IAXnetstats", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_netstats, "Show IAX Netstats" ); @@ -13893,28 +13900,23 @@ static int load_module(void) ast_timer_set_rate(timer, trunkfreq); } - if (set_config(config, 0) == -1) { - if (timer) { - ast_timer_close(timer); - } - return AST_MODULE_LOAD_DECLINE; - } - if (ast_channel_register(&iax2_tech)) { ast_log(LOG_ERROR, "Unable to register channel class %s\n", "IAX2"); __unload_module(); return AST_MODULE_LOAD_FAILURE; } - if (ast_register_switch(&iax2_switch)) + if (ast_register_switch(&iax2_switch)) { ast_log(LOG_ERROR, "Unable to register IAX switch\n"); + } if (start_network_thread()) { ast_log(LOG_ERROR, "Unable to start network thread\n"); __unload_module(); return AST_MODULE_LOAD_FAILURE; - } else + } else { ast_verb(2, "IAX Ready and Listening\n"); + } AST_LIST_LOCK(®istrations); AST_LIST_TRAVERSE(®istrations, reg, entry) |