/** * Stop input CPA */ void rayo_cpa_component_shutdown(void) { switch_event_unbind_callback(on_rayo_cpa_detector_event); switch_event_unbind_callback(on_channel_hangup_complete_event); rayo_cpa_detector_shutdown(); switch_core_hash_destroy(&globals.subscribers); }
/*销毁数据库等资源 */ static switch_bool_t cari_net_destroy() { //cari_net_profile_t *profile = NULL; //const char *profile_name = CARI_NET_PROFILE;//对应配置文件的 <profile name="default"> ////先查找profile的结构 //profile = switch_core_hash_find(cari_net_globals.profile_hash, profile_name); //if (profile // && profile->odbc_dsn // && profile->master_odbc) //{ // //销毁数据库的句柄 // switch_odbc_handle_destroy(&profile->master_odbc); //} ////hash容器销毁 //switch_core_hash_destroy(&cari_net_globals.profile_hash); //socket对应的client的线程退出 setLoopFlag(SWITCH_FALSE); //事件回调函数解除绑定 switch_event_unbind_callback(cari_net_event_statechange); //释放端口号 shutdownSocketAndGarbage(); return SWITCH_TRUE; }
void FSHost::run(void) { switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT; const char *err = NULL; switch_bool_t console = SWITCH_FALSE; switch_status_t destroy_status; createFolders(); /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */ qDebug() << "Initializing core..."; /* Initialize the core and load modules, that will startup FS completely */ if (switch_core_init(flags, console, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err); emit coreLoadingError(err); } qDebug() << "Everything OK, Entering runtime loop ..."; if (switch_event_bind("FSHost", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, eventHandlerCallback, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); } emit loadingModules("Loading modules...", Qt::AlignRight|Qt::AlignBottom, Qt::blue); if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err); emit coreLoadingError(err); } switch_log_bind_logger(loggerHandler, SWITCH_LOG_DEBUG, SWITCH_FALSE); emit ready(); /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set * If its false, it initializes the libedit for the console, then does the same thing */ switch_core_runtime_loop(!console); fflush(stdout); switch_event_unbind_callback(eventHandlerCallback); /* When the runtime loop exits, its time to shutdown */ destroy_status = switch_core_destroy(); if (destroy_status == SWITCH_STATUS_SUCCESS) { qDebug() << "We have properly shutdown the core."; } }
/** * Shutdown record component * @return SWITCH_STATUS_SUCCESS if successful */ switch_status_t rayo_record_component_shutdown(void) { switch_event_unbind_callback(on_call_record_stop_event); switch_event_unbind_callback(on_mixer_record_event); return SWITCH_STATUS_SUCCESS; }
/** * Shutdown fax components * @return SWITCH_STATUS_SUCCESS if successful */ switch_status_t rayo_fax_components_shutdown(void) { switch_event_unbind_callback(on_execute_complete_event); return SWITCH_STATUS_SUCCESS; }