Prototypes for public functions only of internal interest,. More...
Go to the source code of this file.
Functions | |
void | ast_autoservice_init (void) |
void | ast_builtins_init (void) |
initialize the _full_cmd string in * each of the builtins. | |
int | ast_cel_engine_init (void) |
int | ast_cel_engine_reload (void) |
void | ast_channels_init (void) |
int | ast_cli_perms_init (int reload) |
int | ast_data_init (void) |
int | ast_device_state_engine_init (void) |
Initialize the device state engine in separate thread. | |
int | ast_event_init (void) |
int | ast_features_init (void) |
int | ast_file_init (void) |
int | ast_http_init (void) |
int | ast_http_reload (void) |
int | ast_indications_init (void) |
Load indications module. | |
int | ast_indications_reload (void) |
Reload indications module. | |
int | ast_module_reload (const char *name) |
Reload asterisk modules. | |
int | ast_plc_reload (void) |
Reload genericplc configuration value from codecs.conf. | |
void | ast_process_pending_reloads (void) |
Process reload requests received during startup. | |
int | ast_ssl_init (void) |
void | ast_stun_init (void) |
Initialize the STUN system in Asterisk. | |
int | ast_term_init (void) |
int | ast_test_init (void) |
int | ast_timing_init (void) |
int | ast_tps_init (void) |
int | ast_xmldoc_load_documentation (void) |
Load XML documentation. Provided by xmldoc.c. | |
int | astdb_init (void) |
int | astobj2_init (void) |
void | clean_time_zones (void) |
void | close_logger (void) |
int | dnsmgr_init (void) |
int | dnsmgr_reload (void) |
void | dnsmgr_start_refresh (void) |
int | init_framer (void) |
int | init_logger (void) |
int | load_modules (unsigned int) |
int | load_pbx (void) |
void | threadstorage_init (void) |
Prototypes for public functions only of internal interest,.
Definition in file _private.h.
void ast_autoservice_init | ( | void | ) |
Provided by autoservice.c
Definition at line 335 of file autoservice.c.
References as_cond, ast_cond_init, ast_register_cleanup(), and autoservice_shutdown().
Referenced by main().
00336 { 00337 ast_register_cleanup(autoservice_shutdown); 00338 ast_cond_init(&as_cond, NULL); 00339 }
void ast_builtins_init | ( | void | ) |
initialize the _full_cmd string in * each of the builtins.
Provided by cli.c
Definition at line 1880 of file cli.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), and cli_shutdown().
Referenced by main().
01881 { 01882 ast_cli_register_multiple(cli_cli, ARRAY_LEN(cli_cli)); 01883 ast_register_atexit(cli_shutdown); 01884 }
int ast_cel_engine_init | ( | void | ) |
Provided by cel.c
Definition at line 860 of file cel.c.
References ao2_container_alloc, app_cmp(), app_hash(), ast_cel_engine_term(), ast_cli_register(), ast_register_atexit(), do_reload(), lid_cmp(), lid_hash(), and NUM_APP_BUCKETS.
Referenced by main().
00861 { 00862 /* 00863 * Accesses to the appset and linkedids containers have to be 00864 * protected by the reload_lock so they don't need a lock of 00865 * their own. 00866 */ 00867 appset = ao2_container_alloc(NUM_APP_BUCKETS, app_hash, app_cmp); 00868 if (!appset) { 00869 return -1; 00870 } 00871 linkedids = ao2_container_alloc(NUM_APP_BUCKETS, lid_hash, lid_cmp); 00872 if (!linkedids) { 00873 ast_cel_engine_term(); 00874 return -1; 00875 } 00876 00877 if (do_reload(0) || ast_cli_register(&cli_status)) { 00878 ast_cel_engine_term(); 00879 return -1; 00880 } 00881 00882 ast_register_atexit(ast_cel_engine_term); 00883 00884 return 0; 00885 }
int ast_cel_engine_reload | ( | void | ) |
Provided by cel.c
Definition at line 887 of file cel.c.
References do_reload().
00888 { 00889 return do_reload(1); 00890 }
void ast_channels_init | ( | void | ) |
Provided by channel.c
Definition at line 8221 of file channel.c.
References ao2_container_alloc, ARRAY_LEN, ast_channel_cmp_cb(), ast_channel_hash_cb(), ast_cli_register_multiple(), ast_data_register_multiple_core, ast_plc_reload(), ast_register_atexit(), channels, channels_shutdown(), cli_channel, and NUM_CHANNEL_BUCKETS.
Referenced by main().
08222 { 08223 channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS, 08224 ast_channel_hash_cb, ast_channel_cmp_cb); 08225 08226 ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel)); 08227 08228 ast_data_register_multiple_core(channel_providers, ARRAY_LEN(channel_providers)); 08229 08230 ast_plc_reload(); 08231 08232 ast_register_atexit(channels_shutdown); 08233 }
int ast_cli_perms_init | ( | int | reload | ) |
Provided by cli.c
Definition at line 1752 of file cli.c.
References ast_calloc, ast_category_browse(), ast_config_destroy(), ast_config_load2(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log(), ast_mutex_trylock, ast_mutex_unlock, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_strlen_zero(), ast_variable_browse(), cli_perm::command, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEUNCHANGED, destroy_user_perms(), usergroup_cli_perm::gid, LOG_NOTICE, LOG_WARNING, ast_variable::name, ast_variable::next, cli_perm::permit, usergroup_cli_perm::perms, perms_config, usergroup_cli_perm::uid, and ast_variable::value.
Referenced by handle_cli_reload_permissions(), and main().
01753 { 01754 struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; 01755 struct ast_config *cfg; 01756 char *cat = NULL; 01757 struct ast_variable *v; 01758 struct usergroup_cli_perm *user_group, *cp_entry; 01759 struct cli_perm *perm = NULL; 01760 struct passwd *pw; 01761 struct group *gr; 01762 01763 if (ast_mutex_trylock(&permsconfiglock)) { 01764 ast_log(LOG_NOTICE, "You must wait until last 'cli reload permissions' command finish\n"); 01765 return 1; 01766 } 01767 01768 cfg = ast_config_load2(perms_config, "" /* core, can't reload */, config_flags); 01769 if (!cfg) { 01770 ast_mutex_unlock(&permsconfiglock); 01771 return 1; 01772 } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { 01773 ast_mutex_unlock(&permsconfiglock); 01774 return 0; 01775 } 01776 01777 /* free current structures. */ 01778 destroy_user_perms(); 01779 01780 while ((cat = ast_category_browse(cfg, cat))) { 01781 if (!strcasecmp(cat, "general")) { 01782 /* General options */ 01783 for (v = ast_variable_browse(cfg, cat); v; v = v->next) { 01784 if (!strcasecmp(v->name, "default_perm")) { 01785 cli_default_perm = (!strcasecmp(v->value, "permit")) ? 1: 0; 01786 } 01787 } 01788 continue; 01789 } 01790 01791 /* users or groups */ 01792 gr = NULL, pw = NULL; 01793 if (cat[0] == '@') { 01794 /* This is a group */ 01795 gr = getgrnam(&cat[1]); 01796 if (!gr) { 01797 ast_log (LOG_WARNING, "Unknown group '%s'\n", &cat[1]); 01798 continue; 01799 } 01800 } else { 01801 /* This is a user */ 01802 pw = getpwnam(cat); 01803 if (!pw) { 01804 ast_log (LOG_WARNING, "Unknown user '%s'\n", cat); 01805 continue; 01806 } 01807 } 01808 user_group = NULL; 01809 /* Check for duplicates */ 01810 AST_RWLIST_WRLOCK(&cli_perms); 01811 AST_LIST_TRAVERSE(&cli_perms, cp_entry, list) { 01812 if ((pw && cp_entry->uid == pw->pw_uid) || (gr && cp_entry->gid == gr->gr_gid)) { 01813 /* if it is duplicated, just added this new settings, to 01814 the current list. */ 01815 user_group = cp_entry; 01816 break; 01817 } 01818 } 01819 AST_RWLIST_UNLOCK(&cli_perms); 01820 01821 if (!user_group) { 01822 /* alloc space for the new user config. */ 01823 user_group = ast_calloc(1, sizeof(*user_group)); 01824 if (!user_group) { 01825 continue; 01826 } 01827 user_group->uid = (pw ? pw->pw_uid : -1); 01828 user_group->gid = (gr ? gr->gr_gid : -1); 01829 user_group->perms = ast_calloc(1, sizeof(*user_group->perms)); 01830 if (!user_group->perms) { 01831 ast_free(user_group); 01832 continue; 01833 } 01834 } 01835 for (v = ast_variable_browse(cfg, cat); v; v = v->next) { 01836 if (ast_strlen_zero(v->value)) { 01837 /* we need to check this condition cause it could break security. */ 01838 ast_log(LOG_WARNING, "Empty permit/deny option in user '%s'\n", cat); 01839 continue; 01840 } 01841 if (!strcasecmp(v->name, "permit")) { 01842 perm = ast_calloc(1, sizeof(*perm)); 01843 if (perm) { 01844 perm->permit = 1; 01845 perm->command = ast_strdup(v->value); 01846 } 01847 } else if (!strcasecmp(v->name, "deny")) { 01848 perm = ast_calloc(1, sizeof(*perm)); 01849 if (perm) { 01850 perm->permit = 0; 01851 perm->command = ast_strdup(v->value); 01852 } 01853 } else { 01854 /* up to now, only 'permit' and 'deny' are possible values. */ 01855 ast_log(LOG_WARNING, "Unknown '%s' option\n", v->name); 01856 continue; 01857 } 01858 if (perm) { 01859 /* Added the permission to the user's list. */ 01860 AST_LIST_INSERT_TAIL(user_group->perms, perm, list); 01861 perm = NULL; 01862 } 01863 } 01864 AST_RWLIST_WRLOCK(&cli_perms); 01865 AST_RWLIST_INSERT_TAIL(&cli_perms, user_group, list); 01866 AST_RWLIST_UNLOCK(&cli_perms); 01867 } 01868 01869 ast_config_destroy(cfg); 01870 ast_mutex_unlock(&permsconfiglock); 01871 return 0; 01872 }
int ast_data_init | ( | void | ) |
Provided by data.c
Definition at line 3297 of file data.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_manager_register_xml, ast_register_atexit(), ast_rwlock_init, AST_TEST_REGISTER, cli_data, data_provider_cmp(), data_provider_hash(), data_shutdown(), manager_data_get(), NUM_DATA_NODE_BUCKETS, and root_data.
Referenced by main().
03298 { 03299 int res = 0; 03300 03301 ast_rwlock_init(&root_data.lock); 03302 03303 if (!(root_data.container = ao2_container_alloc(NUM_DATA_NODE_BUCKETS, 03304 data_provider_hash, data_provider_cmp))) { 03305 return -1; 03306 } 03307 03308 res |= ast_cli_register_multiple(cli_data, ARRAY_LEN(cli_data)); 03309 03310 res |= ast_manager_register_xml("DataGet", 0, manager_data_get); 03311 03312 AST_TEST_REGISTER(test_data_get); 03313 03314 ast_register_atexit(data_shutdown); 03315 03316 return res; 03317 }
int ast_device_state_engine_init | ( | void | ) |
Initialize the device state engine in separate thread.
Provided by devicestate.c
Definition at line 747 of file devicestate.c.
References ast_cond_init, ast_log(), ast_pthread_create_background, change_thread, do_devstate_changes(), and LOG_ERROR.
Referenced by main().
00748 { 00749 ast_cond_init(&change_pending, NULL); 00750 if (ast_pthread_create_background(&change_thread, NULL, do_devstate_changes, NULL) < 0) { 00751 ast_log(LOG_ERROR, "Unable to start device state change thread.\n"); 00752 return -1; 00753 } 00754 00755 return 0; 00756 }
int ast_event_init | ( | void | ) |
Provided by event.c
Definition at line 1819 of file event.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_event_cache, ast_event_cmp(), ast_event_hash(), ast_event_subs, ast_register_atexit(), AST_RWDLLIST_HEAD_INIT, ast_taskprocessor_get(), container, event_cli, event_shutdown(), hash_fn, and NUM_CACHE_BUCKETS.
Referenced by main().
01820 { 01821 int i; 01822 01823 for (i = 0; i < AST_EVENT_TOTAL; i++) { 01824 AST_RWDLLIST_HEAD_INIT(&ast_event_subs[i]); 01825 } 01826 01827 for (i = 0; i < AST_EVENT_TOTAL; i++) { 01828 if (!ast_event_cache[i].hash_fn) { 01829 /* This event type is not cached. */ 01830 continue; 01831 } 01832 01833 if (!(ast_event_cache[i].container = ao2_container_alloc(NUM_CACHE_BUCKETS, 01834 ast_event_hash, ast_event_cmp))) { 01835 goto event_init_cleanup; 01836 } 01837 } 01838 01839 if (!(event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", 0))) { 01840 goto event_init_cleanup; 01841 } 01842 01843 ast_cli_register_multiple(event_cli, ARRAY_LEN(event_cli)); 01844 01845 ast_register_atexit(event_shutdown); 01846 01847 return 0; 01848 01849 event_init_cleanup: 01850 event_shutdown(); 01851 return -1; 01852 }
int ast_features_init | ( | void | ) |
Provided by features.c
Definition at line 8336 of file features.c.
References action_bridge(), ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_devstate_prov_add(), ast_manager_register_xml, ast_pthread_create, ast_register_application2(), ast_register_atexit(), AST_TEST_REGISTER, bridge_exec(), do_parking_thread(), EVENT_FLAG_CALL, features_shutdown(), load_config(), manager_park(), manager_parking_status(), metermaidstate(), park_call_exec(), parkcall, parked_call_exec(), parking_thread, parkinglot_cmp_cb(), parkinglot_hash_cb(), and parkinglots.
Referenced by main().
08337 { 08338 int res; 08339 08340 parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb); 08341 if (!parkinglots) { 08342 return -1; 08343 } 08344 08345 res = load_config(0); 08346 if (res) { 08347 return res; 08348 } 08349 ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features)); 08350 if (ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL)) { 08351 return -1; 08352 } 08353 ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL); 08354 res = ast_register_application2(parkedcall, parked_call_exec, NULL, NULL, NULL); 08355 if (!res) 08356 res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL); 08357 if (!res) { 08358 ast_manager_register_xml("ParkedCalls", 0, manager_parking_status); 08359 ast_manager_register_xml("Park", EVENT_FLAG_CALL, manager_park); 08360 ast_manager_register_xml("Bridge", EVENT_FLAG_CALL, action_bridge); 08361 } 08362 08363 res |= ast_devstate_prov_add("Park", metermaidstate); 08364 #if defined(TEST_FRAMEWORK) 08365 res |= AST_TEST_REGISTER(features_test); 08366 #endif /* defined(TEST_FRAMEWORK) */ 08367 08368 ast_register_atexit(features_shutdown); 08369 08370 return res; 08371 }
int ast_file_init | ( | void | ) |
Provided by file.c
Definition at line 1503 of file file.c.
Referenced by main().
01504 { 01505 ast_cli_register_multiple(cli_file, ARRAY_LEN(cli_file)); 01506 ast_register_atexit(file_shutdown); 01507 return 0; 01508 }
int ast_http_init | ( | void | ) |
Provided by http.c
Definition at line 1319 of file http.c.
References __ast_http_load(), ARRAY_LEN, ast_cli_register_multiple(), ast_http_uri_link(), ast_register_atexit(), cli_http, http_shutdown(), staticuri, and statusuri.
Referenced by main().
01320 { 01321 ast_http_uri_link(&statusuri); 01322 ast_http_uri_link(&staticuri); 01323 ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http)); 01324 ast_register_atexit(http_shutdown); 01325 01326 return __ast_http_load(0); 01327 }
int ast_http_reload | ( | void | ) |
Provided by http.c
Definition at line 1287 of file http.c.
References __ast_http_load().
01288 { 01289 return __ast_http_load(1); 01290 }
int ast_indications_init | ( | void | ) |
Load indications module.
Provided by indications.c
Definition at line 1169 of file indications.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), ast_tone_zone_cmp(), ast_tone_zone_hash(), indications_shutdown(), load_indications(), and NUM_TONE_ZONE_BUCKETS.
Referenced by main().
01170 { 01171 if (!(ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS, 01172 ast_tone_zone_hash, ast_tone_zone_cmp))) { 01173 return -1; 01174 } 01175 01176 if (load_indications(0)) { 01177 indications_shutdown(); 01178 return -1; 01179 } 01180 01181 ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications)); 01182 01183 ast_register_atexit(indications_shutdown); 01184 return 0; 01185 }
int ast_indications_reload | ( | void | ) |
Reload indications module.
Provided by indications.c
Definition at line 1188 of file indications.c.
References load_indications().
01189 { 01190 return load_indications(1); 01191 }
int ast_module_reload | ( | const char * | name | ) |
Reload asterisk modules.
name | the name of the module to reload |
This function reloads the specified module, or if no modules are specified, it will reload all loaded modules.
1 | if the module was found but cannot be reloaded. | |
-1 | if a reload operation is already in progress. | |
2 | if the specfied module was found and reloaded. |
Definition at line 721 of file loader.c.
References ast_config_AST_CONFIG_DIR, ast_fully_booted, ast_lastreloadtime, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_lock_path(), AST_LOCK_SUCCESS, AST_LOCK_TIMEOUT, ast_log(), ast_mutex_trylock, ast_mutex_unlock, ast_opt_lock_confdir, ast_test_suite_event_notify, ast_tvnow(), ast_unlock_path(), ast_verb, ast_verbose, ast_module::declined, ast_module_info::description, ast_module::flags, ast_module::info, LOG_NOTICE, LOG_WARNING, queue_reload_request(), ast_module_info::reload, ast_module::resource, resource_name_match(), and ast_module::running.
Referenced by action_reload(), action_updateconfig(), ast_process_pending_reloads(), handle_core_reload(), handle_reload(), manager_moduleload(), and monitor_sig_flags().
00722 { 00723 struct ast_module *cur; 00724 int res = 0; /* return value. 0 = not found, others, see below */ 00725 int i; 00726 00727 /* If we aren't fully booted, we just pretend we reloaded but we queue this 00728 up to run once we are booted up. */ 00729 if (!ast_fully_booted) { 00730 queue_reload_request(name); 00731 return 0; 00732 } 00733 00734 if (ast_mutex_trylock(&reloadlock)) { 00735 ast_verbose("The previous reload command didn't finish yet\n"); 00736 return -1; /* reload already in progress */ 00737 } 00738 ast_lastreloadtime = ast_tvnow(); 00739 00740 if (ast_opt_lock_confdir) { 00741 int try; 00742 int res; 00743 for (try = 1, res = AST_LOCK_TIMEOUT; try < 6 && (res == AST_LOCK_TIMEOUT); try++) { 00744 res = ast_lock_path(ast_config_AST_CONFIG_DIR); 00745 if (res == AST_LOCK_TIMEOUT) { 00746 ast_log(LOG_WARNING, "Failed to grab lock on %s, try %d\n", ast_config_AST_CONFIG_DIR, try); 00747 } 00748 } 00749 if (res != AST_LOCK_SUCCESS) { 00750 ast_verbose("Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR); 00751 ast_mutex_unlock(&reloadlock); 00752 return -1; 00753 } 00754 } 00755 00756 /* Call "predefined" reload here first */ 00757 for (i = 0; reload_classes[i].name; i++) { 00758 if (!name || !strcasecmp(name, reload_classes[i].name)) { 00759 if (!reload_classes[i].reload_fn()) { 00760 ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", name); 00761 } 00762 res = 2; /* found and reloaded */ 00763 } 00764 } 00765 00766 if (name && res) { 00767 if (ast_opt_lock_confdir) { 00768 ast_unlock_path(ast_config_AST_CONFIG_DIR); 00769 } 00770 ast_mutex_unlock(&reloadlock); 00771 return res; 00772 } 00773 00774 AST_LIST_LOCK(&module_list); 00775 AST_LIST_TRAVERSE(&module_list, cur, entry) { 00776 const struct ast_module_info *info = cur->info; 00777 00778 if (name && resource_name_match(name, cur->resource)) 00779 continue; 00780 00781 if (!cur->flags.running || cur->flags.declined) { 00782 if (!name) 00783 continue; 00784 ast_log(LOG_NOTICE, "The module '%s' was not properly initialized. " 00785 "Before reloading the module, you must run \"module load %s\" " 00786 "and fix whatever is preventing the module from being initialized.\n", 00787 name, name); 00788 res = 2; /* Don't report that the module was not found */ 00789 break; 00790 } 00791 00792 if (!info->reload) { /* cannot be reloaded */ 00793 /* Nothing to reload, so reload is successful */ 00794 ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource); 00795 if (res < 1) /* store result if possible */ 00796 res = 1; /* 1 = no reload() method */ 00797 continue; 00798 } 00799 00800 res = 2; 00801 ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description); 00802 if (!info->reload()) { 00803 ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource); 00804 } 00805 } 00806 AST_LIST_UNLOCK(&module_list); 00807 00808 if (ast_opt_lock_confdir) { 00809 ast_unlock_path(ast_config_AST_CONFIG_DIR); 00810 } 00811 ast_mutex_unlock(&reloadlock); 00812 00813 return res; 00814 }
int ast_plc_reload | ( | void | ) |
Reload genericplc configuration value from codecs.conf.
Implementation is in main/channel.c
Definition at line 8076 of file channel.c.
References ast_config_destroy(), ast_config_load, AST_OPT_FLAG_GENERIC_PLC, ast_options, ast_set2_flag, ast_true(), ast_variable_browse(), CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, ast_variable::name, ast_variable::next, ast_variable::value, and var.
Referenced by ast_channels_init().
08077 { 08078 struct ast_variable *var; 08079 struct ast_flags config_flags = { 0 }; 08080 struct ast_config *cfg = ast_config_load("codecs.conf", config_flags); 08081 if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) 08082 return 0; 08083 for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) { 08084 if (!strcasecmp(var->name, "genericplc")) { 08085 ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC); 08086 } 08087 } 08088 ast_config_destroy(cfg); 08089 return 0; 08090 }
void ast_process_pending_reloads | ( | void | ) |
Process reload requests received during startup.
This function requests that the loader execute the pending reload requests that were queued during server startup.
Definition at line 656 of file loader.c.
References ast_free, ast_fully_booted, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log(), ast_module_reload(), do_full_reload, LOG_NOTICE, and reload_queue_item::module.
Referenced by main().
00657 { 00658 struct reload_queue_item *item; 00659 00660 if (!ast_fully_booted) { 00661 return; 00662 } 00663 00664 AST_LIST_LOCK(&reload_queue); 00665 00666 if (do_full_reload) { 00667 do_full_reload = 0; 00668 AST_LIST_UNLOCK(&reload_queue); 00669 ast_log(LOG_NOTICE, "Executing deferred reload request.\n"); 00670 ast_module_reload(NULL); 00671 return; 00672 } 00673 00674 while ((item = AST_LIST_REMOVE_HEAD(&reload_queue, entry))) { 00675 ast_log(LOG_NOTICE, "Executing deferred reload request for module '%s'.\n", item->module); 00676 ast_module_reload(item->module); 00677 ast_free(item); 00678 } 00679 00680 AST_LIST_UNLOCK(&reload_queue); 00681 }
int ast_ssl_init | ( | void | ) |
Provided by ssl.c
Definition at line 77 of file ssl.c.
References ast_calloc, ast_mutex_init, ssl_lock(), and ssl_threadid().
Referenced by main().
00078 { 00079 #ifdef HAVE_OPENSSL 00080 unsigned int i; 00081 00082 SSL_library_init(); 00083 SSL_load_error_strings(); 00084 ERR_load_BIO_strings(); 00085 00086 /* Make OpenSSL thread-safe. */ 00087 00088 CRYPTO_set_id_callback(ssl_threadid); 00089 00090 ssl_num_locks = CRYPTO_num_locks(); 00091 if (!(ssl_locks = ast_calloc(ssl_num_locks, sizeof(ssl_locks[0])))) { 00092 return -1; 00093 } 00094 for (i = 0; i < ssl_num_locks; i++) { 00095 ast_mutex_init(&ssl_locks[i]); 00096 } 00097 CRYPTO_set_locking_callback(ssl_lock); 00098 00099 #endif /* HAVE_OPENSSL */ 00100 return 0; 00101 }
void ast_stun_init | ( | void | ) |
Initialize the STUN system in Asterisk.
Provided by stun.c
Definition at line 508 of file stun.c.
References ast_cli_register_multiple(), ast_register_atexit(), and stun_shutdown().
Referenced by main().
00509 { 00510 ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry)); 00511 ast_register_atexit(stun_shutdown); 00512 }
int ast_term_init | ( | void | ) |
Provided by term.c
Definition at line 87 of file term.c.
References ast_opt_console, ast_opt_force_black_background, ast_opt_light_background, ast_opt_no_color, ATTR_BRIGHT, ATTR_RESET, COLOR_BLACK, COLOR_BROWN, COLOR_WHITE, convshort(), and ESC.
Referenced by main().
00088 { 00089 char *term = getenv("TERM"); 00090 char termfile[256] = ""; 00091 char buffer[512] = ""; 00092 int termfd = -1, parseokay = 0, i; 00093 00094 if (ast_opt_no_color) { 00095 return 0; 00096 } 00097 00098 if (!ast_opt_console) { 00099 /* If any remote console is not compatible, we'll strip the color codes at that point */ 00100 vt100compat = 1; 00101 goto end; 00102 } 00103 00104 if (!term) { 00105 return 0; 00106 } 00107 00108 for (i = 0;; i++) { 00109 if (termpath[i] == NULL) { 00110 break; 00111 } 00112 snprintf(termfile, sizeof(termfile), "%s/%c/%s", termpath[i], *term, term); 00113 termfd = open(termfile, O_RDONLY); 00114 if (termfd > -1) { 00115 break; 00116 } 00117 } 00118 if (termfd > -1) { 00119 int actsize = read(termfd, buffer, sizeof(buffer) - 1); 00120 short sz_names = convshort(buffer + 2); 00121 short sz_bools = convshort(buffer + 4); 00122 short n_nums = convshort(buffer + 6); 00123 00124 /* if ((sz_names + sz_bools) & 1) 00125 sz_bools++; */ 00126 00127 if (sz_names + sz_bools + n_nums < actsize) { 00128 /* Offset 13 is defined in /usr/include/term.h, though we do not 00129 * include it here, as it conflicts with include/asterisk/term.h */ 00130 short max_colors = convshort(buffer + 12 + sz_names + sz_bools + 13 * 2); 00131 if (max_colors > 0) { 00132 vt100compat = 1; 00133 } 00134 parseokay = 1; 00135 } 00136 close(termfd); 00137 } 00138 00139 if (!parseokay) { 00140 /* These comparisons should not be substrings nor case-insensitive, as 00141 * terminal types are very particular about how they treat suffixes and 00142 * capitalization. For example, terminal type 'linux-m' does NOT 00143 * support color, while 'linux' does. Not even all vt100* terminals 00144 * support color, either (e.g. 'vt100+fnkeys'). */ 00145 if (!strcmp(term, "linux")) { 00146 vt100compat = 1; 00147 } else if (!strcmp(term, "xterm")) { 00148 vt100compat = 1; 00149 } else if (!strcmp(term, "xterm-color")) { 00150 vt100compat = 1; 00151 } else if (!strcmp(term, "xterm-256color")) { 00152 vt100compat = 1; 00153 } else if (!strncmp(term, "Eterm", 5)) { 00154 /* Both entries which start with Eterm support color */ 00155 vt100compat = 1; 00156 } else if (!strcmp(term, "vt100")) { 00157 vt100compat = 1; 00158 } else if (!strncmp(term, "crt", 3)) { 00159 /* Both crt terminals support color */ 00160 vt100compat = 1; 00161 } 00162 } 00163 00164 end: 00165 if (vt100compat) { 00166 /* Make commands show up in nice colors */ 00167 if (ast_opt_light_background) { 00168 snprintf(prepdata, sizeof(prepdata), "%c[%dm", ESC, COLOR_BROWN); 00169 snprintf(enddata, sizeof(enddata), "%c[%dm", ESC, COLOR_BLACK); 00170 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00171 } else if (ast_opt_force_black_background) { 00172 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10); 00173 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10); 00174 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00175 } else { 00176 snprintf(prepdata, sizeof(prepdata), "%c[%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN); 00177 snprintf(enddata, sizeof(enddata), "%c[%d;%dm", ESC, ATTR_RESET, COLOR_WHITE); 00178 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00179 } 00180 } 00181 return 0; 00182 }
int ast_test_init | ( | void | ) |
Provided by test.c
Definition at line 941 of file test.c.
References ARRAY_LEN, ast_cli_register_multiple(), and ast_register_atexit().
Referenced by main().
00942 { 00943 #ifdef TEST_FRAMEWORK 00944 /* Register cli commands */ 00945 ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli)); 00946 ast_register_atexit(test_shutdown); 00947 #endif 00948 00949 return 0; 00950 }
int ast_timing_init | ( | void | ) |
Provided by timing.c
Definition at line 310 of file timing.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_heap_create(), ast_register_atexit(), timing_holder_cmp(), and timing_shutdown().
Referenced by main().
00311 { 00312 if (!(timing_interfaces = ast_heap_create(2, timing_holder_cmp, 0))) { 00313 return -1; 00314 } 00315 00316 ast_register_atexit(timing_shutdown); 00317 00318 return ast_cli_register_multiple(cli_timing, ARRAY_LEN(cli_timing)); 00319 }
int ast_tps_init | ( | void | ) |
Provided by taskprocessor.c
Definition at line 134 of file taskprocessor.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_log(), ast_register_atexit(), cli_ping_cond, LOG_ERROR, taskprocessor_clis, tps_cmp_cb(), tps_hash_cb(), TPS_MAX_BUCKETS, tps_shutdown(), and tps_singletons.
Referenced by main().
00135 { 00136 if (!(tps_singletons = ao2_container_alloc(TPS_MAX_BUCKETS, tps_hash_cb, tps_cmp_cb))) { 00137 ast_log(LOG_ERROR, "taskprocessor container failed to initialize!\n"); 00138 return -1; 00139 } 00140 00141 ast_cond_init(&cli_ping_cond, NULL); 00142 00143 ast_cli_register_multiple(taskprocessor_clis, ARRAY_LEN(taskprocessor_clis)); 00144 00145 ast_register_atexit(tps_shutdown); 00146 00147 return 0; 00148 }
int ast_xmldoc_load_documentation | ( | void | ) |
int astdb_init | ( | void | ) |
Provided by db.c
Definition at line 880 of file db.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_manager_register_xml, ast_mutex_lock, ast_mutex_unlock, ast_pthread_create_background, ast_register_atexit(), astdb_shutdown(), db_sync_thread(), dbinit(), dblock, EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, manager_dbdel(), manager_dbdeltree(), manager_dbget(), and manager_dbput().
Referenced by main().
00881 { 00882 ast_cond_init(&dbcond, NULL); 00883 if (ast_pthread_create_background(&syncthread, NULL, db_sync_thread, NULL)) { 00884 return -1; 00885 } 00886 00887 ast_mutex_lock(&dblock); 00888 /* Ignore check_return warning from Coverity for dbinit below */ 00889 dbinit(); 00890 ast_mutex_unlock(&dblock); 00891 00892 ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database)); 00893 ast_manager_register_xml("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget); 00894 ast_manager_register_xml("DBPut", EVENT_FLAG_SYSTEM, manager_dbput); 00895 ast_manager_register_xml("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel); 00896 ast_manager_register_xml("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree); 00897 00898 ast_register_atexit(astdb_shutdown); 00899 return 0; 00900 }
int astobj2_init | ( | void | ) |
Provided by astobj2.c
Definition at line 1150 of file astobj2.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_config_AST_LOG_DIR, ast_log(), ast_register_atexit(), astobj2_cleanup(), and LOG_ERROR.
Referenced by main().
01151 { 01152 #ifdef REF_DEBUG 01153 char ref_filename[1024]; 01154 #endif 01155 01156 #ifdef REF_DEBUG 01157 snprintf(ref_filename, sizeof(ref_filename), "%s/refs", ast_config_AST_LOG_DIR); 01158 ref_log = fopen(ref_filename, "w"); 01159 if (!ref_log) { 01160 ast_log(LOG_ERROR, "Could not open ref debug log file: %s\n", ref_filename); 01161 } 01162 #endif 01163 01164 #ifdef AO2_DEBUG 01165 ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); 01166 #endif 01167 01168 ast_register_atexit(astobj2_cleanup); 01169 return 0; 01170 }
void clean_time_zones | ( | void | ) |
Provided by localtime.c
Definition at line 1421 of file localtime.c.
References ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, and AST_LIST_UNLOCK.
Referenced by really_quit().
01422 { 01423 struct state *sp; 01424 01425 AST_LIST_LOCK(&zonelist); 01426 while ((sp = AST_LIST_REMOVE_HEAD(&zonelist, list))) { 01427 ast_free(sp); 01428 } 01429 AST_LIST_UNLOCK(&zonelist); 01430 }
void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 1160 of file logger.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_cond_signal, ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, AST_PTHREADT_NULL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cli_logger, close_logger_thread, f, logchannel::fileptr, logchannel::list, logcond, logthread, and qlog.
Referenced by really_quit().
01161 { 01162 struct logchannel *f = NULL; 01163 struct verb *cur = NULL; 01164 01165 ast_cli_unregister_multiple(cli_logger, ARRAY_LEN(cli_logger)); 01166 01167 logger_initialized = 0; 01168 01169 /* Stop logger thread */ 01170 AST_LIST_LOCK(&logmsgs); 01171 close_logger_thread = 1; 01172 ast_cond_signal(&logcond); 01173 AST_LIST_UNLOCK(&logmsgs); 01174 01175 if (logthread != AST_PTHREADT_NULL) 01176 pthread_join(logthread, NULL); 01177 01178 AST_RWLIST_WRLOCK(&verbosers); 01179 while ((cur = AST_LIST_REMOVE_HEAD(&verbosers, list))) { 01180 ast_free(cur); 01181 } 01182 AST_RWLIST_UNLOCK(&verbosers); 01183 01184 AST_RWLIST_WRLOCK(&logchannels); 01185 01186 if (qlog) { 01187 fclose(qlog); 01188 qlog = NULL; 01189 } 01190 01191 while ((f = AST_LIST_REMOVE_HEAD(&logchannels, list))) { 01192 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 01193 fclose(f->fileptr); 01194 f->fileptr = NULL; 01195 } 01196 ast_free(f); 01197 } 01198 01199 closelog(); /* syslog */ 01200 01201 AST_RWLIST_UNLOCK(&logchannels); 01202 }
int dnsmgr_init | ( | void | ) |
Provided by dnsmgr.c
Definition at line 417 of file dnsmgr.c.
References ast_cli_register(), ast_log(), ast_register_atexit(), cli_refresh, cli_reload, cli_status, dnsmgr_shutdown(), do_reload(), LOG_ERROR, and sched_context_create().
Referenced by main().
00418 { 00419 if (!(sched = sched_context_create())) { 00420 ast_log(LOG_ERROR, "Unable to create schedule context.\n"); 00421 return -1; 00422 } 00423 ast_cli_register(&cli_reload); 00424 ast_cli_register(&cli_status); 00425 ast_cli_register(&cli_refresh); 00426 00427 ast_register_atexit(dnsmgr_shutdown); 00428 00429 return do_reload(1); 00430 }
int dnsmgr_reload | ( | void | ) |
Provided by dnsmgr.c
Definition at line 432 of file dnsmgr.c.
References do_reload().
00433 { 00434 return do_reload(0); 00435 }
void dnsmgr_start_refresh | ( | void | ) |
Provided by dnsmgr.c
Definition at line 291 of file dnsmgr.c.
References ast_sched_add_variable(), AST_SCHED_DEL, master_refresh_info, and refresh_list().
Referenced by main().
00292 { 00293 if (refresh_sched > -1) { 00294 AST_SCHED_DEL(sched, refresh_sched); 00295 refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1); 00296 } 00297 }
int init_framer | ( | void | ) |
Provided by frame.c
Definition at line 995 of file frame.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), and framer_shutdown().
Referenced by main().
00996 { 00997 ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis)); 00998 ast_register_atexit(framer_shutdown); 00999 return 0; 01000 }
int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 1127 of file logger.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_destroy, ast_cond_init, ast_config_AST_LOG_DIR, ast_mkdir(), ast_mutex_destroy, ast_mutex_init, ast_pthread_create, cli_logger, handle_SIGXFSZ, init_logger_chain(), logcond, logger_thread(), and logthread.
Referenced by main().
01128 { 01129 /* auto rotate if sig SIGXFSZ comes a-knockin */ 01130 sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL); 01131 01132 /* Re-initialize the logmsgs mutex. The recursive mutex can be accessed prior 01133 * to Asterisk being forked into the background, which can cause the thread 01134 * ID tracked by the underlying pthread mutex to be different than the ID of 01135 * the thread that unlocks the mutex. Since init_logger is called after the 01136 * fork, it is safe to initialize the mutex here for future accesses. 01137 */ 01138 ast_mutex_destroy(&logmsgs.lock); 01139 ast_mutex_init(&logmsgs.lock); 01140 ast_cond_init(&logcond, NULL); 01141 01142 /* start logger thread */ 01143 if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) { 01144 ast_cond_destroy(&logcond); 01145 return -1; 01146 } 01147 01148 /* register the logger cli commands */ 01149 ast_cli_register_multiple(cli_logger, ARRAY_LEN(cli_logger)); 01150 01151 ast_mkdir(ast_config_AST_LOG_DIR, 0777); 01152 01153 /* create log channels */ 01154 init_logger_chain(0 /* locked */); 01155 logger_initialized = 1; 01156 01157 return 0; 01158 }
int load_modules | ( | unsigned | int | ) |
Provided by loader.c
Definition at line 1072 of file loader.c.
References add_to_load_order(), ast_config_AST_MODULE_DIR, ast_config_destroy(), ast_config_load2(), ast_debug, ast_free, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log(), AST_MODULE_CONFIG, ast_opt_quiet, ast_true(), ast_variable_browse(), ast_variable_retrieve(), ast_verb, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, embedded_module_list, embedding, EVENT_FLAG_SYSTEM, find_resource(), module_list::first, ast_module::flags, module_list::last, ast_module::lib, load_resource_list(), LOG_NOTICE, LOG_WARNING, manager_event, ast_variable::name, ast_variable::next, load_order_entry::resource, ast_module::resource, resource_name_match(), ast_module::running, and ast_variable::value.
Referenced by main().
01073 { 01074 struct ast_config *cfg; 01075 struct ast_module *mod; 01076 struct load_order_entry *order; 01077 struct ast_variable *v; 01078 unsigned int load_count; 01079 struct load_order load_order; 01080 int res = 0; 01081 struct ast_flags config_flags = { 0 }; 01082 int modulecount = 0; 01083 01084 #ifdef LOADABLE_MODULES 01085 struct dirent *dirent; 01086 DIR *dir; 01087 #endif 01088 01089 /* all embedded modules have registered themselves by now */ 01090 embedding = 0; 01091 01092 ast_verb(1, "Asterisk Dynamic Loader Starting:\n"); 01093 01094 AST_LIST_HEAD_INIT_NOLOCK(&load_order); 01095 01096 AST_LIST_LOCK(&module_list); 01097 01098 if (embedded_module_list.first) { 01099 module_list.first = embedded_module_list.first; 01100 module_list.last = embedded_module_list.last; 01101 embedded_module_list.first = NULL; 01102 } 01103 01104 cfg = ast_config_load2(AST_MODULE_CONFIG, "" /* core, can't reload */, config_flags); 01105 if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) { 01106 ast_log(LOG_WARNING, "No '%s' found, no modules will be loaded.\n", AST_MODULE_CONFIG); 01107 goto done; 01108 } 01109 01110 /* first, find all the modules we have been explicitly requested to load */ 01111 for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) { 01112 if (!strcasecmp(v->name, preload_only ? "preload" : "load")) { 01113 add_to_load_order(v->value, &load_order, 0); 01114 } 01115 if (!strcasecmp(v->name, preload_only ? "preload-require" : "require")) { 01116 /* Add the module to the list and make sure it's required */ 01117 add_to_load_order(v->value, &load_order, 1); 01118 ast_debug(2, "Adding module to required list: %s (%s)\n", v->value, v->name); 01119 } 01120 01121 } 01122 01123 /* check if 'autoload' is on */ 01124 if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) { 01125 /* if so, first add all the embedded modules that are not already running to the load order */ 01126 AST_LIST_TRAVERSE(&module_list, mod, entry) { 01127 /* if it's not embedded, skip it */ 01128 if (mod->lib) 01129 continue; 01130 01131 if (mod->flags.running) 01132 continue; 01133 01134 add_to_load_order(mod->resource, &load_order, 0); 01135 } 01136 01137 #ifdef LOADABLE_MODULES 01138 /* if we are allowed to load dynamic modules, scan the directory for 01139 for all available modules and add them as well */ 01140 if ((dir = opendir(ast_config_AST_MODULE_DIR))) { 01141 while ((dirent = readdir(dir))) { 01142 int ld = strlen(dirent->d_name); 01143 01144 /* Must end in .so to load it. */ 01145 01146 if (ld < 4) 01147 continue; 01148 01149 if (strcasecmp(dirent->d_name + ld - 3, ".so")) 01150 continue; 01151 01152 /* if there is already a module by this name in the module_list, 01153 skip this file */ 01154 if (find_resource(dirent->d_name, 0)) 01155 continue; 01156 01157 add_to_load_order(dirent->d_name, &load_order, 0); 01158 } 01159 01160 closedir(dir); 01161 } else { 01162 if (!ast_opt_quiet) 01163 ast_log(LOG_WARNING, "Unable to open modules directory '%s'.\n", 01164 ast_config_AST_MODULE_DIR); 01165 } 01166 #endif 01167 } 01168 01169 /* now scan the config for any modules we are prohibited from loading and 01170 remove them from the load order */ 01171 for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) { 01172 if (strcasecmp(v->name, "noload")) 01173 continue; 01174 01175 AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) { 01176 if (!resource_name_match(order->resource, v->value)) { 01177 AST_LIST_REMOVE_CURRENT(entry); 01178 ast_free(order->resource); 01179 ast_free(order); 01180 } 01181 } 01182 AST_LIST_TRAVERSE_SAFE_END; 01183 } 01184 01185 /* we are done with the config now, all the information we need is in the 01186 load_order list */ 01187 ast_config_destroy(cfg); 01188 01189 load_count = 0; 01190 AST_LIST_TRAVERSE(&load_order, order, entry) 01191 load_count++; 01192 01193 if (load_count) 01194 ast_log(LOG_NOTICE, "%u modules will be loaded.\n", load_count); 01195 01196 /* first, load only modules that provide global symbols */ 01197 if ((res = load_resource_list(&load_order, 1, &modulecount)) < 0) { 01198 goto done; 01199 } 01200 01201 /* now load everything else */ 01202 if ((res = load_resource_list(&load_order, 0, &modulecount)) < 0) { 01203 goto done; 01204 } 01205 01206 done: 01207 while ((order = AST_LIST_REMOVE_HEAD(&load_order, entry))) { 01208 ast_free(order->resource); 01209 ast_free(order); 01210 } 01211 01212 AST_LIST_UNLOCK(&module_list); 01213 01214 /* Tell manager clients that are aggressive at logging in that we're done 01215 loading modules. If there's a DNS problem in chan_sip, we might not 01216 even reach this */ 01217 manager_event(EVENT_FLAG_SYSTEM, "ModuleLoadReport", "ModuleLoadStatus: Done\r\nModuleSelection: %s\r\nModuleCount: %d\r\n", preload_only ? "Preload" : "All", modulecount); 01218 01219 return res; 01220 }
int load_pbx | ( | void | ) |
Provided by pbx.c
Definition at line 10906 of file pbx.c.
References __ast_custom_function_register(), ARRAY_LEN, ast_cli_register_multiple(), ast_data_register_multiple_core, AST_EVENT_DEVICE_STATE, AST_EVENT_IE_END, ast_event_subscribe(), ast_log(), ast_manager_register_xml, ast_register_application2(), ast_register_atexit(), ast_taskprocessor_get(), ast_verb, builtins, device_state_cb(), device_state_sub, EVENT_FLAG_CONFIG, EVENT_FLAG_REPORTING, exception_function, LOG_ERROR, LOG_WARNING, manager_show_dialplan(), pbx_cli, pbx_data_providers, testtime_function, and unload_pbx().
Referenced by main().
10907 { 10908 int x; 10909 10910 ast_register_atexit(unload_pbx); 10911 10912 /* Initialize the PBX */ 10913 ast_verb(1, "Asterisk PBX Core Initializing\n"); 10914 if (!(device_state_tps = ast_taskprocessor_get("pbx-core", 0))) { 10915 ast_log(LOG_WARNING, "failed to create pbx-core taskprocessor\n"); 10916 } 10917 10918 ast_verb(1, "Registering builtin applications:\n"); 10919 ast_cli_register_multiple(pbx_cli, ARRAY_LEN(pbx_cli)); 10920 ast_data_register_multiple_core(pbx_data_providers, ARRAY_LEN(pbx_data_providers)); 10921 __ast_custom_function_register(&exception_function, NULL); 10922 __ast_custom_function_register(&testtime_function, NULL); 10923 10924 /* Register builtin applications */ 10925 for (x = 0; x < ARRAY_LEN(builtins); x++) { 10926 ast_verb(1, "[%s]\n", builtins[x].name); 10927 if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) { 10928 ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name); 10929 return -1; 10930 } 10931 } 10932 10933 /* Register manager application */ 10934 ast_manager_register_xml("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan); 10935 10936 if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, "pbx Device State Change", NULL, 10937 AST_EVENT_IE_END))) { 10938 return -1; 10939 } 10940 10941 return 0; 10942 }
void threadstorage_init | ( | void | ) |