38 #include <fspr_strings.h> 44 #include <fspr_file_io.h> 200 unsigned load_interface = 1;
207 "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->
interface_name,
214 "Failed to load codec interface %s from %s due to bytes per frame %d exceeding buffer size %d.\n",
220 if (load_interface) {
224 "Adding Codec %s %d %s %dhz %dms %dch %dbps\n",
230 "Adding Codec %s %d %s %dhz %dms %dch (VBR)\n",
448 }
else if (!ptr->
extens) {
454 for (i = 0; ptr->
extens[i]; i++) {
499 for (i = 0; ptr->
prefixes[i]; i++) {
681 "Failed to load management interface %s. OID %s already exists\n", key, ptr->
relative_oid);
715 "Failed to load limit interface %s. Name %s already exists\n", key, ptr->
interface_name);
764 #define CHAT_MAX_MSG_QUEUE 101 765 #define CHAT_QUEUE_SIZE 5000 789 const char *replying;
790 const char *dest_proto;
1011 if (data && !strcmp(data,
"__undef")) {
1019 if (expanded != data) {
1034 const char *subject,
const char *body,
const char *type,
const char *hint,
switch_bool_t blocking)
1144 unsigned load_interface = 1;
1151 if (load_interface) {
1154 "Deleting Codec %s %d %s %dhz %dms\n",
1161 for(node = head; node; node = node->
next) {
1164 if ((node = node->
next)) {
1359 for (i = 0; ptr->
extens[i]; i++) {
1370 for(node = head; node; node = node->
next) {
1373 if ((node = node->
next)) {
1411 for (i = 0; ptr->
prefixes[i]; i++) {
1422 for (node = head; node; node = node->
next) {
1425 if ((node = node->
next)) {
1643 char *struct_name = NULL;
1644 switch_module_load_t load_func_ptr = NULL;
1648 const char *err = NULL;
1661 #elif defined (MACOSX) || defined(DARWIN) 1676 if (!interface_struct_handle) {
1687 if (!interface_struct_handle) {
1697 err =
"Trying to load an out of date module, please rebuild the module.";
1704 interface_struct_handle = NULL;
1710 if (interface_struct_handle) {
1711 mod_interface_functions = interface_struct_handle;
1712 load_func_ptr = mod_interface_functions->
load;
1715 if (load_func_ptr == NULL) {
1716 err =
"Cannot locate symbol 'switch_module_load' please make sure this is a valid module.";
1720 status = load_func_ptr(&module_interface, pool);
1723 err =
"Module load routine returned an error";
1724 module_interface = NULL;
1728 if (!module_interface) {
1729 err =
"Module failed to initialize its module_interface. Is this a valid module?";
1764 if (mod_interface_functions) {
1771 *new_module = module;
1793 const char *ext =
".dll";
1795 const char *ext =
".so";
1801 *err =
"allocation error";
1808 if ((dot = strchr(file,
'.'))) {
1812 if ((dot = strchr(file,
'.'))) {
1816 len += strlen(file);
1825 *err =
"Module already loaded";
1828 new_module->
type = type;
1835 *err =
"module load routine returned an error";
1838 *err =
"module load file routine returned an error";
1876 if (!module->
perm) {
1902 *err =
"Module is not unloadable";
1916 *err =
"No such module!";
1937 const char *fname_ext;
1941 const char *ext =
".dll";
1943 const char *ext =
".so";
1951 if ((fname_ext = strrchr(fname,
'.'))) {
1952 if (!strcmp(fname_ext, ext)) {
1953 if (!(fname_base =
switch_mprintf(
"%.*s", (
int)(fname_ext-fname), fname))) {
1957 callback(user_data, fname_base);
1988 switch_module_load_t switch_module_load,
1989 switch_module_runtime_t switch_module_runtime,
1993 switch_module_load_t load_func_ptr = NULL;
1995 const char *err = NULL;
2014 load_func_ptr = (switch_module_load_t) switch_module_load;
2016 if (load_func_ptr == NULL) {
2017 err =
"Cannot Load";
2021 status = load_func_ptr(&module_interface, pool);
2024 err =
"Module load routine returned an error";
2025 module_interface = NULL;
2051 if (switch_module_shutdown) {
2054 if (switch_module_runtime) {
2065 static void switch_loadable_module_path_init()
2067 char *
path = NULL, *working = NULL;
2068 fspr_dir_t *perl_dir_handle = NULL;
2074 fspr_dir_close(perl_dir_handle);
2083 fspr_finfo_t finfo = { 0 };
2084 fspr_dir_t *module_dir_handle = NULL;
2085 fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
2086 char *precf =
"pre_load_modules.conf";
2087 char *cf =
"modules.conf";
2088 char *pcf =
"post_load_modules.conf";
2090 unsigned char all = 0;
2091 unsigned int count = 0;
2100 const char *ext =
".dll";
2101 const char *EXT =
".DLL";
2102 #elif defined (MACOSX) || defined (DARWIN) 2103 const char *ext =
".dylib";
2104 const char *EXT =
".DYLIB";
2106 const char *ext =
".so";
2107 const char *EXT =
".SO";
2115 switch_loadable_module_path_init();
2172 if (
zstr(val) || (strchr(val,
'.') && !strstr(val, ext) && !strstr(val, EXT))) {
2178 if (path &&
zstr(path)) {
2220 #ifdef SWITCH_HAVE_YUV 2221 #ifdef SWITCH_HAVE_VPX 2236 if (
zstr(val) || (strchr(val,
'.') && !strstr(val, ext) && !strstr(val, EXT))) {
2242 if (path &&
zstr(path)) {
2269 if (
zstr(val) || (strchr(val,
'.') && !strstr(val, ext) && !strstr(val, EXT))) {
2275 if (path &&
zstr(path)) {
2299 while (fspr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
2300 const char *fname = finfo.fname;
2302 if (finfo.filetype != APR_REG) {
2314 if (
zstr(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
2320 fspr_dir_close(module_dir_handle);
2343 *err =
"Module in use.";
2376 if ((pool = module->
pool)) {
2501 for (node = head; node; node = node->
next) {
2528 for (node = head; node; node = node->
next) {
2556 for (node = head; node; node = node->
next) {
2574 #define HASH_FUNC(_kind_) SWITCH_DECLARE(switch_##_kind_##_interface_t *) switch_loadable_module_get_##_kind_##_interface(const char *name) \ 2576 switch_##_kind_##_interface_t *i = NULL; \ 2577 if (loadable_modules._kind_##_hash && (i = switch_core_hash_find_locked(loadable_modules._kind_##_hash, name, loadable_modules.mutex))) { \ 2578 PROTECT_INTERFACE(i); \ 2606 #ifdef DEBUG_CODEC_SORTING 2611 for(i = 0; i < arraylen; i++) {
2613 "DEBUG %d %s:%d %d\n", i, array[i]->iananame, array[i]->ianacode, array[i]->microseconds_per_packet / 1000);
2623 array[
b] = array[a];
2629 int i = 0, sorted_ptime = 0;
2631 #ifdef DEBUG_CODEC_SORTING 2633 do_print(array, arraylen);
2637 for (i = 0; i < arraylen; i++) {
2646 if (!strcasecmp(array[i]->iananame,
"ilbc")) {
2650 if (!sorted_ptime) {
2651 sorted_ptime = this_ptime;
2652 #ifdef DEBUG_CODEC_SORTING 2657 if (i > 0 && array[i-1] && strcasecmp(array[i]->iananame, array[i-1]->iananame) && this_ptime != sorted_ptime) {
2661 #ifdef DEBUG_CODEC_SORTING 2664 for(j = i; j < arraylen; j++) {
2667 if (!strcasecmp(array[i]->iananame,
"ilbc")) {
2671 if (check_ptime == sorted_ptime) {
2672 #ifdef DEBUG_CODEC_SORTING 2682 sorted_ptime = this_ptime;
2683 #ifdef DEBUG_CODEC_SORTING 2690 #ifdef DEBUG_CODEC_SORTING 2692 do_print(array, arraylen);
2713 for (node = head; node; node = node->
next) {
2750 name = next = cur =
buf;
2759 if ((p = strchr(next,
'@'))) {
2765 if (strchr(cur,
'i')) {
2766 *interval = atoi(cur);
2767 }
else if ((strchr(cur,
'k') || strchr(cur,
'h'))) {
2769 }
else if (strchr(cur,
'b')) {
2771 }
else if (strchr(cur,
'c')) {
2772 *channels = atoi(cur);
2780 if ((p = strchr(name,
'.'))) {
2786 if ((p = strchr(name,
'~'))) {
2798 int x, i = 0, j = 0;
2804 for (x = 0; x < preflen; x++) {
2805 char *
name,
buf[256], jbuf[256], *modname = NULL, *fmtp = NULL;
2806 uint32_t interval = 0, rate = 0, bit = 0, channels = 1;
2811 for(j = 0; j < x; j++) {
2812 char *jname, *jmodname = NULL, *jfmtp = NULL;
2813 uint32_t jinterval = 0, jrate = 0, jbit = 0, jchannels = 1;
2814 uint32_t ointerval = interval, orate = rate, ochannels = channels;
2816 if (ointerval == 0) {
2824 if (ochannels == 0) {
2831 if (jinterval == 0) {
2839 if (jchannels == 0) {
2843 if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate && ochannels == jchannels &&
2893 if (rate && (uint32_t) crate != rate) {
2944 if (strcasecmp(cmd,
"console_complete")) {
2948 cmd_used = (
char *) cmd;
2949 arg_used = (
char *) arg;
2958 if (cmd_used && *cmd_used) {
2961 if (arg_used && *arg_used) {
2981 if (cmd_used != cmd) {
2985 if (arg_used != arg) {
2996 cJSON *
function, *json_reply = NULL;
3000 function = cJSON_GetObjectItem(json,
"command");
3002 if (
function && function->valuestring
3005 cJSON_AddItemToObject(json,
"status", cJSON_CreateString(
"error"));
3006 cJSON_AddItemToObject(json,
"message", cJSON_CreateString(
"The command returned an error"));
3008 cJSON_AddItemToObject(json,
"status", cJSON_CreateString(
"success"));
3012 json_reply = cJSON_CreateNull();
3016 *retval = json_reply;
3018 cJSON_AddItemToObject(json,
"response", json_reply);
3024 cJSON_AddItemToObject(json,
"status", cJSON_CreateString(
"error"));
3025 cJSON_AddItemToObject(json,
"message", cJSON_CreateString(
"Invalid request or non-existant command"));
3026 cJSON_AddItemToObject(json,
"response", cJSON_CreateNull());
3047 #define ALLOC_INTERFACE(_TYPE_) { \ 3048 switch_##_TYPE_##_interface_t *i, *ptr; \ 3049 i = switch_core_alloc(mod->pool, sizeof(switch_##_TYPE_##_interface_t)); \ 3050 switch_assert(i != NULL); \ 3051 for (ptr = mod->_TYPE_##_interface; ptr && ptr->next; ptr = ptr->next); \ 3055 mod->_TYPE_##_interface = i; \ 3057 switch_thread_rwlock_create(&i->rwlock, mod->pool); \ 3058 switch_mutex_init(&i->reflock, SWITCH_MUTEX_NESTED, mod->pool); \ 3166 if ((*sh)->param_event) {
3181 *sh = malloc(
sizeof(**sh));
3182 memset(*sh, 0,
sizeof(**sh));
3187 (*sh)->param_event = *var_event;
3191 (*sh)->ext = strdup(ext);
3206 }
else if (strstr(buf,
"://")) {
switch_hash_t * timer_hash
#define SWITCH_MAX_CODECS
const char * relative_oid
struct switch_database_interface * next
void * switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex)
Retrieve data from a given hash.
switch_loadable_module_type_t
List of loadable module types.
char * switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var)
static struct switch_loadable_module_container loadable_modules
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
void switch_xml_free(_In_opt_ switch_xml_t xml)
frees the memory allocated for an switch_xml structure
void switch_say_file(switch_say_file_handle_t *sh, const char *fmt,...)
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
A module interface to implement an application.
switch_status_t switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
switch_event_t * param_event
const char * switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_ const char *attr)
returns the value of the requested tag attribute, or "" if not found
switch_module_load_t switch_module_load
switch_memory_pool_t * pool
static switch_bool_t switch_true(const char *expr)
Evaluate the truthfullness of a string expression.
struct switch_directory_interface * next
#define switch_event_expand_headers(_event, _in)
#define ALLOC_INTERFACE(_TYPE_)
Abstract interface to a limit module.
const char * interface_name
#define SWITCH_CHANNEL_LOG
static void chat_queue_message(switch_event_t **eventp)
switch_status_t switch_core_hash_destroy(_Inout_ switch_hash_t **hash)
Destroy an existing hash table.
const char * interface_name
switch_api_function_t function
switch_thread_rwlock_t * rwlock
void * switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key)
Retrieve data from a given hash.
switch_dialplan_interface_t * dialplan_interface
switch_json_api_interface_t * switch_loadable_module_get_json_api_interface(const char *name)
Retrieve the JSON API interface by it's registered name.
Abstraction of an module endpoint interface This is the glue between the abstract idea of a "channel"...
struct switch_database_node_s switch_database_node_t
switch_directory_interface_t * directory_interface
#define switch_core_hash_init(_hash)
const switch_codec_interface_t * ptr
struct switch_management_interface * next
switch_hash_t * endpoint_hash
int switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, char fmtp_array[SWITCH_MAX_CODECS][MAX_FMTP_LEN], int arraylen, char **prefs, int preflen)
Retrieve the list of loaded codecs into an array based on another array showing the sorted order...
switch_thread_rwlock_t * rwlock
#define switch_core_session_hupall_matching_var(_vn, _vv, _c)
switch_core_recover_callback_t switch_core_get_secondary_recover_callback(const char *key)
switch_memory_pool_t * pool
switch_status_t switch_loadable_module_enumerate_available(const char *dir_path, switch_modulename_callback_func_t callback, void *user_data)
Enumerates a list of all modules discovered in a directory.
#define SWITCH_RECOMMENDED_BUFFER_SIZE
switch_status_t switch_loadable_module_build_dynamic(char *filename, switch_module_load_t switch_module_load, switch_module_runtime_t switch_module_runtime, switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime)
build a dynamic module object and register it (for use in double embeded modules) ...
switch_bool_t shutting_down
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
switch_chat_application_function_t chat_application_function
switch_status_t switch_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream)
Execute a registered API command.
switch_codec_interface_t * codec_interface
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
uint32_t decoded_bytes_per_packet
struct switch_stream_handle stream
Representation of an event.
A module interface to implement a chat application.
switch_codec_implementation_t * implementations
switch_hash_t * secondary_recover_hash
switch_status_t switch_event_add_body(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Add a body to an event.
struct switch_endpoint_interface * next
switch_status_t(* chat_send)(switch_event_t *message_event)
#define FREESWITCH_OID_PREFIX
switch_management_interface_t * switch_loadable_module_get_management_interface(const char *relative_oid)
Retrieve the management interface by it's registered name.
Abstract interface to a chat module.
const char * interface_name
switch_thread_rwlock_t * rwlock
char * switch_strip_whitespace(const char *str)
static void switch_loadable_module_sort_codecs(const switch_codec_implementation_t **array, int arraylen)
A representation of an XML tree.
Abstract interface to a dialplan module.
switch_status_t switch_queue_pop(switch_queue_t *queue, void **data)
switch_status_t switch_json_api_execute(cJSON *json, switch_core_session_t *session, cJSON **retval)
Execute a registered JSON API command.
struct switch_speech_interface * next
A table of functions that a timer module implements.
void *SWITCH_THREAD_FUNC chat_thread_run(switch_thread_t *thread, void *obj)
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
switch_database_interface_t * database_interface
#define SWITCH_API_VERSION
static switch_thread_t * thread
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
struct switch_runtime runtime
char * switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname, char **fmtp)
const char * interface_name
switch_status_t switch_loadable_module_protect(const char *mod)
Protect module from beeing unloaded.
switch_thread_rwlock_t * rwlock
Abstract interface to an asr module.
switch_thread_rwlock_t * rwlock
void switch_loadable_module_shutdown(void)
Shutdown the module backend and call the shutdown routine in all loaded modules.
const char * interface_name
switch_api_interface_t * switch_loadable_module_get_api_interface(const char *name)
Retrieve the API interface by it's registered name.
Abstract interface to a file format module.
switch_memory_pool_t * pool
static switch_status_t chat_process_event(switch_event_t **eventp)
struct switch_codec_node_s switch_codec_node_t
switch_memory_pool_t * pool
switch_hash_t * module_hash
struct switch_json_api_interface * next
switch_module_load_t load
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
switch_thread_t * msg_queue_thread[CHAT_MAX_MSG_QUEUE]
switch_status_t switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
switch_thread_rwlock_t * rwlock
struct switch_timer_interface * next
#define UNPROTECT_INTERFACE(_it)
switch_status_t switch_core_chat_send(const char *dest_proto, switch_event_t *message_event)
#define HASH_FUNC(_kind_)
#define SWITCH_MUTEX_NESTED
void switch_core_unregister_secondary_recover_callback(const char *key)
switch_status_t switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
switch_timer_interface_t * timer_interface
switch_status_t switch_loadable_module_unload_module(const char *dir, const char *fname, switch_bool_t force, const char **err)
Unoad a module.
switch_thread_rwlock_t * rwlock
#define SWITCH_PATH_SEPARATOR
switch_chat_interface_t * switch_loadable_module_get_chat_interface(const char *name)
Retrieve the chat interface by it's registered name.
Abstract interface to a speech module.
switch_database_interface_t * switch_loadable_module_get_database_interface(const char *name, const char *modname)
Retrieve the database interface by it's registered name.
switch_hash_t * file_hash
switch_byte_t switch_byte_t * buf
static switch_status_t switch_loadable_module_load_file(char *path, char *filename, switch_bool_t global, switch_loadable_module_t **new_module)
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
switch_hash_t * codec_hash
A module interface to implement an api function.
static void switch_loadable_module_runtime(void)
switch_status_t switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data, _In_opt_ switch_mutex_t *mutex)
Insert data into a hash.
#define CHAT_MAX_MSG_QUEUE
const switch_database_interface_t * ptr
struct switch_dialplan_interface * next
Abstract interface to a say module.
switch_status_t switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event)
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
switch_core_flag_t switch_core_flags(void)
return core flags
const char * interface_name
void switch_dso_destroy(switch_dso_lib_t *lib)
const char * interface_name
switch_codec_type_t codec_type
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
uint32_t actual_samples_per_second
Abstract interface to a management module.
switch_hash_t * application_hash
switch_chat_interface_t * chat_interface
#define SWITCH_THREAD_STACKSIZE
switch_speech_interface_t * speech_interface
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
struct switch_api_interface * next
switch_file_interface_t * switch_loadable_module_get_file_interface(const char *name, const char *modname)
Retrieve the file format interface by it's registered name.
static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t *old_module)
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
const char * interface_name
const char * interface_name
const char * interface_name
Top level module interface to implement a series of codec implementations.
switch_endpoint_interface_t * endpoint_interface
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
switch_status_t switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
int switch_loadable_module_get_codecs(const switch_codec_implementation_t **array, int arraylen)
Retrieve the list of loaded codecs into an array.
switch_status_t switch_loadable_module_exists(const char *mod)
Check if a module is loaded.
void switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val)
Gets the key and value of the current hash element.
switch_module_interface_name_t
struct switch_codec_interface * next
struct switch_chat_interface * next
switch_hash_index_t * switch_core_hash_next(_In_ switch_hash_index_t **hi)
Gets the next element of a hashtable.
uint32_t switch_default_ptime(const char *name, uint32_t number)
char * switch_say_file_handle_detach_path(switch_say_file_handle_t *sh)
switch_status_t switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool)
struct switch_chat_application_interface * next
struct switch_codec_node_s * next
void switch_cond_next(void)
switch_queue_t * msg_queue[CHAT_MAX_MSG_QUEUE]
switch_module_runtime_t runtime
#define SWITCH_STANDARD_STREAM(s)
int microseconds_per_packet
int(* switch_modulename_callback_func_t)(void *user_data, const char *module_name)
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
switch_thread_rwlock_t * rwlock
switch_dso_lib_t switch_dso_open(const char *path, int global, char **err)
void * objs[SWITCH_MAX_CORE_THREAD_SESSION_OBJS]
switch_file_interface_t * file_interface
void * switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key)
Delete data from a hash based on desired key.
switch_application_interface_t * application_interface
const char * switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
switch_codec_interface_t * switch_loadable_module_get_codec_interface(const char *name, const char *modname)
Retrieve the codec interface by it's registered name.
switch_directories SWITCH_GLOBAL_dirs
switch_limit_interface_t * limit_interface
switch_loadable_module_type_t type
#define switch_str_nil(s)
Make a null string a blank string instead.
switch_status_t switch_core_hash_insert_pointer(switch_hash_t *hash, const void *data)
Insert data into a hash with an auto-generated key based on the data pointer.
struct fspr_thread_mutex_t switch_mutex_t
switch_management_interface_t * management_interface
switch_status_t switch_loadable_module_load_module(const char *dir, const char *fname, switch_bool_t runtime, const char **err)
Load a module.
switch_thread_rwlock_t * rwlock
struct switch_database_node_s * next
switch_stream_handle_write_function_t write_function
uint8_t number_of_channels
uint32_t samples_per_second
switch_status_t
Common return values.
switch_chat_application_interface_t * switch_loadable_module_get_chat_application_interface(const char *name)
Retrieve the chat application interface by it's registered name.
const char *const const char *const path
#define switch_goto_status(_status, _label)
switch_loadable_module_interface_t * module_interface
switch_endpoint_interface_t * switch_loadable_module_get_endpoint_interface(const char *name)
Retrieve the endpoint interface by it's registered name.
switch_say_interface_t * switch_loadable_module_get_say_interface(const char *name)
Retrieve the say interface by it's registered name.
switch_xml_t switch_xml_open_cfg(_In_z_ const char *file_path, _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params)
open a config in the core registry
char * switch_say_file_handle_get_path(switch_say_file_handle_t *sh)
static switch_status_t do_chat_send(switch_event_t *message_event)
switch_hash_t * database_hash
switch_thread_rwlock_t * rwlock
struct switch_file_node_s * next
switch_thread_t * switch_core_launch_thread(void *(SWITCH_THREAD_FUNC *func)(switch_thread_t *, void *), void *obj, switch_memory_pool_t *pool)
Launch a thread.
switch_status_t switch_core_chat_send_args(const char *dest_proto, const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint, switch_bool_t blocking)
switch_loadable_module_interface_t * switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name)
switch_json_api_interface_t * json_api_interface
switch_payload_t ianacode
#define switch_core_hash_insert(_h, _k, _d)
switch_event_t * param_event
switch_hash_t * chat_hash
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
static switch_bool_t switch_is_file_path(const char *file)
int(* switch_core_recover_callback_t)(switch_core_session_t *session)
switch_status_t switch_core_register_secondary_recover_callback(const char *key, switch_core_recover_callback_t cb)
switch_hash_t * limit_hash
const char * interface_name
#define switch_event_get_header(_e, _h)
const char * interface_name
switch_xml_t switch_xml_child(_In_ switch_xml_t xml, _In_z_ const char *name)
returns the first child tag (one level deeper) with the given name or NULL \ if not found ...
static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thread, void *obj)
switch_status_t switch_loadable_module_enumerate_loaded(switch_modulename_callback_func_t callback, void *user_data)
Enumerates a list of all currently loaded modules.
static void do_swap(const switch_codec_implementation_t **array, int a, int b)
#define switch_set_string(_dst, _src)
switch_status_t switch_core_execute_chat_app(switch_event_t *message, const char *app, const char *data)
switch_status_t switch_queue_trypush(switch_queue_t *queue, void *data)
const char * interface_name
switch_hash_t * chat_application_hash
struct switch_say_interface * next
switch_thread_rwlock_t * rwlock
void switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
Hangup all sessions that belong to an endpoint.
switch_hash_t * directory_hash
struct switch_codec_implementation * next
static switch_status_t switch_loadable_module_process(char *key, switch_loadable_module_t *new_module, switch_hash_t *event_hash)
switch_module_runtime_t switch_module_runtime
switch_thread_rwlock_t * rwlock
switch_status_t switch_loadable_module_init(switch_bool_t autoload)
Initilize the module backend and load all the modules.
A generic object to pass as a thread's session object to allow mutiple arguements and a pool...
switch_status_t switch_queue_push(switch_queue_t *queue, void *data)
switch_status_t switch_core_chat_deliver(const char *dest_proto, switch_event_t **message_event)
void * switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
static void chat_thread_start(int idx)
struct switch_application_interface * next
void switch_cache_db_database_interface_flush_handles(switch_database_interface_t *database_interface)
switch_memory_pool_t * pool
switch_status_t switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool)
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
switch_module_shutdown_t shutdown
const char * interface_name
switch_status_t switch_thread_exit(switch_thread_t *thd, switch_status_t retval)
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.
const char * switch_stristr(const char *instr, const char *str)
#define SWITCH_CURRENT_APPLICATION_VARIABLE
switch_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
switch_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
A table of settings and callbacks that define a paticular implementation of a codec.
const char * interface_name
#define PROTECT_INTERFACE(_it)
A module interface to implement a json api function.
const switch_file_interface_t * ptr
void switch_say_file_handle_destroy(switch_say_file_handle_t **sh)
struct switch_limit_interface * next
struct fspr_pool_t switch_memory_pool_t
switch_api_interface_t * api_interface
switch_status_t switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout)
const char * interface_name
const char * interface_name
switch_status_t switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
void switch_core_set_signal_handlers(void)
void switch_event_destroy(switch_event_t **event)
Destroy an event.
switch_json_api_function_t function
static struct @6 chat_globals
int switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap)
switch_asr_interface_t * asr_interface
char * switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the pool ...
struct fspr_thread_t switch_thread_t
const char * switch_cut_path(const char *in)
Create a pointer to the file name in a given file path eliminating the directory name.
switch_say_interface_t * say_interface
switch_module_shutdown_t switch_module_shutdown
switch_chat_application_interface_t * chat_application_interface
struct fspr_thread_rwlock_t switch_thread_rwlock_t
struct switch_file_interface * next
Abstract interface to a database module.
#define switch_core_hash_first(_h)
switch_thread_rwlock_t * rwlock
SWITCH_BEGIN_EXTERN_C char * switch_mprintf(const char *zFormat,...)
uint32_t switch_default_rate(const char *name, uint32_t number)
switch_status_t switch_core_sqldb_init(const char **err)
switch_hash_t * management_hash
switch_hash_t * speech_hash
#define switch_core_hash_init_nocase(_hash)
static switch_status_t switch_loadable_module_load_module_ex(const char *dir, const char *fname, switch_bool_t runtime, switch_bool_t global, const char **err, switch_loadable_module_type_t type, switch_hash_t *event_hash)
The abstraction of a loadable module.
switch_thread_rwlock_t * chat_rwlock
const char * interface_name
static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy, const char **err)
const char * interface_name
void * switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname)
switch_hash_t * json_api_hash
Abstract interface to a directory module.
struct switch_asr_interface * next
switch_status_t switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
void switch_core_sqldb_destroy(void)
switch_status_t switch_dir_close(switch_dir_t *thedir)
switch_hash_t * dialplan_hash
struct switch_file_node_s switch_file_node_t