
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_format_attr_init (void) |
| Init the ast_format attribute interface register container. | |
| int | ast_format_list_init (void) |
| Init the Asterisk global format list after all format attribute modules have been loaded. | |
| 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_msg_init (void) |
| 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_rtp_engine_init (void) |
| initializes the rtp engine arrays | |
| 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 | 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) |
Definition in file _private.h.
| void ast_autoservice_init | ( | void | ) |
Provided by autoservice.c
Definition at line 319 of file autoservice.c.
References as_cond, and ast_cond_init.
Referenced by main().
00320 { 00321 ast_cond_init(&as_cond, NULL); 00322 }
| void ast_builtins_init | ( | void | ) |
initialize the _full_cmd string in * each of the builtins.
Provided by cli.c
Definition at line 1871 of file cli.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
01872 { 01873 ast_cli_register_multiple(cli_cli, ARRAY_LEN(cli_cli)); 01874 }
| int ast_cel_engine_init | ( | void | ) |
Provided by cel.c
Definition at line 656 of file cel.c.
References ao2_container_alloc, ao2_ref, app_cmp(), app_hash(), ast_cel_engine_term(), ast_cli_register(), ast_register_atexit(), do_reload(), and NUM_APP_BUCKETS.
Referenced by main().
00657 { 00658 if (!(appset = ao2_container_alloc(NUM_APP_BUCKETS, app_hash, app_cmp))) { 00659 return -1; 00660 } 00661 00662 if (do_reload()) { 00663 ao2_ref(appset, -1); 00664 appset = NULL; 00665 return -1; 00666 } 00667 00668 if (ast_cli_register(&cli_status)) { 00669 ao2_ref(appset, -1); 00670 appset = NULL; 00671 return -1; 00672 } 00673 00674 ast_register_atexit(ast_cel_engine_term); 00675 00676 return 0; 00677 }
| int ast_cel_engine_reload | ( | void | ) |
Provided by cel.c
Definition at line 679 of file cel.c.
References do_reload().
00680 { 00681 return do_reload(); 00682 }
| void ast_channels_init | ( | void | ) |
Provided by channel.c
Definition at line 7966 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(), channels, cli_channel, and NUM_CHANNEL_BUCKETS.
Referenced by main().
07967 { 07968 channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS, 07969 ast_channel_hash_cb, ast_channel_cmp_cb); 07970 07971 ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel)); 07972 07973 ast_data_register_multiple_core(channel_providers, ARRAY_LEN(channel_providers)); 07974 07975 ast_plc_reload(); 07976 }
| int ast_cli_perms_init | ( | int | reload | ) |
Provided by cli.c
Definition at line 1748 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().
01749 { 01750 struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; 01751 struct ast_config *cfg; 01752 char *cat = NULL; 01753 struct ast_variable *v; 01754 struct usergroup_cli_perm *user_group, *cp_entry; 01755 struct cli_perm *perm = NULL; 01756 struct passwd *pw; 01757 struct group *gr; 01758 01759 if (ast_mutex_trylock(&permsconfiglock)) { 01760 ast_log(LOG_NOTICE, "You must wait until last 'cli reload permissions' command finish\n"); 01761 return 1; 01762 } 01763 01764 cfg = ast_config_load2(perms_config, "" /* core, can't reload */, config_flags); 01765 if (!cfg) { 01766 ast_mutex_unlock(&permsconfiglock); 01767 return 1; 01768 } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { 01769 ast_mutex_unlock(&permsconfiglock); 01770 return 0; 01771 } 01772 01773 /* free current structures. */ 01774 destroy_user_perms(); 01775 01776 while ((cat = ast_category_browse(cfg, cat))) { 01777 if (!strcasecmp(cat, "general")) { 01778 /* General options */ 01779 for (v = ast_variable_browse(cfg, cat); v; v = v->next) { 01780 if (!strcasecmp(v->name, "default_perm")) { 01781 cli_default_perm = (!strcasecmp(v->value, "permit")) ? 1: 0; 01782 } 01783 } 01784 continue; 01785 } 01786 01787 /* users or groups */ 01788 gr = NULL, pw = NULL; 01789 if (cat[0] == '@') { 01790 /* This is a group */ 01791 gr = getgrnam(&cat[1]); 01792 if (!gr) { 01793 ast_log (LOG_WARNING, "Unknown group '%s'\n", &cat[1]); 01794 continue; 01795 } 01796 } else { 01797 /* This is a user */ 01798 pw = getpwnam(cat); 01799 if (!pw) { 01800 ast_log (LOG_WARNING, "Unknown user '%s'\n", cat); 01801 continue; 01802 } 01803 } 01804 user_group = NULL; 01805 /* Check for duplicates */ 01806 AST_RWLIST_WRLOCK(&cli_perms); 01807 AST_LIST_TRAVERSE(&cli_perms, cp_entry, list) { 01808 if ((pw && cp_entry->uid == pw->pw_uid) || (gr && cp_entry->gid == gr->gr_gid)) { 01809 /* if it is duplicated, just added this new settings, to 01810 the current list. */ 01811 user_group = cp_entry; 01812 break; 01813 } 01814 } 01815 AST_RWLIST_UNLOCK(&cli_perms); 01816 01817 if (!user_group) { 01818 /* alloc space for the new user config. */ 01819 user_group = ast_calloc(1, sizeof(*user_group)); 01820 if (!user_group) { 01821 continue; 01822 } 01823 user_group->uid = (pw ? pw->pw_uid : -1); 01824 user_group->gid = (gr ? gr->gr_gid : -1); 01825 user_group->perms = ast_calloc(1, sizeof(*user_group->perms)); 01826 if (!user_group->perms) { 01827 ast_free(user_group); 01828 continue; 01829 } 01830 } 01831 for (v = ast_variable_browse(cfg, cat); v; v = v->next) { 01832 if (ast_strlen_zero(v->value)) { 01833 /* we need to check this condition cause it could break security. */ 01834 ast_log(LOG_WARNING, "Empty permit/deny option in user '%s'\n", cat); 01835 continue; 01836 } 01837 if (!strcasecmp(v->name, "permit")) { 01838 perm = ast_calloc(1, sizeof(*perm)); 01839 if (perm) { 01840 perm->permit = 1; 01841 perm->command = ast_strdup(v->value); 01842 } 01843 } else if (!strcasecmp(v->name, "deny")) { 01844 perm = ast_calloc(1, sizeof(*perm)); 01845 if (perm) { 01846 perm->permit = 0; 01847 perm->command = ast_strdup(v->value); 01848 } 01849 } else { 01850 /* up to now, only 'permit' and 'deny' are possible values. */ 01851 ast_log(LOG_WARNING, "Unknown '%s' option\n", v->name); 01852 continue; 01853 } 01854 if (perm) { 01855 /* Added the permission to the user's list. */ 01856 AST_LIST_INSERT_TAIL(user_group->perms, perm, list); 01857 perm = NULL; 01858 } 01859 } 01860 AST_RWLIST_WRLOCK(&cli_perms); 01861 AST_RWLIST_INSERT_TAIL(&cli_perms, user_group, list); 01862 AST_RWLIST_UNLOCK(&cli_perms); 01863 } 01864 01865 ast_config_destroy(cfg); 01866 ast_mutex_unlock(&permsconfiglock); 01867 return 0; 01868 }
| int ast_data_init | ( | void | ) |
Provided by data.c
Definition at line 3309 of file data.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_manager_register_xml, ast_rwlock_init, AST_TEST_REGISTER, cli_data, data_provider_cmp(), data_provider_hash(), manager_data_get(), NUM_DATA_NODE_BUCKETS, and root_data.
Referenced by main().
03310 { 03311 int res = 0; 03312 03313 ast_rwlock_init(&root_data.lock); 03314 03315 if (!(root_data.container = ao2_container_alloc(NUM_DATA_NODE_BUCKETS, 03316 data_provider_hash, data_provider_cmp))) { 03317 return -1; 03318 } 03319 03320 res |= ast_cli_register_multiple(cli_data, ARRAY_LEN(cli_data)); 03321 03322 res |= ast_manager_register_xml("DataGet", 0, manager_data_get); 03323 03324 #ifdef TEST_FRAMEWORK 03325 AST_TEST_REGISTER(test_data_get); 03326 #endif 03327 03328 return res; 03329 }
| int ast_device_state_engine_init | ( | void | ) |
Initialize the device state engine in separate thread.
Provided by devicestate.c
Definition at line 721 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().
00722 { 00723 ast_cond_init(&change_pending, NULL); 00724 if (ast_pthread_create_background(&change_thread, NULL, do_devstate_changes, NULL) < 0) { 00725 ast_log(LOG_ERROR, "Unable to start device state change thread.\n"); 00726 return -1; 00727 } 00728 00729 return 0; 00730 }
| int ast_event_init | ( | void | ) |
Provided by event.c
Definition at line 1748 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_RWDLLIST_HEAD_INIT, ast_taskprocessor_get(), container, event_cli, hash_fn, and NUM_CACHE_BUCKETS.
Referenced by main().
01749 { 01750 int i; 01751 01752 for (i = 0; i < AST_EVENT_TOTAL; i++) { 01753 AST_RWDLLIST_HEAD_INIT(&ast_event_subs[i]); 01754 } 01755 01756 for (i = 0; i < AST_EVENT_TOTAL; i++) { 01757 if (!ast_event_cache[i].hash_fn) { 01758 /* This event type is not cached. */ 01759 continue; 01760 } 01761 01762 if (!(ast_event_cache[i].container = ao2_container_alloc(NUM_CACHE_BUCKETS, 01763 ast_event_hash, ast_event_cmp))) { 01764 return -1; 01765 } 01766 } 01767 01768 if (!(event_dispatcher = ast_taskprocessor_get("core_event_dispatcher", 0))) { 01769 return -1; 01770 } 01771 01772 ast_cli_register_multiple(event_cli, ARRAY_LEN(event_cli)); 01773 01774 return 0; 01775 }
| int ast_features_init | ( | void | ) |
Provided by features.c
Definition at line 8142 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_TEST_REGISTER, bridge_exec(), do_parking_thread(), EVENT_FLAG_CALL, 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().
08143 { 08144 int res; 08145 08146 parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb); 08147 if (!parkinglots) { 08148 return -1; 08149 } 08150 08151 res = load_config(0); 08152 if (res) { 08153 return res; 08154 } 08155 ast_cli_register_multiple(cli_features, ARRAY_LEN(cli_features)); 08156 ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL); 08157 ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL); 08158 res = ast_register_application2(parkedcall, parked_call_exec, NULL, NULL, NULL); 08159 if (!res) 08160 res = ast_register_application2(parkcall, park_call_exec, NULL, NULL, NULL); 08161 if (!res) { 08162 ast_manager_register_xml("ParkedCalls", 0, manager_parking_status); 08163 ast_manager_register_xml("Park", EVENT_FLAG_CALL, manager_park); 08164 ast_manager_register_xml("Bridge", EVENT_FLAG_CALL, action_bridge); 08165 } 08166 08167 res |= ast_devstate_prov_add("Park", metermaidstate); 08168 #if defined(TEST_FRAMEWORK) 08169 res |= AST_TEST_REGISTER(features_test); 08170 #endif /* defined(TEST_FRAMEWORK) */ 08171 08172 return res; 08173 }
| int ast_file_init | ( | void | ) |
| int ast_format_attr_init | ( | void | ) |
Init the ast_format attribute interface register container.
Definition at line 1066 of file format.c.
References ao2_container_alloc, ao2_ref, ARRAY_LEN, ast_cli_register_multiple(), ast_rwlock_destroy, ast_rwlock_init, interface_cmp_cb(), and interface_hash_cb().
Referenced by main().
01067 { 01068 ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis)); 01069 if (ast_rwlock_init(&ilock)) { 01070 return -1; 01071 } 01072 01073 if (!(interfaces = ao2_container_alloc(283, interface_hash_cb, interface_cmp_cb))) { 01074 goto init_cleanup; 01075 } 01076 return 0; 01077 01078 init_cleanup: 01079 ast_rwlock_destroy(&ilock); 01080 if (interfaces) { 01081 ao2_ref(interfaces, -1); 01082 } 01083 return -1; 01084 }
| int ast_format_list_init | ( | void | ) |
Init the Asterisk global format list after all format attribute modules have been loaded.
Definition at line 1043 of file format.c.
References ao2_ref, ast_rwlock_destroy, ast_rwlock_init, build_format_list_array(), and format_list_init().
Referenced by main().
01044 { 01045 if (ast_rwlock_init(&format_list_array_lock)) { 01046 return -1; 01047 } 01048 if (format_list_init()) { 01049 goto init_list_cleanup; 01050 } 01051 if (build_format_list_array()) { 01052 goto init_list_cleanup; 01053 } 01054 01055 return 0; 01056 init_list_cleanup: 01057 01058 ast_rwlock_destroy(&format_list_array_lock); 01059 ao2_ref(format_list, -1); 01060 if (format_list_array) { 01061 ao2_ref(format_list_array, -1); 01062 } 01063 return -1; 01064 }
| int ast_http_init | ( | void | ) |
Provided by http.c
Definition at line 1202 of file http.c.
References __ast_http_load(), ARRAY_LEN, ast_cli_register_multiple(), ast_http_uri_link(), cli_http, staticuri, and statusuri.
Referenced by main().
01203 { 01204 ast_http_uri_link(&statusuri); 01205 ast_http_uri_link(&staticuri); 01206 ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http)); 01207 01208 return __ast_http_load(0); 01209 }
| int ast_http_reload | ( | void | ) |
Provided by http.c
Definition at line 1193 of file http.c.
References __ast_http_load().
01194 { 01195 return __ast_http_load(1); 01196 }
| int ast_indications_init | ( | void | ) |
Load indications module.
Provided by indications.c
Definition at line 1150 of file indications.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_tone_zone_cmp(), ast_tone_zone_hash(), load_indications(), and NUM_TONE_ZONE_BUCKETS.
Referenced by main().
01151 { 01152 if (!(ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS, 01153 ast_tone_zone_hash, ast_tone_zone_cmp))) { 01154 return -1; 01155 } 01156 01157 if (load_indications(0)) { 01158 return -1; 01159 } 01160 01161 ast_cli_register_multiple(cli_indications, ARRAY_LEN(cli_indications)); 01162 01163 return 0; 01164 }
| int ast_indications_reload | ( | void | ) |
Reload indications module.
Provided by indications.c
Definition at line 1167 of file indications.c.
References load_indications().
01168 { 01169 return load_indications(1); 01170 }
| int ast_module_reload | ( | const char * | name | ) |
Reload asterisk modules.
| name | the name of the module to reload |
| 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 669 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_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().
00670 { 00671 struct ast_module *cur; 00672 int res = 0; /* return value. 0 = not found, others, see below */ 00673 int i; 00674 00675 /* If we aren't fully booted, we just pretend we reloaded but we queue this 00676 up to run once we are booted up. */ 00677 if (!ast_fully_booted) { 00678 queue_reload_request(name); 00679 return 0; 00680 } 00681 00682 if (ast_mutex_trylock(&reloadlock)) { 00683 ast_verbose("The previous reload command didn't finish yet\n"); 00684 return -1; /* reload already in progress */ 00685 } 00686 ast_lastreloadtime = ast_tvnow(); 00687 00688 if (ast_opt_lock_confdir) { 00689 int try; 00690 int res; 00691 for (try = 1, res = AST_LOCK_TIMEOUT; try < 6 && (res == AST_LOCK_TIMEOUT); try++) { 00692 res = ast_lock_path(ast_config_AST_CONFIG_DIR); 00693 if (res == AST_LOCK_TIMEOUT) { 00694 ast_log(LOG_WARNING, "Failed to grab lock on %s, try %d\n", ast_config_AST_CONFIG_DIR, try); 00695 } 00696 } 00697 if (res != AST_LOCK_SUCCESS) { 00698 ast_verbose("Cannot grab lock on %s\n", ast_config_AST_CONFIG_DIR); 00699 ast_mutex_unlock(&reloadlock); 00700 return -1; 00701 } 00702 } 00703 00704 /* Call "predefined" reload here first */ 00705 for (i = 0; reload_classes[i].name; i++) { 00706 if (!name || !strcasecmp(name, reload_classes[i].name)) { 00707 reload_classes[i].reload_fn(); /* XXX should check error ? */ 00708 res = 2; /* found and reloaded */ 00709 } 00710 } 00711 00712 if (name && res) { 00713 if (ast_opt_lock_confdir) { 00714 ast_unlock_path(ast_config_AST_CONFIG_DIR); 00715 } 00716 ast_mutex_unlock(&reloadlock); 00717 return res; 00718 } 00719 00720 AST_LIST_LOCK(&module_list); 00721 AST_LIST_TRAVERSE(&module_list, cur, entry) { 00722 const struct ast_module_info *info = cur->info; 00723 00724 if (name && resource_name_match(name, cur->resource)) 00725 continue; 00726 00727 if (!cur->flags.running || cur->flags.declined) { 00728 if (!name) 00729 continue; 00730 ast_log(LOG_NOTICE, "The module '%s' was not properly initialized. " 00731 "Before reloading the module, you must run \"module load %s\" " 00732 "and fix whatever is preventing the module from being initialized.\n", 00733 name, name); 00734 res = 2; /* Don't report that the module was not found */ 00735 break; 00736 } 00737 00738 if (!info->reload) { /* cannot be reloaded */ 00739 if (res < 1) /* store result if possible */ 00740 res = 1; /* 1 = no reload() method */ 00741 continue; 00742 } 00743 00744 res = 2; 00745 ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description); 00746 info->reload(); 00747 } 00748 AST_LIST_UNLOCK(&module_list); 00749 00750 if (ast_opt_lock_confdir) { 00751 ast_unlock_path(ast_config_AST_CONFIG_DIR); 00752 } 00753 ast_mutex_unlock(&reloadlock); 00754 00755 return res; 00756 }
| int ast_msg_init | ( | void | ) |
Provided by message.c
Definition at line 1108 of file message.c.
References __ast_custom_function_register(), ao2_container_alloc, ast_register_application2(), ast_taskprocessor_get(), msg_send_exec(), msg_tech_cmp(), msg_tech_hash(), and TPS_REF_DEFAULT.
Referenced by main().
01109 { 01110 int res; 01111 01112 msg_q_tp = ast_taskprocessor_get("ast_msg_queue", TPS_REF_DEFAULT); 01113 if (!msg_q_tp) { 01114 return -1; 01115 } 01116 01117 msg_techs = ao2_container_alloc(17, msg_tech_hash, msg_tech_cmp); 01118 if (!msg_techs) { 01119 return -1; 01120 } 01121 01122 res = __ast_custom_function_register(&msg_function, NULL); 01123 res |= __ast_custom_function_register(&msg_data_function, NULL); 01124 res |= ast_register_application2(app_msg_send, msg_send_exec, NULL, NULL, NULL); 01125 01126 return res; 01127 }
| int ast_plc_reload | ( | void | ) |
Reload genericplc configuration value from codecs.conf.
Implementation is in main/channel.c
Definition at line 7831 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().
07832 { 07833 struct ast_variable *var; 07834 struct ast_flags config_flags = { 0 }; 07835 struct ast_config *cfg = ast_config_load("codecs.conf", config_flags); 07836 if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) 07837 return 0; 07838 for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) { 07839 if (!strcasecmp(var->name, "genericplc")) { 07840 ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC); 07841 } 07842 } 07843 ast_config_destroy(cfg); 07844 return 0; 07845 }
| 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 604 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().
00605 { 00606 struct reload_queue_item *item; 00607 00608 if (!ast_fully_booted) { 00609 return; 00610 } 00611 00612 AST_LIST_LOCK(&reload_queue); 00613 00614 if (do_full_reload) { 00615 do_full_reload = 0; 00616 AST_LIST_UNLOCK(&reload_queue); 00617 ast_log(LOG_NOTICE, "Executing deferred reload request.\n"); 00618 ast_module_reload(NULL); 00619 return; 00620 } 00621 00622 while ((item = AST_LIST_REMOVE_HEAD(&reload_queue, entry))) { 00623 ast_log(LOG_NOTICE, "Executing deferred reload request for module '%s'.\n", item->module); 00624 ast_module_reload(item->module); 00625 ast_free(item); 00626 } 00627 00628 AST_LIST_UNLOCK(&reload_queue); 00629 }
| int ast_rtp_engine_init | ( | void | ) |
initializes the rtp engine arrays
Definition at line 1983 of file rtp_engine.c.
References add_static_payload(), AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723_1, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_H261, AST_FORMAT_H263, AST_FORMAT_H263_PLUS, AST_FORMAT_H264, AST_FORMAT_ILBC, AST_FORMAT_JPEG, AST_FORMAT_LPC10, AST_FORMAT_MP4_VIDEO, AST_FORMAT_PNG, ast_format_set(), AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FORMAT_SPEEX, AST_FORMAT_SPEEX16, AST_FORMAT_SPEEX32, AST_FORMAT_T140, AST_FORMAT_T140RED, AST_FORMAT_ULAW, AST_RTP_CISCO_DTMF, AST_RTP_CN, AST_RTP_DTMF, ast_rwlock_init, and set_next_mime_type().
Referenced by main().
01984 { 01985 struct ast_format tmpfmt; 01986 01987 ast_rwlock_init(&mime_types_lock); 01988 ast_rwlock_init(&static_RTP_PT_lock); 01989 01990 /* Define all the RTP mime types available */ 01991 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0, "audio", "G723", 8000); 01992 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0, "audio", "GSM", 8000); 01993 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "PCMU", 8000); 01994 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0, "audio", "G711U", 8000); 01995 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "PCMA", 8000); 01996 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0, "audio", "G711A", 8000); 01997 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0, "audio", "G726-32", 8000); 01998 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0, "audio", "DVI4", 8000); 01999 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0, "audio", "L16", 8000); 02000 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0, "audio", "L16", 16000); 02001 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0, "audio", "L16-256", 16000); 02002 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0, "audio", "LPC", 8000); 02003 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729", 8000); 02004 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G729A", 8000); 02005 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0, "audio", "G.729", 8000); 02006 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0, "audio", "speex", 8000); 02007 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0, "audio", "speex", 16000); 02008 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0, "audio", "speex", 32000); 02009 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0, "audio", "iLBC", 8000); 02010 /* this is the sample rate listed in the RTP profile for the G.722 codec, *NOT* the actual sample rate of the media stream */ 02011 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0, "audio", "G722", 8000); 02012 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0, "audio", "AAL2-G726-32", 8000); 02013 set_next_mime_type(NULL, AST_RTP_DTMF, "audio", "telephone-event", 8000); 02014 set_next_mime_type(NULL, AST_RTP_CISCO_DTMF, "audio", "cisco-telephone-event", 8000); 02015 set_next_mime_type(NULL, AST_RTP_CN, "audio", "CN", 8000); 02016 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0, "video", "JPEG", 90000); 02017 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_PNG, 0), 0, "video", "PNG", 90000); 02018 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0, "video", "H261", 90000); 02019 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0, "video", "H263", 90000); 02020 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0, "video", "h263-1998", 90000); 02021 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0, "video", "H264", 90000); 02022 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0, "video", "MP4V-ES", 90000); 02023 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0, "text", "RED", 1000); 02024 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0, "text", "T140", 1000); 02025 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0, "audio", "G7221", 16000); 02026 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0, "audio", "G7221", 32000); 02027 set_next_mime_type(ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0, "audio", "G719", 48000); 02028 02029 /* Define the static rtp payload mappings */ 02030 add_static_payload(0, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0), 0); 02031 #ifdef USE_DEPRECATED_G726 02032 add_static_payload(2, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0);/* Technically this is G.721, but if Cisco can do it, so can we... */ 02033 #endif 02034 add_static_payload(3, ast_format_set(&tmpfmt, AST_FORMAT_GSM, 0), 0); 02035 add_static_payload(4, ast_format_set(&tmpfmt, AST_FORMAT_G723_1, 0), 0); 02036 add_static_payload(5, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0);/* 8 kHz */ 02037 add_static_payload(6, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 16 kHz */ 02038 add_static_payload(7, ast_format_set(&tmpfmt, AST_FORMAT_LPC10, 0), 0); 02039 add_static_payload(8, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0), 0); 02040 add_static_payload(9, ast_format_set(&tmpfmt, AST_FORMAT_G722, 0), 0); 02041 add_static_payload(10, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 2 channels */ 02042 add_static_payload(11, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0), 0); /* 1 channel */ 02043 add_static_payload(13, NULL, AST_RTP_CN); 02044 add_static_payload(16, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 11.025 kHz */ 02045 add_static_payload(17, ast_format_set(&tmpfmt, AST_FORMAT_ADPCM, 0), 0); /* 22.050 kHz */ 02046 add_static_payload(18, ast_format_set(&tmpfmt, AST_FORMAT_G729A, 0), 0); 02047 add_static_payload(19, NULL, AST_RTP_CN); /* Also used for CN */ 02048 add_static_payload(26, ast_format_set(&tmpfmt, AST_FORMAT_JPEG, 0), 0); 02049 add_static_payload(31, ast_format_set(&tmpfmt, AST_FORMAT_H261, 0), 0); 02050 add_static_payload(34, ast_format_set(&tmpfmt, AST_FORMAT_H263, 0), 0); 02051 add_static_payload(97, ast_format_set(&tmpfmt, AST_FORMAT_ILBC, 0), 0); 02052 add_static_payload(98, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0); 02053 add_static_payload(99, ast_format_set(&tmpfmt, AST_FORMAT_H264, 0), 0); 02054 add_static_payload(101, NULL, AST_RTP_DTMF); 02055 add_static_payload(102, ast_format_set(&tmpfmt, AST_FORMAT_SIREN7, 0), 0); 02056 add_static_payload(103, ast_format_set(&tmpfmt, AST_FORMAT_H263_PLUS, 0), 0); 02057 add_static_payload(104, ast_format_set(&tmpfmt, AST_FORMAT_MP4_VIDEO, 0), 0); 02058 add_static_payload(105, ast_format_set(&tmpfmt, AST_FORMAT_T140RED, 0), 0); /* Real time text chat (with redundancy encoding) */ 02059 add_static_payload(106, ast_format_set(&tmpfmt, AST_FORMAT_T140, 0), 0); /* Real time text chat */ 02060 add_static_payload(110, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX, 0), 0); 02061 add_static_payload(111, ast_format_set(&tmpfmt, AST_FORMAT_G726, 0), 0); 02062 add_static_payload(112, ast_format_set(&tmpfmt, AST_FORMAT_G726_AAL2, 0), 0); 02063 add_static_payload(115, ast_format_set(&tmpfmt, AST_FORMAT_SIREN14, 0), 0); 02064 add_static_payload(116, ast_format_set(&tmpfmt, AST_FORMAT_G719, 0), 0); 02065 add_static_payload(117, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX16, 0), 0); 02066 add_static_payload(118, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0), 0); /* 16 Khz signed linear */ 02067 add_static_payload(119, ast_format_set(&tmpfmt, AST_FORMAT_SPEEX32, 0), 0); 02068 add_static_payload(121, NULL, AST_RTP_CISCO_DTMF); /* Must be type 121 */ 02069 02070 return 0; 02071 }
| int ast_ssl_init | ( | void | ) |
Provided by ssl.c
Definition at line 148 of file libasteriskssl.c.
References ast_calloc, ast_debug, and ast_mutex_init.
Referenced by main().
00149 { 00150 #ifdef HAVE_OPENSSL 00151 unsigned int i; 00152 int (*real_SSL_library_init)(void); 00153 void (*real_CRYPTO_set_id_callback)(unsigned long (*)(void)); 00154 void (*real_CRYPTO_set_locking_callback)(void (*)(int, int, const char *, int)); 00155 void (*real_SSL_load_error_strings)(void); 00156 void (*real_ERR_load_SSL_strings)(void); 00157 void (*real_ERR_load_crypto_strings)(void); 00158 void (*real_ERR_load_BIO_strings)(void); 00159 const char *errstr; 00160 00161 /* clear any previous dynamic linker errors */ 00162 dlerror(); 00163 get_OpenSSL_function(SSL_library_init); 00164 if ((errstr = dlerror()) != NULL) { 00165 ast_debug(1, "unable to get real address of SSL_library_init: %s\n", errstr); 00166 /* there is no way to continue in this situation... SSL will 00167 * likely be broken in this process 00168 */ 00169 return -1; 00170 } else { 00171 real_SSL_library_init(); 00172 } 00173 00174 /* Make OpenSSL usage thread-safe. */ 00175 00176 dlerror(); 00177 get_OpenSSL_function(CRYPTO_set_id_callback); 00178 if ((errstr = dlerror()) != NULL) { 00179 ast_debug(1, "unable to get real address of CRYPTO_set_id_callback: %s\n", errstr); 00180 /* there is no way to continue in this situation... SSL will 00181 * likely be broken in this process 00182 */ 00183 return -1; 00184 } else { 00185 real_CRYPTO_set_id_callback(ssl_threadid); 00186 } 00187 00188 dlerror(); 00189 get_OpenSSL_function(CRYPTO_set_locking_callback); 00190 if ((errstr = dlerror()) != NULL) { 00191 ast_debug(1, "unable to get real address of CRYPTO_set_locking_callback: %s\n", errstr); 00192 /* there is no way to continue in this situation... SSL will 00193 * likely be broken in this process 00194 */ 00195 return -1; 00196 } else { 00197 ssl_num_locks = CRYPTO_num_locks(); 00198 if (!(ssl_locks = ast_calloc(ssl_num_locks, sizeof(ssl_locks[0])))) { 00199 return -1; 00200 } 00201 for (i = 0; i < ssl_num_locks; i++) { 00202 ast_mutex_init(&ssl_locks[i]); 00203 } 00204 real_CRYPTO_set_locking_callback(ssl_lock); 00205 } 00206 00207 /* after this point, we don't check for errors from the dlsym() calls, 00208 * under the assumption that if the ones above were successful, all 00209 * the rest will be too. this assumption holds as long as OpenSSL still 00210 * provides all of these functions. 00211 */ 00212 00213 get_OpenSSL_function(SSL_load_error_strings); 00214 real_SSL_load_error_strings(); 00215 00216 get_OpenSSL_function(ERR_load_SSL_strings); 00217 real_ERR_load_SSL_strings(); 00218 00219 get_OpenSSL_function(ERR_load_crypto_strings); 00220 real_ERR_load_crypto_strings(); 00221 00222 get_OpenSSL_function(ERR_load_BIO_strings); 00223 real_ERR_load_BIO_strings(); 00224 00225 #if 0 00226 /* currently this is just another call to SSL_library_init, so we don't call it */ 00227 OpenSSL_add_all_algorithms(); 00228 #endif 00229 00230 startup_complete = 1; 00231 00232 #endif /* HAVE_OPENSSL */ 00233 return 0; 00234 }
| void ast_stun_init | ( | void | ) |
Initialize the STUN system in Asterisk.
Provided by stun.c
Definition at line 499 of file stun.c.
References ast_cli_register_multiple().
Referenced by main().
00500 { 00501 ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry)); 00502 }
| int ast_term_init | ( | void | ) |
Provided by term.c
Definition at line 83 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().
00084 { 00085 char *term = getenv("TERM"); 00086 char termfile[256] = ""; 00087 char buffer[512] = ""; 00088 int termfd = -1, parseokay = 0, i; 00089 00090 if (ast_opt_no_color) { 00091 return 0; 00092 } 00093 00094 if (!ast_opt_console) { 00095 /* If any remote console is not compatible, we'll strip the color codes at that point */ 00096 vt100compat = 1; 00097 goto end; 00098 } 00099 00100 if (!term) { 00101 return 0; 00102 } 00103 00104 for (i = 0;; i++) { 00105 if (termpath[i] == NULL) { 00106 break; 00107 } 00108 snprintf(termfile, sizeof(termfile), "%s/%c/%s", termpath[i], *term, term); 00109 termfd = open(termfile, O_RDONLY); 00110 if (termfd > -1) { 00111 break; 00112 } 00113 } 00114 if (termfd > -1) { 00115 int actsize = read(termfd, buffer, sizeof(buffer) - 1); 00116 short sz_names = convshort(buffer + 2); 00117 short sz_bools = convshort(buffer + 4); 00118 short n_nums = convshort(buffer + 6); 00119 00120 /* if ((sz_names + sz_bools) & 1) 00121 sz_bools++; */ 00122 00123 if (sz_names + sz_bools + n_nums < actsize) { 00124 /* Offset 13 is defined in /usr/include/term.h, though we do not 00125 * include it here, as it conflicts with include/asterisk/term.h */ 00126 short max_colors = convshort(buffer + 12 + sz_names + sz_bools + 13 * 2); 00127 if (max_colors > 0) { 00128 vt100compat = 1; 00129 } 00130 parseokay = 1; 00131 } 00132 close(termfd); 00133 } 00134 00135 if (!parseokay) { 00136 /* These comparisons should not be substrings nor case-insensitive, as 00137 * terminal types are very particular about how they treat suffixes and 00138 * capitalization. For example, terminal type 'linux-m' does NOT 00139 * support color, while 'linux' does. Not even all vt100* terminals 00140 * support color, either (e.g. 'vt100+fnkeys'). */ 00141 if (!strcmp(term, "linux")) { 00142 vt100compat = 1; 00143 } else if (!strcmp(term, "xterm")) { 00144 vt100compat = 1; 00145 } else if (!strcmp(term, "xterm-color")) { 00146 vt100compat = 1; 00147 } else if (!strcmp(term, "xterm-256color")) { 00148 vt100compat = 1; 00149 } else if (!strncmp(term, "Eterm", 5)) { 00150 /* Both entries which start with Eterm support color */ 00151 vt100compat = 1; 00152 } else if (!strcmp(term, "vt100")) { 00153 vt100compat = 1; 00154 } else if (!strncmp(term, "crt", 3)) { 00155 /* Both crt terminals support color */ 00156 vt100compat = 1; 00157 } 00158 } 00159 00160 end: 00161 if (vt100compat) { 00162 /* Make commands show up in nice colors */ 00163 if (ast_opt_light_background) { 00164 snprintf(prepdata, sizeof(prepdata), "%c[%dm", ESC, COLOR_BROWN); 00165 snprintf(enddata, sizeof(enddata), "%c[%dm", ESC, COLOR_BLACK); 00166 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00167 } else if (ast_opt_force_black_background) { 00168 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10); 00169 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10); 00170 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00171 } else { 00172 snprintf(prepdata, sizeof(prepdata), "%c[%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN); 00173 snprintf(enddata, sizeof(enddata), "%c[%d;%dm", ESC, ATTR_RESET, COLOR_WHITE); 00174 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00175 } 00176 } 00177 return 0; 00178 }
| int ast_test_init | ( | void | ) |
Provided by test.c
Definition at line 932 of file test.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
00933 { 00934 #ifdef TEST_FRAMEWORK 00935 /* Register cli commands */ 00936 ast_cli_register_multiple(test_cli, ARRAY_LEN(test_cli)); 00937 #endif 00938 00939 return 0; 00940 }
| int ast_timing_init | ( | void | ) |
Provided by timing.c
Definition at line 288 of file timing.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_heap_create(), and timing_holder_cmp().
Referenced by main().
00289 { 00290 if (!(timing_interfaces = ast_heap_create(2, timing_holder_cmp, 0))) { 00291 return -1; 00292 } 00293 00294 return ast_cli_register_multiple(cli_timing, ARRAY_LEN(cli_timing)); 00295 }
| int ast_tps_init | ( | void | ) |
Provided by taskprocessor.c
Definition at line 122 of file taskprocessor.c.
References ao2_container_alloc, ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_log(), cli_ping_cond, LOG_ERROR, taskprocessor_clis, tps_cmp_cb(), tps_hash_cb(), TPS_MAX_BUCKETS, and tps_singletons.
Referenced by main().
00123 { 00124 if (!(tps_singletons = ao2_container_alloc(TPS_MAX_BUCKETS, tps_hash_cb, tps_cmp_cb))) { 00125 ast_log(LOG_ERROR, "taskprocessor container failed to initialize!\n"); 00126 return -1; 00127 } 00128 00129 ast_cond_init(&cli_ping_cond, NULL); 00130 00131 ast_cli_register_multiple(taskprocessor_clis, ARRAY_LEN(taskprocessor_clis)); 00132 return 0; 00133 }
| int ast_xmldoc_load_documentation | ( | void | ) |
| int astdb_init | ( | void | ) |
Provided by db.c
Definition at line 923 of file db.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_init, ast_manager_register_xml, ast_pthread_create_background, ast_register_atexit(), astdb_atexit(), db_init(), db_sync_thread(), EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, manager_dbdel(), manager_dbdeltree(), manager_dbget(), and manager_dbput().
Referenced by main().
00924 { 00925 if (db_init()) { 00926 return -1; 00927 } 00928 00929 ast_cond_init(&dbcond, NULL); 00930 if (ast_pthread_create_background(&syncthread, NULL, db_sync_thread, NULL)) { 00931 return -1; 00932 } 00933 00934 ast_register_atexit(astdb_atexit); 00935 ast_cli_register_multiple(cli_database, ARRAY_LEN(cli_database)); 00936 ast_manager_register_xml("DBGet", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_dbget); 00937 ast_manager_register_xml("DBPut", EVENT_FLAG_SYSTEM, manager_dbput); 00938 ast_manager_register_xml("DBDel", EVENT_FLAG_SYSTEM, manager_dbdel); 00939 ast_manager_register_xml("DBDelTree", EVENT_FLAG_SYSTEM, manager_dbdeltree); 00940 return 0; 00941 }
| int astobj2_init | ( | void | ) |
Provided by astobj2.c
Definition at line 1143 of file astobj2.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
01144 { 01145 #ifdef AO2_DEBUG 01146 ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); 01147 #endif 01148 01149 return 0; 01150 }
| void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 1155 of file logger.c.
References ast_cond_signal, AST_LIST_LOCK, AST_LIST_UNLOCK, AST_PTHREADT_NULL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, close_logger_thread, f, logchannel::fileptr, logchannel::list, logcond, logthread, and qlog.
Referenced by really_quit().
01156 { 01157 struct logchannel *f = NULL; 01158 01159 logger_initialized = 0; 01160 01161 /* Stop logger thread */ 01162 AST_LIST_LOCK(&logmsgs); 01163 close_logger_thread = 1; 01164 ast_cond_signal(&logcond); 01165 AST_LIST_UNLOCK(&logmsgs); 01166 01167 if (logthread != AST_PTHREADT_NULL) 01168 pthread_join(logthread, NULL); 01169 01170 AST_RWLIST_WRLOCK(&logchannels); 01171 01172 if (qlog) { 01173 fclose(qlog); 01174 qlog = NULL; 01175 } 01176 01177 AST_RWLIST_TRAVERSE(&logchannels, f, list) { 01178 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 01179 fclose(f->fileptr); 01180 f->fileptr = NULL; 01181 } 01182 } 01183 01184 closelog(); /* syslog */ 01185 01186 AST_RWLIST_UNLOCK(&logchannels); 01187 01188 return; 01189 }
| int dnsmgr_init | ( | void | ) |
Provided by dnsmgr.c
Definition at line 398 of file dnsmgr.c.
References ast_cli_register(), ast_log(), ast_sched_context_create(), cli_refresh, cli_reload, cli_status, do_reload(), and LOG_ERROR.
Referenced by main().
00399 { 00400 if (!(sched = ast_sched_context_create())) { 00401 ast_log(LOG_ERROR, "Unable to create schedule context.\n"); 00402 return -1; 00403 } 00404 ast_cli_register(&cli_reload); 00405 ast_cli_register(&cli_status); 00406 ast_cli_register(&cli_refresh); 00407 return do_reload(1); 00408 }
| int dnsmgr_reload | ( | void | ) |
Provided by dnsmgr.c
Definition at line 410 of file dnsmgr.c.
References do_reload().
00411 { 00412 return do_reload(0); 00413 }
| void dnsmgr_start_refresh | ( | void | ) |
Provided by dnsmgr.c
Definition at line 290 of file dnsmgr.c.
References ast_sched_add_variable(), AST_SCHED_DEL, master_refresh_info, and refresh_list().
Referenced by main().
00291 { 00292 if (refresh_sched > -1) { 00293 AST_SCHED_DEL(sched, refresh_sched); 00294 refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1); 00295 } 00296 }
| int init_framer | ( | void | ) |
Provided by frame.c
Definition at line 878 of file format.c.
References ARRAY_LEN, and ast_cli_register_multiple().
Referenced by main().
00879 { 00880 ast_cli_register_multiple(my_clis, ARRAY_LEN(my_clis)); 00881 return 0; 00882 }
| int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 1131 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_pthread_create, cli_logger, handle_SIGXFSZ, init_logger_chain(), logcond, logger_thread(), and logthread.
Referenced by main().
01132 { 01133 /* auto rotate if sig SIGXFSZ comes a-knockin */ 01134 sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL); 01135 01136 /* start logger thread */ 01137 ast_cond_init(&logcond, NULL); 01138 if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) { 01139 ast_cond_destroy(&logcond); 01140 return -1; 01141 } 01142 01143 /* register the logger cli commands */ 01144 ast_cli_register_multiple(cli_logger, ARRAY_LEN(cli_logger)); 01145 01146 ast_mkdir(ast_config_AST_LOG_DIR, 0777); 01147 01148 /* create log channels */ 01149 init_logger_chain(0 /* locked */, NULL); 01150 logger_initialized = 1; 01151 01152 return 0; 01153 }
| int load_modules | ( | unsigned | int | ) |
Provided by loader.c
Definition at line 1011 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().
01012 { 01013 struct ast_config *cfg; 01014 struct ast_module *mod; 01015 struct load_order_entry *order; 01016 struct ast_variable *v; 01017 unsigned int load_count; 01018 struct load_order load_order; 01019 int res = 0; 01020 struct ast_flags config_flags = { 0 }; 01021 int modulecount = 0; 01022 01023 #ifdef LOADABLE_MODULES 01024 struct dirent *dirent; 01025 DIR *dir; 01026 #endif 01027 01028 /* all embedded modules have registered themselves by now */ 01029 embedding = 0; 01030 01031 ast_verb(1, "Asterisk Dynamic Loader Starting:\n"); 01032 01033 AST_LIST_HEAD_INIT_NOLOCK(&load_order); 01034 01035 AST_LIST_LOCK(&module_list); 01036 01037 if (embedded_module_list.first) { 01038 module_list.first = embedded_module_list.first; 01039 module_list.last = embedded_module_list.last; 01040 embedded_module_list.first = NULL; 01041 } 01042 01043 cfg = ast_config_load2(AST_MODULE_CONFIG, "" /* core, can't reload */, config_flags); 01044 if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) { 01045 ast_log(LOG_WARNING, "No '%s' found, no modules will be loaded.\n", AST_MODULE_CONFIG); 01046 goto done; 01047 } 01048 01049 /* first, find all the modules we have been explicitly requested to load */ 01050 for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) { 01051 if (!strcasecmp(v->name, preload_only ? "preload" : "load")) { 01052 add_to_load_order(v->value, &load_order, 0); 01053 } 01054 if (!strcasecmp(v->name, preload_only ? "preload-require" : "require")) { 01055 /* Add the module to the list and make sure it's required */ 01056 add_to_load_order(v->value, &load_order, 1); 01057 ast_debug(2, "Adding module to required list: %s (%s)\n", v->value, v->name); 01058 } 01059 01060 } 01061 01062 /* check if 'autoload' is on */ 01063 if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) { 01064 /* if so, first add all the embedded modules that are not already running to the load order */ 01065 AST_LIST_TRAVERSE(&module_list, mod, entry) { 01066 /* if it's not embedded, skip it */ 01067 if (mod->lib) 01068 continue; 01069 01070 if (mod->flags.running) 01071 continue; 01072 01073 order = add_to_load_order(mod->resource, &load_order, 0); 01074 } 01075 01076 #ifdef LOADABLE_MODULES 01077 /* if we are allowed to load dynamic modules, scan the directory for 01078 for all available modules and add them as well */ 01079 if ((dir = opendir(ast_config_AST_MODULE_DIR))) { 01080 while ((dirent = readdir(dir))) { 01081 int ld = strlen(dirent->d_name); 01082 01083 /* Must end in .so to load it. */ 01084 01085 if (ld < 4) 01086 continue; 01087 01088 if (strcasecmp(dirent->d_name + ld - 3, ".so")) 01089 continue; 01090 01091 /* if there is already a module by this name in the module_list, 01092 skip this file */ 01093 if (find_resource(dirent->d_name, 0)) 01094 continue; 01095 01096 add_to_load_order(dirent->d_name, &load_order, 0); 01097 } 01098 01099 closedir(dir); 01100 } else { 01101 if (!ast_opt_quiet) 01102 ast_log(LOG_WARNING, "Unable to open modules directory '%s'.\n", 01103 ast_config_AST_MODULE_DIR); 01104 } 01105 #endif 01106 } 01107 01108 /* now scan the config for any modules we are prohibited from loading and 01109 remove them from the load order */ 01110 for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) { 01111 if (strcasecmp(v->name, "noload")) 01112 continue; 01113 01114 AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) { 01115 if (!resource_name_match(order->resource, v->value)) { 01116 AST_LIST_REMOVE_CURRENT(entry); 01117 ast_free(order->resource); 01118 ast_free(order); 01119 } 01120 } 01121 AST_LIST_TRAVERSE_SAFE_END; 01122 } 01123 01124 /* we are done with the config now, all the information we need is in the 01125 load_order list */ 01126 ast_config_destroy(cfg); 01127 01128 load_count = 0; 01129 AST_LIST_TRAVERSE(&load_order, order, entry) 01130 load_count++; 01131 01132 if (load_count) 01133 ast_log(LOG_NOTICE, "%d modules will be loaded.\n", load_count); 01134 01135 /* first, load only modules that provide global symbols */ 01136 if ((res = load_resource_list(&load_order, 1, &modulecount)) < 0) { 01137 goto done; 01138 } 01139 01140 /* now load everything else */ 01141 if ((res = load_resource_list(&load_order, 0, &modulecount)) < 0) { 01142 goto done; 01143 } 01144 01145 done: 01146 while ((order = AST_LIST_REMOVE_HEAD(&load_order, entry))) { 01147 ast_free(order->resource); 01148 ast_free(order); 01149 } 01150 01151 AST_LIST_UNLOCK(&module_list); 01152 01153 /* Tell manager clients that are aggressive at logging in that we're done 01154 loading modules. If there's a DNS problem in chan_sip, we might not 01155 even reach this */ 01156 manager_event(EVENT_FLAG_SYSTEM, "ModuleLoadReport", "ModuleLoadStatus: Done\r\nModuleSelection: %s\r\nModuleCount: %d\r\n", preload_only ? "Preload" : "All", modulecount); 01157 01158 return res; 01159 }
| int load_pbx | ( | void | ) |
Provided by pbx.c
Definition at line 10440 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_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, and testtime_function.
Referenced by main().
10441 { 10442 int x; 10443 10444 /* Initialize the PBX */ 10445 ast_verb(1, "Asterisk PBX Core Initializing\n"); 10446 if (!(device_state_tps = ast_taskprocessor_get("pbx-core", 0))) { 10447 ast_log(LOG_WARNING, "failed to create pbx-core taskprocessor\n"); 10448 } 10449 10450 ast_verb(1, "Registering builtin applications:\n"); 10451 ast_cli_register_multiple(pbx_cli, ARRAY_LEN(pbx_cli)); 10452 ast_data_register_multiple_core(pbx_data_providers, ARRAY_LEN(pbx_data_providers)); 10453 __ast_custom_function_register(&exception_function, NULL); 10454 __ast_custom_function_register(&testtime_function, NULL); 10455 10456 /* Register builtin applications */ 10457 for (x = 0; x < ARRAY_LEN(builtins); x++) { 10458 ast_verb(1, "[%s]\n", builtins[x].name); 10459 if (ast_register_application2(builtins[x].name, builtins[x].execute, NULL, NULL, NULL)) { 10460 ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name); 10461 return -1; 10462 } 10463 } 10464 10465 /* Register manager application */ 10466 ast_manager_register_xml("ShowDialPlan", EVENT_FLAG_CONFIG | EVENT_FLAG_REPORTING, manager_show_dialplan); 10467 10468 if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, "pbx Device State Change", NULL, 10469 AST_EVENT_IE_END))) { 10470 return -1; 10471 } 10472 10473 return 0; 10474 }
| void threadstorage_init | ( | void | ) |
1.5.6