asterisk -rx "module reload chan_capi" works now. This allows to start Asterisk while CAPI is not loaded and reload chan_capi after CAPI received available. This is the same as unload and load module and does not preserves active connections

This commit is contained in:
MelwareDE 2011-11-16 21:43:04 +00:00
parent 02c9627241
commit 29b662a4b6
2 changed files with 26 additions and 10 deletions

View File

@ -8816,14 +8816,6 @@ static int capi_eval_config(struct ast_config *cfg)
return 0;
}
#ifdef CC_AST_HAS_VERSION_1_4
static int reload(void)
{
cc_log(LOG_WARNING, "config reload is not supported yet.\n");
return 0;
}
#endif
/*
* unload the module
*/
@ -8849,6 +8841,7 @@ int unload_module(void)
pthread_cancel(capi_device_thread);
pthread_kill(capi_device_thread, SIGURG);
pthread_join(capi_device_thread, NULL);
capi_device_thread = (pthread_t)(0-1);
}
cc_mutex_lock(&iflock);
@ -8865,6 +8858,7 @@ int unload_module(void)
diva_status_cleanup_interface(controller);
#endif
ast_free(capi_controllers[controller]);
capi_controllers[controller] = 0;
}
}
@ -8872,8 +8866,10 @@ int unload_module(void)
while (i) {
if ((i->owner) || (i->used))
cc_log(LOG_WARNING, "On unload, interface still has owner or is used.\n");
if (i->smoother)
if (i->smoother) {
ast_smoother_free(i->smoother);
i->smoother = 0;
}
pbx_capi_qsig_unload_module(i);
@ -8883,6 +8879,7 @@ int unload_module(void)
i = i->next;
ast_free(itmp);
}
capi_iflist = NULL;
cc_mutex_unlock(&iflock);
@ -8896,6 +8893,9 @@ int unload_module(void)
capi_tech.capabilities = ast_format_cap_destroy(capi_tech.capabilities);
#endif
capi_num_controllers = 0;
capi_counter = 0;
return 0;
}
@ -9005,6 +9005,20 @@ int load_module(void)
return 0;
}
#ifdef CC_AST_HAS_VERSION_1_4
static int reload(void)
{
int ret;
cc_verbose(1, 0, VERBOSE_PREFIX_1 "config reload\n");
unload_module();
ret = load_module();
return ret;
}
#endif
#ifdef CC_AST_HAS_VERSION_1_4
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc,
.load = load_module,

View File

@ -135,8 +135,10 @@ void capi_remove_nullif(struct capi_pvt *i)
}
cc_verbose(3, 1, VERBOSE_PREFIX_4 "%s: removed null-interface from controller %d.\n",
i->vname, i->controller);
if (i->smoother)
if (i->smoother) {
ast_smoother_free(i->smoother);
i->smoother = 0;
}
cc_mutex_destroy(&i->lock);
ast_cond_destroy(&i->event_trigger);
controller_nullplcis[i->controller - 1]--;