From e791a85615fa8dd59deb11825b84d00e3d04e54b Mon Sep 17 00:00:00 2001 From: pabelanger Date: Fri, 10 Sep 2010 20:35:08 +0000 Subject: Load iax.conf before registering any functions/applications/actions. Review: https://reviewboard.asterisk.org/r/914/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@286114 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_iax2.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'channels') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 0fc3f70e9..f4bcf13f6 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -12713,13 +12713,6 @@ static int load_module(void) return AST_MODULE_LOAD_FAILURE; } - randomcalltokendata = ast_random(); - ast_custom_function_register(&iaxpeer_function); - - iax_set_output(iax_debug_output); - iax_set_error(iax_error_output); - jb_setoutput(jb_error_output, jb_warning_output, NULL); - #ifdef HAVE_DAHDI #ifdef DAHDI_TIMERACK timingfd = open(DAHDI_FILE_TIMER, O_RDWR); @@ -12735,12 +12728,12 @@ static int load_module(void) for (x = 0; x < ARRAY_LEN(iaxsl); x++) { ast_mutex_init(&iaxsl[x]); } - + ast_cond_init(&sched_cond, NULL); io = io_context_create(); sched = sched_context_create(); - + if (!io || !sched) { ast_log(LOG_ERROR, "Out of memory\n"); return -1; @@ -12760,33 +12753,44 @@ 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); + ast_mutex_init(&waresl.lock); AST_LIST_HEAD_INIT(&iaxq.queue); - + + if (set_config(config, 0) == -1) { + return AST_MODULE_LOAD_DECLINE; + } + ast_cli_register_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry)); ast_register_application(papp, iax2_prov_app, psyn, pdescrip); - + + ast_custom_function_register(&iaxpeer_function); + ast_manager_register( "IAXpeers", 0, manager_iax2_show_peers, "List IAX Peers" ); ast_manager_register( "IAXnetstats", 0, manager_iax2_show_netstats, "Show IAX Netstats" ); - if(set_config(config, 0) == -1) - return AST_MODULE_LOAD_DECLINE; - - if (ast_channel_register(&iax2_tech)) { + if (ast_channel_register(&iax2_tech)) { ast_log(LOG_ERROR, "Unable to register channel class %s\n", "IAX2"); __unload_module(); return -1; } - if (ast_register_switch(&iax2_switch)) + if (ast_register_switch(&iax2_switch)) { ast_log(LOG_ERROR, "Unable to register IAX switch\n"); + } res = start_network_thread(); if (!res) { - if (option_verbose > 1) + if (option_verbose > 1) { ast_verbose(VERBOSE_PREFIX_2 "IAX Ready and Listening\n"); + } } else { ast_log(LOG_ERROR, "Unable to start network thread\n"); ast_netsock_release(netsock); -- cgit v1.2.3