FreeSWITCH API Documentation  1.7.0
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_status_t switch_core_destroy ( void  )

Destroy the core.

Note
to be called at application shutdown

Definition at line 2877 of file switch_core.c.

References switch_directories::base_dir, switch_directories::cache_dir, switch_directories::conf_dir, 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::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, SCF_USE_SQL, switch_directories::script_dir, switch_directories::sounds_dir, switch_directories::storage_dir, SWITCH_CAUSE_SYSTEM_SHUTDOWN, 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_sqldb_stop(), switch_core_unset_variables(), switch_event_add_header(), switch_event_create, switch_event_destroy(), switch_event_fire, switch_event_shutdown(), SWITCH_EVENT_SHUTDOWN, SWITCH_GLOBAL_dirs, switch_loadable_module_shutdown(), SWITCH_LOG_CONSOLE, switch_log_printf(), switch_log_shutdown(), 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 fs_core_destroy(), and main().

2878 {
2879  switch_event_t *event;
2880 
2882  switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
2883  switch_event_fire(&event);
2884  }
2885 
2888 
2889  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
2891  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
2892 
2894 
2896 
2899  }
2901 
2903 
2906  }
2910 
2911  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
2913 
2914  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n");
2916 
2920 
2921  if (runtime.console && runtime.console != stdout && runtime.console != stderr) {
2922  fclose(runtime.console);
2923  runtime.console = NULL;
2924  }
2925 
2944 
2949 
2950  if (IP_LIST.hash) {
2952  }
2953 
2954  if (IP_LIST.pool) {
2956  }
2957 
2959 
2960  if (runtime.memory_pool) {
2961  apr_pool_destroy(runtime.memory_pool);
2962  apr_terminate();
2963  }
2964 
2965  sqlite3_shutdown();
2966 
2968 }
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:412
switch_memory_pool_t * pool
Definition: switch_core.c:1360
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
Definition: switch_utils.h:631
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:640
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_status_t switch_console_shutdown(void)
struct switch_runtime runtime
Definition: switch_core.c:64
void switch_loadable_module_shutdown(void)
Shutdown the module backend and call the shutdown routine in all loaded modules.
void switch_core_media_deinit(void)
switch_status_t switch_event_shutdown(void)
Stop the eventing system.
Definition: switch_event.c:524
switch_hash_t * hash
Definition: switch_core.c:1361
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:789
static switch_ip_list_t IP_LIST
Definition: switch_core.c:1364
switch_hash_t * mime_type_exts
switch_status_t switch_xml_destroy(void)
Definition: switch_xml.c:2358
switch_status_t switch_log_shutdown(void)
Shut down the logging engine.
Definition: switch_log.c:560
void switch_rtp_shutdown(void)
Definition: switch_rtp.c:2348
switch_hash_t * mime_types
static void switch_core_unset_variables(void)
Definition: switch_core.c:422
void switch_core_sqldb_stop(void)
#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:383
switch_directories SWITCH_GLOBAL_dirs
Definition: switch_core.c:60
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:624
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_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(), and main().

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 main().

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().

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().