Merge remote branch 'fsorig/master'

Conflicts:
	src/mod/applications/mod_commands/mod_commands.c
	src/mod/endpoints/mod_portaudio/mod_portaudio.c
	src/mod/endpoints/mod_portaudio/pablio.c
This commit is contained in:
System Administrator
2011-05-26 00:13:12 -04:00
671 changed files with 140614 additions and 18658 deletions
+4
View File
@@ -240,6 +240,7 @@ struct switch_runtime {
uint32_t debug_level;
uint32_t runlevel;
uint32_t tipping_point;
uint32_t microseconds_per_tick;
int32_t timer_affinity;
switch_profile_timer_t *profile_timer;
double profile_time;
@@ -248,9 +249,12 @@ struct switch_runtime {
int max_sql_buffer_len;
switch_dbtype_t odbc_dbtype;
char hostname[256];
char *switchname;
int multiple_registrations;
uint32_t max_db_handles;
uint32_t db_handle_timeout;
int curl_count;
int ssl_count;
};
extern struct switch_runtime runtime;
+5
View File
@@ -150,6 +150,7 @@
*
* - Linux (x86 & x86_64)
* - Windows (MSVC 2008 & VC++ EE 2008)
* - Windows (MSVC 2010 & VC++ EE 2010)
* - Mac OS X (intel & ppc )
* - FreeBSD 6
*
@@ -176,6 +177,10 @@
* mod_pocketsphinx
* - PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/)
*
* mod_unimrcp
* - MRCP (http://www.unimrcp.org/)
*
*
* Codecs
* mod_speex
* - libspeex (http://www.speex.org/)
+62
View File
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Eliot Gable <egable@gmail.com>
*
* switch_apr.h -- APR includes header
*
@@ -144,6 +145,8 @@ SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len)
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap);
SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap);
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
@@ -410,6 +413,65 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock);
/** @} */
/**
* @defgroup switch_atomic Multi-Threaded Adtomic Operations Routines
* @ingroup switch_apr
* @{
*/
/** Opaque type used for the atomic operations */
#ifdef apr_atomic_t
typedef apr_atomic_t switch_atomic_t;
#else
typedef uint32_t switch_atomic_t;
#endif
/**
* Some architectures require atomic operations internal structures to be
* initialized before use.
* @param pool The memory pool to use when initializing the structures.
*/
SWITCH_DECLARE(switch_status_t) switch_atomic_init(switch_memory_pool_t *pool);
/**
* Uses an atomic operation to read the uint32 value at the location specified
* by mem.
* @param mem The location of memory which stores the value to read.
*/
SWITCH_DECLARE(uint32_t) switch_atomic_read(volatile switch_atomic_t *mem);
/**
* Uses an atomic operation to set a uint32 value at a specified location of
* memory.
* @param mem The location of memory to set.
* @param val The uint32 value to set at the memory location.
*/
SWITCH_DECLARE(void) switch_atomic_set(volatile switch_atomic_t *mem, uint32_t val);
/**
* Uses an atomic operation to add the uint32 value to the value at the
* specified location of memory.
* @param mem The location of the value to add to.
* @param val The uint32 value to add to the value at the memory location.
*/
SWITCH_DECLARE(void) switch_atomic_add(volatile switch_atomic_t *mem, uint32_t val);
/**
* Uses an atomic operation to increment the value at the specified memroy
* location.
* @param mem The location of the value to increment.
*/
SWITCH_DECLARE(void) switch_atomic_inc(volatile switch_atomic_t *mem);
/**
* Uses an atomic operation to decrement the value at the specified memroy
* location.
* @param mem The location of the value to decrement.
*/
SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem);
/** @} */
/**
* @defgroup switch_thread_rwlock Thread Read/Write lock Routines
* @ingroup switch_apr
+10
View File
@@ -56,6 +56,15 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C
typedef struct profile_node_s {
char *var;
char *val;
struct profile_node_s *next;
} profile_node_t;
/*! \brief Call Specific Data
*/
struct switch_caller_profile {
@@ -110,6 +119,7 @@ SWITCH_BEGIN_EXTERN_C
switch_memory_pool_t *pool;
struct switch_caller_profile *next;
switch_call_direction_t direction;
profile_node_t *soft;
};
/*! \brief An Abstract Representation of a dialplan Application */
+10 -3
View File
@@ -49,6 +49,7 @@ SWITCH_BEGIN_EXTERN_C struct switch_channel_timetable {
switch_time_t hungup;
switch_time_t transferred;
switch_time_t resurrected;
switch_time_t bridged;
struct switch_channel_timetable *next;
};
@@ -250,6 +251,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check);
SWITCH_DECLARE(switch_status_t) switch_channel_add_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack);
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt, ...);
@@ -283,8 +286,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_cha
\param varname the name of the variable
\return the value of the requested variable
*/
SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup);
#define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE)
SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx);
#define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1)
SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event);
@@ -315,6 +318,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
*/
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel);
SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in);
/*!
@@ -596,7 +600,7 @@ SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_cha
#define switch_channel_clear_app_flag(_c, _f) switch_channel_clear_app_flag_key(__FILE__, _c, _f)
#define switch_channel_test_app_flag(_c, _f) switch_channel_test_app_flag_key(__FILE__, _c, _f)
SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel);
SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel);
SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel);
SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel);
@@ -614,6 +618,9 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_
/** @} */
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
+18 -1
View File
@@ -57,6 +57,7 @@ SWITCH_BEGIN_EXTERN_C
struct switch_app_log {
char *app;
char *arg;
switch_time_t stamp;
struct switch_app_log *next;
};
@@ -434,6 +435,9 @@ SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *se
*/
SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handler_table_t *state_handler);
SWITCH_DECLARE(int) switch_core_curl_count(int *val);
SWITCH_DECLARE(int) switch_core_ssl_count(int *val);
/*!
\brief Remove a global state handler
\param state_handler the state handler to remove
@@ -762,6 +766,7 @@ SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname);
SWITCH_DECLARE(char *) switch_core_get_variable_dup(_In_z_ const char *varname);
SWITCH_DECLARE(char *) switch_core_get_variable_pdup(_In_z_ const char *varname, switch_memory_pool_t *pool);
SWITCH_DECLARE(const char *) switch_core_get_hostname(void);
SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
/*!
\brief Add a global variable to the core
@@ -1183,7 +1188,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(_In_ switch_core_s
///\ingroup core1
///\{
/*!
\brief Initilize a hash table
\brief Initialize a hash table
\param hash a NULL pointer to a hash table to aim at the new hash
\param pool the pool to use for the new hash
\return SWITCH_STATUS_SUCCESS if the hash is created
@@ -1940,6 +1945,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_management_exec(char *relative_oid,
\return 0 on success
*/
SWITCH_DECLARE(int32_t) set_high_priority(void);
SWITCH_DECLARE(int32_t) set_normal_priority(void);
/*!
\brief Change user and/or group of the running process
@@ -2050,6 +2056,7 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload);
SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token);
#define switch_check_network_list_ip(_ip_str, _list_name) switch_check_network_list_ip_token(_ip_str, _list_name, NULL)
SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable);
SWITCH_DECLARE(void) switch_time_set_timerfd(switch_bool_t enable);
SWITCH_DECLARE(void) switch_time_set_nanosleep(switch_bool_t enable);
SWITCH_DECLARE(void) switch_time_set_matrix(switch_bool_t enable);
SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable);
@@ -2203,6 +2210,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries);
SWITCH_DECLARE(void) switch_core_set_signal_handlers(void);
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
SWITCH_DECLARE(const char *) switch_core_banner(void);
@@ -2238,6 +2246,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c
*/
SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force);
SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var);
SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh);
SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh);
SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh);
SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event);
SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
+74
View File
@@ -0,0 +1,74 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* switch_curl.h
*
*/
#ifndef __SWITCH_CURL_H
#define __SWITCH_CURL_H
#include <curl/curl.h>
#include <switch_ssl.h>
static inline void switch_curl_init(void)
{
int curl_count = switch_core_curl_count(NULL);
if (curl_count == 0) {
curl_global_init(CURL_GLOBAL_ALL);
}
curl_count++;
switch_core_curl_count(&curl_count);
}
static inline void switch_curl_destroy()
{
int curl_count = switch_core_curl_count(NULL);
curl_count--;
if (curl_count == 0) {
curl_global_cleanup();
}
switch_core_curl_count(&curl_count);
}
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
+11 -3
View File
@@ -67,6 +67,10 @@ SWITCH_BEGIN_EXTERN_C
char *name;
/*! the header value */
char *value;
/*! array space */
char **array;
/*! array index */
int idx;
/*! hash of the header name */
unsigned long hash;
struct switch_event_header *next;
@@ -99,7 +103,8 @@ struct switch_event {
};
typedef enum {
EF_UNIQ_HEADERS = (1 << 0)
EF_UNIQ_HEADERS = (1 << 0),
EF_CONTAINS_ARRAYS = (1 << 1),
} switch_event_flag_t;
@@ -146,7 +151,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_set_priority(switch_event_t *event,
\param header_name the name of the header to read
\return the value of the requested header
*/
_Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, const char *header_name);
_Ret_opt_z_ SWITCH_DECLARE(switch_event_header_t *) switch_event_get_header_ptr(switch_event_t *event, const char *header_name);
_Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx);
#define switch_event_get_header(_e, _h) switch_event_get_header_idx(_e, _h, -1)
#define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
@@ -285,7 +293,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *
SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode);
SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str);
SWITCH_DECLARE(switch_status_t) switch_event_create_json(switch_event_t **event, const char *json);
SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data);
SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup);
#ifndef SWIG
/*!
+10
View File
@@ -865,6 +865,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
const char *say_gender,
switch_input_args_t *args);
SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *session,
const char *lang,
const char *ext,
const char *tosay,
const char *module_name,
const char *say_type,
const char *say_method,
const char *say_gender,
char **rstr);
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name);
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
+3 -22
View File
@@ -103,29 +103,9 @@ struct switch_stream_handle {
};
struct switch_io_event_hooks;
struct switch_say_file_handle;
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t,
switch_call_cause_t *);
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -490,6 +470,7 @@ struct switch_say_interface {
const char *interface_name;
/*! function to pass down to the module */
switch_say_callback_t say_function;
switch_say_string_callback_t say_string_function;
switch_thread_rwlock_t *rwlock;
int refs;
switch_mutex_t *reflock;
+6 -1
View File
@@ -56,7 +56,7 @@ SWITCH_DECLARE(const char *) switch_nat_get_type(void);
\param pool the memory pool to use for long term allocations
\note Generally called by the core_init
*/
SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool);
SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping);
/*!
\brief Initilize the rest of the NAT Traversal System
@@ -86,6 +86,11 @@ SWITCH_DECLARE(void) switch_nat_republish(void);
*/
SWITCH_DECLARE(void) switch_nat_reinit(void);
/*!
\brief Update the setting if port mapping will be created
*/
SWITCH_DECLARE(void) switch_nat_set_mapping(switch_bool_t mapping);
/*!
\brief Maps a port through the NAT Traversal System
\param port Internal port to map
+4 -4
View File
@@ -223,15 +223,15 @@ typedef intptr_t switch_ssize_t;
#ifdef WIN32
#ifdef WIN64
#define SWITCH_SSIZE_T_FMT "I64d"
#define SWITCH_SIZE_T_FMT "I64d"
#define SWITCH_SSIZE_T_FMT "lld"
#define SWITCH_SIZE_T_FMT "lld"
#else
#define SWITCH_SSIZE_T_FMT "d"
#define SWITCH_SIZE_T_FMT "d"
#endif
#define SWITCH_INT64_T_FMT "I64d"
#define SWITCH_UINT64_T_FMT "I64u"
#define SWITCH_INT64_T_FMT "lld"
#define SWITCH_UINT64_T_FMT "llu"
#ifndef TIME_T_FMT
#define TIME_T_FMT SWITCH_INT64_T_FMT
+4
View File
@@ -70,6 +70,10 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(const char *target, const cha
*/
SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial_match);
SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data,
int *ovector, const char *var, switch_cap_callback_t callback, void *user_data);
SWITCH_DECLARE(void) switch_regex_set_var_callback(const char *var, const char *val, void *user_data);
#define switch_regex_safe_free(re) if (re) {\
switch_regex_free(re);\
+109
View File
@@ -0,0 +1,109 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* switch_ssl.h
*
*/
#ifndef __SWITCH_SSL_H
#define __SWITCH_SSL_H
#if defined(HAVE_OPENSSL)
#include <openssl/crypto.h>
static switch_mutex_t **ssl_mutexes;
static switch_memory_pool_t *ssl_pool = NULL;
static inline void switch_ssl_ssl_lock_callback(int mode, int type, char *file, int line)
{
if (mode & CRYPTO_LOCK) {
switch_mutex_lock(ssl_mutexes[type]);
}
else {
switch_mutex_unlock(ssl_mutexes[type]);
}
}
static inline unsigned long switch_ssl_ssl_thread_id(void)
{
return (unsigned long) switch_thread_self();
}
static inline void switch_ssl_init_ssl_locks(void)
{
int ssl_count = switch_core_ssl_count(NULL);
int i, num;
if (ssl_count == 0) {
num = CRYPTO_num_locks();
ssl_mutexes = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(switch_mutex_t*));
switch_assert(ssl_mutexes != NULL);
switch_core_new_memory_pool(&ssl_pool);
for (i = 0; i < num; i++) {
switch_mutex_init(&(ssl_mutexes[i]), SWITCH_MUTEX_NESTED, ssl_pool);
switch_assert(ssl_mutexes[i] != NULL);
}
CRYPTO_set_id_callback(switch_ssl_ssl_thread_id);
CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))switch_ssl_ssl_lock_callback);
}
ssl_count++;
switch_core_ssl_count(&ssl_count);
}
static inline void switch_ssl_destroy_ssl_locks()
{
int i;
int ssl_count = switch_core_ssl_count(NULL);
ssl_count--;
if (ssl_count == 0) {
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < CRYPTO_num_locks(); i++) {
if (ssl_mutexes[i]) {
switch_mutex_destroy(ssl_mutexes[i]);
}
}
OPENSSL_free(ssl_mutexes);
}
switch_core_ssl_count(&ssl_count);
}
#else
static inline void switch_ssl_init_ssl_locks(void) { return; }
static inline void switch_ssl_destroy_ssl_locks(void) { return; }
#endif
#endif
+30 -7
View File
@@ -36,6 +36,7 @@
#define SWITCH_TYPES_H
#include <switch.h>
SWITCH_BEGIN_EXTERN_C
#define SWITCH_ENT_ORIGINATE_DELIM ":_:"
#define SWITCH_BLANK_STRING ""
@@ -135,6 +136,7 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media"
#define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer"
#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect"
#define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
#define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid"
@@ -264,7 +266,8 @@ typedef enum {
SCF_VERBOSE_EVENTS = (1 << 11),
SCF_USE_WIN32_MONOTONIC = (1 << 12),
SCF_AUTO_SCHEMAS = (1 << 13),
SCF_MINIMAL = (1 << 14)
SCF_MINIMAL = (1 << 14),
SCF_USE_NAT_MAPPING = (1 << 15)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
@@ -486,6 +489,7 @@ typedef struct {
switch_size_t dtmf_packet_count;
switch_size_t cng_packet_count;
switch_size_t flush_packet_count;
switch_size_t largest_jb_size;
} switch_rtp_numbers_t;
@@ -515,7 +519,6 @@ typedef enum {
SWITCH_RTP_FLAG_NOBLOCK - Do not block
SWITCH_RTP_FLAG_IO - IO is ready
SWITCH_RTP_FLAG_USE_TIMER - Timeout Reads and replace with a CNG Frame
SWITCH_RTP_FLAG_TIMER_RECLOCK - Resync the timer to the current clock on slips
SWITCH_RTP_FLAG_SECURE - Secure RTP
SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source
SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed
@@ -532,7 +535,7 @@ typedef enum {
SWITCH_RTP_FLAG_NOBLOCK = (1 << 0),
SWITCH_RTP_FLAG_IO = (1 << 1),
SWITCH_RTP_FLAG_USE_TIMER = (1 << 2),
SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3),
SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 3),
SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4),
SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5),
SWITCH_RTP_FLAG_AUTOADJ = (1 << 6),
@@ -542,7 +545,7 @@ typedef enum {
SWITCH_RTP_FLAG_BREAK = (1 << 10),
SWITCH_RTP_FLAG_UDPTL = (1 << 11),
SWITCH_RTP_FLAG_DATAWAIT = (1 << 12),
SWITCH_RTP_FLAG_BUGGY_2833 = (1 << 13),
SWITCH_RTP_FLAG_BYTESWAP = (1 << 13),
SWITCH_RTP_FLAG_PASS_RFC2833 = (1 << 14),
SWITCH_RTP_FLAG_AUTO_CNG = (1 << 15),
SWITCH_RTP_FLAG_SECURE_SEND_RESET = (1 << 16),
@@ -559,8 +562,7 @@ typedef enum {
SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27),
SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28),
SWITCH_RTP_FLAG_VIDEO = (1 << 29),
SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30),
SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 31)
SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30)
/* don't add any more 31 is the limit! gotta chnge to an array to add more */
} switch_rtp_flag_enum_t;
typedef uint32_t switch_rtp_flag_t;
@@ -828,7 +830,9 @@ SWITCH_STACK_TOP - Stack on the top
typedef enum {
SWITCH_STACK_BOTTOM = (1 << 0),
SWITCH_STACK_TOP = (1 << 1),
SWITCH_STACK_NODUP = (1 << 2)
SWITCH_STACK_NODUP = (1 << 2),
SWITCH_STACK_UNSHIFT = (1 << 3),
SWITCH_STACK_PUSH = (1 << 4),
} switch_stack_t;
/*!
@@ -1107,6 +1111,8 @@ typedef enum {
CF_DIALPLAN,
CF_BLOCK_BROADCAST_UNTIL_MEDIA,
CF_CNG_PLC,
CF_ATTENDED_TRANSFER,
CF_LAZY_ATTENDED_TRANSFER,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
CF_FLAG_MAX
} switch_channel_flag_t;
@@ -1684,6 +1690,7 @@ struct switch_console_callback_match {
};
typedef struct switch_console_callback_match switch_console_callback_match_t;
typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
@@ -1735,6 +1742,7 @@ typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_str
typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session,
_In_ switch_stream_handle_t *stream);
#define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input,
@@ -1772,17 +1780,32 @@ typedef struct {
switch_ivr_dmachine_t *dmachine;
} switch_input_args_t;
typedef struct {
switch_say_type_t type;
switch_say_method_t method;
switch_say_gender_t gender;
const char *ext;
} switch_say_args_t;
typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session,
char *tosay,
switch_say_args_t *say_args,
switch_input_args_t *args);
typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session,
char *tosay,
switch_say_args_t *say_args, char **rstr);
struct switch_say_file_handle;
typedef struct switch_say_file_handle switch_say_file_handle_t;
typedef switch_status_t (*switch_new_say_callback_t) (switch_say_file_handle_t *sh,
char *tosay,
switch_say_args_t *say_args);
typedef struct switch_xml *switch_xml_t;
typedef struct switch_core_time_duration switch_core_time_duration_t;
typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
+47 -21
View File
@@ -151,7 +151,11 @@ static inline char *switch_strchr_strict(const char *in, char find, const char *
#endif
static inline int switch_string_has_escaped_data(const char *in)
{
const char *i = strchr(in, '\\');
const char *i;
switch_assert(in);
i = strchr(in, '\\');
while (i && *i == '\\') {
i++;
@@ -235,20 +239,23 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size
SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size);
SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
/*!
\brief Evaluate the truthfullness of a string expression
\param expr a string expression
\return true or false
*/
#define switch_true(expr)\
((expr && ( !strcasecmp(expr, "yes") ||\
!strcasecmp(expr, "on") ||\
!strcasecmp(expr, "true") ||\
!strcasecmp(expr, "enabled") ||\
!strcasecmp(expr, "active") ||\
!strcasecmp(expr, "allow") ||\
(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
static inline int switch_true(const char *expr)
{
return ((expr && ( !strcasecmp(expr, "yes") ||
!strcasecmp(expr, "on") ||
!strcasecmp(expr, "true") ||
!strcasecmp(expr, "enabled") ||
!strcasecmp(expr, "active") ||
!strcasecmp(expr, "allow") ||
(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE);
}
#define switch_true_buf(expr)\
((( !strcasecmp(expr, "yes") ||\
@@ -264,14 +271,16 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
\param expr a string expression
\return true or false
*/
#define switch_false(expr)\
((expr && ( !strcasecmp(expr, "no") ||\
!strcasecmp(expr, "off") ||\
!strcasecmp(expr, "false") ||\
!strcasecmp(expr, "disabled") ||\
!strcasecmp(expr, "inactive") ||\
!strcasecmp(expr, "disallow") ||\
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE)
static inline int switch_false(const char *expr)
{
return ((expr && ( !strcasecmp(expr, "no") ||
!strcasecmp(expr, "off") ||
!strcasecmp(expr, "false") ||
!strcasecmp(expr, "disabled") ||
!strcasecmp(expr, "inactive") ||
!strcasecmp(expr, "disallow") ||
(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE);
}
SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf, size_t buflen);
@@ -496,6 +505,23 @@ static inline char *switch_clean_string(char *s)
}
static inline char *switch_clean_name_string(char *s)
{
char *p;
for (p = s; p && *p; p++) {
uint8_t x = (uint8_t) * p;
if ((x < 32) || x == '\'' || x == '"' || x == '<' || x == '>' || x == '\\' || x == ':' || x == '@' || x == '/') {
*p = ' ';
}
if ( (p == s) && (*p == ' ') ) {
s++;
}
}
return s;
}
/*!
\brief Free a pointer and set it to NULL unless it already is NULL
@@ -631,7 +657,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
#define switch_time_from_sec(sec) ((switch_time_t)(sec) * 1000000)
/*!
\brief Declares a function designed to set a dymaic global string
\brief Declares a function designed to set a dynamic global string
\param fname the function name to declare
\param vname the name of the global pointer to modify with the new function
*/
@@ -639,9 +665,9 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
if (vname) {free(vname); vname = NULL;}vname = strdup(string);} static void fname(const char *string)
/*!
\brief Separate a string into an array based on a character delimeter
\brief Separate a string into an array based on a character delimiter
\param buf the string to parse
\param delim the character delimeter
\param delim the character delimiter
\param array the array to split the values into
\param arraylen the max number of elements in the array
\return the number of elements added to the array
@@ -649,7 +675,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in);
SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen);
SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup);
SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str);
SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len);
+4 -1
View File
@@ -98,6 +98,7 @@ struct switch_xml {
uint32_t flags;
/*! is_switch_xml_root bool */
switch_bool_t is_switch_xml_root_t;
uint32_t refs;
};
/*!
@@ -377,7 +378,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const ch
SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, const char *user_name, const char *domain_name,
const char *ip, switch_xml_t *user, switch_event_t *params);
SWITCH_DECLARE(uint32_t) switch_xml_clear_user_cache(const char *key, const char *user_name, const char *domain_name);
SWITCH_DECLARE(void) switch_xml_merge_user(switch_xml_t user, switch_xml_t domain, switch_xml_t group);
SWITCH_DECLARE(switch_xml_t) switch_xml_dup(switch_xml_t xml);
@@ -416,6 +417,8 @@ SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_
SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond);
SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language);
SWITCH_END_EXTERN_C
///\}
#endif // _SWITCH_XML_H