mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
indent pass 1
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8686 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+467
-530
File diff suppressed because it is too large
Load Diff
+165
-206
@@ -50,137 +50,108 @@ extern "C" {
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
/*! \brief Find the bit position of the highest set bit in a word
|
||||
\param bits The word to be searched
|
||||
\return The bit number of the highest set bit, or -1 if the word is zero. */
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
static __inline__ int top_bit(unsigned int bits) {
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
||||
" bsrl %%eax,%%edx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n" " bsrl %%eax,%%edx;\n":"=d"(res)
|
||||
:"a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*//*! \brief Find the bit position of the lowest set bit in a word
|
||||
\param bits The word to be searched
|
||||
\return The bit number of the lowest set bit, or -1 if the word is zero. */ static __inline__ int bottom_bit(unsigned int bits) {
|
||||
int res;
|
||||
|
||||
/*! \brief Find the bit position of the lowest set bit in a word
|
||||
\param bits The word to be searched
|
||||
\return The bit number of the lowest set bit, or -1 if the word is zero. */
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n"
|
||||
" bsfl %%eax,%%edx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
__asm__ __volatile__(" movl $-1,%%edx;\n" " bsfl %%eax,%%edx;\n":"=d"(res)
|
||||
:"a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#elif defined(__x86_64__)
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
static __inline__ int top_bit(unsigned int bits) {
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
||||
" bsrq %%rax,%%rdx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n" " bsrq %%rax,%%rdx;\n":"=d"(res)
|
||||
:"a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/ static __inline__ int bottom_bit(unsigned int bits) {
|
||||
int res;
|
||||
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n"
|
||||
" bsfq %%rax,%%rdx;\n"
|
||||
: "=d" (res)
|
||||
: "a" (bits));
|
||||
return res;
|
||||
}
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n" " bsfq %%rax,%%rdx;\n":"=d"(res)
|
||||
:"a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#else
|
||||
static __inline__ int top_bit(unsigned int bits)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 0;
|
||||
if (bits & 0xFFFF0000)
|
||||
{
|
||||
bits &= 0xFFFF0000;
|
||||
i += 16;
|
||||
}
|
||||
if (bits & 0xFF00FF00)
|
||||
{
|
||||
bits &= 0xFF00FF00;
|
||||
i += 8;
|
||||
}
|
||||
if (bits & 0xF0F0F0F0)
|
||||
{
|
||||
bits &= 0xF0F0F0F0;
|
||||
i += 4;
|
||||
}
|
||||
if (bits & 0xCCCCCCCC)
|
||||
{
|
||||
bits &= 0xCCCCCCCC;
|
||||
i += 2;
|
||||
}
|
||||
if (bits & 0xAAAAAAAA)
|
||||
{
|
||||
bits &= 0xAAAAAAAA;
|
||||
i += 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
static __inline__ int top_bit(unsigned int bits) {
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 0;
|
||||
if (bits & 0xFFFF0000) {
|
||||
bits &= 0xFFFF0000;
|
||||
i += 16;
|
||||
}
|
||||
if (bits & 0xFF00FF00) {
|
||||
bits &= 0xFF00FF00;
|
||||
i += 8;
|
||||
}
|
||||
if (bits & 0xF0F0F0F0) {
|
||||
bits &= 0xF0F0F0F0;
|
||||
i += 4;
|
||||
}
|
||||
if (bits & 0xCCCCCCCC) {
|
||||
bits &= 0xCCCCCCCC;
|
||||
i += 2;
|
||||
}
|
||||
if (bits & 0xAAAAAAAA) {
|
||||
bits &= 0xAAAAAAAA;
|
||||
i += 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int bottom_bit(unsigned int bits)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 32;
|
||||
if (bits & 0x0000FFFF)
|
||||
{
|
||||
bits &= 0x0000FFFF;
|
||||
i -= 16;
|
||||
}
|
||||
if (bits & 0x00FF00FF)
|
||||
{
|
||||
bits &= 0x00FF00FF;
|
||||
i -= 8;
|
||||
}
|
||||
if (bits & 0x0F0F0F0F)
|
||||
{
|
||||
bits &= 0x0F0F0F0F;
|
||||
i -= 4;
|
||||
}
|
||||
if (bits & 0x33333333)
|
||||
{
|
||||
bits &= 0x33333333;
|
||||
i -= 2;
|
||||
}
|
||||
if (bits & 0x55555555)
|
||||
{
|
||||
bits &= 0x55555555;
|
||||
i -= 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
static __inline__ int bottom_bit(unsigned int bits) {
|
||||
int i;
|
||||
|
||||
if (bits == 0)
|
||||
return -1;
|
||||
i = 32;
|
||||
if (bits & 0x0000FFFF) {
|
||||
bits &= 0x0000FFFF;
|
||||
i -= 16;
|
||||
}
|
||||
if (bits & 0x00FF00FF) {
|
||||
bits &= 0x00FF00FF;
|
||||
i -= 8;
|
||||
}
|
||||
if (bits & 0x0F0F0F0F) {
|
||||
bits &= 0x0F0F0F0F;
|
||||
i -= 4;
|
||||
}
|
||||
if (bits & 0x33333333) {
|
||||
bits &= 0x33333333;
|
||||
i -= 2;
|
||||
}
|
||||
if (bits & 0x55555555) {
|
||||
bits &= 0x55555555;
|
||||
i -= 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
@@ -194,7 +165,7 @@ static __inline__ int bottom_bit(unsigned int bits)
|
||||
* segment, but a little inline assembly can fix that on an i386, x86_64 and
|
||||
* many other modern processors.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Mu-law is basically as follows:
|
||||
*
|
||||
@@ -222,66 +193,61 @@ static __inline__ int bottom_bit(unsigned int bits)
|
||||
*/
|
||||
|
||||
//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */
|
||||
#define ULAW_BIAS 0x84 /* Bias for linear code. */
|
||||
#define ULAW_BIAS 0x84 /* Bias for linear code. */
|
||||
|
||||
/*! \brief Encode a linear sample to u-law
|
||||
\param linear The sample to encode.
|
||||
\return The u-law value.
|
||||
*/
|
||||
static __inline__ uint8_t linear_to_ulaw(int linear)
|
||||
{
|
||||
uint8_t u_val;
|
||||
int mask;
|
||||
int seg;
|
||||
static __inline__ uint8_t linear_to_ulaw(int linear) {
|
||||
uint8_t u_val;
|
||||
int mask;
|
||||
int seg;
|
||||
|
||||
/* Get the sign and the magnitude of the value. */
|
||||
if (linear < 0)
|
||||
{
|
||||
linear = ULAW_BIAS - linear;
|
||||
mask = 0x7F;
|
||||
}
|
||||
else
|
||||
{
|
||||
linear = ULAW_BIAS + linear;
|
||||
mask = 0xFF;
|
||||
}
|
||||
/* Get the sign and the magnitude of the value. */
|
||||
if (linear < 0) {
|
||||
linear = ULAW_BIAS - linear;
|
||||
mask = 0x7F;
|
||||
} else {
|
||||
linear = ULAW_BIAS + linear;
|
||||
mask = 0xFF;
|
||||
}
|
||||
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
|
||||
/*
|
||||
* Combine the sign, segment, quantization bits,
|
||||
* and complement the code word.
|
||||
*/
|
||||
if (seg >= 8)
|
||||
u_val = (uint8_t) (0x7F ^ mask);
|
||||
else
|
||||
u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
|
||||
/*
|
||||
* Combine the sign, segment, quantization bits,
|
||||
* and complement the code word.
|
||||
*/
|
||||
if (seg >= 8)
|
||||
u_val = (uint8_t) (0x7F ^ mask);
|
||||
else
|
||||
u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
|
||||
#ifdef ULAW_ZEROTRAP
|
||||
/* Optional ITU trap */
|
||||
if (u_val == 0)
|
||||
u_val = 0x02;
|
||||
/* Optional ITU trap */
|
||||
if (u_val == 0)
|
||||
u_val = 0x02;
|
||||
#endif
|
||||
return u_val;
|
||||
}
|
||||
return u_val;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Decode an u-law sample to a linear value.
|
||||
\param ulaw The u-law sample to decode.
|
||||
\return The linear value.
|
||||
*/
|
||||
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
|
||||
{
|
||||
int t;
|
||||
|
||||
/* Complement to obtain normal u-law value. */
|
||||
ulaw = ~ulaw;
|
||||
/*
|
||||
* Extract and bias the quantization bits. Then
|
||||
* shift up by the segment number and subtract out the bias.
|
||||
*/
|
||||
t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
|
||||
return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
|
||||
}
|
||||
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) {
|
||||
int t;
|
||||
|
||||
/* Complement to obtain normal u-law value. */
|
||||
ulaw = ~ulaw;
|
||||
/*
|
||||
* Extract and bias the quantization bits. Then
|
||||
* shift up by the segment number and subtract out the bias.
|
||||
*/
|
||||
t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
|
||||
return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -308,71 +274,64 @@ static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
|
||||
\param linear The sample to encode.
|
||||
\return The A-law value.
|
||||
*/
|
||||
static __inline__ uint8_t linear_to_alaw(int linear)
|
||||
{
|
||||
int mask;
|
||||
int seg;
|
||||
|
||||
if (linear >= 0)
|
||||
{
|
||||
/* Sign (bit 7) bit = 1 */
|
||||
mask = ALAW_AMI_MASK | 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Sign (bit 7) bit = 0 */
|
||||
mask = ALAW_AMI_MASK;
|
||||
linear = -linear - 8;
|
||||
}
|
||||
static __inline__ uint8_t linear_to_alaw(int linear) {
|
||||
int mask;
|
||||
int seg;
|
||||
|
||||
/* Convert the scaled magnitude to segment number. */
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
if (seg >= 8)
|
||||
{
|
||||
if (linear >= 0)
|
||||
{
|
||||
/* Out of range. Return maximum value. */
|
||||
return (uint8_t) (0x7F ^ mask);
|
||||
}
|
||||
/* We must be just a tiny step below zero */
|
||||
return (uint8_t) (0x00 ^ mask);
|
||||
}
|
||||
/* Combine the sign, segment, and quantization bits. */
|
||||
return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
|
||||
}
|
||||
if (linear >= 0) {
|
||||
/* Sign (bit 7) bit = 1 */
|
||||
mask = ALAW_AMI_MASK | 0x80;
|
||||
} else {
|
||||
/* Sign (bit 7) bit = 0 */
|
||||
mask = ALAW_AMI_MASK;
|
||||
linear = -linear - 8;
|
||||
}
|
||||
|
||||
/* Convert the scaled magnitude to segment number. */
|
||||
seg = top_bit(linear | 0xFF) - 7;
|
||||
if (seg >= 8) {
|
||||
if (linear >= 0) {
|
||||
/* Out of range. Return maximum value. */
|
||||
return (uint8_t) (0x7F ^ mask);
|
||||
}
|
||||
/* We must be just a tiny step below zero */
|
||||
return (uint8_t) (0x00 ^ mask);
|
||||
}
|
||||
/* Combine the sign, segment, and quantization bits. */
|
||||
return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Decode an A-law sample to a linear value.
|
||||
\param alaw The A-law sample to decode.
|
||||
\return The linear value.
|
||||
*/
|
||||
static __inline__ int16_t alaw_to_linear(uint8_t alaw)
|
||||
{
|
||||
int i;
|
||||
int seg;
|
||||
static __inline__ int16_t alaw_to_linear(uint8_t alaw) {
|
||||
int i;
|
||||
int seg;
|
||||
|
||||
alaw ^= ALAW_AMI_MASK;
|
||||
i = ((alaw & 0x0F) << 4);
|
||||
seg = (((int) alaw & 0x70) >> 4);
|
||||
if (seg)
|
||||
i = (i + 0x108) << (seg - 1);
|
||||
else
|
||||
i += 8;
|
||||
return (int16_t) ((alaw & 0x80) ? i : -i);
|
||||
}
|
||||
alaw ^= ALAW_AMI_MASK;
|
||||
i = ((alaw & 0x0F) << 4);
|
||||
seg = (((int) alaw & 0x70) >> 4);
|
||||
if (seg)
|
||||
i = (i + 0x108) << (seg - 1);
|
||||
else
|
||||
i += 8;
|
||||
return (int16_t) ((alaw & 0x80) ? i : -i);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
|
||||
\param alaw The A-law sample to transcode.
|
||||
\return The best matching u-law value.
|
||||
*/
|
||||
uint8_t alaw_to_ulaw(uint8_t alaw);
|
||||
uint8_t alaw_to_ulaw(uint8_t alaw);
|
||||
|
||||
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
|
||||
\param ulaw The u-law sample to transcode.
|
||||
\return The best matching A-law value.
|
||||
*/
|
||||
uint8_t ulaw_to_alaw(uint8_t ulaw);
|
||||
uint8_t ulaw_to_alaw(uint8_t ulaw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+96
-99
@@ -56,8 +56,6 @@ SWITCH_BEGIN_EXTERN_C
|
||||
*/
|
||||
/** The fundamental pool type */
|
||||
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/
|
||||
|
||||
|
||||
/**
|
||||
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
||||
* subpools.
|
||||
@@ -93,13 +91,13 @@ SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p);
|
||||
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
|
||||
* is the only supported method of loading DSOs today.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx);
|
||||
|
||||
/**
|
||||
* Close a DSO library.
|
||||
* @param handle handle to close.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle);
|
||||
|
||||
/**
|
||||
* Load a symbol from a DSO handle.
|
||||
@@ -107,7 +105,7 @@ SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle);
|
||||
* @param handle handle to load the symbol from.
|
||||
* @param symname Name of the symbol to load.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym, switch_dso_handle_t * handle, const char *symname);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, switch_dso_handle_t *handle, const char *symname);
|
||||
|
||||
/**
|
||||
* Report more information when a DSO function fails.
|
||||
@@ -115,7 +113,7 @@ SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym,
|
||||
* @param buf Location to store the dso error
|
||||
* @param bufsize The size of the provided buffer
|
||||
*/
|
||||
SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *buf, size_t bufsize);
|
||||
SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -125,11 +123,13 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *b
|
||||
* @{
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
|
||||
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len)
|
||||
char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
|
||||
|
||||
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ 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);
|
||||
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
|
||||
char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -164,7 +164,7 @@ SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z
|
||||
* progress at the same time.
|
||||
|
||||
*/
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t * ht);
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Continue iterating over the entries in a hash table.
|
||||
@@ -172,7 +172,7 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p,
|
||||
* @return a pointer to the updated iteration state. NULL if there are no more
|
||||
* entries.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht);
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *ht);
|
||||
|
||||
/**
|
||||
* Get the current entry's details from the iteration state.
|
||||
@@ -183,11 +183,11 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht)
|
||||
* @remark The return pointers should point to a variable that will be set to the
|
||||
* corresponding data, or they may be NULL if the data isn't interesting.
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key, switch_ssize_t *klen, void **val);
|
||||
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val);
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht);
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -258,7 +258,7 @@ SWITCH_DECLARE(switch_time_t) switch_time_now(void);
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input);
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* formats the exploded time according to the format specified
|
||||
@@ -268,7 +268,7 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result,
|
||||
* @param format The format for the time string
|
||||
* @param tm The time to convert
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t * tm);
|
||||
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
|
||||
|
||||
/**
|
||||
* switch_rfc822_date formats dates in the RFC822
|
||||
@@ -285,7 +285,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result, switch_time_t input);
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input);
|
||||
|
||||
/**
|
||||
* Convert time value from human readable format to a numeric apr_time_t
|
||||
@@ -293,14 +293,14 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result,
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t * result, switch_time_exp_t * input);
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* convert a time to its human readable components in local timezone
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t * result, switch_time_t input);
|
||||
SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input);
|
||||
|
||||
/**
|
||||
* Sleep for the specified number of micro-seconds.
|
||||
@@ -341,27 +341,27 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t);
|
||||
* it will behave as either a nested or an unnested lock.
|
||||
*
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool);
|
||||
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param lock the mutex to destroy.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t * lock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock);
|
||||
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param lock the mutex on which to acquire the lock.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t * lock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param lock the mutex from which to release the lock.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
@@ -370,7 +370,7 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock);
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param lock the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -383,14 +383,14 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock);
|
||||
/** Opaque structure used for the rwlock */
|
||||
typedef struct apr_thread_rwlock_t switch_thread_rwlock_t;
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t * rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -416,7 +416,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
|
||||
* will be stored.
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up. Each
|
||||
@@ -430,7 +430,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t *
|
||||
* is released while the thread is asleep, and is again acquired before
|
||||
* returning from this function.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * cond, switch_mutex_t * mutex);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up or
|
||||
@@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * c
|
||||
* will wake up before this time, otherwise the error APR_TIMEUP
|
||||
* is returned.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t * cond, switch_mutex_t * mutex, switch_interval_time_t timeout);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Signals a single thread, if one exists, that is blocking on the given
|
||||
@@ -457,7 +457,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_
|
||||
* is desired, that mutex must be locked while calling this function.
|
||||
* @param cond the condition variable on which to produce the signal.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t * cond);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Signals all threads blocking on the given condition variable.
|
||||
@@ -465,13 +465,13 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *
|
||||
* the associated mutex. This will happen in a serialized manner.
|
||||
* @param cond the condition variable on which to produce the broadcast.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t * cond);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Destroy the condition variable and free the associated memory.
|
||||
* @param cond the condition variable to destroy.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t * cond);
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -498,20 +498,20 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t
|
||||
* the formatted UUID and a null terminator
|
||||
* @param uuid The UUID to format
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t * uuid);
|
||||
SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid);
|
||||
|
||||
/**
|
||||
* Generate and return a (new) UUID
|
||||
* @param uuid The resulting UUID
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t * uuid);
|
||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid);
|
||||
|
||||
/**
|
||||
* Parse a standard-format string into a UUID
|
||||
* @param uuid The resulting UUID
|
||||
* @param uuid_str The formatted UUID
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const char *uuid_str);
|
||||
SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -530,7 +530,7 @@ SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const ch
|
||||
* @param queue_capacity maximum size of the queue
|
||||
* @param pool a pool to allocate queue from
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* pop/get an object from the queue, blocking if the queue is already empty
|
||||
@@ -541,7 +541,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, uns
|
||||
* @returns APR_EOF if the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successfull pop
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data);
|
||||
|
||||
/**
|
||||
* push/add a object to the queue, blocking if the queue is already full
|
||||
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successfull push
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data);
|
||||
|
||||
/**
|
||||
* returns the size of the queue.
|
||||
@@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *
|
||||
* @param queue the queue
|
||||
* @returns the size of the queue
|
||||
*/
|
||||
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue);
|
||||
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue);
|
||||
|
||||
/**
|
||||
* pop/get an object to the queue, returning immediatly if the queue is empty
|
||||
@@ -574,7 +574,7 @@ SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue);
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successfull push
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void **data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data);
|
||||
|
||||
/**
|
||||
* push/add a object to the queue, returning immediatly if the queue is full
|
||||
@@ -586,7 +586,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successfull push
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -650,13 +650,13 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, voi
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
|
||||
#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
|
||||
or thread can hold a shared lock
|
||||
at any given time. Essentially,
|
||||
this is a "read lock", preventing
|
||||
writers from establishing an
|
||||
exclusive lock. */
|
||||
#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
|
||||
#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
|
||||
may hold an exclusive lock at any
|
||||
given time. This is analogous to
|
||||
a "write lock". */
|
||||
@@ -722,19 +722,19 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, voi
|
||||
* @remark If perm is SWITCH_FPROT_OS_DEFAULT and the file is being created,
|
||||
* appropriate default permissions will be used.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm,
|
||||
switch_memory_pool_t *pool);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t * thefile, switch_seek_where_t where, int64_t *offset);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset);
|
||||
|
||||
/**
|
||||
* Close the specified file.
|
||||
* @param thefile The file descriptor to close.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t * thefile);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t * thefile, int type);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type);
|
||||
|
||||
/**
|
||||
* Delete the specified file.
|
||||
@@ -764,7 +764,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const
|
||||
* @remark It is not possible for both bytes to be read and an APR_EOF
|
||||
* or other error to be returned. APR_EINTR is never returned.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *buf, switch_size_t *nbytes);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* Write data to the specified file.
|
||||
@@ -781,7 +781,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *
|
||||
* @remark It is possible for both bytes to be written and an error to
|
||||
* be returned. APR_EINTR is never returned.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t * thefile, const void *buf, switch_size_t *nbytes);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes);
|
||||
SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool);
|
||||
@@ -798,8 +798,7 @@ SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, swi
|
||||
* @param perm Permissions for the new direcoty.
|
||||
* @param pool the pool to use.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
|
||||
switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
|
||||
|
||||
/** Creates a new directory on the file system, but behaves like
|
||||
* 'mkdir -p'. Creates intermediate directories as required. No error
|
||||
@@ -808,24 +807,23 @@ SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileper
|
||||
* @param perm Permissions for the new direcoty.
|
||||
* @param pool the pool to use.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm,
|
||||
switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
|
||||
|
||||
typedef struct switch_dir switch_dir_t;
|
||||
typedef struct switch_dir switch_dir_t;
|
||||
|
||||
struct switch_array_header_t {
|
||||
/** The pool the array is allocated out of */
|
||||
switch_memory_pool_t *pool;
|
||||
/** The amount of memory allocated for each element of the array */
|
||||
int elt_size;
|
||||
/** The number of active elements in the array */
|
||||
int nelts;
|
||||
/** The number of elements allocated in the array */
|
||||
int nalloc;
|
||||
/** The elements in the array */
|
||||
char *elts;
|
||||
};
|
||||
typedef struct switch_array_header_t switch_array_header_t;
|
||||
struct switch_array_header_t {
|
||||
/** The pool the array is allocated out of */
|
||||
switch_memory_pool_t *pool;
|
||||
/** The amount of memory allocated for each element of the array */
|
||||
int elt_size;
|
||||
/** The number of active elements in the array */
|
||||
int nelts;
|
||||
/** The number of elements allocated in the array */
|
||||
int nalloc;
|
||||
/** The elements in the array */
|
||||
char *elts;
|
||||
};
|
||||
typedef struct switch_array_header_t switch_array_header_t;
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir);
|
||||
@@ -852,7 +850,7 @@ SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *bu
|
||||
typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *);
|
||||
|
||||
//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize)
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t * attr, switch_size_t stacksize);
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threadattr_t *attr);
|
||||
|
||||
@@ -862,14 +860,14 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threa
|
||||
* @param new_attr The newly created threadattr.
|
||||
* @param pool The pool to use
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Set if newly created threads should be created in detached state.
|
||||
* @param attr The threadattr to affect
|
||||
* @param on Non-zero if detached threads should be created.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t * attr, int32_t on);
|
||||
SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on);
|
||||
|
||||
/**
|
||||
* Create a new thread of execution
|
||||
@@ -879,7 +877,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t
|
||||
* @param data Any data to be passed to the starting function
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t * attr,
|
||||
SWITCH_DECLARE(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);
|
||||
|
||||
/** @} */
|
||||
@@ -946,7 +944,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
|
||||
* @param protocol The protocol of the socket (e.g., SWITCH_PROTO_TCP).
|
||||
* @param pool The pool to use
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Shutdown either reading, writing, or both sides of a socket.
|
||||
@@ -961,13 +959,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock
|
||||
* @remark This does not actually close the socket descriptor, it just
|
||||
* controls which calls are still valid on the socket.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t * sock, switch_shutdown_how_e how);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how);
|
||||
|
||||
/**
|
||||
* Close a socket.
|
||||
* @param sock The socket to close
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Bind the socket to its associated port
|
||||
@@ -976,7 +974,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock);
|
||||
* @remark This may be where we will find out if there is any other process
|
||||
* using the selected port.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switch_sockaddr_t * sa);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa);
|
||||
|
||||
/**
|
||||
* Listen to a bound socket for connections.
|
||||
@@ -985,7 +983,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switc
|
||||
* listen queue. If this value is less than zero, the listen
|
||||
* queue size is set to zero.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int32_t backlog);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog);
|
||||
|
||||
/**
|
||||
* Accept a new connection request
|
||||
@@ -995,7 +993,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int
|
||||
* @param sock The socket we are listening on.
|
||||
* @param pool The pool for the new socket.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t * sock, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Issue a connection request to a socket either on the same machine
|
||||
@@ -1003,12 +1001,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock
|
||||
* @param sock The socket we wish to use for our side of the connection
|
||||
* @param sa The address of the machine we wish to connect to.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t * sock, switch_sockaddr_t * sa);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa);
|
||||
|
||||
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa);
|
||||
SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t * in);
|
||||
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t * sa);
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t * sa);
|
||||
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa);
|
||||
SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in);
|
||||
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa);
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1034,7 +1032,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_socka
|
||||
* </PRE>
|
||||
* @param pool The pool for the apr_sockaddr_t and associated storage.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname,
|
||||
int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool);
|
||||
|
||||
/**
|
||||
@@ -1054,7 +1052,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len);
|
||||
|
||||
/**
|
||||
* @param sock The socket to send from
|
||||
@@ -1063,8 +1061,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const
|
||||
* @param buf The data to send
|
||||
* @param len The length of the data to send
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf,
|
||||
switch_size_t *len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len);
|
||||
|
||||
/**
|
||||
* @param from The apr_sockaddr_t to fill in the recipient info
|
||||
@@ -1074,7 +1071,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, swi
|
||||
* @param len The length of the available buffer
|
||||
*
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from, switch_socket_t * sock, int32_t flags, char *buf, size_t *len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1096,7 +1093,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from,
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char *buf, switch_size_t *len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len);
|
||||
|
||||
/**
|
||||
* Setup socket options for the specified socket
|
||||
@@ -1120,7 +1117,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char
|
||||
* </PRE>
|
||||
* @param on Value for the option.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on);
|
||||
|
||||
/**
|
||||
* Setup socket timeout for the specified socket
|
||||
@@ -1133,7 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, in
|
||||
* t < 0 -- read and write calls block
|
||||
* </PRE>
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock, switch_interval_time_t t);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t);
|
||||
|
||||
/**
|
||||
* Join a Multicast Group
|
||||
@@ -1144,7 +1141,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock
|
||||
* @param source Source Address to accept transmissions from (non-NULL
|
||||
* implies Source-Specific Multicast)
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch_sockaddr_t * join, switch_sockaddr_t * iface, switch_sockaddr_t * source);
|
||||
SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source);
|
||||
|
||||
|
||||
|
||||
@@ -1185,7 +1182,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch
|
||||
* platforms; the apr_pollset_create() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
|
||||
|
||||
/**
|
||||
* Add a socket or file descriptor to a pollset
|
||||
@@ -1204,7 +1201,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollse
|
||||
* allowed for implementations where option (1) is impossible
|
||||
* or impractical.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, const switch_pollfd_t * descriptor);
|
||||
SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Poll the sockets in the poll structure
|
||||
@@ -1219,7 +1216,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, c
|
||||
* This is a blocking call, and it will not return until either a
|
||||
* socket has been signalled, or the timeout has expired.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
|
||||
SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
|
||||
|
||||
/*!
|
||||
\brief Create a set of file descriptors to poll
|
||||
@@ -1229,7 +1226,7 @@ SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t nu
|
||||
\param pool the memory pool to use
|
||||
\return SWITCH_STATUS_SUCCESS when successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t * sock, int16_t flags, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p);
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock);
|
||||
|
||||
@@ -106,7 +106,7 @@ static inline void pack_check_over(switch_bitpack_t *pack)
|
||||
pack->cur++;
|
||||
} else {
|
||||
switch_byte_t mask = SWITCH_BITS_PER_BYTE - pack->over;
|
||||
switch_assert(mask < 8); /* if pack->over this will allways be true */
|
||||
switch_assert(mask < 8); /* if pack->over this will allways be true */
|
||||
this_byte &= SWITCH_REVERSE_BITPACKED_MASKS[mask];
|
||||
this_byte >>= mask;
|
||||
|
||||
|
||||
@@ -122,7 +122,8 @@ SWITCH_DECLARE(void) switch_buffer_set_loops(_In_ switch_buffer_t *buffer, _In_
|
||||
* \param datalen amount of data to be written
|
||||
* \return int amount of buffer used after the write, or 0 if no space available
|
||||
*/
|
||||
SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
|
||||
SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
|
||||
const void *data, _In_ switch_size_t datalen);
|
||||
|
||||
/*! \brief Remove data from the buffer
|
||||
* \param buffer any buffer of type switch_buffer_t
|
||||
@@ -142,7 +143,8 @@ SWITCH_DECLARE(void) switch_buffer_zero(_In_ switch_buffer_t *buffer);
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer);
|
||||
|
||||
SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
|
||||
SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
|
||||
const void *data, _In_ switch_size_t datalen);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -140,8 +140,7 @@ struct switch_caller_extension {
|
||||
\return a new extension object allocated from the session's memory pool
|
||||
*/
|
||||
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
|
||||
_In_z_ const char *extension_name,
|
||||
_In_z_ const char *extension_number);
|
||||
_In_z_ const char *extension_name, _In_z_ const char *extension_number);
|
||||
|
||||
/*!
|
||||
\brief Add an application (instruction) to the given extension
|
||||
@@ -152,8 +151,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ swi
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_session_t *session,
|
||||
_In_ switch_caller_extension_t *caller_extension,
|
||||
_In_z_ const char *application_name,
|
||||
_In_z_ const char *extra_data);
|
||||
_In_z_ const char *application_name, _In_z_ const char *extra_data);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -162,8 +160,8 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_se
|
||||
\param name the name
|
||||
\note this function is meant for situations where the name paramater is the contents of the variable
|
||||
*/
|
||||
_Check_return_ _Ret_opt_z_ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(_In_ switch_caller_profile_t *caller_profile,
|
||||
_In_z_ const char *name);
|
||||
_Check_return_ _Ret_opt_z_ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(_In_ switch_caller_profile_t *caller_profile,
|
||||
_In_z_ const char *name);
|
||||
|
||||
/*!
|
||||
\brief Create a new caller profile object
|
||||
@@ -191,8 +189,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(_In_ switch_
|
||||
_In_opt_z_ const char *aniii,
|
||||
_In_opt_z_ const char *rdnis,
|
||||
_In_opt_z_ const char *source,
|
||||
_In_opt_z_ const char *context,
|
||||
_In_opt_z_ const char *destination_number);
|
||||
_In_opt_z_ const char *context, _In_opt_z_ const char *destination_number);
|
||||
|
||||
/*!
|
||||
\brief Clone an existing caller profile object
|
||||
@@ -216,8 +213,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(_In_ switch_
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(_In_ switch_caller_profile_t *caller_profile,
|
||||
_In_opt_z_ const char *prefix,
|
||||
_In_ switch_event_t *event);
|
||||
_In_opt_z_ const char *prefix, _In_ switch_event_t *event);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
/** @} */
|
||||
|
||||
@@ -438,7 +438,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(_In_ switch_cha
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf);
|
||||
SWITCH_DECLARE(void) switch_channel_flush_dtmf(_In_ switch_channel_t *channel);
|
||||
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len) char *dtmf_str, _In_ switch_size_t len);
|
||||
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len)
|
||||
char *dtmf_str, _In_ switch_size_t len);
|
||||
|
||||
/*!
|
||||
\brief Render the name of the provided state enum
|
||||
@@ -469,7 +470,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(_In_ switch_channel_t *channe
|
||||
\note it's necessary to test if the return val is the same as the input and free the string if it is not.
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_channel_expand_variables(_In_ switch_channel_t *channel, _In_ const char *in);
|
||||
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, _In_opt_ const char *prefix);
|
||||
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile,
|
||||
_In_opt_ const char *prefix);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channel_t *channel);
|
||||
|
||||
#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
|
||||
|
||||
@@ -88,13 +88,13 @@ struct switch_config {
|
||||
\param file_path path to the file
|
||||
\return 1 (true) on success 0 (false) on failure
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_path);
|
||||
SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_path);
|
||||
|
||||
/*!
|
||||
\brief Close a previously opened configuration file
|
||||
\param cfg (switch_config_t *) config handle to use
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_config_close_file(switch_config_t * cfg);
|
||||
SWITCH_DECLARE(void) switch_config_close_file(switch_config_t *cfg);
|
||||
|
||||
/*!
|
||||
\brief Retrieve next name/value pair from configuration file
|
||||
@@ -102,7 +102,7 @@ SWITCH_DECLARE(void) switch_config_close_file(switch_config_t * cfg);
|
||||
\param var pointer to aim at the new variable name
|
||||
\param val pointer to aim at the new value
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t * cfg, char **var, char **val);
|
||||
SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t *cfg, char **var, char **val);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
/** @} */
|
||||
|
||||
@@ -52,7 +52,6 @@ SWITCH_BEGIN_EXTERN_C
|
||||
s.raw_write_function = switch_console_stream_raw_write; \
|
||||
s.alloc_len = SWITCH_CMD_CHUNK_LEN; \
|
||||
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN
|
||||
|
||||
/*!
|
||||
\brief A simple comand loop that reads input from the terminal
|
||||
*/
|
||||
|
||||
+54
-58
@@ -43,7 +43,7 @@
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
|
||||
#define SWITCH_MAX_STREAMS 128
|
||||
struct switch_core_time_duration {
|
||||
struct switch_core_time_duration {
|
||||
uint32_t mms;
|
||||
uint32_t ms;
|
||||
uint32_t sec;
|
||||
@@ -132,9 +132,7 @@ struct switch_core_port_allocator;
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_session_t *session,
|
||||
_In_ switch_media_bug_callback_t callback,
|
||||
_In_opt_ void *user_data,
|
||||
_In_ time_t stop_time,
|
||||
_In_ switch_media_bug_flag_t flags,
|
||||
_Out_ switch_media_bug_t **new_bug);
|
||||
_In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug);
|
||||
/*!
|
||||
\brief Obtain private data from a media bug
|
||||
\param bug the bug to get the data from
|
||||
@@ -220,9 +218,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug
|
||||
\return SWITCH_STATUS_SUCCESS if the operation was a success
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
|
||||
_In_ switch_port_t end,
|
||||
_In_ switch_port_flag_t flags,
|
||||
_Out_ switch_core_port_allocator_t **new_allocator);
|
||||
_In_ switch_port_t end,
|
||||
_In_ switch_port_flag_t flags, _Out_ switch_core_port_allocator_t **new_allocator);
|
||||
|
||||
/*!
|
||||
\brief Get a port from the port allocator
|
||||
@@ -406,7 +403,8 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t me
|
||||
#define switch_core_permanent_alloc(_memory) switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
|
||||
SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
||||
SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file,
|
||||
_In_z_ const char *func, _In_ int line);
|
||||
|
||||
/*!
|
||||
\brief Allocate memory directly from a memory pool
|
||||
@@ -416,7 +414,8 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
|
||||
*/
|
||||
#define switch_core_alloc(_pool, _mem) switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
_Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file, const char *func, int line);
|
||||
_Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file,
|
||||
const char *func, int line);
|
||||
|
||||
/*!
|
||||
\brief Allocate memory from a session's pool
|
||||
@@ -429,7 +428,7 @@ _Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
||||
SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
||||
|
||||
/*!
|
||||
\brief Copy a string using permanent memory allocation
|
||||
@@ -439,7 +438,8 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *t
|
||||
#define switch_core_permanent_strdup(_todup) switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
||||
SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file,
|
||||
_In_z_ const char *func, _In_ int line);
|
||||
|
||||
/*!
|
||||
\brief Copy a string using memory allocation from a session's pool
|
||||
@@ -450,7 +450,8 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_sessi
|
||||
#define switch_core_session_strdup(_session, _todup) switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
|
||||
SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
|
||||
SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
|
||||
_In_z_ const char *func, _In_ int line);
|
||||
|
||||
/*!
|
||||
\brief Copy a string using memory allocation from a given pool
|
||||
@@ -542,7 +543,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_co
|
||||
\param session the session to retrieve from
|
||||
\return a pointer to the channel object
|
||||
*/
|
||||
_Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
|
||||
_Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
|
||||
|
||||
/*!
|
||||
\brief Signal a session's state machine thread that a state change has occured
|
||||
@@ -620,7 +621,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(_In_ switch_co
|
||||
\param indication the indication message to pass
|
||||
\return SWITCH_STATUS_SUCCESS if the message was passed
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session,
|
||||
_In_ switch_core_session_message_types_t indication);
|
||||
|
||||
/*!
|
||||
\brief Queue an indication message on a session
|
||||
@@ -628,7 +630,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_
|
||||
\param indication the indication message to queue
|
||||
\return SWITCH_STATUS_SUCCESS if the message was queued
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session,
|
||||
_In_ switch_core_session_message_types_t indication);
|
||||
|
||||
/*!
|
||||
\brief DE-Queue an message on a given session
|
||||
@@ -656,17 +659,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(_In_z_ const char
|
||||
SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
|
||||
_In_ const switch_application_interface_t *application_interface,
|
||||
_In_opt_z_ const char *arg);
|
||||
_In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
|
||||
_In_ const char *app,
|
||||
_In_opt_z_ const char *arg);
|
||||
_In_ const char *app, _In_opt_z_ const char *arg);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_core_session_t *session,
|
||||
_In_z_ const char *exten,
|
||||
_In_opt_z_ const char *dialplan,
|
||||
_In_opt_z_ const char *context);
|
||||
_In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
|
||||
|
||||
/*!
|
||||
\brief Send an event to a session translating it to it's native message format
|
||||
@@ -721,8 +721,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(_In_ switch_core_sessio
|
||||
\param obj an arguement
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
|
||||
_In_ void *(*func) (switch_thread_t *, void *),
|
||||
_In_opt_ void *obj);
|
||||
_In_ void *(*func) (switch_thread_t *, void *), _In_opt_ void *obj);
|
||||
|
||||
/*!
|
||||
\brief Signal a thread using a thread session to terminate
|
||||
@@ -737,8 +736,7 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(_In_ switch_core_thread_sess
|
||||
\param thread_session the thread_session to use
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_service_session(_In_ switch_core_session_t *session,
|
||||
_In_ switch_core_thread_session_t *thread_session,
|
||||
_In_ int stream_id);
|
||||
_In_ switch_core_thread_session_t *thread_session, _In_ int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
|
||||
@@ -756,13 +754,11 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt
|
||||
_In_z_ const char *endpoint_name,
|
||||
_In_ switch_caller_profile_t *caller_profile,
|
||||
_Inout_ switch_core_session_t **new_session,
|
||||
_Inout_ switch_memory_pool_t **pool,
|
||||
_In_ switch_originate_flag_t flags);
|
||||
_Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags);
|
||||
|
||||
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(_In_z_ const char *endpoint_name,
|
||||
_Inout_ switch_core_session_t **new_session,
|
||||
_Inout_ switch_memory_pool_t **pool,
|
||||
_In_ void *data);
|
||||
_Inout_ switch_memory_pool_t **pool, _In_ void *data);
|
||||
|
||||
/*!
|
||||
\brief Receive a message on a given session
|
||||
@@ -837,7 +833,8 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS a the frame was read
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Read a video frame from a session
|
||||
@@ -847,7 +844,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS a if the frame was read
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Write a video frame to a session
|
||||
@@ -857,7 +855,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS a if the frame was written
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Reset the buffers and resampler on a session
|
||||
@@ -874,7 +873,8 @@ SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *sessi
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS a the frame was written
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ switch_core_session_t *session,
|
||||
@@ -916,7 +916,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(_In_ switch_core_s
|
||||
\param pool the pool to use for the new hash
|
||||
\return SWITCH_STATUS_SUCCESS if the hash is created
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_init(_Out_ switch_hash_t ** hash, _In_ switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_init(_Out_ switch_hash_t **hash, _In_ switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Destroy an existing hash table
|
||||
@@ -933,7 +933,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t *
|
||||
\return SWITCH_STATUS_SUCCESS if the data is added
|
||||
\note the string key must be a constant or a dynamic string
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data);
|
||||
|
||||
/*!
|
||||
\brief Insert data into a hash
|
||||
@@ -944,7 +944,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t * has
|
||||
\return SWITCH_STATUS_SUCCESS if the data is added
|
||||
\note the string key must be a constant or a dynamic string
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data, _In_ switch_mutex_t *mutex);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data,
|
||||
_In_ switch_mutex_t *mutex);
|
||||
|
||||
/*!
|
||||
\brief Delete data from a hash based on desired key
|
||||
@@ -952,7 +953,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_
|
||||
\param key the key from which to delete the data
|
||||
\return SWITCH_STATUS_SUCCESS if the data is deleted
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t * hash, _In_z_ const char *key);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key);
|
||||
|
||||
/*!
|
||||
\brief Delete data from a hash based on desired key
|
||||
@@ -961,7 +962,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t * has
|
||||
\param mutex optional mutex to lock
|
||||
\return SWITCH_STATUS_SUCCESS if the data is deleted
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
|
||||
|
||||
/*!
|
||||
\brief Retrieve data from a given hash
|
||||
@@ -969,7 +970,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_
|
||||
\param key the key to retrieve
|
||||
\return a pointer to the data held in the key
|
||||
*/
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t * hash, _In_z_ const char *key);
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -979,11 +980,12 @@ SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t * hash, _In_z_ c
|
||||
\param mutex optional mutex to lock
|
||||
\return a pointer to the data held in the key
|
||||
*/
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
|
||||
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
|
||||
SWITCH_DECLARE(void) switch_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);
|
||||
SWITCH_DECLARE(void) switch_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);
|
||||
|
||||
///\}
|
||||
|
||||
@@ -999,7 +1001,8 @@ SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptr
|
||||
\param pool the memory pool to use for allocation
|
||||
\return
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
|
||||
switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Wait for one cycle on an existing timer
|
||||
@@ -1078,7 +1081,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
|
||||
void *decoded_data,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag);
|
||||
void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
|
||||
|
||||
/*!
|
||||
\brief Decode data using a codec handle
|
||||
@@ -1099,7 +1102,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
|
||||
void *encoded_data,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag);
|
||||
void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
|
||||
|
||||
/*!
|
||||
\brief Destroy an initalized codec handle
|
||||
@@ -1214,9 +1217,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
|
||||
_In_ switch_file_handle_t *fh,
|
||||
_In_z_ const char *file_path,
|
||||
_In_ uint8_t channels,
|
||||
_In_ uint32_t rate,
|
||||
_In_ unsigned int flags,
|
||||
_In_opt_ switch_memory_pool_t *pool);
|
||||
_In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Open a media file using file format modules
|
||||
@@ -1303,10 +1304,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(_In_ switch_file_handle_t
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handle_t *sh,
|
||||
const char *module_name,
|
||||
const char *voice_name,
|
||||
_In_ unsigned int rate,
|
||||
_In_ unsigned int interval,
|
||||
switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
|
||||
const char *voice_name,
|
||||
_In_ unsigned int rate,
|
||||
_In_ unsigned int interval, switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
|
||||
/*!
|
||||
\brief Feed text to the TTS module
|
||||
\param sh the speech handle to feed
|
||||
@@ -1356,7 +1356,7 @@ SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *
|
||||
\return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
|
||||
void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags);
|
||||
void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
|
||||
/*!
|
||||
\brief Close an open speech handle
|
||||
\param sh the speech handle to close
|
||||
@@ -1379,11 +1379,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
|
||||
const char *module_name,
|
||||
const char *codec,
|
||||
int rate,
|
||||
const char *dest,
|
||||
switch_asr_flag_t *flags,
|
||||
switch_memory_pool_t *pool);
|
||||
const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Close an asr handle
|
||||
@@ -1587,7 +1583,7 @@ SWITCH_DECLARE(switch_time_t) switch_core_uptime(void);
|
||||
\param val the command arguement (if needed)
|
||||
\return 0 on success nonzero on error
|
||||
*/
|
||||
SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t * val);
|
||||
SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val);
|
||||
|
||||
/*!
|
||||
\brief Get the output console
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#define SWITCH_EVENT_HOOKS_H
|
||||
|
||||
#include <switch.h>
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
typedef struct switch_io_event_hooks switch_io_event_hooks_t;
|
||||
SWITCH_BEGIN_EXTERN_C typedef struct switch_io_event_hooks switch_io_event_hooks_t;
|
||||
|
||||
typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel_t;
|
||||
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
|
||||
@@ -48,7 +47,7 @@ typedef struct switch_io_event_hook_recv_dtmf switch_io_event_hook_recv_dtmf_t;
|
||||
typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
|
||||
typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t;
|
||||
typedef switch_status_t (*switch_outgoing_channel_hook_t)
|
||||
(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
|
||||
(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
|
||||
typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
|
||||
typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
|
||||
typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
||||
@@ -59,7 +58,7 @@ typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *,
|
||||
typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
|
||||
typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
|
||||
typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *);
|
||||
typedef switch_call_cause_t (*switch_resurrect_session_hook_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
|
||||
typedef switch_call_cause_t (*switch_resurrect_session_hook_t) (switch_core_session_t **, switch_memory_pool_t **, void *);
|
||||
|
||||
/*! \brief Node in which to store custom receive message callback hooks */
|
||||
struct switch_io_event_hook_outgoing_channel {
|
||||
@@ -210,7 +209,7 @@ extern switch_io_event_hooks_t switch_core_session_get_event_hooks(switch_core_s
|
||||
last = ptr; \
|
||||
} \
|
||||
return SWITCH_STATUS_FALSE; \
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NEW_HOOK_DECL_ADD_P(outgoing_channel);
|
||||
|
||||
+163
-195
@@ -8,41 +8,28 @@ extern "C" {
|
||||
#ifdef DOH
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
|
||||
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
|
||||
|
||||
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
|
||||
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
|
||||
#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
|
||||
|
||||
|
||||
//
|
||||
// C++ Interface: switch_to_cpp_mempool
|
||||
//
|
||||
// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t
|
||||
//
|
||||
// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
|
||||
//// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
|
||||
#if 0
|
||||
#ifndef SWITCHTOMEMPOOL
|
||||
#define SWITCHTOMEMPOOL
|
||||
class SwitchToMempool {
|
||||
public:
|
||||
SwitchToMempool() { }
|
||||
SwitchToMempool(switch_memory_pool_t *mem) { memorypool = mem; }
|
||||
void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem)
|
||||
{
|
||||
void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
|
||||
return ptr;
|
||||
}
|
||||
protected:
|
||||
switch_memory_pool_t *memorypool;
|
||||
public:
|
||||
SwitchToMempool() {
|
||||
} SwitchToMempool(switch_memory_pool_t *mem) {
|
||||
memorypool = mem;
|
||||
}
|
||||
void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem) {
|
||||
void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
|
||||
return ptr;
|
||||
}
|
||||
protected:
|
||||
switch_memory_pool_t *memorypool;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
@@ -66,135 +53,130 @@ Note that the first parameter to the new operator is implicitly handled by c++..
|
||||
SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
|
||||
SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
||||
|
||||
class CoreSession;
|
||||
class CoreSession;
|
||||
|
||||
class IVRMenu {
|
||||
protected:
|
||||
switch_ivr_menu_t *menu;
|
||||
switch_memory_pool_t *pool;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu *main,
|
||||
const char *name,
|
||||
const char *greeting_sound,
|
||||
const char *short_greeting_sound,
|
||||
const char *invalid_sound,
|
||||
const char *exit_sound,
|
||||
const char *confirm_macro,
|
||||
const char *confirm_key,
|
||||
int confirm_attempts,
|
||||
int inter_timeout,
|
||||
int digit_len,
|
||||
int timeout,
|
||||
int max_failures
|
||||
);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~IVRMenu();
|
||||
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
|
||||
SWITCH_DECLARE(void) execute(CoreSession *session, const char *name);
|
||||
};
|
||||
class IVRMenu {
|
||||
protected:
|
||||
switch_ivr_menu_t *menu;
|
||||
switch_memory_pool_t *pool;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu * main,
|
||||
const char *name,
|
||||
const char *greeting_sound,
|
||||
const char *short_greeting_sound,
|
||||
const char *invalid_sound,
|
||||
const char *exit_sound,
|
||||
const char *confirm_macro,
|
||||
const char *confirm_key,
|
||||
int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
|
||||
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
|
||||
SWITCH_DECLARE(void) execute(CoreSession * session, const char *name);
|
||||
};
|
||||
|
||||
|
||||
class API {
|
||||
protected:
|
||||
char *last_data;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR API(void);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~API();
|
||||
SWITCH_DECLARE(const char *) execute(const char *command, const char *data);
|
||||
SWITCH_DECLARE(const char *) executeString(const char *command);
|
||||
};
|
||||
class API {
|
||||
protected:
|
||||
char *last_data;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR API(void);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~ API();
|
||||
SWITCH_DECLARE(const char *) execute(const char *command, const char *data);
|
||||
SWITCH_DECLARE(const char *) executeString(const char *command);
|
||||
};
|
||||
|
||||
|
||||
typedef struct input_callback_state {
|
||||
void *function; // pointer to the language specific callback function
|
||||
// eg, PyObject *pyfunc
|
||||
void *threadState; // pointer to the language specific thread state
|
||||
// eg, PyThreadState *threadState
|
||||
void *extra; // currently used to store a switch_file_handle_t
|
||||
char *funcargs; // extra string that will be passed to callback function
|
||||
} input_callback_state_t;
|
||||
typedef struct input_callback_state {
|
||||
void *function; // pointer to the language specific callback function
|
||||
// eg, PyObject *pyfunc
|
||||
void *threadState; // pointer to the language specific thread state
|
||||
// eg, PyThreadState *threadState
|
||||
void *extra; // currently used to store a switch_file_handle_t
|
||||
char *funcargs; // extra string that will be passed to callback function
|
||||
} input_callback_state_t;
|
||||
|
||||
typedef enum {
|
||||
S_HUP = (1 << 0),
|
||||
S_FREE = (1 << 1),
|
||||
S_RDLOCK = (1 << 2)
|
||||
} session_flag_t;
|
||||
typedef enum {
|
||||
S_HUP = (1 << 0),
|
||||
S_FREE = (1 << 1),
|
||||
S_RDLOCK = (1 << 2)
|
||||
} session_flag_t;
|
||||
|
||||
class Stream {
|
||||
protected:
|
||||
switch_stream_handle_t mystream;
|
||||
switch_stream_handle_t *stream_p;
|
||||
int mine;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR Stream(void);
|
||||
SWITCH_DECLARE_CONSTRUCTOR Stream(switch_stream_handle_t *);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~Stream();
|
||||
SWITCH_DECLARE(void) write(const char *data);
|
||||
SWITCH_DECLARE(const char *)get_data(void);
|
||||
};
|
||||
class Stream {
|
||||
protected:
|
||||
switch_stream_handle_t mystream;
|
||||
switch_stream_handle_t *stream_p;
|
||||
int mine;
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR Stream(void);
|
||||
SWITCH_DECLARE_CONSTRUCTOR Stream(switch_stream_handle_t *);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~ Stream();
|
||||
SWITCH_DECLARE(void) write(const char *data);
|
||||
SWITCH_DECLARE(const char *) get_data(void);
|
||||
};
|
||||
|
||||
class Event {
|
||||
protected:
|
||||
public:
|
||||
switch_event_t *event;
|
||||
char *serialized_string;
|
||||
int mine;
|
||||
class Event {
|
||||
protected:
|
||||
public:
|
||||
switch_event_t *event;
|
||||
char *serialized_string;
|
||||
int mine;
|
||||
|
||||
SWITCH_DECLARE_CONSTRUCTOR Event(const char *type, const char *subclass_name = NULL);
|
||||
SWITCH_DECLARE_CONSTRUCTOR Event(switch_event_t *wrap_me, int free_me=0);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~Event();
|
||||
SWITCH_DECLARE(const char *)serialize(const char *format=NULL);
|
||||
SWITCH_DECLARE(bool) setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
|
||||
SWITCH_DECLARE(const char *)getHeader(char *header_name);
|
||||
SWITCH_DECLARE(char *)getBody(void);
|
||||
SWITCH_DECLARE(const char *)getType(void);
|
||||
SWITCH_DECLARE(bool) addBody(const char *value);
|
||||
SWITCH_DECLARE(bool) addHeader(const char *header_name, const char *value);
|
||||
SWITCH_DECLARE(bool) delHeader(const char *header_name);
|
||||
SWITCH_DECLARE(bool) fire(void);
|
||||
|
||||
};
|
||||
SWITCH_DECLARE_CONSTRUCTOR Event(const char *type, const char *subclass_name = NULL);
|
||||
SWITCH_DECLARE_CONSTRUCTOR Event(switch_event_t *wrap_me, int free_me = 0);
|
||||
virtual SWITCH_DECLARE_CONSTRUCTOR ~ Event();
|
||||
SWITCH_DECLARE(const char *) serialize(const char *format = NULL);
|
||||
SWITCH_DECLARE(bool) setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
|
||||
SWITCH_DECLARE(const char *) getHeader(char *header_name);
|
||||
SWITCH_DECLARE(char *) getBody(void);
|
||||
SWITCH_DECLARE(const char *) getType(void);
|
||||
SWITCH_DECLARE(bool) addBody(const char *value);
|
||||
SWITCH_DECLARE(bool) addHeader(const char *header_name, const char *value);
|
||||
SWITCH_DECLARE(bool) delHeader(const char *header_name);
|
||||
SWITCH_DECLARE(bool) fire(void);
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CoreSession {
|
||||
protected:
|
||||
switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
|
||||
// which has a language specific callback function
|
||||
switch_input_args_t *ap; // ptr to args .. (is this really needed?)
|
||||
switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
|
||||
// instead set them here first
|
||||
char *xml_cdr_text;
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
void store_file_handle(switch_file_handle_t *fh);
|
||||
void *on_hangup; // language specific callback function, cast as void *
|
||||
switch_file_handle_t local_fh;
|
||||
switch_file_handle_t *fhp;
|
||||
char dtmf_buf[512];
|
||||
class CoreSession {
|
||||
protected:
|
||||
switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
|
||||
// which has a language specific callback function
|
||||
switch_input_args_t *ap; // ptr to args .. (is this really needed?)
|
||||
switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
|
||||
// instead set them here first
|
||||
char *xml_cdr_text;
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
void store_file_handle(switch_file_handle_t *fh);
|
||||
void *on_hangup; // language specific callback function, cast as void *
|
||||
switch_file_handle_t local_fh;
|
||||
switch_file_handle_t *fhp;
|
||||
char dtmf_buf[512];
|
||||
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession();
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
|
||||
SWITCH_DECLARE_CONSTRUCTOR ~CoreSession();
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
unsigned int flags;
|
||||
int allocated;
|
||||
input_callback_state cb_state; // callback state, always pointed to by the buf
|
||||
// field in this->args
|
||||
switch_channel_state_t hook_state; // store hookstate for on_hangup callback
|
||||
public:
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession();
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
|
||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
|
||||
SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
unsigned int flags;
|
||||
int allocated;
|
||||
input_callback_state cb_state; // callback state, always pointed to by the buf
|
||||
// field in this->args
|
||||
switch_channel_state_t hook_state; // store hookstate for on_hangup callback
|
||||
|
||||
SWITCH_DECLARE(int) answer();
|
||||
SWITCH_DECLARE(int) preAnswer();
|
||||
SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing");
|
||||
SWITCH_DECLARE(void) setVariable(char *var, char *val);
|
||||
SWITCH_DECLARE(void) setPrivate(char *var, void *val);
|
||||
SWITCH_DECLARE(void *)getPrivate(char *var);
|
||||
SWITCH_DECLARE(const char *)getVariable(char *var);
|
||||
SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
|
||||
SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
|
||||
SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
|
||||
SWITCH_DECLARE(int) answer();
|
||||
SWITCH_DECLARE(int) preAnswer();
|
||||
SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing");
|
||||
SWITCH_DECLARE(void) setVariable(char *var, char *val);
|
||||
SWITCH_DECLARE(void) setPrivate(char *var, void *val);
|
||||
SWITCH_DECLARE(void *) getPrivate(char *var);
|
||||
SWITCH_DECLARE(const char *) getVariable(char *var);
|
||||
SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
|
||||
SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
|
||||
SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
|
||||
|
||||
/** \brief Record to a file
|
||||
* \param file_name
|
||||
@@ -203,14 +185,14 @@ class CoreSession {
|
||||
* to be considered silence (500 is a good starting point).
|
||||
* \param <[silence_secs]> seconds of silence to interrupt the record.
|
||||
*/
|
||||
SWITCH_DECLARE(int) recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0);
|
||||
SWITCH_DECLARE(int) recordFile(char *file_name, int max_len = 0, int silence_threshold = 0, int silence_secs = 0);
|
||||
|
||||
|
||||
/** \brief Set attributes of caller data for purposes of outgoing calls
|
||||
* \param var - the variable name, eg, "caller_id_name"
|
||||
* \param val - the data to set, eg, "bob"
|
||||
*/
|
||||
SWITCH_DECLARE(void) setCallerData(char *var, char *val);
|
||||
SWITCH_DECLARE(void) setCallerData(char *var, char *val);
|
||||
|
||||
/** \brief Originate a call to a destination
|
||||
*
|
||||
@@ -222,9 +204,7 @@ class CoreSession {
|
||||
* \return an int status code indicating success or failure
|
||||
*
|
||||
*/
|
||||
SWITCH_DECLARE(int) originate(CoreSession *a_leg_session,
|
||||
char *dest,
|
||||
int timeout=60);
|
||||
SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
|
||||
|
||||
|
||||
/** \brief set a DTMF callback function
|
||||
@@ -235,16 +215,16 @@ class CoreSession {
|
||||
* certain other methods are executing.
|
||||
*
|
||||
*/
|
||||
SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs);
|
||||
SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs);
|
||||
|
||||
SWITCH_DECLARE(int) speak(char *text);
|
||||
SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name);
|
||||
SWITCH_DECLARE(int) speak(char *text);
|
||||
SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name);
|
||||
|
||||
/**
|
||||
* For timeout milliseconds, call the dtmf function set previously
|
||||
* by setDTMFCallback whenever a dtmf or event is received
|
||||
*/
|
||||
SWITCH_DECLARE(int) collectDigits(int timeout);
|
||||
SWITCH_DECLARE(int) collectDigits(int timeout);
|
||||
|
||||
/**
|
||||
* Collect up to maxdigits digits worth of digits
|
||||
@@ -253,20 +233,13 @@ class CoreSession {
|
||||
* (see mod_python.i). This does NOT call any callbacks upon
|
||||
* receiving dtmf digits. For that, use collectDigits.
|
||||
*/
|
||||
SWITCH_DECLARE(char *) getDigits(
|
||||
int maxdigits,
|
||||
char *terminators,
|
||||
int timeout);
|
||||
|
||||
SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
|
||||
SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout);
|
||||
|
||||
SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/** \brief Play a file into channel and collect dtmfs
|
||||
*
|
||||
* See API docs in switch_ivr.h: switch_play_and_get_digits(..)
|
||||
@@ -275,14 +248,10 @@ class CoreSession {
|
||||
* setDTMFCallback(..) as it uses its own internal callback
|
||||
* handler.
|
||||
*/
|
||||
SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
|
||||
int max_digits,
|
||||
int max_tries,
|
||||
int timeout,
|
||||
char *terminators,
|
||||
char *audio_files,
|
||||
char *bad_input_audio_files,
|
||||
char *digits_regex);
|
||||
SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
|
||||
int max_digits,
|
||||
int max_tries,
|
||||
int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex);
|
||||
|
||||
/** \brief Play a file that resides on disk into the channel
|
||||
*
|
||||
@@ -292,53 +261,56 @@ class CoreSession {
|
||||
* \return an int status code indicating success or failure
|
||||
*
|
||||
*/
|
||||
SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count=0);
|
||||
SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count = 0);
|
||||
|
||||
/** \brief flush any pending events
|
||||
*/
|
||||
SWITCH_DECLARE(int) flushEvents();
|
||||
SWITCH_DECLARE(int) flushEvents();
|
||||
|
||||
/** \brief flush any pending digits
|
||||
*/
|
||||
SWITCH_DECLARE(int) flushDigits();
|
||||
SWITCH_DECLARE(int) flushDigits();
|
||||
|
||||
SWITCH_DECLARE(int) setAutoHangup(bool val);
|
||||
SWITCH_DECLARE(int) setAutoHangup(bool val);
|
||||
|
||||
/** \brief Set the hangup callback function
|
||||
* \param hangup_func - language specific function ptr cast into void *
|
||||
*/
|
||||
SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
|
||||
SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
|
||||
|
||||
SWITCH_DECLARE(bool) ready();
|
||||
SWITCH_DECLARE(bool) ready();
|
||||
|
||||
SWITCH_DECLARE(void) execute(char *app, char *data=NULL);
|
||||
SWITCH_DECLARE(void) execute(char *app, char *data = NULL);
|
||||
|
||||
SWITCH_DECLARE(void) sendEvent(Event *sendME);
|
||||
SWITCH_DECLARE(void) sendEvent(Event * sendME);
|
||||
|
||||
SWITCH_DECLARE(void) setEventData(Event *e);
|
||||
SWITCH_DECLARE(char *) getXMLCDR();
|
||||
SWITCH_DECLARE(void) setEventData(Event * e);
|
||||
SWITCH_DECLARE(char *) getXMLCDR();
|
||||
|
||||
virtual bool begin_allow_threads() = 0;
|
||||
virtual bool end_allow_threads() = 0;
|
||||
virtual bool begin_allow_threads() = 0;
|
||||
virtual bool end_allow_threads() = 0;
|
||||
|
||||
/** \brief Get the uuid of this session
|
||||
* \return the uuid of this session
|
||||
*/
|
||||
char* get_uuid() const { return uuid; };
|
||||
char *get_uuid() const {
|
||||
return uuid;
|
||||
};
|
||||
|
||||
/** \brief Get the callback function arguments associated with this session
|
||||
* \return a const reference to the callback function arguments
|
||||
*/
|
||||
const switch_input_args_t& get_cb_args() const { return args; };
|
||||
const switch_input_args_t &get_cb_args() const {
|
||||
return args;
|
||||
};
|
||||
|
||||
/** \brief Callback to the language specific hangup callback
|
||||
*/
|
||||
virtual void check_hangup_hook() = 0;
|
||||
virtual void check_hangup_hook() = 0;
|
||||
|
||||
virtual switch_status_t run_dtmf_callback(void *input,
|
||||
switch_input_type_t itype) = 0;
|
||||
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/* ---- functions not bound to CoreSession instance ----- */
|
||||
@@ -351,7 +323,7 @@ SWITCH_DECLARE(void) console_clean_log(char *msg);
|
||||
* NOTE: the stuff regarding the dtmf callback might be completely
|
||||
* wrong and has not been reviewed or tested
|
||||
*/
|
||||
SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b);
|
||||
SWITCH_DECLARE(void) bridge(CoreSession & session_a, CoreSession & session_b);
|
||||
|
||||
|
||||
/** \brief the actual hangup hook called back by freeswitch core
|
||||
@@ -360,11 +332,8 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b);
|
||||
*/
|
||||
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session);
|
||||
|
||||
SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
|
||||
void *input,
|
||||
switch_input_type_t itype,
|
||||
void *buf,
|
||||
unsigned int buflen);
|
||||
SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
|
||||
void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -382,4 +351,3 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
||||
*/
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ 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, char *header_name);
|
||||
_Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
|
||||
|
||||
#define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
|
||||
|
||||
@@ -292,7 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, con
|
||||
#endif
|
||||
SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const char *in);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
|
||||
_In_z_ const char *proto, _In_z_ const char *login,
|
||||
_In_z_ const char *from, _In_z_ const char *from_domain,
|
||||
_In_z_ const char *status, _In_z_ const char *event_type,
|
||||
@@ -344,7 +344,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event);
|
||||
*/
|
||||
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data)
|
||||
|
||||
SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix,switch_hash_t* vars_map);
|
||||
SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
|
||||
|
||||
///\}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
/*! \brief An abstraction of a data frame */
|
||||
struct switch_frame {
|
||||
struct switch_frame {
|
||||
/*! a pointer to the codec information */
|
||||
switch_codec_t *codec;
|
||||
/*! the originating source of the frame */
|
||||
|
||||
+74
-90
@@ -41,9 +41,7 @@
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
struct switch_unicast_conninfo {
|
||||
SWITCH_BEGIN_EXTERN_C struct switch_unicast_conninfo {
|
||||
switch_core_session_t *session;
|
||||
switch_codec_t read_codec;
|
||||
switch_frame_t write_frame;
|
||||
@@ -73,13 +71,10 @@ typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
|
||||
char *local_ip,
|
||||
switch_port_t local_port,
|
||||
char *remote_ip,
|
||||
switch_port_t remote_port,
|
||||
char *transport,
|
||||
char *flags);
|
||||
char *remote_ip, switch_port_t remote_port, char *transport, char *flags);
|
||||
|
||||
/*!
|
||||
\brief Generate an XML CDR report.
|
||||
@@ -88,7 +83,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
\note on success the xml object must be freed
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t * xml_cdr);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr);
|
||||
SWITCH_DECLARE(int) switch_ivr_set_xml_profile_data(switch_xml_t xml, switch_caller_profile_t *caller_profile, int off);
|
||||
SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channel_t *channel, int off);
|
||||
|
||||
@@ -143,11 +138,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
|
||||
char *buf,
|
||||
switch_size_t buflen,
|
||||
switch_size_t maxdigits,
|
||||
const char *terminators, char *terminator,
|
||||
uint32_t first_timeout,
|
||||
uint32_t digit_timeout,
|
||||
uint32_t abs_timeout);
|
||||
switch_size_t maxdigits,
|
||||
const char *terminators, char *terminator,
|
||||
uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout);
|
||||
|
||||
/*!
|
||||
\brief Engage background Speech detection on a session
|
||||
@@ -161,9 +154,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
||||
const char *mod_name,
|
||||
const char *grammar,
|
||||
const char *path,
|
||||
const char *dest, switch_asr_handle_t *ah);
|
||||
const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah);
|
||||
|
||||
/*!
|
||||
\brief Stop background Speech detection on a session
|
||||
@@ -221,10 +212,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
||||
\param flags tweak read-mux, write-mux and dtmf
|
||||
\return SWITCH_STATUS_SUCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
||||
const char *uuid,
|
||||
const char *require_group,
|
||||
switch_eavesdrop_flag_t flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
|
||||
const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief displace the media for a session with the audio from a file
|
||||
@@ -307,10 +296,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_
|
||||
\param data optional data for appliaction
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
|
||||
const char *key, const char *tone_spec,
|
||||
const char *flags, time_t timeout,
|
||||
const char *app, const char *data);
|
||||
const char *flags, time_t timeout, const char *app, const char *data);
|
||||
|
||||
|
||||
|
||||
@@ -322,7 +310,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
|
||||
\param args arguements to pass for callbacks etc
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file,
|
||||
switch_input_args_t *args);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
|
||||
|
||||
@@ -337,9 +326,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session,
|
||||
_In_ switch_file_handle_t *fh,
|
||||
_In_z_ const char *file,
|
||||
_In_opt_ switch_input_args_t *args,
|
||||
_In_ uint32_t limit);
|
||||
_In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -407,8 +394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
const switch_state_handler_table_t *table,
|
||||
const char *cid_name_override,
|
||||
const char *cid_num_override,
|
||||
switch_caller_profile_t *caller_profile_override,
|
||||
switch_originate_flag_t flags);
|
||||
switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Bridge Audio from one session to another
|
||||
@@ -439,7 +425,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
||||
\param dialplan the new dialplan (OPTIONAL, may be NULL)
|
||||
\param context the new context (OPTIONAL, may be NULL)
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan, const char *context);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan,
|
||||
const char *context);
|
||||
|
||||
/*!
|
||||
\brief Transfer an existing session to another location in the future
|
||||
@@ -560,14 +547,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session
|
||||
\param parser a pointer to the object pointer
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser);
|
||||
|
||||
/*!
|
||||
\brief Destroy a digit stream parser object
|
||||
\param parser a pointer to the parser object
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t * parser);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t *parser);
|
||||
|
||||
/*!
|
||||
\brief Create a new digit stream object
|
||||
@@ -575,14 +562,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_iv
|
||||
\param stream a pointer to the stream object pointer
|
||||
\return NULL if no match found or consumer data that was associated with a given digit string when matched
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t ** stream);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream);
|
||||
|
||||
/*!
|
||||
\brief Destroys a digit stream object
|
||||
\param stream a pointer to the stream object
|
||||
\return NULL if no match found or consumer data that was associated with a given digit string when matched
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t * stream);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t *stream);
|
||||
|
||||
/*!
|
||||
\brief Set a digit string to action mapping
|
||||
@@ -591,7 +578,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit
|
||||
\param data consumer data attached to this digit string
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t * parser, char *digits, void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data);
|
||||
|
||||
/*!
|
||||
\brief Delete a string to action mapping
|
||||
@@ -599,7 +586,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_
|
||||
\param digits the digit string to be removed from the map
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t * parser, char *digits);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t *parser, char *digits);
|
||||
|
||||
/*!
|
||||
\brief Feed digits collected into the stream for event match testing
|
||||
@@ -608,14 +595,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_
|
||||
\param digit a digit to collect and test against the map of digit strings
|
||||
\return NULL if no match found or consumer data that was associated with a given digit string when matched
|
||||
*/
|
||||
SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t * stream, char digit);
|
||||
SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t *stream, char digit);
|
||||
|
||||
/*!
|
||||
\brief Reset the collected digit stream to nothing
|
||||
\param stream a pointer to the parser stream object created by switch_ivr_digit_stream_new
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t * stream);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream);
|
||||
|
||||
/*!
|
||||
\brief Set a digit string terminator
|
||||
@@ -623,7 +610,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_s
|
||||
\param digit the terminator digit
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t * parser, char digit);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t *parser, char digit);
|
||||
|
||||
|
||||
/******************************************************************************************************/
|
||||
@@ -655,7 +642,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
SWITCH_IVR_ACTION_NOOP /* No operation */
|
||||
} switch_ivr_action_t;
|
||||
struct switch_ivr_menu;
|
||||
typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *);
|
||||
typedef switch_ivr_action_t switch_ivr_menu_action_function_t (struct switch_ivr_menu *, char *, char *, size_t, void *);
|
||||
typedef struct switch_ivr_menu switch_ivr_menu_t;
|
||||
typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
|
||||
/******************************************************************************************************/
|
||||
@@ -680,20 +667,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\return SWITCH_STATUS_SUCCESS if the menu was created.
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
|
||||
switch_ivr_menu_t * main,
|
||||
const char *name,
|
||||
const char *greeting_sound,
|
||||
const char *short_greeting_sound,
|
||||
const char *invalid_sound,
|
||||
const char *exit_sound,
|
||||
const char *confirm_macro,
|
||||
const char *confirm_key,
|
||||
int confirm_attempts,
|
||||
int inter_timeout,
|
||||
int digit_len,
|
||||
int timeout, int max_failures,
|
||||
switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu,
|
||||
switch_ivr_menu_t *main,
|
||||
const char *name,
|
||||
const char *greeting_sound,
|
||||
const char *short_greeting_sound,
|
||||
const char *invalid_sound,
|
||||
const char *exit_sound,
|
||||
const char *confirm_macro,
|
||||
const char *confirm_key,
|
||||
int confirm_attempts,
|
||||
int inter_timeout, int digit_len, int timeout, int max_failures, switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
|
||||
@@ -703,7 +687,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
|
||||
*\param bind KeyStrokes to bind the action to.
|
||||
*\return SWUTCH_STATUS_SUCCESS if the action was binded
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t * menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
|
||||
const char *bind);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -717,8 +702,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *
|
||||
*\note The function returns an switch_ivr_action_t enum of what you want to do. and looks to your buffer for args.
|
||||
*\return SWUTCH_STATUS_SUCCESS if the function was binded
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t * menu,
|
||||
switch_ivr_menu_action_function_t * function, const char *arg, const char *bind);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu,
|
||||
switch_ivr_menu_action_function_t *function, const char *arg, const char *bind);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -729,14 +714,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t
|
||||
*\param obj A void pointer to an object you want to make avaliable to your callback functions that you may have binded with switch_ivr_menu_bind_function.
|
||||
*\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t * stack, char *name, void *obj);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t *stack, char *name, void *obj);
|
||||
|
||||
/*!
|
||||
*\brief free a stack of menu objects.
|
||||
*\param stack The top level menu you wish to destroy.
|
||||
*\return SWITCH_STATUS_SUCCESS if the object was a top level menu and it was freed
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t * stack);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack);
|
||||
|
||||
struct switch_ivr_menu_xml_ctx;
|
||||
typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
|
||||
@@ -748,10 +733,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t * s
|
||||
*\param xml_menu The xml Menu source of the menu to be created
|
||||
*\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
|
||||
switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
||||
switch_ivr_menu_t **menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
|
||||
|
||||
/*!
|
||||
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
|
||||
@@ -759,46 +744,45 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_na
|
||||
*\param function The menu function callback that will be executed when menu digits are bound to this name
|
||||
*\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
|
||||
const char *name, switch_ivr_menu_action_function_t * function);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
||||
const char *name, switch_ivr_menu_action_function_t *function);
|
||||
|
||||
/*!
|
||||
*\param xml_menu_ctx A pointer of a XML menu parser context to be created
|
||||
*\param pool memory pool (NULL to create one)
|
||||
*\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t ** xml_menu_ctx, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t **xml_menu_ctx, switch_memory_pool_t *pool);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
|
||||
switch_input_args_t *args);
|
||||
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
|
||||
SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
|
||||
SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
|
||||
switch_input_args_t *args);
|
||||
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
|
||||
SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
|
||||
SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
||||
uint32_t min_digits,
|
||||
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);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
||||
uint32_t min_digits,
|
||||
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);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
|
||||
switch_bind_flag_t bind_flags, const char *app);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
|
||||
switch_bind_flag_t bind_flags, const char *app);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
|
||||
const char *say_method, switch_input_args_t *args);
|
||||
|
||||
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
|
||||
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
|
||||
SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
|
||||
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
|
||||
|
||||
/** @} */
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -128,9 +128,8 @@ SWITCH_DECLARE(switch_dialplan_interface_t *) switch_loadable_module_get_dialpla
|
||||
SWITCH_DECLARE(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);
|
||||
|
||||
switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Retrieve the timer interface by it's registered name
|
||||
@@ -259,7 +258,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
|
||||
\param filename the path to the module's dll or so file
|
||||
\return SWITCH_STATUS_SUCCESS on a successful load
|
||||
*/
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load( switch_loadable_module_interface_t **module_interface, char *filename);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(switch_loadable_module_interface_t **module_interface, char *filename);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void);
|
||||
|
||||
/*!
|
||||
@@ -317,44 +316,43 @@ SWITCH_DECLARE(uint32_t) switch_core_codec_next_id(void);
|
||||
}
|
||||
|
||||
|
||||
static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool,
|
||||
switch_codec_interface_t *codec_interface,
|
||||
/*! enumeration defining the type of the codec */
|
||||
const switch_codec_type_t codec_type,
|
||||
/*! the IANA code number */
|
||||
switch_payload_t ianacode,
|
||||
/*! the IANA code name */
|
||||
const char *iananame,
|
||||
/*! default fmtp to send (can be overridden by the init function) */
|
||||
char *fmtp,
|
||||
/*! samples transferred per second */
|
||||
uint32_t samples_per_second,
|
||||
/*! 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 that denote one frame */
|
||||
int microseconds_per_frame,
|
||||
/*! number of samples that denote one frame */
|
||||
uint32_t samples_per_frame,
|
||||
/*! number of bytes that denote one frame decompressed */
|
||||
uint32_t bytes_per_frame,
|
||||
/*! number of bytes that denote one frame compressed */
|
||||
uint32_t encoded_bytes_per_frame,
|
||||
/*! number of channels represented */
|
||||
uint8_t number_of_channels,
|
||||
/*! number of frames to send in one netowrk packet */
|
||||
int pref_frames_per_packet,
|
||||
/*! max number of frames to send in one network packet */
|
||||
int max_frames_per_packet,
|
||||
/*! function to initialize a codec handle using this implementation */
|
||||
switch_core_codec_init_func_t init,
|
||||
/*! function to encode raw data into encoded data */
|
||||
switch_core_codec_encode_func_t encode,
|
||||
/*! function to decode encoded data into raw data */
|
||||
switch_core_codec_decode_func_t decode,
|
||||
/*! deinitalize a codec handle using this implementation */
|
||||
switch_core_codec_destroy_func_t destroy)
|
||||
static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool, switch_codec_interface_t *codec_interface,
|
||||
/*! enumeration defining the type of the codec */
|
||||
const switch_codec_type_t codec_type,
|
||||
/*! the IANA code number */
|
||||
switch_payload_t ianacode,
|
||||
/*! the IANA code name */
|
||||
const char *iananame,
|
||||
/*! default fmtp to send (can be overridden by the init function) */
|
||||
char *fmtp,
|
||||
/*! samples transferred per second */
|
||||
uint32_t samples_per_second,
|
||||
/*! 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 that denote one frame */
|
||||
int microseconds_per_frame,
|
||||
/*! number of samples that denote one frame */
|
||||
uint32_t samples_per_frame,
|
||||
/*! number of bytes that denote one frame decompressed */
|
||||
uint32_t bytes_per_frame,
|
||||
/*! number of bytes that denote one frame compressed */
|
||||
uint32_t encoded_bytes_per_frame,
|
||||
/*! number of channels represented */
|
||||
uint8_t number_of_channels,
|
||||
/*! number of frames to send in one netowrk packet */
|
||||
int pref_frames_per_packet,
|
||||
/*! max number of frames to send in one network packet */
|
||||
int max_frames_per_packet,
|
||||
/*! function to initialize a codec handle using this implementation */
|
||||
switch_core_codec_init_func_t init,
|
||||
/*! function to encode raw data into encoded data */
|
||||
switch_core_codec_encode_func_t encode,
|
||||
/*! function to decode encoded data into raw data */
|
||||
switch_core_codec_decode_func_t decode,
|
||||
/*! deinitalize a codec handle using this implementation */
|
||||
switch_core_codec_destroy_func_t destroy)
|
||||
{
|
||||
if (codec_type == SWITCH_CODEC_TYPE_VIDEO || SWITCH_ACCEPTABLE_INTERVAL(microseconds_per_frame / 1000)) {
|
||||
switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl));
|
||||
|
||||
@@ -111,7 +111,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(_In_ switch_log_function_
|
||||
\param level the level
|
||||
\return the name of the log level
|
||||
*/
|
||||
_Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
|
||||
_Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
|
||||
|
||||
/*!
|
||||
\brief Return the level number of the specified log level name
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
/*! \brief A table of functions to execute at various states
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
SWITCH_SHN_ON_INIT,
|
||||
SWITCH_SHN_ON_ROUTING,
|
||||
SWITCH_SHN_ON_EXECUTE,
|
||||
@@ -100,7 +99,31 @@ struct switch_io_event_hooks;
|
||||
|
||||
|
||||
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_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
|
||||
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);
|
||||
@@ -108,9 +131,9 @@ typedef switch_status_t (*switch_io_send_dtmf_t) (switch_core_session_t *, const
|
||||
typedef switch_status_t (*switch_io_receive_message_t) (switch_core_session_t *, switch_core_session_message_t *);
|
||||
typedef switch_status_t (*switch_io_receive_event_t) (switch_core_session_t *, switch_event_t *);
|
||||
typedef switch_status_t (*switch_io_state_change_t) (switch_core_session_t *);
|
||||
typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_io_write_video_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
|
||||
typedef switch_call_cause_t (*switch_io_resurrect_session_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
|
||||
typedef switch_call_cause_t (*switch_io_resurrect_session_t) (switch_core_session_t **, switch_memory_pool_t **, void *);
|
||||
|
||||
typedef enum {
|
||||
SWITCH_IO_OUTGOING_CHANNEL,
|
||||
@@ -192,7 +215,7 @@ struct switch_timer {
|
||||
switch_memory_pool_t *memory_pool;
|
||||
/*! private data for loadable modules to store information */
|
||||
void *private_info;
|
||||
/*! remaining time from last call to _check()*/
|
||||
/*! remaining time from last call to _check() */
|
||||
switch_size_t diff;
|
||||
switch_size_t tick;
|
||||
};
|
||||
@@ -346,7 +369,7 @@ struct switch_asr_handle {
|
||||
/*! The Rate */
|
||||
uint32_t rate;
|
||||
char *grammar;
|
||||
/*! module specific param*/
|
||||
/*! module specific param */
|
||||
char *param;
|
||||
/*! the handle's memory pool */
|
||||
switch_memory_pool_t *memory_pool;
|
||||
@@ -365,7 +388,7 @@ struct switch_speech_interface {
|
||||
/*! function to feed audio to the ASR */
|
||||
switch_status_t (*speech_feed_tts) (switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
|
||||
/*! function to read audio from the TTS */
|
||||
switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags);
|
||||
switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
|
||||
void (*speech_flush_tts) (switch_speech_handle_t *sh);
|
||||
void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, const char *val);
|
||||
void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
|
||||
@@ -389,7 +412,7 @@ struct switch_speech_handle {
|
||||
uint32_t samples;
|
||||
char voice[80];
|
||||
char *engine;
|
||||
/*! module specific param*/
|
||||
/*! module specific param */
|
||||
char *param;
|
||||
/*! the handle's memory pool */
|
||||
switch_memory_pool_t *memory_pool;
|
||||
@@ -526,7 +549,7 @@ struct switch_codec_implementation {
|
||||
char *fmtp;
|
||||
/*! samples transferred per second */
|
||||
uint32_t samples_per_second;
|
||||
/*! actual samples transferred per second for those who are not moron g722 RFC writers*/
|
||||
/*! 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;
|
||||
@@ -545,13 +568,13 @@ struct switch_codec_implementation {
|
||||
/*! max number of frames to send in one network packet */
|
||||
int max_frames_per_packet;
|
||||
/*! function to initialize a codec handle using this implementation */
|
||||
switch_core_codec_init_func_t init;
|
||||
switch_core_codec_init_func_t init;
|
||||
/*! function to encode raw data into encoded data */
|
||||
switch_core_codec_encode_func_t encode;
|
||||
switch_core_codec_encode_func_t encode;
|
||||
/*! function to decode encoded data into raw data */
|
||||
switch_core_codec_decode_func_t decode;
|
||||
switch_core_codec_decode_func_t decode;
|
||||
/*! deinitalize a codec handle using this implementation */
|
||||
switch_core_codec_destroy_func_t destroy;
|
||||
switch_core_codec_destroy_func_t destroy;
|
||||
uint32_t codec_id;
|
||||
struct switch_codec_implementation *next;
|
||||
};
|
||||
|
||||
@@ -44,9 +44,7 @@
|
||||
#endif
|
||||
#include <sqltypes.h>
|
||||
|
||||
SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
struct switch_odbc_handle;
|
||||
SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
|
||||
|
||||
typedef enum {
|
||||
SWITCH_ODBC_STATE_INIT,
|
||||
@@ -70,7 +68,6 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
|
||||
char *sql, switch_core_db_callback_func_t callback, void *pdata);
|
||||
SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -59,21 +59,16 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* C4610: struct can never be instantiated - user defined constructor required
|
||||
*/
|
||||
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
|
||||
|
||||
#define SWITCH_HAVE_ODBC 1
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma comment(lib, "odbc32.lib")
|
||||
#endif
|
||||
|
||||
#pragma include_alias(<libteletone.h>, <../../libs/libteletone/src/libteletone.h>)
|
||||
#pragma include_alias(<libteletone_generate.h>, <../../libs/libteletone/src/libteletone_generate.h>)
|
||||
#pragma include_alias(<libteletone_detect.h>, <../../libs/libteletone/src/libteletone_detect.h>)
|
||||
|
||||
#if (_MSC_VER >= 1400) // VC8+
|
||||
#define switch_assert(expr) assert(expr);__analysis_assume( expr )
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1400) // VC8+
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
@@ -90,7 +85,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#undef inline
|
||||
#define inline __inline
|
||||
#ifndef uint32_t
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
@@ -187,9 +182,9 @@ typedef int gid_t;
|
||||
#define PRINTF_FUNCTION(fmtstr,vars)
|
||||
#endif
|
||||
#ifdef SWITCH_INT32
|
||||
typedef SWITCH_INT32 switch_int32_t;
|
||||
typedef SWITCH_INT32 switch_int32_t;
|
||||
#else
|
||||
typedef int32_t switch_int32_t;
|
||||
typedef int32_t switch_int32_t;
|
||||
#endif
|
||||
|
||||
#ifdef SWITCH_SIZE_T
|
||||
@@ -298,10 +293,9 @@ SWITCH_END_EXTERN_C
|
||||
#ifndef switch_assert
|
||||
#define switch_assert(expr) assert(expr)
|
||||
#endif
|
||||
|
||||
#ifndef __ATTR_SAL
|
||||
/* used for msvc code analysis */
|
||||
/* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
|
||||
/* used for msvc code analysis */
|
||||
/* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
|
||||
#define _In_
|
||||
#define _In_z_
|
||||
#define _In_opt_z_
|
||||
@@ -324,8 +318,6 @@ SWITCH_END_EXTERN_C
|
||||
#define _Out_ptrdiff_cap_(x)
|
||||
#define _Out_opt_ptrdiff_cap_(x)
|
||||
#endif
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
||||
+10
-22
@@ -45,9 +45,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_RTP_KEY_LEN 30
|
||||
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
|
||||
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
|
||||
|
||||
|
||||
typedef enum {
|
||||
typedef enum {
|
||||
SWITCH_RTP_CRYPTO_SEND,
|
||||
SWITCH_RTP_CRYPTO_RECV,
|
||||
SWITCH_RTP_CRYPTO_MAX
|
||||
@@ -72,16 +70,13 @@ typedef struct switch_rtp_crypto_key switch_rtp_crypto_key_t;
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
|
||||
switch_rtp_crypto_direction_t direction,
|
||||
uint32_t index,
|
||||
switch_rtp_crypto_key_type_t type,
|
||||
unsigned char *key,
|
||||
switch_size_t keylen);
|
||||
uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen);
|
||||
|
||||
///\defgroup rtp RTP (RealTime Transport Protocol)
|
||||
///\ingroup core1
|
||||
///\{
|
||||
typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
|
||||
switch_socket_t * sock, void *data, switch_size_t datalen, switch_sockaddr_t * from_addr);
|
||||
typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
|
||||
switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr);
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
|
||||
@@ -130,10 +125,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
|
||||
switch_payload_t payload,
|
||||
uint32_t samples_per_interval,
|
||||
uint32_t ms_per_packet,
|
||||
switch_rtp_flag_t flags,
|
||||
char *timer_name,
|
||||
const char **err,
|
||||
switch_memory_pool_t *pool);
|
||||
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -158,10 +150,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
|
||||
switch_payload_t payload,
|
||||
uint32_t samples_per_interval,
|
||||
uint32_t ms_per_packet,
|
||||
switch_rtp_flag_t flags,
|
||||
char *timer_name,
|
||||
const char **err,
|
||||
switch_memory_pool_t *pool);
|
||||
switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -296,7 +285,7 @@ SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp_t *rtp_session, sw
|
||||
\param io_flags i/o flags
|
||||
\return the number of bytes read
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t * datalen,
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
|
||||
switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
|
||||
|
||||
/*!
|
||||
@@ -341,7 +330,8 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session,
|
||||
\return the number of bytes read
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
|
||||
void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
|
||||
void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
|
||||
switch_io_flag_t io_flags);
|
||||
|
||||
/*!
|
||||
\brief Read data from a given RTP session without copying
|
||||
@@ -390,9 +380,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
||||
\return the number of bytes written
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
||||
void *data,
|
||||
uint32_t datalen,
|
||||
uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
|
||||
void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the SSRC from a given RTP session
|
||||
|
||||
@@ -137,7 +137,7 @@ SWITCH_DECLARE(void) switch_stun_random_string(char *buf, uint16_t len, char *se
|
||||
\param len the length of the data
|
||||
\return a stun packet pointer to buf to use as an access point
|
||||
*/
|
||||
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t * buf, uint32_t len);
|
||||
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, uint32_t len);
|
||||
|
||||
/*!
|
||||
\brief Obtain a printable string form of a given value
|
||||
@@ -155,7 +155,7 @@ SWITCH_DECLARE(const char *) switch_stun_value_to_name(int32_t type, uint32_t va
|
||||
\param port the port
|
||||
\return true or false
|
||||
*/
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t * port);
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port);
|
||||
|
||||
/*!
|
||||
\brief Extract a username from a packet attribute
|
||||
@@ -174,7 +174,7 @@ SWITCH_DECLARE(char *) switch_stun_packet_attribute_get_username(switch_stun_pac
|
||||
\param buf a pointer to data to use for the packet
|
||||
\return a pointer to a ready-to-use stun packet
|
||||
*/
|
||||
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t * buf);
|
||||
SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t *buf);
|
||||
|
||||
/*!
|
||||
\brief Add a username packet attribute
|
||||
|
||||
+42
-49
@@ -91,11 +91,9 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
|
||||
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
|
||||
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
|
||||
|
||||
#define SWITCH_DEFAULT_DTMF_DURATION 2000
|
||||
#define SWITCH_MAX_DTMF_DURATION 192000
|
||||
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
|
||||
|
||||
#ifdef WIN32
|
||||
#define SWITCH_PATH_SEPARATOR "\\"
|
||||
#else
|
||||
@@ -144,7 +142,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_SPEECH_KEY "speech"
|
||||
#define SWITCH_UUID_BRIDGE "uuid_bridge"
|
||||
#define SWITCH_BITS_PER_BYTE 8
|
||||
typedef uint8_t switch_byte_t;
|
||||
typedef uint8_t switch_byte_t;
|
||||
|
||||
typedef struct {
|
||||
char digit;
|
||||
@@ -168,7 +166,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
SOF_NONE = 0,
|
||||
SOF_NOBLOCK = (1 << 0),
|
||||
SOF_FORKED_DIAL = (1 << 1)
|
||||
SOF_FORKED_DIAL = (1 << 1)
|
||||
} switch_originate_flag_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -185,7 +183,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
SCF_NONE = 0,
|
||||
SCF_USE_SQL = ( 1 << 0),
|
||||
SCF_USE_SQL = (1 << 0),
|
||||
SCF_NO_NEW_SESSIONS = (1 << 1),
|
||||
SCF_SHUTTING_DOWN = (1 << 2),
|
||||
SCF_CRASH_PROT = (1 << 3)
|
||||
@@ -320,10 +318,10 @@ SWITCH_DECLARE_DATA extern switch_directories SWITCH_GLOBAL_dirs;
|
||||
|
||||
#define SWITCH_MAX_STACKS 32
|
||||
#define SWITCH_THREAD_STACKSIZE 240 * 1024
|
||||
#define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
|
||||
#define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
|
||||
#define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
|
||||
#define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
|
||||
#define SWITCH_MAX_SAMPLE_LEN 32
|
||||
#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
|
||||
#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
|
||||
#define SWITCH_RECOMMENDED_BUFFER_SIZE (SWITCH_BYTES_PER_SAMPLE * SWITCH_MAX_SAMPLE_LEN * (SWITCH_MAX_INTERVAL + SWITCH_INTERVAL_PAD))
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
#define SWITCH_MAX_STATE_HANDLERS 30
|
||||
@@ -425,29 +423,29 @@ typedef enum {
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
typedef struct {
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
} switch_rtp_hdr_t;
|
||||
|
||||
#else /* BIG_ENDIAN */
|
||||
|
||||
typedef struct {
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
} switch_rtp_hdr_t;
|
||||
|
||||
#endif
|
||||
@@ -1210,25 +1208,19 @@ typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void
|
||||
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *decoded_data,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
uint32_t * encoded_data_len,
|
||||
uint32_t * encoded_rate,
|
||||
unsigned int *flag);
|
||||
switch_codec_t *other_codec,
|
||||
void *decoded_data,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
|
||||
|
||||
|
||||
typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *encoded_data,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
uint32_t * decoded_data_len,
|
||||
uint32_t * decoded_rate,
|
||||
unsigned int *flag);
|
||||
switch_codec_t *other_codec,
|
||||
void *encoded_data,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
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_destroy_func_t) (switch_codec_t *);
|
||||
@@ -1255,7 +1247,8 @@ typedef struct switch_stream_handle switch_stream_handle_t;
|
||||
typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...);
|
||||
typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);
|
||||
|
||||
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);
|
||||
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)
|
||||
|
||||
@@ -1274,9 +1267,9 @@ typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session
|
||||
char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *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,
|
||||
const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
|
||||
void *user_data);
|
||||
typedef switch_xml_t (*switch_xml_search_function_t) (const char *section,
|
||||
const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
|
||||
void *user_data);
|
||||
|
||||
typedef struct switch_hash switch_hash_t;
|
||||
struct HashElem;
|
||||
@@ -1290,9 +1283,9 @@ typedef struct switch_network_list switch_network_list_t;
|
||||
#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)
|
||||
typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS ;
|
||||
typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS ;
|
||||
typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS ;
|
||||
typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS;
|
||||
typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS;
|
||||
typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS;
|
||||
#define SWITCH_MODULE_LOAD_FUNCTION(name) switch_status_t name SWITCH_MODULE_LOAD_ARGS
|
||||
#define SWITCH_MODULE_RUNTIME_FUNCTION(name) switch_status_t name SWITCH_MODULE_RUNTIME_ARGS
|
||||
#define SWITCH_MODULE_SHUTDOWN_FUNCTION(name) switch_status_t name SWITCH_MODULE_SHUTDOWN_ARGS
|
||||
|
||||
+14
-15
@@ -54,15 +54,12 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#else
|
||||
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Test for NULL or zero length string
|
||||
\param s the string to test
|
||||
\return true value if the string is NULL or zero length
|
||||
*/
|
||||
#define switch_strlen_zero(s) (!s || *s == '\0')
|
||||
|
||||
|
||||
static inline switch_bool_t switch_is_moh(const char *s)
|
||||
{
|
||||
if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
|
||||
@@ -78,9 +75,10 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size
|
||||
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
|
||||
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
|
||||
|
||||
static inline switch_bool_t switch_is_digit_string(const char *s) {
|
||||
static inline switch_bool_t switch_is_digit_string(const char *s)
|
||||
{
|
||||
|
||||
while(s && *s) {
|
||||
while (s && *s) {
|
||||
if (*s < 48 || *s > 57) {
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
@@ -113,7 +111,8 @@ atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
|
||||
\param family the address family to return (AF_INET or AF_INET6)
|
||||
\return SWITCH_STATUS_SUCCESSS for success, otherwise failure
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) char *buf, _In_ int len, _In_ int family);
|
||||
SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len)
|
||||
char *buf, _In_ int len, _In_ int family);
|
||||
|
||||
/*!
|
||||
\brief find the char representation of an ip adress
|
||||
@@ -205,7 +204,7 @@ switch_mutex_unlock(obj->flag_mutex);
|
||||
|
||||
#define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
|
||||
|
||||
static inline char *switch_clean_string(char *s)
|
||||
static inline char *switch_clean_string(char *s)
|
||||
{
|
||||
char *p;
|
||||
for (p = s; p && *p; p++) {
|
||||
@@ -247,11 +246,11 @@ static inline switch_bool_t switch_strstr(char *s, char *q)
|
||||
}
|
||||
|
||||
S = strdup(s);
|
||||
|
||||
|
||||
assert(S != NULL);
|
||||
|
||||
for (p = S; p && *p; p++) {
|
||||
*p = (char)toupper(*p);
|
||||
*p = (char) toupper(*p);
|
||||
}
|
||||
|
||||
if (strstr(S, q)) {
|
||||
@@ -263,9 +262,9 @@ static inline switch_bool_t switch_strstr(char *s, char *q)
|
||||
assert(Q != NULL);
|
||||
|
||||
for (p = Q; p && *p; p++) {
|
||||
*p = (char)toupper(*p);
|
||||
*p = (char) toupper(*p);
|
||||
}
|
||||
|
||||
|
||||
if (strstr(s, Q)) {
|
||||
tf = SWITCH_TRUE;
|
||||
goto done;
|
||||
@@ -275,8 +274,8 @@ static inline switch_bool_t switch_strstr(char *s, char *q)
|
||||
tf = SWITCH_TRUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
done:
|
||||
switch_safe_free(S);
|
||||
switch_safe_free(Q);
|
||||
|
||||
@@ -345,7 +344,7 @@ SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t *pool, char *in,
|
||||
\param ms the number of milliseconds to wait
|
||||
\return the requested condition
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t * poll, int ms);
|
||||
SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
||||
|
||||
/*!
|
||||
\brief Create a pointer to the file name in a given file path eliminating the directory name
|
||||
@@ -369,7 +368,7 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network
|
||||
SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip(switch_network_list_t *list, uint32_t ip);
|
||||
#define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1)
|
||||
|
||||
int switch_inet_pton(int af, const char *src, void *dst);
|
||||
int switch_inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
/* malloc or DIE macros */
|
||||
#ifdef NDEBUG
|
||||
|
||||
@@ -184,7 +184,7 @@ SWITCH_DECLARE(const char *) switch_xml_attr_soft(switch_xml_t xml, const char *
|
||||
///\ Returns NULL if not found.
|
||||
///\param xml the xml node
|
||||
///\return an xml node or NULL
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml,...);
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml, ...);
|
||||
|
||||
///\brief Converts an switch_xml structure back to xml. Returns a string of xml data that
|
||||
///\ must be freed.
|
||||
@@ -234,7 +234,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name);
|
||||
///\param name the name of the tag
|
||||
///\param off the offset
|
||||
///\return an xml node or NULL
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off);
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off);
|
||||
|
||||
///\brief wrapper for switch_xml_add_child() that strdup()s name
|
||||
///\param xml the xml node
|
||||
@@ -247,7 +247,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name);
|
||||
///\param xml the xml node
|
||||
///\param txt the text
|
||||
///\return an xml node or NULL
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_set_txt(switch_xml_t xml, const char *txt);
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_set_txt(switch_xml_t xml, const char *txt);
|
||||
|
||||
///\brief wrapper for switch_xml_set_txt() that strdup()s txt
|
||||
///\ sets the character content for the given tag and returns the tag
|
||||
@@ -324,25 +324,22 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_root(void);
|
||||
///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
|
||||
const char *tag_name,
|
||||
const char *key_name, const char *key_value, switch_xml_t * root, switch_xml_t * node,
|
||||
const char *key_name, const char *key_value, switch_xml_t *root, switch_xml_t *node,
|
||||
switch_event_t *params);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain);
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
|
||||
const char *user_name,
|
||||
const char *domain_name,
|
||||
const char *ip,
|
||||
switch_xml_t *root,
|
||||
switch_xml_t *domain,
|
||||
switch_xml_t *user,
|
||||
switch_event_t *params);
|
||||
const char *user_name,
|
||||
const char *domain_name,
|
||||
const char *ip,
|
||||
switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, switch_event_t *params);
|
||||
|
||||
///\brief open a config in the core registry
|
||||
///\param file_path the name of the config section e.g. modules.conf
|
||||
///\param node a pointer to point to the node if it is found
|
||||
///\param params optional URL formatted params to pass to external gateways
|
||||
///\return the root xml node associated with the current request or NULL
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t * node, switch_event_t *params);
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params);
|
||||
|
||||
///\brief bind a search function to an external gateway
|
||||
///\param function the search function to bind
|
||||
|
||||
Reference in New Issue
Block a user