mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 20:51:58 +00:00
indent
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4798 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -143,7 +143,7 @@ struct switch_media_bug {
|
||||
struct switch_media_bug *next;
|
||||
};
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_sqldb_start(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(void) switch_core_sqldb_start(switch_memory_pool_t * pool);
|
||||
SWITCH_DECLARE(void) switch_core_sqldb_stop(void);
|
||||
SWITCH_DECLARE(void) switch_core_session_init(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(void) switch_core_session_init(switch_memory_pool_t * pool);
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_core_memory_init(void);
|
||||
|
||||
+79
-99
@@ -55,7 +55,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* @{
|
||||
*/
|
||||
/** The fundamental pool type */
|
||||
typedef struct apr_pool_t switch_memory_pool_t;
|
||||
typedef struct apr_pool_t switch_memory_pool_t;
|
||||
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* to re-use this memory for the next allocation.
|
||||
* @see apr_pool_destroy()
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p);
|
||||
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t * p);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -93,14 +93,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.
|
||||
@@ -108,8 +107,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.
|
||||
@@ -117,7 +115,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -165,7 +163,7 @@ SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_siz
|
||||
* 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.
|
||||
@@ -173,7 +171,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.
|
||||
@@ -184,7 +182,7 @@ 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);
|
||||
|
||||
/**
|
||||
* The default hash function.
|
||||
@@ -194,7 +192,7 @@ SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key,
|
||||
*/
|
||||
SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen);
|
||||
|
||||
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);
|
||||
|
||||
/** @} */
|
||||
/**
|
||||
@@ -252,7 +250,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
|
||||
@@ -262,9 +260,7 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, s
|
||||
* @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
|
||||
@@ -281,7 +277,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
|
||||
@@ -289,14 +285,14 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, s
|
||||
* @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.
|
||||
@@ -337,28 +333,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
|
||||
@@ -367,7 +362,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -380,15 +375,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -414,7 +408,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
|
||||
@@ -428,7 +422,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
|
||||
@@ -446,8 +440,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *co
|
||||
* 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
|
||||
@@ -456,7 +449,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.
|
||||
@@ -464,13 +457,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -497,20 +490,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -529,8 +522,7 @@ SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const cha
|
||||
* @param queue_capacity maximum size of the queue
|
||||
* @param 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 +533,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue,
|
||||
* @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 +544,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **d
|
||||
* @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 +554,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *d
|
||||
* @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 +566,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 +578,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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -684,17 +676,16 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
|
||||
* @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_memory_pool_t *pool);
|
||||
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 file 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);
|
||||
|
||||
/**
|
||||
* Delete the specified file.
|
||||
@@ -703,7 +694,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile);
|
||||
* @remark If the file is open, it won't be removed until all
|
||||
* instances are closed.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t * pool);
|
||||
|
||||
/**
|
||||
* Read data from the specified file.
|
||||
@@ -722,7 +713,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memo
|
||||
* @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.
|
||||
@@ -739,7 +730,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *b
|
||||
* @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(switch_status_t) switch_file_exists(const char *filename);
|
||||
|
||||
@@ -764,21 +755,21 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename);
|
||||
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);
|
||||
|
||||
/**
|
||||
* Create and initialize a new threadattr variable
|
||||
* @param new_attr The newly created threadattr.
|
||||
* @param cont 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
|
||||
@@ -788,9 +779,8 @@ 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_thread_start_t func, void *data,
|
||||
switch_memory_pool_t *cont);
|
||||
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);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -856,8 +846,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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.
|
||||
@@ -872,13 +861,13 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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
|
||||
@@ -887,7 +876,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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.
|
||||
@@ -896,7 +885,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -906,8 +895,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @param sock The socket we are listening on.
|
||||
* @param connection_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
|
||||
@@ -915,12 +903,12 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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(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(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);
|
||||
|
||||
|
||||
/**
|
||||
@@ -946,9 +934,8 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* </PRE>
|
||||
* @param p 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,
|
||||
int32_t family, switch_port_t port, int32_t flags,
|
||||
switch_memory_pool_t *pool);
|
||||
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);
|
||||
|
||||
/**
|
||||
* Send data over a network.
|
||||
@@ -967,7 +954,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -976,8 +963,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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
|
||||
@@ -987,9 +973,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1011,7 +995,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -1035,7 +1019,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* </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
|
||||
@@ -1048,7 +1032,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -1059,8 +1043,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* @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);
|
||||
|
||||
|
||||
|
||||
@@ -1101,8 +1084,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -1121,7 +1103,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -1136,8 +1118,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
* 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
|
||||
@@ -1147,8 +1128,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
\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);
|
||||
|
||||
|
||||
/** @} */
|
||||
@@ -1159,7 +1139,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_threa
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -72,11 +72,8 @@ static const uint8_t SWITCH_REVERSE_BITPACKED_MASKS[] = { 255, 254, 252, 248, 24
|
||||
\param buflen the length of the storage buffer
|
||||
\param mode RFC3551 or AAL2 mode (curse you backwards folks)
|
||||
*/
|
||||
DoxyDefine(void
|
||||
switch_bitpack_init(switch_bitpack_t *pack, int32_t bitlen, switch_byte_t *buf, uint32_t buflen,
|
||||
switch_bitpack_mode_t mode))
|
||||
static inline int8_t switch_bitpack_init(switch_bitpack_t *pack, switch_byte_t bitlen, switch_byte_t *buf,
|
||||
uint32_t buflen, switch_bitpack_mode_t mode)
|
||||
DoxyDefine(void switch_bitpack_init(switch_bitpack_t *pack, int32_t bitlen, switch_byte_t * buf, uint32_t buflen, switch_bitpack_mode_t mode))
|
||||
static inline int8_t switch_bitpack_init(switch_bitpack_t *pack, switch_byte_t bitlen, switch_byte_t * buf, uint32_t buflen, switch_bitpack_mode_t mode)
|
||||
{
|
||||
if (!pack || (bitlen > SWITCH_BITS_PER_BYTE) || !buf || !buflen) {
|
||||
return -1;
|
||||
|
||||
@@ -58,8 +58,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* \param max_len length required by the buffer
|
||||
* \return status
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t *pool, switch_buffer_t **buffer,
|
||||
switch_size_t max_len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t * pool, switch_buffer_t **buffer, switch_size_t max_len);
|
||||
|
||||
/*! \brief Allocate a new dynamic switch_buffer
|
||||
* \param buffer returned pointer to the new buffer
|
||||
@@ -68,9 +67,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t *pool,
|
||||
* \param max_len length the buffer is allowed to grow to
|
||||
* \return status
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **buffer,
|
||||
switch_size_t blocksize,
|
||||
switch_size_t start_len, switch_size_t max_len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **buffer, switch_size_t blocksize, switch_size_t start_len, switch_size_t max_len);
|
||||
|
||||
/*! \brief Get the length of a switch_buffer_t
|
||||
* \param buffer any buffer of type switch_buffer_t
|
||||
|
||||
@@ -127,8 +127,7 @@ struct switch_caller_extension {
|
||||
\param extension_number extension number
|
||||
\return a new extension object allocated from the session's memory pool
|
||||
*/
|
||||
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session,
|
||||
char *extension_name, char *extension_number);
|
||||
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, char *extension_name, char *extension_number);
|
||||
|
||||
/*!
|
||||
\brief Add an application (instruction) to the given extension
|
||||
@@ -138,8 +137,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_c
|
||||
\param extra_data optional argument to the application
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
|
||||
switch_caller_extension_t *caller_extension,
|
||||
char *application_name, char *extra_data);
|
||||
switch_caller_extension_t *caller_extension, char *application_name, char *extra_data);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -166,7 +164,7 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *
|
||||
\param destination_number destination number
|
||||
\return a new profile object allocated from the session's memory pool
|
||||
*/
|
||||
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
|
||||
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t * pool,
|
||||
const char *username,
|
||||
const char *dialplan,
|
||||
const char *caller_id_name,
|
||||
@@ -174,10 +172,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
|
||||
const char *network_addr,
|
||||
const char *ani,
|
||||
const char *aniii,
|
||||
const char *rdnis,
|
||||
const char *source,
|
||||
const char *context,
|
||||
const char *destination_number);
|
||||
const char *rdnis, const char *source, const char *context, const char *destination_number);
|
||||
|
||||
/*!
|
||||
\brief Clone an existing caller profile object
|
||||
@@ -185,8 +180,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
|
||||
\param tocopy the existing profile
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session,
|
||||
switch_caller_profile_t *tocopy);
|
||||
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy);
|
||||
|
||||
/*!
|
||||
\brief Add headers to an existing event in regards to a specific profile
|
||||
@@ -195,8 +189,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_cor
|
||||
\param event the event to add the information to
|
||||
*/
|
||||
|
||||
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_t *caller_profile, char *prefix,
|
||||
switch_event_t *event);
|
||||
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_t *caller_profile, char *prefix, switch_event_t *event);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
/** @} */
|
||||
|
||||
@@ -74,9 +74,7 @@ SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_channel_t *channel,
|
||||
const char *file,
|
||||
const char *func,
|
||||
int line, switch_channel_state_t state);
|
||||
const char *file, const char *func, int line, switch_channel_state_t state);
|
||||
|
||||
/*!
|
||||
\brief Set the current state of a channel
|
||||
@@ -120,7 +118,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch
|
||||
\param pool memory_pool to use for allocation
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Connect a newly allocated channel to a session object and setup it's initial state
|
||||
@@ -129,9 +127,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel,
|
||||
\param state the initial state of the channel
|
||||
\param flags the initial channel flags
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel,
|
||||
switch_core_session_t *session,
|
||||
switch_channel_state_t state, uint32_t flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state, uint32_t flags);
|
||||
|
||||
/*!
|
||||
\brief Fire A presence event for the channel
|
||||
@@ -152,8 +148,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel);
|
||||
\param channel channel to assign the profile to
|
||||
\param caller_profile the profile to assign
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel,
|
||||
switch_caller_profile_t *caller_profile);
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||
|
||||
/*!
|
||||
\brief Retrive the given channel's caller profile
|
||||
@@ -167,8 +162,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
|
||||
\param channel channel to assign the profile to
|
||||
\param caller_profile the profile to assign
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel,
|
||||
switch_caller_profile_t *caller_profile);
|
||||
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||
|
||||
/*!
|
||||
\brief Retrive the given channel's originator caller profile
|
||||
@@ -182,8 +176,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p
|
||||
\param channel channel to assign the profile to
|
||||
\param caller_profile the profile to assign
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel,
|
||||
switch_caller_profile_t *caller_profile);
|
||||
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile);
|
||||
|
||||
/*!
|
||||
\brief Retrive the given channel's originatee caller profile
|
||||
@@ -207,8 +200,7 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel);
|
||||
\param value the vaule of the variable
|
||||
\returns SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname,
|
||||
const char *value);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value);
|
||||
|
||||
/*!
|
||||
\brief Set a variable on a given channel, without duplicating the value from the session pool.
|
||||
@@ -217,8 +209,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch
|
||||
\param value the vaule of the variable (MUST BE ALLOCATED FROM THE SESSION POOL ALREADY)
|
||||
\returns SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_nodup(switch_channel_t *channel, const char *varname,
|
||||
char *value);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_nodup(switch_channel_t *channel, const char *varname, char *value);
|
||||
|
||||
/*!
|
||||
\brief Retrieve a variable from a given channel
|
||||
@@ -235,16 +226,14 @@ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, ch
|
||||
* pool is NULL, then an internal, non-thread-safe iterator is used.
|
||||
* @remark Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables
|
||||
*/
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel,
|
||||
switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Assign a caller extension to a given channel
|
||||
\param channel channel to assign extension to
|
||||
\param caller_extension extension to assign
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel,
|
||||
switch_caller_extension_t *caller_extension);
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
|
||||
|
||||
/*!
|
||||
\brief Retrieve caller extension from a given channel
|
||||
@@ -282,11 +271,9 @@ SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, sw
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flags);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
|
||||
/*!
|
||||
\brief Answer a channel (initiate/acknowledge a successful connection)
|
||||
@@ -309,8 +296,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
|
||||
*/
|
||||
#define switch_channel_mark_pre_answered(channel) switch_channel_perform_mark_pre_answered(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
/*!
|
||||
\brief Send Ringing message to a channel
|
||||
\param channel channel to ring
|
||||
@@ -319,14 +305,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
|
||||
#define switch_channel_ring_ready(channel) switch_channel_perform_ring_ready(channel, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line);
|
||||
|
||||
/*!
|
||||
\brief Indicate progress on a channel to attempt early media
|
||||
@@ -348,16 +331,14 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_ch
|
||||
\param state_handler table of state handler functions
|
||||
\return the index number/priority of the table negative value indicates failure
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_channel_add_state_handler(switch_channel_t *channel,
|
||||
const switch_state_handler_table_t *state_handler);
|
||||
SWITCH_DECLARE(int) switch_channel_add_state_handler(switch_channel_t *channel, const switch_state_handler_table_t *state_handler);
|
||||
|
||||
/*!
|
||||
\brief clear a state handler table from a given channel
|
||||
\param channel channel from which to clear the state handler table
|
||||
\param state_handler table of state handler functions
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channel,
|
||||
const switch_state_handler_table_t *state_handler);
|
||||
SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channel, const switch_state_handler_table_t *state_handler);
|
||||
|
||||
/*!
|
||||
\brief Retrieve an state handler tablefrom a given channel at given index level
|
||||
@@ -365,8 +346,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channe
|
||||
\param index the index of the state handler table (start from 0)
|
||||
\return given channel's state handler table at given index or NULL if requested index does not exist.
|
||||
*/
|
||||
SWITCH_DECLARE(const switch_state_handler_table_t *) switch_channel_get_state_handler(switch_channel_t *channel,
|
||||
int index);
|
||||
SWITCH_DECLARE(const switch_state_handler_table_t *) switch_channel_get_state_handler(switch_channel_t *channel, int index);
|
||||
|
||||
/*!
|
||||
\brief Set private data on channel
|
||||
@@ -402,9 +382,7 @@ SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_channel_t *channel,
|
||||
const char *file,
|
||||
const char *func,
|
||||
int line, switch_call_cause_t hangup_cause);
|
||||
const char *file, const char *func, int line, switch_call_cause_t hangup_cause);
|
||||
|
||||
/*!
|
||||
\brief Hangup a channel flagging it's state machine to end
|
||||
|
||||
@@ -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
|
||||
/** @} */
|
||||
|
||||
@@ -65,8 +65,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const
|
||||
/*!
|
||||
\brief A method akin to printf for dealing with api streams
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt,
|
||||
...) PRINTF_FUNCTION(2, 3);
|
||||
SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
|
||||
+57
-112
@@ -124,8 +124,7 @@ struct switch_core_port_allocator;
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t *session,
|
||||
switch_media_bug_callback_t callback,
|
||||
void *user_data,
|
||||
switch_media_bug_flag_t flags, switch_media_bug_t **new_bug);
|
||||
void *user_data, switch_media_bug_flag_t flags, switch_media_bug_t **new_bug);
|
||||
/*!
|
||||
\brief Obtain private data from a media bug
|
||||
\param bug the bug to get the data from
|
||||
@@ -190,9 +189,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
||||
\return SWITCH_STATUS_SUCCESS if the operation was a success
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(switch_port_t start,
|
||||
switch_port_t end,
|
||||
uint8_t inc,
|
||||
switch_core_port_allocator_t **new_allocator);
|
||||
switch_port_t end, uint8_t inc, switch_core_port_allocator_t **new_allocator);
|
||||
|
||||
/*!
|
||||
\brief Get a port from the port allocator
|
||||
@@ -247,8 +244,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void);
|
||||
///\{
|
||||
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(switch_core_session_t *session,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(switch_core_session_t *session, const char *file, const char *func, int line);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@@ -264,8 +260,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
|
||||
|
||||
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session, const char *file, const char *func, int line);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@@ -279,8 +274,7 @@ SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *sessi
|
||||
#endif
|
||||
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t *session,
|
||||
const char *file, const char *func, int line);
|
||||
SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t *session, const char *file, const char *func, int line);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@@ -321,13 +315,13 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handl
|
||||
\brief Create a new sub memory pool from the core's master pool
|
||||
\return SWITCH_STATUS_SUCCESS on success
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_new_memory_pool(switch_memory_pool_t **pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_new_memory_pool(switch_memory_pool_t ** pool);
|
||||
|
||||
/*!
|
||||
\brief Returns a subpool back to the main pool
|
||||
\return SWITCH_STATUS_SUCCESS on success
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_destroy_memory_pool(switch_memory_pool_t **pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_destroy_memory_pool(switch_memory_pool_t ** pool);
|
||||
|
||||
/*!
|
||||
\brief Start the session's state machine
|
||||
@@ -355,7 +349,7 @@ SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory);
|
||||
\param memory the number of bytes to allocate
|
||||
\return a void pointer to the allocated memory
|
||||
*/
|
||||
SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size_t memory);
|
||||
SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t * pool, switch_size_t memory);
|
||||
|
||||
/*!
|
||||
\brief Allocate memory from a session's pool
|
||||
@@ -387,7 +381,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session
|
||||
\param todup the string to duplicate
|
||||
\return a pointer to the newly duplicated string
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char *todup);
|
||||
SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t * pool, const char *todup);
|
||||
|
||||
/*!
|
||||
\brief printf-style style printing routine. The data is output to a string allocated from the session
|
||||
@@ -405,7 +399,7 @@ SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *sessio
|
||||
\param ... The arguments to use while printing the data
|
||||
\return The new string
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const char *fmt, ...);
|
||||
SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t * pool, const char *fmt, ...);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the memory pool from a session
|
||||
@@ -426,7 +420,7 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_
|
||||
\return the newly created session
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch_endpoint_interface_t
|
||||
*endpoint_interface, switch_memory_pool_t **pool);
|
||||
*endpoint_interface, switch_memory_pool_t ** pool);
|
||||
|
||||
/*!
|
||||
\brief Destroy a session and return the memory pool to the core
|
||||
@@ -447,8 +441,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_count(void);
|
||||
\param pool the pool to use
|
||||
\return the newly created session
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char *endpoint_name,
|
||||
switch_memory_pool_t **pool);
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t ** pool);
|
||||
|
||||
/*!
|
||||
\brief Launch the session thread (state machine) on a given session
|
||||
@@ -482,9 +475,7 @@ SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session_t *sessi
|
||||
SWITCH_DECLARE(char *) switch_core_get_uuid(void);
|
||||
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(char *uuid_str,
|
||||
const char *file,
|
||||
const char *func, int line);
|
||||
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(char *uuid_str, const char *file, const char *func, int line);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@@ -525,8 +516,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause);
|
||||
\param message the switch_core_session_message_t object to send
|
||||
\return the status returned by the message handler
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str,
|
||||
switch_core_session_message_t *message);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str, switch_core_session_message_t *message);
|
||||
|
||||
/*!
|
||||
\brief Queue a message on a session
|
||||
@@ -534,8 +524,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str,
|
||||
\param message the message to queue
|
||||
\return SWITCH_STATUS_SUCCESS if the message was queued
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session,
|
||||
switch_core_session_message_t *message);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
|
||||
|
||||
/*!
|
||||
\brief Queue an indication message on a session
|
||||
@@ -543,8 +532,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_se
|
||||
\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(switch_core_session_t *session,
|
||||
switch_core_session_message_types_t indication);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
|
||||
|
||||
/*!
|
||||
\brief DE-Queue an message on a given session
|
||||
@@ -552,8 +540,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core
|
||||
\param message the de-queued message
|
||||
\return the SWITCH_STATUS_SUCCESS if the message was de-queued
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_session_t *session,
|
||||
switch_core_session_message_t **message);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_session_t *session, switch_core_session_message_t **message);
|
||||
|
||||
/*!
|
||||
\brief Flush a message queue on a given session
|
||||
@@ -576,8 +563,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(char *uuid_str, s
|
||||
\param event the event to receive
|
||||
\return the status returned by the handler
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(switch_core_session_t *session,
|
||||
switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(switch_core_session_t *session, switch_event_t **event);
|
||||
|
||||
/*!
|
||||
\brief Retrieve private user data from a session
|
||||
@@ -623,8 +609,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(switch_core_session_t *
|
||||
\param func a function to execute in the thread
|
||||
\param obj an arguement
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session_t *session,
|
||||
void *(*func) (switch_thread_t *, void *), void *obj);
|
||||
SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session_t *session, void *(*func) (switch_thread_t *, void *), void *obj);
|
||||
|
||||
/*!
|
||||
\brief Signal a thread using a thread session to terminate
|
||||
@@ -638,8 +623,7 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(switch_core_thread_session_t
|
||||
\param stream_id which logical media channel to use
|
||||
\param thread_session the thread_session to use
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_service_session(switch_core_session_t *session,
|
||||
switch_core_thread_session_t *thread_session, int stream_id);
|
||||
SWITCH_DECLARE(void) switch_core_service_session(switch_core_session_t *session, switch_core_thread_session_t *thread_session, int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
|
||||
@@ -653,8 +637,7 @@ SWITCH_DECLARE(void) switch_core_service_session(switch_core_session_t *session,
|
||||
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
|
||||
char *endpoint_name,
|
||||
switch_caller_profile_t *caller_profile,
|
||||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
|
||||
/*!
|
||||
\brief Answer the channel of a given session
|
||||
@@ -669,8 +652,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_answer_channel(switch_core_s
|
||||
\param message the message to recieve
|
||||
\return the status returned by the message handler
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_session_t *session,
|
||||
switch_core_session_message_t *message);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_session_t *session, switch_core_session_message_t *message);
|
||||
|
||||
/*!
|
||||
\brief Queue an event on a given session
|
||||
@@ -694,8 +676,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_event_count(switch_core_session_t *s
|
||||
\param event the de-queued event
|
||||
\return the SWITCH_STATUS_SUCCESS if the event was de-queued
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session,
|
||||
switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_session_t *session, switch_event_t **event);
|
||||
|
||||
/*!
|
||||
\brief Queue a private event on a given session
|
||||
@@ -703,8 +684,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_se
|
||||
\param event the event to queue
|
||||
\return the status returned by the message handler
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(switch_core_session_t *session,
|
||||
switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(switch_core_session_t *session, switch_event_t **event);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -720,8 +700,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_private_event_count(switch_core_sess
|
||||
\param event the de-queued event
|
||||
\return the SWITCH_STATUS_SUCCESS if the event was de-queued
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch_core_session_t *session,
|
||||
switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch_core_session_t *session, switch_event_t **event);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -732,8 +711,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
|
||||
\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(switch_core_session_t *session, switch_frame_t **frame,
|
||||
int timeout, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Reset the buffers and resampler on a session
|
||||
@@ -749,14 +727,11 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session);
|
||||
\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(switch_core_session_t *session, switch_frame_t *frame,
|
||||
int timeout, int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, int stream_id);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(switch_core_session_t *session,
|
||||
const char *file,
|
||||
const char *func,
|
||||
int line, switch_signal_t sig);
|
||||
const char *file, const char *func, int line, switch_signal_t sig);
|
||||
/*!
|
||||
\brief Send a signal to a channel
|
||||
\param session session to send signal to
|
||||
@@ -772,8 +747,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(switch_
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS if data is available for read within timeframe specified
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_read(switch_core_session_t *session, int timeout,
|
||||
int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_read(switch_core_session_t *session, int timeout, int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Wait for a session to be ready for output
|
||||
@@ -782,8 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_read(switch_core_ses
|
||||
\param stream_id which logical media channel to use
|
||||
\return SWITCH_STATUS_SUCCESS if the session is available for write within timeframe specified
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_write(switch_core_session_t *session, int timeout,
|
||||
int stream_id);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_write(switch_core_session_t *session, int timeout, int stream_id);
|
||||
|
||||
/*!
|
||||
\brief Send DTMF to a session
|
||||
@@ -805,14 +778,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
|
||||
\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(switch_hash_t **hash, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t ** hash, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Destroy an existing hash table
|
||||
\param hash the hash to destroy
|
||||
\return SWITCH_STATUS_SUCCESS if the hash is destroyed
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t *hash);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t * hash);
|
||||
|
||||
/*!
|
||||
\brief Insert data into a hash
|
||||
@@ -822,7 +795,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t *hash);
|
||||
\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(switch_hash_t *hash, const char *key, const void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t * hash, const char *key, const void *data);
|
||||
|
||||
/*!
|
||||
\brief Insert data into a hash with dynamicly allocated key name
|
||||
@@ -831,7 +804,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, con
|
||||
\param data the data to add
|
||||
\return SWITCH_STATUS_SUCCESS if the data is added
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *hash, const char *key, const void *data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t * hash, const char *key, const void *data);
|
||||
|
||||
/*!
|
||||
\brief Delete data from a hash based on desired key
|
||||
@@ -839,7 +812,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup(switch_hash_t *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(switch_hash_t *hash, const char *key);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t * hash, const char *key);
|
||||
|
||||
/*!
|
||||
\brief Retrieve data from a given hash
|
||||
@@ -847,7 +820,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, con
|
||||
\param key the key to retrieve
|
||||
\return a pointer to the data held in the key
|
||||
*/
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, const char *key);
|
||||
SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t * hash, const char *key);
|
||||
///\}
|
||||
|
||||
///\defgroup timer Timer Functions
|
||||
@@ -862,8 +835,7 @@ SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, const char *ke
|
||||
\param pool the memory pool to use for allocation
|
||||
\return
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, 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, char *timer_name, int interval, int samples, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Wait for one cycle on an existing timer
|
||||
@@ -916,9 +888,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec,
|
||||
uint32_t rate,
|
||||
int ms,
|
||||
int channels,
|
||||
uint32_t flags,
|
||||
const switch_codec_settings_t *codec_settings,
|
||||
switch_memory_pool_t *pool);
|
||||
uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Encode data using a codec handle
|
||||
@@ -939,9 +909,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
|
||||
@@ -962,9 +930,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
|
||||
@@ -979,8 +945,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
|
||||
\param codec the codec to add
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session,
|
||||
switch_codec_t *codec);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the read codec from a given session
|
||||
@@ -995,8 +960,7 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_
|
||||
\param codec the codec to add
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_session_t *session,
|
||||
switch_codec_t *codec);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_session_t *session, switch_codec_t *codec);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the write codec from a given session
|
||||
@@ -1024,7 +988,7 @@ SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(char *filename);
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute(switch_core_db_t *db, char *sql, uint32_t retries);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute(switch_core_db_t * db, char *sql, uint32_t retries);
|
||||
|
||||
/*!
|
||||
\brief perform a test query then perform a reactive query if the first one fails
|
||||
@@ -1032,7 +996,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute(switch_core_db
|
||||
\param test_sql the test sql
|
||||
\param reactive_sql the reactive sql
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *test_sql, char *reactive_sql);
|
||||
SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t * db, char *test_sql, char *reactive_sql);
|
||||
|
||||
#define SWITCH_CORE_DB "core"
|
||||
/*!
|
||||
@@ -1057,9 +1021,7 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te
|
||||
\note the loadable module used is chosen based on the file extension
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
|
||||
char *file_path,
|
||||
uint8_t channels,
|
||||
uint32_t rate, unsigned int flags, switch_memory_pool_t *pool);
|
||||
char *file_path, uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t * pool);
|
||||
/*!
|
||||
\brief Read media from a file handle
|
||||
\param fh the file handle to read from (must be initilized by you memset all 0 for read, fill in channels and rate for write)
|
||||
@@ -1086,8 +1048,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
|
||||
\param whence the indicator (see traditional seek)
|
||||
\return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples,
|
||||
int whence);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence);
|
||||
|
||||
/*!
|
||||
\brief Set metadata to the desired string
|
||||
@@ -1096,8 +1057,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
|
||||
\param string the string to add
|
||||
\return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col,
|
||||
const char *string);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string);
|
||||
|
||||
/*!
|
||||
\brief get metadata of the desired string
|
||||
@@ -1106,8 +1066,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t
|
||||
\param string pointer to the string to fetch
|
||||
\return SWITCH_STATUS_SUCCESS with cur_pos adjusted to new position
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col,
|
||||
const char **string);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -1133,9 +1092,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
|
||||
char *module_name,
|
||||
char *voice_name,
|
||||
unsigned int rate,
|
||||
switch_speech_flag_t *flags, switch_memory_pool_t *pool);
|
||||
char *voice_name, unsigned int rate, switch_speech_flag_t *flags, switch_memory_pool_t * pool);
|
||||
/*!
|
||||
\brief Feed text to the TTS module
|
||||
\param sh the speech handle to feed
|
||||
@@ -1143,8 +1100,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
|
||||
\param flags flags in/out for fine tuning
|
||||
\return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
||||
switch_speech_flag_t *flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Flush TTS audio on a given handle
|
||||
@@ -1186,9 +1142,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
|
||||
@@ -1211,9 +1165,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,
|
||||
char *module_name,
|
||||
char *codec,
|
||||
int rate,
|
||||
char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool);
|
||||
char *codec, int rate, char *dest, switch_asr_flag_t *flags, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Close an asr handle
|
||||
@@ -1231,8 +1183,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, s
|
||||
\param flags flags to influence behaviour
|
||||
\return SWITCH_STATUS_SUCCESS
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len,
|
||||
switch_asr_flag_t *flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Check an asr handle for results
|
||||
@@ -1249,8 +1200,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_check_results(switch_asr_handle_
|
||||
\param flags flags to influence behaviour
|
||||
\return SWITCH_STATUS_SUCCESS
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_get_results(switch_asr_handle_t *ah, char **xmlstr,
|
||||
switch_asr_flag_t *flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Load a grammar to an asr handle
|
||||
@@ -1300,9 +1250,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah);
|
||||
\return SWITCH_STATUS_SUCCESS if the handle is opened
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_directory_open(switch_directory_handle_t *dh,
|
||||
char *module_name,
|
||||
char *source,
|
||||
char *dsn, char *passwd, switch_memory_pool_t *pool);
|
||||
char *module_name, char *source, char *dsn, char *passwd, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Query a directory handle
|
||||
@@ -1362,9 +1310,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_ready(void);
|
||||
\param datalen size in bytes of data.
|
||||
\return SUCCESS on sucess.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_management_exec(char *relative_oid,
|
||||
switch_management_action_t action,
|
||||
char *data, switch_size_t datalen);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_management_exec(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -1414,8 +1360,7 @@ SWITCH_DECLARE(FILE *) switch_core_get_console(void);
|
||||
/*!
|
||||
\brief Launch a thread
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func) (switch_thread_t *, void *), void *obj,
|
||||
switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func) (switch_thread_t *, void *), void *obj, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Initiate Globals
|
||||
|
||||
@@ -50,7 +50,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* Each open database is represented by an instance of the
|
||||
* following opaque structure.
|
||||
*/
|
||||
typedef struct sqlite3 switch_core_db_t;
|
||||
typedef struct sqlite3 switch_core_db_t;
|
||||
typedef struct sqlite3_stmt switch_core_db_stmt_t;
|
||||
|
||||
typedef int (*switch_core_db_callback_func_t) (void *pArg, int argc, char **argv, char **columnNames);
|
||||
@@ -82,7 +82,7 @@ typedef void (*switch_core_db_destructor_type_t) (void *);
|
||||
* this routine is called. Otherwise, SWITCH_CORE_DB_BUSY is returned and the
|
||||
* database connection remains open.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db);
|
||||
SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t * db);
|
||||
|
||||
/**
|
||||
* Open the database file "filename". The "filename" is UTF-8
|
||||
@@ -99,7 +99,7 @@ SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db);
|
||||
* with the switch_core_db_t* handle should be released by passing it to
|
||||
* switch_core_db_close() when it is no longer required.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t **ppDb);
|
||||
SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t ** ppDb);
|
||||
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -164,7 +164,7 @@ SWITCH_DECLARE(int) switch_core_db_column_count(switch_core_db_stmt_t *pStmt);
|
||||
* The string "not an error" is returned when the most recent API call was
|
||||
* successful.
|
||||
*/
|
||||
SWITCH_DECLARE(const char *) switch_core_db_errmsg(switch_core_db_t *db);
|
||||
SWITCH_DECLARE(const char *) switch_core_db_errmsg(switch_core_db_t * db);
|
||||
|
||||
/**
|
||||
* A function to executes one or more statements of SQL.
|
||||
@@ -206,9 +206,7 @@ SWITCH_DECLARE(const char *) switch_core_db_errmsg(switch_core_db_t *db);
|
||||
* behavior can be modified somewhat using the sswitch_core_db_busy_handler()
|
||||
* and switch_core_db_busy_timeout() functions below.)
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db,
|
||||
const char *sql,
|
||||
switch_core_db_callback_func_t callback, void *data, char **errmsg);
|
||||
SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t * db, const char *sql, switch_core_db_callback_func_t callback, void *data, char **errmsg);
|
||||
|
||||
/**
|
||||
* This function is called to delete a compiled
|
||||
@@ -248,9 +246,7 @@ SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt);
|
||||
*
|
||||
* On success, SWITCH_CORE_DB_OK is returned. Otherwise an error code is returned.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db,
|
||||
const char *zSql,
|
||||
int nBytes, switch_core_db_stmt_t **ppStmt, const char **pzTail);
|
||||
SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t * db, const char *zSql, int nBytes, switch_core_db_stmt_t **ppStmt, const char **pzTail);
|
||||
|
||||
/**
|
||||
* After an SQL query has been compiled with a call to either
|
||||
@@ -367,8 +363,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int64(switch_core_db_stmt_t *pStmt, int
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_bind_text(switch_core_db_stmt_t *pStmt, int i, const char *zData, int nData,
|
||||
switch_core_db_destructor_type_t xDel);
|
||||
SWITCH_DECLARE(int) switch_core_db_bind_text(switch_core_db_stmt_t *pStmt, int i, const char *zData, int nData, switch_core_db_destructor_type_t xDel);
|
||||
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -401,7 +396,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_double(switch_core_db_stmt_t *pStmt, int
|
||||
*
|
||||
* This function is similar to the mysql_insert_id() function from MySQL.
|
||||
*/
|
||||
SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
|
||||
SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t * db);
|
||||
|
||||
/**
|
||||
* This next routine is really just a wrapper around switch_core_db_exec().
|
||||
@@ -444,7 +439,7 @@ SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
|
||||
*
|
||||
* The return value of this routine is the same as from switch_core_db_exec().
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_db_get_table(switch_core_db_t *db, /* An open database */
|
||||
SWITCH_DECLARE(int) switch_core_db_get_table(switch_core_db_t * db, /* An open database */
|
||||
const char *sql, /* SQL to be executed */
|
||||
char ***resultp, /* Result written to a char *[] that this points to */
|
||||
int *nrow, /* Number of result rows written here */
|
||||
|
||||
@@ -47,15 +47,12 @@ typedef struct switch_io_event_hook_send_dtmf switch_io_event_hook_send_dtmf_t;
|
||||
typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
|
||||
|
||||
|
||||
typedef switch_status_t (*switch_outgoing_channel_hook_t) (switch_core_session_t *, switch_caller_profile_t *,
|
||||
switch_core_session_t *);
|
||||
typedef switch_status_t (*switch_outgoing_channel_hook_t) (switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t *);
|
||||
typedef switch_status_t (*switch_answer_channel_hook_t) (switch_core_session_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 **, int, switch_io_flag_t,
|
||||
int);
|
||||
typedef switch_status_t (*switch_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t,
|
||||
int);
|
||||
typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
|
||||
typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, int);
|
||||
typedef switch_status_t (*switch_waitfor_read_hook_t) (switch_core_session_t *, int, int);
|
||||
typedef switch_status_t (*switch_waitfor_write_hook_t) (switch_core_session_t *, int, int);
|
||||
@@ -180,9 +177,7 @@ extern switch_io_event_hooks_t switch_core_session_get_event_hooks(switch_core_s
|
||||
\param outgoing_channel hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing_channel(switch_core_session_t *session,
|
||||
switch_outgoing_channel_hook_t
|
||||
outgoing_channel);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing_channel(switch_core_session_t *session, switch_outgoing_channel_hook_t outgoing_channel);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session answers a channel
|
||||
@@ -190,8 +185,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing_channel(swit
|
||||
\param answer_channel hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch_core_session_t *session,
|
||||
switch_answer_channel_hook_t answer_channel);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch_core_session_t *session, switch_answer_channel_hook_t answer_channel);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session sends a message
|
||||
@@ -199,9 +193,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch
|
||||
\param receive_message hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_receive_message(switch_core_session_t *session,
|
||||
switch_receive_message_hook_t
|
||||
receive_message);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_receive_message(switch_core_session_t *session, switch_receive_message_hook_t receive_message);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session reads a frame
|
||||
@@ -209,8 +201,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_receive_message(switc
|
||||
\param read_frame hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_core_session_t *session,
|
||||
switch_read_frame_hook_t read_frame);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_core_session_t *session, switch_read_frame_hook_t read_frame);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session writes a frame
|
||||
@@ -218,8 +209,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_cor
|
||||
\param write_frame hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_write_frame(switch_core_session_t *session,
|
||||
switch_write_frame_hook_t write_frame);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_write_frame(switch_core_session_t *session, switch_write_frame_hook_t write_frame);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session kills a channel
|
||||
@@ -227,8 +217,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_write_frame(switch_co
|
||||
\param kill_channel hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_kill_channel(switch_core_session_t *session,
|
||||
switch_kill_channel_hook_t kill_channel);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_kill_channel(switch_core_session_t *session, switch_kill_channel_hook_t kill_channel);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session waits for a read event
|
||||
@@ -236,8 +225,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_kill_channel(switch_c
|
||||
\param waitfor_read hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_read(switch_core_session_t *session,
|
||||
switch_waitfor_read_hook_t waitfor_read);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_read(switch_core_session_t *session, switch_waitfor_read_hook_t waitfor_read);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session waits for a write event
|
||||
@@ -245,8 +233,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_read(switch_c
|
||||
\param waitfor_write hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_write(switch_core_session_t *session,
|
||||
switch_waitfor_write_hook_t waitfor_write);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_write(switch_core_session_t *session, switch_waitfor_write_hook_t waitfor_write);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session sends dtmf
|
||||
@@ -254,8 +241,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_write(switch_
|
||||
\param send_dtmf hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_send_dtmf(switch_core_session_t *session,
|
||||
switch_send_dtmf_hook_t send_dtmf);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_send_dtmf(switch_core_session_t *session, switch_send_dtmf_hook_t send_dtmf);
|
||||
|
||||
/*!
|
||||
\brief Add an event hook to be executed when a session receives a state change signal
|
||||
@@ -263,8 +249,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_send_dtmf(switch_core
|
||||
\param state_change hook to bind
|
||||
\return SWITCH_STATUS_SUCCESS on suceess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session,
|
||||
switch_answer_channel_hook_t state_change);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session, switch_answer_channel_hook_t state_change);
|
||||
///\}
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
||||
@@ -123,7 +123,7 @@ struct switch_event_node {
|
||||
\param pool the memory pool to use for the event system (creates a new one if NULL)
|
||||
\return SWITCH_STATUS_SUCCESS when complete
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Stop the eventing system
|
||||
@@ -138,8 +138,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void);
|
||||
\param subclass_name the subclass name for custom event (only valid when event_id is SWITCH_EVENT_CUSTOM)
|
||||
\return SWITCH_STATUS_SUCCESS on success
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id,
|
||||
const char *subclass_name);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name);
|
||||
|
||||
/*!
|
||||
\brief Set the priority of an event
|
||||
@@ -173,8 +172,7 @@ SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
|
||||
\return SWITCH_STATUS_SUCCESS if the header was added
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
|
||||
const char *header_name, const char *fmt,
|
||||
...) PRINTF_FUNCTION(4, 5);
|
||||
const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
|
||||
|
||||
/*!
|
||||
\brief Destroy an event
|
||||
@@ -199,8 +197,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_
|
||||
\param user_data optional private data to pass to the event handlers
|
||||
\return
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(char *file, char *func, int line, switch_event_t **event,
|
||||
void *user_data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(char *file, char *func, int line, switch_event_t **event, void *user_data);
|
||||
|
||||
/*!
|
||||
\brief Bind an event callback to a specific event
|
||||
@@ -211,8 +208,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(char *file, char *fun
|
||||
\param user_data optional user specific data to pass whenever the callback is invoked
|
||||
\return SWITCH_STATUS_SUCCESS if the event was binded
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name,
|
||||
switch_event_callback_t callback, void *user_data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback, void *user_data);
|
||||
|
||||
/*!
|
||||
\brief Render the name of an event id enumeration
|
||||
@@ -270,8 +266,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_running(void);
|
||||
\return SWITCH_STATUS_SUCCESS if the body was added to the event
|
||||
\note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2,
|
||||
3);
|
||||
SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
+50
-91
@@ -85,8 +85,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
|
||||
\param timeout a timeout in milliseconds
|
||||
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session,
|
||||
switch_input_args_t *args, uint32_t timeout);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t timeout);
|
||||
|
||||
/*!
|
||||
\brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up.
|
||||
@@ -102,9 +101,7 @@ 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,
|
||||
uint32_t buflen,
|
||||
uint32_t maxdigits,
|
||||
const char *terminators,
|
||||
char *terminator, uint32_t timeout);
|
||||
uint32_t maxdigits, const char *terminators, char *terminator, uint32_t timeout);
|
||||
|
||||
/*!
|
||||
\brief Engage background Speech detection on a session
|
||||
@@ -117,9 +114,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
|
||||
char *mod_name,
|
||||
char *grammar,
|
||||
char *path, char *dest, switch_asr_handle_t *ah);
|
||||
char *mod_name, char *grammar, char *path, char *dest, switch_asr_handle_t *ah);
|
||||
|
||||
/*!
|
||||
\brief Stop background Speech detection on a session
|
||||
@@ -149,8 +144,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_resume_detect_speech(switch_core_sess
|
||||
\param path the grammar path
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar,
|
||||
char *path);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path);
|
||||
|
||||
/*!
|
||||
\brief Unload a grammar on a background speech detection handle
|
||||
@@ -167,8 +161,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c
|
||||
\param fh file handle to use (NULL for builtin one)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file,
|
||||
switch_file_handle_t *fh);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, switch_file_handle_t *fh);
|
||||
|
||||
/*!
|
||||
\brief Stop Recording a session
|
||||
@@ -192,8 +185,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_session(switch_core_
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session,
|
||||
switch_file_handle_t *fh, 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, char *file, switch_input_args_t *args);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -209,8 +201,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
|
||||
switch_file_handle_t *fh,
|
||||
char *file, switch_input_args_t *args, uint32_t limit);
|
||||
switch_file_handle_t *fh, char *file, switch_input_args_t *args, uint32_t limit);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -236,15 +227,11 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
||||
uint32_t timeout,
|
||||
char *valid_terminators,
|
||||
char *audio_file,
|
||||
char *bad_input_audio_file,
|
||||
void *digit_buffer,
|
||||
uint32_t digit_buffer_length, char *digits_regex);
|
||||
char *bad_input_audio_file, void *digit_buffer, uint32_t digit_buffer_length, char *digits_regex);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
|
||||
switch_speech_handle_t *sh,
|
||||
switch_codec_t *codec,
|
||||
switch_timer_t *timer,
|
||||
char *text, switch_input_args_t *args);
|
||||
switch_codec_t *codec, switch_timer_t *timer, char *text, switch_input_args_t *args);
|
||||
|
||||
/*!
|
||||
\brief Speak given text with given tts engine
|
||||
@@ -259,9 +246,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
||||
char *tts_name,
|
||||
char *voice_name,
|
||||
uint32_t rate, char *text, switch_input_args_t *args);
|
||||
char *tts_name, char *voice_name, uint32_t rate, char *text, switch_input_args_t *args);
|
||||
|
||||
/*!
|
||||
\brief Make an outgoing call
|
||||
@@ -282,9 +267,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
char *bridgeto,
|
||||
uint32_t timelimit_sec,
|
||||
const switch_state_handler_table_t *table,
|
||||
char *cid_name_override,
|
||||
char *cid_num_override,
|
||||
switch_caller_profile_t *caller_profile_override);
|
||||
char *cid_name_override, char *cid_num_override, switch_caller_profile_t *caller_profile_override);
|
||||
|
||||
/*!
|
||||
\brief Bridge Audio from one session to another
|
||||
@@ -297,8 +280,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_session_t *session,
|
||||
switch_core_session_t *peer_session,
|
||||
switch_input_callback_function_t dtmf_callback,
|
||||
void *session_data, void *peer_session_data);
|
||||
switch_input_callback_function_t dtmf_callback, void *session_data, void *peer_session_data);
|
||||
|
||||
/*!
|
||||
\brief Bridge Signalling from one session to another
|
||||
@@ -306,8 +288,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
||||
\param peer_session the other session
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *session,
|
||||
switch_core_session_t *peer_session);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *session, switch_core_session_t *peer_session);
|
||||
|
||||
/*!
|
||||
\brief Transfer an existing session to another location
|
||||
@@ -316,8 +297,7 @@ 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(switch_core_session_t *session, char *extension,
|
||||
char *dialplan, char *context);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, char *extension, char *dialplan, char *context);
|
||||
|
||||
/*!
|
||||
\brief Transfer an existing session to another location in the future
|
||||
@@ -328,8 +308,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
|
||||
\param context the new context (OPTIONAL, may be NULL)
|
||||
\return the id of the task
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid, char *extension, char *dialplan,
|
||||
char *context);
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid, char *extension, char *dialplan, char *context);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -340,8 +319,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid
|
||||
\param bleg hangup up the B-Leg if possible
|
||||
\return the id of the task
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, switch_call_cause_t cause,
|
||||
switch_bool_t bleg);
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, switch_call_cause_t cause, switch_bool_t bleg);
|
||||
|
||||
/*!
|
||||
\brief Bridge two existing sessions
|
||||
@@ -403,8 +381,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session
|
||||
\param flags flags to send to the request (SMF_ECHO_BRIDGED to send the broadcast to both sides of the call)
|
||||
\return the id of the task
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uuid, char *path,
|
||||
switch_media_flag_t flags);
|
||||
SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uuid, char *path, switch_media_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Signal the session to broadcast audio
|
||||
@@ -422,8 +399,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, swi
|
||||
\param var the name of the variable to transfer (NULL for all)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session_t *sessa, switch_core_session_t *sessb,
|
||||
char *var);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session_t *sessa, switch_core_session_t *sessb, char *var);
|
||||
|
||||
|
||||
/******************************************************************************************************/
|
||||
@@ -438,15 +414,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
|
||||
@@ -454,15 +429,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
|
||||
@@ -471,8 +445,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
|
||||
@@ -480,8 +453,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
|
||||
@@ -489,15 +461,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
|
||||
@@ -505,8 +476,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);
|
||||
|
||||
|
||||
/******************************************************************************************************/
|
||||
@@ -541,8 +511,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;
|
||||
/******************************************************************************************************/
|
||||
@@ -563,17 +532,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\param pool memory pool (NULL to create one)
|
||||
*\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 *exit_sound,
|
||||
const char *invalid_sound,
|
||||
const char *tts_engine,
|
||||
const char *tts_voice,
|
||||
const char *phrase_lang,
|
||||
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 *exit_sound,
|
||||
const char *invalid_sound,
|
||||
const char *tts_engine,
|
||||
const char *tts_voice,
|
||||
const char *phrase_lang, int timeout, int max_failures, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
|
||||
@@ -583,9 +551,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\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);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -599,9 +565,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\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);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -612,15 +577,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\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;
|
||||
@@ -632,9 +596,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\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);
|
||||
|
||||
/*!
|
||||
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
|
||||
@@ -642,24 +605,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
|
||||
*\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,
|
||||
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,
|
||||
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,
|
||||
char *macro_name,
|
||||
char *data, char *lang, switch_input_args_t *args);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, char *macro_name, char *data, char *lang, switch_input_args_t *args);
|
||||
/** @} */
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
||||
@@ -204,8 +204,7 @@ SWITCH_DECLARE(switch_management_interface_t *) switch_loadable_module_get_manag
|
||||
\param arraylen the max size in elements of the array
|
||||
\return the number of elements added to the array
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool,
|
||||
const switch_codec_implementation_t **array, int arraylen);
|
||||
SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t * pool, const switch_codec_implementation_t **array, int arraylen);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -217,8 +216,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool
|
||||
\return the number of elements added to the array
|
||||
\note this function only considers codecs that are listed in the "prefs" array and ignores the rest.
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array,
|
||||
int arraylen, char **prefs, int preflen);
|
||||
SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen);
|
||||
|
||||
/*!
|
||||
\brief Execute a registered API command
|
||||
@@ -228,8 +226,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
|
||||
\param stream stream for output
|
||||
\return the status returned by the API call
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_core_session_t *session,
|
||||
switch_stream_handle_t *stream);
|
||||
SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
|
||||
|
||||
|
||||
@@ -249,8 +246,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch
|
||||
\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(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_reload(void);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_pause(void);
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_resume(void);
|
||||
|
||||
@@ -74,7 +74,7 @@ typedef switch_status_t (*switch_log_function_t) (const switch_log_node_t *node,
|
||||
\param pool the memory pool to use
|
||||
\note to be called at application startup by the core
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Shut down the logging engine
|
||||
|
||||
@@ -80,8 +80,7 @@ struct switch_io_event_hooks;
|
||||
/*! \brief A table of i/o routines that an endpoint interface can implement */
|
||||
struct switch_io_routines {
|
||||
/*! creates an outgoing session from given session, caller profile */
|
||||
switch_call_cause_t (*outgoing_channel) (switch_core_session_t *, switch_caller_profile_t *,
|
||||
switch_core_session_t **, switch_memory_pool_t **);
|
||||
switch_call_cause_t (*outgoing_channel) (switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **);
|
||||
/*! answers the given session's channel */
|
||||
switch_status_t (*answer_channel) (switch_core_session_t *);
|
||||
/*! read a frame from a session */
|
||||
@@ -278,16 +277,13 @@ struct switch_speech_interface {
|
||||
/*! the name of the interface */
|
||||
const char *interface_name;
|
||||
/*! function to open the speech interface */
|
||||
switch_status_t (*speech_open) (switch_speech_handle_t *sh,
|
||||
char *voice_name, int rate, switch_speech_flag_t *flags);
|
||||
switch_status_t (*speech_open) (switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags);
|
||||
/*! function to close the speech interface */
|
||||
switch_status_t (*speech_close) (switch_speech_handle_t *, switch_speech_flag_t *flags);
|
||||
/*! 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, char *val);
|
||||
void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
|
||||
@@ -339,8 +335,7 @@ struct switch_management_interface {
|
||||
/*! the name of the interface */
|
||||
const char *relative_oid;
|
||||
/*! function to open the directory interface */
|
||||
switch_status_t (*management_function) (char *relative_oid, switch_management_action_t action, char *data,
|
||||
switch_size_t datalen);
|
||||
switch_status_t (*management_function) (char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
|
||||
const struct switch_management_interface *next;
|
||||
};
|
||||
|
||||
@@ -468,17 +463,13 @@ struct switch_codec_implementation {
|
||||
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);
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag);
|
||||
/*! function to decode encoded data into raw data */
|
||||
switch_status_t (*decode) (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);
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag);
|
||||
/*! deinitalize a codec handle using this implementation */
|
||||
switch_status_t (*destroy) (switch_codec_t *);
|
||||
const struct switch_codec_implementation *next;
|
||||
|
||||
@@ -74,7 +74,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;
|
||||
@@ -166,9 +166,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
|
||||
|
||||
@@ -40,22 +40,16 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* @ingroup FREESWITCH
|
||||
* @{
|
||||
*/
|
||||
typedef struct real_pcre switch_regex_t;
|
||||
typedef struct real_pcre switch_regex_t;
|
||||
|
||||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
|
||||
int options,
|
||||
const char **errorptr,
|
||||
int *erroroffset, const unsigned char *tables);
|
||||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables);
|
||||
|
||||
SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject,
|
||||
int *ovector,
|
||||
int stringcount, int stringnumber, char *buffer, int size);
|
||||
SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int size);
|
||||
|
||||
SWITCH_DECLARE(void) switch_regex_free(void *data);
|
||||
|
||||
SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector,
|
||||
uint32_t olen);
|
||||
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, char *data, char *field_data,
|
||||
SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t ** new_re, int *ovector, uint32_t olen);
|
||||
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t * re, int match_count, char *data, char *field_data,
|
||||
char *substituted, uint32_t len, int *ovector);
|
||||
|
||||
/*!
|
||||
|
||||
@@ -85,9 +85,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
\return SWITCH_STATUS_SUCCESS if the handle was created
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_resample_create(switch_audio_resampler_t **new_resampler,
|
||||
int from_rate,
|
||||
switch_size_t from_size,
|
||||
int to_rate, uint32_t to_size, switch_memory_pool_t *pool);
|
||||
int from_rate, switch_size_t from_size, int to_rate, uint32_t to_size, switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Destroy an existing resampler handle
|
||||
@@ -105,8 +103,7 @@ SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t *resampler
|
||||
\param last parameter denoting the last sample is being resampled
|
||||
\return the used size of dst
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen,
|
||||
float *dst, uint32_t dstlen, int last);
|
||||
SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last);
|
||||
|
||||
/*!
|
||||
\brief Convert an array of floats to an array of shorts
|
||||
|
||||
+10
-23
@@ -44,15 +44,14 @@ SWITCH_BEGIN_EXTERN_C
|
||||
///\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);
|
||||
switch_socket_t * sock, void *data, switch_size_t datalen, switch_sockaddr_t * from_addr);
|
||||
|
||||
/*!
|
||||
\brief Initilize the RTP System
|
||||
\param pool the memory pool to use for long term allocations
|
||||
\note Generally called by the core_init
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t * pool);
|
||||
|
||||
/*!
|
||||
\brief Request a new port to be used for media
|
||||
@@ -77,9 +76,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 *crypto_key,
|
||||
char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||
switch_rtp_flag_t flags, char *crypto_key, char *timer_name, const char **err, switch_memory_pool_t * pool);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -105,9 +102,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(char *rx_host,
|
||||
switch_payload_t payload,
|
||||
uint32_t samples_per_interval,
|
||||
uint32_t ms_per_packet,
|
||||
switch_rtp_flag_t flags,
|
||||
char *crypto_key,
|
||||
char *timer_name, const char **err, switch_memory_pool_t *pool);
|
||||
switch_rtp_flag_t flags, char *crypto_key, char *timer_name, const char **err, switch_memory_pool_t * pool);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -117,8 +112,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(char *rx_host,
|
||||
\param port the remote port
|
||||
\param err pointer for error messages
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, char *host, switch_port_t port,
|
||||
const char **err);
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err);
|
||||
|
||||
/*!
|
||||
\brief Assign a local address to the RTP session
|
||||
@@ -128,8 +122,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
|
||||
\param err pointer for error messages
|
||||
\note this call also binds the RTP session's socket to the new address
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, char *host, switch_port_t port,
|
||||
const char **err);
|
||||
SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err);
|
||||
|
||||
/*!
|
||||
\brief Kill the socket on an existing RTP session
|
||||
@@ -190,8 +183,7 @@ SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_se
|
||||
\param rtp_session the RTP session to set the samples per interval on
|
||||
\param samples_per_interval the new default samples per interval
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_samples_per_interval(switch_rtp_t *rtp_session,
|
||||
uint16_t samples_per_interval);
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_samples_per_interval(switch_rtp_t *rtp_session, uint16_t samples_per_interval);
|
||||
|
||||
/*!
|
||||
\brief Get the default samples per interval for a given RTP session
|
||||
@@ -277,9 +269,7 @@ 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);
|
||||
void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Read data from a given RTP session without copying
|
||||
@@ -298,8 +288,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
|
||||
\param flags frame flags
|
||||
\return the number of bytes written
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint32_t ts,
|
||||
switch_frame_flag_t *flags);
|
||||
SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint32_t ts, switch_frame_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Enable VAD on an RTP Session
|
||||
@@ -344,9 +333,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
||||
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
|
||||
void *data,
|
||||
uint16_t datalen,
|
||||
uint8_t m,
|
||||
switch_payload_t payload,
|
||||
uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags);
|
||||
uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the SSRC from a given RTP session
|
||||
|
||||
@@ -62,9 +62,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
*/
|
||||
SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
|
||||
switch_scheduler_func_t func,
|
||||
char *desc,
|
||||
char *group,
|
||||
uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags);
|
||||
char *desc, char *group, uint32_t cmd_id, void *cmd_arg, switch_scheduler_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Delete a scheduled task
|
||||
|
||||
+183
-100
@@ -51,7 +51,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||
* Each open sqlite database is represented by an instance of the
|
||||
* following opaque structure.
|
||||
*/
|
||||
typedef sqlite3 switch_core_db_t;
|
||||
typedef sqlite3 switch_core_db_t;
|
||||
typedef sqlite3_stmt switch_core_db_stmt_t;
|
||||
/**
|
||||
* Aggregate functions use the following routine to allocate
|
||||
@@ -63,14 +63,16 @@ typedef sqlite3_stmt switch_core_db_stmt_t;
|
||||
*
|
||||
* The buffer allocated is freed automatically by SQLite.
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_aggregate_context(sqlite3_context *, int nBytes);)
|
||||
DoxyDefine(void *switch_core_db_aggregate_context(sqlite3_context *, int nBytes);
|
||||
)
|
||||
#define switch_core_db_aggregate_context sqlite3_aggregate_context
|
||||
/**
|
||||
* /return the number of calls to xStep for a particular
|
||||
* aggregate function instance. The current call to xStep counts so this
|
||||
* routine always returns at least 1.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_aggregate_count(sqlite3_context *);)
|
||||
DoxyDefine(int switch_core_db_aggregate_count(sqlite3_context *);
|
||||
)
|
||||
#define switch_core_db_aggregate_count sqlite3_aggregate_count
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -100,7 +102,8 @@ DoxyDefine(int switch_core_db_aggregate_count(sqlite3_context *);)
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_blob(sqlite3_stmt *, int, const void *, int n, void (*)(void *));)
|
||||
DoxyDefine(int switch_core_db_bind_blob(sqlite3_stmt *, int, const void *, int n, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_bind_blob sqlite3_bind_blob
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -122,7 +125,8 @@ DoxyDefine(int switch_core_db_bind_blob(sqlite3_stmt *, int, const void *, int n
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_double(sqlite3_stmt *, int, double);)
|
||||
DoxyDefine(int switch_core_db_bind_double(sqlite3_stmt *, int, double);
|
||||
)
|
||||
#define switch_core_db_bind_double sqlite3_bind_double
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -144,7 +148,8 @@ DoxyDefine(int switch_core_db_bind_double(sqlite3_stmt *, int, double);)
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_int(sqlite3_stmt *, int, int);)
|
||||
DoxyDefine(int switch_core_db_bind_int(sqlite3_stmt *, int, int);
|
||||
)
|
||||
#define switch_core_db_bind_int sqlite3_bind_int
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -166,7 +171,8 @@ DoxyDefine(int switch_core_db_bind_int(sqlite3_stmt *, int, int);)
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_int64(sqlite3_stmt *, int, sqlite_int64);)
|
||||
DoxyDefine(int switch_core_db_bind_int64(sqlite3_stmt *, int, sqlite_int64);
|
||||
)
|
||||
#define switch_core_db_bind_int64 sqlite3_bind_int64
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -188,7 +194,8 @@ DoxyDefine(int switch_core_db_bind_int64(sqlite3_stmt *, int, sqlite_int64);)
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_null(sqlite3_stmt *, int);)
|
||||
DoxyDefine(int switch_core_db_bind_null(sqlite3_stmt *, int);
|
||||
)
|
||||
#define switch_core_db_bind_null sqlite3_bind_null
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -218,7 +225,8 @@ DoxyDefine(int switch_core_db_bind_null(sqlite3_stmt *, int);)
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_text(sqlite3_stmt *, int, const char *, int n, void (*)(void *));)
|
||||
DoxyDefine(int switch_core_db_bind_text(sqlite3_stmt *, int, const char *, int n, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_bind_text sqlite3_bind_text
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -248,7 +256,8 @@ DoxyDefine(int switch_core_db_bind_text(sqlite3_stmt *, int, const char *, int n
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_text16(sqlite3_stmt *, int, const void *, int, void (*)(void *));)
|
||||
DoxyDefine(int switch_core_db_bind_text16(sqlite3_stmt *, int, const void *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_bind_text16 sqlite3_bind_text16
|
||||
/**
|
||||
* In the SQL strings input to switch_core_db_prepare(),
|
||||
@@ -270,20 +279,23 @@ DoxyDefine(int switch_core_db_bind_text16(sqlite3_stmt *, int, const void *, int
|
||||
* an switch_core_db_prepare() or sqlite3_reset(). Unbound parameterss are
|
||||
* interpreted as NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_value(sqlite3_stmt *, int, const sqlite3_value *);)
|
||||
DoxyDefine(int switch_core_db_bind_value(sqlite3_stmt *, int, const sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_bind_value sqlite3_bind_value
|
||||
/**
|
||||
* @return The number of parameters in a compiled SQL statement.
|
||||
* @remark This routine was added to support DBD::SQLite.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_parameter_count(sqlite3_stmt *);)
|
||||
DoxyDefine(int switch_core_db_bind_parameter_count(sqlite3_stmt *);
|
||||
)
|
||||
#define switch_core_db_bind_parameter_count sqlite3_bind_parameter_count
|
||||
/**
|
||||
* @return the index of a parameter with the given name. If no parameter with the
|
||||
* given name is found, return 0.
|
||||
* @remark The name must match exactly.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_bind_parameter_index(sqlite3_stmt *, const char *zName);)
|
||||
DoxyDefine(int switch_core_db_bind_parameter_index(sqlite3_stmt *, const char *zName);
|
||||
)
|
||||
#define switch_core_db_bind_parameter_index sqlite3_bind_parameter_index
|
||||
/**
|
||||
* @return the name of the i-th parameter.
|
||||
@@ -292,7 +304,8 @@ DoxyDefine(int switch_core_db_bind_parameter_index(sqlite3_stmt *, const char *z
|
||||
* $VVV the complete text of the parameter name is returned, including
|
||||
* the initial ":" or "$". NULL is returned if the index is out of range.
|
||||
*/
|
||||
DoxyDefine(const char *switch_core_db_bind_parameter_name(sqlite3_stmt *, int);)
|
||||
DoxyDefine(const char *switch_core_db_bind_parameter_name(sqlite3_stmt *, int);
|
||||
)
|
||||
#define switch_core_db_bind_parameter_name sqlite3_bind_parameter_name
|
||||
/**
|
||||
* This routine identifies a callback function that is invoked
|
||||
@@ -316,7 +329,8 @@ DoxyDefine(const char *switch_core_db_bind_parameter_name(sqlite3_stmt *, int);)
|
||||
* data structures out from under the executing query and will
|
||||
* probably result in a coredump.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_busy_handler(switch_core_db *, int (*)(void *, int), void *);)
|
||||
DoxyDefine(int switch_core_db_busy_handler(switch_core_db *, int (*)(void *, int), void *);
|
||||
)
|
||||
#define switch_core_db_busy_handler sqlite3_busy_handler
|
||||
/**
|
||||
* This routine sets a busy handler that sleeps for a while when a
|
||||
@@ -328,7 +342,8 @@ DoxyDefine(int switch_core_db_busy_handler(switch_core_db *, int (*)(void *, int
|
||||
* Calling this routine with an argument less than or equal to zero
|
||||
* turns off all busy handlers.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_busy_timeout(switch_core_db *, int ms);)
|
||||
DoxyDefine(int switch_core_db_busy_timeout(switch_core_db *, int ms);
|
||||
)
|
||||
#define switch_core_db_busy_timeout sqlite3_busy_timeout
|
||||
/**
|
||||
* This function returns the number of database rows that were changed
|
||||
@@ -350,7 +365,8 @@ DoxyDefine(int switch_core_db_busy_timeout(switch_core_db *, int ms);)
|
||||
* table. To get an accurate count of the number of rows deleted, use
|
||||
* "DELETE FROM table WHERE 1" instead.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_changes(switch_core_db *);)
|
||||
DoxyDefine(int switch_core_db_changes(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_changes sqlite3_changes
|
||||
/**
|
||||
* A function to close the database.
|
||||
@@ -363,7 +379,8 @@ DoxyDefine(int switch_core_db_changes(switch_core_db *);)
|
||||
* this routine is called. Otherwise, SQLITE_BUSY is returned and the
|
||||
* database connection remains open.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_close(switch_core_db *);)
|
||||
DoxyDefine(int switch_core_db_close(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_close sqlite3_close
|
||||
/**
|
||||
* To avoid having to register all collation sequences before a database
|
||||
@@ -384,9 +401,9 @@ DoxyDefine(int switch_core_db_close(switch_core_db *);)
|
||||
* The collation sequence is returned to SQLite by a collation-needed
|
||||
* callback using the sqlite3_create_collation() API, described above.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_collation_needed(switch_core_db *,
|
||||
void *, void (*)(void *, switch_core_db *, int eTextRep, const char *)
|
||||
);)
|
||||
DoxyDefine(int switch_core_db_collation_needed(switch_core_db *, void *, void (*)(void *, switch_core_db *, int eTextRep, const char *)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_collation_needed sqlite3_collation_needed
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -429,7 +446,8 @@ DoxyDefine(int switch_core_db_collation_needed(switch_core_db *,
|
||||
*
|
||||
* @return the value of a BLOB.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_column_blob(sqlite3_stmt * stmt, int iCol);)
|
||||
DoxyDefine(const void *switch_core_db_column_blob(sqlite3_stmt * stmt, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_blob sqlite3_column_blob
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -472,7 +490,8 @@ DoxyDefine(const void *switch_core_db_column_blob(sqlite3_stmt * stmt, int iCol)
|
||||
* TEXT value represented as UTF-8. The "\000" terminator is included in the
|
||||
* byte count for TEXT values.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_column_bytes(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(int switch_core_db_column_bytes(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_bytes sqlite3_column_bytes
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -515,7 +534,8 @@ DoxyDefine(int switch_core_db_column_bytes(sqlite3_stmt *, int iCol);)
|
||||
* TEXT value represented as UTF-16. The "\u0000" terminator is included in
|
||||
* the byte count for TEXT values.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_column_bytes16(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(int switch_core_db_column_bytes16(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_bytes16 sqlite3_column_bytes16
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -556,7 +576,8 @@ DoxyDefine(int switch_core_db_column_bytes16(sqlite3_stmt *, int iCol);)
|
||||
*
|
||||
* Return a FLOAT value.
|
||||
*/
|
||||
DoxyDefine(double switch_core_db_column_double(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(double switch_core_db_column_double(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_double sqlite3_column_double
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -598,7 +619,8 @@ DoxyDefine(double switch_core_db_column_double(sqlite3_stmt *, int iCol);)
|
||||
* Return an INTEGER value in the host computer's native integer representation.
|
||||
* This might be either a 32- or 64-bit integer depending on the host.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_column_int(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(int switch_core_db_column_int(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_int sqlite3_column_int
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -639,7 +661,8 @@ DoxyDefine(int switch_core_db_column_int(sqlite3_stmt *, int iCol);)
|
||||
*
|
||||
* Return an INTEGER value as a 64-bit signed integer.
|
||||
*/
|
||||
DoxyDefine(sqlite_int64 switch_core_db_column_int64(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(sqlite_int64 switch_core_db_column_int64(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_int64 sqlite3_column_int64
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -680,7 +703,8 @@ DoxyDefine(int switch_core_db_column_int(sqlite3_stmt *, int iCol);)
|
||||
*
|
||||
* Return the value as UTF-8 text.
|
||||
*/
|
||||
DoxyDefine(const unsigned char *switch_core_db_column_text(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(const unsigned char *switch_core_db_column_text(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_text sqlite3_column_text
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -721,7 +745,8 @@ DoxyDefine(const unsigned char *switch_core_db_column_text(sqlite3_stmt *, int i
|
||||
*
|
||||
* Return the value as UTF-16 text.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_column_text16(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(const void *switch_core_db_column_text16(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_text16 sqlite3_column_text16
|
||||
/**
|
||||
* The next group of routines returns information about the information
|
||||
@@ -763,21 +788,24 @@ DoxyDefine(const void *switch_core_db_column_text16(sqlite3_stmt *, int iCol);)
|
||||
* ReturnS the datatype of the result. This is one of
|
||||
* SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_column_type(sqlite3_stmt *, int iCol);)
|
||||
DoxyDefine(int switch_core_db_column_type(sqlite3_stmt *, int iCol);
|
||||
)
|
||||
#define switch_core_db_column_type sqlite3_column_type
|
||||
/**
|
||||
* The first parameter is a compiled SQL statement. This function returns
|
||||
* the column heading for the Nth column of that statement, where N is the
|
||||
* second function parameter. The string returned is UTF-8.
|
||||
*/
|
||||
DoxyDefine(const char *switch_core_db_column_name(sqlite3_stmt *, int);)
|
||||
DoxyDefine(const char *switch_core_db_column_name(sqlite3_stmt *, int);
|
||||
)
|
||||
#define switch_core_db_column_name sqlite3_column_name
|
||||
/**
|
||||
* Return the number of columns in the result set returned by the compiled
|
||||
* SQL statement. This routine returns 0 if pStmt is an SQL statement
|
||||
* that does not return data (for example an UPDATE).
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_column_count(sqlite3_stmt * pStmt);)
|
||||
DoxyDefine(int switch_core_db_column_count(sqlite3_stmt * pStmt);
|
||||
)
|
||||
#define switch_core_db_column_count sqlite3_column_count
|
||||
/**
|
||||
* The first parameter is a compiled SQL statement. If this statement
|
||||
@@ -797,7 +825,8 @@ DoxyDefine(int switch_core_db_column_count(sqlite3_stmt * pStmt);)
|
||||
* result column (i==1), and a NULL pointer for the first result column
|
||||
* (i==0).
|
||||
*/
|
||||
DoxyDefine(const char *switch_core_db_column_decltype(sqlite3_stmt *, int i);)
|
||||
DoxyDefine(const char *switch_core_db_column_decltype(sqlite3_stmt *, int i);
|
||||
)
|
||||
#define switch_core_db_column_decltype sqlite3_column_decltype
|
||||
/**
|
||||
* The first parameter is a compiled SQL statement. If this statement
|
||||
@@ -817,7 +846,8 @@ DoxyDefine(const char *switch_core_db_column_decltype(sqlite3_stmt *, int i);)
|
||||
* result column (i==1), and a NULL pointer for the first result column
|
||||
* (i==0).
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_column_decltype16(sqlite3_stmt *, int);)
|
||||
DoxyDefine(const void *switch_core_db_column_decltype16(sqlite3_stmt *, int);
|
||||
)
|
||||
#define switch_core_db_column_decltype16 sqlite3_column_decltype16
|
||||
/**
|
||||
* Register a callback function to be invoked whenever a new transaction
|
||||
@@ -832,7 +862,8 @@ DoxyDefine(const void *switch_core_db_column_decltype16(sqlite3_stmt *, int);)
|
||||
*
|
||||
****** THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_commit_hook(switch_core_db *, int (*)(void *), void *);)
|
||||
DoxyDefine(void *switch_core_db_commit_hook(switch_core_db *, int (*)(void *), void *);
|
||||
)
|
||||
#define switch_core_db_commit_hook sqlite3_commit_hook
|
||||
/**
|
||||
* This functions return true if the given input string comprises
|
||||
@@ -843,7 +874,8 @@ DoxyDefine(void *switch_core_db_commit_hook(switch_core_db *, int (*)(void *), v
|
||||
* and comments is a semicolon, then return true. otherwise return
|
||||
* false.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_complete(const char *sql);)
|
||||
DoxyDefine(int switch_core_db_complete(const char *sql);
|
||||
)
|
||||
#define switch_core_db_complete sqlite3_complete
|
||||
/**
|
||||
* This function is used to add new collation sequences to the
|
||||
@@ -871,10 +903,9 @@ DoxyDefine(int switch_core_db_complete(const char *sql);)
|
||||
* string. i.e. (STRING1 - STRING2).
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_create_collation(switch_core_db *,
|
||||
const char *zName,
|
||||
int eTextRep,
|
||||
void *, int (*xCompare) (void *, int, const void *, int, const void *)
|
||||
);)
|
||||
const char *zName, int eTextRep, void *, int (*xCompare) (void *, int, const void *, int, const void *)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_create_collation sqlite3_create_collation
|
||||
/**
|
||||
* The following function is used to add user functions or aggregates
|
||||
@@ -915,9 +946,9 @@ DoxyDefine(int switch_core_db_create_function(switch_core_db *,
|
||||
int eTextRep,
|
||||
void *,
|
||||
void (*xFunc) (sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xStep) (sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xFinal) (sqlite3_context *)
|
||||
);)
|
||||
void (*xStep) (sqlite3_context *, int, sqlite3_value **), void (*xFinal) (sqlite3_context *)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_create_function sqlite3_create_function
|
||||
/**
|
||||
* Return the number of values in the current row of the result set.
|
||||
@@ -928,7 +959,8 @@ DoxyDefine(int switch_core_db_create_function(switch_core_db *,
|
||||
* error code, or before switch_core_db_step() has been called on a
|
||||
* compiled SQL statement, this routine returns zero.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_data_count(sqlite3_stmt * pStmt);)
|
||||
DoxyDefine(int switch_core_db_data_count(sqlite3_stmt * pStmt);
|
||||
)
|
||||
#define switch_core_db_data_count sqlite3_data_count
|
||||
/**
|
||||
* Return the sqlite3* database handle to which the prepared statement given
|
||||
@@ -936,7 +968,8 @@ DoxyDefine(int switch_core_db_data_count(sqlite3_stmt * pStmt);)
|
||||
* the first argument to the switch_core_db_prepare() that was used to create
|
||||
* the statement in the first place.
|
||||
*/
|
||||
DoxyDefine(switch_core_db * switch_core_db_db_handle(sqlite3_stmt *);)
|
||||
DoxyDefine(switch_core_db * switch_core_db_db_handle(sqlite3_stmt *);
|
||||
)
|
||||
#define switch_core_db_db_handle sqlite3_db_handle
|
||||
/**
|
||||
** Return the error code for the most recent switch_core_db_* API call associated
|
||||
@@ -953,7 +986,8 @@ DoxyDefine(int switch_core_db_data_count(sqlite3_stmt * pStmt);)
|
||||
** code returned by this function is associated with the same error as
|
||||
** the strings returned by sqlite3_errmsg() and sqlite3_errmsg16().
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_errcode(switch_core_db * db);)
|
||||
DoxyDefine(int switch_core_db_errcode(switch_core_db * db);
|
||||
)
|
||||
#define switch_core_db_errcode sqlite3_errcode
|
||||
/**
|
||||
* Return a pointer to a UTF-8 encoded string describing in english the
|
||||
@@ -963,7 +997,8 @@ DoxyDefine(int switch_core_db_errcode(switch_core_db * db);)
|
||||
* The string "not an error" is returned when the most recent API call was
|
||||
* successful.
|
||||
*/
|
||||
DoxyDefine(const char *switch_core_db_errmsg(switch_core_db *);)
|
||||
DoxyDefine(const char *switch_core_db_errmsg(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_errmsg sqlite3_errmsg
|
||||
/**
|
||||
* A function to executes one or more statements of SQL.
|
||||
@@ -1010,7 +1045,8 @@ DoxyDefine(int switch_core_db_exec(switch_core_db *, /* An open database */
|
||||
sqlite3_callback, /* Callback function */
|
||||
void *, /* 1st argument to callback function */
|
||||
char **errmsg /* Error msg written here */
|
||||
);)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_exec sqlite3_exec
|
||||
/**
|
||||
* Return TRUE (non-zero) if the statement supplied as an argument needs
|
||||
@@ -1021,7 +1057,8 @@ DoxyDefine(int switch_core_db_exec(switch_core_db *, /* An open database */
|
||||
* added or changed.
|
||||
*
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_expired(sqlite3_stmt *);)
|
||||
DoxyDefine(int switch_core_db_expired(sqlite3_stmt *);
|
||||
)
|
||||
#define switch_core_db_expired sqlite3_expired
|
||||
/**
|
||||
* This function is called to delete a compiled
|
||||
@@ -1037,12 +1074,14 @@ DoxyDefine(int switch_core_db_expired(sqlite3_stmt *);)
|
||||
* rolled back and transactions cancelled, depending on the circumstances,
|
||||
* and the result code returned will be SQLITE_ABORT.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_finalize(sqlite3_stmt * pStmt);)
|
||||
DoxyDefine(int switch_core_db_finalize(sqlite3_stmt * pStmt);
|
||||
)
|
||||
#define switch_core_db_finalize sqlite3_finalize
|
||||
/**
|
||||
* Call this routine to free the memory that sqlite3_get_table() allocated.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_free_table(char **result);)
|
||||
DoxyDefine(void switch_core_db_free_table(char **result);
|
||||
)
|
||||
#define switch_core_db_free_table sqlite3_free_table
|
||||
/**
|
||||
* Test to see whether or not the database connection is in autocommit
|
||||
@@ -1050,7 +1089,8 @@ DoxyDefine(void switch_core_db_free_table(char **result);)
|
||||
* by default. Autocommit is disabled by a BEGIN statement and reenabled
|
||||
* by the next COMMIT or ROLLBACK.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_get_autocommit(switch_core_db *);)
|
||||
DoxyDefine(int switch_core_db_get_autocommit(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_get_autocommit sqlite3_get_autocommit
|
||||
/**
|
||||
* The following function may be used by scalar user functions to
|
||||
@@ -1071,7 +1111,8 @@ DoxyDefine(int switch_core_db_get_autocommit(switch_core_db *);)
|
||||
* expressions that are constant at compile time. This includes literal
|
||||
* values and SQL variables.
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_get_auxdata(sqlite3_context *, int);)
|
||||
DoxyDefine(void *switch_core_db_get_auxdata(sqlite3_context *, int);
|
||||
)
|
||||
#define switch_core_db_get_auxdata sqlite3_get_auxdata
|
||||
/**
|
||||
* The following function may be used by scalar user functions to
|
||||
@@ -1094,7 +1135,8 @@ DoxyDefine(void *switch_core_db_get_auxdata(sqlite3_context *, int);)
|
||||
* expressions that are constant at compile time. This includes literal
|
||||
* values and SQL variables.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_set_auxdata(sqlite3_context *, int, void *, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_set_auxdata(sqlite3_context *, int, void *, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_set_auxdata sqlite3_set_auxdata
|
||||
/**
|
||||
* This next routine is really just a wrapper around sqlite3_exec().
|
||||
@@ -1143,7 +1185,8 @@ DoxyDefine(int switch_core_db_get_table(switch_core_db *, /* An open database */
|
||||
int *nrow, /* Number of result rows written here */
|
||||
int *ncolumn, /* Number of result columns written here */
|
||||
char **errmsg /* Error msg written here */
|
||||
);)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_get_table sqlite3_get_table
|
||||
/**
|
||||
* This function is called to recover from a malloc() failure that occured
|
||||
@@ -1164,7 +1207,8 @@ DoxyDefine(int switch_core_db_get_table(switch_core_db *, /* An open database */
|
||||
* This functionality can be omitted from a build by defining the
|
||||
* SQLITE_OMIT_GLOBALRECOVER at compile time.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_global_recover();)
|
||||
DoxyDefine(int switch_core_db_global_recover();
|
||||
)
|
||||
#define switch_core_db_global_recover sqlite3_global_recover
|
||||
/** This function causes any pending database operation to abort and
|
||||
* return at its earliest opportunity. This routine is typically
|
||||
@@ -1172,7 +1216,8 @@ DoxyDefine(int switch_core_db_global_recover();)
|
||||
* or Ctrl-C where the user wants a long query operation to halt
|
||||
* immediately.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_interrupt(switch_core_db *);)
|
||||
DoxyDefine(void switch_core_db_interrupt(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_interrupt sqlite3_interrupt
|
||||
/**
|
||||
* Each entry in an SQLite table has a unique integer key. (The key is
|
||||
@@ -1183,7 +1228,8 @@ DoxyDefine(void switch_core_db_interrupt(switch_core_db *);)
|
||||
*
|
||||
* This function is similar to the mysql_insert_id() function from MySQL.
|
||||
*/
|
||||
DoxyDefine(sqlite_int64 switch_core_db_last_insert_rowid(switch_core_db *);)
|
||||
DoxyDefine(sqlite_int64 switch_core_db_last_insert_rowid(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_last_insert_rowid sqlite3_last_insert_rowid
|
||||
/**
|
||||
* Open the sqlite database file "filename". The "filename" is UTF-8
|
||||
@@ -1202,7 +1248,8 @@ DoxyDefine(void switch_core_db_interrupt(switch_core_db *);)
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_open(const char *filename, /* Database filename (UTF-8) */
|
||||
switch_core_db ** ppDb /* OUT: SQLite db handle */
|
||||
);)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_open sqlite3_open
|
||||
/**
|
||||
* To execute an SQL query, it must first be compiled into a byte-code
|
||||
@@ -1226,12 +1273,13 @@ DoxyDefine(int switch_core_db_open(const char *filename, /* Database filename (U
|
||||
*
|
||||
* On success, SQLITE_OK is returned. Otherwise an error code is returned.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_prepare(sqlite3 * db, /* Database handle */
|
||||
DoxyDefine(int switch_core_db_prepare(sqlite3 *db, /* Database handle */
|
||||
const char *zSql, /* SQL statement, UTF-8 encoded */
|
||||
int nBytes, /* Length of zSql in bytes. */
|
||||
sqlite3_stmt ** ppStmt, /* OUT: Statement handle */
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);)
|
||||
);
|
||||
)
|
||||
#define switch_core_db_prepare sqlite3_prepare
|
||||
/**
|
||||
* Register a function for tracing SQL command evaluation. The function registered by
|
||||
@@ -1241,8 +1289,8 @@ DoxyDefine(int switch_core_db_prepare(sqlite3 * db, /* Database handle */
|
||||
* The sqlite3_profile() API is currently considered experimental and
|
||||
* is subject to change.
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_profile(switch_core_db *,
|
||||
void (*xProfile) (void *, const char *, sqlite_uint64), void *);)
|
||||
DoxyDefine(void *switch_core_db_profile(switch_core_db *, void (*xProfile) (void *, const char *, sqlite_uint64), void *);
|
||||
)
|
||||
#define switch_core_db_profile sqlite3_profile
|
||||
/**
|
||||
* This routine configures a callback function - the progress callback - that
|
||||
@@ -1270,7 +1318,8 @@ DoxyDefine(void *switch_core_db_profile(switch_core_db *,
|
||||
*
|
||||
****** THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_progress_handler(switch_core_db *, int, int (*)(void *), void *);)
|
||||
DoxyDefine(void switch_core_db_progress_handler(switch_core_db *, int, int (*)(void *), void *);
|
||||
)
|
||||
#define switch_core_db_progress_handler sqlite3_progress_handler
|
||||
/**
|
||||
* The switch_core_db_reset() function is called to reset a compiled SQL
|
||||
@@ -1279,79 +1328,92 @@ DoxyDefine(void switch_core_db_progress_handler(switch_core_db *, int, int (*)(v
|
||||
* Any SQL statement variables that had values bound to them using
|
||||
* the switch_core_db_bind_*() API retain their values.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_reset(sqlite3_stmt * pStmt);)
|
||||
DoxyDefine(int switch_core_db_reset(sqlite3_stmt * pStmt);
|
||||
)
|
||||
#define switch_core_db_reset sqlite3_reset
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_blob(sqlite3_context *, const void *, int, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_result_blob(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_result_blob sqlite3_result_blob
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_double(sqlite3_context *, double);)
|
||||
DoxyDefine(void switch_core_db_result_double(sqlite3_context *, double);
|
||||
)
|
||||
#define switch_core_db_result_double sqlite3_result_double
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_error(sqlite3_context *, const char *, int);)
|
||||
DoxyDefine(void switch_core_db_result_error(sqlite3_context *, const char *, int);
|
||||
)
|
||||
#define switch_core_db_result_error sqlite3_result_error
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_error16(sqlite3_context *, const void *, int);)
|
||||
DoxyDefine(void switch_core_db_result_error16(sqlite3_context *, const void *, int);
|
||||
)
|
||||
#define switch_core_db_result_error16 sqlite3_result_error16
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_int(sqlite3_context *, int);)
|
||||
DoxyDefine(void switch_core_db_result_int(sqlite3_context *, int);
|
||||
)
|
||||
#define switch_core_db_result_int sqlite3_result_int
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_int64(sqlite3_context *, sqlite_int64);)
|
||||
DoxyDefine(void switch_core_db_result_int64(sqlite3_context *, sqlite_int64);
|
||||
)
|
||||
#define switch_core_db_result_int64 sqlite3_result_int64
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_null(sqlite3_context *);)
|
||||
DoxyDefine(void switch_core_db_result_null(sqlite3_context *);
|
||||
)
|
||||
#define switch_core_db_result_null sqlite3_result_null
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_text(sqlite3_context *, const char *, int, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_result_text(sqlite3_context *, const char *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_result_text sqlite3_result_text
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_text16(sqlite3_context *, const void *, int, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_result_text16(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_result_text16 sqlite3_result_text16
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_text16le(sqlite3_context *, const void *, int, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_result_text16le(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_result_text16le sqlite3_result_text16le
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_text16be(sqlite3_context *, const void *, int, void (*)(void *));)
|
||||
DoxyDefine(void switch_core_db_result_text16be(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
)
|
||||
#define switch_core_db_result_text16be sqlite3_result_text16be
|
||||
/**
|
||||
* User-defined functions invoke this routine in order to
|
||||
* set their return value.
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_result_value(sqlite3_context *, sqlite3_value *);)
|
||||
DoxyDefine(void switch_core_db_result_value(sqlite3_context *, sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_result_value sqlite3_result_value
|
||||
/**
|
||||
* This routine registers a callback with the SQLite library. The
|
||||
@@ -1362,8 +1424,8 @@ DoxyDefine(void switch_core_db_result_value(sqlite3_context *, sqlite3_value *);
|
||||
* if the column should be treated as a NULL value.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_set_authorizer(switch_core_db *,
|
||||
int (*xAuth) (void *, int, const char *, const char *, const char *,
|
||||
const char *), void *pUserData);)
|
||||
int (*xAuth) (void *, int, const char *, const char *, const char *, const char *), void *pUserData);
|
||||
)
|
||||
#define switch_core_db_set_authorizer sqlite3_set_authorizer
|
||||
/**
|
||||
* After an SQL query has been compiled with a call to either
|
||||
@@ -1397,7 +1459,8 @@ DoxyDefine(int switch_core_db_set_authorizer(switch_core_db *,
|
||||
* SQLITE_DONE. Or it could be the case the the same database connection
|
||||
* is being used simulataneously by two or more threads.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_step(sqlite3_stmt *);)
|
||||
DoxyDefine(int switch_core_db_step(sqlite3_stmt *);
|
||||
)
|
||||
#define switch_core_db_step sqlite3_step
|
||||
/**
|
||||
* If the following global variable is made to point to a
|
||||
@@ -1409,7 +1472,8 @@ DoxyDefine(int switch_core_db_step(sqlite3_stmt *);)
|
||||
* Once switch_core_db_open() has been called, changing this variable will invalidate
|
||||
* the current temporary database, if any.
|
||||
*/
|
||||
DoxyDefine(extern char *switch_core_db_temp_directory;)
|
||||
DoxyDefine(extern char *switch_core_db_temp_directory;
|
||||
)
|
||||
#define switch_core_db_temp_directory sqlite3_temp_directory
|
||||
/**
|
||||
* This function returns the number of database rows that have been
|
||||
@@ -1427,14 +1491,16 @@ DoxyDefine(int switch_core_db_step(sqlite3_stmt *);)
|
||||
* table. To get an accurate count of the number of rows deleted, use
|
||||
* "DELETE FROM table WHERE 1" instead.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_total_changes(switch_core_db *);)
|
||||
DoxyDefine(int switch_core_db_total_changes(switch_core_db *);
|
||||
)
|
||||
#define switch_core_db_total_changes sqlite3_total_changes
|
||||
/**
|
||||
* Register a function for tracing SQL command evaluation. The function
|
||||
* registered is invoked at the first switch_core_db_step()
|
||||
* for the evaluation of an SQL statement.
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_trace(switch_core_db *, void (*xTrace) (void *, const char *), void *);)
|
||||
DoxyDefine(void *switch_core_db_trace(switch_core_db *, void (*xTrace) (void *, const char *), void *);
|
||||
)
|
||||
#define switch_core_db_trace sqlite3_trace
|
||||
/**
|
||||
* Move all bindings from the first prepared statement over to the second.
|
||||
@@ -1443,14 +1509,16 @@ DoxyDefine(void *switch_core_db_trace(switch_core_db *, void (*xTrace) (void *,
|
||||
* the second prepared statement then all of the bindings transfered over
|
||||
* to the second statement before the first statement is finalized.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_transfer_bindings(sqlite3_stmt *, sqlite3_stmt *);)
|
||||
DoxyDefine(int switch_core_db_transfer_bindings(sqlite3_stmt *, sqlite3_stmt *);
|
||||
)
|
||||
#define switch_core_db_transfer_bindings sqlite3_transfer_bindings
|
||||
/**
|
||||
* The pUserData parameter to the switch_core_db_create_function()
|
||||
* routine used to register user functions is available to
|
||||
* the implementation of the function using this call.
|
||||
*/
|
||||
DoxyDefine(void *switch_core_db_user_data(sqlite3_context *);)
|
||||
DoxyDefine(void *switch_core_db_user_data(sqlite3_context *);
|
||||
)
|
||||
#define switch_core_db_user_data sqlite3_user_data
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1460,7 +1528,8 @@ DoxyDefine(void *switch_core_db_user_data(sqlite3_context *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_value_blob(sqlite3_value *);)
|
||||
DoxyDefine(const void *switch_core_db_value_blob(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_blob sqlite3_value_blob
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1470,7 +1539,8 @@ DoxyDefine(const void *switch_core_db_value_blob(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_value_bytes(sqlite3_value *);)
|
||||
DoxyDefine(int switch_core_db_value_bytes(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_bytes sqlite3_value_bytes
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1480,7 +1550,8 @@ DoxyDefine(int switch_core_db_value_bytes(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_value_bytes16(sqlite3_value *);)
|
||||
DoxyDefine(int switch_core_db_value_bytes16(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_bytes16 sqlite3_value_bytes16
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1490,7 +1561,8 @@ DoxyDefine(int switch_core_db_value_bytes16(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(double switch_core_db_value_double(sqlite3_value *);)
|
||||
DoxyDefine(double switch_core_db_value_double(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_double sqlite3_value_double
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1500,7 +1572,8 @@ DoxyDefine(double switch_core_db_value_double(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_value_int(sqlite3_value *);)
|
||||
DoxyDefine(int switch_core_db_value_int(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_int sqlite3_value_int
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1510,7 +1583,8 @@ DoxyDefine(int switch_core_db_value_int(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(sqlite_int64 switch_core_db_value_int64(sqlite3_value *);)
|
||||
DoxyDefine(sqlite_int64 switch_core_db_value_int64(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_int64 sqlite3_value_int64
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1520,7 +1594,8 @@ DoxyDefine(int switch_core_db_value_int(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(const unsigned char *switch_core_db_value_text(sqlite3_value *);)
|
||||
DoxyDefine(const unsigned char *switch_core_db_value_text(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_text sqlite3_value_text
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1530,7 +1605,8 @@ DoxyDefine(const unsigned char *switch_core_db_value_text(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_value_text16(sqlite3_value *);)
|
||||
DoxyDefine(const void *switch_core_db_value_text16(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_text16 sqlite3_value_text16
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1540,7 +1616,8 @@ DoxyDefine(const void *switch_core_db_value_text16(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_value_text16be(sqlite3_value *);)
|
||||
DoxyDefine(const void *switch_core_db_value_text16be(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_text16be sqlite3_value_text16be
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1550,7 +1627,8 @@ DoxyDefine(const void *switch_core_db_value_text16be(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(const void *switch_core_db_value_text16le(sqlite3_value *);)
|
||||
DoxyDefine(const void *switch_core_db_value_text16le(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_text16le sqlite3_value_text16le
|
||||
/**
|
||||
* returns information about parameters to
|
||||
@@ -1560,7 +1638,8 @@ DoxyDefine(const void *switch_core_db_value_text16le(sqlite3_value *);)
|
||||
* sqlite3_value* pointer instead of an sqlite3_stmt* and an integer
|
||||
* column number.
|
||||
*/
|
||||
DoxyDefine(int switch_core_db_value_type(sqlite3_value *);)
|
||||
DoxyDefine(int switch_core_db_value_type(sqlite3_value *);
|
||||
)
|
||||
#define switch_core_db_value_type sqlite3_value_type
|
||||
/**
|
||||
* This routine is a variant of the "sprintf()" from the
|
||||
@@ -1603,7 +1682,8 @@ DoxyDefine(int switch_core_db_value_type(sqlite3_value *);)
|
||||
* should always use %q instead of %s when inserting text into a string
|
||||
* literal.
|
||||
*/
|
||||
DoxyDefine(char *switch_core_db_mprintf(const char *, ...);)
|
||||
DoxyDefine(char *switch_core_db_mprintf(const char *, ...);
|
||||
)
|
||||
#define switch_core_db_mprintf sqlite3_mprintf
|
||||
#define switch_mprintf sqlite3_mprintf
|
||||
/**
|
||||
@@ -1647,7 +1727,8 @@ DoxyDefine(char *switch_core_db_mprintf(const char *, ...);)
|
||||
* should always use %q instead of %s when inserting text into a string
|
||||
* literal.
|
||||
*/
|
||||
DoxyDefine(char *switch_core_db_vmprintf(const char *, va_list);)
|
||||
DoxyDefine(char *switch_core_db_vmprintf(const char *, va_list);
|
||||
)
|
||||
#define switch_core_db_vmprintf sqlite3_vmprintf
|
||||
/**
|
||||
* This routine is a variant of the "sprintf()" from the
|
||||
@@ -1690,12 +1771,14 @@ DoxyDefine(char *switch_core_db_vmprintf(const char *, va_list);)
|
||||
* should always use %q instead of %s when inserting text into a string
|
||||
* literal.
|
||||
*/
|
||||
DoxyDefine(char *switch_core_db_snprintf(int, char *, const char *, ...);)
|
||||
DoxyDefine(char *switch_core_db_snprintf(int, char *, const char *, ...);
|
||||
)
|
||||
#define switch_core_db_snprintf sqlite3_snprintf
|
||||
/**
|
||||
* call this routine to free memory malloced by a call to switch_core_db_mprintf, switch_core_db_vmprintf, or switch_core_db_snprintf
|
||||
*/
|
||||
DoxyDefine(void switch_core_db_free(char *z);)
|
||||
DoxyDefine(void switch_core_db_free(char *z);
|
||||
)
|
||||
#define switch_core_db_free sqlite3_free
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
@@ -136,7 +136,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
|
||||
@@ -154,8 +154,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
|
||||
@@ -164,8 +163,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_s
|
||||
\param len the maximum size of the username buffer
|
||||
\return a pointer to the username or NULL
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_stun_packet_attribute_get_username(switch_stun_packet_attribute_t *attribute,
|
||||
char *username, uint16_t len);
|
||||
SWITCH_DECLARE(char *) switch_stun_packet_attribute_get_username(switch_stun_packet_attribute_t *attribute, char *username, uint16_t len);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -175,8 +173,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
|
||||
@@ -185,8 +182,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_st
|
||||
\param ulen the length of the username
|
||||
\return true or false
|
||||
*/
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username,
|
||||
uint16_t ulen);
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_packet_t *packet, char *username, uint16_t ulen);
|
||||
|
||||
|
||||
/*!
|
||||
@@ -196,8 +192,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_pa
|
||||
\param port the port of the mapped address
|
||||
\return true or false
|
||||
*/
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr,
|
||||
uint16_t port);
|
||||
SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_stun_packet_t *packet, char *ipstr, uint16_t port);
|
||||
|
||||
/*!
|
||||
\brief Perform a stun lookup
|
||||
@@ -210,9 +205,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_s
|
||||
\return SUCCESS or FAIL
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
|
||||
switch_port_t *port,
|
||||
char *stunip,
|
||||
switch_port_t stunport, char **err, switch_memory_pool_t *pool);
|
||||
switch_port_t *port, char *stunip, switch_port_t stunport, char **err, switch_memory_pool_t * pool);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,7 +114,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 enum {
|
||||
SWITCH_FALSE = 0,
|
||||
@@ -976,11 +976,9 @@ typedef void (*switch_scheduler_func_t) (switch_scheduler_task_t *task);
|
||||
typedef switch_status_t (*switch_state_handler_t) (switch_core_session_t *);
|
||||
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_api_function_t) (char *in, switch_core_session_t *session,
|
||||
switch_stream_handle_t *stream);
|
||||
typedef switch_status_t (*switch_api_function_t) (char *in, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input,
|
||||
switch_input_type_t input_type, void *buf,
|
||||
unsigned int buflen);
|
||||
switch_input_type_t input_type, void *buf, unsigned int buflen);
|
||||
typedef struct switch_say_interface switch_say_interface_t;
|
||||
typedef struct {
|
||||
switch_input_callback_function_t input_callback;
|
||||
@@ -988,9 +986,7 @@ typedef struct {
|
||||
uint32_t buflen;
|
||||
} switch_input_args_t;
|
||||
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);
|
||||
char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args);
|
||||
typedef switch_status_t (*switch_module_load_t) (switch_loadable_module_interface_t **, char *);
|
||||
typedef switch_status_t (*switch_module_reload_t) (void);
|
||||
typedef switch_status_t (*switch_module_pause_t) (void);
|
||||
@@ -1001,9 +997,7 @@ typedef switch_status_t (*switch_module_shutdown_t) (void);
|
||||
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, const char *params, void *user_data);
|
||||
const char *tag_name, const char *key_name, const char *key_value, const char *params, void *user_data);
|
||||
|
||||
/* things we don't deserve to know about */
|
||||
/*! \brief A channel */
|
||||
|
||||
@@ -219,7 +219,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
|
||||
\param esc the escape character
|
||||
\return the escaped string
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t *pool, char *in, char *delim, char esc);
|
||||
SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t * pool, char *in, char *delim, char esc);
|
||||
|
||||
/*!
|
||||
\brief Wait for a socket
|
||||
@@ -227,7 +227,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
|
||||
@@ -236,8 +236,7 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
||||
SWITCH_DECLARE(const char *) switch_cut_path(const char *in);
|
||||
|
||||
SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace);
|
||||
SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search,
|
||||
size_t search_len);
|
||||
SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
|
||||
|
||||
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK)
|
||||
SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len);
|
||||
|
||||
@@ -137,8 +137,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_child(switch_xml_t xml, const char *name
|
||||
///\param attrname the attribute name
|
||||
///\param value the value
|
||||
///\return an xml node or NULL
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(switch_xml_t node, const char *childname, const char *attrname,
|
||||
const char *value);
|
||||
SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(switch_xml_t node, const char *childname, const char *attrname, const char *value);
|
||||
|
||||
///\brief returns the next tag of the same name in the same section and depth or NULL
|
||||
///\ if not found
|
||||
@@ -292,7 +291,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
|
||||
///\param pool a memory pool to use
|
||||
///\param err a pointer to set error strings
|
||||
///\return SWITCH_STATUS_SUCCESS if successful
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err);
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t * pool, const char **err);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void);
|
||||
@@ -313,9 +312,7 @@ 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 *params);
|
||||
const char *key_name, const char *key_value, switch_xml_t * root, switch_xml_t * node, const char *params);
|
||||
|
||||
///\brief open a config in the core registry
|
||||
///\param file_path the name of the config section e.g. modules.conf
|
||||
@@ -330,8 +327,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_x
|
||||
///\param user_data a pointer to private data to be used during the callback
|
||||
///\return SWITCH_STATUS_SUCCESS if successful
|
||||
///\note gateway functions will be executed in the order they were binded until a success is found else the root registry will be used
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function(switch_xml_search_function_t function,
|
||||
switch_xml_section_t sections, void *user_data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function(switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data);
|
||||
|
||||
///\brief parse a string for a list of sections
|
||||
///\param str a | delimited list of section names
|
||||
|
||||
@@ -67,16 +67,13 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
|
||||
&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
|
||||
switch_channel_set_flag(caller_channel, CF_NOMEDIA);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Channel is already up, delaying point-to-point mode 'till both legs are up.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying point-to-point mode 'till both legs are up.\n");
|
||||
no_media_bridge = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n",
|
||||
switch_channel_cause2str(cause));
|
||||
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(cause));
|
||||
if (!do_continue && cause != SWITCH_CAUSE_NO_ANSWER) {
|
||||
/* All Causes besides NO_ANSWER terminate the originating session unless continue_on_fail is set.
|
||||
We will pass the fail cause on when we hangup. */
|
||||
@@ -137,8 +134,7 @@ static const switch_loadable_module_interface_t mod_bridgecall_module_interface
|
||||
/*.application_interface */ &bridge_application_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -80,8 +80,7 @@ static switch_status_t status_function(char *cmd, switch_core_session_t *session
|
||||
"UP %u year%s, %u day%s, %u hour%s, %u minute%s, %u second%s, %u millisecond%s, %u microsecond%s\n",
|
||||
duration.yr, duration.yr == 1 ? "" : "s", duration.day, duration.day == 1 ? "" : "s",
|
||||
duration.hr, duration.hr == 1 ? "" : "s", duration.min, duration.min == 1 ? "" : "s",
|
||||
duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s",
|
||||
duration.mms, duration.mms == 1 ? "" : "s");
|
||||
duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms, duration.mms == 1 ? "" : "s");
|
||||
|
||||
stream->write_function(stream, "%d sessions\n", switch_core_session_count());
|
||||
|
||||
@@ -96,9 +95,7 @@ static switch_status_t status_function(char *cmd, switch_core_session_t *session
|
||||
refresh++;
|
||||
r = atoi(refresh);
|
||||
if (r > 0) {
|
||||
stream->write_function(stream,
|
||||
"<META HTTP-EQUIV=REFRESH CONTENT=\"%d; URL=/api/status?refresh=%d%s\">\n", r, r,
|
||||
html ? "html=1" : "");
|
||||
stream->write_function(stream, "<META HTTP-EQUIV=REFRESH CONTENT=\"%d; URL=/api/status?refresh=%d%s\">\n", r, r, html ? "html=1" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,8 +130,7 @@ static switch_status_t ctl_function(char *data, switch_core_session_t *session,
|
||||
arg = 0;
|
||||
switch_core_session_ctl(SCSC_SHUTDOWN, &arg);
|
||||
} else {
|
||||
stream->write_function(stream, "INVALID COMMAND [%s]\nUSAGE: fsctl [hupall|pause|resume|shutdown]\n",
|
||||
argv[0]);
|
||||
stream->write_function(stream, "INVALID COMMAND [%s]\nUSAGE: fsctl [hupall|pause|resume|shutdown]\n", argv[0]);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -161,8 +157,7 @@ static switch_status_t load_function(char *mod, switch_core_session_t *session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) mod, SWITCH_TRUE) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) mod, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "OK\n");
|
||||
} else {
|
||||
stream->write_function(stream, "ERROR\n");
|
||||
@@ -250,8 +245,7 @@ static switch_status_t transfer_function(char *cmd, switch_core_session_t *isess
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t sched_transfer_function(char *cmd, switch_core_session_t *isession,
|
||||
switch_stream_handle_t *stream)
|
||||
static switch_status_t sched_transfer_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
|
||||
{
|
||||
switch_core_session_t *session = NULL;
|
||||
char *argv[6] = { 0 };
|
||||
@@ -365,8 +359,7 @@ static switch_status_t uuid_media_function(char *cmd, switch_core_session_t *ise
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t uuid_broadcast_function(char *cmd, switch_core_session_t *isession,
|
||||
switch_stream_handle_t *stream)
|
||||
static switch_status_t uuid_broadcast_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *argv[4] = { 0 };
|
||||
int argc = 0;
|
||||
@@ -403,8 +396,7 @@ static switch_status_t uuid_broadcast_function(char *cmd, switch_core_session_t
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t sched_broadcast_function(char *cmd, switch_core_session_t *isession,
|
||||
switch_stream_handle_t *stream)
|
||||
static switch_status_t sched_broadcast_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *argv[4] = { 0 };
|
||||
int argc = 0;
|
||||
@@ -500,8 +492,7 @@ static switch_status_t uuid_bridge_function(char *cmd, switch_core_session_t *is
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t session_record_function(char *cmd, switch_core_session_t *isession,
|
||||
switch_stream_handle_t *stream)
|
||||
static switch_status_t session_record_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
|
||||
{
|
||||
switch_core_session_t *session = NULL;
|
||||
char *argv[4] = { 0 };
|
||||
@@ -647,13 +638,11 @@ static switch_status_t originate_function(char *cmd, switch_core_session_t *ises
|
||||
timeout = atoi(argv[6]);
|
||||
}
|
||||
|
||||
if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (machine) {
|
||||
stream->write_function(stream, "fail: %s\n", switch_channel_cause2str(cause));
|
||||
} else {
|
||||
stream->write_function(stream, "Cannot Create Outgoing Channel! [%s] cause: %s\n", aleg,
|
||||
switch_channel_cause2str(cause));
|
||||
stream->write_function(stream, "Cannot Create Outgoing Channel! [%s] cause: %s\n", aleg, switch_channel_cause2str(cause));
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -704,14 +693,14 @@ static void sch_api_callback(switch_scheduler_task_t *task)
|
||||
assert(task);
|
||||
|
||||
cmd = (char *) task->cmd_arg;
|
||||
|
||||
|
||||
if ((arg = strchr(cmd, ' '))) {
|
||||
*arg++ = '\0';
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
switch_api_execute(cmd, arg, NULL, &stream);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *)stream.data));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
|
||||
switch_safe_free(stream.data);
|
||||
}
|
||||
|
||||
@@ -723,7 +712,7 @@ static switch_status_t sched_api_function(char *cmd, switch_core_session_t *ises
|
||||
assert(cmd != NULL);
|
||||
tm = strdup(cmd);
|
||||
assert(tm != NULL);
|
||||
|
||||
|
||||
if ((dcmd = strchr(tm, ' '))) {
|
||||
uint32_t id;
|
||||
|
||||
@@ -738,10 +727,10 @@ static switch_status_t sched_api_function(char *cmd, switch_core_session_t *ises
|
||||
stream->write_function(stream, "Added task %u\n", id);
|
||||
} else {
|
||||
stream->write_function(stream, "Invalid syntax\n");
|
||||
}
|
||||
}
|
||||
|
||||
switch_safe_free(tm);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -767,8 +756,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
for (x = 0; x < argc; x++) {
|
||||
if (holder->http) {
|
||||
holder->stream->write_function(holder->stream, "<td>");
|
||||
holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x],
|
||||
x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
|
||||
holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
|
||||
} else {
|
||||
holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ",");
|
||||
}
|
||||
@@ -782,11 +770,9 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
for (x = 0; x < argc; x++) {
|
||||
if (holder->http) {
|
||||
holder->stream->write_function(holder->stream, "<td>");
|
||||
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "",
|
||||
x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
|
||||
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
|
||||
} else {
|
||||
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "",
|
||||
x == (argc - 1) ? "\n" : ",");
|
||||
holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : ",");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,8 +820,7 @@ static switch_status_t show_function(char *cmd, switch_core_session_t *session,
|
||||
holder.print_title = 0;
|
||||
if ((cmdname = strchr(cmd, ' ')) != 0) {
|
||||
*cmdname++ = '\0';
|
||||
snprintf(sql, sizeof(sql) - 1,
|
||||
"select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
|
||||
snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
|
||||
} else {
|
||||
snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
|
||||
}
|
||||
@@ -1073,8 +1058,7 @@ static const switch_loadable_module_interface_t mod_commands_module_interface =
|
||||
/*.api_interface */ &originate_api_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &mod_commands_module_interface;
|
||||
|
||||
@@ -272,18 +272,16 @@ typedef struct api_command {
|
||||
|
||||
/* Function Prototypes */
|
||||
static uint32_t next_member_id(void);
|
||||
static conference_relationship_t *member_get_relationship(conference_member_t * member,
|
||||
conference_member_t * other_member);
|
||||
static conference_relationship_t *member_get_relationship(conference_member_t * member, conference_member_t * other_member);
|
||||
static conference_member_t *conference_member_get(conference_obj_t * conference, uint32_t id);
|
||||
static conference_relationship_t *member_add_relationship(conference_member_t * member, uint32_t id);
|
||||
static switch_status_t member_del_relationship(conference_member_t * member, uint32_t id);
|
||||
static switch_status_t conference_add_member(conference_obj_t * conference, conference_member_t * member);
|
||||
static switch_status_t conference_del_member(conference_obj_t * conference, conference_member_t * member);
|
||||
static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj);
|
||||
static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj);
|
||||
static void conference_loop_output(conference_member_t * member);
|
||||
static uint32_t conference_stop_file(conference_obj_t * conference, file_stop_t stop);
|
||||
static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin,
|
||||
switch_channel_t *channel, uint8_t async);
|
||||
static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async);
|
||||
static switch_status_t conference_say(conference_obj_t * conference, const char *text, uint32_t leadin);
|
||||
static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim);
|
||||
static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
@@ -291,24 +289,19 @@ static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
|
||||
static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto,
|
||||
uint32_t timeout,
|
||||
char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
|
||||
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
|
||||
static switch_status_t conference_outcall_bg(conference_obj_t * conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto,
|
||||
uint32_t timeout, char *flags, char *cid_name, char *cid_num);
|
||||
switch_core_session_t *session, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num);
|
||||
static void conference_function(switch_core_session_t *session, char *data);
|
||||
static void launch_conference_thread(conference_obj_t * conference);
|
||||
static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
|
||||
static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj);
|
||||
static switch_status_t conference_local_play_file(conference_obj_t * conference,
|
||||
switch_core_session_t *session, char *path, uint32_t leadin,
|
||||
char *buf, switch_size_t len);
|
||||
switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len);
|
||||
static switch_status_t conference_member_play_file(conference_member_t * member, char *file, uint32_t leadin);
|
||||
static switch_status_t conference_member_say(conference_member_t * member, char *text, uint32_t leadin);
|
||||
static uint32_t conference_member_stop_file(conference_member_t * member, file_stop_t stop);
|
||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
|
||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t * pool);
|
||||
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
|
||||
static void launch_conference_record_thread(conference_obj_t * conference, char *path);
|
||||
|
||||
@@ -316,8 +309,7 @@ typedef switch_status_t (*conf_api_args_cmd_t) (conference_obj_t *, switch_strea
|
||||
typedef switch_status_t (*conf_api_member_cmd_t) (conference_member_t *, switch_stream_handle_t *, void *);
|
||||
typedef switch_status_t (*conf_api_text_cmd_t) (conference_obj_t *, switch_stream_handle_t *, const char *);
|
||||
|
||||
static void conference_member_itterator(conference_obj_t * conference,
|
||||
switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data);
|
||||
static void conference_member_itterator(conference_obj_t * conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data);
|
||||
static switch_status_t conf_api_sub_mute(conference_member_t * member, switch_stream_handle_t *stream, void *data);
|
||||
static switch_status_t conf_api_sub_unmute(conference_member_t * member, switch_stream_handle_t *stream, void *data);
|
||||
static switch_status_t conf_api_sub_deaf(conference_member_t * member, switch_stream_handle_t *stream, void *data);
|
||||
@@ -336,8 +328,7 @@ static uint32_t next_member_id(void)
|
||||
}
|
||||
|
||||
/* if other_member has a relationship with member, produce it */
|
||||
static conference_relationship_t *member_get_relationship(conference_member_t * member,
|
||||
conference_member_t * other_member)
|
||||
static conference_relationship_t *member_get_relationship(conference_member_t * member, conference_member_t * other_member)
|
||||
{
|
||||
conference_relationship_t *rel = NULL;
|
||||
|
||||
@@ -493,15 +484,13 @@ static switch_status_t conference_add_member(conference_obj_t * conference, conf
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count,
|
||||
conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
if (conference->count > 1 && conference->enter_sound) {
|
||||
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN,
|
||||
switch_core_session_get_channel(member->session), 0);
|
||||
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
|
||||
}
|
||||
// anounce the total number of members in the conference
|
||||
if (conference->count >= conference->anounce_count && conference->anounce_count > 1) {
|
||||
@@ -509,8 +498,7 @@ static switch_status_t conference_add_member(conference_obj_t * conference, conf
|
||||
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
|
||||
} else if (conference->count == 1) {
|
||||
if (conference->alone_sound) {
|
||||
conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN,
|
||||
switch_core_session_get_channel(member->session), 0);
|
||||
conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
|
||||
} else {
|
||||
snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
|
||||
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
|
||||
@@ -601,8 +589,7 @@ static switch_status_t conference_del_member(conference_obj_t * conference, conf
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count,
|
||||
conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
@@ -612,12 +599,10 @@ static switch_status_t conference_del_member(conference_obj_t * conference, conf
|
||||
switch_set_flag(conference, CFLAG_DESTRUCT);
|
||||
} else {
|
||||
if (conference->exit_sound) {
|
||||
conference_play_file(conference, conference->exit_sound, 0,
|
||||
switch_core_session_get_channel(member->session), 0);
|
||||
conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session), 0);
|
||||
}
|
||||
if (conference->count == 1 && conference->alone_sound) {
|
||||
conference_play_file(conference, conference->alone_sound, 0,
|
||||
switch_core_session_get_channel(member->session), 0);
|
||||
conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +628,7 @@ static switch_status_t conference_del_member(conference_obj_t * conference, conf
|
||||
}
|
||||
|
||||
/* Main monitor thread (1 per distinct conference room) */
|
||||
static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
conference_obj_t *conference = (conference_obj_t *) obj;
|
||||
conference_member_t *imember, *omember;
|
||||
@@ -659,10 +644,8 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
|
||||
async_file_frame = switch_core_alloc(conference->pool, CONF_BUFFER_SIZE);
|
||||
|
||||
|
||||
if (switch_core_timer_init(&timer, conference->timer_name, conference->interval, samples, conference->pool) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success interval: %u samples: %u\n",
|
||||
conference->interval, samples);
|
||||
if (switch_core_timer_init(&timer, conference->timer_name, conference->interval, samples, conference->pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success interval: %u samples: %u\n", conference->interval, samples);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed. Conference Cannot Start\n");
|
||||
return NULL;
|
||||
@@ -700,21 +683,17 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
|
||||
if (imember->mux_resampler && switch_buffer_inuse(imember->resample_buffer) >= bytes) {
|
||||
imember->read = (uint32_t) switch_buffer_read(imember->resample_buffer, imember->frame, bytes);
|
||||
ready++;
|
||||
} else
|
||||
if ((imember->read =
|
||||
(uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, imember->buflen))) {
|
||||
} else if ((imember->read = (uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, imember->buflen))) {
|
||||
/* If the caller is not at the right sample rate resample him to suit and buffer accordingly */
|
||||
if (imember->mux_resampler) {
|
||||
int16_t *bptr = (int16_t *) imember->frame;
|
||||
int16_t out[1024];
|
||||
int len = (int) imember->read;
|
||||
|
||||
imember->mux_resampler->from_len =
|
||||
switch_short_to_float(bptr, imember->mux_resampler->from, (int) len / 2);
|
||||
imember->mux_resampler->from_len = switch_short_to_float(bptr, imember->mux_resampler->from, (int) len / 2);
|
||||
imember->mux_resampler->to_len =
|
||||
switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
|
||||
imember->mux_resampler->from_len, imember->mux_resampler->to,
|
||||
imember->mux_resampler->to_size, 0);
|
||||
imember->mux_resampler->from_len, imember->mux_resampler->to, imember->mux_resampler->to_size, 0);
|
||||
switch_float_to_short(imember->mux_resampler->to, out, len);
|
||||
len = imember->mux_resampler->to_len * 2;
|
||||
switch_buffer_write(imember->resample_buffer, out, len);
|
||||
@@ -739,9 +718,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
|
||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
|
||||
uint32_t rate = conference->rate;
|
||||
|
||||
if (switch_core_speech_read_tts(&conference->fnode->sh,
|
||||
file_frame,
|
||||
&file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_speech_read_tts(&conference->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
|
||||
file_sample_len = file_data_len / 2;
|
||||
} else {
|
||||
file_sample_len = file_data_len = 0;
|
||||
@@ -1278,7 +1255,7 @@ static void conference_loop_fn_hangup(conference_member_t * member, caller_contr
|
||||
}
|
||||
|
||||
/* marshall frames from the call leg to the conference thread for muxing to other call legs */
|
||||
static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
conference_member_t *member = obj;
|
||||
switch_channel_t *channel;
|
||||
@@ -1343,11 +1320,9 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
|
||||
switch_event_t *event;
|
||||
talking = 1;
|
||||
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s",
|
||||
member->conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
|
||||
switch_event_fire(&event);
|
||||
@@ -1364,11 +1339,9 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
|
||||
hangover_hits = hangunder_hits = 0;
|
||||
talking = 0;
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s",
|
||||
member->conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", member->conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "stop-talking");
|
||||
switch_event_fire(&event);
|
||||
@@ -1384,12 +1357,10 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
|
||||
int16_t *bptr = (int16_t *) read_frame->data;
|
||||
int len = (int) read_frame->datalen;;
|
||||
|
||||
member->read_resampler->from_len =
|
||||
switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
|
||||
member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
|
||||
member->read_resampler->to_len =
|
||||
switch_resample_process(member->read_resampler, member->read_resampler->from,
|
||||
member->read_resampler->from_len, member->read_resampler->to,
|
||||
member->read_resampler->to_size, 0);
|
||||
member->read_resampler->from_len, member->read_resampler->to, member->read_resampler->to_size, 0);
|
||||
switch_float_to_short(member->read_resampler->to, read_frame->data, len);
|
||||
len = member->read_resampler->to_len * 2;
|
||||
read_frame->datalen = len;
|
||||
@@ -1413,7 +1384,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
|
||||
}
|
||||
|
||||
/* launch an input thread for the call leg */
|
||||
static void launch_conference_loop_input(conference_member_t * member, switch_memory_pool_t *pool)
|
||||
static void launch_conference_loop_input(conference_member_t * member, switch_memory_pool_t * pool)
|
||||
{
|
||||
if (member != NULL) {
|
||||
switch_thread_t *thread;
|
||||
@@ -1486,10 +1457,8 @@ static void conference_loop_output(conference_member_t * member)
|
||||
launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
|
||||
|
||||
/* build a digit stream object */
|
||||
if (member->conference->dtmf_parser != NULL &&
|
||||
switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Warning Will Robinson, there is no digit parser stream object\n");
|
||||
if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n");
|
||||
}
|
||||
|
||||
/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
|
||||
@@ -1514,8 +1483,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||
char *p, *freeme = NULL;
|
||||
|
||||
if ((p = strchr(to, '+')) && strncmp(to, CONF_CHAT_PROTO, strlen(CONF_CHAT_PROTO))) {
|
||||
freeme =
|
||||
switch_mprintf("%s+%s@%s", CONF_CHAT_PROTO, member->conference->name, member->conference->domain);
|
||||
freeme = switch_mprintf("%s+%s@%s", CONF_CHAT_PROTO, member->conference->name, member->conference->domain);
|
||||
to = freeme;
|
||||
}
|
||||
|
||||
@@ -1527,14 +1495,12 @@ static void conference_loop_output(conference_member_t * member)
|
||||
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
|
||||
/* test to see if outbound channel has answered */
|
||||
if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Outbound conference channel answered, setting CFLAG_ANSWERED\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound conference channel answered, setting CFLAG_ANSWERED\n");
|
||||
switch_set_flag(member->conference, CFLAG_ANSWERED);
|
||||
}
|
||||
} else {
|
||||
if (switch_test_flag(member->conference, CFLAG_ANSWERED) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"CLFAG_ANSWERED set, answering inbound channel\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CLFAG_ANSWERED set, answering inbound channel\n");
|
||||
switch_channel_answer(channel);
|
||||
}
|
||||
}
|
||||
@@ -1547,15 +1513,12 @@ static void conference_loop_output(conference_member_t * member)
|
||||
|
||||
for (digit = dtmf; *digit && caller_action == NULL; digit++) {
|
||||
caller_action = (caller_control_action_t *)
|
||||
switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream,
|
||||
*digit);
|
||||
switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
|
||||
}
|
||||
}
|
||||
/* otherwise, clock the parser so that it can handle digit timeout detection */
|
||||
} else if (member->conference->dtmf_parser != NULL) {
|
||||
caller_action =
|
||||
(caller_control_action_t *) switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser,
|
||||
member->digit_stream, '\0');
|
||||
caller_action = (caller_control_action_t *) switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0');
|
||||
}
|
||||
|
||||
/* if a caller action has been detected, handle it */
|
||||
@@ -1572,9 +1535,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||
SWITCH_LOG_INFO,
|
||||
"executing caller control '%s' param '%s' on call '%u, %s, %s, %s'\n",
|
||||
caller_action->fndesc->key,
|
||||
param ? param : "none",
|
||||
member->id,
|
||||
switch_channel_get_name(channel), profile->caller_id_name, profile->caller_id_number);
|
||||
param ? param : "none", member->id, switch_channel_get_name(channel), profile->caller_id_name, profile->caller_id_number);
|
||||
#endif
|
||||
|
||||
caller_action->fndesc->handler(member, caller_action);
|
||||
@@ -1614,9 +1575,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
|
||||
uint32_t rate = member->conference->rate;
|
||||
|
||||
if (switch_core_speech_read_tts(&member->fnode->sh,
|
||||
file_frame,
|
||||
&file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_speech_read_tts(&member->fnode->sh, file_frame, &file_data_len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
|
||||
file_sample_len = file_data_len / 2;
|
||||
} else {
|
||||
file_sample_len = file_data_len = 0;
|
||||
@@ -1732,7 +1691,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||
}
|
||||
|
||||
/* Sub-Routine called by a record entity inside a conference */
|
||||
static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
switch_file_handle_t fh = { 0 };
|
||||
@@ -1772,15 +1731,13 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
|
||||
switch_mutex_init(&member->audio_out_mutex, SWITCH_MUTEX_NESTED, rec->pool);
|
||||
|
||||
/* Setup an audio buffer for the incoming audio */
|
||||
if (switch_buffer_create_dynamic(&member->audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, 0) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_buffer_create_dynamic(&member->audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, 0) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Setup an audio buffer for the outgoing audio */
|
||||
if (switch_buffer_create_dynamic(&member->mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, 0) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_buffer_create_dynamic(&member->mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, 0) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -1791,19 +1748,14 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
|
||||
}
|
||||
|
||||
if (switch_core_file_open(&fh,
|
||||
rec->path,
|
||||
(uint8_t) 1,
|
||||
conference->rate,
|
||||
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, rec->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
rec->path, (uint8_t) 1, conference->rate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, rec->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_timer_init(&timer, conference->timer_name, conference->interval, samples, rec->pool) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success interval: %u samples: %u\n",
|
||||
conference->interval, samples);
|
||||
if (switch_core_timer_init(&timer, conference->timer_name, conference->interval, samples, rec->pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success interval: %u samples: %u\n", conference->interval, samples);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed. Conference Cannot Start\n");
|
||||
goto end;
|
||||
@@ -1814,8 +1766,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
|
||||
switch_safe_free(vval);
|
||||
}
|
||||
|
||||
switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST,
|
||||
"FreeSWITCH mod_conference Software Conference Module");
|
||||
switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, "FreeSWITCH mod_conference Software Conference Module");
|
||||
|
||||
while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) {
|
||||
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
|
||||
@@ -1936,8 +1887,7 @@ static uint32_t conference_member_stop_file(conference_member_t * member, file_s
|
||||
}
|
||||
|
||||
/* Play a file in the conference room */
|
||||
static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin,
|
||||
switch_channel_t *channel, uint8_t async)
|
||||
static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
conference_file_node_t *fnode, *nptr = NULL;
|
||||
@@ -2004,11 +1954,7 @@ static switch_status_t conference_play_file(conference_obj_t * conference, char
|
||||
fnode->leadin = leadin;
|
||||
|
||||
/* Open the file */
|
||||
if (switch_core_file_open(&fnode->fh,
|
||||
file,
|
||||
(uint8_t) 1,
|
||||
conference->rate,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_file_open(&fnode->fh, file, (uint8_t) 1, conference->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
status = SWITCH_STATUS_NOTFOUND;
|
||||
goto done;
|
||||
@@ -2065,8 +2011,7 @@ static switch_status_t conference_member_play_file(conference_member_t * member,
|
||||
conference_file_node_t *fnode, *nptr;
|
||||
switch_memory_pool_t *pool;
|
||||
|
||||
if ((expanded =
|
||||
switch_channel_expand_variables(switch_core_session_get_channel(member->session), file)) != file) {
|
||||
if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), file)) != file) {
|
||||
file = expanded;
|
||||
} else {
|
||||
expanded = NULL;
|
||||
@@ -2109,10 +2054,7 @@ static switch_status_t conference_member_play_file(conference_member_t * member,
|
||||
|
||||
/* Open the file */
|
||||
if (switch_core_file_open(&fnode->fh,
|
||||
file,
|
||||
(uint8_t) 1,
|
||||
member->conference->rate,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
file, (uint8_t) 1, member->conference->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
status = SWITCH_STATUS_NOTFOUND;
|
||||
goto done;
|
||||
@@ -2178,12 +2120,8 @@ static switch_status_t conference_member_say(conference_member_t * member, char
|
||||
fnode->pool = pool;
|
||||
|
||||
memset(&fnode->sh, 0, sizeof(fnode->sh));
|
||||
if (switch_core_speech_open(&fnode->sh,
|
||||
conference->tts_engine,
|
||||
conference->tts_voice,
|
||||
conference->rate, &flags, fnode->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n",
|
||||
conference->tts_engine);
|
||||
if (switch_core_speech_open(&fnode->sh, conference->tts_engine, conference->tts_voice, conference->rate, &flags, fnode->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -2253,10 +2191,7 @@ static switch_status_t conference_say(conference_obj_t * conference, const char
|
||||
fnode->leadin = leadin;
|
||||
|
||||
memset(&fnode->sh, 0, sizeof(fnode->sh));
|
||||
if (switch_core_speech_open(&fnode->sh,
|
||||
conference->tts_engine,
|
||||
conference->tts_voice,
|
||||
conference->rate, &flags, conference->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_speech_open(&fnode->sh, conference->tts_engine, conference->tts_voice, conference->rate, &flags, conference->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -2284,8 +2219,7 @@ static switch_status_t conference_say(conference_obj_t * conference, const char
|
||||
}
|
||||
|
||||
/* execute a callback for every member of the conference */
|
||||
static void conference_member_itterator(conference_obj_t * conference, switch_stream_handle_t *stream,
|
||||
conf_api_member_cmd_t pfncallback, void *data)
|
||||
static void conference_member_itterator(conference_obj_t * conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
|
||||
{
|
||||
conference_member_t *member = NULL;
|
||||
|
||||
@@ -2359,9 +2293,7 @@ static void conference_list(conference_obj_t * conference, switch_stream_handle_
|
||||
|
||||
|
||||
stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
|
||||
member->id, delim,
|
||||
name, delim,
|
||||
uuid, delim, profile->caller_id_name, delim, profile->caller_id_number, delim);
|
||||
member->id, delim, name, delim, uuid, delim, profile->caller_id_name, delim, profile->caller_id_number, delim);
|
||||
|
||||
if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
|
||||
stream->write_function(stream, "hear");
|
||||
@@ -2373,9 +2305,7 @@ static void conference_list(conference_obj_t * conference, switch_stream_handle_
|
||||
count++;
|
||||
}
|
||||
|
||||
stream->write_function(stream, "%s%d%s%d%s%d\n",
|
||||
delim,
|
||||
member->volume_in_level, delim, member->volume_out_level, delim, member->energy_level);
|
||||
stream->write_function(stream, "%s%d%s%d%s%d\n", delim, member->volume_in_level, delim, member->volume_out_level, delim, member->energy_level);
|
||||
}
|
||||
|
||||
switch_mutex_unlock(conference->member_mutex);
|
||||
@@ -2692,8 +2622,7 @@ static switch_status_t conf_api_sub_volume_out(conference_member_t * member, swi
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
int ret_status = SWITCH_STATUS_GENERR;
|
||||
|
||||
@@ -2729,9 +2658,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_s
|
||||
|
||||
stream->write_function(stream, "Conference %s (%u member%s%s)\n",
|
||||
conference->name,
|
||||
conference->count,
|
||||
conference->count == 1 ? "" : "s",
|
||||
switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
|
||||
conference->count, conference->count == 1 ? "" : "s", switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
|
||||
if (pretty) {
|
||||
conference_list_pretty(conference, stream);
|
||||
} else {
|
||||
@@ -2751,8 +2678,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_s
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_play(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_play(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
int ret_status = SWITCH_STATUS_GENERR;
|
||||
switch_event_t *event;
|
||||
@@ -2786,8 +2712,7 @@ static switch_status_t conf_api_sub_play(conference_obj_t * conference, switch_s
|
||||
if ((member = conference_member_get(conference, id))) {
|
||||
if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
|
||||
@@ -2833,8 +2758,7 @@ static switch_status_t conf_api_sub_say(conference_obj_t * conference, switch_st
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, switch_stream_handle_t *stream,
|
||||
const char *text)
|
||||
static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, switch_stream_handle_t *stream, const char *text)
|
||||
{
|
||||
int ret_status = SWITCH_STATUS_GENERR;
|
||||
char *expanded = NULL;
|
||||
@@ -2870,8 +2794,7 @@ static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, swi
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((expanded =
|
||||
switch_channel_expand_variables(switch_core_session_get_channel(member->session), (char *) text)) != text) {
|
||||
if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), (char *) text)) != text) {
|
||||
text = expanded;
|
||||
} else {
|
||||
expanded = NULL;
|
||||
@@ -2899,8 +2822,7 @@ static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, swi
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_stop(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_stop(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
int ret_status = SWITCH_STATUS_GENERR;
|
||||
uint8_t current = 0, all = 0;
|
||||
@@ -2937,8 +2859,7 @@ static switch_status_t conf_api_sub_stop(conference_obj_t * conference, switch_s
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_relate(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_relate(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
int ret_status = SWITCH_STATUS_GENERR;
|
||||
|
||||
@@ -3007,8 +2928,7 @@ static switch_status_t conf_api_sub_relate(conference_obj_t * conference, switch
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_lock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_lock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_event_t *event;
|
||||
|
||||
@@ -3030,8 +2950,7 @@ static switch_status_t conf_api_sub_lock(conference_obj_t * conference, switch_s
|
||||
return 0;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_unlock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_unlock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_event_t *event;
|
||||
|
||||
@@ -3054,8 +2973,7 @@ static switch_status_t conf_api_sub_unlock(conference_obj_t * conference, switch
|
||||
return 0;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_dial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_dial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -3080,8 +2998,7 @@ static switch_status_t conf_api_sub_dial(conference_obj_t * conference, switch_s
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t conf_api_sub_bgdial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_bgdial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -3102,8 +3019,7 @@ static switch_status_t conf_api_sub_bgdial(conference_obj_t * conference, switch
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_transfer(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_transfer(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
|
||||
char *params = NULL;
|
||||
@@ -3225,8 +3141,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t * conference, swit
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_record(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_record(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
|
||||
assert(conference != NULL);
|
||||
@@ -3242,8 +3157,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t * conference, switch
|
||||
return ret_status;
|
||||
}
|
||||
|
||||
static switch_status_t conf_api_sub_norecord(conference_obj_t * conference, switch_stream_handle_t *stream, int argc,
|
||||
char **argv)
|
||||
static switch_status_t conf_api_sub_norecord(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -3330,8 +3244,7 @@ static api_command_t conf_api_sub_commands[] = {
|
||||
|
||||
#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
|
||||
|
||||
switch_status_t conf_api_dispatch(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv,
|
||||
const char *cmdline, int argn)
|
||||
switch_status_t conf_api_dispatch(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
uint32_t i, found = 0;
|
||||
@@ -3371,9 +3284,7 @@ switch_status_t conf_api_dispatch(conference_obj_t * conference, switch_stream_h
|
||||
}
|
||||
|
||||
if (all) {
|
||||
conference_member_itterator(conference, stream,
|
||||
(conf_api_member_cmd_t) conf_api_sub_commands[i].pfnapicmd,
|
||||
argv[argn + 2]);
|
||||
conference_member_itterator(conference, stream, (conf_api_member_cmd_t) conf_api_sub_commands[i].pfnapicmd, argv[argn + 2]);
|
||||
} else if (last) {
|
||||
conference_member_t *member = NULL;
|
||||
conference_member_t *last_member = NULL;
|
||||
@@ -3421,8 +3332,7 @@ switch_status_t conf_api_dispatch(conference_obj_t * conference, switch_stream_h
|
||||
|
||||
if ((start_text = strstr(modified_cmdline, cmd))) {
|
||||
modified_cmdline = start_text + strlen(cmd);
|
||||
while (modified_cmdline && *modified_cmdline
|
||||
&& (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
|
||||
while (modified_cmdline && *modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
|
||||
modified_cmdline++;
|
||||
}
|
||||
}
|
||||
@@ -3558,9 +3468,7 @@ static const switch_state_handler_table_t audio_bridge_peer_state_handlers = {
|
||||
static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto,
|
||||
uint32_t timeout,
|
||||
char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
|
||||
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
|
||||
{
|
||||
switch_core_session_t *peer_session;
|
||||
switch_channel_t *peer_channel;
|
||||
@@ -3611,13 +3519,8 @@ static switch_status_t conference_outcall(conference_obj_t * conference,
|
||||
|
||||
/* establish an outbound call leg */
|
||||
if (switch_ivr_originate(session,
|
||||
&peer_session,
|
||||
cause,
|
||||
bridgeto,
|
||||
timeout,
|
||||
&audio_bridge_peer_state_handlers, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
|
||||
switch_channel_cause2str(*cause));
|
||||
&peer_session, cause, bridgeto, timeout, &audio_bridge_peer_state_handlers, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause));
|
||||
if (caller_channel) {
|
||||
switch_channel_hangup(caller_channel, *cause);
|
||||
}
|
||||
@@ -3689,7 +3592,7 @@ struct bg_call {
|
||||
char *conference_name;
|
||||
};
|
||||
|
||||
static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
struct bg_call *call = (struct bg_call *) obj;
|
||||
|
||||
@@ -3697,8 +3600,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
|
||||
switch_call_cause_t cause;
|
||||
switch_event_t *event;
|
||||
|
||||
conference_outcall(call->conference, NULL, call->session, call->bridgeto, call->timeout, call->flags,
|
||||
call->cid_name, call->cid_num, &cause);
|
||||
conference_outcall(call->conference, NULL, call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", call->conference->name);
|
||||
@@ -3719,9 +3621,7 @@ static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread,
|
||||
|
||||
static switch_status_t conference_outcall_bg(conference_obj_t * conference,
|
||||
char *conference_name,
|
||||
switch_core_session_t *session,
|
||||
char *bridgeto,
|
||||
uint32_t timeout, char *flags, char *cid_name, char *cid_num)
|
||||
switch_core_session_t *session, char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num)
|
||||
{
|
||||
struct bg_call *call = NULL;
|
||||
|
||||
@@ -3766,8 +3666,7 @@ static switch_status_t conference_outcall_bg(conference_obj_t * conference,
|
||||
|
||||
/* Play a file */
|
||||
static switch_status_t conference_local_play_file(conference_obj_t * conference,
|
||||
switch_core_session_t *session, char *path, uint32_t leadin,
|
||||
char *buf, switch_size_t len)
|
||||
switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
|
||||
{
|
||||
uint32_t x = 0;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
@@ -3977,8 +3876,7 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
|
||||
/* be friendly */
|
||||
if (conference->pin_sound) {
|
||||
conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf,
|
||||
sizeof(pin_buf));
|
||||
conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
|
||||
}
|
||||
/* wait for them if neccessary */
|
||||
if (strlen(pin_buf) < strlen(conference->pin)) {
|
||||
@@ -3988,8 +3886,7 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
status = switch_ivr_collect_digits_count(session,
|
||||
buf,
|
||||
sizeof(pin_buf) - (unsigned int) strlen(pin_buf),
|
||||
(unsigned int) strlen(conference->pin) -
|
||||
(unsigned int) strlen(pin_buf), "#", &term, 10000);
|
||||
(unsigned int) strlen(conference->pin) - (unsigned int) strlen(pin_buf), "#", &term, 10000);
|
||||
}
|
||||
|
||||
pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
|
||||
@@ -3999,8 +3896,7 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
|
||||
/* more friendliness */
|
||||
if (conference->bad_pin_sound) {
|
||||
conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf,
|
||||
sizeof(pin_buf));
|
||||
conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
|
||||
}
|
||||
}
|
||||
pin_retries--;
|
||||
@@ -4047,8 +3943,7 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
/* if we're using "bridge:" make an outbound call and bridge it in */
|
||||
if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
|
||||
switch_call_cause_t cause;
|
||||
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) != SWITCH_STATUS_SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
@@ -4069,17 +3964,13 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
flags = 0;
|
||||
goto done;
|
||||
}
|
||||
@@ -4109,31 +4000,25 @@ static void conference_function(switch_core_session_t *session, char *data)
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
flags = 0;
|
||||
goto codec_done2;
|
||||
}
|
||||
|
||||
/* Setup an audio buffer for the incoming audio */
|
||||
if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
|
||||
goto codec_done1;
|
||||
}
|
||||
|
||||
/* Setup an audio buffer for the outgoing audio */
|
||||
if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
|
||||
goto codec_done1;
|
||||
}
|
||||
@@ -4385,8 +4270,7 @@ static switch_status_t conf_default_controls(conference_obj_t * conference)
|
||||
for (i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i < CCFNTBL_QTY; i++) {
|
||||
if (!switch_strlen_zero(ccfntbl[i].digits)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Installing default caller control action '%s' bound to '%s'.\n", ccfntbl[i].key,
|
||||
ccfntbl[i].digits);
|
||||
"Installing default caller control action '%s' bound to '%s'.\n", ccfntbl[i].key, ccfntbl[i].digits);
|
||||
action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
|
||||
if (action != NULL) {
|
||||
action->fndesc = &ccfntbl[i];
|
||||
@@ -4394,8 +4278,7 @@ static switch_status_t conf_default_controls(conference_obj_t * conference)
|
||||
status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, ccfntbl[i].digits, action);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key,
|
||||
ccfntbl[i].digits);
|
||||
"unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits);
|
||||
status = SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
}
|
||||
@@ -4405,8 +4288,7 @@ static switch_status_t conf_default_controls(conference_obj_t * conference)
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t * conference,
|
||||
switch_xml_t xml_controls, switch_xml_t xml_menus)
|
||||
static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t * conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
switch_xml_t xml_kvp;
|
||||
@@ -4432,11 +4314,8 @@ static switch_status_t conference_new_install_caller_controls_custom(conference_
|
||||
|
||||
caller_control_action_t *action;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Installing caller control action '%s' bound to '%s'.\n", key, val);
|
||||
action =
|
||||
(caller_control_action_t *) switch_core_alloc(conference->pool,
|
||||
sizeof(caller_control_action_t));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n", key, val);
|
||||
action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
|
||||
if (action != NULL) {
|
||||
action->fndesc = &ccfntbl[i];
|
||||
action->data = (void *) switch_core_strdup(conference->pool, data);
|
||||
@@ -4444,19 +4323,16 @@ static switch_status_t conference_new_install_caller_controls_custom(conference_
|
||||
status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, val, action);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"unable to alloc memory for caller control binding '%s' to '%s'\n",
|
||||
ccfntbl[i].key, ccfntbl[i].digits);
|
||||
"unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits);
|
||||
status = SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status == SWITCH_STATUS_NOOP) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n",
|
||||
key);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n", key);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4464,7 +4340,7 @@ static switch_status_t conference_new_install_caller_controls_custom(conference_
|
||||
}
|
||||
|
||||
/* create a new conferene with a specific profile */
|
||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
|
||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t * pool)
|
||||
{
|
||||
conference_obj_t *conference;
|
||||
switch_xml_t xml_kvp;
|
||||
@@ -4582,8 +4458,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||
// a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound
|
||||
// stuff is added, see comments above
|
||||
max_members = 0; // set to 0 to disable max counts
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"max-members %s is invalid, not setting a limit\n", val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
|
||||
}
|
||||
} else if (!strcasecmp(var, "max-members-sound")) {
|
||||
maxmember_sound = val;
|
||||
@@ -4592,8 +4467,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||
anounce_count = strtol(val, NULL, 0);
|
||||
if (errno == ERANGE || errno == EINVAL) {
|
||||
anounce_count = 0;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"anounce-count is invalid, not anouncing member counts\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "anounce-count is invalid, not anouncing member counts\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4755,8 +4629,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||
status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
|
||||
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Unable to install caller controls group '%s'\n", caller_controls);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", caller_controls);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
|
||||
@@ -4801,8 +4674,7 @@ static void pres_event_handler(switch_event_t *event)
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count,
|
||||
conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
@@ -4856,8 +4728,7 @@ static void send_presence(switch_event_types_t id)
|
||||
}
|
||||
|
||||
/* Called by FreeSWITCH when the module loads */
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
uint32_t i;
|
||||
size_t nl, ol = 0;
|
||||
@@ -4910,9 +4781,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
|
||||
|
||||
/* Subscribe to presence request events */
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ static void detect_speech_function(switch_core_session_t *session, char *data)
|
||||
switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n",
|
||||
detect_speech_application_interface.syntax);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", detect_speech_application_interface.syntax);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -430,8 +429,7 @@ static void privacy_function(switch_core_session_t *session, char *data)
|
||||
} else if (!strcasecmp(arg, "number")) {
|
||||
switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Privacy to %s [%d]\n", arg, caller_profile->flags);
|
||||
}
|
||||
@@ -552,7 +550,7 @@ static switch_status_t chat_api_function(char *fmt, switch_core_session_t *sessi
|
||||
static char *ivr_cf_name = "ivr.conf";
|
||||
|
||||
#ifdef _TEST_CALLBACK_
|
||||
static switch_ivr_action_t menu_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
|
||||
static switch_ivr_action_t menu_handler(switch_ivr_menu_t * menu, char *param, char *buf, size_t buflen, void *obj)
|
||||
{
|
||||
switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
|
||||
|
||||
@@ -585,11 +583,9 @@ static void ivr_application_function(switch_core_session_t *session, char *data)
|
||||
// build a menu tree and execute it
|
||||
if (switch_ivr_menu_stack_xml_init(&xml_ctx, NULL) == SWITCH_STATUS_SUCCESS
|
||||
#ifdef _TEST_CALLBACK_
|
||||
&& switch_ivr_menu_stack_xml_add_custom(xml_ctx, "custom",
|
||||
&menu_handler) == SWITCH_STATUS_SUCCESS
|
||||
&& switch_ivr_menu_stack_xml_add_custom(xml_ctx, "custom", &menu_handler) == SWITCH_STATUS_SUCCESS
|
||||
#endif
|
||||
&& switch_ivr_menu_stack_xml_build(xml_ctx, &menu_stack, xml_menus,
|
||||
xml_menu) == SWITCH_STATUS_SUCCESS) {
|
||||
&& switch_ivr_menu_stack_xml_build(xml_ctx, &menu_stack, xml_menus, xml_menu) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_xml_free(cxml);
|
||||
cxml = NULL;
|
||||
switch_channel_pre_answer(channel);
|
||||
@@ -877,8 +873,7 @@ static const switch_loadable_module_interface_t mod_dptools_module_interface = {
|
||||
/*.api_interface */ &presence_api_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -67,8 +67,7 @@ static switch_loadable_module_interface_t echo_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &echo_module_interface;
|
||||
|
||||
@@ -329,8 +329,7 @@ static void parse_rr(const struct dns_parse *p, enum_query_t * q, struct dns_rr
|
||||
|
||||
if ((proceed = switch_regex_perform(q->number, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
if (strchr(regex, '(')) {
|
||||
switch_perform_substitution(re, proceed, replace, q->number, substituted, sizeof(substituted),
|
||||
ovector);
|
||||
switch_perform_substitution(re, proceed, replace, q->number, substituted, sizeof(substituted), ovector);
|
||||
uri = substituted;
|
||||
} else {
|
||||
uri = replace;
|
||||
@@ -338,8 +337,7 @@ static void parse_rr(const struct dns_parse *p, enum_query_t * q, struct dns_rr
|
||||
|
||||
if ((route = (enum_route_t *) switch_core_hash_find(globals.routes, service))) {
|
||||
switch_regex_safe_free(re);
|
||||
if ((proceed =
|
||||
switch_regex_perform(uri, route->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
if ((proceed = switch_regex_perform(uri, route->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
if (strchr(route->regex, '(')) {
|
||||
switch_perform_substitution(re, proceed, route->replace, uri, rbuf, sizeof(rbuf), ovector);
|
||||
uri = rbuf;
|
||||
@@ -395,8 +393,7 @@ static void dnscb(struct dns_ctx *ctx, void *result, void *data)
|
||||
if ((qcls == DNS_C_ANY || qcls == rr.dnsrr_cls) && (q->qtyp == DNS_T_ANY || q->qtyp == rr.dnsrr_typ))
|
||||
++nrr;
|
||||
else if (rr.dnsrr_typ == DNS_T_CNAME && !nrr) {
|
||||
if (dns_getdn(pkt, &rr.dnsrr_dptr, end,
|
||||
p.dnsp_dnbuf, sizeof(p.dnsp_dnbuf)) <= 0 || rr.dnsrr_dptr != rr.dnsrr_dend) {
|
||||
if (dns_getdn(pkt, &rr.dnsrr_dptr, end, p.dnsp_dnbuf, sizeof(p.dnsp_dnbuf)) <= 0 || rr.dnsrr_dptr != rr.dnsrr_dend) {
|
||||
r = DNS_E_PROTOCOL;
|
||||
break;
|
||||
} else {
|
||||
@@ -537,11 +534,8 @@ static switch_caller_extension_t *enum_dialplan_hunt(switch_core_session_t *sess
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ENUM Lookup on %s\n", caller_profile->destination_number);
|
||||
|
||||
if (enum_lookup(switch_strlen_zero(dp) ? globals.root : dp, caller_profile->destination_number, &results) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if ((extension =
|
||||
switch_caller_extension_new(session, caller_profile->destination_number,
|
||||
caller_profile->destination_number)) == 0) {
|
||||
if (enum_lookup(switch_strlen_zero(dp) ? globals.root : dp, caller_profile->destination_number, &results) == SWITCH_STATUS_SUCCESS) {
|
||||
if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
|
||||
free_results(&results);
|
||||
return NULL;
|
||||
@@ -596,8 +590,7 @@ static void enum_app_function(switch_core_session_t *session, char *data)
|
||||
void *vval;
|
||||
const void *vvar;
|
||||
|
||||
for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)); hi;
|
||||
hi = switch_hash_next(hi)) {
|
||||
for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &vvar, NULL, &vval);
|
||||
if (vvar && !strncmp(vvar, "enum_", 5)) {
|
||||
switch_channel_set_variable(channel, (char *) vvar, NULL);
|
||||
@@ -658,8 +651,7 @@ static switch_status_t enum_function(char *data, switch_core_session_t *session,
|
||||
|
||||
stream->write_function(stream,
|
||||
"\nOffered Routes:\n"
|
||||
"Order\tPref\tService \tRoute\n"
|
||||
"==============================================================================\n");
|
||||
"Order\tPref\tService \tRoute\n" "==============================================================================\n");
|
||||
|
||||
for (rp = results; rp; rp = rp->next) {
|
||||
stream->write_function(stream, "%d\t%d\t%-10s\t%s\n", rp->order, rp->preference, rp->service, rp->route);
|
||||
@@ -668,14 +660,12 @@ static switch_status_t enum_function(char *data, switch_core_session_t *session,
|
||||
|
||||
stream->write_function(stream,
|
||||
"\nSupported Routes:\n"
|
||||
"Order\tPref\tService \tRoute\n"
|
||||
"==============================================================================\n");
|
||||
"Order\tPref\tService \tRoute\n" "==============================================================================\n");
|
||||
|
||||
for (rtp = globals.route_order; rtp; rtp = rtp->next) {
|
||||
for (rp = results; rp; rp = rp->next) {
|
||||
if (!strcmp(rtp->service, rp->service)) {
|
||||
stream->write_function(stream, "%d\t%d\t%-10s\t%s\n", rp->order, rp->preference, rp->service,
|
||||
rp->route);
|
||||
stream->write_function(stream, "%d\t%d\t%-10s\t%s\n", rp->order, rp->preference, rp->service, rp->route);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -726,8 +716,7 @@ static switch_loadable_module_interface_t enum_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
if (dns_init(0) < 0) {
|
||||
|
||||
@@ -39,8 +39,7 @@ static const char modname[] = "mod_ivrtest";
|
||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
||||
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||
*/
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf,
|
||||
unsigned int buflen)
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch (itype) {
|
||||
case SWITCH_INPUT_TYPE_DTMF:{
|
||||
@@ -74,8 +73,7 @@ static void xml_function(switch_core_session_t *session, char *data)
|
||||
teamname = switch_xml_attr_soft(team, "name");
|
||||
for (driver = switch_xml_child(team, "driver"); driver; driver = driver->next) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"%s, %s: %s\n", switch_xml_child(driver, "name")->txt, teamname,
|
||||
switch_xml_child(driver, "points")->txt);
|
||||
"%s, %s: %s\n", switch_xml_child(driver, "name")->txt, teamname, switch_xml_child(driver, "points")->txt);
|
||||
}
|
||||
}
|
||||
switch_xml_free(f1);
|
||||
@@ -98,16 +96,11 @@ static void ivr_application_function(switch_core_session_t *session, char *data)
|
||||
NULL,
|
||||
"main",
|
||||
"please enter some numbers so i can figure out if I have any bugs or not",
|
||||
"enter some numbers",
|
||||
NULL, "I have no idea what that is", "cepstral", "david", NULL, 15000, 10, NULL);
|
||||
"enter some numbers", NULL, "I have no idea what that is", "cepstral", "david", NULL, 15000, 10, NULL);
|
||||
|
||||
|
||||
status = switch_ivr_menu_init(&sub_menu,
|
||||
menu,
|
||||
"sub",
|
||||
"/ram/congrats.wav",
|
||||
"/ram/extension.wav",
|
||||
NULL, "/ram/invalid.wav", NULL, NULL, NULL, 15000, 10, NULL);
|
||||
menu, "sub", "/ram/congrats.wav", "/ram/extension.wav", NULL, "/ram/invalid.wav", NULL, NULL, NULL, 15000, 10, NULL);
|
||||
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
// build the menu
|
||||
@@ -145,10 +138,7 @@ static void dirtest_function(switch_core_session_t *session, char *data)
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
if (switch_core_directory_open(&dh,
|
||||
"ldap",
|
||||
"ldap.freeswitch.org",
|
||||
"cn=Manager,dc=freeswitch,dc=org", "test", NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_directory_open(&dh, "ldap", "ldap.freeswitch.org", "cn=Manager,dc=freeswitch,dc=org", "test", NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't connect\n");
|
||||
return;
|
||||
}
|
||||
@@ -166,8 +156,7 @@ static void dirtest_function(switch_core_session_t *session, char *data)
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t show_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf,
|
||||
unsigned int buflen)
|
||||
static switch_status_t show_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
|
||||
switch (itype) {
|
||||
@@ -249,8 +238,7 @@ static void bugtest_function(switch_core_session_t *session, char *data)
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status;
|
||||
|
||||
if ((status = switch_core_media_bug_add(session,
|
||||
bug_callback, NULL, SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
||||
if ((status = switch_core_media_bug_add(session, bug_callback, NULL, SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return;
|
||||
}
|
||||
@@ -284,9 +272,7 @@ static void asrtest_function(switch_core_session_t *session, char *data)
|
||||
|
||||
|
||||
if (switch_core_asr_open(&ah, "lumenvox",
|
||||
read_codec->implementation->iananame,
|
||||
8000,
|
||||
"127.0.0.1", &flags, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
read_codec->implementation->iananame, 8000, "127.0.0.1", &flags, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
if (strcmp(ah.codec, read_codec->implementation->iananame)) {
|
||||
if (switch_core_codec_init(&codec,
|
||||
ah.codec,
|
||||
@@ -306,16 +292,14 @@ static void asrtest_function(switch_core_session_t *session, char *data)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->number_of_channels,
|
||||
read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->number_of_channels, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
switch_core_session_reset(session);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_asr_load_grammar(&ah, "demo", "/opt/lumenvox/engine_7.0/Lang/BuiltinGrammars/ABNFPhone.gram") !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_asr_load_grammar(&ah, "demo", "/opt/lumenvox/engine_7.0/Lang/BuiltinGrammars/ABNFPhone.gram") != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
|
||||
goto end;
|
||||
}
|
||||
@@ -393,8 +377,7 @@ static void ivrtest_function(switch_core_session_t *session, char *data)
|
||||
|
||||
while (switch_channel_get_state(channel) == CS_EXECUTE) {
|
||||
memset(buf, 0, sizeof(buf));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"Enter up to 10 digits, press # to terminate, * to hangup\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enter up to 10 digits, press # to terminate, * to hangup\n");
|
||||
|
||||
if (data) {
|
||||
switch_input_args_t args = { 0 };
|
||||
@@ -435,8 +418,7 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "I globally hooked to [%s] on the hangup event\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "I globally hooked to [%s] on the hangup event\n", switch_channel_get_name(channel));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
@@ -525,8 +507,7 @@ static const switch_loadable_module_interface_t mod_ivrtest_module_interface = {
|
||||
/*.application_interface */ &asrtest_application_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -59,8 +59,7 @@ static switch_loadable_module_interface_t park_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &park_module_interface;
|
||||
|
||||
@@ -38,8 +38,7 @@ static const char modname[] = "mod_playback";
|
||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
||||
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||
*/
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf,
|
||||
unsigned int buflen)
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
|
||||
|
||||
@@ -236,8 +235,7 @@ static const switch_loadable_module_interface_t mod_playback_module_interface =
|
||||
/*.application_interface */ &playback_application_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -85,8 +85,7 @@ static uint32_t match_count(char *str, uint32_t max)
|
||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
||||
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||
*/
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf,
|
||||
unsigned int buflen)
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch (itype) {
|
||||
case SWITCH_INPUT_TYPE_DTMF:{
|
||||
@@ -245,9 +244,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
|
||||
memset(&sh, 0, sizeof(sh));
|
||||
if (switch_core_speech_open(&sh,
|
||||
engine,
|
||||
voice, rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_speech_open(&sh, engine, voice, rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
|
||||
return;
|
||||
}
|
||||
@@ -257,30 +254,24 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
NULL,
|
||||
(int) rate,
|
||||
interval,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
|
||||
rate, interval);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", rate, interval);
|
||||
flags = 0;
|
||||
switch_core_speech_close(&sh, &flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer_name) {
|
||||
if (switch_core_timer_init
|
||||
(&timer, timer_name, interval, (int) (rate / 50),
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_timer_init(&timer, timer_name, interval, (int) (rate / 50), switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
|
||||
switch_core_codec_destroy(&speech_codec);
|
||||
flags = 0;
|
||||
switch_core_speech_close(&sh, &flags);
|
||||
return;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n",
|
||||
(rate / 50) * 2, interval);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", (rate / 50) * 2, interval);
|
||||
|
||||
/* start a thread to absorb incoming audio */
|
||||
for (stream_id = 0; stream_id < switch_core_session_get_stream_count(session); stream_id++) {
|
||||
@@ -311,8 +302,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
#else
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
|
||||
"Select one of the following news sources, followed by the pound key or press 0 to exit. "
|
||||
",<break time=\"600ms\"/>");
|
||||
"Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
|
||||
#endif
|
||||
len = (int32_t) strlen(buf);
|
||||
|
||||
@@ -370,10 +360,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
args.input_callback = NULL;
|
||||
args.buf = NULL;
|
||||
args.buflen = 0;
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp, "I'm sorry. That is an Invalid Selection. ", &args);
|
||||
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, "I'm sorry. That is an Invalid Selection. ", &args);
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
goto finished;
|
||||
}
|
||||
@@ -544,8 +531,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
if (switch_test_flag(&dtb, SFLAG_INFO)) {
|
||||
switch_clear_flag(&dtb, SFLAG_INFO);
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
"%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
|
||||
snprintf(buf + len, sizeof(buf) - len, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
|
||||
@@ -569,8 +555,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
|
||||
if (entries[dtb.index].dept_txt) {
|
||||
snprintf(buf + len, sizeof(buf) - len, "From the %s department. ",
|
||||
entries[dtb.index].dept_txt);
|
||||
snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
|
||||
@@ -599,10 +584,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
args.input_callback = on_dtmf;
|
||||
args.buf = &dtb;
|
||||
args.buflen = sizeof(dtb);
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp, entries[dtb.index].description_txt, &args);
|
||||
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, entries[dtb.index].description_txt, &args);
|
||||
}
|
||||
if (status == SWITCH_STATUS_BREAK) {
|
||||
continue;
|
||||
@@ -655,8 +637,7 @@ static switch_loadable_module_interface_t rss_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &rss_module_interface;
|
||||
|
||||
@@ -47,8 +47,7 @@ static switch_loadable_module_interface_t skel_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &skel_module_interface;
|
||||
|
||||
@@ -113,8 +113,7 @@ static swift_result_t write_audio(swift_event * event, swift_event_t type, void
|
||||
return rv;
|
||||
}
|
||||
|
||||
static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, char *voice_name, int rate,
|
||||
switch_speech_flag_t *flags)
|
||||
static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, char *voice_name, int rate, switch_speech_flag_t *flags)
|
||||
{
|
||||
cepstral_t *cepstral = switch_core_alloc(sh->memory_pool, sizeof(*cepstral));
|
||||
char srate[25];
|
||||
@@ -257,9 +256,7 @@ static void cepstral_speech_flush_tts(switch_speech_handle_t *sh)
|
||||
swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
|
||||
}
|
||||
|
||||
static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh,
|
||||
void *data,
|
||||
size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
|
||||
static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
|
||||
{
|
||||
cepstral_t *cepstral;
|
||||
size_t desired = *datalen;
|
||||
|
||||
@@ -113,8 +113,7 @@ static struct {
|
||||
|
||||
#endif
|
||||
|
||||
static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
|
||||
#ifdef AMR_PASSTHROUGH
|
||||
@@ -202,8 +201,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
|
||||
context->enc_mode = globals.default_bitrate;
|
||||
}
|
||||
|
||||
snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d",
|
||||
switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
|
||||
snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
|
||||
codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
|
||||
|
||||
context->enc_mode = AMR_DEFAULT_BITRATE;
|
||||
@@ -245,9 +243,7 @@ static switch_status_t switch_amr_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef AMR_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -259,9 +255,7 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*encoded_data_len =
|
||||
Encoder_Interface_Encode(context->encoder_state, context->enc_mode, (int16_t *) decoded_data,
|
||||
(switch_byte_t *) encoded_data, 0);
|
||||
*encoded_data_len = Encoder_Interface_Encode(context->encoder_state, context->enc_mode, (int16_t *) decoded_data, (switch_byte_t *) encoded_data, 0);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#endif
|
||||
@@ -271,9 +265,7 @@ static switch_status_t switch_amr_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef AMR_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -328,8 +320,7 @@ static switch_loadable_module_interface_t amr_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
#ifndef AMR_PASSTHROUGH
|
||||
char *cf = "amr.conf";
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
static const char modname[] = "mod_g711";
|
||||
|
||||
|
||||
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g711u_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
int encoding, decoding;
|
||||
|
||||
@@ -56,9 +55,7 @@ static switch_status_t switch_g711u_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
@@ -80,9 +77,7 @@ static switch_status_t switch_g711u_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
@@ -111,8 +106,7 @@ static switch_status_t switch_g711u_destroy(switch_codec_t *codec)
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t switch_g711a_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g711a_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
int encoding, decoding;
|
||||
|
||||
@@ -131,9 +125,7 @@ static switch_status_t switch_g711a_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
@@ -155,9 +147,7 @@ static switch_status_t switch_g711a_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
short *dbuf;
|
||||
unsigned char *ebuf;
|
||||
@@ -421,8 +411,7 @@ static switch_loadable_module_interface_t g711_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &g711_module_interface;
|
||||
|
||||
@@ -40,8 +40,7 @@ struct g722_context {
|
||||
g722_encode_state_t encoder_object;
|
||||
};
|
||||
|
||||
static switch_status_t switch_g722_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g722_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
int encoding, decoding;
|
||||
struct g722_context *context = NULL;
|
||||
@@ -77,9 +76,7 @@ static switch_status_t switch_g722_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct g722_context *context = codec->private_info;
|
||||
|
||||
@@ -87,8 +84,7 @@ static switch_status_t switch_g722_encode(switch_codec_t *codec,
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*encoded_data_len =
|
||||
g722_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
|
||||
*encoded_data_len = g722_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -97,9 +93,7 @@ static switch_status_t switch_g722_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct g722_context *context = codec->private_info;
|
||||
|
||||
@@ -107,9 +101,7 @@ static switch_status_t switch_g722_decode(switch_codec_t *codec,
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*decoded_data_len =
|
||||
(2 *
|
||||
g722_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
|
||||
*decoded_data_len = (2 * g722_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -178,8 +170,7 @@ static switch_loadable_module_interface_t g722_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &g722_module_interface;
|
||||
|
||||
@@ -60,8 +60,7 @@ struct g723_context {
|
||||
};
|
||||
#endif
|
||||
|
||||
static switch_status_t switch_g723_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g723_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
#ifdef G723_PASSTHROUGH
|
||||
codec->flags |= SWITCH_CODEC_FLAG_PASSTHROUGH;
|
||||
@@ -110,9 +109,7 @@ static switch_status_t switch_g723_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef G723_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -142,9 +139,7 @@ static switch_status_t switch_g723_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef G723_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -205,8 +200,7 @@ static switch_loadable_module_interface_t g723_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &g723_module_interface;
|
||||
|
||||
@@ -52,8 +52,7 @@ typedef struct {
|
||||
switch_byte_t buf[160];
|
||||
} g726_handle_t;
|
||||
|
||||
static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
uint32_t encoding, decoding;
|
||||
g726_handle_t *handle;
|
||||
@@ -88,16 +87,14 @@ static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag
|
||||
handle->loops = 160;
|
||||
break;
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid Encoding Size %d!\n",
|
||||
codec->implementation->encoded_bytes_per_frame);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid Encoding Size %d!\n", codec->implementation->encoded_bytes_per_frame);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
g726_init_state(&handle->context);
|
||||
codec->private_info = handle;
|
||||
handle->bits_per_frame =
|
||||
(switch_byte_t) (codec->implementation->bits_per_second / (codec->implementation->samples_per_second));
|
||||
handle->bits_per_frame = (switch_byte_t) (codec->implementation->bits_per_second / (codec->implementation->samples_per_second));
|
||||
handle->mode = (flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))
|
||||
? SWITCH_BITPACK_MODE_AAL2 : SWITCH_BITPACK_MODE_RFC3551;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -117,9 +114,7 @@ static switch_status_t switch_g726_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
|
||||
g726_handle_t *handle = codec->private_info;
|
||||
@@ -151,8 +146,7 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len,
|
||||
*encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -166,9 +160,7 @@ static switch_status_t switch_g726_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
|
||||
g726_handle_t *handle = codec->private_info;
|
||||
@@ -434,8 +426,7 @@ static switch_loadable_module_interface_t g726_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &g726_module_interface;
|
||||
|
||||
@@ -45,8 +45,7 @@ struct g729_context {
|
||||
};
|
||||
#endif
|
||||
|
||||
static switch_status_t switch_g729_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_g729_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
#ifdef G729_PASSTHROUGH
|
||||
codec->flags |= SWITCH_CODEC_FLAG_PASSTHROUGH;
|
||||
@@ -96,9 +95,7 @@ static switch_status_t switch_g729_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef G729_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -128,8 +125,7 @@ static switch_status_t switch_g729_encode(switch_codec_t *codec,
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len,
|
||||
*encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -141,9 +137,7 @@ static switch_status_t switch_g729_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
#ifdef G729_PASSTHROUGH
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
|
||||
@@ -208,8 +202,7 @@ static switch_status_t switch_g729_decode(switch_codec_t *codec,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n",
|
||||
encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -274,8 +267,7 @@ static switch_loadable_module_interface_t g729_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &g729_module_interface;
|
||||
|
||||
@@ -36,8 +36,7 @@ struct gsm_context {
|
||||
gsm encoder;
|
||||
gsm decoder;
|
||||
};
|
||||
static switch_status_t switch_gsm_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_gsm_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
struct gsm_context *context;
|
||||
int encoding, decoding;
|
||||
@@ -90,8 +89,7 @@ static switch_status_t switch_gsm_encode(switch_codec_t *codec, switch_codec_t *
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len,
|
||||
*encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -122,13 +120,11 @@ static switch_status_t switch_gsm_decode(switch_codec_t *codec, switch_codec_t *
|
||||
if (new_len <= *decoded_data_len) {
|
||||
*decoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u %u\n", new_len,
|
||||
*decoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%u]\n",
|
||||
encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%u]\n", encoded_data_len);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -166,8 +162,7 @@ static switch_loadable_module_interface_t gsm_module_interface = {
|
||||
/*.codec_interface */ &gsm_codec_interface,
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -44,8 +44,7 @@ struct ilbc_context {
|
||||
uint16_t dbytes;
|
||||
};
|
||||
|
||||
static switch_status_t switch_ilbc_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_ilbc_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
struct ilbc_context *context;
|
||||
int encoding, decoding;
|
||||
@@ -99,9 +98,7 @@ static switch_status_t switch_ilbc_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct ilbc_context *context = codec->private_info;
|
||||
|
||||
@@ -129,8 +126,7 @@ static switch_status_t switch_ilbc_encode(switch_codec_t *codec,
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len,
|
||||
*encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -141,9 +137,7 @@ static switch_status_t switch_ilbc_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct ilbc_context *context = codec->private_info;
|
||||
|
||||
@@ -176,8 +170,7 @@ static switch_status_t switch_ilbc_decode(switch_codec_t *codec,
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n",
|
||||
encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -321,8 +314,7 @@ static switch_loadable_module_interface_t ilbc_module_interface = {
|
||||
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
static const char modname[] = "mod_l16";
|
||||
|
||||
|
||||
static switch_status_t switch_raw_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_raw_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
int encoding, decoding;
|
||||
|
||||
@@ -53,13 +52,10 @@ static switch_status_t switch_raw_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
|
||||
if (codec && other_codec
|
||||
&& codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||
if (codec && other_codec && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||
memcpy(encoded_data, decoded_data, decoded_data_len);
|
||||
*encoded_data_len = decoded_data_len;
|
||||
return SWITCH_STATUS_RESAMPLE;
|
||||
@@ -71,12 +67,9 @@ static switch_status_t switch_raw_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
if (codec && other_codec
|
||||
&& codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||
if (codec && other_codec && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||
memcpy(decoded_data, encoded_data, encoded_data_len);
|
||||
*decoded_data_len = encoded_data_len;
|
||||
return SWITCH_STATUS_RESAMPLE;
|
||||
@@ -429,8 +422,7 @@ static switch_loadable_module_interface_t raw_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &raw_module_interface;
|
||||
|
||||
@@ -51,8 +51,7 @@ struct lpc10_context {
|
||||
struct lpc10_decoder_state decoder_object;
|
||||
};
|
||||
|
||||
static switch_status_t switch_lpc10_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_lpc10_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
uint32_t encoding, decoding;
|
||||
struct lpc10_context *context = NULL;
|
||||
@@ -88,9 +87,7 @@ static switch_status_t switch_lpc10_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct lpc10_context *context = codec->private_info;
|
||||
uint8_t i;
|
||||
@@ -123,9 +120,7 @@ static switch_status_t switch_lpc10_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct lpc10_context *context = codec->private_info;
|
||||
int i;
|
||||
@@ -193,8 +188,7 @@ static switch_loadable_module_interface_t lpc10_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &lpc10_module_interface;
|
||||
|
||||
@@ -72,8 +72,7 @@ struct speex_context {
|
||||
int decoder_mode;
|
||||
};
|
||||
|
||||
static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_flag_t flags,
|
||||
const switch_codec_settings_t *codec_settings)
|
||||
static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
struct speex_context *context = NULL;
|
||||
int encoding, decoding;
|
||||
@@ -111,17 +110,14 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
|
||||
speex_encoder_ctl(context->encoder_state, SPEEX_GET_FRAME_SIZE, &context->encoder_frame_size);
|
||||
speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &codec->codec_settings.complexity);
|
||||
if (codec->codec_settings.preproc) {
|
||||
context->pp =
|
||||
speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->samples_per_second);
|
||||
context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->samples_per_second);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &codec->codec_settings.pp_vad);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &codec->codec_settings.pp_agc);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &codec->codec_settings.pp_agc_level);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DENOISE, &codec->codec_settings.pp_denoise);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB, &codec->codec_settings.pp_dereverb);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY,
|
||||
&codec->codec_settings.pp_dereverb_decay);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL,
|
||||
&codec->codec_settings.pp_dereverb_level);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &codec->codec_settings.pp_dereverb_decay);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &codec->codec_settings.pp_dereverb_level);
|
||||
}
|
||||
|
||||
if (!codec->codec_settings.abr && !codec->codec_settings.vbr) {
|
||||
@@ -161,9 +157,7 @@ static switch_status_t switch_speex_encode(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)
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct speex_context *context = codec->private_info;
|
||||
short *buf;
|
||||
@@ -214,9 +208,7 @@ static switch_status_t switch_speex_decode(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)
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct speex_context *context = codec->private_info;
|
||||
short *buf;
|
||||
@@ -343,8 +335,7 @@ static switch_loadable_module_interface_t speex_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &speex_module_interface;
|
||||
|
||||
@@ -99,17 +99,14 @@ static switch_caller_extension_t *directory_dialplan_hunt(switch_core_session_t
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
|
||||
caller_profile->destination_number);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name, caller_profile->destination_number);
|
||||
|
||||
|
||||
if (!(globals.directory_name && globals.host && globals.dn && globals.base && globals.pass)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (switch_core_directory_open(&dh,
|
||||
globals.directory_name,
|
||||
globals.host, globals.dn, globals.pass, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_directory_open(&dh, globals.directory_name, globals.host, globals.dn, globals.pass, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't connect\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -126,8 +123,7 @@ static switch_caller_extension_t *directory_dialplan_hunt(switch_core_session_t
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DIRECTORY VALUE [%s]=[%s]\n", var, val);
|
||||
if (!strcasecmp(var, "callflow")) {
|
||||
if (!extension) {
|
||||
if ((extension = switch_caller_extension_new(session, caller_profile->destination_number,
|
||||
caller_profile->destination_number)) == 0) {
|
||||
if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -168,8 +164,7 @@ static const switch_loadable_module_interface_t directory_dialplan_module_interf
|
||||
/*.application_interface = */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
load_config();
|
||||
|
||||
@@ -114,11 +114,8 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit
|
||||
if (!field_data) {
|
||||
field_data = "";
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field,
|
||||
field_data, expression);
|
||||
if (!
|
||||
(proceed =
|
||||
switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field, field_data, expression);
|
||||
if (!(proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n");
|
||||
|
||||
for (xaction = switch_xml_child(xcond, "anti-action"); xaction; xaction = xaction->next) {
|
||||
@@ -126,9 +123,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit
|
||||
char *data = (char *) switch_xml_attr_soft(xaction, "data");
|
||||
|
||||
if (!*extension) {
|
||||
if ((*extension =
|
||||
switch_caller_extension_new(session, exten_name,
|
||||
caller_profile->destination_number)) == 0) {
|
||||
if ((*extension = switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
|
||||
proceed = 0;
|
||||
goto done;
|
||||
@@ -170,8 +165,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit
|
||||
}
|
||||
|
||||
if (!*extension) {
|
||||
if ((*extension =
|
||||
switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
|
||||
if ((*extension = switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
|
||||
proceed = 0;
|
||||
goto done;
|
||||
@@ -194,9 +188,7 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit
|
||||
return proceed;
|
||||
}
|
||||
|
||||
static switch_status_t dialplan_xml_locate(switch_core_session_t *session,
|
||||
switch_caller_profile_t *caller_profile,
|
||||
switch_xml_t * root, switch_xml_t * node)
|
||||
static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t * root, switch_xml_t * node)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_GENERR;
|
||||
switch_channel_t *channel;
|
||||
@@ -261,8 +253,7 @@ static switch_status_t dialplan_xml_locate(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
|
||||
for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)); hi;
|
||||
hi = switch_hash_next(hi)) {
|
||||
for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)); hi; hi = switch_hash_next(hi)) {
|
||||
void *val;
|
||||
const void *var;
|
||||
switch_hash_this(hi, &var, NULL, &val);
|
||||
@@ -318,8 +309,7 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session,
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Processing %s->%s!\n", caller_profile->caller_id_name,
|
||||
caller_profile->destination_number);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Processing %s->%s!\n", caller_profile->caller_id_name, caller_profile->destination_number);
|
||||
|
||||
/* get our handle to the "dialplan" section of the config */
|
||||
|
||||
@@ -330,10 +320,8 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session,
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ((conf = switch_xml_find_child(alt_root, "section", "name", "dialplan")) &&
|
||||
(tag = switch_xml_find_child(conf, "dialplan", NULL, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Getting dialplan from alternate path: %s\n",
|
||||
alt_path);
|
||||
if ((conf = switch_xml_find_child(alt_root, "section", "name", "dialplan")) && (tag = switch_xml_find_child(conf, "dialplan", NULL, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Getting dialplan from alternate path: %s\n", alt_path);
|
||||
xml = alt_root;
|
||||
cfg = tag;
|
||||
} else {
|
||||
@@ -350,8 +338,7 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session,
|
||||
/* get a handle to the context tag */
|
||||
if (!(xcontext = switch_xml_find_child(cfg, "context", "name", caller_profile->context))) {
|
||||
if (!(xcontext = switch_xml_find_child(cfg, "context", "name", "global"))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "context %s not found\n",
|
||||
caller_profile->context);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "context %s not found\n", caller_profile->context);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -402,8 +389,7 @@ static const switch_loadable_module_interface_t dialplan_module_interface = {
|
||||
/*.application_interface = */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
|
||||
@@ -188,8 +188,7 @@ static switch_status_t mod_ldap_next_pair(switch_directory_handle_t *dh, char **
|
||||
context->attr = ldap_next_attribute(context->ld, context->entry, context->ber);
|
||||
}
|
||||
context->vitt++;
|
||||
if (context->entry && context->attr
|
||||
&& (context->vals = ldap_get_values(context->ld, context->entry, context->attr)) != 0) {
|
||||
if (context->entry && context->attr && (context->vals = ldap_get_values(context->ld, context->entry, context->attr)) != 0) {
|
||||
goto itter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@ static switch_memory_pool_t *module_pool = NULL;
|
||||
|
||||
static char sub_sql[] =
|
||||
"CREATE TABLE subscriptions (\n"
|
||||
" sub_from VARCHAR(255),\n"
|
||||
" sub_to VARCHAR(255),\n" " show VARCHAR(255),\n" " status VARCHAR(255)\n" ");\n";
|
||||
" sub_from VARCHAR(255),\n" " sub_to VARCHAR(255),\n" " show VARCHAR(255),\n" " status VARCHAR(255)\n" ");\n";
|
||||
|
||||
|
||||
typedef enum {
|
||||
@@ -171,8 +170,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string)
|
||||
|
||||
static switch_status_t dl_login(char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
static switch_status_t dl_logout(char *profile_name, switch_core_session_t *session,
|
||||
switch_stream_handle_t *stream);
|
||||
static switch_status_t dl_logout(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_ring(switch_core_session_t *session);
|
||||
@@ -180,12 +178,9 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
static switch_status_t channel_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
|
||||
static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal,
|
||||
@@ -324,8 +319,7 @@ static void pres_event_handler(switch_event_t *event)
|
||||
if (f_host && (profile = switch_core_hash_find(globals.profile_hash, f_host))) {
|
||||
if (to && (sql = switch_mprintf("select * from subscriptions where sub_to='%q'", to))) {
|
||||
if (!(db = switch_core_db_open_file(profile->dbname))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n",
|
||||
profile->dbname);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
|
||||
return;
|
||||
}
|
||||
switch_mutex_lock(profile->mutex);
|
||||
@@ -361,12 +355,10 @@ static void pres_event_handler(switch_event_t *event)
|
||||
}
|
||||
|
||||
|
||||
sql = switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from subscriptions where sub_to like '%%%q'",
|
||||
type, rpid, status, proto, from);
|
||||
sql = switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
|
||||
|
||||
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi;
|
||||
hi = switch_hash_next(hi)) {
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
char *errmsg;
|
||||
switch_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (struct mdl_profile *) val;
|
||||
@@ -465,8 +457,7 @@ static void roster_event_handler(switch_event_t *event)
|
||||
sql = switch_mprintf("select *,'%q' from subscriptions", status ? status : "");
|
||||
}
|
||||
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi;
|
||||
hi = switch_hash_next(hi)) {
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
char *errmsg;
|
||||
switch_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (struct mdl_profile *) val;
|
||||
@@ -541,8 +532,7 @@ static void sign_off(void)
|
||||
sql = switch_mprintf("select * from subscriptions");
|
||||
|
||||
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi;
|
||||
hi = switch_hash_next(hi)) {
|
||||
for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||
char *errmsg;
|
||||
switch_hash_this(hi, NULL, NULL, &val);
|
||||
profile = (struct mdl_profile *) val;
|
||||
@@ -576,10 +566,7 @@ static void sign_on(struct mdl_profile *profile)
|
||||
switch_core_db_t *db;
|
||||
char *errmsg;
|
||||
|
||||
if ((sql =
|
||||
switch_mprintf
|
||||
("select * from subscriptions where sub_to like 'ext+%%' or sub_to like 'user+%%' or sub_to like 'conf+%%'")))
|
||||
{
|
||||
if ((sql = switch_mprintf("select * from subscriptions where sub_to like 'ext+%%' or sub_to like 'user+%%' or sub_to like 'conf+%%'"))) {
|
||||
if (!(db = switch_core_db_open_file(profile->dbname))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
|
||||
return;
|
||||
@@ -599,8 +586,7 @@ static void terminate_session(switch_core_session_t **session, int line, switch_
|
||||
switch_channel_state_t state = switch_channel_get_state(channel);
|
||||
struct private_object *tech_pvt = NULL;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line,
|
||||
switch_channel_state_name(state));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line, switch_channel_state_name(state));
|
||||
|
||||
tech_pvt = switch_core_session_get_private(*session);
|
||||
|
||||
@@ -650,15 +636,12 @@ static int get_codecs(struct private_object *tech_pvt)
|
||||
if (!tech_pvt->num_codecs) {
|
||||
if (globals.codec_string) {
|
||||
if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs,
|
||||
SWITCH_MAX_CODECS,
|
||||
globals.codec_order,
|
||||
globals.codec_order_last)) <= 0) {
|
||||
SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last)) <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
|
||||
return 0;
|
||||
}
|
||||
} else if (((tech_pvt->num_codecs =
|
||||
switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session),
|
||||
tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
|
||||
switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -669,7 +652,7 @@ static int get_codecs(struct private_object *tech_pvt)
|
||||
|
||||
|
||||
|
||||
static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
ldl_handle_t *handle = obj;
|
||||
struct mdl_profile *profile = NULL;
|
||||
@@ -683,8 +666,7 @@ static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void
|
||||
switch_clear_flag(profile, TFLAG_IO);
|
||||
globals.handles--;
|
||||
ldl_handle_destroy(&handle);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name,
|
||||
profile->login);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -774,10 +756,7 @@ static int activate_rtp(struct private_object *tech_pvt)
|
||||
tech_pvt->codec_num,
|
||||
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
|
||||
tech_pvt->read_codec.implementation->microseconds_per_frame,
|
||||
flags,
|
||||
NULL,
|
||||
tech_pvt->profile->timer_name,
|
||||
&err, switch_core_session_get_pool(tech_pvt->session)))) {
|
||||
flags, NULL, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return 0;
|
||||
@@ -787,8 +766,7 @@ static int activate_rtp(struct private_object *tech_pvt)
|
||||
uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
|
||||
switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user);
|
||||
if ((vad_in && inb) || (vad_out && !inb)) {
|
||||
switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec,
|
||||
SWITCH_VAD_FLAG_TALKING);
|
||||
switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_VAD);
|
||||
}
|
||||
switch_rtp_set_cng_pt(tech_pvt->rtp_session, 13);
|
||||
@@ -846,18 +824,15 @@ static int do_candidates(struct private_object *tech_pvt, int force)
|
||||
}
|
||||
|
||||
cand[0].address = tech_pvt->profile->ip;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand[0].address,
|
||||
cand[0].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand[0].address, cand[0].port);
|
||||
if (switch_stun_lookup
|
||||
(&cand[0].address, &cand[0].port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &err,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip,
|
||||
SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return 0;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand[0].address,
|
||||
cand[0].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
|
||||
}
|
||||
cand[0].type = "stun";
|
||||
tech_pvt->stun_ip = switch_core_session_strdup(tech_pvt->session, cand[0].address);
|
||||
@@ -871,8 +846,7 @@ static int do_candidates(struct private_object *tech_pvt, int force)
|
||||
cand[0].password = tech_pvt->local_pass;
|
||||
cand[0].pref = 1;
|
||||
cand[0].protocol = "udp";
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address,
|
||||
cand[0].port, cand[0].username);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port, cand[0].username);
|
||||
tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY);
|
||||
@@ -940,12 +914,10 @@ static int do_describe(struct private_object *tech_pvt, int force)
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[0].name,
|
||||
payloads[0].rate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[0].name, payloads[0].rate);
|
||||
tech_pvt->desc_id =
|
||||
ldl_session_describe(tech_pvt->dlsession, payloads, 1,
|
||||
switch_test_flag(tech_pvt,
|
||||
TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT);
|
||||
switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_CODEC_READY);
|
||||
}
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND);
|
||||
@@ -985,8 +957,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
|
||||
|
||||
while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) &&
|
||||
switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
|
||||
switch_test_flag(tech_pvt, TFLAG_ANSWER) &&
|
||||
switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
|
||||
switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
|
||||
now = switch_time_now();
|
||||
elapsed = (unsigned int) ((now - started) / 1000);
|
||||
|
||||
@@ -1242,13 +1213,11 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *d
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%s]\n", dtmf);
|
||||
|
||||
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session,
|
||||
dtmf, 100 * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
|
||||
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf, 100 * (tech_pvt->read_codec.implementation->samples_per_second / 1000));
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
struct private_object *tech_pvt = NULL;
|
||||
uint32_t bytes = 0;
|
||||
@@ -1306,9 +1275,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
}
|
||||
|
||||
if (switch_test_flag(&tech_pvt->read_frame, SFF_CNG)) {
|
||||
tech_pvt->read_frame.datalen =
|
||||
tech_pvt->last_read ? tech_pvt->last_read : tech_pvt->read_codec.implementation->
|
||||
encoded_bytes_per_frame;
|
||||
tech_pvt->read_frame.datalen = tech_pvt->last_read ? tech_pvt->last_read : tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
|
||||
}
|
||||
|
||||
if (tech_pvt->read_frame.datalen > 0) {
|
||||
@@ -1339,8 +1306,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
@@ -1536,7 +1502,7 @@ static const switch_loadable_module_interface_t channel_module_interface = {
|
||||
*/
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool)
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
|
||||
struct private_object *tech_pvt;
|
||||
@@ -1614,8 +1580,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
|
||||
switch_core_session_add_stream(*new_session, NULL);
|
||||
if ((tech_pvt =
|
||||
(struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
|
||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
|
||||
memset(tech_pvt, 0, sizeof(*tech_pvt));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(*new_session));
|
||||
tech_pvt->flags |= globals.flags;
|
||||
@@ -1662,9 +1627,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
|
||||
if (!cid_msg) {
|
||||
f_cid_msg =
|
||||
switch_mprintf("Incoming Call From %s %s\n", outbound_profile->caller_id_name,
|
||||
outbound_profile->caller_id_number);
|
||||
f_cid_msg = switch_mprintf("Incoming Call From %s %s\n", outbound_profile->caller_id_name, outbound_profile->caller_id_number);
|
||||
cid_msg = f_cid_msg;
|
||||
}
|
||||
|
||||
@@ -1701,8 +1664,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -1713,14 +1675,12 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
load_config();
|
||||
|
||||
if (switch_event_reserve_subclass(DL_EVENT_LOGIN_SUCCESS) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!",
|
||||
DL_EVENT_LOGIN_SUCCESS);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", DL_EVENT_LOGIN_SUCCESS);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_reserve_subclass(DL_EVENT_LOGIN_FAILURE) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!",
|
||||
DL_EVENT_LOGIN_FAILURE);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", DL_EVENT_LOGIN_FAILURE);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -1729,23 +1689,17 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -1773,9 +1727,7 @@ static ldl_status handle_loop(ldl_handle_t * handle)
|
||||
|
||||
static switch_status_t init_profile(struct mdl_profile *profile, uint8_t login)
|
||||
{
|
||||
if (profile &&
|
||||
profile->login &&
|
||||
profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten) {
|
||||
if (profile && profile->login && profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten) {
|
||||
ldl_handle_t *handle;
|
||||
|
||||
if (switch_test_flag(profile, TFLAG_TIMER) && !profile->timer_name) {
|
||||
@@ -1787,18 +1739,14 @@ static switch_status_t init_profile(struct mdl_profile *profile, uint8_t login)
|
||||
profile->login,
|
||||
profile->password,
|
||||
profile->server,
|
||||
profile->user_flags,
|
||||
profile->message,
|
||||
handle_loop, handle_signalling, handle_response, profile) == LDL_STATUS_SUCCESS) {
|
||||
profile->user_flags, profile->message, handle_loop, handle_signalling, handle_response, profile) == LDL_STATUS_SUCCESS) {
|
||||
profile->handle = handle;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Thread for %s@%s\n", profile->login,
|
||||
profile->dialplan);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Thread for %s@%s\n", profile->login, profile->dialplan);
|
||||
switch_core_hash_insert(globals.profile_hash, profile->name, profile);
|
||||
handle_thread_launch(handle);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Profile for %s@%s\n", profile->login,
|
||||
profile->dialplan);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Profile for %s@%s\n", profile->login, profile->dialplan);
|
||||
switch_core_hash_insert(globals.profile_hash, profile->name, profile);
|
||||
}
|
||||
} else {
|
||||
@@ -1810,10 +1758,7 @@ static switch_status_t init_profile(struct mdl_profile *profile, uint8_t login)
|
||||
"message[%s]\n"
|
||||
"rtp-ip[%s]\n"
|
||||
"name[%s]\n"
|
||||
"exten[%s]\n",
|
||||
profile->login,
|
||||
profile->password,
|
||||
profile->dialplan, profile->message, profile->ip, profile->name, profile->exten);
|
||||
"exten[%s]\n", profile->login, profile->password, profile->dialplan, profile->message, profile->ip, profile->name, profile->exten);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -2014,20 +1959,17 @@ static switch_status_t load_config(void)
|
||||
globals.debug = atoi(val);
|
||||
} else if (!strcasecmp(var, "codec-prefs")) {
|
||||
set_global_codec_string(val);
|
||||
globals.codec_order_last =
|
||||
switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
|
||||
globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
|
||||
} else if (!strcasecmp(var, "codec-rates")) {
|
||||
set_global_codec_rates_string(val);
|
||||
globals.codec_rates_last =
|
||||
switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
|
||||
globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(xmlint = switch_xml_child(cfg, "profile"))) {
|
||||
if ((xmlint = switch_xml_child(cfg, "interface"))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2102,7 +2044,7 @@ static switch_status_t load_config(void)
|
||||
}
|
||||
|
||||
|
||||
static void execute_sql(char *dbname, char *sql, switch_mutex_t *mutex)
|
||||
static void execute_sql(char *dbname, char *sql, switch_mutex_t * mutex)
|
||||
{
|
||||
switch_core_db_t *db;
|
||||
|
||||
@@ -2167,8 +2109,7 @@ static void do_vcard(ldl_handle_t * handle, char *to, char *from, char *id)
|
||||
}
|
||||
|
||||
if (!(vcard = switch_xml_child(user, "vcard"))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find <vcard> tag for user [%s@%s]\n", to_user,
|
||||
to_host);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find <vcard> tag for user [%s@%s]\n", to_user, to_host);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -2188,8 +2129,7 @@ static void do_vcard(ldl_handle_t * handle, char *to, char *from, char *id)
|
||||
switch_safe_free(xmlstr);
|
||||
}
|
||||
|
||||
static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal, char *to,
|
||||
char *from, char *subject, char *msg)
|
||||
static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, char *msg)
|
||||
{
|
||||
struct mdl_profile *profile = NULL;
|
||||
switch_core_session_t *session = NULL;
|
||||
@@ -2225,8 +2165,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
case LDL_SIGNAL_SUBSCRIBE:
|
||||
|
||||
if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
|
||||
"insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from,
|
||||
to, msg, subject))) {
|
||||
"insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
|
||||
execute_sql(profile->dbname, sql, profile->mutex);
|
||||
switch_core_db_free(sql);
|
||||
}
|
||||
@@ -2269,9 +2208,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
break;
|
||||
case LDL_SIGNAL_PRESENCE_IN:
|
||||
|
||||
if ((sql =
|
||||
switch_mprintf("update subscriptions set show='%q', status='%q' where sub_from='%q'", msg, subject,
|
||||
from))) {
|
||||
if ((sql = switch_mprintf("update subscriptions set show='%q', status='%q' where sub_from='%q'", msg, subject, from))) {
|
||||
execute_sql(profile->dbname, sql, profile->mutex);
|
||||
switch_core_db_free(sql);
|
||||
}
|
||||
@@ -2305,9 +2242,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
case LDL_SIGNAL_PRESENCE_OUT:
|
||||
|
||||
if ((sql =
|
||||
switch_mprintf("update subscriptions set show='%q', status='%q' where sub_from='%q'", msg, subject,
|
||||
from))) {
|
||||
if ((sql = switch_mprintf("update subscriptions set show='%q', status='%q' where sub_from='%q'", msg, subject, from))) {
|
||||
execute_sql(profile->dbname, sql, profile->mutex);
|
||||
switch_core_db_free(sql);
|
||||
}
|
||||
@@ -2332,9 +2267,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
if (profile->auto_reply) {
|
||||
ldl_handle_send_msg(handle,
|
||||
(profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->
|
||||
handle),
|
||||
from, "", profile->auto_reply);
|
||||
(profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "", profile->auto_reply);
|
||||
}
|
||||
|
||||
if (strchr(to, '+')) {
|
||||
@@ -2366,10 +2299,8 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
}
|
||||
break;
|
||||
case LDL_SIGNAL_LOGIN_SUCCESS:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s",
|
||||
ldl_handle_get_login(profile->handle));
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
if (profile->user_flags & LDL_FLAG_COMPONENT) {
|
||||
@@ -2378,17 +2309,14 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
break;
|
||||
case LDL_SIGNAL_LOGIN_FAILURE:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s",
|
||||
ldl_handle_get_login(profile->handle));
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
break;
|
||||
case LDL_SIGNAL_CONNECTED:
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_CONNECTED) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s",
|
||||
ldl_handle_get_login(profile->handle));
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", ldl_handle_get_login(profile->handle));
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
break;
|
||||
@@ -2408,12 +2336,10 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n",
|
||||
ldl_session_get_id(dlsession));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
|
||||
|
||||
if (switch_channel_get_state(channel) >= CS_HANGUP) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call %s is already over\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel));
|
||||
status = LDL_STATUS_FALSE;
|
||||
goto done;
|
||||
}
|
||||
@@ -2427,8 +2353,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
|
||||
if ((tech_pvt =
|
||||
(struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
||||
memset(tech_pvt, 0, sizeof(*tech_pvt));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
tech_pvt->flags |= globals.flags;
|
||||
@@ -2448,8 +2373,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
status = LDL_STATUS_FALSE;
|
||||
goto done;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating a session for %s\n",
|
||||
ldl_session_get_id(dlsession));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession));
|
||||
ldl_session_set_private(dlsession, session);
|
||||
tech_pvt->dlsession = dlsession;
|
||||
switch_channel_set_name(channel, "DingaLing/new");
|
||||
@@ -2540,8 +2464,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
unsigned int x, y;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u payloads\n", len);
|
||||
for (x = 0; x < len; x++) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n",
|
||||
payloads[x].name, payloads[x].id);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
|
||||
for (y = 0; y < tech_pvt->num_codecs; y++) {
|
||||
char *name = tech_pvt->codecs[y]->iananame;
|
||||
|
||||
@@ -2559,8 +2482,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) {
|
||||
tech_pvt->codec_index = y;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n",
|
||||
y, payloads[x].name, payloads[x].id);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
|
||||
tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
|
||||
tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
|
||||
tech_pvt->r_codec_num = (switch_payload_t) (payloads[x].id);
|
||||
@@ -2604,8 +2526,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
|
||||
if (tech_pvt->remote_ip) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n",
|
||||
tech_pvt->remote_ip);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n", tech_pvt->remote_ip);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2617,8 +2538,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address,
|
||||
candidates[x].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
|
||||
if (!strcasecmp(candidates[x].protocol, "udp") && (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun")) && ((profile->lanaddr && lanaddr) || (strncasecmp(candidates[x].address, "10.", 3) && strncasecmp(candidates[x].address, "192.168.", 8) && strncasecmp(candidates[x].address, "127.", 4) && strncasecmp(candidates[x].address, "255.", 4) && strncasecmp(candidates[x].address, "0.", 2) && strncasecmp(candidates[x].address, "1.", 2) && strncasecmp(candidates[x].address, "2.", 2) && strncasecmp(candidates[x].address, "172.16.", 7) && strncasecmp(candidates[x].address, "172.17.", 7) && strncasecmp(candidates[x].address, "172.18.", 7) && strncasecmp(candidates[x].address, "172.19.", 7) && strncasecmp(candidates[x].address, "172.2", 5) && strncasecmp(candidates[x].address, "172.30.", 7) && strncasecmp(candidates[x].address, "172.31.", 7) && strncasecmp(candidates[x].address, "192.0.2.", 8) && // 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them?
|
||||
strncasecmp
|
||||
@@ -2637,8 +2557,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
memset(payloads, 0, sizeof(payloads));
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n",
|
||||
candidates[x].address, candidates[x].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
|
||||
@@ -2704,8 +2623,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
|
||||
if (!tech_pvt->caller_profile) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession),
|
||||
cid_name, cid_num, exten);
|
||||
"Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten);
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
ldl_handle_get_login(profile->handle),
|
||||
@@ -2718,9 +2636,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
|
||||
ldl_session_get_value(dlsession,
|
||||
"aniii"),
|
||||
ldl_session_get_value(dlsession,
|
||||
"rdnis"),
|
||||
(char *) modname, context,
|
||||
exten)) != 0) {
|
||||
"rdnis"), (char *) modname, context, exten)) != 0) {
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
|
||||
switch_channel_set_name(channel, name);
|
||||
|
||||
@@ -103,8 +103,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip)
|
||||
|
||||
|
||||
static char *IAXNAMES[] =
|
||||
{ "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
|
||||
static char *IAXNAMES[] = { "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
|
||||
"IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
|
||||
"IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
|
||||
"IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
|
||||
@@ -210,8 +209,7 @@ typedef enum {
|
||||
} iax_io_t;
|
||||
|
||||
static switch_status_t iax_set_codec(private_t * tech_pvt, struct iax_session *iax_session,
|
||||
unsigned int *format, unsigned int *cababilities, unsigned short *samprate,
|
||||
iax_io_t io)
|
||||
unsigned int *format, unsigned int *cababilities, unsigned short *samprate, iax_io_t io)
|
||||
{
|
||||
char *dname = NULL;
|
||||
//int rate = 8000;
|
||||
@@ -224,17 +222,11 @@ static switch_status_t iax_set_codec(private_t * tech_pvt, struct iax_session *i
|
||||
uint32_t interval = 0;
|
||||
|
||||
if (globals.codec_string) {
|
||||
if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs,
|
||||
SWITCH_MAX_CODECS,
|
||||
globals.codec_order,
|
||||
globals.codec_order_last)) <= 0) {
|
||||
if ((num_codecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, globals.codec_order, globals.codec_order_last)) <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
} else
|
||||
if (((num_codecs =
|
||||
switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), codecs,
|
||||
SWITCH_MAX_CODECS))) <= 0) {
|
||||
} else if (((num_codecs = switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), codecs, SWITCH_MAX_CODECS))) <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -425,11 +417,9 @@ static switch_status_t channel_on_loopback(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
|
||||
|
||||
@@ -642,8 +632,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *d
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@@ -714,8 +703,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@@ -736,8 +724,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
}
|
||||
#endif
|
||||
//printf("Send %ld %d\n", time(NULL), (int) frame->datalen);
|
||||
iax_send_voice(tech_pvt->iax_session, tech_pvt->codec, frame->data, (int) frame->datalen,
|
||||
tech_pvt->write_codec.implementation->samples_per_frame);
|
||||
iax_send_voice(tech_pvt->iax_session, tech_pvt->codec, frame->data, (int) frame->datalen, tech_pvt->write_codec.implementation->samples_per_frame);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -803,7 +790,7 @@ that allocate memory or you will have 1 channel with memory allocated from anoth
|
||||
*/
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool)
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
@@ -853,8 +840,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
|
||||
iax_call(tech_pvt->iax_session,
|
||||
caller_profile->caller_id_number,
|
||||
caller_profile->caller_id_name, caller_profile->destination_number, NULL, 0, req, cap);
|
||||
caller_profile->caller_id_number, caller_profile->caller_id_name, caller_profile->destination_number, NULL, 0, req, cap);
|
||||
|
||||
switch_channel_set_flag(channel, CF_OUTBOUND);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
|
||||
@@ -866,8 +852,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -924,12 +909,10 @@ static switch_status_t load_config(void)
|
||||
set_global_dialplan(val);
|
||||
} else if (!strcmp(var, "codec-prefs")) {
|
||||
set_global_codec_string(val);
|
||||
globals.codec_order_last =
|
||||
switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
|
||||
globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
|
||||
} else if (!strcmp(var, "codec-rates")) {
|
||||
set_global_codec_rates_string(val);
|
||||
globals.codec_rates_last =
|
||||
switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
|
||||
globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -954,11 +937,8 @@ static switch_status_t tech_media(private_t * tech_pvt, struct iax_event *iaxeve
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_CODEC) &&
|
||||
(status =
|
||||
iax_set_codec(tech_pvt, iaxevent->session, &format, &cap, &iaxevent->ies.samprate,
|
||||
IAX_SET)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error %u %u\n", iaxevent->ies.format,
|
||||
iaxevent->ies.capability);
|
||||
(status = iax_set_codec(tech_pvt, iaxevent->session, &format, &cap, &iaxevent->ies.samprate, IAX_SET)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error %u %u\n", iaxevent->ies.format, iaxevent->ies.capability);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -1021,8 +1001,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
}
|
||||
|
||||
if (globals.debug && iaxevent->etype != IAX_EVENT_VOICE) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Event %d [%s]!\n",
|
||||
iaxevent->etype, IAXNAMES[iaxevent->etype]);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Event %d [%s]!\n", iaxevent->etype, IAXNAMES[iaxevent->etype]);
|
||||
}
|
||||
|
||||
switch (iaxevent->etype) {
|
||||
@@ -1061,12 +1040,10 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
if (channel) {
|
||||
if (tech_media(tech_pvt, iaxevent) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "WTF Mutiple Answer %s?\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "WTF Mutiple Answer %s?\n", switch_channel_get_name(channel));
|
||||
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Answer %s\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Answer %s\n", switch_channel_get_name(channel));
|
||||
switch_channel_mark_answered(channel);
|
||||
}
|
||||
} else {
|
||||
@@ -1079,14 +1056,12 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"Incoming call connected %s, %s, %s %u/%u\n",
|
||||
iaxevent->ies.called_number,
|
||||
iaxevent->ies.calling_number,
|
||||
iaxevent->ies.calling_name, iaxevent->ies.format, iaxevent->ies.capability);
|
||||
iaxevent->ies.calling_number, iaxevent->ies.calling_name, iaxevent->ies.format, iaxevent->ies.capability);
|
||||
|
||||
if (iaxevent) {
|
||||
switch_core_session_t *session;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n",
|
||||
iaxevent->ies.calling_name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New Inbound Channel %s!\n", iaxevent->ies.calling_name);
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
@@ -1112,20 +1087,16 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
NULL,
|
||||
NULL,
|
||||
(char *) modname,
|
||||
iaxevent->ies.called_context,
|
||||
iaxevent->ies.called_number)) != 0) {
|
||||
iaxevent->ies.called_context, iaxevent->ies.called_number)) != 0) {
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number,
|
||||
rand() & 0xffff);
|
||||
snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
|
||||
switch_channel_set_name(channel, name);
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
|
||||
}
|
||||
|
||||
if (iax_set_codec(tech_pvt, iaxevent->session,
|
||||
&iaxevent->ies.format,
|
||||
&iaxevent->ies.capability,
|
||||
&iaxevent->ies.samprate, IAX_SET) != SWITCH_STATUS_SUCCESS) {
|
||||
&iaxevent->ies.format, &iaxevent->ies.capability, &iaxevent->ies.samprate, IAX_SET) != SWITCH_STATUS_SUCCESS) {
|
||||
iax_reject(iaxevent->session, "Codec Error!");
|
||||
switch_core_session_destroy(&session);
|
||||
} else {
|
||||
@@ -1150,13 +1121,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n", switch_channel_get_name(channel));
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
|
||||
switch_channel_hangup(channel,
|
||||
iaxevent->etype ==
|
||||
IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING :
|
||||
SWITCH_CAUSE_FACILITY_REJECTED);
|
||||
switch_channel_hangup(channel, iaxevent->etype == IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING : SWITCH_CAUSE_FACILITY_REJECTED);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
iaxevent->session = NULL;
|
||||
}
|
||||
@@ -1198,16 +1165,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
if (channel) {
|
||||
char str[2] = { (char) iaxevent->subclass };
|
||||
if (globals.debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s DTMF %s\n", str,
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s DTMF %s\n", str, switch_channel_get_name(channel));
|
||||
}
|
||||
switch_channel_queue_dtmf(channel, str);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't know what to do with IAX event %d.\n",
|
||||
iaxevent->etype);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't know what to do with IAX event %d.\n", iaxevent->etype);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,12 +144,9 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
static switch_status_t channel_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
static switch_status_t engage_device(int samplerate, int codec_ms);
|
||||
static switch_status_t engage_ring_device(int sample_rate, int channels);
|
||||
@@ -202,8 +199,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL INIT %d %d\n",
|
||||
switch_channel_get_name(channel), switch_channel_get_state(channel),
|
||||
switch_test_flag(tech_pvt, TFLAG_ANSWER));
|
||||
switch_channel_get_name(channel), switch_channel_get_state(channel), switch_test_flag(tech_pvt, TFLAG_ANSWER));
|
||||
|
||||
|
||||
|
||||
@@ -229,8 +225,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
ring_file,
|
||||
globals.read_codec.implementation->number_of_channels,
|
||||
globals.read_codec.implementation->samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
||||
NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (engage_ring_device(fh.samplerate, fh.channels) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
@@ -239,8 +234,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open %s, disabling ring file!\n",
|
||||
ring_file);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open %s, disabling ring file!\n", ring_file);
|
||||
ring_file = NULL;
|
||||
}
|
||||
}
|
||||
@@ -256,8 +250,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan)
|
||||
|
||||
snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_info", "%s", buf);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call_id", "%s", tech_pvt->call_id);
|
||||
switch_channel_event_set_data(channel, event);
|
||||
@@ -545,8 +538,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *d
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@@ -584,8 +576,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
codec_ms,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
|
||||
switch_core_codec_destroy(&globals.read_codec);
|
||||
tech_pvt->hold_file = NULL;
|
||||
@@ -647,9 +638,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
switch_mutex_lock(globals.device_lock);
|
||||
|
||||
if ((samples =
|
||||
ReadAudioStream(globals.audio_stream, globals.read_frame.data,
|
||||
globals.read_codec.implementation->samples_per_frame)) != 0) {
|
||||
if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) != 0) {
|
||||
globals.read_frame.datalen = samples * 2;
|
||||
globals.read_frame.samples = samples;
|
||||
|
||||
@@ -668,8 +657,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@@ -833,7 +821,7 @@ static const switch_loadable_module_interface_t channel_module_interface = {
|
||||
*/
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool)
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool)
|
||||
{
|
||||
|
||||
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
|
||||
@@ -857,8 +845,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
if (outbound_profile) {
|
||||
char name[128];
|
||||
char *id =
|
||||
!switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
|
||||
char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
|
||||
snprintf(name, sizeof(name), "PortAudio/%s", id);
|
||||
|
||||
switch_channel_set_name(channel, name);
|
||||
@@ -883,8 +870,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
switch_status_t status;
|
||||
@@ -1041,8 +1027,7 @@ static switch_status_t load_config(void)
|
||||
|
||||
if (globals.ringdev < 0) {
|
||||
if (globals.outdev > -1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Invalid ring device configured using output device!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ring device configured using output device!\n");
|
||||
globals.ringdev = globals.outdev;
|
||||
}
|
||||
}
|
||||
@@ -1092,8 +1077,7 @@ static int get_dev_by_name(char *name, int in)
|
||||
numDevices = Pa_GetDeviceCount();
|
||||
|
||||
if (numDevices < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "ERROR: Pa_CountDevices returned 0x%x\n",
|
||||
numDevices);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -1125,8 +1109,7 @@ static int get_dev_by_name(char *name, int in)
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputParameters,
|
||||
const PaStreamParameters * outputParameters)
|
||||
static void PrintSupportedStandardSampleRates(const PaStreamParameters * inputParameters, const PaStreamParameters * outputParameters)
|
||||
{
|
||||
int i, printCount, cr = 7;
|
||||
PaError err;
|
||||
@@ -1167,8 +1150,7 @@ static switch_status_t devlist(char **argv, int argc, switch_stream_handle_t *st
|
||||
}
|
||||
for (i = 0; i < numDevices; i++) {
|
||||
deviceInfo = Pa_GetDeviceInfo(i);
|
||||
stream->write_function(stream, "%d;%s;%d;%d\n", i, deviceInfo->name, deviceInfo->maxInputChannels,
|
||||
deviceInfo->maxOutputChannels);
|
||||
stream->write_function(stream, "%d;%s;%d;%d\n", i, deviceInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -1185,18 +1167,15 @@ static int dump_info(void)
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
|
||||
"PortAudio version number = %d\nPortAudio version text = '%s'\n", Pa_GetVersion(),
|
||||
Pa_GetVersionText());
|
||||
"PortAudio version number = %d\nPortAudio version text = '%s'\n", Pa_GetVersion(), Pa_GetVersionText());
|
||||
if (globals.audio_stream) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
|
||||
"ERROR: Cannot use this command this while a call is in progress\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
numDevices = Pa_GetDeviceCount();
|
||||
if (numDevices < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Pa_CountDevices returned 0x%x\n",
|
||||
numDevices);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
err = numDevices;
|
||||
goto error;
|
||||
}
|
||||
@@ -1236,13 +1215,11 @@ static int dump_info(void)
|
||||
}
|
||||
/* print device info fields */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Name: %s\n", deviceInfo->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Host: %s | ",
|
||||
Pa_GetHostApiInfo(deviceInfo->hostApi)->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Host: %s | ", Pa_GetHostApiInfo(deviceInfo->hostApi)->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "inputs: %d | ", deviceInfo->maxInputChannels);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "outputs: %d | ", deviceInfo->maxOutputChannels);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Default rate: %8.2f\n",
|
||||
deviceInfo->defaultSampleRate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Default rate: %8.2f\n", deviceInfo->defaultSampleRate);
|
||||
|
||||
/* poll for standard sample rates */
|
||||
inputParameters.device = i;
|
||||
@@ -1259,22 +1236,19 @@ static int dump_info(void)
|
||||
|
||||
if (inputParameters.channelCount > 0) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel input rates:",
|
||||
inputParameters.channelCount);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel input rates:", inputParameters.channelCount);
|
||||
PrintSupportedStandardSampleRates(&inputParameters, NULL);
|
||||
}
|
||||
|
||||
if (outputParameters.channelCount > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel output rates:",
|
||||
outputParameters.channelCount);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "half-duplex 16 bit %d channel output rates:", outputParameters.channelCount);
|
||||
PrintSupportedStandardSampleRates(NULL, &outputParameters);
|
||||
}
|
||||
|
||||
if (inputParameters.channelCount > 0 && outputParameters.channelCount > 0) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
|
||||
"full-duplex 16 bit %d channel input, %d channel output rates:",
|
||||
inputParameters.channelCount, outputParameters.channelCount);
|
||||
"full-duplex 16 bit %d channel input, %d channel output rates:", inputParameters.channelCount, outputParameters.channelCount);
|
||||
PrintSupportedStandardSampleRates(&inputParameters, &outputParameters);
|
||||
}
|
||||
}
|
||||
@@ -1284,8 +1258,7 @@ static int dump_info(void)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,
|
||||
"An error occured while using the portaudio stream\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
|
||||
return err;
|
||||
@@ -1308,23 +1281,14 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
|
||||
if (switch_core_codec_init(&globals.read_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
sample_rate,
|
||||
codec_ms,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
if (switch_core_codec_init(&globals.write_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
sample_rate,
|
||||
codec_ms,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
|
||||
switch_core_codec_destroy(&globals.read_codec);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -1332,10 +1296,7 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
|
||||
}
|
||||
|
||||
if (switch_core_timer_init(&globals.timer,
|
||||
globals.timer_name,
|
||||
codec_ms,
|
||||
globals.read_codec.implementation->samples_per_frame,
|
||||
module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
|
||||
switch_core_codec_destroy(&globals.read_codec);
|
||||
switch_core_codec_destroy(&globals.write_codec);
|
||||
@@ -1415,8 +1376,7 @@ static switch_status_t engage_ring_device(int sample_rate, int channels)
|
||||
}
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Engage ring device! rate: %d channels %d\n", sample_rate,
|
||||
channels);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Engage ring device! rate: %d channels %d\n", sample_rate, channels);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1714,15 +1674,9 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
NULL,
|
||||
dialplan,
|
||||
cid_name,
|
||||
cid_num,
|
||||
NULL, NULL, NULL, NULL, (char *) modname, NULL,
|
||||
dest)) != 0) {
|
||||
dialplan, cid_name, cid_num, NULL, NULL, NULL, NULL, (char *) modname, NULL, dest)) != 0) {
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "PortAudio/%s",
|
||||
tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->
|
||||
destination_number : modname);
|
||||
snprintf(name, sizeof(name), "PortAudio/%s", tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
|
||||
switch_channel_set_name(channel, name);
|
||||
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
@@ -1734,8 +1688,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
switch_core_session_thread_launch(tech_pvt->session);
|
||||
add_pvt(tech_pvt, PA_MASTER);
|
||||
stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id,
|
||||
switch_core_session_get_uuid(tech_pvt->session));
|
||||
stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
|
||||
} else {
|
||||
switch_core_session_destroy(&session);
|
||||
stream->write_function(stream, "FAIL:Device Error!\n");
|
||||
@@ -1773,8 +1726,7 @@ static switch_status_t pa_cmd(char *cmd, switch_core_session_t *isession, switch
|
||||
"pa devlist\n"
|
||||
"pa indev [#<num>|<partial name>\n"
|
||||
"pa outdev [#<num>|<partial name>\n"
|
||||
"pa ringdev [#<num>|<partial name>\n"
|
||||
"--------------------------------------------------------------------------------\n";
|
||||
"pa ringdev [#<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
|
||||
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
stream->write_function(stream, "%s", usage_string);
|
||||
|
||||
@@ -164,8 +164,7 @@ void PaUtil_FlushRingBuffer(PaUtilRingBuffer * rbuf)
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be written or numBytes, whichever is smaller.
|
||||
*/
|
||||
long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes,
|
||||
void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
|
||||
long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
|
||||
{
|
||||
long index;
|
||||
long available = PaUtil_GetRingBufferWriteAvailable(rbuf);
|
||||
@@ -205,8 +204,7 @@ long PaUtil_AdvanceRingBufferWriteIndex(PaUtilRingBuffer * rbuf, long numBytes)
|
||||
** If non-contiguous, size2 will be the size of second region.
|
||||
** Returns room available to be written or numBytes, whichever is smaller.
|
||||
*/
|
||||
long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes,
|
||||
void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
|
||||
long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2)
|
||||
{
|
||||
long index;
|
||||
long available = PaUtil_GetRingBufferReadAvailable(rbuf);
|
||||
|
||||
@@ -142,8 +142,7 @@ extern "C" {
|
||||
|
||||
@return The room available to be written or numBytes, whichever is smaller.
|
||||
*/
|
||||
long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes,
|
||||
void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
|
||||
long PaUtil_GetRingBufferWriteRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
|
||||
|
||||
/** Advance the write index to the next location to be written.
|
||||
|
||||
@@ -175,8 +174,7 @@ extern "C" {
|
||||
|
||||
@return The number of bytes available for reading.
|
||||
*/
|
||||
long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes,
|
||||
void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
|
||||
long PaUtil_GetRingBufferReadRegions(PaUtilRingBuffer * rbuf, long numBytes, void **dataPtr1, long *sizePtr1, void **dataPtr2, long *sizePtr2);
|
||||
|
||||
/** Advance the read index to the next location to be read.
|
||||
|
||||
|
||||
@@ -60,9 +60,7 @@
|
||||
/************************************************************************/
|
||||
|
||||
static int blockingIOCallback(const void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
const PaStreamCallbackTimeInfo * timeInfo,
|
||||
PaStreamCallbackFlags statusFlags, void *userData);
|
||||
unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
|
||||
static PaError PABLIO_InitFIFO(PaUtilRingBuffer * rbuf, long numFrames, long bytesPerFrame);
|
||||
static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf);
|
||||
|
||||
@@ -74,9 +72,7 @@ static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf);
|
||||
* Read and write data only if there is room in FIFOs.
|
||||
*/
|
||||
static int blockingIOCallback(const void *inputBuffer, void *outputBuffer,
|
||||
unsigned long framesPerBuffer,
|
||||
const PaStreamCallbackTimeInfo * timeInfo,
|
||||
PaStreamCallbackFlags statusFlags, void *userData)
|
||||
unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
|
||||
{
|
||||
PABLIO_Stream *data = (PABLIO_Stream *) userData;
|
||||
long numBytes = data->bytesPerFrame * framesPerBuffer;
|
||||
@@ -195,8 +191,7 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
|
||||
*
|
||||
*/
|
||||
PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
|
||||
const PaStreamParameters * inputParameters,
|
||||
const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags)
|
||||
const PaStreamParameters * inputParameters, const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags)
|
||||
{
|
||||
long bytesPerSample;
|
||||
PaError err;
|
||||
@@ -250,9 +245,7 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
|
||||
|
||||
/* Open a PortAudio stream that we will use to communicate with the underlying
|
||||
* audio drivers. */
|
||||
err = Pa_OpenStream(&aStream->stream,
|
||||
inputParameters,
|
||||
outputParameters, sampleRate, FRAMES_PER_BUFFER, streamFlags, blockingIOCallback, aStream);
|
||||
err = Pa_OpenStream(&aStream->stream, inputParameters, outputParameters, sampleRate, FRAMES_PER_BUFFER, streamFlags, blockingIOCallback, aStream);
|
||||
if (err != paNoError)
|
||||
goto error;
|
||||
|
||||
|
||||
@@ -105,8 +105,7 @@ extern "C" {
|
||||
*/
|
||||
PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
|
||||
const PaStreamParameters * inputParameters,
|
||||
const PaStreamParameters * outputParameters,
|
||||
double sampleRate, PaStreamCallbackFlags statusFlags);
|
||||
const PaStreamParameters * outputParameters, double sampleRate, PaStreamCallbackFlags statusFlags);
|
||||
|
||||
PaError CloseAudioStream(PABLIO_Stream * aStream);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -69,8 +69,7 @@ extern "C" {
|
||||
}
|
||||
/*- 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) {
|
||||
\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)
|
||||
@@ -86,8 +85,7 @@ extern "C" {
|
||||
:"a" (bits));
|
||||
return res;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
static __inline__ int bottom_bit(unsigned int bits) {
|
||||
/*- End of function --------------------------------------------------------*/ static __inline__ int bottom_bit(unsigned int bits) {
|
||||
int res;
|
||||
|
||||
__asm__ __volatile__(" movq $-1,%%rdx;\n" " bsfq %%rax,%%rdx;\n":"=d"(res)
|
||||
|
||||
@@ -186,8 +186,7 @@ sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan)
|
||||
return CreateFile(fname,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
(LPSECURITY_ATTRIBUTES) NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, (HANDLE) NULL);
|
||||
(LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, (HANDLE) NULL);
|
||||
#else
|
||||
int fd = -1;
|
||||
|
||||
@@ -498,8 +497,7 @@ int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
|
||||
printf("\trx pkt\t%d\ttx pkt\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_packets, tdm_api->wp_tdm_cmd.stats.tx_packets);
|
||||
printf("\trx err\t%d\ttx err\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_errors, tdm_api->wp_tdm_cmd.stats.tx_errors);
|
||||
#ifndef __WINDOWS__
|
||||
printf("\trx ovr\t%d\ttx idl\t%d\n",
|
||||
tdm_api->wp_tdm_cmd.stats.rx_fifo_errors, tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
|
||||
printf("\trx ovr\t%d\ttx idl\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_fifo_errors, tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@@ -765,8 +763,7 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
|
||||
if (tdm_api->wp_tdm_event.wp_dtmf_event) {
|
||||
tdm_api->wp_tdm_event.wp_dtmf_event(fd,
|
||||
rx_event->wp_tdm_api_event_dtmf_digit,
|
||||
rx_event->wp_tdm_api_event_dtmf_type,
|
||||
rx_event->wp_tdm_api_event_dtmf_port);
|
||||
rx_event->wp_tdm_api_event_dtmf_type, rx_event->wp_tdm_api_event_dtmf_port);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -138,8 +138,7 @@ static int __pri_sangoma_write(struct pri *pri, void *buf, int buflen)
|
||||
/* FIXME: This might cause problems with other libraries
|
||||
* We must remove 2 bytes from buflen because
|
||||
* libpri sends 2 fake CRC bytes */
|
||||
res = sangoma_sendmsg_socket((sng_fd_t) (pri->fd),
|
||||
tmpbuf, sizeof(wp_tdm_api_rx_hdr_t), buf, (unsigned short) buflen - 2, 0);
|
||||
res = sangoma_sendmsg_socket((sng_fd_t) (pri->fd), tmpbuf, sizeof(wp_tdm_api_rx_hdr_t), buf, (unsigned short) buflen - 2, 0);
|
||||
if (res > 0) {
|
||||
res = buflen;
|
||||
}
|
||||
@@ -222,8 +221,7 @@ int sangoma_one_loop(struct sangoma_pri *spri)
|
||||
if (event) {
|
||||
event_handler handler;
|
||||
/* 0 is catchall event handler */
|
||||
if ((handler =
|
||||
spri->eventmap[event->e] ? spri->eventmap[event->e] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) {
|
||||
if ((handler = spri->eventmap[event->e] ? spri->eventmap[event->e] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) {
|
||||
handler(spri, event->e, event);
|
||||
} else {
|
||||
fprintf(stderr, "No event handler found for event %d.\n", event->e);
|
||||
|
||||
@@ -30,9 +30,7 @@ int tdmv_api_ioctl(HANDLE fd, wanpipe_tdm_api_cmd_t * tdm_api_cmd)
|
||||
|
||||
if (DeviceIoControl(fd,
|
||||
IoctlManagementCommand,
|
||||
(LPVOID) & wan_udp,
|
||||
sizeof(wan_udp_hdr_t),
|
||||
(LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
(LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
//actual ioctl failed
|
||||
err = 1;
|
||||
prn(1, "Error: tdmv_api_ioctl(): DeviceIoControl failed!!\n");
|
||||
@@ -70,9 +68,7 @@ int wanpipe_api_ioctl(HANDLE fd, wan_cmd_api_t * api_cmd)
|
||||
|
||||
if (DeviceIoControl(fd,
|
||||
IoctlManagementCommand,
|
||||
(LPVOID) & wan_udp,
|
||||
sizeof(wan_udp_hdr_t),
|
||||
(LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
(LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPVOID) & wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
err = 1;
|
||||
prn(1, "Error: wanpipe_api_ioctl(): DeviceIoControl failed!!\n");
|
||||
return err;
|
||||
@@ -95,10 +91,7 @@ static USHORT DoReadCommand(HANDLE drv, RX_DATA_STRUCT * pRx)
|
||||
{
|
||||
DWORD ln;
|
||||
|
||||
if (DeviceIoControl(drv,
|
||||
IoctlReadCommand,
|
||||
(LPVOID) NULL,
|
||||
0L, (LPVOID) pRx, sizeof(RX_DATA_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
if (DeviceIoControl(drv, IoctlReadCommand, (LPVOID) NULL, 0L, (LPVOID) pRx, sizeof(RX_DATA_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
//check messages log
|
||||
prn(1, "Error: DoReadCommand(): DeviceIoControl failed!\n");
|
||||
return 1;
|
||||
@@ -115,9 +108,7 @@ static UCHAR DoWriteCommand(HANDLE drv, TX_DATA_STRUCT * pTx)
|
||||
|
||||
if (DeviceIoControl(drv,
|
||||
IoctlWriteCommand,
|
||||
(LPVOID) pTx,
|
||||
(ULONG) sizeof(TX_DATA_STRUCT),
|
||||
(LPVOID) pTx, sizeof(TX_DATA_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
(LPVOID) pTx, (ULONG) sizeof(TX_DATA_STRUCT), (LPVOID) pTx, sizeof(TX_DATA_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
//check messages log
|
||||
prn(1, "Error: DoWriteCommand(): DeviceIoControl failed!\n");
|
||||
return 1;
|
||||
@@ -131,12 +122,7 @@ static USHORT DoApiPollCommand(HANDLE drv, API_POLL_STRUCT * api_poll_ptr)
|
||||
{
|
||||
DWORD ln;
|
||||
|
||||
if (DeviceIoControl(drv,
|
||||
IoctlApiPoll,
|
||||
(LPVOID) NULL,
|
||||
0L,
|
||||
(LPVOID) api_poll_ptr,
|
||||
sizeof(API_POLL_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
if (DeviceIoControl(drv, IoctlApiPoll, (LPVOID) NULL, 0L, (LPVOID) api_poll_ptr, sizeof(API_POLL_STRUCT), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
//check messages log
|
||||
prn(1, "Error: DoApiPollCommand(): DeviceIoControl failed!\n");
|
||||
return 1;
|
||||
@@ -157,9 +143,7 @@ int DoManagementCommand(HANDLE drv, wan_udp_hdr_t * wan_udp)
|
||||
|
||||
if (DeviceIoControl(drv,
|
||||
IoctlManagementCommand,
|
||||
(LPVOID) wan_udp,
|
||||
sizeof(wan_udp_hdr_t),
|
||||
(LPVOID) wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
(LPVOID) wan_udp, sizeof(wan_udp_hdr_t), (LPVOID) wan_udp, sizeof(wan_udp_hdr_t), (LPDWORD) (&ln), (LPOVERLAPPED) NULL) == FALSE) {
|
||||
//check messages log
|
||||
prn(1, "Error: DoManagementCommand(): DeviceIoControl failed!\n");
|
||||
return 1;
|
||||
|
||||
@@ -269,7 +269,7 @@ static void analog_parse_event(analog_channel_t * alc)
|
||||
|
||||
}
|
||||
|
||||
static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
@@ -462,18 +462,16 @@ static switch_status_t wanpipe_on_loopback(switch_core_session_t *session);
|
||||
static switch_status_t wanpipe_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool);
|
||||
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
|
||||
static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
|
||||
static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
|
||||
static int check_flags(struct sangoma_pri *spri);
|
||||
static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
|
||||
static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
|
||||
static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj);
|
||||
static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t * thread, void *obj);
|
||||
static switch_status_t config_wanpipe(int reload);
|
||||
|
||||
|
||||
@@ -499,20 +497,16 @@ static switch_status_t wanpipe_codec_init(private_object_t * tech_pvt)
|
||||
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n",
|
||||
switch_channel_get_name(channel));
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n",
|
||||
switch_channel_get_name(channel));
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -583,20 +577,16 @@ static switch_status_t wanpipe_on_init(switch_core_session_t *session)
|
||||
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
|
||||
|
||||
switch_copy_string(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index],
|
||||
switch_core_session_get_uuid(session),
|
||||
sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
|
||||
switch_core_session_get_uuid(session), sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
|
||||
|
||||
|
||||
ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number,
|
||||
tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
|
||||
ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
|
||||
|
||||
if (ss7boost_client_connection_write(&tech_pvt->ss7boost_handle->mcon, &event) <= 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Called Event TG=%d\n",
|
||||
tech_pvt->boost_trunk_group);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Called Event TG=%d\n", tech_pvt->boost_trunk_group);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -664,9 +654,7 @@ static switch_status_t wanpipe_on_hangup(switch_core_session_t *session)
|
||||
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
isup_exec_command(tech_pvt->ss7boost_handle,
|
||||
tech_pvt->boost_span_number,
|
||||
tech_pvt->boost_chan_number,
|
||||
-1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL);
|
||||
tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL);
|
||||
}
|
||||
} else if (tech_pvt->spri) {
|
||||
chanmap = tech_pvt->spri->private_info;
|
||||
@@ -731,9 +719,7 @@ static switch_status_t wanpipe_answer_channel(switch_core_session_t *session)
|
||||
pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
|
||||
}
|
||||
} else if (tech_pvt->ss7boost_handle) {
|
||||
isup_exec_command(tech_pvt->ss7boost_handle,
|
||||
tech_pvt->boost_span_number,
|
||||
tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_ANSWERED, 0);
|
||||
isup_exec_command(tech_pvt->ss7boost_handle, tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_ANSWERED, 0);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -741,8 +727,7 @@ static switch_status_t wanpipe_answer_channel(switch_core_session_t *session)
|
||||
|
||||
|
||||
|
||||
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
@@ -775,9 +760,7 @@ static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch
|
||||
}
|
||||
|
||||
if ((bread = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
|
||||
&tech_pvt->hdrframe,
|
||||
sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes,
|
||||
0)) < 0) {
|
||||
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
|
||||
if (errno == EBUSY) {
|
||||
continue;
|
||||
} else {
|
||||
@@ -821,8 +804,7 @@ static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt;
|
||||
uint32_t dtmf_blen;
|
||||
@@ -855,9 +837,7 @@ static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switc
|
||||
write(tech_pvt->fd, data, frame->datalen);
|
||||
#endif
|
||||
|
||||
result =
|
||||
sangoma_sendmsg_socket(tech_pvt->wpsock->fd, &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), data,
|
||||
frame->datalen, 0);
|
||||
result = sangoma_sendmsg_socket(tech_pvt->wpsock->fd, &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), data, frame->datalen, 0);
|
||||
|
||||
if (result < 0 && errno != EBUSY) {
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -1005,7 +985,7 @@ static const switch_loadable_module_interface_t wanpipe_module_interface = {
|
||||
|
||||
static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool)
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool)
|
||||
{
|
||||
char *bchan = NULL;
|
||||
char name[128] = "";
|
||||
@@ -1136,8 +1116,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
if (sangoma_span_chan_fromif(bchan, &span, &chan)) {
|
||||
if (!wp_open(tech_pvt, span, chan)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span,
|
||||
chan, strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span, chan, strerror(errno));
|
||||
switch_core_session_destroy(new_session);
|
||||
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
goto error;
|
||||
@@ -1170,8 +1149,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
if (autochan > 0) {
|
||||
for (callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
|
||||
if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n",
|
||||
span, callno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1179,8 +1157,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
} else if (autochan < 0) {
|
||||
for (callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
|
||||
if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n",
|
||||
span, callno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1209,8 +1186,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
if (spri && (tech_pvt->call = pri_new_call(spri->pri))) {
|
||||
struct pri_sr *sr;
|
||||
|
||||
snprintf(name, sizeof(name), "wanpipe/pri/s%dc%d/%s", spri->span, callno,
|
||||
caller_profile->destination_number);
|
||||
snprintf(name, sizeof(name), "wanpipe/pri/s%dc%d/%s", spri->span, callno, caller_profile->destination_number);
|
||||
switch_channel_set_name(channel, name);
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
sr = pri_sr_new();
|
||||
@@ -1218,13 +1194,8 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
pri_sr_set_bearer(sr, 0, SPANS[span]->l1);
|
||||
pri_sr_set_called(sr, caller_profile->destination_number, SPANS[span]->dp, 1);
|
||||
pri_sr_set_caller(sr,
|
||||
caller_profile->caller_id_number,
|
||||
caller_profile->caller_id_name,
|
||||
SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
|
||||
pri_sr_set_redirecting(sr,
|
||||
caller_profile->caller_id_number,
|
||||
SPANS[span]->dp,
|
||||
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
|
||||
caller_profile->caller_id_number, caller_profile->caller_id_name, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
|
||||
pri_sr_set_redirecting(sr, caller_profile->caller_id_number, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
|
||||
|
||||
if (pri_setup(spri->pri, tech_pvt->call, sr)) {
|
||||
switch_core_session_destroy(new_session);
|
||||
@@ -1241,8 +1212,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
|
||||
goto error;
|
||||
}
|
||||
pri_sr_free(sr);
|
||||
switch_copy_string(chanmap->map[callno],
|
||||
switch_core_session_get_uuid(*new_session), sizeof(chanmap->map[callno]));
|
||||
switch_copy_string(chanmap->map[callno], switch_core_session_get_uuid(*new_session), sizeof(chanmap->map[callno]));
|
||||
tech_pvt->spri = spri;
|
||||
}
|
||||
} else if (is_boost) {
|
||||
@@ -1304,8 +1274,7 @@ static void s_pri_message(struct pri *pri, char *s)
|
||||
}
|
||||
#endif
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -1379,8 +1348,7 @@ static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, p
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Hanging up channel s%dc%d\n", spri->span,
|
||||
pevent->hangup.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Hanging up channel s%dc%d\n", spri->span, pevent->hangup.channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1394,15 +1362,13 @@ static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, p
|
||||
chanmap = spri->private_info;
|
||||
|
||||
if ((session = switch_core_session_locate(chanmap->map[pevent->answer.channel]))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d\n", spri->span,
|
||||
pevent->answer.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d\n", spri->span, pevent->answer.channel);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
switch_channel_mark_answered(channel);
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d but it's not in use?\n",
|
||||
spri->span, pevent->answer.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, pevent->answer.channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1420,8 +1386,7 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
if ((session = switch_core_session_locate(chanmap->map[pevent->proceeding.channel]))) {
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span,
|
||||
pevent->proceeding.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, pevent->proceeding.channel);
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
@@ -1440,8 +1405,7 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span,
|
||||
pevent->proceeding.channel);
|
||||
"-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span, pevent->proceeding.channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1458,8 +1422,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
chanmap = spri->private_info;
|
||||
|
||||
if ((session = switch_core_session_locate(chanmap->map[pevent->ringing.channel]))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d\n", spri->span,
|
||||
pevent->ringing.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d\n", spri->span, pevent->ringing.channel);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
@@ -1469,8 +1432,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel,
|
||||
chanmap->map[pevent->ringing.channel]);
|
||||
"-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1489,8 +1451,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
|
||||
chanmap = spri->private_info;
|
||||
if (switch_core_session_locate(chanmap->map[pevent->ring.channel])) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n",
|
||||
spri->span, pevent->ring.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n", spri->span, pevent->ring.channel);
|
||||
switch_core_session_rwunlock(session);
|
||||
ret = 0;
|
||||
goto done;
|
||||
@@ -1529,18 +1490,14 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
}
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
NULL,
|
||||
globals.dialplan,
|
||||
"FreeSWITCH", pevent->ring.callingnum,
|
||||
NULL, globals.dialplan, "FreeSWITCH", pevent->ring.callingnum,
|
||||
#ifdef WIN32
|
||||
NULL,
|
||||
#else
|
||||
pevent->ring.callingani,
|
||||
#endif
|
||||
switch_strlen_zero(ani2str) ? NULL : ani2str,
|
||||
NULL,
|
||||
NULL,
|
||||
(char *) modname, NULL, pevent->ring.callednum))) {
|
||||
NULL, NULL, (char *) modname, NULL, pevent->ring.callednum))) {
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
}
|
||||
|
||||
@@ -1559,8 +1516,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd!\n");
|
||||
}
|
||||
|
||||
switch_copy_string(chanmap->map[pevent->ring.channel], switch_core_session_get_uuid(session),
|
||||
sizeof(chanmap->map[pevent->ring.channel]));
|
||||
switch_copy_string(chanmap->map[pevent->ring.channel], switch_core_session_get_uuid(session), sizeof(chanmap->map[pevent->ring.channel]));
|
||||
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
switch_core_session_thread_launch(session);
|
||||
@@ -1586,8 +1542,7 @@ static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
struct channel_map *chanmap;
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Restarting s%dc%d\n", spri->span,
|
||||
pevent->restart.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Restarting s%dc%d\n", spri->span, pevent->restart.channel);
|
||||
|
||||
if (pevent->restart.channel < 1) {
|
||||
return 0;
|
||||
@@ -1599,8 +1554,7 @@ static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
if ((session = switch_core_session_locate(chanmap->map[pevent->restart.channel]))) {
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hanging Up channel %s\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hanging Up channel %s\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
@@ -1635,13 +1589,12 @@ static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_typ
|
||||
static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type,
|
||||
sangoma_pri_event_str(event_type));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type, sangoma_pri_event_str(event_type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
struct sangoma_pri *spri = obj;
|
||||
struct channel_map chanmap;
|
||||
@@ -1787,8 +1740,7 @@ static void handle_call_start(ss7boost_handle_t * ss7boost_handle, ss7boost_clie
|
||||
char name[128];
|
||||
|
||||
if (*ss7boost_handle->span_chanmap[event->span].map[event->chan]) {
|
||||
isup_exec_command(ss7boost_handle,
|
||||
event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY);
|
||||
isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1812,20 +1764,13 @@ static void handle_call_start(ss7boost_handle_t * ss7boost_handle, ss7boost_clie
|
||||
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
NULL,
|
||||
globals.dialplan,
|
||||
"FreeSWITCH(boost)",
|
||||
(char *) event->calling_number_digits,
|
||||
NULL, globals.dialplan, "FreeSWITCH(boost)", (char *) event->calling_number_digits,
|
||||
#ifdef WIN32
|
||||
NULL,
|
||||
#else
|
||||
(char *) event->calling_number_digits,
|
||||
#endif
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
(char *) modname,
|
||||
NULL, (char *) event->called_number_digits))) {
|
||||
NULL, NULL, NULL, (char *) modname, NULL, (char *) event->called_number_digits))) {
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
}
|
||||
|
||||
@@ -1839,14 +1784,12 @@ static void handle_call_start(ss7boost_handle_t * ss7boost_handle, ss7boost_clie
|
||||
tech_pvt->boost_pres = event->calling_number_presentation;
|
||||
|
||||
if (!wp_open(tech_pvt, event->span + 1, event->chan + 1)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span + 1,
|
||||
event->chan + 1);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span + 1, event->chan + 1);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan],
|
||||
switch_core_session_get_uuid(session),
|
||||
sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
|
||||
switch_core_session_get_uuid(session), sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
|
||||
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_ACK, 0);
|
||||
@@ -1862,8 +1805,7 @@ static void handle_call_start(ss7boost_handle_t * ss7boost_handle, ss7boost_clie
|
||||
switch_core_session_destroy(&session);
|
||||
}
|
||||
|
||||
isup_exec_command(ss7boost_handle,
|
||||
event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY);
|
||||
isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY);
|
||||
|
||||
}
|
||||
|
||||
@@ -1899,16 +1841,14 @@ static void handle_call_start_ack(ss7boost_handle_t * ss7boost_handle, ss7boost_
|
||||
tech_pvt->boost_chan_number = event->chan;
|
||||
|
||||
switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan],
|
||||
switch_core_session_get_uuid(session),
|
||||
sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
|
||||
switch_core_session_get_uuid(session), sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
|
||||
|
||||
|
||||
|
||||
if (!tech_pvt->wpsock) {
|
||||
if (!wp_open(tech_pvt, tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
|
||||
tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1,
|
||||
strerror(errno));
|
||||
tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return;
|
||||
}
|
||||
@@ -1951,8 +1891,7 @@ static void handle_call_answer(ss7boost_handle_t * ss7boost_handle, ss7boost_cli
|
||||
if (!tech_pvt->wpsock) {
|
||||
if (!wp_open(tech_pvt, tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
|
||||
tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1,
|
||||
strerror(errno));
|
||||
tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return;
|
||||
}
|
||||
@@ -2003,8 +1942,7 @@ static void handle_call_start_nack(ss7boost_handle_t * ss7boost_handle, ss7boost
|
||||
|
||||
switch_channel_hangup(channel, event->release_cause);
|
||||
|
||||
isup_exec_command(ss7boost_handle,
|
||||
event->span, event->chan, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0);
|
||||
isup_exec_command(ss7boost_handle, event->span, event->chan, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0);
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
@@ -2044,8 +1982,7 @@ static int parse_ss7_event(ss7boost_handle_t * ss7boost_handle, ss7boost_client_
|
||||
event->chan + 1,
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
|
||||
switch_channel_cause2str(event->release_cause),
|
||||
event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
|
||||
switch_channel_cause2str(event->release_cause), event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
|
||||
|
||||
|
||||
switch (event->event_id) {
|
||||
@@ -2075,15 +2012,14 @@ static int parse_ss7_event(ss7boost_handle_t * ss7boost_handle, ss7boost_client_
|
||||
handle_call_stop_ack(ss7boost_handle, event);
|
||||
break;
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
|
||||
ss7boost_client_event_id_name(event->event_id));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n", ss7boost_client_event_id_name(event->event_id));
|
||||
break;
|
||||
}
|
||||
switch_mutex_unlock(ss7boost_handle->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
ss7boost_handle_t *ss7boost_handle = (ss7boost_handle_t *) obj;
|
||||
ss7boost_client_event_t *event;
|
||||
@@ -2091,8 +2027,7 @@ static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t *thread, void *
|
||||
if (ss7boost_client_connection_open(&ss7boost_handle->mcon,
|
||||
ss7boost_handle->local_ip,
|
||||
ss7boost_handle->local_port,
|
||||
ss7boost_handle->remote_ip,
|
||||
ss7boost_handle->remote_port, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
ss7boost_handle->remote_ip, ss7boost_handle->remote_port, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FATAL ERROR CREATING CLIENT CONNECTION\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -2115,13 +2050,11 @@ static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t *thread, void *
|
||||
gettimeofday(¤t, NULL);
|
||||
timersub(¤t, &event->tv, &difftime);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
|
||||
ss7boost_client_event_id_name(event->event_id),
|
||||
(int) difftime.tv_sec, (int) difftime.tv_usec);
|
||||
ss7boost_client_event_id_name(event->event_id), (int) difftime.tv_sec, (int) difftime.tv_usec);
|
||||
|
||||
parse_ss7_event(ss7boost_handle, event);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Reading from Boost Socket! %s\n",
|
||||
strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Reading from Boost Socket! %s\n", strerror(errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2262,8 +2195,7 @@ static switch_status_t config_wanpipe(int reload)
|
||||
}
|
||||
|
||||
if (!(sock = wp_open(NULL, span, chan))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open device '%s' (%s)\n", c_dev,
|
||||
strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open device '%s' (%s)\n", c_dev, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2423,9 +2355,7 @@ static switch_status_t config_wanpipe(int reload)
|
||||
SPANS[current_span]->l1 = PRI_LAYER_1_ULAW;
|
||||
}
|
||||
if (sangoma_init_pri(&SPANS[current_span]->spri,
|
||||
current_span,
|
||||
SPANS[current_span]->dchan,
|
||||
SPANS[current_span]->pswitch, SPANS[current_span]->node, globals.debug)) {
|
||||
current_span, SPANS[current_span]->dchan, SPANS[current_span]->pswitch, SPANS[current_span]->node, globals.debug)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -56,14 +56,12 @@ static struct ss7boost_client_map ss7boost_client_table[] = {
|
||||
|
||||
|
||||
|
||||
static switch_status_t create_udp_socket(ss7boost_client_connection_t * mcon, char *local_ip, int local_port, char *ip,
|
||||
int port)
|
||||
static switch_status_t create_udp_socket(ss7boost_client_connection_t * mcon, char *local_ip, int local_port, char *ip, int port)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n", local_ip, local_port, ip, port);
|
||||
|
||||
if (switch_sockaddr_info_get(&mcon->local_addr, local_ip, SWITCH_UNSPEC, local_port, 0, mcon->pool) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_sockaddr_info_get(&mcon->local_addr, local_ip, SWITCH_UNSPEC, local_port, 0, mcon->pool) != SWITCH_STATUS_SUCCESS) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -79,14 +77,12 @@ static switch_status_t create_udp_socket(ss7boost_client_connection_t * mcon, ch
|
||||
goto fail;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Created boost connection %s:%d->%s:%d\n", local_ip,
|
||||
local_port, ip, port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Created boost connection %s:%d->%s:%d\n", local_ip, local_port, ip, port);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
fail:
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure creating boost connection %s:%d->%s:%d\n", local_ip,
|
||||
local_port, ip, port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure creating boost connection %s:%d->%s:%d\n", local_ip, local_port, ip, port);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -102,9 +98,7 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t * mcon,
|
||||
char *local_ip,
|
||||
int local_port,
|
||||
char *ip, int port, switch_memory_pool_t *pool)
|
||||
char *local_ip, int local_port, char *ip, int port, switch_memory_pool_t * pool)
|
||||
{
|
||||
memset(mcon, 0, sizeof(*mcon));
|
||||
mcon->pool = pool;
|
||||
@@ -118,24 +112,21 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon,
|
||||
ss7boost_client_event_t ** event)
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon, ss7boost_client_event_t ** event)
|
||||
{
|
||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||
switch_size_t bytes = 0;
|
||||
|
||||
bytes = sizeof(mcon->event);
|
||||
|
||||
if (switch_socket_recvfrom(mcon->local_addr, mcon->socket, 0, (void *) &mcon->event, &bytes) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_socket_recvfrom(mcon->local_addr, mcon->socket, 0, (void *) &mcon->event, &bytes) != SWITCH_STATUS_SUCCESS) {
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
if (bytes == sizeof(mcon->event) || bytes == (sizeof(mcon->event) - sizeof(uint32_t))) {
|
||||
if (rxseq != mcon->event.seqno) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "------------------------------------------\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
||||
"Critical Error: Invalid Sequence Number Expect=%i Rx=%i\n", rxseq, mcon->event.seqno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Critical Error: Invalid Sequence Number Expect=%i Rx=%i\n", rxseq, mcon->event.seqno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "------------------------------------------\n");
|
||||
}
|
||||
rxseq++;
|
||||
@@ -147,8 +138,7 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon,
|
||||
ss7boost_client_event_t * event)
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon, ss7boost_client_event_t * event)
|
||||
{
|
||||
int err;
|
||||
switch_size_t len;
|
||||
@@ -160,8 +150,7 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client
|
||||
|
||||
if (event->span < 0 || event->chan < 0 || event->span > 7 || event->chan > 30) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "------------------------------------------\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
|
||||
"Critical Error: Invalid Span=%i Chan=%i\n", event->span, event->chan);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Critical Error: Invalid Span=%i Chan=%i\n", event->span, event->chan);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "------------------------------------------\n");
|
||||
}
|
||||
#ifdef WIN32
|
||||
@@ -179,8 +168,7 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client
|
||||
switch_mutex_unlock(mcon->mutex);
|
||||
|
||||
if (len != sizeof(ss7boost_client_event_t)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write Error: [%d][%d][%s]\n", mcon->socket, errno,
|
||||
strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write Error: [%d][%d][%s]\n", mcon->socket, errno, strerror(errno));
|
||||
err = -1;
|
||||
}
|
||||
|
||||
@@ -206,15 +194,13 @@ SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client
|
||||
event->chan + 1,
|
||||
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
|
||||
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
|
||||
event->release_cause,
|
||||
event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
|
||||
event->release_cause, event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
|
||||
|
||||
|
||||
return err ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called,
|
||||
int setup_id)
|
||||
SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called, int setup_id)
|
||||
{
|
||||
memset(event, 0, sizeof(ss7boost_client_event_t));
|
||||
event->event_id = SIGBOOST_EVENT_CALL_START;
|
||||
@@ -233,8 +219,7 @@ SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event,
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id,
|
||||
int chan, int span)
|
||||
SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id, int chan, int span)
|
||||
{
|
||||
memset(event, 0, sizeof(ss7boost_client_event_t));
|
||||
event->event_id = event_id;
|
||||
|
||||
@@ -91,17 +91,11 @@ typedef struct ss7boost_client_connection ss7boost_client_connection_t;
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client_connection_t * mcon);
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t * mcon,
|
||||
char *local_ip,
|
||||
int local_port,
|
||||
char *ip, int port, switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon,
|
||||
ss7boost_client_event_t ** event);
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon,
|
||||
ss7boost_client_event_t * event);
|
||||
SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id,
|
||||
int chan, int span);
|
||||
SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called,
|
||||
int setup_id);
|
||||
char *local_ip, int local_port, char *ip, int port, switch_memory_pool_t * pool);
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon, ss7boost_client_event_t ** event);
|
||||
SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon, ss7boost_client_event_t * event);
|
||||
SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id, int chan, int span);
|
||||
SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called, int setup_id);
|
||||
SWITCH_DECLARE(char *) ss7boost_client_event_id_name(uint32_t event_id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -171,24 +171,21 @@ static switch_status_t woomera_on_loopback(switch_core_session_t *session);
|
||||
static switch_status_t woomera_on_transmit(switch_core_session_t *session);
|
||||
static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool);
|
||||
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id);
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool);
|
||||
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t woomera_kill_channel(switch_core_session_t *session, int sig);
|
||||
static void tech_destroy(private_object * tech_pvt);
|
||||
static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...);
|
||||
static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...);
|
||||
static char *woomera_message_header(woomera_message * wmsg, char *key);
|
||||
static int woomera_enqueue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
|
||||
static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
|
||||
static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile,
|
||||
woomera_event_queue * event_queue);
|
||||
static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags);
|
||||
static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue);
|
||||
static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags);
|
||||
static int woomera_profile_thread_running(woomera_profile * profile, int set, int new);
|
||||
static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket);
|
||||
static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket);
|
||||
static int tech_create_read_socket(private_object * tech_pvt);
|
||||
static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj);
|
||||
static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj);
|
||||
static void *woomera_thread_run(void *obj);
|
||||
static int tech_activate(private_object * tech_pvt);
|
||||
|
||||
@@ -214,8 +211,7 @@ static switch_status_t woomera_on_init(switch_core_session_t *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->read_codec, "L16", NULL, rate, 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -223,8 +219,7 @@ static switch_status_t woomera_on_init(switch_core_session_t *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->write_codec, "L16", NULL, rate, 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -297,7 +292,7 @@ static switch_status_t woomera_on_hangup(switch_core_session_t *session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void woomera_socket_close(switch_socket_t **socket)
|
||||
static void woomera_socket_close(switch_socket_t ** socket)
|
||||
{
|
||||
if (*socket) {
|
||||
switch_socket_close(*socket);
|
||||
@@ -381,8 +376,7 @@ static switch_status_t woomera_waitfor_write(switch_core_session_t *session, int
|
||||
// return switch_socket_waitfor(tech_pvt->write_poll, ms);
|
||||
}
|
||||
|
||||
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
@@ -407,8 +401,7 @@ static switch_status_t woomera_read_frame(switch_core_session_t *session, switch
|
||||
*frame = pframe;
|
||||
|
||||
len = sizeof(tech_pvt->databuf);
|
||||
if (switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf, &len) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_socket_recvfrom(tech_pvt->udpread, tech_pvt->udp_socket, 0, tech_pvt->databuf, &len) == SWITCH_STATUS_SUCCESS) {
|
||||
pframe->datalen = (uint32_t) len;
|
||||
pframe->samples = (int) pframe->datalen / 2;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -417,8 +410,7 @@ static switch_status_t woomera_read_frame(switch_core_session_t *session, switch
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
|
||||
switch_io_flag_t flags, int stream_id)
|
||||
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
struct private_object *tech_pvt = NULL;
|
||||
@@ -486,15 +478,14 @@ static const switch_loadable_module_interface_t woomera_module_interface = {
|
||||
*/
|
||||
static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool)
|
||||
switch_core_session_t **new_session, switch_memory_pool_t ** pool)
|
||||
{
|
||||
if ((*new_session = switch_core_session_request(&woomera_endpoint_interface, pool)) != 0) {
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
|
||||
switch_core_session_add_stream(*new_session, NULL);
|
||||
if ((tech_pvt =
|
||||
(struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
|
||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
|
||||
memset(tech_pvt, 0, sizeof(*tech_pvt));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(*new_session));
|
||||
tech_pvt->profile = &default_profile;
|
||||
@@ -542,12 +533,9 @@ static void tech_destroy(private_object * tech_pvt)
|
||||
}
|
||||
|
||||
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "hangup %s%s", tech_pvt->call_info.callid,
|
||||
WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "{%s} Already Disconnected\n",
|
||||
tech_pvt->profile->name);
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "hangup %s%s", tech_pvt->call_info.callid, WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "{%s} Already Disconnected\n", tech_pvt->profile->name);
|
||||
}
|
||||
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "bye%s", WOOMERA_RECORD_SEPERATOR);
|
||||
@@ -556,7 +544,7 @@ static void tech_destroy(private_object * tech_pvt)
|
||||
}
|
||||
|
||||
|
||||
static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...)
|
||||
static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...)
|
||||
{
|
||||
char *stuff;
|
||||
size_t res = 0, len = 0;
|
||||
@@ -642,8 +630,7 @@ static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_mess
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile,
|
||||
woomera_event_queue * event_queue)
|
||||
static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue)
|
||||
{
|
||||
char *cur, *cr, *next = NULL;
|
||||
char buf[2048] = "", *ptr;
|
||||
@@ -780,8 +767,7 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
|
||||
|
||||
if (event_queue && switch_test_flag(wmsg, WFLAG_EVENT)) {
|
||||
if (globals.debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue Event: {%s} [%s]\n", profile->name,
|
||||
wmsg->command);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue Event: {%s} [%s]\n", profile->name, wmsg->command);
|
||||
}
|
||||
/* we don't want events we want a reply so we will stash them for later */
|
||||
woomera_enqueue_event(event_queue, wmsg);
|
||||
@@ -802,13 +788,12 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
|
||||
}
|
||||
|
||||
|
||||
static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags)
|
||||
static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags)
|
||||
{
|
||||
|
||||
switch_sockaddr_t *sa;
|
||||
|
||||
if (switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_sockaddr_info_get(&sa, profile->woomera_host, AF_INET, profile->woomera_port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -848,7 +833,7 @@ static int woomera_profile_thread_running(woomera_profile * profile, int set, in
|
||||
|
||||
}
|
||||
|
||||
static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket)
|
||||
static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket)
|
||||
{
|
||||
woomera_message wmsg;
|
||||
|
||||
@@ -858,18 +843,15 @@ static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **wo
|
||||
if (!woomera_profile_thread_running(profile, 0, 0)) {
|
||||
break;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"{%s} Cannot Reconnect to Woomera! retry in 5 seconds\n", profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "{%s} Cannot Reconnect to Woomera! retry in 5 seconds\n", profile->name);
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
}
|
||||
|
||||
if (*woomera_socket) {
|
||||
if (switch_test_flag(profile, PFLAG_INBOUND)) {
|
||||
woomera_printf(profile, *woomera_socket, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(*woomera_socket,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, profile, &profile->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n",
|
||||
profile->name);
|
||||
if (woomera_message_parse(*woomera_socket, &wmsg, WOOMERA_HARD_TIMEOUT, profile, &profile->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n", profile->name);
|
||||
globals.panic = 1;
|
||||
woomera_profile_thread_running(&default_profile, 1, 0);
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
@@ -898,8 +880,7 @@ static int tech_create_read_socket(private_object * tech_pvt)
|
||||
tech_pvt->port = globals.next_woomera_port = WOOMERA_MIN_PORT;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d\n", tech_pvt->profile->audio_ip,
|
||||
tech_pvt->port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d\n", tech_pvt->profile->audio_ip, tech_pvt->port);
|
||||
//tech_pvt->udp_socket = create_udp_socket(tech_pvt->profile->audio_ip, tech_pvt->port, &tech_pvt->udpread, 0);
|
||||
|
||||
switch_sockaddr_info_get(&tech_pvt->udpread, tech_pvt->profile->audio_ip, SWITCH_UNSPEC, tech_pvt->port, 0, pool);
|
||||
@@ -936,18 +917,14 @@ static int tech_activate(private_object * tech_pvt)
|
||||
tech_pvt->profile->audio_ip,
|
||||
tech_pvt->port,
|
||||
WOOMERA_LINE_SEPERATOR,
|
||||
tech_pvt->caller_profile->caller_id_name,
|
||||
tech_pvt->caller_profile->caller_id_number, WOOMERA_RECORD_SEPERATOR);
|
||||
tech_pvt->caller_profile->caller_id_name, tech_pvt->caller_profile->caller_id_number, WOOMERA_RECORD_SEPERATOR);
|
||||
|
||||
woomera_message_parse(tech_pvt->command_channel,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue);
|
||||
woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue);
|
||||
} else {
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_PARSE_INCOMING);
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(tech_pvt->command_channel,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
if (woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n", tech_pvt->profile->name);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
}
|
||||
@@ -961,7 +938,7 @@ static int tech_activate(private_object * tech_pvt)
|
||||
|
||||
|
||||
|
||||
static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
switch_core_session_t *session = obj;
|
||||
switch_channel_t *channel = NULL;
|
||||
@@ -1001,13 +978,9 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
if (switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_ANSWER);
|
||||
#ifdef USE_ANSWER
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "ANSWER %s%s", tech_pvt->call_info.callid,
|
||||
WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile,
|
||||
&tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "ANSWER %s%s", tech_pvt->call_info.callid, WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n", tech_pvt->profile->name);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
continue;
|
||||
@@ -1019,11 +992,8 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
switch_mutex_lock(tech_pvt->iolock);
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "DTMF %s %s%s", tech_pvt->call_info.callid,
|
||||
tech_pvt->dtmfbuf, WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile,
|
||||
&tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
if (woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n", tech_pvt->profile->name);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
continue;
|
||||
@@ -1037,9 +1007,7 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
struct timeval now;
|
||||
int elapsed;
|
||||
gettimeofday(&now, NULL);
|
||||
elapsed =
|
||||
(((now.tv_sec * 1000) + now.tv_usec / 1000) -
|
||||
((tech_pvt->started.tv_sec * 1000) + tech_pvt->started.tv_usec / 1000));
|
||||
elapsed = (((now.tv_sec * 1000) + now.tv_usec / 1000) - ((tech_pvt->started.tv_sec * 1000) + tech_pvt->started.tv_usec / 1000));
|
||||
if (elapsed > tech_pvt->timeout) {
|
||||
/* call timed out! */
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
@@ -1104,11 +1072,9 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
NULL,
|
||||
tech_pvt->profile->dialplan,
|
||||
cid_name, cid_num, ip, NULL, NULL, NULL,
|
||||
(char *) modname, NULL, exten)) != 0) {
|
||||
cid_name, cid_num, ip, NULL, NULL, NULL, (char *) modname, NULL, exten)) != 0) {
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number,
|
||||
rand() & 0xffff);
|
||||
snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
|
||||
switch_channel_set_name(channel, name);
|
||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||
|
||||
@@ -1117,15 +1083,10 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel,
|
||||
"%s %s%s"
|
||||
"Raw-Audio: %s/%d%s",
|
||||
MEDIA_ANSWER,
|
||||
wmsg.callid,
|
||||
WOOMERA_LINE_SEPERATOR,
|
||||
tech_pvt->profile->audio_ip, tech_pvt->port, WOOMERA_RECORD_SEPERATOR);
|
||||
MEDIA_ANSWER, wmsg.callid, WOOMERA_LINE_SEPERATOR, tech_pvt->profile->audio_ip, tech_pvt->port, WOOMERA_RECORD_SEPERATOR);
|
||||
|
||||
if (woomera_message_parse(tech_pvt->command_channel,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
if (woomera_message_parse(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! Woomera is broken!\n", tech_pvt->profile->name);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
continue;
|
||||
@@ -1152,16 +1113,10 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
switch_channel_set_state(channel, CS_RING);
|
||||
|
||||
if (switch_sockaddr_info_get(&tech_pvt->udpwrite,
|
||||
ip,
|
||||
SWITCH_UNSPEC,
|
||||
port,
|
||||
0,
|
||||
switch_core_session_get_pool(tech_pvt->session)) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
ip, SWITCH_UNSPEC, port, 0, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (globals.debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
WOOMERA_DEBUG_PREFIX "{%s} Cannot resolve %s\n",
|
||||
tech_pvt->profile->name, ip);
|
||||
WOOMERA_DEBUG_PREFIX "{%s} Cannot resolve %s\n", tech_pvt->profile->name, ip);
|
||||
}
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_NETWORK_OUT_OF_ORDER);
|
||||
}
|
||||
@@ -1169,13 +1124,11 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
|
||||
}
|
||||
}
|
||||
if (globals.debug > 2) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "CHECK {%s}(%d)\n",
|
||||
tech_pvt->profile->name, res);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "CHECK {%s}(%d)\n", tech_pvt->profile->name, res);
|
||||
}
|
||||
}
|
||||
if (globals.debug > 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "Monitor thread for %s done.\n",
|
||||
tech_pvt->profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "Monitor thread for %s done.\n", tech_pvt->profile->name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1229,13 +1182,11 @@ static void *woomera_thread_run(void *obj)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((((res = woomera_dequeue_event(&profile->event_queue, &wmsg)) != 0) ||
|
||||
((res = woomera_message_parse(profile->woomera_socket, &wmsg,
|
||||
/* if we are not stingy with threads we can block forever */
|
||||
0, profile, NULL))) != 0)) {
|
||||
if ((((res = woomera_dequeue_event(&profile->event_queue, &wmsg)) != 0) || ((res = woomera_message_parse(profile->woomera_socket, &wmsg,
|
||||
/* if we are not stingy with threads we can block forever */
|
||||
0, profile, NULL))) != 0)) {
|
||||
if (res < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! I lost my connection to woomera!\n",
|
||||
profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "{%s} HELP! I lost my connection to woomera!\n", profile->name);
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
|
||||
//global_set_flag(TFLAG_ABORT);
|
||||
@@ -1277,12 +1228,9 @@ static void *woomera_thread_run(void *obj)
|
||||
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
|
||||
if ((tech_pvt =
|
||||
(struct private_object *) switch_core_session_alloc(session,
|
||||
sizeof(struct private_object))) != 0) {
|
||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
||||
memset(tech_pvt, 0, sizeof(*tech_pvt));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED,
|
||||
switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
tech_pvt->profile = &default_profile;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
@@ -1299,8 +1247,7 @@ static void *woomera_thread_run(void *obj)
|
||||
}
|
||||
|
||||
if (globals.debug > 2) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Main Thread {%s} Select Return %d\n",
|
||||
profile->name, res);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Main Thread {%s} Select Return %d\n", profile->name, res);
|
||||
}
|
||||
|
||||
switch_yield(100);
|
||||
@@ -1339,8 +1286,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
struct woomera_profile *profile = &default_profile;
|
||||
|
||||
@@ -54,8 +54,8 @@ extern "C" {
|
||||
class CDRContainer {
|
||||
public:
|
||||
CDRContainer();
|
||||
CDRContainer(switch_memory_pool_t *module_pool);
|
||||
~CDRContainer();
|
||||
CDRContainer(switch_memory_pool_t * module_pool);
|
||||
~CDRContainer();
|
||||
void add_cdr(switch_core_session_t *session);
|
||||
void process_records();
|
||||
#ifdef SWITCH_QUEUE_ENHANCED
|
||||
|
||||
@@ -99,7 +99,7 @@ class MysqlCDR:public BaseCDR {
|
||||
// Now a couple internal methods
|
||||
template < typename T > void add_parameter(T & param, enum_field_types type, bool * is_null = 0);
|
||||
void add_string_parameter(char *param, long unsigned int ¶m_length, enum_field_types type, bool * is_null = 0);
|
||||
void set_mysql_time(switch_time_exp_t ¶m, MYSQL_TIME & destination);
|
||||
void set_mysql_time(switch_time_exp_t & param, MYSQL_TIME & destination);
|
||||
void connect_to_database();
|
||||
};
|
||||
|
||||
|
||||
@@ -146,8 +146,7 @@ static void event_handler(switch_event_t *event)
|
||||
if (globals.event_list[(uint8_t) SWITCH_EVENT_ALL]) {
|
||||
send = 1;
|
||||
} else if ((globals.event_list[(uint8_t) event->event_id])) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM ||
|
||||
(event->subclass && switch_core_hash_find(globals.event_hash, event->subclass->name))) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass && switch_core_hash_find(globals.event_hash, event->subclass->name))) {
|
||||
send = 1;
|
||||
}
|
||||
}
|
||||
@@ -184,8 +183,7 @@ static switch_loadable_module_interface_t event_test_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
@@ -202,8 +200,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_sockaddr_info_get(&globals.addr, globals.address, SWITCH_UNSPEC, globals.port, 0, module_pool) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_sockaddr_info_get(&globals.addr, globals.address, SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
@@ -237,8 +234,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
*module_interface = &event_test_module_interface;
|
||||
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
switch_socket_close(globals.udp_socket);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -290,8 +286,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
continue;
|
||||
}
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet);
|
||||
if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) {
|
||||
char *var, *val, *term = NULL, tmpname[128];
|
||||
switch_event_add_header(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes");
|
||||
var = packet;
|
||||
|
||||
@@ -88,7 +88,7 @@ static struct {
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_pass, prefs.password)
|
||||
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj);
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj);
|
||||
static void launch_listener_thread(listener_t * listener);
|
||||
|
||||
static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
@@ -133,8 +133,7 @@ static void event_handler(switch_event_t *event)
|
||||
if (l->event_list[(uint8_t) SWITCH_EVENT_ALL]) {
|
||||
send = 1;
|
||||
} else if ((l->event_list[(uint8_t) event->event_id])) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM
|
||||
|| (event->subclass && switch_core_hash_find(l->event_hash, event->subclass->name))) {
|
||||
if (event->event_id != SWITCH_EVENT_CUSTOM || (event->subclass && switch_core_hash_find(l->event_hash, event->subclass->name))) {
|
||||
send = 1;
|
||||
}
|
||||
}
|
||||
@@ -190,8 +189,7 @@ static void socket_function(switch_core_session_t *session, char *data)
|
||||
port = (switch_port_t) atoi(port_name);
|
||||
}
|
||||
|
||||
if (switch_sockaddr_info_get(&sa, host, AF_INET, port, 0, switch_core_session_get_pool(session)) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_sockaddr_info_get(&sa, host, AF_INET, port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +269,7 @@ static switch_loadable_module_interface_t event_socket_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
static void close_socket(switch_socket_t **sock)
|
||||
static void close_socket(switch_socket_t ** sock)
|
||||
{
|
||||
switch_mutex_lock(listen_list.sock_mutex);
|
||||
if (*sock) {
|
||||
@@ -303,8 +301,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &event_socket_module_interface;
|
||||
@@ -454,8 +451,7 @@ static switch_status_t read_packet(listener_t * listener, switch_event_t **event
|
||||
|
||||
|
||||
if (data) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
|
||||
snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
|
||||
len = strlen(buf);
|
||||
switch_socket_send(listener->sock, buf, &len);
|
||||
len = strlen(data);
|
||||
@@ -492,8 +488,7 @@ static switch_status_t read_packet(listener_t * listener, switch_event_t **event
|
||||
|
||||
len = strlen(listener->ebuf);
|
||||
|
||||
snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n"
|
||||
"Content-Type: text/event-%s\n" "\n", len, etype);
|
||||
snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
|
||||
|
||||
len = strlen(hbuf);
|
||||
switch_socket_send(listener->sock, hbuf, &len);
|
||||
@@ -524,7 +519,7 @@ struct api_command_struct {
|
||||
uint8_t bg;
|
||||
};
|
||||
|
||||
static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
|
||||
struct api_command_struct *acs = (struct api_command_struct *) obj;
|
||||
@@ -632,8 +627,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
|
||||
goto done;
|
||||
} else if (!strncasecmp(cmd, "sendmsg", 4)) {
|
||||
if (switch_test_flag(listener, LFLAG_ASYNC)) {
|
||||
if ((status =
|
||||
switch_core_session_queue_private_event(listener->session, &event)) == SWITCH_STATUS_SUCCESS) {
|
||||
if ((status = switch_core_session_queue_private_event(listener->session, &event)) == SWITCH_STATUS_SUCCESS) {
|
||||
snprintf(reply, reply_len, "+OK");
|
||||
} else {
|
||||
snprintf(reply, reply_len, "-ERR memory error");
|
||||
@@ -901,8 +895,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
|
||||
switch_set_flag_locked(listener, LFLAG_EVENTS);
|
||||
}
|
||||
|
||||
snprintf(reply, reply_len, "+OK event listener enabled %s",
|
||||
listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
|
||||
snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
|
||||
|
||||
} else if (!strncasecmp(cmd, "nixevent", 8)) {
|
||||
char *next, *cur;
|
||||
@@ -991,7 +984,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
|
||||
return status;
|
||||
}
|
||||
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
listener_t *listener = (listener_t *) obj;
|
||||
char buf[1024];
|
||||
@@ -1045,10 +1038,8 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||
switch_channel_event_set_data(channel, call_event);
|
||||
switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
|
||||
|
||||
switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode",
|
||||
switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
|
||||
switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Control",
|
||||
switch_test_flag(listener, LFLAG_FULL) ? "full" : "single-channel");
|
||||
switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");
|
||||
switch_event_add_header(call_event, SWITCH_STACK_BOTTOM, "Control", switch_test_flag(listener, LFLAG_FULL) ? "full" : "single-channel");
|
||||
|
||||
switch_event_serialize(call_event, &event_str);
|
||||
if (!event_str) {
|
||||
@@ -1221,8 +1212,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
|
||||
if (rv)
|
||||
goto fail;
|
||||
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP,
|
||||
pool);
|
||||
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
|
||||
if (rv)
|
||||
goto sock_fail;
|
||||
rv = switch_socket_opt_set(listen_list.sock, SWITCH_SO_REUSEADDR, 1);
|
||||
@@ -1243,8 +1233,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
|
||||
listen_list.ready = 1;
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -53,10 +53,8 @@ static void event_handler(switch_event_t *event)
|
||||
dofree++;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
|
||||
"\nEVENT (text version)\n--------------------------------\n%s", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
|
||||
"\nEVENT (xml version)\n--------------------------------\n%s\n", xmlstr);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\nEVENT (text version)\n--------------------------------\n%s", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\nEVENT (xml version)\n--------------------------------\n%s\n", xmlstr);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -90,7 +88,7 @@ static switch_loadable_module_interface_t event_test_module_interface = {
|
||||
#define TTHREADS 500
|
||||
static int THREADS = 0;
|
||||
|
||||
static void *torture_thread(switch_thread_t *thread, void *obj)
|
||||
static void *torture_thread(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
@@ -127,8 +125,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
#endif
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &event_test_module_interface;
|
||||
@@ -138,8 +135,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -134,8 +134,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid)
|
||||
|
||||
if (count == 3) {
|
||||
/* TBD use config to pick what events to bind to */
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -305,17 +304,12 @@ static void j_setup_filter(struct session *sess)
|
||||
iks_filter_delete(my_filter);
|
||||
my_filter = iks_filter_new();
|
||||
iks_filter_add_rule(my_filter, on_msg, 0,
|
||||
IKS_RULE_TYPE, IKS_PAK_MESSAGE,
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_CHAT, IKS_RULE_FROM, globals.target_jid, IKS_RULE_DONE);
|
||||
IKS_RULE_TYPE, IKS_PAK_MESSAGE, IKS_RULE_SUBTYPE, IKS_TYPE_CHAT, IKS_RULE_FROM, globals.target_jid, IKS_RULE_DONE);
|
||||
iks_filter_add_rule(my_filter, (iksFilterHook *) on_result, sess,
|
||||
IKS_RULE_TYPE, IKS_PAK_IQ,
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "auth", IKS_RULE_DONE);
|
||||
iks_filter_add_rule(my_filter, on_error, sess,
|
||||
IKS_RULE_TYPE, IKS_PAK_IQ,
|
||||
IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, IKS_RULE_ID, "auth", IKS_RULE_DONE);
|
||||
IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "auth", IKS_RULE_DONE);
|
||||
iks_filter_add_rule(my_filter, on_error, sess, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, IKS_RULE_ID, "auth", IKS_RULE_DONE);
|
||||
|
||||
iks_filter_add_rule(my_filter, on_subscribe, sess,
|
||||
IKS_RULE_TYPE, IKS_PAK_S10N, IKS_RULE_SUBTYPE, IKS_TYPE_SUBSCRIBE, IKS_RULE_DONE);
|
||||
iks_filter_add_rule(my_filter, on_subscribe, sess, IKS_RULE_TYPE, IKS_PAK_S10N, IKS_RULE_SUBTYPE, IKS_TYPE_SUBSCRIBE, IKS_RULE_DONE);
|
||||
|
||||
}
|
||||
|
||||
@@ -403,8 +397,7 @@ static switch_loadable_module_interface_t xmpp_event_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &xmpp_event_module_interface;
|
||||
|
||||
@@ -50,9 +50,7 @@ static struct {
|
||||
static sw_result HOWL_API my_browser(sw_discovery discovery,
|
||||
sw_discovery_oid oid,
|
||||
sw_discovery_browse_status status,
|
||||
sw_uint32 interface_index,
|
||||
sw_const_string name,
|
||||
sw_const_string type, sw_const_string domain, sw_opaque_t extra)
|
||||
sw_uint32 interface_index, sw_const_string name, sw_const_string type, sw_const_string domain, sw_opaque_t extra)
|
||||
{
|
||||
//sw_discovery_resolve_id rid;
|
||||
|
||||
@@ -90,8 +88,7 @@ static sw_result HOWL_API my_browser(sw_discovery discovery,
|
||||
case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Remove Service\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "remove service: 0x%x %s %s %s\n", interface_index,
|
||||
name, type, domain);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -108,8 +105,7 @@ static sw_result HOWL_API my_browser(sw_discovery discovery,
|
||||
}
|
||||
|
||||
|
||||
static sw_result HOWL_API my_service_reply(sw_discovery discovery,
|
||||
sw_discovery_oid oid, sw_discovery_publish_status status, sw_opaque extra)
|
||||
static sw_result HOWL_API my_service_reply(sw_discovery discovery, sw_discovery_oid oid, sw_discovery_publish_status status, sw_opaque extra)
|
||||
{
|
||||
static sw_string status_text[] = {
|
||||
"Started",
|
||||
@@ -170,8 +166,7 @@ static void event_handler(switch_event_t *event)
|
||||
NULL,
|
||||
porti,
|
||||
sw_text_record_bytes(text_record),
|
||||
sw_text_record_len(text_record),
|
||||
my_service_reply, NULL, &globals.disc_id)) != SW_OKAY) {
|
||||
sw_text_record_len(text_record), my_service_reply, NULL, &globals.disc_id)) != SW_OKAY) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "publish failed: %u\n", result);
|
||||
sw_text_record_fina(text_record);
|
||||
switch_mutex_unlock(globals.zc_lock);
|
||||
@@ -220,16 +215,12 @@ static switch_status_t load_config(void)
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
} else if (!strcasecmp(var, "publish") && !strcasecmp(val, "yes")) {
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_PUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind
|
||||
((char *) modname, SWITCH_EVENT_UNPUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_UNPUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -268,8 +259,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
@@ -63,8 +63,7 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, char
|
||||
flags |= SWITCH_FOPEN_READ;
|
||||
}
|
||||
|
||||
if (switch_file_open(&context->fd, path, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_file_open(&context->fd, path, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -98,8 +97,7 @@ static switch_status_t native_file_file_close(switch_file_handle_t *handle)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t native_file_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples,
|
||||
int whence)
|
||||
static switch_status_t native_file_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
|
||||
{
|
||||
native_file_context *context = handle->private_info;
|
||||
|
||||
@@ -123,16 +121,14 @@ static switch_status_t native_file_file_write(switch_file_handle_t *handle, void
|
||||
return switch_file_write(context->fd, data, len);
|
||||
}
|
||||
|
||||
static switch_status_t native_file_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col,
|
||||
const char *string)
|
||||
static switch_status_t native_file_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
|
||||
{
|
||||
//native_file_context *context = handle->private_info;
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t native_file_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col,
|
||||
const char **string)
|
||||
static switch_status_t native_file_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string)
|
||||
{
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -167,8 +163,7 @@ static switch_loadable_module_interface_t native_file_module_interface = {
|
||||
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
|
||||
|
||||
@@ -173,10 +173,8 @@ void print_header(struct frame *fr)
|
||||
fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
|
||||
layers[fr->lay], freqs[fr->sampling_frequency], modes[fr->mode], fr->mode_ext, fr->framesize + 4);
|
||||
debug_printf("Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n",
|
||||
fr->stereo, fr->copyright ? "Yes" : "No",
|
||||
fr->original ? "Yes" : "No", fr->error_protection ? "Yes" : "No", fr->emphasis);
|
||||
debug_printf("Bitrate: %d Kbits/s, Extension value: %d\n",
|
||||
tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], fr->extension);
|
||||
fr->stereo, fr->copyright ? "Yes" : "No", fr->original ? "Yes" : "No", fr->error_protection ? "Yes" : "No", fr->emphasis);
|
||||
debug_printf("Bitrate: %d Kbits/s, Extension value: %d\n", tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], fr->extension);
|
||||
}
|
||||
|
||||
void print_header_compact(struct frame *fr)
|
||||
@@ -186,8 +184,7 @@ void print_header_compact(struct frame *fr)
|
||||
|
||||
debug_printf("MPEG %s layer %s, %d kbit/s, %ld Hz %s\n",
|
||||
fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
|
||||
layers[fr->lay],
|
||||
tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], freqs[fr->sampling_frequency], modes[fr->mode]);
|
||||
layers[fr->lay], tabsel_123[fr->lsf][fr->lay - 1][fr->bitrate_index], freqs[fr->sampling_frequency], modes[fr->mode]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -114,16 +114,13 @@ void init_layer3_const(void)
|
||||
}
|
||||
|
||||
for (i = 0; i < 18; i++) {
|
||||
win[0][i] = win[1][i] =
|
||||
0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 0) + 1)) / cos(M_PI * (double) (2 * (i + 0) + 19) / 72.0);
|
||||
win[0][i + 18] = win[3][i + 18] =
|
||||
0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 18) + 1)) / cos(M_PI * (double) (2 * (i + 18) + 19) / 72.0);
|
||||
win[0][i] = win[1][i] = 0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 0) + 1)) / cos(M_PI * (double) (2 * (i + 0) + 19) / 72.0);
|
||||
win[0][i + 18] = win[3][i + 18] = 0.5 * sin(M_PI / 72.0 * (double) (2 * (i + 18) + 1)) / cos(M_PI * (double) (2 * (i + 18) + 19) / 72.0);
|
||||
}
|
||||
for (i = 0; i < 6; i++) {
|
||||
win[1][i + 18] = 0.5 / cos(M_PI * (double) (2 * (i + 18) + 19) / 72.0);
|
||||
win[3][i + 12] = 0.5 / cos(M_PI * (double) (2 * (i + 12) + 19) / 72.0);
|
||||
win[1][i + 24] =
|
||||
0.5 * sin(M_PI / 24.0 * (double) (2 * i + 13)) / cos(M_PI * (double) (2 * (i + 24) + 19) / 72.0);
|
||||
win[1][i + 24] = 0.5 * sin(M_PI / 24.0 * (double) (2 * i + 13)) / cos(M_PI * (double) (2 * (i + 24) + 19) / 72.0);
|
||||
win[1][i + 30] = win[3][i] = 0.0;
|
||||
win[3][i + 6] = 0.5 * sin(M_PI / 24.0 * (double) (2 * i + 1)) / cos(M_PI * (double) (2 * (i + 6) + 19) / 72.0);
|
||||
}
|
||||
@@ -295,8 +292,7 @@ void init_layer3_sample_limits(struct mpstr *mp, int down_sample_sblimit)
|
||||
* read additional side information
|
||||
*/
|
||||
#ifdef MPEG1
|
||||
static int III_get_side_info_1(struct mpstr *mp, struct III_sideinfo *si, int stereo,
|
||||
int ms_stereo, long sfreq, int single)
|
||||
static int III_get_side_info_1(struct mpstr *mp, struct III_sideinfo *si, int stereo, int ms_stereo, long sfreq, int single)
|
||||
{
|
||||
int ch, gr;
|
||||
int powdiff = (single == 3) ? 4 : 0;
|
||||
@@ -372,8 +368,7 @@ static int III_get_side_info_1(struct mpstr *mp, struct III_sideinfo *si, int st
|
||||
/*
|
||||
* Side Info for MPEG 2.0 / LSF
|
||||
*/
|
||||
static int III_get_side_info_2(struct mpstr *mp, struct III_sideinfo *si, int stereo,
|
||||
int ms_stereo, long sfreq, int single)
|
||||
static int III_get_side_info_2(struct mpstr *mp, struct III_sideinfo *si, int stereo, int ms_stereo, long sfreq, int single)
|
||||
{
|
||||
int ch;
|
||||
int powdiff = (single == 3) ? 4 : 0;
|
||||
@@ -602,8 +597,7 @@ static int pretab2[22] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*
|
||||
* don't forget to apply the same changes to III_dequantize_sample_ms() !!!
|
||||
*/
|
||||
static int III_dequantize_sample(struct mpstr *mp, real xr[SBLIMIT][SSLIMIT], int *scf,
|
||||
struct gr_info_s *gr_info, int sfreq, int part2bits)
|
||||
static int III_dequantize_sample(struct mpstr *mp, real xr[SBLIMIT][SSLIMIT], int *scf, struct gr_info_s *gr_info, int sfreq, int part2bits)
|
||||
{
|
||||
int shift = 1 + gr_info->scalefac_scale;
|
||||
real *xrpnt = (real *) xr;
|
||||
@@ -953,8 +947,7 @@ static int III_dequantize_sample(struct mpstr *mp, real xr[SBLIMIT][SSLIMIT], in
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int III_dequantize_sample_ms(real xr[2][SBLIMIT][SSLIMIT], int *scf,
|
||||
struct gr_info_s *gr_info, int sfreq, int part2bits)
|
||||
static int III_dequantize_sample_ms(real xr[2][SBLIMIT][SSLIMIT], int *scf, struct gr_info_s *gr_info, int sfreq, int part2bits)
|
||||
{
|
||||
int shift = 1 + gr_info->scalefac_scale;
|
||||
real *xrpnt = (real *) xr[1];
|
||||
@@ -1345,8 +1338,7 @@ static int III_dequantize_sample_ms(real xr[2][SBLIMIT][SSLIMIT], int *scf,
|
||||
/*
|
||||
* III_stereo: calculate real channel values for Joint-I-Stereo-mode
|
||||
*/
|
||||
static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac,
|
||||
struct gr_info_s *gr_info, int sfreq, int ms_stereo, int lsf)
|
||||
static void III_i_stereo(real xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, struct gr_info_s *gr_info, int sfreq, int ms_stereo, int lsf)
|
||||
{
|
||||
real(*xr)[SBLIMIT * SSLIMIT] = (real(*)[SBLIMIT * SSLIMIT]) xr_buf;
|
||||
struct bandInfoStruct *bi = &bandInfo[sfreq];
|
||||
@@ -1777,8 +1769,7 @@ static void dct12(real * in, real * rawout1, real * rawout2, register real * wi,
|
||||
/*
|
||||
* III_hybrid
|
||||
*/
|
||||
static void III_hybrid(struct mpstr *mp, real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT],
|
||||
int ch, struct gr_info_s *gr_info)
|
||||
static void III_hybrid(struct mpstr *mp, real fsIn[SBLIMIT][SSLIMIT], real tsOut[SSLIMIT][SBLIMIT], int ch, struct gr_info_s *gr_info)
|
||||
{
|
||||
real *tspnt = (real *) tsOut;
|
||||
real(*block)[2][SBLIMIT * SSLIMIT] = mp->hybrid_block;
|
||||
|
||||
@@ -422,7 +422,7 @@ static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
|
||||
#define MY_BUF_LEN 1024 * 32
|
||||
#define MY_BLOCK_SIZE MY_BUF_LEN
|
||||
static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
CURL *curl_handle = NULL;
|
||||
shout_context_t *context = (shout_context_t *) obj;
|
||||
@@ -458,7 +458,7 @@ static void launch_read_stream_thread(shout_context_t * context)
|
||||
switch_thread_create(&thread, thd_attr, read_stream_thread, context, context->memory_pool);
|
||||
}
|
||||
|
||||
static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
shout_context_t *context = (shout_context_t *) obj;
|
||||
|
||||
@@ -484,9 +484,7 @@ static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, voi
|
||||
memset(audio, 255, sizeof(audio));
|
||||
}
|
||||
|
||||
if ((rlen =
|
||||
lame_encode_buffer(context->gfp, (void *) audio, NULL, audio_read / sizeof(int16_t), mp3buf,
|
||||
sizeof(mp3buf))) < 0) {
|
||||
if ((rlen = lame_encode_buffer(context->gfp, (void *) audio, NULL, audio_read / sizeof(int16_t), mp3buf, sizeof(mp3buf))) < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
|
||||
goto error;
|
||||
}
|
||||
@@ -494,8 +492,7 @@ static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, voi
|
||||
if (rlen) {
|
||||
ret = shout_send(context->shout, mp3buf, rlen);
|
||||
if (ret != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Send error: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Send error: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
@@ -560,9 +557,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, char *path)
|
||||
context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
|
||||
launch_read_stream_thread(context);
|
||||
} else {
|
||||
if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ,
|
||||
SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE,
|
||||
handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
|
||||
goto error;
|
||||
}
|
||||
@@ -587,8 +582,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, char *path)
|
||||
lame_print_config(context->gfp);
|
||||
|
||||
if (handle->handler) {
|
||||
if (switch_buffer_create_dynamic(&context->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_buffer_create_dynamic(&context->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
|
||||
goto error;
|
||||
}
|
||||
@@ -633,62 +627,52 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, char *path)
|
||||
}
|
||||
|
||||
if (shout_set_host(context->shout, host) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting hostname: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting hostname: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_protocol(context->shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting protocol: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting protocol: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_port(context->shout, portno) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting port: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting port: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_password(context->shout, password) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting password: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting password: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_mount(context->shout, file) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting mount: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting mount: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_user(context->shout, username) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_url(context->shout, "http://www.freeswitch.org") != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_description(context->shout, "FreeSWITCH mod_shout Broadcasting Module") != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_audio_info(context->shout, "bitrate", "64000") != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (shout_set_format(context->shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting user: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -728,8 +712,7 @@ static switch_status_t shout_file_close(switch_file_handle_t *handle)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples,
|
||||
int whence)
|
||||
static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
|
||||
{
|
||||
shout_context_t *context = handle->private_info;
|
||||
|
||||
@@ -800,8 +783,7 @@ static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data
|
||||
if (context->shout && !context->shout_init) {
|
||||
context->shout_init++;
|
||||
if (shout_open(context->shout) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening stream: %s\n", shout_get_error(context->shout));
|
||||
context->err++;
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -844,20 +826,17 @@ static switch_status_t shout_file_set_string(switch_file_handle_t *handle, switc
|
||||
switch (col) {
|
||||
case SWITCH_AUDIO_COL_STR_TITLE:
|
||||
if (shout_set_name(context->shout, string) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
}
|
||||
break;
|
||||
case SWITCH_AUDIO_COL_STR_COMMENT:
|
||||
if (shout_set_url(context->shout, string) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
}
|
||||
break;
|
||||
case SWITCH_AUDIO_COL_STR_ARTIST:
|
||||
if (shout_set_description(context->shout, string) != SHOUTERR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n",
|
||||
shout_get_error(context->shout));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -898,8 +877,7 @@ static switch_loadable_module_interface_t shout_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
supported_formats[0] = "shout";
|
||||
supported_formats[1] = "mp3";
|
||||
|
||||
@@ -137,19 +137,16 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, char *pat
|
||||
}
|
||||
|
||||
if ((mode & SFM_WRITE) && sf_format_check(&context->sfinfo) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error : file format is invalid (0x%08X).\n",
|
||||
context->sfinfo.format);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error : file format is invalid (0x%08X).\n", context->sfinfo.format);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
};
|
||||
|
||||
if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path,
|
||||
sf_strerror(context->handle));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path, sf_strerror(context->handle));
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] %dhz\n", path,
|
||||
context->sfinfo.samplerate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] %dhz\n", path, context->sfinfo.samplerate);
|
||||
handle->samples = (unsigned int) context->sfinfo.frames;
|
||||
handle->samplerate = context->sfinfo.samplerate;
|
||||
handle->channels = (uint8_t) context->sfinfo.channels;
|
||||
@@ -171,8 +168,7 @@ static switch_status_t sndfile_file_close(switch_file_handle_t *handle)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples,
|
||||
int whence)
|
||||
static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
|
||||
{
|
||||
sndfile_context *context = handle->private_info;
|
||||
|
||||
@@ -239,8 +235,7 @@ static switch_status_t sndfile_file_set_string(switch_file_handle_t *handle, swi
|
||||
return sf_set_string(context->handle, (int) col, string) ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t sndfile_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col,
|
||||
const char **string)
|
||||
static switch_status_t sndfile_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string)
|
||||
{
|
||||
sndfile_context *context = handle->private_info;
|
||||
const char *s;
|
||||
@@ -294,15 +289,13 @@ static switch_status_t setup_formats(void)
|
||||
|
||||
sf_command(NULL, SFC_GET_LIB_VERSION, buffer, sizeof(buffer));
|
||||
if (strlen(buffer) < 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Line %d: could not retrieve lib version.\n",
|
||||
__LINE__);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Line %d: could not retrieve lib version.\n", __LINE__);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "\nLibSndFile Version : %s Supported Formats\n", buffer);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,
|
||||
"================================================================================\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "================================================================================\n");
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof(int));
|
||||
sf_command(NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof(int));
|
||||
|
||||
@@ -315,8 +308,7 @@ static switch_status_t setup_formats(void)
|
||||
skip = 0;
|
||||
info.format = m;
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof(info));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s (extension \"%s\")\n", info.name,
|
||||
info.extension);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s (extension \"%s\")\n", info.name, info.extension);
|
||||
for (x = 0; x < len; x++) {
|
||||
if (supported_formats[x] == info.extension) {
|
||||
skip++;
|
||||
@@ -364,14 +356,12 @@ static switch_status_t setup_formats(void)
|
||||
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_NOTICE,
|
||||
"================================================================================\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_NOTICE, "================================================================================\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
@@ -48,8 +48,7 @@ switch_status_t mod_mono_load_modules(const char *module_dir);
|
||||
MonoClass *mod_mono_find_assembly_class(MonoImage * image);
|
||||
|
||||
/* Managed functions */
|
||||
void mod_mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt,
|
||||
char *msg);
|
||||
void mod_mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, char *msg);
|
||||
|
||||
static const char modname[] = "mod_mono";
|
||||
static switch_memory_pool_t *mono_pool = NULL;
|
||||
@@ -75,8 +74,7 @@ static switch_loadable_module_interface_t mono_module_interface = {
|
||||
* This function will initialise the memory pool and plugin hash for this module,
|
||||
* it will then initialise a new mono domain.
|
||||
*/
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
||||
{
|
||||
*interface = &mono_module_interface;
|
||||
|
||||
@@ -101,8 +99,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
apr_finfo_t *assembly_finfo = (apr_finfo_t *) switch_core_alloc(mono_pool, sizeof(*assembly_finfo));
|
||||
|
||||
snprintf(assembly_dir, assembly_dir_len, "%s/%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR);
|
||||
snprintf(assembly_file, assembly_file_len, "%s/%s%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR,
|
||||
SWITCH_MONO_ASSEMBLY);
|
||||
snprintf(assembly_file, assembly_file_len, "%s/%s%s", SWITCH_GLOBAL_dirs.base_dir, SWITCH_MONO_LIBDIR, SWITCH_MONO_ASSEMBLY);
|
||||
|
||||
if (apr_stat(assembly_finfo, assembly_file, 0, mono_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not find FreeSwitch.NET assembly\n");
|
||||
@@ -247,8 +244,7 @@ switch_status_t mod_mono_load_modules(const char *module_dir)
|
||||
|
||||
plugin->object = mono_object_new(globals.domain, plugin->class);
|
||||
|
||||
switch_core_hash_insert(globals.plugins, (char *) mono_image_get_name(mono_assembly_get_image(assembly)),
|
||||
plugin);
|
||||
switch_core_hash_insert(globals.plugins, (char *) mono_image_get_name(mono_assembly_get_image(assembly)), plugin);
|
||||
|
||||
plugin = NULL;
|
||||
}
|
||||
@@ -280,8 +276,7 @@ MonoClass *mod_mono_find_assembly_class(MonoImage * image)
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt,
|
||||
char *msg)
|
||||
void mono_switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, char *msg)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, msg);
|
||||
}
|
||||
|
||||
@@ -68,8 +68,7 @@ static void perl_function(switch_core_session_t *session, char *data)
|
||||
char *uuid = switch_core_session_get_uuid(session);
|
||||
char code[1024];
|
||||
PerlInterpreter *my_perl = clone_perl();
|
||||
sprintf(code, "package fs_perl;\n"
|
||||
"$SWITCH_ENV{UUID} = \"%s\";\n" "chdir(\"%s/perl\");\n", uuid, SWITCH_GLOBAL_dirs.base_dir);
|
||||
sprintf(code, "package fs_perl;\n" "$SWITCH_ENV{UUID} = \"%s\";\n" "chdir(\"%s/perl\");\n", uuid, SWITCH_GLOBAL_dirs.base_dir);
|
||||
|
||||
Perl_eval_pv(my_perl, code, TRUE);
|
||||
|
||||
@@ -112,8 +111,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
PerlInterpreter *my_perl;
|
||||
|
||||
@@ -468,8 +468,7 @@ extern "C" {
|
||||
if (s->next) {
|
||||
s->next->prev = s->prev;
|
||||
}
|
||||
/* Insert s as second element in the list */
|
||||
s-> next = ty->next;
|
||||
/* Insert s as second element in the list */ s->next = ty->next;
|
||||
if (ty->next)
|
||||
ty->next->prev = s;
|
||||
ty->next = s;
|
||||
@@ -689,14 +688,12 @@ typedef struct {
|
||||
static void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
|
||||
{
|
||||
#else
|
||||
static void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *),
|
||||
int (*get) (struct interpreter *, SV *, MAGIC *))
|
||||
static void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *), int (*get) (struct interpreter *, SV *, MAGIC *))
|
||||
{
|
||||
#endif
|
||||
#else
|
||||
# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
|
||||
static void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *),
|
||||
int (CPerlObj::*get) (SV *, MAGIC *))
|
||||
static void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *), int (CPerlObj::*get) (SV *, MAGIC *))
|
||||
{
|
||||
#endif
|
||||
MAGIC *mg;
|
||||
@@ -821,10 +818,8 @@ SWIGEXPORT(void) SWIG_init(CV * cv, CPerlObj *);
|
||||
switch_input_callback_function_t, void *, unsigned int, unsigned int);
|
||||
extern int fs_switch_ivr_sleep(switch_core_session_t *, uint32_t);
|
||||
extern int fs_ivr_play_file2(switch_core_session_t *, char *);
|
||||
extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *, switch_input_callback_function_t, void *,
|
||||
unsigned int, unsigned int);
|
||||
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *, char *, unsigned int, unsigned int,
|
||||
char const *, char *, unsigned int);
|
||||
extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *, switch_input_callback_function_t, void *, unsigned int, unsigned int);
|
||||
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *, char *, unsigned int, unsigned int, char const *, char *, unsigned int);
|
||||
extern int fs_switch_ivr_originate(switch_core_session_t *, switch_core_session_t **, char *, uint32_t);
|
||||
extern int fs_switch_ivr_session_transfer(switch_core_session_t *, char *, char *, char *);
|
||||
extern int fs_switch_ivr_speak_text(switch_core_session_t *, char *, char *, uint32_t, char *);
|
||||
@@ -1157,8 +1152,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1192,8 +1186,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1291,14 +1284,12 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
|
||||
SWIG_croak("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(2)))
|
||||
@@ -1308,8 +1299,7 @@ extern "C" {
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_callback_function_t");
|
||||
SWIG_croak("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_callback_function_t");
|
||||
}
|
||||
arg4 = *argp;
|
||||
}
|
||||
@@ -1415,15 +1405,13 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
if (SWIG_ConvertPtr(ST(1), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_callback_function_t");
|
||||
SWIG_croak("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_callback_function_t");
|
||||
}
|
||||
arg2 = *argp;
|
||||
}
|
||||
@@ -1460,13 +1448,11 @@ extern "C" {
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 7) || (items > 7)) {
|
||||
SWIG_croak
|
||||
("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
|
||||
SWIG_croak("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1511,14 +1497,12 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(2)))
|
||||
@@ -1559,8 +1543,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1603,8 +1586,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1651,8 +1633,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1689,8 +1670,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
|
||||
SWIG_croak
|
||||
("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
|
||||
SWIG_croak("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
|
||||
}
|
||||
}
|
||||
if (!SvOK((SV *) ST(1)))
|
||||
@@ -1716,17 +1696,14 @@ extern "C" {
|
||||
|
||||
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
||||
|
||||
static swig_type_info _swigt__p_switch_channel_t[] =
|
||||
{ {"_p_switch_channel_t", 0, "switch_channel_t *", 0}, {"_p_switch_channel_t"}, {0} };
|
||||
static swig_type_info _swigt__p_switch_file_handle_t[] =
|
||||
{ {"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0}, {"_p_switch_file_handle_t"}, {0} };
|
||||
static swig_type_info _swigt__p_switch_channel_t[] = { {"_p_switch_channel_t", 0, "switch_channel_t *", 0}, {"_p_switch_channel_t"}, {0} };
|
||||
static swig_type_info _swigt__p_switch_file_handle_t[] = { {"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0}, {"_p_switch_file_handle_t"}, {0} };
|
||||
static swig_type_info _swigt__p_switch_core_session_t[] =
|
||||
{ {"_p_switch_core_session_t", 0, "switch_core_session_t *", 0}, {"_p_switch_core_session_t"}, {0} };
|
||||
static swig_type_info _swigt__p_p_switch_core_session_t[] =
|
||||
{ {"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0}, {"_p_p_switch_core_session_t"}, {0} };
|
||||
static swig_type_info _swigt__p_uint32_t[] = { {"_p_uint32_t", 0, "uint32_t *", 0}, {"_p_uint32_t"}, {0} };
|
||||
static swig_type_info _swigt__p_switch_input_callback_function_t[] =
|
||||
{ {"_p_switch_input_callback_function_t", 0, "switch_input_callback_function_t *", 0},
|
||||
static swig_type_info _swigt__p_switch_input_callback_function_t[] = { {"_p_switch_input_callback_function_t", 0, "switch_input_callback_function_t *", 0},
|
||||
{"_p_switch_input_callback_function_t"}, {0}
|
||||
};
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@ extern "C" {
|
||||
#include <switch.h>
|
||||
|
||||
extern void *globalDTMFCallbackFunction;
|
||||
extern switch_status_t PythonDTMFCallback(switch_core_session * session,
|
||||
void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
|
||||
extern switch_status_t PythonDTMFCallback(switch_core_session * session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
|
||||
|
||||
class SessionContainer {
|
||||
private:
|
||||
|
||||
@@ -114,8 +114,7 @@ static switch_loadable_module_interface_t python_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &python_module_interface;
|
||||
|
||||
@@ -329,8 +329,7 @@ extern "C" {
|
||||
Note: if start == end at the beginning of the function, we go all the way around
|
||||
the circular list.
|
||||
*/
|
||||
SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start,
|
||||
swig_module_info * end, const char *name) {
|
||||
SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
|
||||
swig_module_info *iter = start;
|
||||
do {
|
||||
if (iter->size) {
|
||||
@@ -572,7 +571,7 @@ extern "C" {
|
||||
* type checking.
|
||||
*
|
||||
* Author : David Beazley (beazley@cs.uchicago.edu)
|
||||
************************************************************************//* Common SWIG API */
|
||||
************************************************************************//* Common SWIG API */
|
||||
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags)
|
||||
#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags)
|
||||
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
|
||||
@@ -584,11 +583,11 @@ extern "C" {
|
||||
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Pointer declarations
|
||||
* ----------------------------------------------------------------------------- *//*
|
||||
Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
|
||||
C/C++ pointers in the python side. Very useful for debugging, but
|
||||
not always safe.
|
||||
*/
|
||||
* ----------------------------------------------------------------------------- *//*
|
||||
Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
|
||||
C/C++ pointers in the python side. Very useful for debugging, but
|
||||
not always safe.
|
||||
*/
|
||||
#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
|
||||
# define SWIG_COBJECT_TYPES
|
||||
#endif
|
||||
@@ -652,8 +651,7 @@ extern "C" {
|
||||
|
||||
SWIGRUNTIME PyObject *PySwigObject_repr(PySwigObject * v) {
|
||||
char result[SWIG_BUFFER_SIZE];
|
||||
return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
|
||||
PyString_FromFormat("<Swig Object at %s>", result) : 0;
|
||||
return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? PyString_FromFormat("<Swig Object at %s>", result) : 0;
|
||||
}
|
||||
|
||||
SWIGRUNTIME PyObject *PySwigObject_str(PySwigObject * v) {
|
||||
@@ -1283,8 +1281,7 @@ extern "C" {
|
||||
#ifdef SWIG_LINK_RUNTIME
|
||||
type_pointer = SWIG_ReturnGlobalTypeList((void *) 0);
|
||||
#else
|
||||
type_pointer = PyCObject_Import((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION,
|
||||
(char *) "type_pointer" SWIG_TYPE_TABLE_NAME);
|
||||
type_pointer = PyCObject_Import((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Clear();
|
||||
type_pointer = (void *) 0;
|
||||
@@ -1541,8 +1538,7 @@ extern "C" {
|
||||
resultobj = Py_None;
|
||||
return resultobj;
|
||||
fail:return NULL;
|
||||
}
|
||||
static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
|
||||
} static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
|
||||
PyObject *resultobj = NULL;
|
||||
char *arg1 = (char *) 0;
|
||||
int result;
|
||||
@@ -1883,8 +1879,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
SWIG_Python_ConvertPtr(obj3, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,
|
||||
SWIG_POINTER_EXCEPTION);
|
||||
SWIG_Python_ConvertPtr(obj3, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
|
||||
if (SWIG_arg_fail(4))
|
||||
SWIG_fail;
|
||||
if (argp == NULL) {
|
||||
@@ -1932,8 +1927,7 @@ extern "C" {
|
||||
PyObject *obj4 = 0;
|
||||
PyObject *obj5 = 0;
|
||||
|
||||
if (!PyArg_ParseTuple
|
||||
(args, (char *) "OOOOOO:fs_switch_ivr_record_file", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5))
|
||||
if (!PyArg_ParseTuple(args, (char *) "OOOOOO:fs_switch_ivr_record_file", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5))
|
||||
goto fail;
|
||||
SWIG_Python_ConvertPtr(obj0, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
|
||||
if (SWIG_arg_fail(1))
|
||||
@@ -1947,8 +1941,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
SWIG_Python_ConvertPtr(obj3, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,
|
||||
SWIG_POINTER_EXCEPTION);
|
||||
SWIG_Python_ConvertPtr(obj3, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
|
||||
if (SWIG_arg_fail(4))
|
||||
SWIG_fail;
|
||||
if (argp == NULL) {
|
||||
@@ -2051,16 +2044,14 @@ extern "C" {
|
||||
PyObject *obj3 = 0;
|
||||
PyObject *obj4 = 0;
|
||||
|
||||
if (!PyArg_ParseTuple
|
||||
(args, (char *) "OOOOO:fs_switch_ivr_collect_digits_callback", &obj0, &obj1, &obj2, &obj3, &obj4))
|
||||
if (!PyArg_ParseTuple(args, (char *) "OOOOO:fs_switch_ivr_collect_digits_callback", &obj0, &obj1, &obj2, &obj3, &obj4))
|
||||
goto fail;
|
||||
SWIG_Python_ConvertPtr(obj0, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
|
||||
if (SWIG_arg_fail(1))
|
||||
SWIG_fail;
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
SWIG_Python_ConvertPtr(obj1, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,
|
||||
SWIG_POINTER_EXCEPTION);
|
||||
SWIG_Python_ConvertPtr(obj1, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
|
||||
if (SWIG_arg_fail(2))
|
||||
SWIG_fail;
|
||||
if (argp == NULL) {
|
||||
@@ -2115,9 +2106,7 @@ extern "C" {
|
||||
PyObject *obj5 = 0;
|
||||
PyObject *obj6 = 0;
|
||||
|
||||
if (!PyArg_ParseTuple
|
||||
(args, (char *) "OOOOOOO:fs_switch_ivr_collect_digits_count", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5,
|
||||
&obj6))
|
||||
if (!PyArg_ParseTuple(args, (char *) "OOOOOOO:fs_switch_ivr_collect_digits_count", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6))
|
||||
goto fail;
|
||||
SWIG_Python_ConvertPtr(obj0, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
|
||||
if (SWIG_arg_fail(1))
|
||||
@@ -2262,9 +2251,7 @@ extern "C" {
|
||||
PyObject *obj7 = 0;
|
||||
PyObject *obj8 = 0;
|
||||
|
||||
if (!PyArg_ParseTuple
|
||||
(args, (char *) "OOOOOOOOO:fs_switch_ivr_speak_text", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6,
|
||||
&obj7, &obj8))
|
||||
if (!PyArg_ParseTuple(args, (char *) "OOOOOOOOO:fs_switch_ivr_speak_text", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8))
|
||||
goto fail;
|
||||
SWIG_Python_ConvertPtr(obj0, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
|
||||
if (SWIG_arg_fail(1))
|
||||
@@ -2288,8 +2275,7 @@ extern "C" {
|
||||
}
|
||||
{
|
||||
switch_input_callback_function_t *argp;
|
||||
SWIG_Python_ConvertPtr(obj5, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,
|
||||
SWIG_POINTER_EXCEPTION);
|
||||
SWIG_Python_ConvertPtr(obj5, (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
|
||||
if (SWIG_arg_fail(6))
|
||||
SWIG_fail;
|
||||
if (argp == NULL) {
|
||||
@@ -2461,17 +2447,12 @@ extern "C" {
|
||||
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
||||
|
||||
static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_p_switch_core_session_t =
|
||||
{ "_p_p_switch_core_session_t", "switch_core_session_t **", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_channel_state_t =
|
||||
{ "_p_switch_channel_state_t", "enum switch_channel_state_t *|switch_channel_state_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_p_switch_core_session_t = { "_p_p_switch_core_session_t", "switch_core_session_t **", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "enum switch_channel_state_t *|switch_channel_state_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_core_session_t =
|
||||
{ "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_file_handle_t =
|
||||
{ "_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_input_callback_function_t =
|
||||
{ "_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_file_handle_t = { "_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__p_switch_input_callback_function_t = { "_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, 0 };
|
||||
static swig_type_info _swigt__ptrdiff_t = { "_ptrdiff_t", "ptrdiff_t", 0, 0, 0 };
|
||||
static swig_type_info _swigt__size_t = { "_size_t", "size_t", 0, 0, 0 };
|
||||
|
||||
@@ -2488,17 +2469,12 @@ extern "C" {
|
||||
};
|
||||
|
||||
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_p_switch_core_session_t[] =
|
||||
{ {&_swigt__p_p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_channel_state_t[] =
|
||||
{ {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_p_switch_core_session_t[] = { {&_swigt__p_p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_core_session_t[] =
|
||||
{ {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_file_handle_t[] =
|
||||
{ {&_swigt__p_switch_file_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_input_callback_function_t[] =
|
||||
{ {&_swigt__p_switch_input_callback_function_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_file_handle_t[] = { {&_swigt__p_switch_file_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__ptrdiff_t[] = { {&_swigt__ptrdiff_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
static swig_cast_info _swigc__size_t[] = { {&_swigt__size_t, 0, 0, 0}, {0, 0, 0, 0} };
|
||||
|
||||
@@ -2704,8 +2680,7 @@ extern "C" {
|
||||
SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * v) {
|
||||
v = v;
|
||||
return PyString_FromString("<Swig global variables>");
|
||||
}
|
||||
SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
|
||||
} SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
|
||||
swig_globalvar *var;
|
||||
flags = flags;
|
||||
fprintf(fp, "Swig global variables { ");
|
||||
@@ -2809,9 +2784,7 @@ extern "C" {
|
||||
return ((PyObject *) result);
|
||||
}
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_addvarlink(PyObject * p, char *name, PyObject * (*get_attr) (void),
|
||||
int (*set_attr) (PyObject * p)) {
|
||||
SWIGINTERN void SWIG_Python_addvarlink(PyObject * p, char *name, PyObject * (*get_attr) (void), int (*set_attr) (PyObject * p)) {
|
||||
swig_varlinkobject *v = (swig_varlinkobject *) p;
|
||||
swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
|
||||
if (gv) {
|
||||
@@ -2872,10 +2845,7 @@ extern "C" {
|
||||
/* Fix SwigMethods to carry the callback ptrs when needed */
|
||||
/* ----------------------------------------------------------------------------- */
|
||||
|
||||
SWIGINTERN void
|
||||
SWIG_Python_FixMethods(PyMethodDef * methods,
|
||||
swig_const_info * const_table,
|
||||
swig_type_info ** types, swig_type_info ** types_initial) {
|
||||
SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef * methods, swig_const_info * const_table, swig_type_info ** types, swig_type_info ** types_initial) {
|
||||
size_t i;
|
||||
for (i = 0; methods[i].ml_name; ++i) {
|
||||
char *c = methods[i].ml_doc;
|
||||
|
||||
@@ -614,8 +614,7 @@ JSObject *new_js_event(switch_event_t *event, char *name, JSContext * cx, JSObje
|
||||
eo->event = event;
|
||||
eo->freed = 1;
|
||||
if ((Event = JS_DefineObject(cx, obj, name, &event_class, NULL, 0))) {
|
||||
if ((JS_SetPrivate(cx, Event, eo) &&
|
||||
JS_DefineProperties(cx, Event, event_props) && JS_DefineFunctions(cx, Event, event_methods))) {
|
||||
if ((JS_SetPrivate(cx, Event, eo) && JS_DefineProperties(cx, Event, event_props) && JS_DefineFunctions(cx, Event, event_methods))) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -623,8 +622,7 @@ JSObject *new_js_event(switch_event_t *event, char *name, JSContext * cx, JSObje
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t js_common_callback(switch_core_session_t *session, void *input, switch_input_type_t itype,
|
||||
void *buf, unsigned int buflen)
|
||||
static switch_status_t js_common_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
char *dtmf = NULL;
|
||||
switch_event_t *event = NULL;
|
||||
@@ -635,8 +633,7 @@ static switch_status_t js_common_callback(switch_core_session_t *session, void *
|
||||
JSObject *Event = NULL;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -670,8 +667,7 @@ static switch_status_t js_common_callback(switch_core_session_t *session, void *
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t js_stream_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype,
|
||||
void *buf, unsigned int buflen)
|
||||
static switch_status_t js_stream_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
char *ret;
|
||||
switch_status_t status;
|
||||
@@ -756,8 +752,7 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t js_record_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype,
|
||||
void *buf, unsigned int buflen)
|
||||
static switch_status_t js_record_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
char *ret;
|
||||
switch_status_t status;
|
||||
@@ -794,8 +789,7 @@ static switch_status_t js_record_input_callback(switch_core_session_t *session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t js_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype,
|
||||
void *buf, unsigned int buflen)
|
||||
static switch_status_t js_collect_input_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
{
|
||||
char *ret;
|
||||
switch_status_t status;
|
||||
@@ -822,8 +816,7 @@ static JSBool session_flush_digits(JSContext * cx, JSObject * obj, uintN argc, j
|
||||
switch_channel_t *channel;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -878,8 +871,7 @@ static JSBool session_recordfile(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -962,8 +954,7 @@ static JSBool session_collect_input(JSContext * cx, JSObject * obj, uintN argc,
|
||||
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1030,8 +1021,7 @@ static JSBool session_sayphrase(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1161,8 +1151,7 @@ static JSBool session_streamfile(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1227,8 +1216,7 @@ static JSBool session_set_variable(JSContext * cx, JSObject * obj, uintN argc, j
|
||||
switch_channel_t *channel;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1298,8 +1286,7 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1350,10 +1337,7 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
args.input_callback = dtmf_func;
|
||||
args.buf = bp;
|
||||
args.buflen = len;
|
||||
switch_ivr_speak_text(jss->session,
|
||||
tts_name,
|
||||
voice_name && strlen(voice_name) ? voice_name : NULL,
|
||||
codec->implementation->samples_per_second, text, &args);
|
||||
switch_ivr_speak_text(jss->session, tts_name, voice_name && strlen(voice_name) ? voice_name : NULL, codec->implementation->samples_per_second, text, &args);
|
||||
JS_ResumeRequest(cx, cb_state.saveDepth);
|
||||
*rval = cb_state.ret;
|
||||
|
||||
@@ -1369,8 +1353,7 @@ static JSBool session_get_digits(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
switch_channel_t *channel;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1390,8 +1373,7 @@ static JSBool session_get_digits(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
JS_ValueToInt32(cx, argv[0], &digits);
|
||||
|
||||
if (digits > sizeof(buf) - 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exceeded max digits of %" SWITCH_SIZE_T_FMT "\n",
|
||||
sizeof(buf) - 1);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exceeded max digits of %" SWITCH_SIZE_T_FMT "\n", sizeof(buf) - 1);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1417,8 +1399,7 @@ static JSBool session_autohangup(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1443,8 +1424,7 @@ static JSBool session_answer(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
switch_channel_t *channel;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1473,8 +1453,7 @@ static JSBool session_cdr(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@@ -1496,8 +1475,7 @@ static JSBool session_ready(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
switch_channel_t *channel;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1521,8 +1499,7 @@ static JSBool session_wait_for_media(JSContext * cx, JSObject * obj, uintN argc,
|
||||
int32 timeout = 60;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1565,8 +1542,7 @@ static JSBool session_wait_for_answer(JSContext * cx, JSObject * obj, uintN argc
|
||||
int32 timeout = 60;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1605,8 +1581,7 @@ static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval
|
||||
struct js_session *jss = JS_GetPrivate(cx, obj);
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1629,8 +1604,7 @@ static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval
|
||||
jsrefcount saveDepth;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1655,8 +1629,7 @@ static JSBool session_get_event(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
switch_event_t *event;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1670,8 +1643,7 @@ static JSBool session_get_event(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
eo->freed = 0;
|
||||
|
||||
if ((Event = JS_DefineObject(cx, obj, "__event__", &event_class, NULL, 0))) {
|
||||
if ((JS_SetPrivate(cx, Event, eo) &&
|
||||
JS_DefineProperties(cx, Event, event_props) && JS_DefineFunctions(cx, Event, event_methods))) {
|
||||
if ((JS_SetPrivate(cx, Event, eo) && JS_DefineProperties(cx, Event, event_props) && JS_DefineFunctions(cx, Event, event_methods))) {
|
||||
*rval = OBJECT_TO_JSVAL(Event);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1691,8 +1663,7 @@ static JSBool session_send_event(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
struct event_obj *eo;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -1724,8 +1695,7 @@ static JSBool session_hangup(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
if (!jss || !jss->session) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"You must call the session.originate method before calling this method!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You must call the session.originate method before calling this method!\n");
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -2043,8 +2013,7 @@ JSClass session_class = {
|
||||
};
|
||||
|
||||
|
||||
static JSObject *new_js_session(JSContext * cx, JSObject * obj, switch_core_session_t *session, struct js_session *jss,
|
||||
char *name, int flags)
|
||||
static JSObject *new_js_session(JSContext * cx, JSObject * obj, switch_core_session_t *session, struct js_session *jss, char *name, int flags)
|
||||
{
|
||||
JSObject *session_obj;
|
||||
if ((session_obj = JS_DefineObject(cx, obj, name, &session_class, NULL, 0))) {
|
||||
@@ -2054,8 +2023,7 @@ static JSObject *new_js_session(JSContext * cx, JSObject * obj, switch_core_sess
|
||||
jss->cx = cx;
|
||||
jss->obj = session_obj;
|
||||
if ((JS_SetPrivate(cx, session_obj, jss) &&
|
||||
JS_DefineProperties(cx, session_obj, session_props) &&
|
||||
JS_DefineFunctions(cx, session_obj, session_methods))) {
|
||||
JS_DefineProperties(cx, session_obj, session_props) && JS_DefineFunctions(cx, session_obj, session_methods))) {
|
||||
return session_obj;
|
||||
}
|
||||
}
|
||||
@@ -2167,15 +2135,9 @@ static JSBool session_originate(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
}
|
||||
|
||||
caller_profile = switch_caller_profile_new(pool,
|
||||
username,
|
||||
dialplan,
|
||||
cid_name,
|
||||
cid_num,
|
||||
network_addr, ani, aniii, rdnis, (char *) modname, context, dest);
|
||||
username, dialplan, cid_name, cid_num, network_addr, ani, aniii, rdnis, (char *) modname, context, dest);
|
||||
|
||||
if (switch_ivr_originate
|
||||
(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL,
|
||||
caller_profile) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
|
||||
goto done;
|
||||
}
|
||||
@@ -2356,8 +2318,7 @@ static JSBool fileio_write(JSContext * cx, JSObject * obj, uintN argc, jsval * a
|
||||
|
||||
if (data) {
|
||||
wrote = strlen(data);
|
||||
*rval =
|
||||
BOOLEAN_TO_JSVAL((switch_file_write(fio->fd, data, &wrote) == SWITCH_STATUS_SUCCESS) ? JS_TRUE : JS_FALSE);
|
||||
*rval = BOOLEAN_TO_JSVAL((switch_file_write(fio->fd, data, &wrote) == SWITCH_STATUS_SUCCESS) ? JS_TRUE : JS_FALSE);
|
||||
}
|
||||
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
|
||||
@@ -2561,8 +2522,7 @@ static JSBool js_bridge(JSContext * cx, JSObject * obj, uintN argc, jsval * argv
|
||||
}
|
||||
|
||||
if (!(jss_a && jss_b)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure! %s %s\n", jss_a ? "y" : "n",
|
||||
jss_b ? "y" : "n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure! %s %s\n", jss_a ? "y" : "n", jss_b ? "y" : "n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -2648,18 +2608,11 @@ static int env_init(JSContext * cx, JSObject * javascript_object)
|
||||
|
||||
JS_InitStandardClasses(cx, javascript_object);
|
||||
|
||||
JS_InitClass(cx,
|
||||
javascript_object,
|
||||
NULL,
|
||||
&session_class, session_construct, 3, session_props, session_methods, session_props, session_methods);
|
||||
JS_InitClass(cx, javascript_object, NULL, &session_class, session_construct, 3, session_props, session_methods, session_props, session_methods);
|
||||
|
||||
JS_InitClass(cx,
|
||||
javascript_object,
|
||||
NULL, &fileio_class, fileio_construct, 3, fileio_props, fileio_methods, fileio_props, fileio_methods);
|
||||
JS_InitClass(cx, javascript_object, NULL, &fileio_class, fileio_construct, 3, fileio_props, fileio_methods, fileio_props, fileio_methods);
|
||||
|
||||
JS_InitClass(cx,
|
||||
javascript_object,
|
||||
NULL, &event_class, event_construct, 3, event_props, event_methods, event_props, event_methods);
|
||||
JS_InitClass(cx, javascript_object, NULL, &event_class, event_construct, 3, event_props, event_methods, event_props, event_methods);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -2720,7 +2673,7 @@ static void js_parse_and_execute(switch_core_session_t *session, char *input_cod
|
||||
|
||||
|
||||
|
||||
static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t *thread, void *obj)
|
||||
static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
char *input_code = obj;
|
||||
|
||||
@@ -2801,8 +2754,7 @@ static switch_loadable_module_interface_t spidermonkey_module_interface = {
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
switch_status_t status;
|
||||
|
||||
|
||||
@@ -90,8 +90,7 @@ static JSBool js_email(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
|
||||
if (argc > 3 &&
|
||||
(from = JS_GetStringBytes(JS_ValueToString(cx, argv[0]))) &&
|
||||
(to = JS_GetStringBytes(JS_ValueToString(cx, argv[1]))) &&
|
||||
(headers = JS_GetStringBytes(JS_ValueToString(cx, argv[2]))) &&
|
||||
(body = JS_GetStringBytes(JS_ValueToString(cx, argv[3])))
|
||||
(headers = JS_GetStringBytes(JS_ValueToString(cx, argv[2]))) && (body = JS_GetStringBytes(JS_ValueToString(cx, argv[3])))
|
||||
) {
|
||||
if (argc > 4) {
|
||||
file = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
|
||||
@@ -129,8 +128,7 @@ static JSBool js_email(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
|
||||
if (file) {
|
||||
snprintf(buf, B64BUFFLEN, "\n\n--%s\nContent-Type: application/octet-stream\n"
|
||||
"Content-Transfer-Encoding: base64\n"
|
||||
"Content-Description: Sound attachment.\n"
|
||||
"Content-Disposition: attachment; filename=\"%s\"\n\n", bound, file);
|
||||
"Content-Description: Sound attachment.\n" "Content-Disposition: attachment; filename=\"%s\"\n\n", bound, file);
|
||||
if (!write_buf(fd, buf))
|
||||
return JS_FALSE;
|
||||
|
||||
@@ -233,8 +231,7 @@ switch_status_t etpan_load(JSContext * cx, JSObject * obj)
|
||||
{
|
||||
JS_DefineFunctions(cx, obj, etpan_functions);
|
||||
|
||||
JS_InitClass(cx,
|
||||
obj, NULL, &etpan_class, etpan_construct, 3, etpan_props, etpan_methods, etpan_props, etpan_methods);
|
||||
JS_InitClass(cx, obj, NULL, &etpan_class, etpan_construct, 3, etpan_props, etpan_methods, etpan_props, etpan_methods);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -375,9 +372,7 @@ int send_message(char *data, size_t len, char **rcpts)
|
||||
}
|
||||
|
||||
/* first open the stream */
|
||||
if ((ret = mailsmtp_socket_connect(smtp,
|
||||
(smtp_server != NULL ? smtp_server : "localhost"),
|
||||
smtp_port)) != MAILSMTP_NO_ERROR) {
|
||||
if ((ret = mailsmtp_socket_connect(smtp, (smtp_server != NULL ? smtp_server : "localhost"), smtp_port)) != MAILSMTP_NO_ERROR) {
|
||||
fprintf(stderr, "mailsmtp_socket_connect: %s\n", mailsmtp_strerror(ret));
|
||||
goto error;
|
||||
}
|
||||
@@ -397,17 +392,14 @@ int send_message(char *data, size_t len, char **rcpts)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (esmtp && smtp_user != NULL &&
|
||||
(ret = mailsmtp_auth(smtp, smtp_user, (smtp_password != NULL) ? smtp_password : ""))
|
||||
if (esmtp && smtp_user != NULL && (ret = mailsmtp_auth(smtp, smtp_user, (smtp_password != NULL) ? smtp_password : ""))
|
||||
!= MAILSMTP_NO_ERROR) {
|
||||
fprintf(stderr, "mailsmtp_auth: %s: %s\n", smtp_user, mailsmtp_strerror(ret));
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* source */
|
||||
if ((ret = (esmtp ?
|
||||
mailesmtp_mail(smtp, smtp_from, 1, "etPanSMTPTest") :
|
||||
mailsmtp_mail(smtp, smtp_from))) != MAILSMTP_NO_ERROR) {
|
||||
if ((ret = (esmtp ? mailesmtp_mail(smtp, smtp_from, 1, "etPanSMTPTest") : mailsmtp_mail(smtp, smtp_from))) != MAILSMTP_NO_ERROR) {
|
||||
fprintf(stderr, "mailsmtp_mail: %s, %s\n", smtp_from, mailsmtp_strerror(ret));
|
||||
goto error;
|
||||
}
|
||||
@@ -415,9 +407,7 @@ int send_message(char *data, size_t len, char **rcpts)
|
||||
/* recipients */
|
||||
for (r = rcpts; *r != NULL; r++) {
|
||||
if ((ret = (esmtp ?
|
||||
mailesmtp_rcpt(smtp, *r,
|
||||
MAILSMTP_DSN_NOTIFY_FAILURE | MAILSMTP_DSN_NOTIFY_DELAY,
|
||||
NULL) : mailsmtp_rcpt(smtp, *r))) != MAILSMTP_NO_ERROR) {
|
||||
mailesmtp_rcpt(smtp, *r, MAILSMTP_DSN_NOTIFY_FAILURE | MAILSMTP_DSN_NOTIFY_DELAY, NULL) : mailsmtp_rcpt(smtp, *r))) != MAILSMTP_NO_ERROR) {
|
||||
fprintf(stderr, "mailsmtp_rcpt: %s: %s\n", *r, mailsmtp_strerror(ret));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -168,15 +168,12 @@ odbc_status_t odbc_obj_connect(odbc_obj_t * obj)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connecting %s\n", obj->dsn);
|
||||
|
||||
result = SQLConnect(obj->con,
|
||||
(SQLCHAR *) obj->dsn, SQL_NTS,
|
||||
(SQLCHAR *) obj->username, SQL_NTS, (SQLCHAR *) obj->password, SQL_NTS);
|
||||
result = SQLConnect(obj->con, (SQLCHAR *) obj->dsn, SQL_NTS, (SQLCHAR *) obj->username, SQL_NTS, (SQLCHAR *) obj->password, SQL_NTS);
|
||||
|
||||
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
|
||||
SQLGetDiagRec(SQL_HANDLE_DBC, obj->con, 1, stat, &err, msg, 100, &mlen);
|
||||
SQLFreeHandle(SQL_HANDLE_ENV, obj->env);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error SQLConnect=%d errno=%d %s\n", result, (int) err,
|
||||
msg);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error SQLConnect=%d errno=%d %s\n", result, (int) err, msg);
|
||||
return ODBC_FAIL;
|
||||
} else {
|
||||
|
||||
@@ -445,8 +442,7 @@ static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
SQLCHAR *data = odbc_obj->colbuf;
|
||||
SQLCHAR *esc = NULL;
|
||||
|
||||
SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize,
|
||||
&DecimalDigits, &Nullable);
|
||||
SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
|
||||
SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
|
||||
|
||||
if (strchr((char *) odbc_obj->colbuf, '"')) { /* please don't */
|
||||
@@ -454,8 +450,7 @@ static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *
|
||||
data = esc;
|
||||
}
|
||||
|
||||
snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name,
|
||||
data);
|
||||
snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
|
||||
switch_safe_free(esc);
|
||||
|
||||
eval_some_js((char *) odbc_obj->code, cx, obj, rval);
|
||||
|
||||
@@ -116,8 +116,7 @@ static JSBool teletone_construct(JSContext * cx, JSObject * obj, uintN argc, jsv
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
read_codec->implementation->number_of_channels,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed\n");
|
||||
@@ -285,9 +284,7 @@ static JSBool teletone_generate(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((write_frame.datalen =
|
||||
(uint32_t) switch_buffer_read(tto->audio_buffer, fdata,
|
||||
write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
if ((write_frame.datalen = (uint32_t) switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
if (loops) {
|
||||
switch_buffer_t *tmp;
|
||||
|
||||
@@ -298,8 +295,7 @@ static JSBool teletone_generate(JSContext * cx, JSObject * obj, uintN argc, jsva
|
||||
loops--;
|
||||
/* try again */
|
||||
if ((write_frame.datalen =
|
||||
(uint32_t) switch_buffer_read(tto->audio_buffer, fdata,
|
||||
write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
(uint32_t) switch_buffer_read(tto->audio_buffer, fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -363,11 +359,7 @@ JSClass teletone_class = {
|
||||
|
||||
switch_status_t teletone_load(JSContext * cx, JSObject * obj)
|
||||
{
|
||||
JS_InitClass(cx,
|
||||
obj,
|
||||
NULL,
|
||||
&teletone_class,
|
||||
teletone_construct, 3, teletone_props, teletone_methods, teletone_props, teletone_methods);
|
||||
JS_InitClass(cx, obj, NULL, &teletone_class, teletone_construct, 3, teletone_props, teletone_methods, teletone_props, teletone_methods);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ static WORD COLORS[] = { FOREGROUND_RED | FOREGROUND_INTENSITY,
|
||||
FOREGROUND_GREEN | FOREGROUND_INTENSITY
|
||||
};
|
||||
#else
|
||||
static const char *COLORS[] =
|
||||
{ SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN,
|
||||
static const char *COLORS[] = { SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN,
|
||||
SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW, ""
|
||||
};
|
||||
#endif
|
||||
@@ -130,8 +129,7 @@ static switch_status_t config_logger(void)
|
||||
if (!strcasecmp(var, "colorize") && switch_true(val)) {
|
||||
#ifdef WIN32
|
||||
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE
|
||||
&& GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
|
||||
if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
|
||||
wOldColorAttrs = csbiInfo.wAttributes;
|
||||
COLORIZE = 1;
|
||||
}
|
||||
@@ -190,8 +188,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
|
||||
|
||||
@@ -148,8 +148,7 @@ static switch_status_t load_config(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
|
||||
{
|
||||
switch_status_t status;
|
||||
*interface = &console_module_interface;
|
||||
|
||||
@@ -56,9 +56,7 @@ static const char modname[] = "mod_say_en";
|
||||
}}\
|
||||
|
||||
|
||||
static switch_status_t en_spell(switch_core_session_t *session,
|
||||
char *tosay,
|
||||
switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
static switch_status_t en_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@@ -78,9 +76,7 @@ static switch_status_t en_spell(switch_core_session_t *session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t play_group(switch_say_method_t method,
|
||||
int a,
|
||||
int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
|
||||
static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
|
||||
{
|
||||
|
||||
if (a) {
|
||||
@@ -156,9 +152,7 @@ static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
|
||||
}
|
||||
|
||||
static switch_status_t en_say_general_count(switch_core_session_t *session,
|
||||
char *tosay,
|
||||
switch_say_type_t type,
|
||||
switch_say_method_t method, switch_input_args_t *args)
|
||||
char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
int in;
|
||||
@@ -188,18 +182,13 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
|
||||
switch (method) {
|
||||
case SSM_COUNTED:
|
||||
case SSM_PRONOUNCED:
|
||||
if ((status =
|
||||
play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session,
|
||||
args)) != SWITCH_STATUS_SUCCESS) {
|
||||
if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
if ((status =
|
||||
play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session,
|
||||
args)) != SWITCH_STATUS_SUCCESS) {
|
||||
if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
if ((status =
|
||||
play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||
if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
break;
|
||||
@@ -224,8 +213,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t en_ip(switch_core_session_t *session,
|
||||
char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
static switch_status_t en_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
char *a, *b, *c, *d;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
@@ -268,9 +256,7 @@ static switch_status_t en_ip(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t en_say_time(switch_core_session_t *session,
|
||||
char *tosay,
|
||||
switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
int32_t t;
|
||||
switch_time_t target = 0;
|
||||
@@ -416,9 +402,7 @@ static switch_status_t en_say_time(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t en_say_money(switch_core_session_t *session,
|
||||
char *tosay,
|
||||
switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
|
||||
@@ -484,9 +468,7 @@ static switch_status_t en_say_money(switch_core_session_t *session,
|
||||
|
||||
|
||||
|
||||
static switch_status_t en_say(switch_core_session_t *session,
|
||||
char *tosay,
|
||||
switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
|
||||
{
|
||||
|
||||
switch_say_callback_t say_cb = NULL;
|
||||
@@ -547,8 +529,7 @@ static switch_loadable_module_interface_t say_en_module_interface = {
|
||||
/*.asr_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &say_en_module_interface;
|
||||
|
||||
@@ -197,8 +197,7 @@ static const switch_loadable_module_interface_t mod_softtimer_module_interface =
|
||||
/*.timer_interface */ &timer_interface
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
@@ -100,8 +100,7 @@ static const switch_loadable_module_interface_t mod_xml_cdr_module_interface = {
|
||||
/*.application_interface */ NULL
|
||||
};
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* test global state handlers */
|
||||
switch_core_add_state_handler(&state_handlers);
|
||||
|
||||
@@ -56,9 +56,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
}
|
||||
|
||||
|
||||
static switch_xml_t xml_url_fetch(const char *section,
|
||||
const char *tag_name,
|
||||
const char *key_name, const char *key_value, const char *params, void *user_data)
|
||||
static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, const char *params, void *user_data)
|
||||
{
|
||||
char filename[512] = "";
|
||||
CURL *curl_handle = NULL;
|
||||
@@ -88,8 +86,7 @@ static switch_xml_t xml_url_fetch(const char *section,
|
||||
section,
|
||||
tag_name ? tag_name : "",
|
||||
key_name ? key_name : "",
|
||||
key_value ? key_value : "",
|
||||
params ? strchr(params, '=') ? "&" : "¶ms=" : "", params ? params : ""))) {
|
||||
key_value ? key_value : "", params ? strchr(params, '=') ? "&" : "¶ms=" : "", params ? params : ""))) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
||||
return NULL;
|
||||
@@ -206,8 +203,7 @@ static switch_status_t do_config(void)
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
|
||||
switch_strlen_zero(bname) ? "N/A" : bname,
|
||||
binding->url, binding->bindings ? binding->bindings : "all");
|
||||
switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
|
||||
switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding);
|
||||
x++;
|
||||
binding = NULL;
|
||||
@@ -219,8 +215,7 @@ static switch_status_t do_config(void)
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &xml_curl_module_interface;
|
||||
|
||||
@@ -112,8 +112,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm)
|
||||
}
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &xml_rpc_module_interface;
|
||||
@@ -300,8 +299,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
MIMETypeInit();
|
||||
MIMETypeAdd("text/html", "html");
|
||||
|
||||
snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR,
|
||||
"freeswitch_http.log");
|
||||
snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
|
||||
ServerCreate(&abyssServer, "XmlRpcServer", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, logfile);
|
||||
|
||||
xmlrpc_server_abyss_set_handler(&env, &abyssServer, "/RPC2", registryP);
|
||||
@@ -309,8 +307,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
|
||||
ServerInit(&abyssServer);
|
||||
ServerAddHandler(&abyssServer, HandleHook);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting HTTP Port %d, DocRoot [%s]\n", globals.port,
|
||||
SWITCH_GLOBAL_dirs.htdocs_dir);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting HTTP Port %d, DocRoot [%s]\n", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir);
|
||||
while (globals.running) {
|
||||
ServerRunOnce2(&abyssServer, ABYSS_FOREGROUND);
|
||||
}
|
||||
|
||||
+1
-2
@@ -263,8 +263,7 @@ int main(int argc, char *argv[])
|
||||
SERVICENAME,
|
||||
SERVICENAME,
|
||||
GENERIC_READ | GENERIC_EXECUTE,
|
||||
SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, servicePath, NULL, NULL, NULL, NULL, NULL);
|
||||
SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, servicePath, NULL, NULL, NULL, NULL, NULL);
|
||||
exit(0);
|
||||
}
|
||||
if (argv[x] && !strcmp(argv[x], "-uninstall")) {
|
||||
|
||||
+77
-92
@@ -65,24 +65,24 @@
|
||||
|
||||
/* Memory Pools */
|
||||
|
||||
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
|
||||
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t * p)
|
||||
{
|
||||
apr_pool_clear(p);
|
||||
}
|
||||
|
||||
/* Hash tables */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_hash_first(p, ht);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_hash_next(ht);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
apr_hash_this(hi, key, klen, val);
|
||||
}
|
||||
@@ -92,31 +92,29 @@ SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssi
|
||||
return apr_hashfunc_default(key, klen);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_hash_pool_get(ht);
|
||||
}
|
||||
|
||||
/* DSO functions */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_dso_load(res_handle, path, ctx);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_dso_unload(handle);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_dso_sym(ressym, handle, symname);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_dso_error(dso, buf, bufsize);
|
||||
}
|
||||
@@ -124,9 +122,7 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *bu
|
||||
|
||||
/* string functions */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
|
||||
}
|
||||
@@ -153,69 +149,69 @@ SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_siz
|
||||
|
||||
/* thread read write lock functions */
|
||||
|
||||
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_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t * pool)
|
||||
{
|
||||
return apr_thread_rwlock_create(rwlock, pool);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_destroy(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_pool_get(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_rdlock(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_tryrdlock(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_wrlock(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_trywrlock(rwlock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t * rwlock)
|
||||
{
|
||||
return apr_thread_rwlock_unlock(rwlock);
|
||||
}
|
||||
|
||||
/* thread mutex functions */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_mutex_create(lock, flags, pool);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t * lock)
|
||||
{
|
||||
return apr_thread_mutex_destroy(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)
|
||||
{
|
||||
return apr_thread_mutex_lock(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)
|
||||
{
|
||||
return apr_thread_mutex_unlock(lock);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock)
|
||||
{
|
||||
return apr_thread_mutex_trylock(lock);
|
||||
}
|
||||
@@ -227,22 +223,22 @@ SWITCH_DECLARE(switch_time_t) switch_time_now(void)
|
||||
return (switch_time_t) apr_time_now();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_time_exp_gmt_get(result, (apr_time_exp_t *) input);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_time_exp_get(result, (apr_time_exp_t *) input);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_time_exp_lt((apr_time_exp_t *) result, input);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_time_exp_gmt((apr_time_exp_t *) result, input);
|
||||
}
|
||||
@@ -272,46 +268,44 @@ SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec)
|
||||
|
||||
/* Thread condition locks */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_create(cond, pool);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_wait(cond, mutex);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_timedwait(cond, mutex, timeout);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_signal(cond);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_broadcast(cond);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_thread_cond_destroy(cond);
|
||||
}
|
||||
|
||||
/* file i/o stubs */
|
||||
|
||||
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_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t * pool)
|
||||
{
|
||||
return apr_file_open(newf, fname, flag, perm, 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)
|
||||
{
|
||||
apr_status_t rv;
|
||||
apr_off_t off = (apr_off_t) (*offset);
|
||||
@@ -320,22 +314,22 @@ SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_
|
||||
return rv;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile)
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t * thefile)
|
||||
{
|
||||
return apr_file_close(thefile);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool)
|
||||
SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t * pool)
|
||||
{
|
||||
return apr_file_remove(path, pool);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_file_read(thefile, buf, nbytes);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_file_write(thefile, buf, nbytes);
|
||||
}
|
||||
@@ -356,107 +350,103 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename)
|
||||
/* thread stubs */
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_threadattr_create(new_attr, pool);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_threadattr_detach_set(attr, on);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_threadattr_stacksize_set(attr, stacksize);
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return apr_thread_create(new_thread, attr, func, data, cont);
|
||||
}
|
||||
|
||||
/* socket stubs */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_create(new_sock, family, type, protocol, pool);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_shutdown(sock, how);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock)
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock)
|
||||
{
|
||||
return apr_socket_close(sock);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_bind(sock, sa);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_listen(sock, backlog);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_accept(new_sock, sock, pool);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_connect(sock, sa);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_send(sock, buf, 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)
|
||||
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)
|
||||
{
|
||||
return apr_socket_sendto(sock, where, flags, buf, len);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_recv(sock, buf, len);
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_opt_set(sock, opt, on);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_socket_timeout_set(sock, t);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa)
|
||||
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t * sa)
|
||||
{
|
||||
return apr_sockaddr_ip_get(addr, sa);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_mcast_join(sock, join, iface, source);
|
||||
}
|
||||
@@ -464,24 +454,23 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_
|
||||
|
||||
/* socket functions */
|
||||
|
||||
SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in)
|
||||
SWITCH_DECLARE(char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t * in)
|
||||
{
|
||||
return get_addr(buf, len, &in->sa.sin.sin_addr);
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
|
||||
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa)
|
||||
{
|
||||
return sa->port;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa)
|
||||
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t * sa)
|
||||
{
|
||||
return sa->family;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
apr_status_t r;
|
||||
|
||||
@@ -498,25 +487,22 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from,
|
||||
|
||||
/* poll stubs */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_pollset_create(pollset, size, p, flags);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_pollset_add(pollset, descriptor);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_poll(aprset, numsock, nsds, timeout);
|
||||
}
|
||||
|
||||
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_pollset_t *pollset;
|
||||
|
||||
@@ -554,17 +540,17 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
|
||||
/* UUID Handling (apr-util) */
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
apr_uuid_format(buffer, (const apr_uuid_t *) uuid);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
|
||||
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t * uuid)
|
||||
{
|
||||
apr_uuid_get((apr_uuid_t *) 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)
|
||||
{
|
||||
return apr_uuid_parse((apr_uuid_t *) uuid, uuid_str);
|
||||
}
|
||||
@@ -572,33 +558,32 @@ SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const cha
|
||||
|
||||
/* FIFO queues (apr-util) */
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_queue_create(queue, queue_capacity, pool);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue)
|
||||
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue)
|
||||
{
|
||||
return apr_queue_size(queue);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_queue_pop(queue, data);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_queue_push(queue, data);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_queue_trypop(queue, data);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return apr_queue_trypush(queue, data);
|
||||
}
|
||||
|
||||
+3
-7
@@ -50,13 +50,11 @@ struct switch_buffer {
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t *pool, switch_buffer_t **buffer,
|
||||
switch_size_t max_len)
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t * pool, switch_buffer_t **buffer, switch_size_t max_len)
|
||||
{
|
||||
switch_buffer_t *new_buffer;
|
||||
|
||||
if ((new_buffer = switch_core_alloc(pool, sizeof(switch_buffer_t))) != 0
|
||||
&& (new_buffer->data = switch_core_alloc(pool, max_len)) != 0) {
|
||||
if ((new_buffer = switch_core_alloc(pool, sizeof(switch_buffer_t))) != 0 && (new_buffer->data = switch_core_alloc(pool, max_len)) != 0) {
|
||||
new_buffer->datalen = max_len;
|
||||
new_buffer->id = buffer_id++;
|
||||
new_buffer->head = new_buffer->data;
|
||||
@@ -66,9 +64,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_memory_pool_t *pool,
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **buffer,
|
||||
switch_size_t blocksize,
|
||||
switch_size_t start_len, switch_size_t max_len)
|
||||
SWITCH_DECLARE(switch_status_t) switch_buffer_create_dynamic(switch_buffer_t **buffer, switch_size_t blocksize, switch_size_t start_len, switch_size_t max_len)
|
||||
{
|
||||
switch_buffer_t *new_buffer;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user