RTS API Documentation  1.10.11
Functions
Startup/Shutdown
+ Collaboration diagram for Startup/Shutdown:

Functions

switch_status_t switch_core_init (_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err)
 Initilize the core. More...
 
switch_status_t switch_core_init_and_modload (_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err)
 Initilize the core and load modules. More...
 
uint32_t switch_core_session_limit (_In_ uint32_t new_limit)
 Set/Get Session Limit. More...
 
uint32_t switch_core_sessions_per_second (_In_ uint32_t new_limit)
 Set/Get Session Rate Limit. More...
 
switch_status_t switch_core_destroy (void)
 Destroy the core. More...
 

Detailed Description

Function Documentation

◆ switch_core_destroy()

switch_status_t switch_core_destroy ( void  )

Destroy the core.

Note
to be called at application shutdown

Definition at line 3020 of file switch_core.c.

References switch_directories::base_dir, switch_directories::cache_dir, switch_directories::certs_dir, switch_directories::conf_dir, switch_filenames::conf_name, switch_runtime::console, switch_directories::data_dir, switch_directories::db_dir, switch_directories::fonts_dir, switch_runtime::global_vars, switch_directories::grammar_dir, switch_ip_list_t::hash, switch_directories::htdocs_dir, switch_directories::images_dir, switch_directories::lib_dir, switch_directories::localstate_dir, switch_directories::log_dir, switch_runtime::memory_pool, switch_runtime::mime_type_exts, switch_runtime::mime_types, switch_directories::mod_dir, switch_ip_list_t::pool, switch_runtime::ptimes, switch_directories::recordings_dir, switch_directories::run_dir, SCF_NO_NEW_SESSIONS, SCF_RESTART, SCF_SHUTTING_DOWN, SCF_USE_AUTO_NAT, switch_directories::script_dir, switch_runtime::shutdown_cause, switch_directories::sounds_dir, switch_directories::storage_dir, switch_channel_global_uninit(), SWITCH_CHANNEL_LOG, switch_console_shutdown(), switch_core_destroy_memory_pool, switch_core_hash_destroy(), switch_core_media_deinit(), switch_core_memory_stop(), switch_core_session_hupall(), switch_core_session_uninit(), switch_core_unset_variables(), switch_curl_destroy(), switch_event_add_header(), switch_event_create, switch_event_destroy(), switch_event_fire, switch_event_shutdown(), SWITCH_EVENT_SHUTDOWN, SWITCH_GLOBAL_dirs, SWITCH_GLOBAL_filenames, switch_loadable_module_shutdown(), SWITCH_LOG_CONSOLE, switch_log_printf(), switch_log_shutdown(), switch_msrp_destroy(), switch_nat_shutdown(), switch_rtp_shutdown(), switch_safe_free, switch_scheduler_task_thread_stop(), switch_set_flag, switch_ssl_destroy_ssl_locks(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_RESTART, SWITCH_STATUS_SUCCESS, switch_test_flag, switch_xml_destroy(), and switch_directories::temp_dir.

Referenced by freeswitch_kill_background(), fs_core_destroy(), and main().

3021 {
3022  switch_event_t *event;
3023 
3025  switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
3026  switch_event_fire(&event);
3027  }
3028 
3031 
3032  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
3034  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
3035 
3037 
3039 
3041  EVP_cleanup();
3042 
3044 
3047 
3050  }
3054 
3055  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
3057 
3058  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
3060 
3064 
3065  if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
3066  fclose(runtime.console);
3067  runtime.console = NULL;
3068  }
3069 
3090 
3092 
3097 
3098  if (IP_LIST.hash) {
3100  }
3101 
3102  if (IP_LIST.pool) {
3104  }
3105 
3107 
3108  if (runtime.memory_pool) {
3109  fspr_pool_destroy(runtime.memory_pool);
3110  fspr_terminate();
3111  }
3112 
3113  sqlite3_shutdown();
3114 
3116 }
void switch_channel_global_uninit(void)
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
Definition: switch_event.h:413
switch_status_t switch_msrp_destroy(void)
Definition: switch_msrp.c:349
switch_memory_pool_t * pool
Definition: switch_core.c:1368
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:700
void switch_nat_shutdown(void)
Shuts down the NAT Traversal System.
Definition: switch_nat.c:741
#define SWITCH_CHANNEL_LOG
switch_status_t switch_core_hash_destroy(_Inout_ switch_hash_t **hash)
Destroy an existing hash table.
void switch_core_memory_stop(void)
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
Definition: switch_core.h:642
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
Definition: switch_event.h:80
switch_event_t * global_vars
void switch_scheduler_task_thread_stop(void)
Stop the scheduler system.
switch_call_cause_t shutdown_cause
switch_status_t switch_console_shutdown(void)
struct switch_runtime runtime
Definition: switch_core.c:86
void switch_loadable_module_shutdown(void)
Shutdown the module backend and call the shutdown routine in all loaded modules.
void switch_curl_destroy(void)
Definition: switch_curl.c:56
void switch_core_media_deinit(void)
switch_status_t switch_event_shutdown(void)
Stop the eventing system.
Definition: switch_event.c:549
switch_hash_t * hash
Definition: switch_core.c:1369
switch_hash_t * ptimes
void switch_core_session_uninit(void)
void switch_core_session_hupall(_In_ switch_call_cause_t cause)
Hangup all sessions.
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
Definition: switch_utils.h:885
static switch_ip_list_t IP_LIST
Definition: switch_core.c:1372
switch_hash_t * mime_type_exts
switch_status_t switch_xml_destroy(void)
Definition: switch_xml.c:2473
switch_status_t switch_log_shutdown(void)
Shut down the logging engine.
Definition: switch_log.c:799
void switch_rtp_shutdown(void)
Definition: switch_rtp.c:2552
switch_hash_t * mime_types
static void switch_core_unset_variables(void)
Definition: switch_core.c:434
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
Definition: switch_event.h:384
switch_filenames SWITCH_GLOBAL_filenames
Definition: switch_core.c:83
switch_directories SWITCH_GLOBAL_dirs
Definition: switch_core.c:82
switch_memory_pool_t * memory_pool
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
Definition: switch_utils.h:693
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
void switch_event_destroy(switch_event_t **event)
Destroy an event.
void switch_ssl_destroy_ssl_locks(void)

◆ switch_core_init()

switch_status_t switch_core_init ( _In_ switch_core_flag_t  flags,
_In_ switch_bool_t  console,
_Out_ const char **  err 
)

Initilize the core.

Parameters
consoleoptional FILE stream for output
flagscore flags
erra pointer to set any errors to
Note
to be called at application startup

Referenced by fs_core_init(), fst_init_core_and_modload(), and main().

◆ switch_core_init_and_modload()

switch_status_t switch_core_init_and_modload ( _In_ switch_core_flag_t  flags,
_In_ switch_bool_t  console,
_Out_ const char **  err 
)

Initilize the core and load modules.

Parameters
consoleoptional FILE stream for output
flagscore flags
erra pointer to set any errors to
Note
to be called at application startup instead of switch_core_init. Includes module loading.

Referenced by freeswitch_kill_background(), fst_init_core_and_modload(), and main().

◆ switch_core_session_limit()

uint32_t switch_core_session_limit ( _In_ uint32_t  new_limit)

Set/Get Session Limit.

Parameters
new_limitnew value (if > 0)
Returns
the current session limit

Referenced by send_heartbeat(), switch_core_init_and_modload(), switch_core_session_ctl(), and switch_load_core_config().

◆ switch_core_sessions_per_second()

uint32_t switch_core_sessions_per_second ( _In_ uint32_t  new_limit)

Set/Get Session Rate Limit.

Parameters
new_limitnew value (if > 0)
Returns
the current session rate limit

Referenced by switch_core_init_and_modload(), and switch_load_core_config().