mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-08 20:43:51 +00:00
Merge branch 'master' into smgmaster
This commit is contained in:
commit
5f7ab903bb
307 files changed
+16815
-2494
No files matched your search
@@ -91,7 +91,10 @@
|
||||
#include <Ws2tcpip.h>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
/* work around for warnings in vs 2010 */
|
||||
#pragma warning (disable:6386)
|
||||
#include <Ws2tcpip.h>
|
||||
#pragma warning (default:6386)
|
||||
#endif
|
||||
#else
|
||||
#include <strings.h>
|
||||
|
||||
@@ -261,10 +261,17 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_
|
||||
#define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_export_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_export_variable_var_check(switch_channel_t *channel,
|
||||
const char *varname, const char *val,
|
||||
const char *export_varname,
|
||||
switch_bool_t var_check);
|
||||
|
||||
#define switch_channel_export_variable(_channel, _varname, _value) switch_channel_export_variable_var_check(_channel, _varname, _value, SWITCH_TRUE)
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
|
||||
SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel,
|
||||
switch_event_t *var_event, const char *export_varname);
|
||||
|
||||
#define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE)
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname,
|
||||
const char *export_varname, const char *fmt, ...);
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
@@ -1339,15 +1339,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer)
|
||||
\param pool the memory pool to use
|
||||
\return SWITCH_STATUS_SUCCESS if the handle is allocated
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec,
|
||||
#define switch_core_codec_init(_codec, _codec_name, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool) \
|
||||
switch_core_codec_init_with_bitrate(_codec, _codec_name, _fmtp, _rate, _ms, _channels, 0, _flags, _codec_settings, _pool)
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec,
|
||||
const char *codec_name,
|
||||
const char *fmtp,
|
||||
uint32_t rate,
|
||||
int ms,
|
||||
int channels,
|
||||
uint32_t bitrate,
|
||||
uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec);
|
||||
|
||||
/*!
|
||||
|
||||
@@ -292,7 +292,8 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
||||
SWITCH_DECLARE(int) transfer(char *extension, char *dialplan = NULL, char *context = NULL);
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators);
|
||||
SWITCH_DECLARE(char *) read(int min_digits, int max_digits,
|
||||
const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout = 0);
|
||||
|
||||
/** \brief Play a file into channel and collect dtmfs
|
||||
*
|
||||
@@ -306,7 +307,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
||||
int max_digits,
|
||||
int max_tries,
|
||||
int timeout, char *terminators, char *audio_files, char *bad_input_audio_files,
|
||||
char *digits_regex, const char *var_name = NULL);
|
||||
char *digits_regex, const char *var_name = NULL, int digit_timeout = 0);
|
||||
|
||||
/** \brief Play a file that resides on disk into the channel
|
||||
*
|
||||
|
||||
@@ -369,7 +369,8 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
||||
const char *audio_file,
|
||||
const char *bad_input_audio_file,
|
||||
const char *var_name, char *digit_buffer, uint32_t digit_buffer_length,
|
||||
const char *digits_regex);
|
||||
const char *digits_regex,
|
||||
uint32_t digit_timeout);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
|
||||
switch_speech_handle_t *sh,
|
||||
@@ -804,7 +805,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
||||
uint32_t max_digits,
|
||||
const char *prompt_audio_file,
|
||||
const char *var_name,
|
||||
char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
|
||||
char *digit_buffer,
|
||||
switch_size_t digit_buffer_length,
|
||||
uint32_t timeout,
|
||||
const char *valid_terminators,
|
||||
uint32_t digit_timeout);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_block_dtmf_session(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unblock_dtmf_session(switch_core_session_t *session);
|
||||
@@ -836,6 +842,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *ses
|
||||
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
|
||||
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
|
||||
switch_memory_pool_t *pool,
|
||||
uint32_t digit_timeout, uint32_t input_timeout);
|
||||
|
||||
SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine,
|
||||
const char *digits,
|
||||
int32_t key,
|
||||
switch_ivr_dmachine_callback_t callback,
|
||||
void *user_data);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *dmachine, const char *digits, switch_ivr_dmachine_match_t **match);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p);
|
||||
SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine);
|
||||
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
@@ -570,42 +570,23 @@ struct switch_directory_handle {
|
||||
void *private_info;
|
||||
};
|
||||
|
||||
|
||||
/* nobody has more setting than speex so we will let them set the standard */
|
||||
/*! \brief Various codec settings (currently only relevant to speex) */
|
||||
struct switch_codec_settings {
|
||||
/*! desired quality */
|
||||
int quality;
|
||||
/*! desired complexity */
|
||||
int complexity;
|
||||
/*! desired enhancement */
|
||||
int enhancement;
|
||||
/*! desired vad level */
|
||||
int vad;
|
||||
/*! desired vbr level */
|
||||
int vbr;
|
||||
/*! desired vbr quality */
|
||||
float vbr_quality;
|
||||
/*! desired abr level */
|
||||
int abr;
|
||||
/*! desired dtx setting */
|
||||
int dtx;
|
||||
/*! desired preprocessor settings */
|
||||
int preproc;
|
||||
/*! preprocessor vad settings */
|
||||
int pp_vad;
|
||||
/*! preprocessor gain control settings */
|
||||
int pp_agc;
|
||||
/*! preprocessor gain level */
|
||||
float pp_agc_level;
|
||||
/*! preprocessor denoise level */
|
||||
int pp_denoise;
|
||||
/*! preprocessor dereverb settings */
|
||||
int pp_dereverb;
|
||||
/*! preprocessor dereverb decay level */
|
||||
float pp_dereverb_decay;
|
||||
/*! preprocessor dereverb level */
|
||||
float pp_dereverb_level;
|
||||
int unused;
|
||||
};
|
||||
|
||||
/*! an abstract handle of a fmtp parsed by codec */
|
||||
struct switch_codec_fmtp {
|
||||
/*! actual samples transferred per second for those who are not moron g722 RFC writers */
|
||||
uint32_t actual_samples_per_second;
|
||||
/*! bits transferred per second */
|
||||
int bits_per_second;
|
||||
/*! number of microseconds of media in one packet (ptime * 1000) */
|
||||
int microseconds_per_packet;
|
||||
/*! private data for the codec module to store handle specific info */
|
||||
void *private_info;
|
||||
|
||||
};
|
||||
|
||||
/*! an abstract handle to a codec module */
|
||||
@@ -618,8 +599,6 @@ struct switch_codec {
|
||||
char *fmtp_in;
|
||||
/*! fmtp line for local sdp */
|
||||
char *fmtp_out;
|
||||
/*! codec settings for this handle */
|
||||
switch_codec_settings_t codec_settings;
|
||||
/*! flags to modify behaviour */
|
||||
uint32_t flags;
|
||||
/*! the handle's memory pool */
|
||||
@@ -678,6 +657,8 @@ struct switch_codec_interface {
|
||||
const char *interface_name;
|
||||
/*! a list of codec implementations related to the codec */
|
||||
switch_codec_implementation_t *implementations;
|
||||
/*! function to decode a codec fmtp parameters */
|
||||
switch_core_codec_fmtp_parse_func_t parse_fmtp;
|
||||
uint32_t codec_id;
|
||||
switch_thread_rwlock_t *rwlock;
|
||||
int refs;
|
||||
|
||||
@@ -449,6 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_
|
||||
SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs);
|
||||
|
||||
SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_session);
|
||||
|
||||
/*!
|
||||
\}
|
||||
|
||||
@@ -156,6 +156,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition"
|
||||
#define SWITCH_HOLD_MUSIC_VARIABLE "hold_music"
|
||||
#define SWITCH_EXPORT_VARS_VARIABLE "export_vars"
|
||||
#define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars"
|
||||
#define SWITCH_R_SDP_VARIABLE "switch_r_sdp"
|
||||
#define SWITCH_L_SDP_VARIABLE "switch_l_sdp"
|
||||
#define SWITCH_B_SDP_VARIABLE "switch_m_sdp"
|
||||
@@ -770,9 +771,9 @@ typedef struct {
|
||||
const char *T38FaxUdpEC;
|
||||
const char *T38VendorInfo;
|
||||
const char *remote_ip;
|
||||
uint32_t remote_port;
|
||||
uint16_t remote_port;
|
||||
const char *local_ip;
|
||||
uint32_t local_port;
|
||||
uint16_t local_port;
|
||||
} switch_t38_options_t;
|
||||
|
||||
/*!
|
||||
@@ -832,6 +833,7 @@ typedef enum {
|
||||
SWITCH_STATUS_NOUNLOAD,
|
||||
SWITCH_STATUS_IGNORE,
|
||||
SWITCH_STATUS_TOO_SMALL,
|
||||
SWITCH_STATUS_FOUND,
|
||||
SWITCH_STATUS_NOT_INITALIZED
|
||||
} switch_status_t;
|
||||
|
||||
@@ -1588,6 +1590,7 @@ typedef struct switch_core_thread_session switch_core_thread_session_t;
|
||||
typedef struct switch_codec_implementation switch_codec_implementation_t;
|
||||
typedef struct switch_buffer switch_buffer_t;
|
||||
typedef struct switch_codec_settings switch_codec_settings_t;
|
||||
typedef struct switch_codec_fmtp switch_codec_fmtp_t;
|
||||
typedef struct switch_odbc_handle switch_odbc_handle_t;
|
||||
|
||||
typedef struct switch_io_routines switch_io_routines_t;
|
||||
@@ -1646,6 +1649,7 @@ typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *code
|
||||
void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings);
|
||||
typedef switch_status_t (*switch_core_codec_fmtp_parse_func_t) (const char *fmtp, switch_codec_fmtp_t *codec_fmtp);
|
||||
typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *);
|
||||
|
||||
|
||||
@@ -1681,12 +1685,27 @@ typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session
|
||||
switch_input_type_t input_type, void *buf, unsigned int buflen);
|
||||
typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data);
|
||||
typedef struct switch_say_interface switch_say_interface_t;
|
||||
|
||||
struct switch_ivr_dmachine;
|
||||
typedef struct switch_ivr_dmachine switch_ivr_dmachine_t;
|
||||
|
||||
struct switch_ivr_dmachine_match {
|
||||
switch_ivr_dmachine_t *dmachine;
|
||||
const char *match_digits;
|
||||
int32_t match_key;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
typedef struct switch_ivr_dmachine_match switch_ivr_dmachine_match_t;
|
||||
typedef switch_status_t (*switch_ivr_dmachine_callback_t) (switch_ivr_dmachine_match_t *match);
|
||||
|
||||
typedef struct {
|
||||
switch_input_callback_function_t input_callback;
|
||||
void *buf;
|
||||
uint32_t buflen;
|
||||
switch_read_frame_callback_function_t read_frame_callback;
|
||||
void *user_data;
|
||||
switch_ivr_dmachine_t *dmachine;
|
||||
} switch_input_args_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -1714,7 +1733,7 @@ struct switch_network_list;
|
||||
typedef struct switch_network_list switch_network_list_t;
|
||||
|
||||
|
||||
#define SWITCH_API_VERSION 4
|
||||
#define SWITCH_API_VERSION 5
|
||||
#define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
|
||||
#define SWITCH_MODULE_RUNTIME_ARGS (void)
|
||||
#define SWITCH_MODULE_SHUTDOWN_ARGS (void)
|
||||
|
||||
@@ -139,6 +139,9 @@ static inline char *switch_strchr_strict(const char *in, char find, const char *
|
||||
#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:6011)
|
||||
#endif
|
||||
static inline int switch_string_has_escaped_data(const char *in)
|
||||
{
|
||||
const char *i = strchr(in, '\\');
|
||||
@@ -153,6 +156,9 @@ static inline int switch_string_has_escaped_data(const char *in)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:6011)
|
||||
#endif
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
|
||||
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
|
||||
@@ -171,6 +177,23 @@ static inline switch_bool_t switch_is_digit_string(const char *s)
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32_t switch_known_bitrate(switch_payload_t payload)
|
||||
{
|
||||
switch(payload) {
|
||||
case 0: /* PCMU */ return 64000;
|
||||
case 3: /* GSM */ return 13200;
|
||||
case 4: /* G723 */ return 6300;
|
||||
case 7: /* LPC */ return 2400;
|
||||
case 8: /* PCMA */ return 64000;
|
||||
case 9: /* G722 */ return 64000;
|
||||
case 18: /* G729 */ return 8000;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len);
|
||||
|
||||
|
||||
@@ -353,7 +376,16 @@ switch_mutex_unlock(obj->flag_mutex);
|
||||
#define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
|
||||
|
||||
|
||||
static inline char *switch_sanitize_number(char *number)
|
||||
static inline uint32_t switch_default_ptime(const char *name, uint32_t number)
|
||||
{
|
||||
if (!strcasecmp(name, "G723")) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
return 20;
|
||||
}
|
||||
|
||||
static inline char *switch_sanitize_number(char *number)
|
||||
{
|
||||
char *p = number, *q;
|
||||
char warp[] = "/:";
|
||||
@@ -455,6 +487,9 @@ static inline char *switch_safe_strdup(const char *it)
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:6011)
|
||||
#endif
|
||||
static inline char *switch_lc_strdup(const char *it)
|
||||
{
|
||||
char *dup;
|
||||
@@ -487,6 +522,9 @@ static inline char *switch_uc_strdup(const char *it)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:6011)
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
Reference in new issue
Block a user