diff --git a/src/include/private/switch_core.h b/src/include/private/switch_core.h index 90a4a344aa..03777a2560 100644 --- a/src/include/private/switch_core.h +++ b/src/include/private/switch_core.h @@ -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); diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 5d73850364..11871f8dfb 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -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 * * @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. * */ - 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. * */ - 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 * * @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 * */ - 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: diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h index 7e2372463f..e9a98c0b9a 100644 --- a/src/include/switch_bitpack.h +++ b/src/include/switch_bitpack.h @@ -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; diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h index ddc1d45f76..46e3f98952 100644 --- a/src/include/switch_buffer.h +++ b/src/include/switch_buffer.h @@ -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 diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index de83e756c9..3387c39440 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -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 /** @} */ diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 0d892f7dc4..67c01f4ffe 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -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 diff --git a/src/include/switch_config.h b/src/include/switch_config.h index 66f383ee70..f4f665f213 100644 --- a/src/include/switch_config.h +++ b/src/include/switch_config.h @@ -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 /** @} */ diff --git a/src/include/switch_console.h b/src/include/switch_console.h index bea024b776..0c81dc4577 100644 --- a/src/include/switch_console.h +++ b/src/include/switch_console.h @@ -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: diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 40969da06f..63e1067cc6 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -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 diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index 30745a7097..131d715560 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -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 */ diff --git a/src/include/switch_core_event_hook.h b/src/include/switch_core_event_hook.h index 436301f8ea..5838733d68 100644 --- a/src/include/switch_core_event_hook.h +++ b/src/include/switch_core_event_hook.h @@ -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 diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 75d81297cc..eb8957148a 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -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); /*! diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index f0d2c4a524..6b86e02d4d 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -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: diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index b82d39fe71..1fe9aec535 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -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); diff --git a/src/include/switch_log.h b/src/include/switch_log.h index 8cc8b1e646..a875a97077 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -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 diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 39927b8728..0eb086c1b7 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -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; diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index f8a50ad7d3..a89a0b6b7d 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -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 diff --git a/src/include/switch_regex.h b/src/include/switch_regex.h index 3bc6216d4e..212d80ee47 100644 --- a/src/include/switch_regex.h +++ b/src/include/switch_regex.h @@ -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); /*! diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index cf9e98a8be..5c1f81f1e9 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -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 diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 7f3330a2a4..774c38c000 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -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 diff --git a/src/include/switch_scheduler.h b/src/include/switch_scheduler.h index 16bc3a82a9..75e65d4247 100644 --- a/src/include/switch_scheduler.h +++ b/src/include/switch_scheduler.h @@ -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 diff --git a/src/include/switch_sqlite.h b/src/include/switch_sqlite.h index 966c164908..8a0d6c0092 100644 --- a/src/include/switch_sqlite.h +++ b/src/include/switch_sqlite.h @@ -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 /** @} */ /** @} */ diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h index 48e1ed6add..9c63c191ea 100644 --- a/src/include/switch_stun.h +++ b/src/include/switch_stun.h @@ -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); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 36f1c02e86..eb1b7160fd 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -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 */ diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index fc02eef109..dfce229a06 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -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); diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index f07e7b635b..4c4e62fd5c 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -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 diff --git a/src/mod/applications/mod_bridgecall/mod_bridgecall.c b/src/mod/applications/mod_bridgecall/mod_bridgecall.c index 11abd6adbf..0c3c4ee7da 100644 --- a/src/mod/applications/mod_bridgecall/mod_bridgecall.c +++ b/src/mod/applications/mod_bridgecall/mod_bridgecall.c @@ -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 */ diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index b4049d26c8..f0379fb64c 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -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, - "\n", r, r, - html ? "html=1" : ""); + stream->write_function(stream, "\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, ""); - holder->stream->write_function(holder->stream, "%s%s", columnNames[x], - x == (argc - 1) ? "\n" : ""); + holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ""); } 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, ""); - 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" : ""); } 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; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 9f901ce517..3e1b43e4a7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -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; } diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 6a0b863895..609590579d 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -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 */ diff --git a/src/mod/applications/mod_echo/mod_echo.c b/src/mod/applications/mod_echo/mod_echo.c index 7e455777ff..894f82df2c 100644 --- a/src/mod/applications/mod_echo/mod_echo.c +++ b/src/mod/applications/mod_echo/mod_echo.c @@ -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; diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index e845d7015a..95d73bfe02 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -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) { diff --git a/src/mod/applications/mod_ivrtest/mod_ivrtest.c b/src/mod/applications/mod_ivrtest/mod_ivrtest.c index d0058d5830..cd3af99357 100644 --- a/src/mod/applications/mod_ivrtest/mod_ivrtest.c +++ b/src/mod/applications/mod_ivrtest/mod_ivrtest.c @@ -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 */ diff --git a/src/mod/applications/mod_park/mod_park.c b/src/mod/applications/mod_park/mod_park.c index 8ab2a9f0ed..19e29c081b 100644 --- a/src/mod/applications/mod_park/mod_park.c +++ b/src/mod/applications/mod_park/mod_park.c @@ -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; diff --git a/src/mod/applications/mod_playback/mod_playback.c b/src/mod/applications/mod_playback/mod_playback.c index 5d47e8b238..561474f14f 100644 --- a/src/mod/applications/mod_playback/mod_playback.c +++ b/src/mod/applications/mod_playback/mod_playback.c @@ -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 */ diff --git a/src/mod/applications/mod_rss/mod_rss.c b/src/mod/applications/mod_rss/mod_rss.c index 499d163fdc..3f2ff2c199 100644 --- a/src/mod/applications/mod_rss/mod_rss.c +++ b/src/mod/applications/mod_rss/mod_rss.c @@ -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, ",Main Menu. " - "Select one of the following news sources, followed by the pound key or press 0 to exit. " - ","); + "Select one of the following news sources, followed by the pound key or press 0 to exit. " ","); #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; diff --git a/src/mod/applications/mod_skel/mod_skel.c b/src/mod/applications/mod_skel/mod_skel.c index 6bd6cc01d1..306535eb0d 100644 --- a/src/mod/applications/mod_skel/mod_skel.c +++ b/src/mod/applications/mod_skel/mod_skel.c @@ -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; diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index afd619e56f..2c5c3d2da3 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -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; diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index 44ad3d66c5..d145ef0dbc 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -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"; diff --git a/src/mod/codecs/mod_g711/mod_g711.c b/src/mod/codecs/mod_g711/mod_g711.c index b8d9b1fd7b..3ecc0bf274 100644 --- a/src/mod/codecs/mod_g711/mod_g711.c +++ b/src/mod/codecs/mod_g711/mod_g711.c @@ -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; diff --git a/src/mod/codecs/mod_g722/mod_g722.c b/src/mod/codecs/mod_g722/mod_g722.c index d884c46241..ebd0d2f537 100644 --- a/src/mod/codecs/mod_g722/mod_g722.c +++ b/src/mod/codecs/mod_g722/mod_g722.c @@ -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; diff --git a/src/mod/codecs/mod_g723_1/mod_g723_1.c b/src/mod/codecs/mod_g723_1/mod_g723_1.c index eae6492e3a..4ff0c488a0 100644 --- a/src/mod/codecs/mod_g723_1/mod_g723_1.c +++ b/src/mod/codecs/mod_g723_1/mod_g723_1.c @@ -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; diff --git a/src/mod/codecs/mod_g726/mod_g726.c b/src/mod/codecs/mod_g726/mod_g726.c index 82cd575398..880148b1e9 100644 --- a/src/mod/codecs/mod_g726/mod_g726.c +++ b/src/mod/codecs/mod_g726/mod_g726.c @@ -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; diff --git a/src/mod/codecs/mod_g729/mod_g729.c b/src/mod/codecs/mod_g729/mod_g729.c index f49defa1e3..0b0251db27 100644 --- a/src/mod/codecs/mod_g729/mod_g729.c +++ b/src/mod/codecs/mod_g729/mod_g729.c @@ -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; diff --git a/src/mod/codecs/mod_gsm/mod_gsm.c b/src/mod/codecs/mod_gsm/mod_gsm.c index f5e107d70e..bc73aa0dac 100644 --- a/src/mod/codecs/mod_gsm/mod_gsm.c +++ b/src/mod/codecs/mod_gsm/mod_gsm.c @@ -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 */ diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index d724b32dad..0e2c4190fc 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -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 */ diff --git a/src/mod/codecs/mod_l16/mod_l16.c b/src/mod/codecs/mod_l16/mod_l16.c index 053865b53c..c2b9d3485d 100644 --- a/src/mod/codecs/mod_l16/mod_l16.c +++ b/src/mod/codecs/mod_l16/mod_l16.c @@ -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; diff --git a/src/mod/codecs/mod_lpc10/mod_lpc10.c b/src/mod/codecs/mod_lpc10/mod_lpc10.c index dc900f86ba..1dcf8a1dd5 100644 --- a/src/mod/codecs/mod_lpc10/mod_lpc10.c +++ b/src/mod/codecs/mod_lpc10/mod_lpc10.c @@ -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; diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index c6f11073f5..9b137abcd6 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -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; diff --git a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c index 047a4d12e6..f6121c7cd9 100644 --- a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c +++ b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c @@ -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(); diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 647734d632..ac7e35fac3 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -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 */ diff --git a/src/mod/directories/mod_ldap/mod_ldap.c b/src/mod/directories/mod_ldap/mod_ldap.c index d093c566de..9bef0254ca 100644 --- a/src/mod/directories/mod_ldap/mod_ldap.c +++ b/src/mod/directories/mod_ldap/mod_ldap.c @@ -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; } } diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 597c210ac0..6d38d70e8a 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -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 tag for user [%s@%s]\n", to_user, - to_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find 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); diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index 4db2f1f142..1e302158c9 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -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; } diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 0eb8da3933..78acd0f40e 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -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 [#|\n" "pa outdev [#|\n" - "pa ringdev [#|\n" - "--------------------------------------------------------------------------------\n"; + "pa ringdev [#|\n" "--------------------------------------------------------------------------------\n"; if (switch_strlen_zero(cmd)) { stream->write_function(stream, "%s", usage_string); diff --git a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c index bb999a8e74..41342f2e2d 100644 --- a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c +++ b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c @@ -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); diff --git a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h index cacc1de675..ae026c02dd 100644 --- a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h +++ b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h @@ -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. diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index 592571158e..ac82612833 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -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; diff --git a/src/mod/endpoints/mod_portaudio/pablio.h b/src/mod/endpoints/mod_portaudio/pablio.h index 336f76cbc3..4131101e6f 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.h +++ b/src/mod/endpoints/mod_portaudio/pablio.h @@ -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); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 75fa985a3a..faadb81b04 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -90,8 +90,7 @@ static char reg_sql[] = "CREATE TABLE sip_registrations (\n" " user VARCHAR(255),\n" " host VARCHAR(255),\n" - " contact VARCHAR(1024),\n" - " status VARCHAR(255),\n" " rpid VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; + " contact VARCHAR(1024),\n" " status VARCHAR(255),\n" " rpid VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; static char sub_sql[] = @@ -103,15 +102,13 @@ static char sub_sql[] = " sub_to_host VARCHAR(255),\n" " event VARCHAR(255),\n" " contact VARCHAR(1024),\n" - " call_id VARCHAR(255),\n" - " full_from VARCHAR(255),\n" " full_via VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; + " call_id VARCHAR(255),\n" " full_from VARCHAR(255),\n" " full_via VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; static char auth_sql[] = "CREATE TABLE sip_authentication (\n" " user VARCHAR(255),\n" - " host VARCHAR(255),\n" - " passwd VARCHAR(255),\n" " nonce VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; + " host VARCHAR(255),\n" " passwd VARCHAR(255),\n" " nonce VARCHAR(255),\n" " expires INTEGER(8)" ");\n"; static const char modname[] = "mod_sofia"; #define STRLEN 15 @@ -334,14 +331,11 @@ static switch_status_t sofia_on_loopback(switch_core_session_t *session); static switch_status_t sofia_on_transmit(switch_core_session_t *session); static switch_call_cause_t sofia_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_caller_profile_t *outbound_profile, switch_core_session_t **new_session, switch_memory_pool_t ** pool); -static switch_status_t sofia_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 sofia_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 sofia_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 sofia_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 config_sofia(int reload); @@ -355,8 +349,7 @@ static void set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, static void tech_set_codecs(private_object_t * tech_pvt); -static void attach_private(switch_core_session_t *session, - sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame); +static void attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame); static void terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line); @@ -366,42 +359,30 @@ static switch_status_t do_invite(switch_core_session_t *session); static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp); -static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t len, switch_mutex_t *mutex); +static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t len, switch_mutex_t * mutex); static void establish_presence(sofia_profile_t * profile); static void sip_i_state(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); -static void sip_i_refer(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]); +static void sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]); -static void sip_i_info(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]); +static void sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]); -static void sip_i_invite(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); +static void sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); -static void sip_i_register(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); +static void sip_i_register(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); static void event_callback(nua_event_t event, int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]); -static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void *obj); +static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t * thread, void *obj); static void launch_profile_thread(sofia_profile_t * profile); @@ -471,8 +452,7 @@ static char *get_url_from_contact(char *buf, uint8_t to_dup) } -static auth_res_t parse_auth(sofia_profile_t * profile, sip_authorization_t const *authorization, const char *regstr, - char *np, size_t nplen) +static auth_res_t parse_auth(sofia_profile_t * profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen) { int indexnum; const char *cur; @@ -576,7 +556,7 @@ static auth_res_t parse_auth(sofia_profile_t * profile, sip_authorization_t cons } -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; @@ -630,7 +610,7 @@ static int del_callback(void *pArg, int argc, char **argv, char **columnNames) return 0; } -static void check_expire(switch_core_db_t *db, sofia_profile_t * profile, time_t now) +static void check_expire(switch_core_db_t * db, sofia_profile_t * profile, time_t now) { char sql[1024]; char *errmsg; @@ -641,8 +621,7 @@ static void check_expire(switch_core_db_t *db, sofia_profile_t * profile, time_t } switch_mutex_lock(profile->ireg_mutex); - snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires < %ld", - profile->name, (long) now); + snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires < %ld", profile->name, (long) now); switch_core_db_exec(db, sql, del_callback, NULL, &errmsg); if (errmsg) { @@ -734,8 +713,7 @@ static void set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, snprintf(buf, sizeof(buf), "v=0\n" "o=FreeSWITCH %d%" SWITCH_TIME_T_FMT " %d%" SWITCH_TIME_T_FMT " IN IP4 %s\n" - "s=FreeSWITCH\n" - "c=IN IP4 %s\n" "t=0 0\n" "a=%s\n" "m=audio %d RTP/AVP", port, now, port, now, ip, ip, sr, port); + "s=FreeSWITCH\n" "c=IN IP4 %s\n" "t=0 0\n" "a=%s\n" "m=audio %d RTP/AVP", port, now, port, now, ip, ip, sr, port); if (tech_pvt->rm_encoding) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); @@ -763,8 +741,7 @@ static void set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, if (tech_pvt->rm_encoding) { rate = tech_pvt->rm_rate; - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->pt, - tech_pvt->rm_encoding, tech_pvt->rm_rate); + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->pt, tech_pvt->rm_encoding, tech_pvt->rm_rate); if (tech_pvt->fmtp_out) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out); } @@ -782,16 +759,14 @@ static void set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, rate = imp->samples_per_second; } if (ptime && ptime != imp->microseconds_per_frame / 1000) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ptime %u != advertised ptime %u\n", - imp->microseconds_per_frame / 1000, ptime); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ptime %u != advertised ptime %u\n", imp->microseconds_per_frame / 1000, ptime); } if (rfc_3551_sucks && imp->ianacode == 9) { rfc_3551_sucks = 8000; } - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, - rfc_3551_sucks); + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rfc_3551_sucks); if (imp->fmtp) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp); } @@ -799,8 +774,7 @@ static void set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, } if (tech_pvt->te > 95) { - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", - tech_pvt->te, tech_pvt->te); + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); } if (tech_pvt->cng_pt) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/%d\n", tech_pvt->cng_pt, rate); @@ -858,11 +832,9 @@ static void tech_set_codecs(private_object_t * tech_pvt) if (codec_string) { char *tmp_codec_string; if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) { - tech_pvt->codec_order_last = - switch_separate_string(tmp_codec_string, ',', tech_pvt->codec_order, SWITCH_MAX_CODECS); + tech_pvt->codec_order_last = switch_separate_string(tmp_codec_string, ',', tech_pvt->codec_order, SWITCH_MAX_CODECS); tech_pvt->num_codecs = - switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, - tech_pvt->codec_order_last); + switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, tech_pvt->codec_order_last); } } else { tech_pvt->num_codecs = @@ -873,8 +845,7 @@ static void tech_set_codecs(private_object_t * tech_pvt) } -static void attach_private(switch_core_session_t *session, - sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame) +static void attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame) { switch_channel_t *channel; char name[256]; @@ -941,8 +912,7 @@ static void terminate_session(switch_core_session_t **session, switch_call_cause -static switch_status_t sofia_ext_address_lookup(char **ip, - switch_port_t *port, char *sourceip, switch_memory_pool_t *pool) +static switch_status_t sofia_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t * pool) { char *error; @@ -957,8 +927,7 @@ static switch_status_t sofia_ext_address_lookup(char **ip, return SWITCH_STATUS_FALSE; } if (switch_stun_lookup(ip, port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &error, pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, - SWITCH_STUN_DEFAULT_PORT, error); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, error); return SWITCH_STATUS_FALSE; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stun Success [%s]:[%d]\n", *ip, *port); @@ -987,10 +956,7 @@ static switch_status_t tech_choose_port(private_object_t * tech_pvt) sdp_port = tech_pvt->local_sdp_audio_port; if (tech_pvt->profile->extrtpip) { - if (sofia_ext_address_lookup(&ip, - &sdp_port, - tech_pvt->profile->extrtpip, - switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + if (sofia_ext_address_lookup(&ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { terminate_session(&tech_pvt->session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__); return SWITCH_STATUS_FALSE; } @@ -1046,9 +1012,7 @@ static switch_status_t do_invite(switch_core_session_t *session) if (!tech_pvt->from_str) { tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, "\"%s\" ", cid_name, - cid_num, - tech_pvt->profile->extsipip ? tech_pvt->profile-> - extsipip : tech_pvt->profile->sipip); + cid_num, tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip); } @@ -1093,8 +1057,7 @@ static switch_status_t do_invite(switch_core_session_t *session) screen = "yes"; } - snprintf(rpid, sizeof(rpid) - 1, "Remote-Party-ID: %s;party=calling;screen=%s;privacy=%s", tech_pvt->from_str, - screen, priv); + snprintf(rpid, sizeof(rpid) - 1, "Remote-Party-ID: %s;party=calling;screen=%s;privacy=%s", tech_pvt->from_str, screen, priv); } @@ -1102,17 +1065,14 @@ static switch_status_t do_invite(switch_core_session_t *session) char *url = get_url_from_contact(tech_pvt->dest, 1); tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url), - SIPTAG_TO_STR(tech_pvt->dest_to), - SIPTAG_FROM_STR(tech_pvt->from_str), - SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); + SIPTAG_TO_STR(tech_pvt->dest_to), SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); switch_safe_free(url); if (!(tech_pvt->sofia_private = malloc(sizeof(*tech_pvt->sofia_private)))) { abort(); } memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private)); - switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), - sizeof(tech_pvt->sofia_private->uuid)); + switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid)); nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private); } @@ -1138,8 +1098,7 @@ static switch_status_t do_invite(switch_core_session_t *session) SWITCH_STANDARD_STREAM(stream); - for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(tech_pvt->session)); hi; - hi = switch_hash_next(hi)) { + for (hi = switch_channel_variable_first(channel, switch_core_session_get_pool(tech_pvt->session)); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &vval); if (vvar && vval) { const char *name = vvar; @@ -1164,8 +1123,7 @@ static switch_status_t do_invite(switch_core_session_t *session) //SIPTAG_CONTACT_STR(tech_pvt->profile->url), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), - SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), - TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END()); + SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END()); switch_safe_free(stream.data); @@ -1195,15 +1153,12 @@ static void do_xfer_invite(switch_core_session_t *session) if ((tech_pvt->from_str = switch_core_session_sprintf(session, "\"%s\" ", (char *) caller_profile->caller_id_name, (char *) caller_profile->caller_id_number, - tech_pvt->profile->extsipip ? tech_pvt->profile-> - extsipip : tech_pvt->profile->sipip))) { + tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip))) { char *rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL, - SIPTAG_TO_STR(tech_pvt->dest), - SIPTAG_FROM_STR(tech_pvt->from_str), - SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); + SIPTAG_TO_STR(tech_pvt->dest), SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private); @@ -1212,8 +1167,7 @@ static void do_xfer_invite(switch_core_session_t *session) TAG_IF(rpid, SIPTAG_HEADER_STR(rpid)), SIPTAG_CONTACT_STR(tech_pvt->profile->url), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), - SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), - SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END()); + SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END()); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); } @@ -1247,8 +1201,7 @@ static void tech_absorb_sdp(private_object_t * tech_pvt) } if (connection) { - tech_pvt->proxy_sdp_audio_ip = - switch_core_session_strdup(tech_pvt->session, connection->c_address); + tech_pvt->proxy_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, connection->c_address); } tech_pvt->proxy_sdp_audio_port = (switch_port_t) m->m_port; if (tech_pvt->proxy_sdp_audio_ip && tech_pvt->proxy_sdp_audio_port) { @@ -1422,17 +1375,14 @@ static switch_status_t sofia_on_hangup(switch_core_session_t *session) if (tech_pvt->nh) { if (!switch_test_flag(tech_pvt, TFLAG_BYE)) { if (switch_test_flag(tech_pvt, TFLAG_ANS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", - switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel)); nua_bye(tech_pvt->nh, TAG_END()); } else { if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", - sip_cause); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause); nua_respond(tech_pvt->nh, sip_cause, NULL, TAG_END()); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", - switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel)); nua_cancel(tech_pvt->nh, TAG_END()); } } @@ -1495,8 +1445,7 @@ static switch_status_t tech_set_codec(private_object_t * tech_pvt, int force) switch_core_codec_destroy(&tech_pvt->write_codec); switch_core_session_reset(tech_pvt->session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already using %s\n", - tech_pvt->read_codec.implementation->iananame); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already using %s\n", tech_pvt->read_codec.implementation->iananame); return SWITCH_STATUS_SUCCESS; } } @@ -1538,8 +1487,7 @@ static switch_status_t tech_set_codec(private_object_t * tech_pvt, int force) tech_pvt->read_frame.rate = tech_pvt->rm_rate; ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set Codec %s %s/%ld %d ms\n", - switch_channel_get_name(channel), - tech_pvt->rm_encoding, tech_pvt->rm_rate, tech_pvt->codec_ms); + switch_channel_get_name(channel), tech_pvt->rm_encoding, tech_pvt->rm_rate, tech_pvt->codec_ms); tech_pvt->read_frame.codec = &tech_pvt->read_codec; switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec); @@ -1600,8 +1548,7 @@ static switch_status_t activate_rtp(private_object_t * tech_pvt) tech_pvt->local_sdp_audio_ip, tech_pvt->local_sdp_audio_port, tech_pvt->remote_sdp_audio_ip, - tech_pvt->remote_sdp_audio_port, - tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000); + tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000); snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); switch_channel_set_variable(channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); @@ -1610,9 +1557,7 @@ static switch_status_t activate_rtp(private_object_t * tech_pvt) if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) { switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE); - if (switch_rtp_set_remote_address(tech_pvt->rtp_session, - tech_pvt->remote_sdp_audio_ip, - tech_pvt->remote_sdp_audio_port, &err) != SWITCH_STATUS_SUCCESS) { + if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, &err) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP REPORTS ERROR: [%s]\n", err); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP CHANGING DEST TO: [%s:%d]\n", @@ -1631,9 +1576,7 @@ static switch_status_t activate_rtp(private_object_t * tech_pvt) tech_pvt->read_codec.implementation->samples_per_frame, tech_pvt->codec_ms * 1000, (switch_rtp_flag_t) flags, - NULL, - tech_pvt->profile->timer_name, - &err, switch_core_session_get_pool(tech_pvt->session)); + NULL, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)); if (switch_rtp_ready(tech_pvt->rtp_session)) { uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0; @@ -1645,12 +1588,10 @@ static switch_status_t activate_rtp(private_object_t * tech_pvt) switch_set_flag_locked(tech_pvt, TFLAG_IO); 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_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP Engage VAD for %s ( %s %s )\n", - switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), - vad_in ? "in" : "", vad_out ? "out" : ""); + switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : ""); } if (tech_pvt->te) { @@ -1737,8 +1678,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) { char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); if (tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "CODEC NEGOTIATION ERROR"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); return SWITCH_STATUS_FALSE; } @@ -1754,23 +1694,20 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) if (tech_pvt->nh) { if (tech_pvt->local_sdp_str) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", - switch_channel_get_name(channel), tech_pvt->local_sdp_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str); } } } nua_respond(tech_pvt->nh, SIP_200_OK, SIPTAG_CONTACT_STR(tech_pvt->profile->url), - SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), - SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); + SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t sofia_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 sofia_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 = NULL; switch_channel_t *channel = NULL; @@ -1860,8 +1797,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) { frames = (tech_pvt->read_frame.datalen / bytes); } - tech_pvt->read_frame.samples = - (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame); + tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame); } break; } @@ -1881,8 +1817,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f } -static switch_status_t sofia_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 sofia_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; switch_channel_t *channel = NULL; @@ -1929,8 +1864,7 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_ #if 0 printf("%s %s->%s send %d bytes %d samples in %d frames ts=%d\n", switch_channel_get_name(channel), - tech_pvt->local_sdp_audio_ip, - tech_pvt->remote_sdp_audio_ip, frame->datalen, samples, frames, tech_pvt->timestamp_send); + tech_pvt->local_sdp_audio_ip, tech_pvt->remote_sdp_audio_ip, frame->datalen, samples, frames, tech_pvt->timestamp_send); #endif tech_pvt->timestamp_send += samples; @@ -2014,9 +1948,7 @@ static switch_status_t sofia_send_dtmf(switch_core_session_t *session, char *dig assert(tech_pvt != NULL); return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, - digits, - tech_pvt->profile->dtmf_duration * - (tech_pvt->read_codec.implementation->samples_per_second / 1000)); + digits, tech_pvt->profile->dtmf_duration * (tech_pvt->read_codec.implementation->samples_per_second / 1000)); } @@ -2098,11 +2030,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi private_object_t *b_tech_pvt = switch_core_session_get_private(b_session); switch_set_flag_locked(a_tech_pvt, TFLAG_REINVITE); - a_tech_pvt->remote_sdp_audio_ip = - switch_core_session_strdup(a_session, b_tech_pvt->remote_sdp_audio_ip); + a_tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(a_session, b_tech_pvt->remote_sdp_audio_ip); a_tech_pvt->remote_sdp_audio_port = b_tech_pvt->remote_sdp_audio_port; - a_tech_pvt->local_sdp_audio_ip = - switch_core_session_strdup(a_session, b_tech_pvt->local_sdp_audio_ip); + a_tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(a_session, b_tech_pvt->local_sdp_audio_ip); a_tech_pvt->local_sdp_audio_port = b_tech_pvt->local_sdp_audio_port; activate_rtp(a_tech_pvt); @@ -2151,8 +2081,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) { char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); if (tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "CODEC NEGOTIATION ERROR"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); return SWITCH_STATUS_FALSE; } @@ -2165,16 +2094,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi set_local_sdp(tech_pvt, NULL, 0, NULL, 0); activate_rtp(tech_pvt); if (tech_pvt->local_sdp_str) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", - tech_pvt->local_sdp_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str); } } nua_respond(tech_pvt->nh, SIP_183_SESSION_PROGRESS, SIPTAG_CONTACT_STR(tech_pvt->profile->url), - SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), - SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END()); + SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END()); } } break; @@ -2206,8 +2133,7 @@ static switch_status_t sofia_receive_event(switch_core_session_t *session, switc if (tech_pvt->hash_key) { msg_nh = nua_handle(tech_pvt->profile->nua, NULL, SIPTAG_FROM_STR(tech_pvt->chat_from), - NUTAG_URL(tech_pvt->chat_to), - SIPTAG_TO_STR(tech_pvt->chat_to), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); + NUTAG_URL(tech_pvt->chat_to), SIPTAG_TO_STR(tech_pvt->chat_to), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR("text/html"), SIPTAG_PAYLOAD_STR(body), TAG_END()); } @@ -2251,8 +2177,7 @@ static const switch_chat_interface_t sofia_chat_interface = { }; -static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, - switch_size_t datalen) +static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen) { return SWITCH_STATUS_SUCCESS; } @@ -2308,8 +2233,7 @@ static void logger(void *logarg, char const *fmt, va_list ap) static switch_call_cause_t sofia_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_caller_profile_t *outbound_profile, switch_core_session_t **new_session, switch_memory_pool_t ** pool) { switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; switch_core_session_t *nsession; @@ -2404,8 +2328,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session tech_pvt->dest = switch_core_session_strdup(nsession, buf); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, - host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, host); cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION; terminate_session(&nsession, cause, __LINE__); goto done; @@ -2417,8 +2340,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session tech_pvt->dest = switch_core_session_strdup(nsession, buf); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, - profile_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, profile_name); cause = SWITCH_CAUSE_NO_ROUTE_DESTINATION; terminate_session(&nsession, cause, __LINE__); goto done; @@ -2516,8 +2438,7 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp } if (!connection) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Cannot find a c= line in the sdp at media or session level!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find a c= line in the sdp at media or session level!\n"); match = 0; break; } @@ -2542,8 +2463,7 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp if (!cng_pt && !strcasecmp(rm_encoding, "CN")) { cng_pt = tech_pvt->cng_pt = (switch_payload_t) map->rm_pt; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", - cng_pt); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt); if (tech_pvt->rtp_session) { switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt); switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTO_CNG); @@ -2586,8 +2506,7 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp char tmp[80]; int num; - snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", - near_match->iananame, near_match->samples_per_second, ptime); + snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime); prefs[0] = tmp; num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1); @@ -2609,14 +2528,12 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp tech_pvt->pt = (switch_payload_t) map->rm_pt; tech_pvt->rm_rate = map->rm_rate; tech_pvt->codec_ms = mimp->microseconds_per_frame / 1000; - tech_pvt->remote_sdp_audio_ip = - switch_core_session_strdup(session, (char *) connection->c_address); + tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *) connection->c_address); tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp); tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port; tech_pvt->agreed_pt = (switch_payload_t) map->rm_pt; snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); - switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, - tech_pvt->remote_sdp_audio_ip); + switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip); switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); } else { match = 0; @@ -2704,9 +2621,7 @@ static switch_call_cause_t sip_cause_to_freeswitch(int status) static void set_hash_key(char *hash_key, int32_t len, sip_t const *sip) { - snprintf(hash_key, len, "%s%s%s", - (char *) sip->sip_from->a_url->url_user, - (char *) sip->sip_from->a_url->url_host, (char *) sip->sip_to->a_url->url_user); + snprintf(hash_key, len, "%s%s%s", (char *) sip->sip_from->a_url->url_user, (char *) sip->sip_from->a_url->url_host, (char *) sip->sip_to->a_url->url_user); #if 0 @@ -2715,8 +2630,7 @@ static void set_hash_key(char *hash_key, int32_t len, sip_t const *sip) (char *) sip->sip_to->a_url->url_user, (char *) sip->sip_to->a_url->url_host, (char *) sip->sip_to->a_url->url_params, - (char *) sip->sip_from->a_url->url_user, - (char *) sip->sip_from->a_url->url_host, (char *) sip->sip_from->a_url->url_params); + (char *) sip->sip_from->a_url->url_user, (char *) sip->sip_from->a_url->url_host, (char *) sip->sip_from->a_url->url_params); #endif } @@ -2726,13 +2640,11 @@ static void set_chat_hash(private_object_t * tech_pvt, sip_t const *sip) char hash_key[256] = ""; char buf[512]; - if (tech_pvt->hash_key || !sip || !sip->sip_from || - !sip->sip_from->a_url || !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { + if (tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { return; } - if (find_reg_url - (tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) { + if (find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) { tech_pvt->chat_from = sip_header_as_string(tech_pvt->home, (const sip_header_t *) sip->sip_to); tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf); set_hash_key(hash_key, sizeof(hash_key), sip); @@ -2748,9 +2660,7 @@ static void set_chat_hash(private_object_t * tech_pvt, sip_t const *sip) static void sip_i_message(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { if (sip) { sip_from_t const *from = sip->sip_from; @@ -2847,8 +2757,7 @@ static void sip_i_message(int status, if ((ci = switch_loadable_module_get_chat_interface(proto))) { ci->chat_send(SOFIA_CHAT_PROTO, from_addr, to_addr, "", msg, full_from); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", - proto ? proto : "(none)"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto ? proto : "(none)"); } } @@ -2892,9 +2801,7 @@ static void pass_sdp(private_object_t * tech_pvt, char *sdp) static void sip_i_state(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { const char *l_sdp = NULL, *r_sdp = NULL; int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0; @@ -2925,8 +2832,7 @@ static void sip_i_state(int status, NUTAG_ANSWER_RECV_REF(answer_recv), NUTAG_OFFER_SENT_REF(offer_sent), NUTAG_ANSWER_SENT_REF(answer_sent), - SIPTAG_REPLACES_STR_REF(replaces_str), - SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END()); + SIPTAG_REPLACES_STR_REF(replaces_str), SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END()); if (session) { channel = switch_core_session_get_channel(session); @@ -2988,8 +2894,7 @@ static void sip_i_state(int status, if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) { switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); switch_channel_mark_pre_answered(channel); - if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && - (uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) + if (!switch_channel_test_flag(channel, CF_GEN_RINGBACK) && (uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { @@ -3002,12 +2907,10 @@ static void sip_i_state(int status, goto done; } else { if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "DELAYED NEGOTIATION"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION"); } else { if (tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "CODEC NEGOTIATION ERROR"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); } } @@ -3062,8 +2965,7 @@ static void sip_i_state(int status, && (bnh = nua_handle_by_replaces(nua, replaces))) { sofia_private_t *b_private; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Processing Replaces Attended Transfer\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Processing Replaces Attended Transfer\n"); while (switch_channel_get_state(channel) < CS_EXECUTE) { switch_yield(10000); } @@ -3074,17 +2976,14 @@ static void sip_i_state(int status, if (br_b) { switch_ivr_uuid_bridge(br_a, br_b); - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER"); switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER); } else { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER_ERROR"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } } else { - switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER_ERROR"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } nua_handle_unref(bnh); @@ -3096,8 +2995,7 @@ static void sip_i_state(int status, nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Invite with no SDP activating no-media-mode\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invite with no SDP activating no-media-mode\n"); switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP"); switch_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION); @@ -3259,7 +3157,7 @@ static void sip_i_state(int status, } -static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t len, switch_mutex_t *mutex) +static char *get_auth_data(char *dbname, char *nonce, char *npassword, size_t len, switch_mutex_t * mutex) { switch_core_db_t *db; switch_core_db_stmt_t *stmt; @@ -3329,9 +3227,7 @@ typedef enum { REG_INVITE } sofia_regtype_t; -static uint8_t handle_register(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen) +static uint8_t handle_register(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen) { sip_from_t const *from = NULL; sip_expires_t const *expires = NULL; @@ -3368,8 +3264,7 @@ static uint8_t handle_register(nua_t * nua, } if (!from_user || !from_host) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Can not do authorization without a complete from header\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete from header\n"); nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END()); return 1; } @@ -3395,8 +3290,7 @@ static uint8_t handle_register(nua_t * nua, snprintf(contact_str, sizeof(contact_str), "%s ", display, contact->m_url->url_user, contact->m_url->url_host, port, contact->m_url->url_params); } else { - snprintf(contact_str, sizeof(contact_str), "%s ", - display, contact->m_url->url_user, contact->m_url->url_host, port); + snprintf(contact_str, sizeof(contact_str), "%s ", display, contact->m_url->url_user, contact->m_url->url_host, port); } } @@ -3417,14 +3311,12 @@ static uint8_t handle_register(nua_t * nua, } if (authorization) { - if ((auth_res = - parse_auth(profile, authorization, sip->sip_request->rq_method_name, key, keylen)) == AUTH_STALE) { + if ((auth_res = parse_auth(profile, authorization, sip->sip_request->rq_method_name, key, keylen)) == AUTH_STALE) { stale = 1; } if (auth_res != AUTH_OK && !stale) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", - forbidden ? "forbidden" : "challange", from_user, from_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", from_user, from_host); if (auth_res == AUTH_FORBIDDEN) { nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); } else { @@ -3439,23 +3331,20 @@ static uint8_t handle_register(nua_t * nua, if (switch_xml_locate("directory", "domain", "name", from_host, &xml, &domain, params) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", from_user, - from_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", from_user, from_host); nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_CONTACT(contact), TAG_END()); return 1; } if (!(user = switch_xml_find_child(domain, "user", "id", from_user))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", from_user, - from_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", from_user, from_host); nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_CONTACT(contact), TAG_END()); switch_xml_free(xml); return 1; } if (!(xparams = switch_xml_child(user, "params"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", from_user, - from_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", from_user, from_host); nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_CONTACT(contact), TAG_END()); switch_xml_free(xml); return 1; @@ -3499,21 +3388,15 @@ static uint8_t handle_register(nua_t * nua, sql = switch_mprintf("delete from sip_authentication where user='%q' and host='%q';\n" "insert into sip_authentication values('%q','%q','%q','%q', %ld)", - from_user, - from_host, from_user, from_host, a1_hash, uuid_str, time(NULL) + profile->nonce_ttl); - auth_str = - switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", from_host, uuid_str, - stale ? " stale=\"true\"," : ""); + from_user, from_host, from_user, from_host, a1_hash, uuid_str, time(NULL) + profile->nonce_ttl); + auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", from_host, uuid_str, stale ? " stale=\"true\"," : ""); if (regtype == REG_REGISTER) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", - from_user, from_host); - nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), - TAG_END()); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", from_user, from_host); + nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END()); } else if (regtype == REG_INVITE) { - nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, - NUTAG_WITH_THIS(nua), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END()); + nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, NUTAG_WITH_THIS(nua), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END()); } @@ -3563,8 +3446,7 @@ static uint8_t handle_register(nua_t * nua, } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Register:\nFrom: [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", from_user, from_host, - contact_str, (long) exptime); + "Register:\nFrom: [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", from_user, from_host, contact_str, (long) exptime); if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { @@ -3586,8 +3468,7 @@ static uint8_t handle_register(nua_t * nua, if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, from_user, - from_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, from_user, from_host); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "unavailable"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid); @@ -3721,8 +3602,7 @@ static int sub_callback(void *pArg, int argc, char **argv, char **columnNames) "\r\n" "\r\n" "\r\n" - "\r\n" - "\r\n" "%s\r\n" "", id, open, rpid, note); + "\r\n" "\r\n" "%s\r\n" "", id, open, rpid, note); @@ -3738,8 +3618,7 @@ static int sub_callback(void *pArg, int argc, char **argv, char **columnNames) SIPTAG_CALL_ID_STR(callid), SIPTAG_VIA_STR(full_via), SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=3600"), - SIPTAG_EVENT_STR(event), - SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END()); + SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END()); switch_safe_free(id); switch_safe_free(note); @@ -3751,9 +3630,7 @@ static int sub_callback(void *pArg, int argc, char **argv, char **columnNames) static void sip_i_subscribe(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { if (sip) { long exp, exp_raw; @@ -3800,12 +3677,9 @@ static void sip_i_subscribe(int status, if (contact->m_url->url_params) { contact_str = switch_mprintf("%s ", - display, - contact->m_url->url_user, - contact->m_url->url_host, port, contact->m_url->url_params); + display, contact->m_url->url_user, contact->m_url->url_host, port, contact->m_url->url_params); } else { - contact_str = switch_mprintf("%s ", - display, contact->m_url->url_user, contact->m_url->url_host, port); + contact_str = switch_mprintf("%s ", display, contact->m_url->url_user, contact->m_url->url_host, port); } } @@ -3879,12 +3753,7 @@ static void sip_i_subscribe(int status, from_user, from_host, to_user, - to_host, - event, - proto, - from_user, - from_host, - to_user, to_host, event, contact_str, call_id, full_from, full_via, exp))) { + to_host, event, proto, from_user, from_host, to_user, to_host, event, contact_str, call_id, full_from, full_via, exp))) { execute_sql(profile->dbname, sql, profile->ireg_mutex); switch_safe_free(sql); } @@ -3893,8 +3762,7 @@ static void sip_i_subscribe(int status, nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), - SIPTAG_SUBSCRIPTION_STATE_STR(sstr), - SIPTAG_FROM(sip->sip_to), SIPTAG_TO(sip->sip_from), SIPTAG_CONTACT_STR(to_str), TAG_END()); + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_FROM(sip->sip_to), SIPTAG_TO(sip->sip_from), SIPTAG_CONTACT_STR(to_str), TAG_END()); @@ -3904,8 +3772,7 @@ static void sip_i_subscribe(int status, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname); goto end; } - if ((sql = switch_mprintf("select * from sip_subscriptions where user='%q' and host='%q'", - to_user, to_host, to_user, to_host))) { + if ((sql = switch_mprintf("select * from sip_subscriptions where user='%q' and host='%q'", to_user, to_host, to_user, to_host))) { switch_mutex_lock(profile->ireg_mutex); switch_core_db_exec(db, sql, sub_reg_callback, profile, &errmsg); switch_mutex_unlock(profile->ireg_mutex); @@ -3935,18 +3802,14 @@ static void sip_i_subscribe(int status, static void sip_r_subscribe(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { } /*---------------------------------------*/ -static void sip_i_refer(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) +static void sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) { /* Incoming refer */ sip_from_t const *from; @@ -3967,8 +3830,7 @@ static void sip_i_refer(nua_t * nua, if (switch_channel_test_flag(channel_a, CF_NOMEDIA)) { nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), - NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END()); goto done; } @@ -3982,8 +3844,7 @@ static void sip_i_refer(nua_t * nua, exten = (char *) refer_to->r_url->url_user; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Process REFER to [%s@%s]\n", exten, - (char *) refer_to->r_url->url_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Process REFER to [%s@%s]\n", exten, (char *) refer_to->r_url->url_host); if (refer_to->r_url->url_headers) { sip_replaces_t *replaces; @@ -4021,25 +3882,21 @@ static void sip_i_refer(nua_t * nua, br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE); br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", br_a, - br_b); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", br_a, br_b); if (br_a && br_b) { switch_ivr_uuid_bridge(br_a, br_b); - switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER"); + switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER"); switch_set_flag_locked(tech_pvt, TFLAG_BYE); switch_set_flag_locked(b_tech_pvt, TFLAG_BYE); nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), - NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); } else { if (!br_a && !br_b) { switch_set_flag_locked(tech_pvt, TFLAG_NOHUP); switch_set_flag_locked(b_tech_pvt, TFLAG_XFER); - b_tech_pvt->xferto = - switch_core_session_strdup(b_session, switch_core_session_get_uuid(session)); + b_tech_pvt->xferto = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session)); } else if (!br_a && br_b) { switch_core_session_t *br_b_session; @@ -4054,17 +3911,14 @@ static void sip_i_refer(nua_t * nua, switch_channel_set_state(br_b_channel, CS_TRANSMIT); switch_set_flag_locked(tech_pvt, TFLAG_REINVITE); - tech_pvt->local_sdp_audio_ip = - switch_core_session_strdup(session, b_tech_pvt->local_sdp_audio_ip); + tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(session, b_tech_pvt->local_sdp_audio_ip); tech_pvt->local_sdp_audio_port = b_tech_pvt->local_sdp_audio_port; - tech_pvt->remote_sdp_audio_ip = - switch_core_session_strdup(session, br_b_tech_pvt->remote_sdp_audio_ip); + tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, br_b_tech_pvt->remote_sdp_audio_ip); tech_pvt->remote_sdp_audio_port = br_b_tech_pvt->remote_sdp_audio_port; activate_rtp(tech_pvt); - br_b_tech_pvt->kick = - switch_core_session_strdup(br_b_session, switch_core_session_get_uuid(session)); + br_b_tech_pvt->kick = switch_core_session_strdup(br_b_session, switch_core_session_get_uuid(session)); switch_core_session_rwunlock(br_b_session); @@ -4074,8 +3928,7 @@ static void sip_i_refer(nua_t * nua, } switch_set_flag_locked(tech_pvt, TFLAG_BYE); nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), - NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); } if (b_session) { @@ -4098,35 +3951,26 @@ static void sip_i_refer(nua_t * nua, exten = switch_mprintf("sofia/%s/%s@%s:%s", profile->name, - (char *) refer_to->r_url->url_user, - (char *) refer_to->r_url->url_host, refer_to->r_url->url_port); + (char *) refer_to->r_url->url_user, (char *) refer_to->r_url->url_host, refer_to->r_url->url_port); switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, rep); if (switch_ivr_originate(a_session, - &tsession, - &cause, - exten, - timeout, - &noop_state_handler, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Cannot Create Outgoing Channel! [%s]\n", exten); + &tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", exten); nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), - TAG_END()); + SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END()); goto done; } switch_core_session_rwunlock(a_session); tuuid_str = switch_core_session_get_uuid(tsession); switch_ivr_uuid_bridge(br_a, tuuid_str); - switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER"); + switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER"); switch_set_flag_locked(tech_pvt, TFLAG_BYE); nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), - NUTAG_SUBSTATE(nua_substate_terminated), - SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END()); } else { goto error; } @@ -4134,11 +3978,9 @@ static void sip_i_refer(nua_t * nua, } else { error: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Transfer! [%s]\n", br_a); - switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, - "ATTENDED_TRANSFER_ERROR"); + switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR"); nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), - NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), - SIPTAG_EVENT_STR(etmp), TAG_END()); + NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END()); } } } else { @@ -4175,9 +4017,7 @@ static void sip_i_refer(nua_t * nua, TAG_END()); */ } else { - exten = switch_mprintf("sip:%s@%s:%s", - (char *) refer_to->r_url->url_user, - (char *) refer_to->r_url->url_host, refer_to->r_url->url_port); + exten = switch_mprintf("sip:%s@%s:%s", (char *) refer_to->r_url->url_user, (char *) refer_to->r_url->url_host, refer_to->r_url->url_port); tech_pvt->dest = switch_core_session_strdup(session, exten); @@ -4207,9 +4047,7 @@ static void sip_i_refer(nua_t * nua, } -static void sip_i_publish(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) +static void sip_i_publish(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { if (sip) { sip_from_t const *from = sip->sip_from; @@ -4308,9 +4146,7 @@ static void sip_i_publish(nua_t * nua, } -static void sip_i_info(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) +static void sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) { //placeholder for string searching @@ -4356,8 +4192,7 @@ static void sip_i_info(nua_t * nua, //print in the logs if something comes through we don't understand switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown INFO Recieved: %s%s" URL_PRINT_FORMAT "[%s]\n", - from->a_display ? from->a_display : "", from->a_display ? " " : "", - URL_PRINT_ARGS(from->a_url), sip->sip_payload->pl_data); + from->a_display ? from->a_display : "", from->a_display ? " " : "", URL_PRINT_ARGS(from->a_url), sip->sip_payload->pl_data); } return; @@ -4446,9 +4281,7 @@ static void process_rpid(sip_unknown_t * un, private_object_t * tech_pvt) } } -static void sip_i_invite(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) +static void sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { switch_core_session_t *session = NULL; char key[128] = ""; @@ -4498,8 +4331,7 @@ static void sip_i_invite(nua_t * nua, tech_pvt->key = switch_core_session_strdup(session, key); } - get_addr(network_ip, sizeof(network_ip), - &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr); + get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr); channel = switch_core_session_get_channel(session); @@ -4612,10 +4444,7 @@ static void sip_i_invite(nua_t * nua, tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), from_user, profile->dialplan, - displayname, - from_user, - network_ip, - NULL, NULL, NULL, modname, context, destination_number); + displayname, from_user, network_ip, NULL, NULL, NULL, modname, context, destination_number); if (tech_pvt->caller_profile) { @@ -4645,15 +4474,12 @@ static void sip_i_invite(nua_t * nua, abort(); } memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private)); - switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), - sizeof(tech_pvt->sofia_private->uuid)); + switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid)); nua_handle_bind(nh, tech_pvt->sofia_private); tech_pvt->nh = nh; } -static void sip_i_register(nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) +static void sip_i_register(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { char key[128] = ""; @@ -4675,9 +4501,7 @@ static void sip_i_register(nua_t * nua, static void sip_i_options(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { nua_respond(nh, SIP_200_OK, //SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), @@ -4689,9 +4513,7 @@ static void sip_i_options(int status, static void sip_r_register(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { if (sofia_private && sofia_private->gateway) { switch (status) { @@ -4703,8 +4525,7 @@ static void sip_r_register(int status, if (expi != sofia_private->gateway->freq) { sofia_private->gateway->freq = expi; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Changing expire time to %d by request of proxy %s\n", expi, - sofia_private->gateway->register_proxy); + "Changing expire time to %d by request of proxy %s\n", expi, sofia_private->gateway->register_proxy); } } @@ -4722,9 +4543,7 @@ static void sip_r_register(int status, static void sip_r_challenge(int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) { outbound_reg_t *gateway = NULL; sip_www_authenticate_t const *authenticate = NULL; @@ -4805,8 +4624,7 @@ static void sip_r_challenge(int status, } if (!gateway) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, - qrealm); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Match for Scheme [%s] Realm [%s]\n", scheme, qrealm); return; } switch_safe_free(duprealm); @@ -4816,11 +4634,9 @@ static void sip_r_challenge(int status, } } - snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, - gateway->register_username, gateway->register_password); + snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", - profile->username, authentication); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication); ss_state = nua_callstate_authenticating; @@ -4834,9 +4650,7 @@ static void sip_r_challenge(int status, static void event_callback(nua_event_t event, int status, char const *phrase, - nua_t * nua, - sofia_profile_t * profile, - nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) + nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]) { struct private_object *tech_pvt = NULL; auth_res_t auth_res = AUTH_FORBIDDEN; @@ -4879,9 +4693,7 @@ static void event_callback(nua_event_t event, } if (authorization) { - auth_res = - parse_auth(profile, authorization, (char *) sip->sip_request->rq_method_name, tech_pvt->key, - strlen(tech_pvt->key)); + auth_res = parse_auth(profile, authorization, (char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key)); } if (auth_res != AUTH_OK) { @@ -4965,11 +4777,9 @@ static void event_callback(nua_event_t event, break; default: if (status > 100) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: unknown event %d: %03d %s\n", - nua_event_name(event), event, status, phrase); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: unknown event %d: %03d %s\n", nua_event_name(event), event, status, phrase); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: unknown event %d\n", nua_event_name(event), - event); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: unknown event %d\n", nua_event_name(event), event); } break; } @@ -5012,8 +4822,7 @@ static void check_gateway(sofia_profile_t * profile, time_t now) if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL, NUTAG_URL(gateway_ptr->register_proxy), SIPTAG_TO_STR(gateway_ptr->register_to), - NUTAG_CALLSTATE_REF(ss_state), - SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) { + NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registering %s\n", gateway_ptr->name); if (!(gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private)))) { @@ -5029,8 +4838,7 @@ static void check_gateway(sofia_profile_t * profile, time_t now) SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gateway_ptr->expires_str), NUTAG_REGISTRAR(gateway_ptr->register_proxy), - NUTAG_OUTBOUND("no-options-keepalive"), - NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); + NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); gateway_ptr->retry = now + 10; gateway_ptr->state = REG_STATE_TRYING; } else { @@ -5057,7 +4865,7 @@ static void check_gateway(sofia_profile_t * profile, time_t now) #define IREG_SECONDS 30 #define GATEWAY_SECONDS 1 -static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t * thread, void *obj) { sofia_profile_t *profile = (sofia_profile_t *) obj; switch_memory_pool_t *pool; @@ -5106,8 +4914,7 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void NUTAG_ALLOW("INFO"), TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")), TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)), - SIPTAG_SUPPORTED_STR("100rel, precondition"), - SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT), TAG_END()); + SIPTAG_SUPPORTED_STR("100rel, precondition"), SIPTAG_USER_AGENT_STR(SOFIA_USER_AGENT), TAG_END()); } @@ -5293,14 +5100,11 @@ static switch_status_t config_sofia(int reload) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val); } } else if (!strcasecmp(var, "ext-rtp-ip")) { - profile->extrtpip = - switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); + profile->extrtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); } else if (!strcasecmp(var, "rtp-ip")) { - profile->rtpip = - switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); + profile->rtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); } else if (!strcasecmp(var, "sip-ip")) { - profile->sipip = - switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); + profile->sipip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip); } else if (!strcasecmp(var, "ext-sip-ip")) { if (!strcasecmp(val, "auto")) { profile->extsipip = switch_core_strdup(profile->pool, globals.guess_ip); @@ -5425,12 +5229,10 @@ static switch_status_t config_sofia(int reload) profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip); } if (profile->extsipip) { - profile->url = - switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->sip_port); + profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->sip_port); profile->bindurl = switch_core_sprintf(profile->pool, "%s;maddr=%s", profile->url, profile->sipip); } else { - profile->url = - switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port); + profile->url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->sip_port); profile->bindurl = profile->url; } } @@ -5441,8 +5243,7 @@ static switch_status_t config_sofia(int reload) } if ((gateways_tag = switch_xml_child(xprofile, "gateways"))) { - for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; - gateway_tag = gateway_tag->next) { + for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) { char *name = (char *) switch_xml_attr_soft(gateway_tag, "name"); outbound_reg_t *gateway; @@ -5453,9 +5254,7 @@ static switch_status_t config_sofia(int reload) if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) { char *scheme = "Digest", *realm = NULL, - *username = NULL, - *password = NULL, - *extension = NULL, *proxy = NULL, *context = "default", *expire_seconds = "3600"; + *username = NULL, *password = NULL, *extension = NULL, *proxy = NULL, *context = "default", *expire_seconds = "3600"; gateway->pool = profile->pool; gateway->profile = profile; @@ -5491,15 +5290,13 @@ static switch_status_t config_sofia(int reload) } if (switch_strlen_zero(username)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "ERROR: username param is REQUIRED!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: username param is REQUIRED!\n"); switch_xml_free(xml); goto skip; } if (switch_strlen_zero(password)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "ERROR: password param is REQUIRED!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: password param is REQUIRED!\n"); switch_xml_free(xml); goto skip; } @@ -5518,14 +5315,11 @@ static switch_status_t config_sofia(int reload) gateway->register_username = switch_core_strdup(gateway->pool, username); gateway->register_password = switch_core_strdup(gateway->pool, password); gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, realm); - gateway->register_contact = switch_core_sprintf(gateway->pool, - "sip:%s@%s:%d", extension, profile->sipip, - profile->sip_port); + gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, profile->sipip, profile->sip_port); if (!strncasecmp(proxy, "sip:", 4)) { gateway->register_proxy = switch_core_strdup(gateway->pool, proxy); - gateway->register_to = - switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4); + gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4); } else { gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy); gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy); @@ -5535,8 +5329,7 @@ static switch_status_t config_sofia(int reload) if ((gateway->freq = atoi(gateway->expires_str)) < 5) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Invalid Freq: %d. Setting Register-Frequency to 3600\n", - gateway->freq); + "Invalid Freq: %d. Setting Register-Frequency to 3600\n", gateway->freq); gateway->freq = 3600; } gateway->freq -= 2; @@ -5545,14 +5338,11 @@ static switch_status_t config_sofia(int reload) profile->gateways = gateway; if (find_gateway(gateway->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Ignoring duplicate gateway '%s'\n", gateway->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", gateway->name); } else if (find_gateway(gateway->register_from)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Ignoring duplicate uri '%s'\n", gateway->register_from); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate uri '%s'\n", gateway->register_from); } else if (find_gateway(gateway->register_contact)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Ignoring duplicate contact '%s'\n", gateway->register_from); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate contact '%s'\n", gateway->register_from); } else { add_gateway(gateway->name, gateway); add_gateway(gateway->register_from, gateway); @@ -5566,12 +5356,10 @@ static switch_status_t config_sofia(int reload) } if (profile->sipip) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, - url); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url); launch_profile_thread(profile); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Unable to start Profile %s due to no configured sip-ip\n", profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Unable to start Profile %s due to no configured sip-ip\n", profile->name); } profile = NULL; } @@ -5626,8 +5414,7 @@ static void event_handler(switch_event_t *event) execute_sql(profile->dbname, sql, profile->ireg_mutex); switch_safe_free(sql); sql = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Propagating registration for %s@%s->%s\n", - from_user, from_host, contact_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Propagating registration for %s@%s->%s\n", from_user, from_host, contact_str); } @@ -5709,8 +5496,7 @@ static void cancel_presence(void) if ((sql = switch_mprintf("select 0,'unavailable','unavailable',* from sip_subscriptions where event='presence'"))) { switch_mutex_lock(globals.hash_mutex); - 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)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { @@ -5839,17 +5625,13 @@ static void pres_event_handler(switch_event_t *event) if (event->event_id == SWITCH_EVENT_ROSTER) { if (from) { - sql = - switch_mprintf - ("select 1,'%q','%q',* from sip_subscriptions where event='presence' and full_from like '%%%q%%'", - status, rpid, from); + sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from); } else { sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where event='presence'", status, rpid); } switch_mutex_lock(globals.hash_mutex); - 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)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { @@ -5955,8 +5737,7 @@ static void pres_event_handler(switch_event_t *event) } switch_mutex_lock(globals.hash_mutex); - 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)) { switch_hash_this(hi, NULL, NULL, &val); profile = (sofia_profile_t *) val; if (!(profile->pflags & PFLAG_PRESENCE)) { @@ -5982,8 +5763,7 @@ static void pres_event_handler(switch_event_t *event) } -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) { silence_frame.data = silence_data; @@ -6002,8 +5782,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), AF_INET); - if (switch_event_bind((char *) modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != - SWITCH_STATUS_SUCCESS) { + if (switch_event_bind((char *) modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); return SWITCH_STATUS_TERM; } @@ -6019,29 +5798,22 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod config_sofia(0); - 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_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; } - 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_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != - SWITCH_STATUS_SUCCESS) { + if (switch_event_bind((char *) modname, SWITCH_EVENT_ROSTER, 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; } diff --git a/src/mod/endpoints/mod_wanpipe/libsangoma/g711.h b/src/mod/endpoints/mod_wanpipe/libsangoma/g711.h index 390e53eed0..73533d77c3 100644 --- a/src/mod/endpoints/mod_wanpipe/libsangoma/g711.h +++ b/src/mod/endpoints/mod_wanpipe/libsangoma/g711.h @@ -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) diff --git a/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c b/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c index 43fecb2f2a..f0c9014700 100644 --- a/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c +++ b/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c @@ -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; diff --git a/src/mod/endpoints/mod_wanpipe/libsangoma/sangoma_pri.c b/src/mod/endpoints/mod_wanpipe/libsangoma/sangoma_pri.c index b631247c58..b459edd65a 100644 --- a/src/mod/endpoints/mod_wanpipe/libsangoma/sangoma_pri.c +++ b/src/mod/endpoints/mod_wanpipe/libsangoma/sangoma_pri.c @@ -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); diff --git a/src/mod/endpoints/mod_wanpipe/libsangoma/win_api_common.h b/src/mod/endpoints/mod_wanpipe/libsangoma/win_api_common.h index 962f41db1c..05dab420eb 100644 --- a/src/mod/endpoints/mod_wanpipe/libsangoma/win_api_common.h +++ b/src/mod/endpoints/mod_wanpipe/libsangoma/win_api_common.h @@ -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; diff --git a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c index 7f0327a9bb..f3cd9f83fe 100644 --- a/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c +++ b/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c @@ -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; } diff --git a/src/mod/endpoints/mod_wanpipe/ss7boost_client.c b/src/mod/endpoints/mod_wanpipe/ss7boost_client.c index da8b28503c..241604a505 100644 --- a/src/mod/endpoints/mod_wanpipe/ss7boost_client.c +++ b/src/mod/endpoints/mod_wanpipe/ss7boost_client.c @@ -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; diff --git a/src/mod/endpoints/mod_wanpipe/ss7boost_client.h b/src/mod/endpoints/mod_wanpipe/ss7boost_client.h index 80d530e501..d3bb6e08a6 100644 --- a/src/mod/endpoints/mod_wanpipe/ss7boost_client.h +++ b/src/mod/endpoints/mod_wanpipe/ss7boost_client.h @@ -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 diff --git a/src/mod/endpoints/mod_woomera/mod_woomera.c b/src/mod/endpoints/mod_woomera/mod_woomera.c index 63c79cd9e8..efa3a25fda 100644 --- a/src/mod/endpoints/mod_woomera/mod_woomera.c +++ b/src/mod/endpoints/mod_woomera/mod_woomera.c @@ -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; diff --git a/src/mod/event_handlers/mod_cdr/cdrcontainer.h b/src/mod/event_handlers/mod_cdr/cdrcontainer.h index 7e6c7d8e9c..65511df1fd 100644 --- a/src/mod/event_handlers/mod_cdr/cdrcontainer.h +++ b/src/mod/event_handlers/mod_cdr/cdrcontainer.h @@ -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 diff --git a/src/mod/event_handlers/mod_cdr/mysqlcdr.h b/src/mod/event_handlers/mod_cdr/mysqlcdr.h index 6398578c0b..b8cc8791f8 100644 --- a/src/mod/event_handlers/mod_cdr/mysqlcdr.h +++ b/src/mod/event_handlers/mod_cdr/mysqlcdr.h @@ -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(); }; diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index b390873dd6..50a0616e51 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -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; diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index d0f1f32bca..327eff0bda 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -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; } diff --git a/src/mod/event_handlers/mod_event_test/mod_event_test.c b/src/mod/event_handlers/mod_event_test/mod_event_test.c index 183bb76072..d5d1524393 100644 --- a/src/mod/event_handlers/mod_event_test/mod_event_test.c +++ b/src/mod/event_handlers/mod_event_test/mod_event_test.c @@ -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; } diff --git a/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c b/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c index afee00b108..460fa7f7ac 100644 --- a/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c +++ b/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c @@ -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; diff --git a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c index a9d707c2a8..99b19836ce 100644 --- a/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c +++ b/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c @@ -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)); diff --git a/src/mod/formats/mod_native_file/mod_native_file.c b/src/mod/formats/mod_native_file/mod_native_file.c index c180c5c8be..c33b0872ce 100644 --- a/src/mod/formats/mod_native_file/mod_native_file.c +++ b/src/mod/formats/mod_native_file/mod_native_file.c @@ -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]; diff --git a/src/mod/formats/mod_shout/common.c b/src/mod/formats/mod_shout/common.c index 62ef6df6f8..a0a1f90424 100644 --- a/src/mod/formats/mod_shout/common.c +++ b/src/mod/formats/mod_shout/common.c @@ -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 diff --git a/src/mod/formats/mod_shout/layer3.c b/src/mod/formats/mod_shout/layer3.c index 14153a8f64..ec8eeda77a 100644 --- a/src/mod/formats/mod_shout/layer3.c +++ b/src/mod/formats/mod_shout/layer3.c @@ -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; diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 0141e5a6fe..b05fbd4dbc 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -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"; diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 84dbc07442..a453b0dcdd 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -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) { diff --git a/src/mod/languages/mod_mono/mod_mono.c b/src/mod/languages/mod_mono/mod_mono.c index 79991034cc..c9de8e3a73 100755 --- a/src/mod/languages/mod_mono/mod_mono.c +++ b/src/mod/languages/mod_mono/mod_mono.c @@ -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); } diff --git a/src/mod/languages/mod_perl/mod_perl.c b/src/mod/languages/mod_perl/mod_perl.c index cde3560d2a..d54d50d6f5 100644 --- a/src/mod/languages/mod_perl/mod_perl.c +++ b/src/mod/languages/mod_perl/mod_perl.c @@ -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; diff --git a/src/mod/languages/mod_perl/switch_swig_wrap.c b/src/mod/languages/mod_perl/switch_swig_wrap.c index d06d97f523..e662c71c0a 100644 --- a/src/mod/languages/mod_perl/switch_swig_wrap.c +++ b/src/mod/languages/mod_perl/switch_swig_wrap.c @@ -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} }; diff --git a/src/mod/languages/mod_python/freeswitch_python.h b/src/mod/languages/mod_python/freeswitch_python.h index 87799e4670..98282dbe57 100644 --- a/src/mod/languages/mod_python/freeswitch_python.h +++ b/src/mod/languages/mod_python/freeswitch_python.h @@ -10,8 +10,7 @@ extern "C" { #include 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: diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index ce309dc06c..6e00bfcf90 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -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; diff --git a/src/mod/languages/mod_python/switch_swig_wrap.c b/src/mod/languages/mod_python/switch_swig_wrap.c index ade2ceb380..347013f4e0 100644 --- a/src/mod/languages/mod_python/switch_swig_wrap.c +++ b/src/mod/languages/mod_python/switch_swig_wrap.c @@ -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("", result) : 0; + return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? PyString_FromFormat("", 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(""); - } - 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; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 643d5ac87d..745a7f0199 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -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; diff --git a/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c index 93632230a2..bf074ec9a5 100644 --- a/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c +++ b/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c @@ -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; } diff --git a/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c index 23a05a5568..13ec900692 100644 --- a/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c +++ b/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c @@ -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); diff --git a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c index b5e9d973c8..2a155a8481 100644 --- a/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c +++ b/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c @@ -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; } diff --git a/src/mod/loggers/mod_console/mod_console.c b/src/mod/loggers/mod_console/mod_console.c index b3db9e41f6..0969cb527c 100644 --- a/src/mod/loggers/mod_console/mod_console.c +++ b/src/mod/loggers/mod_console/mod_console.c @@ -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"); diff --git a/src/mod/loggers/mod_syslog/mod_syslog.c b/src/mod/loggers/mod_syslog/mod_syslog.c index e1c9f05379..1e8d65ecc3 100644 --- a/src/mod/loggers/mod_syslog/mod_syslog.c +++ b/src/mod/loggers/mod_syslog/mod_syslog.c @@ -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; diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 2de428ff37..c3a9bc823d 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -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; diff --git a/src/mod/timers/mod_softtimer/mod_softtimer.c b/src/mod/timers/mod_softtimer/mod_softtimer.c index cba5d41edb..b3a3f64261 100644 --- a/src/mod/timers/mod_softtimer/mod_softtimer.c +++ b/src/mod/timers/mod_softtimer/mod_softtimer.c @@ -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) { diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 5ec71ee068..03643274a1 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -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); diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 681c45d186..5f93d16c9b 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -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; diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 77188f30cb..c6dcd2c99e 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -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); } diff --git a/src/switch.c b/src/switch.c index 8fcc3d19fa..8df7a8a6d8 100644 --- a/src/switch.c +++ b/src/switch.c @@ -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")) { diff --git a/src/switch_apr.c b/src/switch_apr.c index 7d143351e2..8e7f38f896 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -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); } diff --git a/src/switch_buffer.c b/src/switch_buffer.c index 78e2a94f83..df352871fe 100644 --- a/src/switch_buffer.c +++ b/src/switch_buffer.c @@ -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; diff --git a/src/switch_caller.c b/src/switch_caller.c index 2454da31f0..49c461113a 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -32,7 +32,7 @@ #include #include -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, @@ -40,9 +40,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) { @@ -70,8 +68,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor } -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) { switch_caller_profile_t *profile = NULL; if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile_t))) != 0) { @@ -138,8 +135,7 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t * return NULL; } -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) { char header_name[1024]; @@ -198,23 +194,19 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_ } snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, - switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no"); snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, - switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no"); snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, - switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no"); } -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) { switch_caller_extension_t *caller_extension = NULL; @@ -229,8 +221,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_c SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session, - switch_caller_extension_t *caller_extension, - char *application_name, char *application_data) + switch_caller_extension_t *caller_extension, char *application_name, char *application_data) { switch_caller_application_t *caller_application = NULL; diff --git a/src/switch_channel.c b/src/switch_channel.c index 2396d3811e..321aa1436f 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -165,7 +165,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch return times; } -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) { assert(pool != NULL); @@ -259,9 +259,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel) switch_buffer_destroy(&channel->dtmf_buffer); } -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) { assert(channel != NULL); channel->state = state; @@ -319,8 +317,7 @@ SWITCH_DECLARE(char *) switch_channel_get_variable(switch_channel_t *channel, ch return v; } -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) { assert(channel != NULL); return switch_hash_first(pool, channel->variables); @@ -358,16 +355,14 @@ SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel) return channel->name ? channel->name : "N/A"; } -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) { assert(channel != NULL); if (varname) { switch_core_hash_delete(channel->variables, varname); if (!switch_strlen_zero(value)) { - switch_core_hash_insert_dup(channel->variables, varname, - switch_core_session_strdup(channel->session, value)); + switch_core_hash_insert_dup(channel->variables, varname, switch_core_session_strdup(channel->session, value)); } else { switch_core_hash_delete(channel->variables, varname); } @@ -377,8 +372,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch return SWITCH_STATUS_FALSE; } -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) { assert(channel != NULL); @@ -438,8 +432,7 @@ SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel) { assert(channel != NULL); - return (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP - && !switch_test_flag(channel, CF_TRANSFER)) ? 1 : 0; + return (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && !switch_test_flag(channel, CF_TRANSFER)) ? 1 : 0; } static const char *state_names[] = { @@ -475,9 +468,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_name_state(char *name) } 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) { switch_channel_state_t last_state; int ok = 0; @@ -652,14 +643,10 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c } else { char state_num[25]; snprintf(state_num, sizeof(state_num), "%d", channel->state); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", - (char *) switch_channel_state_name(channel->state)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", - (char *) state_num); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", - switch_channel_get_name(channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", - switch_core_session_get_uuid(channel->session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", (char *) switch_channel_state_name(channel->state)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session)); } switch_event_fire(&event); } @@ -671,8 +658,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c } else { switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_WARNING, - "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], - state_names[state]); + "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]); /* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */ if (channel->state < CS_HANGUP) { @@ -705,26 +691,20 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw originatee_caller_profile = caller_profile->originatee_caller_profile; } - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", - switch_channel_state_name(channel->state)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", switch_channel_state_name(channel->state)); snprintf(state_num, sizeof(state_num), "%d", channel->state); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", state_num); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", - switch_core_session_get_uuid(channel->session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session)); if ((codec = switch_core_session_get_read_codec(channel->session))) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", - switch_str_nil(codec->implementation->iananame)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", - codec->implementation->samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->samples_per_second); } if ((codec = switch_core_session_get_write_codec(channel->session))) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", - switch_str_nil(codec->implementation->iananame)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", - codec->implementation->samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->samples_per_second); } /* Index Caller's Profile */ @@ -743,8 +723,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw } /* Index Variables */ - for (hi = switch_hash_first(switch_core_session_get_pool(channel->session), channel->variables); hi; - hi = switch_hash_next(hi)) { + for (hi = switch_hash_first(switch_core_session_get_pool(channel->session), channel->variables); hi; hi = switch_hash_next(hi)) { char buf[1024]; switch_hash_this(hi, &var, NULL, &val); if (var && val) { @@ -757,8 +736,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw } -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) { assert(channel != NULL); assert(channel->session != NULL); @@ -766,8 +744,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel assert(caller_profile != NULL); if (!caller_profile->uuid) { - caller_profile->uuid = - switch_core_session_strdup(channel->session, switch_core_session_get_uuid(channel->session)); + caller_profile->uuid = switch_core_session_strdup(channel->session, switch_core_session_get_uuid(channel->session)); } if (!caller_profile->chan_name) { @@ -787,8 +764,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel } } - caller_profile->times = - (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times)); + caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times)); caller_profile->times->created = switch_time_now(); if (channel->caller_profile && channel->caller_profile->times) { @@ -814,8 +790,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit return profile; } -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) { assert(channel != NULL); if (channel->caller_profile) { @@ -826,8 +801,7 @@ SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel } } -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) { assert(channel != NULL); if (channel->caller_profile) { @@ -873,8 +847,7 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel) return switch_core_session_get_uuid(channel->session); } -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) { int x, index; @@ -900,8 +873,7 @@ SWITCH_DECLARE(int) switch_channel_add_state_handler(switch_channel_t *channel, return index; } -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) { const switch_state_handler_table_t *h = NULL; @@ -918,8 +890,7 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_channel_get_state_ha return h; } -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) { int index, i = channel->state_handler_index; const switch_state_handler_table_t *new_handlers[SWITCH_MAX_STATE_HANDLERS] = { 0 }; @@ -951,8 +922,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channe } -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) { assert(channel != NULL); @@ -978,9 +948,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension( 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) { assert(channel != NULL); switch_mutex_lock(channel->flag_mutex); @@ -999,8 +967,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n", channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause)); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", - switch_channel_cause2str(channel->hangup_cause)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause)); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } @@ -1017,12 +984,10 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan } -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) { if (!switch_channel_test_flag(channel, CF_RING_READY)) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", - channel->name); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name); switch_channel_set_flag(channel, CF_RING_READY); return SWITCH_STATUS_SUCCESS; } @@ -1032,8 +997,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_ch -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_event_t *event; @@ -1043,8 +1007,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ char *uuid; switch_core_session_t *other_session; - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", - channel->name); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name); switch_channel_set_flag(channel, CF_EARLY_MEDIA); switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA"); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) { @@ -1066,8 +1029,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ return SWITCH_STATUS_FALSE; } -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_core_session_message_t msg; char *uuid = switch_core_session_get_uuid(channel->session); @@ -1098,8 +1060,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel return status; } -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) { switch_core_session_message_t msg; char *uuid = switch_core_session_get_uuid(channel->session); @@ -1124,15 +1085,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel status = switch_core_session_message_send(uuid, &msg); if (status == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", - channel->name); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name); } return status; } -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) { switch_event_t *event; char *uuid; @@ -1171,14 +1130,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan } switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER"); - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", - channel->name); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name); return SWITCH_STATUS_SUCCESS; } -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) { assert(channel != NULL); diff --git a/src/switch_config.c b/src/switch_config.c index c74475242f..aa4d16bb90 100644 --- a/src/switch_config.c +++ b/src/switch_config.c @@ -32,7 +32,7 @@ #include #include -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) { FILE *f; char *path = NULL; @@ -57,8 +57,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat int last = -1; char *var, *val; - snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, - SWITCH_PATH_SEPARATOR); + snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR); path = path_buf; if ((f = fopen(path, "r")) == 0) { @@ -89,7 +88,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_pat } -SWITCH_DECLARE(void) switch_config_close_file(switch_config_t *cfg) +SWITCH_DECLARE(void) switch_config_close_file(switch_config_t * cfg) { if (cfg->file) { @@ -101,7 +100,7 @@ SWITCH_DECLARE(void) switch_config_close_file(switch_config_t *cfg) -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) { int ret = 0; char *p, *end; diff --git a/src/switch_console.c b/src/switch_console.c index 2f4ece09d7..7b8be2d8c5 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -114,8 +114,7 @@ static int switch_console_process(char *cmd) SWITCH_STANDARD_STREAM(stream); if (stream.data) { if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "API CALL [%s(%s)] output:\n%s\n", cmd, - arg ? arg : "", (char *) stream.data); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", (char *) stream.data); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Unknown Command: %s\n", cmd); } @@ -127,8 +126,7 @@ static int switch_console_process(char *cmd) return 1; } -SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line, - const char *fmt, ...) +SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *fmt, ...) { char *data = NULL; int ret = 0; @@ -161,8 +159,7 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const } else if (channel == SWITCH_CHANNEL_ID_EVENT && - switch_event_running() == SWITCH_STATUS_SUCCESS && - switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { + switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep); diff --git a/src/switch_core.c b/src/switch_core.c index aef608a94e..a9993361a6 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -156,8 +156,7 @@ SWITCH_DECLARE(char *) switch_core_get_variable(char *varname) SWITCH_DECLARE(void) switch_core_set_variable(char *varname, char *value) { - switch_core_hash_insert(runtime.global_vars, switch_core_strdup(runtime.memory_pool, varname), - switch_core_strdup(runtime.memory_pool, value)); + switch_core_hash_insert(runtime.global_vars, switch_core_strdup(runtime.memory_pool, varname), switch_core_strdup(runtime.memory_pool, value)); } SWITCH_DECLARE(char *) switch_core_get_uuid(void) @@ -166,7 +165,7 @@ SWITCH_DECLARE(char *) switch_core_get_uuid(void) } -static void *switch_core_service_thread(switch_thread_t *thread, void *obj) +static void *switch_core_service_thread(switch_thread_t * thread, void *obj) { switch_core_thread_session_t *data = obj; switch_core_session_t *session = data->objs[0]; @@ -210,8 +209,7 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(switch_core_thread_session_t } } -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) { thread_session->running = 1; thread_session->objs[0] = session; @@ -234,7 +232,7 @@ SWITCH_DECLARE(void) switch_core_service_session(switch_core_session_t *session, */ -SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool) +SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t * pool) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -583,8 +581,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(char *console, cons } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, - "\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\n\n", - SWITCH_VERSION_FULL, __CP, switch_core_session_limit(0)); + "\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\n\n", SWITCH_VERSION_FULL, __CP, switch_core_session_limit(0)); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index 5dfeb4157d..9a3f33e47a 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -36,9 +36,7 @@ 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) { switch_status_t status; @@ -115,8 +113,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, s return ah->asr_interface->asr_close(ah, 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) +SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags) { assert(ah != NULL); @@ -130,8 +127,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_check_results(switch_asr_handle_ return ah->asr_interface->asr_check_results(ah, flags); } -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) { assert(ah != NULL); diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 358878fcab..57b69e7456 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -34,8 +34,7 @@ #include #include "private/switch_core.h" -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) { switch_event_t *event; @@ -43,10 +42,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", - codec->implementation->iananame); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", - codec->implementation->samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->samples_per_second); switch_event_fire(&event); } @@ -59,18 +56,15 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_ return session->read_codec; } -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) { switch_event_t *event; assert(session != NULL); if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", - codec->implementation->iananame); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", - codec->implementation->samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->samples_per_second); switch_event_fire(&event); } @@ -85,8 +79,7 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(switch_core SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, char *codec_name, char *fmtp, uint32_t rate, int ms, int channels, uint32_t flags, - const switch_codec_settings_t *codec_settings, - switch_memory_pool_t *pool) + const switch_codec_settings_t *codec_settings, switch_memory_pool_t * pool) { const switch_codec_interface_t *codec_interface; const switch_codec_implementation_t *iptr, *implementation = NULL; @@ -127,8 +120,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch /* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */ for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { if ((!rate || rate == iptr->samples_per_second) && - (!ms || ms == (iptr->microseconds_per_frame / 1000)) && - (!channels || channels == iptr->number_of_channels)) { + (!ms || ms == (iptr->microseconds_per_frame / 1000)) && (!channels || channels == iptr->number_of_channels)) { implementation = iptr; break; } @@ -159,8 +151,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch return SWITCH_STATUS_SUCCESS; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Codec %s Exists but not at the desired implementation. %dhz %dms\n", codec_name, rate, ms); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec %s Exists but not at the desired implementation. %dhz %dms\n", codec_name, rate, ms); } return SWITCH_STATUS_NOTIMPL; @@ -172,9 +163,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) { assert(codec != NULL); assert(encoded_data != NULL); @@ -191,11 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec, } - return codec->implementation->encode(codec, - other_codec, - decoded_data, - decoded_data_len, - decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag); + return codec->implementation->encode(codec, other_codec, decoded_data, decoded_data_len, decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag); } @@ -204,9 +189,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) { assert(codec != NULL); @@ -226,11 +209,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec, } - return codec->implementation->decode(codec, - other_codec, - encoded_data, - encoded_data_len, - encoded_rate, decoded_data, decoded_data_len, decoded_rate, flag); + return codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate, decoded_data, decoded_data_len, decoded_rate, flag); } diff --git a/src/switch_core_db.c b/src/switch_core_db.c index c4f69b774f..7cc3b45e26 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -47,12 +47,12 @@ static void db_pick_path(char *dbname, char *buf, switch_size_t size) } -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) { return sqlite3_open(filename, ppDb); } -SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t *db) +SWITCH_DECLARE(int) switch_core_db_close(switch_core_db_t * db) { return sqlite3_close(db); } @@ -72,14 +72,12 @@ SWITCH_DECLARE(int) switch_core_db_column_count(switch_core_db_stmt_t *pStmt) return sqlite3_column_count(pStmt); } -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) { return sqlite3_errmsg(db); } -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) { return sqlite3_exec(db, sql, callback, data, errmsg); } @@ -89,9 +87,7 @@ SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt) return sqlite3_finalize(pStmt); } -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) { return sqlite3_prepare(db, zSql, nBytes, ppStmt, pzTail); } @@ -116,8 +112,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int64(switch_core_db_stmt_t *pStmt, int return sqlite3_bind_int64(pStmt, i, iValue); } -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) { return sqlite3_bind_text(pStmt, i, zData, nData, xDel); } @@ -127,13 +122,12 @@ SWITCH_DECLARE(int) switch_core_db_bind_double(switch_core_db_stmt_t *pStmt, int return sqlite3_bind_double(pStmt, i, dValue); } -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) { return sqlite3_last_insert_rowid(db); } -SWITCH_DECLARE(int) switch_core_db_get_table(switch_core_db_t *db, const char *sql, char ***resultp, int *nrow, - int *ncolumn, char **errmsg) +SWITCH_DECLARE(int) switch_core_db_get_table(switch_core_db_t * db, const char *sql, char ***resultp, int *nrow, int *ncolumn, char **errmsg) { return sqlite3_get_table(db, sql, resultp, nrow, ncolumn, errmsg); } @@ -173,7 +167,7 @@ SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(char *filename) } -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) { char *errmsg; @@ -182,14 +176,12 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te switch_core_db_exec(db, test_sql, NULL, NULL, &errmsg); if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\nAuto Generating Table!\n", - errmsg, test_sql); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\nAuto Generating Table!\n", errmsg, test_sql); switch_core_db_free(errmsg); errmsg = NULL; switch_core_db_exec(db, reactive_sql, NULL, NULL, &errmsg); if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\n", errmsg, - reactive_sql); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\n", errmsg, reactive_sql); switch_core_db_free(errmsg); errmsg = NULL; } diff --git a/src/switch_core_directory.c b/src/switch_core_directory.c index 90e0159e56..25c69f6f44 100644 --- a/src/switch_core_directory.c +++ b/src/switch_core_directory.c @@ -35,9 +35,7 @@ #include "private/switch_core.h" 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) { switch_status_t status; @@ -80,9 +78,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_han 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) { switch_status_t status; diff --git a/src/switch_core_event_hook.c b/src/switch_core_event_hook.c index 1fec028f25..5491cfb1a9 100644 --- a/src/switch_core_event_hook.c +++ b/src/switch_core_event_hook.c @@ -31,8 +31,7 @@ #include "switch.h" #include "private/switch_core.h" -SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing(switch_core_session_t *session, - switch_outgoing_channel_hook_t outgoing_channel) +SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing(switch_core_session_t *session, switch_outgoing_channel_hook_t outgoing_channel) { switch_io_event_hook_outgoing_channel_t *hook, *ptr; @@ -53,8 +52,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing(switch_core_ return SWITCH_STATUS_MEMERR; } -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) { switch_io_event_hook_answer_channel_t *hook, *ptr; @@ -76,8 +74,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch } -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_io_event_hook_state_change_t *hook, *ptr; @@ -99,8 +96,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_c } -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) { switch_io_event_hook_read_frame_t *hook, *ptr; @@ -122,8 +118,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_cor } -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) { switch_io_event_hook_write_frame_t *hook, *ptr; @@ -145,8 +140,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_write_frame(switch_co } -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) { switch_io_event_hook_kill_channel_t *hook, *ptr; @@ -168,8 +162,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_kill_channel(switch_c } -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) { switch_io_event_hook_waitfor_read_t *hook, *ptr; @@ -191,8 +184,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_read(switch_c } -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) { switch_io_event_hook_waitfor_write_t *hook, *ptr; @@ -215,8 +207,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_waitfor_write(switch_ } -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) { switch_io_event_hook_send_dtmf_t *hook, *ptr; diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 8611326634..807fb7482c 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -35,9 +35,7 @@ #include "private/switch_core.h" 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) { char *ext; switch_status_t status; @@ -108,8 +106,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, return fh->file_interface->file_write(fh, data, len); } -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) { assert(fh != NULL); @@ -117,16 +114,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, return fh->file_interface->file_seek(fh, cur_pos, samples, whence); } -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) { assert(fh != NULL); return fh->file_interface->file_set_string(fh, col, string); } -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) { assert(fh != NULL); diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index afd0c5d4ab..be67e7db27 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -34,7 +34,7 @@ #include #include "private/switch_core.h" -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) { assert(pool != NULL); @@ -45,31 +45,31 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t **hash, swit return SWITCH_STATUS_GENERR; } -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) { assert(hash != NULL); return SWITCH_STATUS_SUCCESS; } -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) { apr_hash_set(hash, switch_core_strdup(apr_hash_pool_get(hash), key), APR_HASH_KEY_STRING, data); return SWITCH_STATUS_SUCCESS; } -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) { apr_hash_set(hash, key, APR_HASH_KEY_STRING, data); return SWITCH_STATUS_SUCCESS; } -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) { apr_hash_set(hash, key, APR_HASH_KEY_STRING, NULL); return SWITCH_STATUS_SUCCESS; } -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) { return apr_hash_get(hash, key, APR_HASH_KEY_STRING); } diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 4d1e7e91f1..97e1623904 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -35,8 +35,7 @@ #include "private/switch_core.h" -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) { switch_io_event_hook_read_frame_t *ptr; switch_status_t status; @@ -56,15 +55,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } if (session->endpoint_interface->io_routines->read_frame) { - if ((status = session->endpoint_interface->io_routines->read_frame(session, - frame, - timeout, - SWITCH_IO_FLAG_NOOP, - stream_id)) == SWITCH_STATUS_SUCCESS) { + if ((status = session->endpoint_interface->io_routines->read_frame(session, frame, timeout, SWITCH_IO_FLAG_NOOP, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) { - if ((status = - ptr->read_frame(session, frame, timeout, SWITCH_IO_FLAG_NOOP, - stream_id)) != SWITCH_STATUS_SUCCESS) { + if ((status = ptr->read_frame(session, frame, timeout, SWITCH_IO_FLAG_NOOP, stream_id)) != SWITCH_STATUS_SUCCESS) { break; } } @@ -87,8 +80,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi goto done; } - if ((session->read_codec && (*frame)->codec - && session->read_codec->implementation != (*frame)->codec->implementation)) { + if ((session->read_codec && (*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) { need_codec = TRUE; } @@ -116,8 +108,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi read_frame->data, read_frame->datalen, session->read_codec->implementation->samples_per_second, - session->raw_read_frame.data, - &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag); + session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag); switch (status) { case SWITCH_STATUS_RESAMPLE: @@ -126,8 +117,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi read_frame->codec->implementation->samples_per_second, read_frame->codec->implementation->bytes_per_frame * 20, session->read_codec->implementation->samples_per_second, - session->read_codec->implementation->bytes_per_frame * 20, - session->pool) != SWITCH_STATUS_SUCCESS) { + session->read_codec->implementation->bytes_per_frame * 20, session->pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate resampler\n"); status = SWITCH_STATUS_FALSE; goto done; @@ -143,20 +133,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi status = SWITCH_STATUS_SUCCESS; break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", - session->read_codec->codec_interface->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name); goto done; } } if (session->read_resampler) { short *data = read_frame->data; - session->read_resampler->from_len = - switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2); + session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2); session->read_resampler->to_len = switch_resample_process(session->read_resampler, session->read_resampler->from, - session->read_resampler->from_len, session->read_resampler->to, - session->read_resampler->to_size, 0); + session->read_resampler->from_len, session->read_resampler->to, session->read_resampler->to_size, 0); switch_float_to_short(session->read_resampler->to, data, read_frame->datalen); read_frame->samples = session->read_resampler->to_len; read_frame->datalen = session->read_resampler->to_len * 2; @@ -206,10 +193,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } else { if (!session->raw_read_buffer) { switch_size_t bytes = session->read_codec->implementation->bytes_per_frame; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes\n", - (uint32_t) bytes); - switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, - bytes * SWITCH_BUFFER_START_FRAMES, 0); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes\n", (uint32_t) bytes); + switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0); } if (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen)) { status = SWITCH_STATUS_MEMERR; @@ -217,17 +202,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } } - if (perfect - || switch_buffer_inuse(session->raw_read_buffer) >= - session->read_codec->implementation->bytes_per_frame) { + if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_codec->implementation->bytes_per_frame) { if (perfect) { enc_frame = *frame; session->raw_read_frame.rate = (*frame)->rate; } else { session->raw_read_frame.datalen = (uint32_t) switch_buffer_read(session->raw_read_buffer, session->raw_read_frame.data, - session->read_codec-> - implementation->bytes_per_frame); + session->read_codec->implementation->bytes_per_frame); session->raw_read_frame.rate = session->read_codec->implementation->samples_per_second; enc_frame = &session->raw_read_frame; @@ -242,9 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi enc_frame->data, enc_frame->datalen, session->read_codec->implementation->samples_per_second, - session->enc_read_frame.data, - &session->enc_read_frame.datalen, - &session->enc_read_frame.rate, &flag); + session->enc_read_frame.data, &session->enc_read_frame.datalen, &session->enc_read_frame.rate, &flag); switch (status) { @@ -252,8 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "fixme 1\n"); case SWITCH_STATUS_SUCCESS: session->enc_read_frame.codec = session->read_codec; - session->enc_read_frame.samples = - session->read_codec->implementation->bytes_per_frame / sizeof(int16_t); + session->enc_read_frame.samples = session->read_codec->implementation->bytes_per_frame / sizeof(int16_t); session->enc_read_frame.timestamp = read_frame->timestamp; session->enc_read_frame.payload = session->read_codec->implementation->ianacode; *frame = &session->enc_read_frame; @@ -267,8 +246,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi status = SWITCH_STATUS_SUCCESS; break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s encoder error!\n", - session->read_codec->codec_interface->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name); *frame = NULL; status = SWITCH_STATUS_GENERR; break; @@ -291,17 +269,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi return status; } -static switch_status_t perform_write(switch_core_session_t *session, switch_frame_t *frame, int timeout, - switch_io_flag_t flags, int stream_id) +static switch_status_t perform_write(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id) { switch_io_event_hook_write_frame_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; if (session->endpoint_interface->io_routines->write_frame) { - if ((status = - session->endpoint_interface->io_routines->write_frame(session, frame, timeout, flags, - stream_id)) == SWITCH_STATUS_SUCCESS) { + if ((status = session->endpoint_interface->io_routines->write_frame(session, frame, timeout, flags, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.write_frame; ptr; ptr = ptr->next) { if ((status = ptr->write_frame(session, frame, timeout, flags, stream_id)) != SWITCH_STATUS_SUCCESS) { break; @@ -312,8 +287,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram return status; } -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_status_t status = SWITCH_STATUS_FALSE; @@ -365,8 +339,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess frame->data, frame->datalen, session->write_codec->implementation->samples_per_second, - session->raw_write_frame.data, - &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag); + session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag); switch (status) { @@ -377,8 +350,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess frame->codec->implementation->samples_per_second, frame->codec->implementation->bytes_per_frame * 20, session->write_codec->implementation->samples_per_second, - session->write_codec->implementation->bytes_per_frame * 20, - session->pool); + session->write_codec->implementation->bytes_per_frame * 20, session->pool); if (status != SWITCH_STATUS_SUCCESS) { goto done; } @@ -397,8 +369,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess status = SWITCH_STATUS_SUCCESS; break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", - frame->codec->codec_interface->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name); return status; } } @@ -412,8 +383,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess session->write_resampler->to_len = (uint32_t) switch_resample_process(session->write_resampler, session->write_resampler->from, - session->write_resampler->from_len, session->write_resampler->to, - session->write_resampler->to_size, 0); + session->write_resampler->from_len, session->write_resampler->to, session->write_resampler->to_size, 0); switch_float_to_short(session->write_resampler->to, data, session->write_resampler->to_len); @@ -484,20 +454,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess switch_size_t bytes = session->write_codec->implementation->bytes_per_frame; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Write Buffer at %u bytes to accomodate %u->%u\n", - (uint32_t) bytes, - write_frame->datalen, session->write_codec->implementation->bytes_per_frame); + (uint32_t) bytes, write_frame->datalen, session->write_codec->implementation->bytes_per_frame); if ((status = switch_buffer_create_dynamic(&session->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, - bytes * SWITCH_BUFFER_START_FRAMES, - 0)) != SWITCH_STATUS_SUCCESS) { + bytes * SWITCH_BUFFER_START_FRAMES, 0)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Write Buffer Failed!\n"); return status; } } if (!(switch_buffer_write(session->raw_write_buffer, write_frame->data, write_frame->datalen))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Write Buffer %u bytes Failed!\n", - write_frame->datalen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Write Buffer %u bytes Failed!\n", write_frame->datalen); return SWITCH_STATUS_MEMERR; } } @@ -512,9 +479,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess enc_frame->data, enc_frame->datalen, session->write_codec->implementation->samples_per_second, - session->enc_write_frame.data, - &session->enc_write_frame.datalen, - &session->enc_write_frame.rate, &flag); + session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); switch (status) { case SWITCH_STATUS_RESAMPLE: @@ -535,8 +500,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess status = SWITCH_STATUS_SUCCESS; break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s encoder error!\n", - session->read_codec->codec_interface->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name); write_frame = NULL; return status; } @@ -569,8 +533,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess enc_frame->datalen, frame->codec->implementation->samples_per_second, session->enc_write_frame.data, - &session->enc_write_frame.datalen, - &session->enc_write_frame.rate, &flag); + &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag); switch (status) { @@ -586,8 +549,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess frame->codec->implementation->bytes_per_frame * 20, session->write_codec->implementation-> samples_per_second, - session->write_codec->implementation-> - bytes_per_frame * 20, session->pool); + session->write_codec->implementation->bytes_per_frame * 20, session->pool); if (status != SWITCH_STATUS_SUCCESS) { goto done; } @@ -618,15 +580,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->read_resampler) { short *data = write_frame->data; - session->read_resampler->from_len = switch_short_to_float(data, - session->read_resampler->from, - (int) write_frame->datalen / - 2); + session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) write_frame->datalen / 2); session->read_resampler->to_len = (uint32_t) switch_resample_process(session->read_resampler, session->read_resampler->from, session->read_resampler->from_len, - session->read_resampler->to, - session->read_resampler->to_size, 0); + session->read_resampler->to, session->read_resampler->to_size, 0); switch_float_to_short(session->read_resampler->to, data, write_frame->datalen * 2); write_frame->samples = session->read_resampler->to_len; write_frame->datalen = session->read_resampler->to_len * 2; @@ -635,9 +593,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (flag & SFF_CNG) { switch_set_flag(write_frame, SFF_CNG); } - if ((status = - perform_write(session, write_frame, timeout, io_flag, - stream_id)) != SWITCH_STATUS_SUCCESS) { + if ((status = perform_write(session, write_frame, timeout, io_flag, stream_id)) != SWITCH_STATUS_SUCCESS) { break; } } @@ -667,15 +623,12 @@ static char *SIG_NAMES[] = { }; 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) { switch_io_event_hook_kill_channel_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_INFO, "Kill %s [%s]\n", - switch_channel_get_name(session->channel), SIG_NAMES[sig]); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_INFO, "Kill %s [%s]\n", switch_channel_get_name(session->channel), SIG_NAMES[sig]); if (session->endpoint_interface->io_routines->kill_channel) { if ((status = session->endpoint_interface->io_routines->kill_channel(session, sig)) == SWITCH_STATUS_SUCCESS) { @@ -691,16 +644,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(switch_ } -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) { switch_io_event_hook_waitfor_read_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; if (session->endpoint_interface->io_routines->waitfor_read) { - if ((status = - session->endpoint_interface->io_routines->waitfor_read(session, timeout, - stream_id)) == SWITCH_STATUS_SUCCESS) { + if ((status = session->endpoint_interface->io_routines->waitfor_read(session, timeout, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.waitfor_read; ptr; ptr = ptr->next) { if ((status = ptr->waitfor_read(session, timeout, stream_id)) != SWITCH_STATUS_SUCCESS) { break; @@ -713,16 +663,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_read(switch_core_ses } -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) { switch_io_event_hook_waitfor_write_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; if (session->endpoint_interface->io_routines->waitfor_write) { - if ((status = - session->endpoint_interface->io_routines->waitfor_write(session, timeout, - stream_id)) == SWITCH_STATUS_SUCCESS) { + if ((status = session->endpoint_interface->io_routines->waitfor_write(session, timeout, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.waitfor_write; ptr; ptr = ptr->next) { if ((status = ptr->waitfor_write(session, timeout, stream_id)) != SWITCH_STATUS_SUCCESS) { break; @@ -755,8 +702,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio } digit[0] = *d; - if ((status = - session->endpoint_interface->io_routines->send_dtmf(session, digit)) != SWITCH_STATUS_SUCCESS) { + if ((status = session->endpoint_interface->io_routines->send_dtmf(session, digit)) != SWITCH_STATUS_SUCCESS) { return status; } } diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index f1e22085ba..538d355381 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -144,8 +144,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b #define MAX_BUG_BUFFER 1024 * 512 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) { switch_media_bug_t *bug, *bp; switch_size_t bytes; @@ -171,8 +170,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t bug->session = session; bug->flags = flags; bug->ready = 1; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attaching BUG to %s\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attaching BUG to %s\n", switch_channel_get_name(session->channel)); bytes = session->read_codec->implementation->bytes_per_frame; if (!bug->flags) { @@ -180,16 +178,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t } if (switch_test_flag(bug, SMBF_READ_STREAM)) { - switch_buffer_create_dynamic(&bug->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, - bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER); + switch_buffer_create_dynamic(&bug->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER); switch_mutex_init(&bug->read_mutex, SWITCH_MUTEX_NESTED, session->pool); } bytes = session->write_codec->implementation->bytes_per_frame; if (switch_test_flag(bug, SMBF_WRITE_STREAM)) { - switch_buffer_create_dynamic(&bug->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, - bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER); + switch_buffer_create_dynamic(&bug->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER); switch_mutex_init(&bug->write_mutex, SWITCH_MUTEX_NESTED, session->pool); } @@ -221,8 +217,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_ses bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_CLOSE); } switch_core_media_bug_destroy(bp); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing BUG from %s\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(session->channel)); } switch_thread_rwlock_unlock(session->bug_rwlock); session->bugs = NULL; @@ -241,8 +236,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t * bp->ready = 0; } switch_core_media_bug_destroy(bp); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing BUG from %s\n", - switch_channel_get_name(bp->session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(bp->session->channel)); *bug = NULL; return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index a773a15044..37fe9ca797 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -118,7 +118,7 @@ SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *sessio return result; } -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, ...) { va_list ap; char *result = NULL; @@ -157,7 +157,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session } -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) { char *duped = NULL; switch_size_t len; @@ -179,7 +179,7 @@ SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char return duped; } -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) { if ((apr_pool_create(pool, NULL)) != SWITCH_STATUS_SUCCESS) { @@ -189,14 +189,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_new_memory_pool(switch_memory_pool_t return SWITCH_STATUS_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) { apr_pool_destroy(*pool); return SWITCH_STATUS_SUCCESS; } -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) { void *ptr = NULL; assert(pool != NULL); diff --git a/src/switch_core_port_allocator.c b/src/switch_core_port_allocator.c index 8fdf317534..6d9fa60ef5 100644 --- a/src/switch_core_port_allocator.c +++ b/src/switch_core_port_allocator.c @@ -44,9 +44,7 @@ struct switch_core_port_allocator { }; 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) { switch_status_t status; switch_memory_pool_t *pool; @@ -74,9 +72,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(switch_port_t sta return SWITCH_STATUS_SUCCESS; } -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) { const switch_management_interface_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; diff --git a/src/switch_core_rwlock.c b/src/switch_core_rwlock.c index 44c1273c21..7970f5b338 100644 --- a/src/switch_core_rwlock.c +++ b/src/switch_core_rwlock.c @@ -35,8 +35,7 @@ #include "private/switch_core.h" #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) #else SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_session_t *session) #endif @@ -47,14 +46,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio if (switch_test_flag(session, SSF_DESTROYED)) { status = SWITCH_STATUS_FALSE; #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel)); #endif } else { status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock); #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n", switch_channel_get_name(session->channel)); #endif } } @@ -63,12 +60,10 @@ 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) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel)); #else SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session) { @@ -77,11 +72,9 @@ SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *sessi } #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) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n", switch_channel_get_name(session->channel)); #else SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session) { diff --git a/src/switch_core_session.c b/src/switch_core_session.c index bae0c5e1ae..c2dd9c09bd 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -45,8 +45,7 @@ static struct { #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) #else SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(char *uuid_str) #endif @@ -178,8 +177,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(switch_core_session_t * 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) { switch_io_event_hook_outgoing_channel_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; @@ -218,9 +216,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ caller_profile->ani, caller_profile->aniii, caller_profile->rdnis, - caller_profile->source, - caller_profile->context, - caller_profile->destination_number); + caller_profile->source, caller_profile->context, caller_profile->destination_number); outgoing_profile->flags = caller_profile->flags; } } @@ -229,13 +225,10 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } } - if ((cause = endpoint_interface->io_routines->outgoing_channel(session, - outgoing_profile, - new_session, pool)) == SWITCH_CAUSE_SUCCESS) { + if ((cause = endpoint_interface->io_routines->outgoing_channel(session, outgoing_profile, new_session, pool)) == SWITCH_CAUSE_SUCCESS) { if (session) { for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) { - if ((status = - ptr->outgoing_channel(session, caller_profile, *new_session)) != SWITCH_STATUS_SUCCESS) { + if ((status = ptr->outgoing_channel(session, caller_profile, *new_session)) != SWITCH_STATUS_SUCCESS) { break; } } @@ -244,8 +237,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ return cause; } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate outgoing channel interface for %s\n", - endpoint_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate outgoing channel interface for %s\n", endpoint_name); return SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED; } @@ -272,12 +264,9 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_CODEC_VARIABLE, tmp); } - switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VARIABLE, - switch_core_session_get_uuid(session)); - switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, - switch_core_session_get_uuid(session)); - switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, - switch_core_session_get_uuid(*new_session)); + switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VARIABLE, switch_core_session_get_uuid(session)); + switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session)); + switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*new_session)); /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */ if ((export_vars = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE))) { @@ -354,8 +343,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_answer_channel(switch_core_s return status; } -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) { switch_io_event_hook_receive_message_t *ptr; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -379,8 +367,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_ return status; } -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) { switch_core_session_message_t *msg; @@ -396,8 +383,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core return SWITCH_STATUS_FALSE; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -416,8 +402,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_se return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; void *pop; @@ -449,8 +434,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_se } -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) { switch_io_event_hook_receive_event_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; @@ -517,8 +501,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_event_count(switch_core_session_t *s return -1; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; void *pop; @@ -534,8 +517,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_se return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -566,8 +548,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_private_event_count(switch_core_sess return -1; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; void *pop; @@ -584,8 +565,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch if (session->private_event_queue) { - if ((status = - (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + if ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { *event = (switch_event_t *) pop; } } @@ -714,8 +694,7 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session_t **session switch_memory_pool_t *pool; switch_event_t *event; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", - switch_channel_get_name((*session)->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", switch_channel_get_name((*session)->channel)); switch_scheduler_del_task_group((*session)->uuid_str); @@ -743,7 +722,7 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session_t **session } -static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t * thread, void *obj) { switch_core_session_t *session = obj; session->thread = thread; @@ -758,8 +737,7 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thre switch_set_flag(session, SSF_DESTROYED); switch_core_session_rwunlock(session); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Session %u (%s) Ended\n", session->id, - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Session %u (%s) Ended\n", session->id, switch_channel_get_name(session->channel)); switch_core_session_destroy(&session); return NULL; } @@ -774,16 +752,14 @@ SWITCH_DECLARE(void) switch_core_session_thread_launch(switch_core_session_t *se if (!session->thread_running) { switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - if (switch_thread_create(&thread, thd_attr, switch_core_session_thread, session, session->pool) != - SWITCH_STATUS_SUCCESS) { + if (switch_thread_create(&thread, thd_attr, switch_core_session_thread, session, session->pool) != SWITCH_STATUS_SUCCESS) { switch_core_session_destroy(&session); } } } -SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session_t *session, switch_thread_start_t func, - void *obj) +SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session_t *session, switch_thread_start_t func, void *obj) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -797,7 +773,7 @@ SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session_t *se 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) { switch_memory_pool_t *usepool; switch_core_session_t *session; @@ -882,8 +858,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_count(void) return runtime.session_count; } -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) { const switch_endpoint_interface_t *endpoint_interface; @@ -925,7 +900,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit) } -SWITCH_DECLARE(void) switch_core_session_init(switch_memory_pool_t *pool) +SWITCH_DECLARE(void) switch_core_session_init(switch_memory_pool_t * pool) { memset(&runtime, 0, sizeof(runtime)); runtime.session_limit = 1000; diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index 669f8595d6..5809c4bb27 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -34,8 +34,7 @@ #include #include "private/switch_core.h" -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) { assert(sh != NULL); @@ -79,9 +78,7 @@ SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t * } 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) { assert(sh != NULL); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index d2601215c6..8cab77e214 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -41,7 +41,7 @@ static struct { switch_memory_pool_t *memory_pool; } runtime; -static switch_status_t switch_core_db_persistant_execute_trans(switch_core_db_t *db, char *sql, uint32_t retries) +static switch_status_t switch_core_db_persistant_execute_trans(switch_core_db_t * db, char *sql, uint32_t retries) { char *errmsg; switch_status_t status = SWITCH_STATUS_FALSE; @@ -113,7 +113,7 @@ static switch_status_t switch_core_db_persistant_execute_trans(switch_core_db_t return status; } -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) { char *errmsg; switch_status_t status = SWITCH_STATUS_FALSE; @@ -145,7 +145,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute(switch_core_db } #define SQLLEN 1024 * 64 -static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread, void *obj) { void *pop; uint32_t itterations = 0; @@ -200,8 +200,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, if (trans && ((itterations == target) || nothing_in_queue)) { if (switch_core_db_persistant_execute_trans(runtime.event_db, sqlbuf, 1000) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, - "SQL thread unable to commit transaction, records lost!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n"); } itterations = 0; trans = 0; @@ -229,9 +228,8 @@ static void core_event_handler(switch_event_t *event) sql = switch_mprintf("insert into tasks values('%q','%q','%q','%q')", switch_event_get_header(event, "task-id"), switch_event_get_header(event, "task-desc"), - switch_event_get_header(event, "task-group"), - switch_event_get_header(event, "task-runtime") - ); + switch_event_get_header(event, "task-group"), switch_event_get_header(event, "task-runtime") + ); break; case SWITCH_EVENT_DEL_SCHEDULE: case SWITCH_EVENT_EXE_SCHEDULE: @@ -239,8 +237,7 @@ static void core_event_handler(switch_event_t *event) break; case SWITCH_EVENT_RE_SCHEDULE: sql = switch_mprintf("update tasks set task_runtime='%q' where task_id=%q", - switch_event_get_header(event, "task-runtime"), - switch_event_get_header(event, "task-id")); + switch_event_get_header(event, "task-runtime"), switch_event_get_header(event, "task-id")); break; case SWITCH_EVENT_CHANNEL_DESTROY: sql = switch_mprintf("delete from channels where uuid='%q'", switch_event_get_header(event, "unique-id")); @@ -249,8 +246,7 @@ static void core_event_handler(switch_event_t *event) sql = switch_mprintf("insert into channels (uuid,created,name,state) values('%q','%q','%q','%q')", switch_event_get_header(event, "unique-id"), switch_event_get_header(event, "event-date-local"), - switch_event_get_header(event, "channel-name"), - switch_event_get_header(event, "channel-state") + switch_event_get_header(event, "channel-name"), switch_event_get_header(event, "channel-state") ); break; case SWITCH_EVENT_CODEC: @@ -266,8 +262,7 @@ static void core_event_handler(switch_event_t *event) case SWITCH_EVENT_CHANNEL_EXECUTE: sql = switch_mprintf("update channels set application='%q',application_data='%q' where uuid='%q'", switch_event_get_header(event, "application"), - switch_event_get_header(event, "application-data"), - switch_event_get_header(event, "unique-id") + switch_event_get_header(event, "application-data"), switch_event_get_header(event, "unique-id") ); break; case SWITCH_EVENT_CHANNEL_STATE: @@ -286,14 +281,12 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header(event, "caller-caller-id-name"), switch_event_get_header(event, "caller-caller-id-number"), switch_event_get_header(event, "caller-network-addr"), - switch_event_get_header(event, "caller-destination-number"), - switch_event_get_header(event, "unique-id") + switch_event_get_header(event, "caller-destination-number"), switch_event_get_header(event, "unique-id") ); break; default: sql = switch_mprintf("update channels set state='%s' where uuid='%s'", - switch_event_get_header(event, "channel-state"), - switch_event_get_header(event, "unique-id") + switch_event_get_header(event, "channel-state"), switch_event_get_header(event, "unique-id") ); break; } @@ -311,14 +304,11 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header(event, "originatee-caller-id-name"), switch_event_get_header(event, "originatee-caller-id-number"), switch_event_get_header(event, "originatee-destination-number"), - switch_event_get_header(event, "originatee-channel-name"), - switch_event_get_header(event, "originatee-unique-id") + switch_event_get_header(event, "originatee-channel-name"), switch_event_get_header(event, "originatee-unique-id") ); break; case SWITCH_EVENT_CHANNEL_UNBRIDGE: - sql = - switch_mprintf("delete from calls where caller_uuid='%s'", - switch_event_get_header(event, "caller-unique-id")); + sql = switch_mprintf("delete from calls where caller_uuid='%s'", switch_event_get_header(event, "caller-unique-id")); break; case SWITCH_EVENT_SHUTDOWN: sql = switch_mprintf("delete from channels;delete from interfaces;delete from calls"); @@ -350,7 +340,7 @@ static void core_event_handler(switch_event_t *event) } -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_thread_t *thread; switch_threadattr_t *thd_attr;; @@ -373,8 +363,7 @@ SWITCH_DECLARE(void) switch_core_sqldb_start(switch_memory_pool_t *pool) " dest VARCHAR(255),\n" " application VARCHAR(255),\n" " application_data VARCHAR(255),\n" - " read_codec VARCHAR(255),\n" - " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255)\n" ");\n"; + " read_codec VARCHAR(255),\n" " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255)\n" ");\n"; char create_calls_sql[] = "CREATE TABLE calls (\n" " function VARCHAR(255),\n" @@ -385,20 +374,15 @@ SWITCH_DECLARE(void) switch_core_sqldb_start(switch_memory_pool_t *pool) " caller_uuid VARCHAR(255),\n" " callee_cid_name VARCHAR(255),\n" " callee_cid_num VARCHAR(255),\n" - " callee_dest_num VARCHAR(255),\n" - " callee_chan_name VARCHAR(255),\n" " callee_uuid VARCHAR(255)\n" ");\n"; + " callee_dest_num VARCHAR(255),\n" " callee_chan_name VARCHAR(255),\n" " callee_uuid VARCHAR(255)\n" ");\n"; char create_interfaces_sql[] = "CREATE TABLE interfaces (\n" " type VARCHAR(255),\n" - " name VARCHAR(255),\n" - " description VARCHAR(255),\n" " syntax VARCHAR(255)\n" ");\n"; + " name VARCHAR(255),\n" " description VARCHAR(255),\n" " syntax VARCHAR(255)\n" ");\n"; char create_tasks_sql[] = "CREATE TABLE tasks (\n" " task_id INTEGER(4),\n" - " task_desc VARCHAR(255),\n" - " task_group VARCHAR(255),\n" - " task_runtime INTEGER(8)\n" - ");\n"; + " task_desc VARCHAR(255),\n" " task_group VARCHAR(255),\n" " task_runtime INTEGER(8)\n" ");\n"; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n"); switch_core_db_exec(runtime.db, "drop table channels", NULL, NULL, NULL); @@ -409,8 +393,7 @@ SWITCH_DECLARE(void) switch_core_sqldb_start(switch_memory_pool_t *pool) switch_core_db_exec(runtime.db, create_calls_sql, NULL, NULL, NULL); switch_core_db_exec(runtime.db, create_interfaces_sql, NULL, NULL, NULL); switch_core_db_exec(runtime.db, create_tasks_sql, NULL, NULL, NULL); - if (switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL) != - SWITCH_STATUS_SUCCESS) { + if (switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event handler!\n"); } } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index d73974cad8..fb59865df4 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -36,16 +36,14 @@ static void switch_core_standard_on_init(switch_core_session_t *session) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard INIT %s\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard INIT %s\n", switch_channel_get_name(session->channel)); } static void switch_core_standard_on_hangup(switch_core_session_t *session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HANGUP %s, cause: %s\n", - switch_channel_get_name(session->channel), - switch_channel_cause2str(switch_channel_get_cause(session->channel))); + switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel))); } @@ -55,8 +53,7 @@ static void switch_core_standard_on_ring(switch_core_session_t *session) switch_caller_profile_t *caller_profile; switch_caller_extension_t *extension = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RING %s\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RING %s\n", switch_channel_get_name(session->channel)); if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't get profile!\n"); @@ -125,16 +122,13 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) char *expanded = NULL; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Execute %s(%s)\n", - extension->current_application->application_name, - switch_str_nil(extension->current_application->application_data)); - if ((application_interface = - switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", - extension->current_application->application_name); + extension->current_application->application_name, switch_str_nil(extension->current_application->application_data)); + if ((application_interface = switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", extension->current_application->application_name); switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return; } - + if (switch_channel_test_flag(session->channel, CF_NOMEDIA) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Cannot be used with NO_MEDIA mode!\n", extension->current_application->application_name); @@ -143,26 +137,21 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) } if (!application_interface->application_function) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", - extension->current_application->application_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", extension->current_application->application_name); switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return; } if ((expanded = switch_channel_expand_variables(session->channel, - extension->current_application->application_data)) != - extension->current_application->application_data) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Expanded String %s(%s)\n", - extension->current_application->application_name, expanded); + extension->current_application->application_data)) != extension->current_application->application_data) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Expanded String %s(%s)\n", extension->current_application->application_name, expanded); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", - extension->current_application->application_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data-Orig", "%s", - extension->current_application->application_data); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", extension->current_application->application_name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data-Orig", "%s", extension->current_application->application_data); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", expanded); switch_event_fire(&event); } @@ -248,8 +237,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) switch_channel_event_set_data(session->channel, event); switch_event_fire(&event); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Thread has crashed for channel %s\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Thread has crashed for channel %s\n", switch_channel_get_name(session->channel)); switch_channel_hangup(session->channel, SWITCH_CAUSE_CRASH); } else { apr_hash_set(runtime.stack_table, &thread_id, sizeof(thread_id), &env); @@ -294,20 +282,16 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) switch (state) { case CS_NEW: /* Just created, Waiting for first instructions */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State NEW\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel)); break; case CS_DONE: goto done; case CS_HANGUP: /* Deactivate and end the thread */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HANGUP\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HANGUP\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_hangup || (driver_state_handler->on_hangup - && driver_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS - && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + && driver_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_hangup || (application_state_handler->on_hangup && application_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS @@ -339,13 +323,11 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } goto done; case CS_INIT: /* Basic setup tasks */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State INIT\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State INIT\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_init || (driver_state_handler->on_init && driver_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_init || (application_state_handler->on_init && application_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS @@ -361,8 +343,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) while (proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { if (!application_state_handler || !application_state_handler->on_init || (application_state_handler->on_init && - application_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS && - midstate == switch_channel_get_state(session->channel))) { + application_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { proceed++; continue; } else { @@ -376,13 +357,11 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_RING: /* Look for a dialplan and find something to do */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State RING\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State RING\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_ring || (driver_state_handler->on_ring && driver_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_ring || (application_state_handler->on_ring && application_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS @@ -398,8 +377,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) while (proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { if (!application_state_handler || !application_state_handler->on_ring || (application_state_handler->on_ring && - application_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS && - midstate == switch_channel_get_state(session->channel))) { + application_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { proceed++; continue; } else { @@ -413,14 +391,11 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_EXECUTE: /* Execute an Operation */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State EXECUTE\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State EXECUTE\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_execute || (driver_state_handler->on_execute - && driver_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS - && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + && driver_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_execute || (application_state_handler->on_execute && application_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS @@ -451,14 +426,11 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_LOOPBACK: /* loop all data back to source */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State LOOPBACK\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State LOOPBACK\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_loopback || (driver_state_handler->on_loopback - && driver_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS - && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + && driver_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_loopback || (application_state_handler->on_loopback && application_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS @@ -489,15 +461,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_TRANSMIT: /* send/recieve data to/from another channel */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State TRANSMIT\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State TRANSMIT\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_transmit || (driver_state_handler->on_transmit - && driver_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS - && midstate == switch_channel_get_state(session->channel))) { + && driver_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_transmit || (application_state_handler->on_transmit && application_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS @@ -528,14 +497,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_HOLD: /* wait in limbo */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HOLD\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HOLD\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_hold || (driver_state_handler->on_hold && driver_state_handler->on_hold(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_hold || (application_state_handler->on_hold && application_state_handler->on_hold(session) == SWITCH_STATUS_SUCCESS @@ -551,8 +518,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) while (proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { if (!application_state_handler || !application_state_handler->on_hold || (application_state_handler->on_hold && - application_state_handler->on_hold(session) == SWITCH_STATUS_SUCCESS && - midstate == switch_channel_get_state(session->channel))) { + application_state_handler->on_hold(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { proceed++; continue; } else { @@ -566,15 +532,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) } break; case CS_HIBERNATE: /* wait in limbo */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HIBERNATE\n", - switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State HIBERNATE\n", switch_channel_get_name(session->channel)); if (!driver_state_handler->on_hibernate || (driver_state_handler->on_hibernate - && driver_state_handler->on_hibernate(session) == SWITCH_STATUS_SUCCESS - && midstate == switch_channel_get_state(session->channel))) { + && driver_state_handler->on_hibernate(session) == SWITCH_STATUS_SUCCESS && midstate == switch_channel_get_state(session->channel))) { - while ((application_state_handler = - switch_channel_get_state_handler(session->channel, index++)) != 0) { + while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { if (!application_state_handler || !application_state_handler->on_hibernate || (application_state_handler->on_hibernate && application_state_handler->on_hibernate(session) == SWITCH_STATUS_SUCCESS diff --git a/src/switch_core_timer.c b/src/switch_core_timer.c index 006f06a9ee..621d55d718 100644 --- a/src/switch_core_timer.c +++ b/src/switch_core_timer.c @@ -34,8 +34,7 @@ #include #include "private/switch_core.h" -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) { switch_timer_interface_t *timer_interface; switch_status_t status; diff --git a/src/switch_event.c b/src/switch_event.c index bb9ec11daa..a509941341 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -180,7 +180,7 @@ static int switch_events_match(switch_event_t *event, switch_event_node_t *node) return match; } -static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t * thread, void *obj) { switch_event_t *out_event = NULL; switch_queue_t *queue = NULL; @@ -390,7 +390,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) return SWITCH_STATUS_SUCCESS; } -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) { switch_thread_t *thread; switch_threadattr_t *thd_attr;; @@ -433,8 +433,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) } -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) { if (event_id != SWITCH_EVENT_CUSTOM && subclass_name) { @@ -485,8 +484,7 @@ SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event) return NULL; } -SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack, - const char *header_name, const char *fmt, ...) +SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt, ...) { int ret = 0; char data[2048]; @@ -572,8 +570,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_ { switch_event_header_t *header, *hp, *hp2, *last = NULL; - if (switch_event_create_subclass(event, todup->event_id, todup->subclass ? todup->subclass->name : NULL) != - SWITCH_STATUS_SUCCESS) { + if (switch_event_create_subclass(event, todup->event_id, todup->subclass ? todup->subclass->name : NULL) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_GENERR; } @@ -796,8 +793,7 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch } -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) { switch_time_exp_t tm; @@ -869,8 +865,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(char *file, char *fun return SWITCH_STATUS_SUCCESS; } -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) { switch_event_node_t *event_node; switch_event_subclass_t *subclass = NULL; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 9bbbddbba5..0421b8eeb8 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -172,9 +172,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, char dtmf[128]; switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); if (args && args->input_callback) { - if ((status = - args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, - args->buflen)) != SWITCH_STATUS_SUCCESS) { + if ((status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { break; } } @@ -182,9 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) { if (args && args->input_callback) { - if ((status = - args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, - args->buflen)) != SWITCH_STATUS_SUCCESS) { + if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { break; } } else { @@ -205,8 +201,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, return status; } -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) { switch_channel_t *channel; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -273,9 +268,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) { uint32_t i = 0, x = (uint32_t) strlen(buf); switch_channel_t *channel; @@ -514,8 +507,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag return status; } -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) { switch_channel_t *channel; switch_caller_profile_t *profile, *new_profile; @@ -585,16 +577,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ msg.from = __FILE__; switch_core_session_receive_message(session, &msg); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Transfer %s to %s[%s@%s]\n", - switch_channel_get_name(channel), dialplan, extension, context); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Transfer %s to %s[%s@%s]\n", switch_channel_get_name(channel), dialplan, extension, context); return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_FALSE; } -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) { switch_channel_t *chana = switch_core_session_get_channel(sessa); switch_channel_t *chanb = switch_core_session_get_channel(sessb); @@ -616,8 +606,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session void *vval; const void *vvar; - for (hi = switch_channel_variable_first(chana, switch_core_session_get_pool(sessa)); hi; - hi = switch_hash_next(hi)) { + for (hi = switch_channel_variable_first(chana, switch_core_session_get_pool(sessa)); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &vval); if (vvar && vval && (!prefix || (var && !strncmp((char *) vvar, var, strlen(var))))) { switch_channel_set_variable(chanb, (char *) vvar, (char *) vval); @@ -645,8 +634,7 @@ struct switch_ivr_digit_stream { switch_time_t last_digit_time; }; -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -663,8 +651,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory } // if we have a pool, make a parser object if (pool != NULL) { - *parser = - (switch_ivr_digit_stream_parser_t *) switch_core_alloc(pool, sizeof(switch_ivr_digit_stream_parser_t)); + *parser = (switch_ivr_digit_stream_parser_t *) switch_core_alloc(pool, sizeof(switch_ivr_digit_stream_parser_t)); } // if we have parser object, initialize it for the caller if (*parser != NULL) { @@ -687,7 +674,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -705,8 +692,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_iv return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -722,7 +708,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_str return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -735,8 +721,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -773,8 +758,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -789,8 +773,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ return status; } -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) { void *result = NULL; @@ -821,8 +804,7 @@ SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stre } } // don't allow collected digit string testing if there are varying sized keys until timeout - if (parser->maxlen - parser->minlen > 0 - && (switch_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) { + if (parser->maxlen - parser->minlen > 0 && (switch_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) { len = 0; } // if we have digits to test @@ -840,7 +822,7 @@ SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stre return result; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -854,8 +836,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_s return status; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -949,8 +930,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ switch_hash_index_t *hi; void *vval; const void *vvar; - switch_xml_t variable, - variables, cdr, x_caller_profile, x_caller_extension, x_times, time_tag, x_application, x_callflow; + switch_xml_t variable, variables, cdr, x_caller_profile, x_caller_extension, x_times, time_tag, x_application, x_callflow; char tmp[512]; int cdr_off = 0, v_off = 0; @@ -965,8 +945,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ goto error; } - 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 && vval) { if ((variable = switch_xml_add_child_d(variables, (char *) vvar, v_off++))) { @@ -1001,8 +980,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ switch_xml_set_attr_d(x_caller_extension, "name", caller_profile->caller_extension->extension_name); switch_xml_set_attr_d(x_caller_extension, "number", caller_profile->caller_extension->extension_number); if (caller_profile->caller_extension->current_application) { - switch_xml_set_attr_d(x_caller_extension, "current_app", - caller_profile->caller_extension->current_application->application_name); + switch_xml_set_attr_d(x_caller_extension, "current_app", caller_profile->caller_extension->current_application->application_name); } for (ap = caller_profile->caller_extension->applications; ap; ap = ap->next) { diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 2502e4046e..24d4b738ff 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -82,8 +82,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi } -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) { switch_channel_t *channel; switch_codec_t *read_codec; @@ -112,8 +111,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t file, read_codec->implementation->number_of_channels, read_codec->implementation->samples_per_second, - SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, - switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session); return SWITCH_STATUS_GENERR; @@ -249,9 +247,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_sessi switch_channel_answer(channel); - if ((status = switch_core_media_bug_add(session, - inband_dtmf_callback, - pvt, SMBF_READ_STREAM, &bug)) != SWITCH_STATUS_SUCCESS) { + if ((status = switch_core_media_bug_add(session, inband_dtmf_callback, pvt, SMBF_READ_STREAM, &bug)) != SWITCH_STATUS_SUCCESS) { return status; } @@ -269,7 +265,7 @@ struct speech_thread_handle { switch_memory_pool_t *pool; }; -static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t * thread, void *obj) { struct speech_thread_handle *sth = (struct speech_thread_handle *) obj; switch_channel_t *channel = switch_core_session_get_channel(sth->session); @@ -433,8 +429,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_resume_detect_speech(switch_core_sess } -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) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; @@ -478,8 +473,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c } 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) { switch_channel_t *channel; switch_codec_t *read_codec; @@ -518,8 +512,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * if (switch_core_asr_open(ah, mod_name, "L16", - read_codec->implementation->samples_per_second, - dest, &flags, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + read_codec->implementation->samples_per_second, dest, &flags, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { if (switch_core_asr_load_grammar(ah, grammar, path) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); @@ -538,9 +531,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * sth->session = session; sth->ah = ah; - if ((status = switch_core_media_bug_add(session, - speech_callback, - sth, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) { + if ((status = switch_core_media_bug_add(session, speech_callback, sth, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) { switch_core_asr_close(ah, &flags); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return status; @@ -572,8 +563,7 @@ static void sch_hangup_callback(switch_scheduler_task_t *task) switch_channel_t *channel = switch_core_session_get_channel(session); if (helper->bleg) { - if ((other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && - (other_session = switch_core_session_locate(other_uuid))) { + if ((other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(other_uuid))) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); switch_channel_hangup(other_channel, helper->cause); switch_core_session_rwunlock(other_session); @@ -588,8 +578,7 @@ static void sch_hangup_callback(switch_scheduler_task_t *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) { struct hangup_helper *helper; size_t len = sizeof(*helper); @@ -600,8 +589,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, char *uuid, helper->cause = cause; helper->bleg = bleg; - return switch_scheduler_add_task(runtime, sch_hangup_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, - SSHF_FREE_ARG); + return switch_scheduler_add_task(runtime, sch_hangup_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, SSHF_FREE_ARG); } struct transfer_helper { @@ -627,8 +615,7 @@ static void sch_transfer_callback(switch_scheduler_task_t *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) { struct transfer_helper *helper; size_t len = sizeof(*helper); @@ -669,8 +656,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_transfer(time_t runtime, char *uuid switch_copy_string(helper->context, context, strlen(context) + 1); } - return switch_scheduler_add_task(runtime, sch_transfer_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, - SSHF_FREE_ARG); + return switch_scheduler_add_task(runtime, sch_transfer_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, SSHF_FREE_ARG); } @@ -689,8 +675,7 @@ static void sch_broadcast_callback(switch_scheduler_task_t *task) switch_ivr_broadcast(helper->uuid_str, helper->path, helper->flags); } -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) { struct broadcast_helper *helper; size_t len = sizeof(*helper) + strlen(path) + 1; @@ -703,8 +688,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, char *uui switch_copy_string(helper->path, path, len - sizeof(helper)); - return switch_scheduler_add_task(runtime, sch_broadcast_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, - SSHF_FREE_ARG); + return switch_scheduler_add_task(runtime, sch_broadcast_callback, (char *) __SWITCH_FUNC__, uuid, 0, helper, SSHF_FREE_ARG); } SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, switch_media_flag_t flags) @@ -795,5 +779,3 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, swi return SWITCH_STATUS_SUCCESS; } - - diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 45f66273c3..3ca41532a5 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -41,7 +41,7 @@ struct audio_bridge_data { int running; }; -static void *audio_bridge_thread(switch_thread_t *thread, void *obj) +static void *audio_bridge_thread(switch_thread_t * thread, void *obj) { switch_core_thread_session_t *his_thread, *data = obj; int *stream_id_p; @@ -118,8 +118,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (input_callback) { if (input_callback(session_a, dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", - switch_channel_get_name(chan_a)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a)); switch_mutex_lock(data->mutex); data->running = -1; switch_mutex_unlock(data->mutex); @@ -133,8 +132,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) status = input_callback(session_a, event, SWITCH_INPUT_TYPE_EVENT, user_data, 0); } - if (event->event_id != SWITCH_EVENT_MESSAGE - || switch_core_session_receive_event(session_b, &event) != SWITCH_STATUS_SUCCESS) { + if (event->event_id != SWITCH_EVENT_MESSAGE || switch_core_session_receive_event(session_b, &event) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); } @@ -184,8 +182,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read: %s Bad Frame.... Bubye!\n", - switch_channel_get_name(chan_a)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read: %s Bad Frame.... Bubye!\n", switch_channel_get_name(chan_a)); switch_mutex_lock(data->mutex); data->running = -1; switch_mutex_unlock(data->mutex); @@ -199,8 +196,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_core_session_receive_message(session_a, &msg); switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", - switch_channel_get_name(chan_a)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a)); switch_channel_clear_flag(chan_a, CF_BRIDGED); switch_mutex_lock(data->mutex); @@ -333,15 +329,13 @@ static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session) /* add another profile to both sessions for CDR's sake */ if ((profile = switch_channel_get_caller_profile(channel))) { new_profile = switch_caller_profile_clone(session, profile); - new_profile->destination_number = - switch_core_session_strdup(session, switch_core_session_get_uuid(other_session)); + new_profile->destination_number = switch_core_session_strdup(session, switch_core_session_get_uuid(other_session)); switch_channel_set_caller_profile(channel, new_profile); } if ((profile = switch_channel_get_caller_profile(other_channel))) { new_profile = switch_caller_profile_clone(other_session, profile); - new_profile->destination_number = - switch_core_session_strdup(other_session, switch_core_session_get_uuid(session)); + new_profile->destination_number = switch_core_session_strdup(other_session, switch_core_session_get_uuid(session)); switch_channel_set_caller_profile(other_channel, new_profile); } @@ -349,16 +343,14 @@ static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session) if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", - switch_core_session_get_uuid(other_session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(other_session)); switch_event_fire(&event); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(other_channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "uuid_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", - switch_core_session_get_uuid(session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session)); switch_event_fire(&event); } @@ -390,8 +382,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session assert(channel != NULL); switch_channel_clear_flag(channel, CF_TRANSFER); - switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, - switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)); + switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)); return SWITCH_STATUS_SUCCESS; } @@ -428,8 +419,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session) switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL); switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL); - if (switch_channel_get_state(other_channel) < CS_HANGUP && - switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) { + if (switch_channel_get_state(other_channel) < CS_HANGUP && switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) { switch_channel_hangup(other_channel, switch_channel_get_cause(channel)); } else { switch_channel_set_state(other_channel, CS_EXECUTE); @@ -452,8 +442,7 @@ static const switch_state_handler_table_t signal_bridge_state_handlers = { /*.on_hibernate */ signal_bridge_on_hibernate }; -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) { switch_channel_t *caller_channel, *peer_channel; switch_event_t *event; @@ -474,8 +463,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * return SWITCH_STATUS_FALSE; } - switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, - switch_core_session_get_uuid(peer_session)); + switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session)); switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session)); switch_channel_set_flag(caller_channel, CF_ORIGINATOR); @@ -491,16 +479,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", - switch_core_session_get_uuid(peer_session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(peer_session)); switch_event_fire(&event); } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(peer_channel, event); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "signal_bridge"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", - switch_core_session_get_uuid(session)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session)); switch_event_fire(&event); } @@ -522,8 +508,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * 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 input_callback, - void *session_data, void *peer_session_data) + switch_input_callback_function_t input_callback, void *session_data, void *peer_session_data) { switch_core_thread_session_t *this_audio_thread, *other_audio_thread; switch_channel_t *caller_channel, *peer_channel; @@ -577,8 +562,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses } if (switch_core_session_read_lock(peer_session) == SWITCH_STATUS_SUCCESS) { - switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_VARIABLE, - switch_core_session_get_uuid(peer_session)); + switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session)); switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session)); msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; @@ -651,8 +635,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses done: - if (switch_channel_get_state(caller_channel) < CS_HANGUP && - switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) { + if (switch_channel_get_state(caller_channel) < CS_HANGUP && switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) { switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel)); } @@ -700,18 +683,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(char *originator_uuid, ch status = SWITCH_STATUS_SUCCESS; - while (switch_channel_get_state(originatee_channel) < CS_HANGUP - && switch_channel_test_flag(originatee_channel, CF_TAGGED)) { + while (switch_channel_get_state(originatee_channel) < CS_HANGUP && switch_channel_test_flag(originatee_channel, CF_TAGGED)) { switch_yield(20000); } } else { switch_core_session_rwunlock(originator_session); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no channel for originatee uuid %s\n", - originatee_uuid); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no channel for originatee uuid %s\n", originatee_uuid); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no channel for originator uuid %s\n", - originator_uuid); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no channel for originator uuid %s\n", originator_uuid); } return status; diff --git a/src/switch_ivr_menu.c b/src/switch_ivr_menu.c index 8eda8a380f..1ea540c28a 100644 --- a/src/switch_ivr_menu.c +++ b/src/switch_ivr_menu.c @@ -61,7 +61,7 @@ struct switch_ivr_menu_action { struct switch_ivr_menu_action *next; }; -static switch_ivr_menu_t *switch_ivr_menu_find(switch_ivr_menu_t *stack, const char *name) +static switch_ivr_menu_t *switch_ivr_menu_find(switch_ivr_menu_t * stack, const char *name) { switch_ivr_menu_t *ret; for (ret = stack; ret; ret = ret->next) { @@ -71,7 +71,7 @@ static switch_ivr_menu_t *switch_ivr_menu_find(switch_ivr_menu_t *stack, const c return ret; } -static void switch_ivr_menu_stack_add(switch_ivr_menu_t **top, switch_ivr_menu_t *bottom) +static void switch_ivr_menu_stack_add(switch_ivr_menu_t ** top, switch_ivr_menu_t * bottom) { switch_ivr_menu_t *ptr; @@ -85,17 +85,15 @@ static void switch_ivr_menu_stack_add(switch_ivr_menu_t **top, switch_ivr_menu_t } -SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu, - switch_ivr_menu_t *main, +SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu, + switch_ivr_menu_t * main, const char *name, const char *greeting_sound, const char *short_greeting_sound, const char *invalid_sound, const char *exit_sound, const char *tts_engine, - const char *tts_voice, - const char *phrase_lang, - int timeout, int max_failures, switch_memory_pool_t *pool) + const char *tts_voice, const char *phrase_lang, int timeout, int max_failures, switch_memory_pool_t * pool) { switch_ivr_menu_t *menu; uint8_t newpool = 0; @@ -175,8 +173,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_men return SWITCH_STATUS_SUCCESS; } -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) { switch_ivr_menu_action_t *action; uint32_t len; @@ -197,9 +194,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *m return SWITCH_STATUS_MEMERR; } -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) { switch_ivr_menu_action_t *action; uint32_t len; @@ -220,7 +216,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t return SWITCH_STATUS_MEMERR; } -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) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -237,7 +233,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *st return status; } -static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_menu_t *menu, char *sound, uint32_t need) +static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_menu_t * menu, char *sound, uint32_t need) { char terminator; uint32_t len; @@ -274,8 +270,7 @@ static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_me if (strlen(sound) > 7 && strncmp(sound, "phrase:", 7) == 0) { status = switch_ivr_phrase_macro(session, sound + 7, "", menu->phrase_lang, &args); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "play_or_say: no player for [%s]. Use say: or phrase:\n", sound); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_or_say: no player for [%s]. Use say: or phrase:\n", sound); } } } @@ -284,9 +279,7 @@ static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_me menu->ptr += strlen(menu->buf); if (strlen(menu->buf) < need) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u digits\n", need); - status = - switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), need, "#", - &terminator, menu->timeout); + status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), need, "#", &terminator, menu->timeout); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digits '%s'\n", menu->buf); } @@ -296,8 +289,7 @@ static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_me return status; } -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) { int reps = 0, errs = 0, match = 0, running = 1; char *greeting_sound = NULL, *aptr = NULL; @@ -356,20 +348,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s errs = 0; if (ap->function) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "IVR function on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf, - ap->arg); + "IVR function on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf, ap->arg); todo = ap->function(menu, ap->arg, arg, sizeof(arg), obj); aptr = arg; } else { todo = ap->ivr_action; aptr = ap->arg; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "IVR action on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf, - aptr); + "IVR action on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf, aptr); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "switch_ivr_menu_execute todo=[%d]\n", - todo); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "switch_ivr_menu_execute todo=[%d]\n", todo); switch (todo) { case SWITCH_IVR_ACTION_DIE: @@ -405,8 +394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s } if (app_name && app_arg) { - if ((application_interface = - switch_loadable_module_get_application_interface(app_name))) { + if ((application_interface = switch_loadable_module_get_application_interface(app_name))) { if (application_interface->application_function) { application_interface->application_function(session, app_arg); } @@ -445,14 +433,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s } if (!match) { if (*menu->buf) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", - menu->name, menu->buf); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name, menu->buf); if (menu->invalid_sound) { play_or_say(session, menu, menu->invalid_sound, 0); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' no input detected\n", - menu->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' no input detected\n", menu->name); } errs++; if (status == SWITCH_STATUS_SUCCESS) { @@ -490,7 +476,7 @@ struct switch_ivr_menu_xml_ctx { int autocreated; }; -static switch_ivr_menu_xml_map_t *switch_ivr_menu_stack_xml_find(switch_ivr_menu_xml_ctx_t *xml_ctx, char *name) +static switch_ivr_menu_xml_map_t *switch_ivr_menu_stack_xml_find(switch_ivr_menu_xml_ctx_t * xml_ctx, char *name) { switch_ivr_menu_xml_map_t *map = (xml_ctx != NULL ? xml_ctx->map : NULL); int rc = -1; @@ -502,14 +488,12 @@ static switch_ivr_menu_xml_map_t *switch_ivr_menu_stack_xml_find(switch_ivr_menu return (rc == 0 ? map : NULL); } -static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *xml_ctx, char *name, int action, - switch_ivr_menu_action_function_t * function) +static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t * xml_ctx, char *name, int action, switch_ivr_menu_action_function_t * function) { switch_status_t status = SWITCH_STATUS_FALSE; // if this action/function does not exist yet - if (xml_ctx != NULL && name != NULL && xml_ctx->pool != NULL - && switch_ivr_menu_stack_xml_find(xml_ctx, name) == NULL) { + if (xml_ctx != NULL && name != NULL && xml_ctx->pool != NULL && switch_ivr_menu_stack_xml_find(xml_ctx, name) == NULL) { switch_ivr_menu_xml_map_t *map = switch_core_alloc(xml_ctx->pool, sizeof(switch_ivr_menu_xml_map_t)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "switch_ivr_menu_stack_xml_add bindng '%s'\n", name); @@ -535,8 +519,7 @@ static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t * return status; } -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_status_t status = SWITCH_STATUS_FALSE; int autocreated = 0; @@ -586,16 +569,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_x return status; } -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) { return switch_ivr_menu_stack_xml_add(xml_menu_ctx, name, -1, function); } -SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx, - switch_ivr_menu_t **menu_stack, - switch_xml_t xml_menus, switch_xml_t xml_menu) +SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx, + switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu) { switch_status_t status = SWITCH_STATUS_FALSE; @@ -619,10 +600,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ greet_long, greet_short, invalid_sound, - exit_sound, - tts_engine, - tts_voice, - phrase_lang, atoi(timeout) * 1000, atoi(max_failures), xml_menu_ctx->pool); + exit_sound, tts_engine, tts_voice, phrase_lang, atoi(timeout) * 1000, atoi(max_failures), xml_menu_ctx->pool); // set the menu_stack for the caller if (status == SWITCH_STATUS_SUCCESS && *menu_stack == NULL) { *menu_stack = menu; @@ -632,8 +610,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ switch_xml_t xml_kvp; // build menu entries - for (xml_kvp = switch_xml_child(xml_menu, "entry"); xml_kvp != NULL && status == SWITCH_STATUS_SUCCESS; - xml_kvp = xml_kvp->next) { + for (xml_kvp = switch_xml_child(xml_menu, "entry"); xml_kvp != NULL && status == SWITCH_STATUS_SUCCESS; xml_kvp = xml_kvp->next) { const char *action = switch_xml_attr(xml_kvp, "action"); const char *digits = switch_xml_attr(xml_kvp, "digits"); const char *param = switch_xml_attr_soft(xml_kvp, "param"); @@ -651,8 +628,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ if (found && xml_map != NULL) { // do we need to build a new sub-menu ? - if (xml_map->action == SWITCH_IVR_ACTION_EXECMENU - && switch_ivr_menu_find(*menu_stack, param) == NULL) { + if (xml_map->action == SWITCH_IVR_ACTION_EXECMENU && switch_ivr_menu_find(*menu_stack, param) == NULL) { if ((xml_menu = switch_xml_find_child(xml_menus, "menu", "name", param)) != NULL) { status = switch_ivr_menu_stack_xml_build(xml_menu_ctx, menu_stack, xml_menus, xml_menu); } @@ -661,12 +637,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ if (status == SWITCH_STATUS_SUCCESS) { if (xml_map->function != NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "binding menu caller control '%s'/'%s' to '%s'\n", xml_map->name, - param, digits); + "binding menu caller control '%s'/'%s' to '%s'\n", xml_map->name, param, digits); status = switch_ivr_menu_bind_function(menu, xml_map->function, param, digits); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "binding menu action '%s' to '%s'\n", xml_map->name, digits); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding menu action '%s' to '%s'\n", xml_map->name, digits); status = switch_ivr_menu_bind_action(menu, xml_map->action, param, digits); } } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 52908d56bb..7b91404926 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -72,7 +72,7 @@ struct key_collect { switch_core_session_t *session; }; -static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t * thread, void *obj) { struct key_collect *collect = (struct key_collect *) obj; switch_channel_t *channel = switch_core_session_get_channel(collect->session); @@ -151,15 +151,12 @@ static void launch_collect_thread(struct key_collect *collect) switch_threadattr_create(&thd_attr, switch_core_session_get_pool(collect->session)); switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, collect_thread_run, collect, - switch_core_session_get_pool(collect->session)); + switch_thread_create(&thread, thd_attr, collect_thread_run, collect, switch_core_session_get_pool(collect->session)); } static uint8_t check_channel_status(switch_channel_t **peer_channels, switch_core_session_t **peer_sessions, - uint32_t len, - int32_t *idx, - uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t * ring_ready) + uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready) { uint32_t i; @@ -243,9 +240,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) { char *pipe_names[MAX_PEERS] = { 0 }; char *data = NULL; @@ -328,8 +323,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess assert(caller_channel != NULL); /* Copy all the channel variables into the event */ - for (hi = switch_channel_variable_first(caller_channel, switch_core_session_get_pool(session)); hi; - hi = switch_hash_next(hi)) { + for (hi = switch_channel_variable_first(caller_channel, switch_core_session_get_pool(session)); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &vvar, NULL, &vval); if (vvar && vval) { switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, "%s", (char *) vval); @@ -346,12 +340,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess for (x = 0; x < var_count; x++) { char *inner_var_array[2]; int inner_var_count; - if ((inner_var_count = - switch_separate_string(var_array[x], '=', inner_var_array, - (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { + if ((inner_var_count = switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { - switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], "%s", - inner_var_array[1]); + switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], "%s", inner_var_array[1]); if (caller_channel) { switch_channel_set_variable(caller_channel, inner_var_array[0], inner_var_array[1]); } @@ -393,8 +384,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess retries = tmp; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Invalid originate_retries setting of %d ignored, value must be between 1 and 100\n", - tmp); + "Invalid originate_retries setting of %d ignored, value must be between 1 and 100\n", tmp); } } @@ -405,8 +395,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess sleep_ms = tmp; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Invalid originate_retry_sleep_ms setting of %d ignored, value must be between 500 and 60000\n", - tmp); + "Invalid originate_retry_sleep_ms setting of %d ignored, value must be between 500 and 60000\n", tmp); } } @@ -451,13 +440,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess to = 0; if (try > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, - retries, sleep_ms); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms); switch_yield(sleep_ms * 1000); } - and_argc = - switch_separate_string(pipe_names[r], ',', peer_names, (sizeof(peer_names) / sizeof(peer_names[0]))); + and_argc = switch_separate_string(pipe_names[r], ',', peer_names, (sizeof(peer_names) / sizeof(peer_names[0]))); if (caller_channel && !sent_ring && and_argc > 1 && !ringback_data) { switch_channel_ring_ready(caller_channel); @@ -478,9 +465,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess goto done; } - caller_caller_profile = - caller_profile_override ? caller_profile_override : - switch_channel_get_caller_profile(caller_channel); + caller_caller_profile = caller_profile_override ? caller_profile_override : switch_channel_get_caller_profile(caller_channel); if (!cid_name_override) { cid_name_override = caller_caller_profile->caller_id_name; @@ -498,8 +483,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess NULL, NULL, caller_caller_profile->rdnis, - caller_caller_profile->source, - caller_caller_profile->context, chan_data); + caller_caller_profile->source, caller_caller_profile->context, chan_data); caller_profiles[i]->flags = caller_caller_profile->flags; pool = NULL; } else { @@ -526,24 +510,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess caller_profile_override->ani, caller_profile_override->aniii, caller_profile_override->rdnis, - caller_profile_override->source, - caller_profile_override->context, chan_data); + caller_profile_override->source, caller_profile_override->context, chan_data); } else { caller_profiles[i] = switch_caller_profile_new(pool, NULL, NULL, - cid_name_override, - cid_num_override, - NULL, - NULL, NULL, NULL, __FILE__, NULL, chan_data); + cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data); } } - if ((reason = - switch_core_session_outgoing_channel(session, chan_type, caller_profiles[i], &peer_sessions[i], - &pool)) != SWITCH_CAUSE_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Cannot Create Outgoing Channel! cause: %s\n", switch_channel_cause2str(reason)); + if ((reason = switch_core_session_outgoing_channel(session, chan_type, caller_profiles[i], &peer_sessions[i], &pool)) != SWITCH_CAUSE_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! cause: %s\n", switch_channel_cause2str(reason)); if (pool) { switch_core_destroy_memory_pool(&pool); } @@ -627,15 +604,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess NULL, read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, pool) == SWITCH_STATUS_SUCCESS) { + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, 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); write_frame.codec = &write_codec; write_frame.datalen = read_codec->implementation->bytes_per_frame; write_frame.samples = write_frame.datalen / 2; @@ -661,8 +635,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ringback_data = tmp_data; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback File [%s]\n", - ringback_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback File [%s]\n", ringback_data); ringback.fhb.channels = read_codec->implementation->number_of_channels; ringback.fhb.samplerate = read_codec->implementation->samples_per_second; @@ -671,8 +644,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess read_codec->implementation->number_of_channels, read_codec->implementation->samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, - switch_core_session_get_pool(session)) != - SWITCH_STATUS_SUCCESS) { + switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n"); switch_safe_free(tmp_data); goto notready; @@ -682,8 +654,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } else { teletone_init_session(&ringback.ts, 0, teletone_handler, &ringback); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", - ringback_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data); //ringback.ts.debug = 1; //ringback.ts.debug_stream = switch_core_get_console(); if (teletone_run(&ringback.ts, ringback_data)) { @@ -709,8 +680,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } while ((!caller_channel || switch_channel_ready(caller_channel)) && - check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok, - &ring_ready)) { + check_channel_status(peer_channels, peer_sessions, and_argc, &idx, &hups, file, key, early_ok, &ring_ready)) { // When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail. if ((to = (uint8_t) ((time(NULL) - start) >= (time_t) timelimit_sec)) @@ -769,24 +739,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } write_frame.data = abuf; write_frame.datalen = (uint32_t) (ringback.asis ? olen : olen * 2); - if (switch_core_session_write_frame(session, &write_frame, 1000, 0) != - SWITCH_STATUS_SUCCESS) { + if (switch_core_session_write_frame(session, &write_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) { break; } } else if (ringback.audio_buffer) { if ((write_frame.datalen = (uint32_t) switch_buffer_read(ringback.audio_buffer, write_frame.data, - write_frame.codec->implementation-> - bytes_per_frame)) <= 0) { + write_frame.codec->implementation->bytes_per_frame)) <= 0) { switch_buffer_t *tmp; tmp = ringback.audio_buffer; ringback.audio_buffer = ringback.loop_buffer; ringback.loop_buffer = tmp; if ((write_frame.datalen = (uint32_t) switch_buffer_read(ringback.audio_buffer, write_frame.data, - write_frame.codec-> - implementation-> - bytes_per_frame)) <= 0) { + write_frame.codec->implementation->bytes_per_frame)) <= 0) { break; } } @@ -884,8 +850,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (caller_channel) { switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted"); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", - switch_channel_get_name(peer_channel)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel)); *cause = SWITCH_CAUSE_SUCCESS; } else { @@ -913,13 +878,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (idx == IDX_CANCEL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, - switch_channel_cause2str(*cause)); + "Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause)); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Originate Resulted in Error Cause: %d [%s]\n", *cause, - switch_channel_cause2str(*cause)); + "Originate Resulted in Error Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause)); } } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index a466950b39..91b94c07d4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -90,9 +90,7 @@ static switch_say_method_t get_say_type_by_name(char *name) } -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_xml_t cfg, xml = NULL, language, macros, macro, input, action; char *lname = NULL, *mname = NULL, hint_data[1024] = "", enc_hint[1024] = ""; @@ -204,8 +202,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s if (match) { status = SWITCH_STATUS_SUCCESS; - for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; - action = action->next) { + for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) { char *adata = (char *) switch_xml_attr_soft(action, "data"); char *func = (char *) switch_xml_attr_soft(action, "function"); @@ -232,8 +229,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s odata = expanded; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, - chan_lang); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, chan_lang); if (!strcasecmp(func, "play-file")) { status = switch_ivr_play_file(session, NULL, odata, args); @@ -248,21 +244,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s char *say_type = (char *) switch_xml_attr_soft(action, "type"); char *say_method = (char *) switch_xml_attr_soft(action, "method"); - status = - si->say_function(session, odata, get_say_type_by_name(say_type), - get_say_method_by_name(say_method), args); + status = si->say_function(session, odata, get_say_type_by_name(say_type), get_say_method_by_name(say_method), args); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", - chan_lang); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", chan_lang); } } else if (!strcasecmp(func, "speak-text")) { switch_codec_t *read_codec; if ((read_codec = switch_core_session_get_read_codec(session))) { - status = switch_ivr_speak_text(session, - tts_engine, - tts_voice, - read_codec->implementation->samples_per_second, odata, args); + status = switch_ivr_speak_text(session, tts_engine, tts_voice, read_codec->implementation->samples_per_second, odata, args); } } } @@ -292,8 +282,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s } 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) { switch_channel_t *channel; char dtmf[128]; @@ -325,8 +314,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se file, read_codec->implementation->number_of_channels, read_codec->implementation->samples_per_second, - SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, - switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session); return SWITCH_STATUS_GENERR; @@ -377,8 +365,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se 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, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + 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"); switch_core_session_set_read_codec(session, &codec); } else { @@ -492,8 +479,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se #define FILE_BLOCKSIZE 1024 * 8 #define FILE_BUFSIZE 1024 * 64 -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) { switch_channel_t *channel; int16_t abuf[FILE_STARTSAMPLES]; @@ -568,8 +554,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess file, read_codec->implementation->number_of_channels, read_codec->implementation->samples_per_second, - SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, - switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_core_session_reset(session); return SWITCH_STATUS_NOTFOUND; } @@ -621,10 +606,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess "TITLE=%s\n" "COPYRIGHT=%s\n" "SOFTWARE=%s\n" - "ARTIST=%s\n" - "COMMENT=%s\n" - "DATE=%s\n", file, fh->samplerate, fh->channels, - title, copyright, software, artist, comment, date); + "ARTIST=%s\n" "COMMENT=%s\n" "DATE=%s\n", file, fh->samplerate, fh->channels, title, copyright, software, artist, comment, date); #endif assert(read_codec != NULL); @@ -653,20 +635,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess codec_name, NULL, fh->samplerate, - interval, - fh->channels, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, pool) == SWITCH_STATUS_SUCCESS) { + interval, fh->channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, - SWITCH_LOG_DEBUG, - "Codec Activated %s@%uhz %u channels %dms\n", - codec_name, fh->samplerate, fh->channels, interval); + SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); write_frame.codec = &codec; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, - fh->channels, interval); + "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); switch_core_file_close(fh); switch_core_session_reset(session); return SWITCH_STATUS_GENERR; @@ -687,8 +663,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_core_session_reset(session); return SWITCH_STATUS_GENERR; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", len, - interval); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", len, interval); } write_frame.rate = fh->samplerate; @@ -904,9 +879,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t uint32_t timeout, char *valid_terminators, char *prompt_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) { char terminator; //used to hold terminator recieved from @@ -948,8 +921,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t if (max_digits == 1 && status == SWITCH_STATUS_BREAK) { //Check the digit if we have a regex if (digits_regex != NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, - (char *) digit_buffer); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer); //Make sure the digit is allowed if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) { @@ -977,9 +949,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Calling more digits try %d\n", max_tries); //Try to grab some more digits for the timeout period - status = - switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, - &terminator, timeout); + status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &terminator, timeout); //Make sure we made it out alive if (status != SWITCH_STATUS_SUCCESS) { @@ -991,8 +961,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t if (min_digits <= strlen(digit_buffer)) { //See if we need to test a regex if (digits_regex != NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, - (char *) digit_buffer); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer); //Test the regex if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Match found!\n"); @@ -1025,9 +994,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t 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) { switch_channel_t *channel; short abuf[960]; @@ -1216,9 +1183,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session 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) { switch_channel_t *channel; int interval = 0; @@ -1248,11 +1213,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses } memset(&sh, 0, sizeof(sh)); - if (switch_core_speech_open(&sh, - tts_name, - voice_name, - (uint32_t) rate, - &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_speech_open(&sh, tts_name, voice_name, (uint32_t) rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n"); switch_core_session_reset(session); return SWITCH_STATUS_FALSE; @@ -1269,17 +1230,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses if (switch_core_codec_init(&codec, codec_name, - NULL, - (int) rate, - interval, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, pool) == SWITCH_STATUS_SUCCESS) { + NULL, (int) rate, interval, 1, 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"); write_frame.codec = &codec; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", - codec_name, rate, interval); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval); flags = 0; switch_core_speech_close(&sh, &flags); switch_core_session_reset(session); @@ -1296,8 +1251,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses switch_core_session_reset(session); return SWITCH_STATUS_GENERR; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", len, - interval); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", len, interval); /* start a thread to absorb incoming audio */ for (stream_id = 0; stream_id < switch_core_session_get_stream_count(session); stream_id++) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 16b9cae38b..aeb89e100e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -69,7 +69,7 @@ struct switch_loadable_module_container { static struct switch_loadable_module_container loadable_modules; -static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj) +static void *switch_loadable_module_exec(switch_thread_t * thread, void *obj) { @@ -84,13 +84,11 @@ static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj) for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) { status = module->switch_module_runtime(); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name); if (ts->pool) { switch_memory_pool_t *pool = ts->pool; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Pool for %s\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Pool for %s\n", module->module_interface->module_name); switch_core_destroy_memory_pool(&pool); } switch_yield(1000000); @@ -109,8 +107,7 @@ static void switch_loadable_module_runtime(void) module = (switch_loadable_module_t *) val; if (module->switch_module_runtime) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting runtime thread for %s\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting runtime thread for %s\n", module->module_interface->module_name); switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool); } } @@ -126,8 +123,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable const switch_endpoint_interface_t *ptr; for (ptr = new_module->module_interface->endpoint_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load endpoint interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load endpoint interface from %s due to no interface name.\n", key); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Endpoint '%s'\n", ptr->interface_name); switch_core_hash_insert(loadable_modules.endpoint_hash, ptr->interface_name, (const void *) ptr); @@ -141,8 +137,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->codec_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load codec interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load codec interface from %s due to no interface name.\n", key); } else { unsigned load_interface = 1; for (impl = ptr->implementations; impl; impl = impl->next) { @@ -153,15 +148,12 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } if (!load_interface) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", - ptr->interface_name, key); + "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key); } else { for (impl = ptr->implementations; impl; impl = impl->next) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Codec '%s' (%s) %dhz %dms\n", - impl->iananame, - ptr->interface_name, - impl->samples_per_second, impl->microseconds_per_frame / 1000); + impl->iananame, ptr->interface_name, impl->samples_per_second, impl->microseconds_per_frame / 1000); if (!switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) { switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) ptr); } @@ -181,8 +173,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->dialplan_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load dialplan interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load dialplan interface from %s due to no interface name.\n", key); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Dialplan '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { @@ -200,8 +191,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->timer_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load timer interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load timer interface from %s due to no interface name.\n", key); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Timer '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { @@ -219,16 +209,13 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->application_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load application interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load application interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Application '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Application '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "application"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", - switch_str_nil(ptr->short_desc)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "description", "%s", switch_str_nil(ptr->short_desc)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "syntax", "%s", switch_str_nil(ptr->syntax)); switch_event_fire(&event); } @@ -242,11 +229,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->api_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load api interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load api interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding API Function '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding API Function '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "api"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -264,13 +249,11 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->file_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load file interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load file interface from %s due to no interface name.\n", key); } else { int i; for (i = 0; ptr->extens[i]; i++) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding File Format '%s'\n", - ptr->extens[i]); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding File Format '%s'\n", ptr->extens[i]); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "file"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->extens[i]); @@ -287,11 +270,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->speech_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load speech interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load speech interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Speech interface '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Speech interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "speech"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -307,11 +288,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->asr_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load asr interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load asr interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Asr interface '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Asr interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "asr"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -327,11 +306,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->directory_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load directory interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load directory interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Directory interface '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Directory interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "directory"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -347,11 +324,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->chat_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load chat interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load chat interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Chat interface '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Chat interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "chat"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -367,11 +342,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->say_interface; ptr; ptr = ptr->next) { if (!ptr->interface_name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load say interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load say interface from %s due to no interface name.\n", key); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Say interface '%s'\n", - ptr->interface_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Say interface '%s'\n", ptr->interface_name); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "say"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "name", "%s", ptr->interface_name); @@ -387,17 +360,14 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable for (ptr = new_module->module_interface->management_interface; ptr; ptr = ptr->next) { if (!ptr->relative_oid) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load management interface from %s due to no interface name.\n", key); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load management interface from %s due to no interface name.\n", key); } else { if (switch_core_hash_find(loadable_modules.management_hash, ptr->relative_oid)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed to load management interface %s. OID %s already exists\n", key, - ptr->relative_oid); + "Failed to load management interface %s. OID %s already exists\n", key, ptr->relative_oid); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Adding Management interface '%s' OID[%s.%s]\n", key, FREESWITCH_OID_PREFIX, - ptr->relative_oid); + "Adding Management interface '%s' OID[%s.%s]\n", key, FREESWITCH_OID_PREFIX, ptr->relative_oid); switch_core_hash_insert(loadable_modules.management_hash, ptr->relative_oid, (const void *) ptr); if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "management"); @@ -480,8 +450,7 @@ static switch_status_t switch_loadable_module_load_file(char *filename, switch_l module->lib = dso; *new_module = module; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", - module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name); return SWITCH_STATUS_SUCCESS; @@ -599,8 +568,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filen if (module->switch_module_runtime) { switch_core_launch_thread(switch_loadable_module_exec, module, loadable_modules.pool); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", - module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name); return switch_loadable_module_process((char *) module->filename, module); } @@ -615,8 +583,7 @@ static void switch_loadable_module_path_init() if (apr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) { apr_dir_close(perl_dir_handle); - apr_env_set("path", - apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool); + apr_env_set("path", apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool); } } #endif @@ -714,8 +681,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() if (all) { if (apr_dir_open(&module_dir_handle, SWITCH_GLOBAL_dirs.mod_dir, loadable_modules.pool) != APR_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", - SWITCH_GLOBAL_dirs.mod_dir); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", SWITCH_GLOBAL_dirs.mod_dir); return SWITCH_STATUS_GENERR; } @@ -759,20 +725,16 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void) module = (switch_loadable_module_t *) val; if (module->switch_module_shutdown) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping: %s\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping: %s\n", module->module_interface->module_name); if (module->switch_module_shutdown() == SWITCH_STATUS_UNLOAD) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s unloaded.\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s unloaded.\n", module->module_interface->module_name); switch_dso_unload(module->lib); module->lib = NULL; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s shutdown.\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s shutdown.\n", module->module_interface->module_name); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s has no shutdown routine\n", - module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s has no shutdown routine\n", module->module_interface->module_name); } } @@ -858,8 +820,7 @@ SWITCH_DECLARE(switch_management_interface_t *) switch_loadable_module_get_manag return switch_core_hash_find(loadable_modules.management_hash, relative_oid); } -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) { switch_hash_index_t *hi; void *val; @@ -891,8 +852,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool } -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) { int x, i = 0; switch_codec_interface_t *codec_interface; @@ -973,8 +933,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ return i; } -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) { switch_api_interface_t *api; switch_status_t status; diff --git a/src/switch_log.c b/src/switch_log.c index 5daa38ed7e..99147ca1ab 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -111,7 +111,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t fun return SWITCH_STATUS_SUCCESS; } -static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t * thread, void *obj) { /* To Be or Not To Be */ @@ -210,8 +210,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char if (channel == SWITCH_CHANNEL_ID_EVENT) { switch_event_t *event; - if (switch_event_running() == SWITCH_STATUS_SUCCESS - && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { + if (switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Function", "%s", funcp); @@ -250,7 +249,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char } -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) { switch_thread_t *thread; switch_threadattr_t *thd_attr;; diff --git a/src/switch_regex.c b/src/switch_regex.c index d8d338e753..a72890036d 100644 --- a/src/switch_regex.c +++ b/src/switch_regex.c @@ -33,15 +33,11 @@ #include #include SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, - int options, - const char **errorptr, - int *erroroffset, const unsigned char *tables) + int options, const char **errorptr, int *erroroffset, const unsigned char *tables) { return pcre_compile(pattern, options, errorptr, erroroffset, 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) { return pcre_copy_substring(subject, ovector, stringcount, stringnumber, buffer, size); } @@ -49,8 +45,7 @@ SWITCH_DECLARE(void) switch_regex_free(void *data) { pcre_free(data); - } SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector, - uint32_t olen) + } SWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t ** new_re, int *ovector, uint32_t olen) { const char *error = NULL; int erroffset = 0; @@ -92,7 +87,7 @@ SWITCH_DECLARE(void) switch_regex_free(void *data) } -SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, char *data, char *field_data, +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) { char index[10] = ""; @@ -149,16 +144,13 @@ SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_c } //Note our error switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Regular Expression Error expression[%s] error[%s] location[%d]\n", expression, error, - error_offset); + "Regular Expression Error expression[%s] error[%s] location[%d]\n", expression, error, error_offset); //We definitely didn't match anything return SWITCH_STATUS_FALSE; } //So far so good, run the regex - match_count = - pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, 0, offset_vectors, - sizeof(offset_vectors) / sizeof(offset_vectors[0])); + match_count = pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, 0, offset_vectors, sizeof(offset_vectors) / sizeof(offset_vectors[0])); //Clean up if (pcre_prepared) { diff --git a/src/switch_resample.c b/src/switch_resample.c index 84573ae078..b04c86ae6c 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -53,9 +53,7 @@ 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) { #ifdef DISABLE_RESAMPLE *new_resampler = NULL; @@ -75,8 +73,7 @@ SWITCH_DECLARE(switch_status_t) switch_resample_create(switch_audio_resampler_t resampler->factor = (lto_rate / lfrom_rate); resampler->resampler = resample_open(QUALITY, resampler->factor, resampler->factor); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Activate Resampler %d->%d %f\n", resampler->from_rate, - resampler->to_rate, resampler->factor); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Activate Resampler %d->%d %f\n", resampler->from_rate, resampler->to_rate, resampler->factor); resampler->from_size = from_size; resampler->from = (float *) switch_core_alloc(pool, resampler->from_size); resampler->to_size = to_size; @@ -88,8 +85,7 @@ SWITCH_DECLARE(switch_status_t) switch_resample_create(switch_audio_resampler_t } -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) { #ifdef DISABLE_RESAMPLE return 0; @@ -99,8 +95,7 @@ SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resam for (;;) { int srcBlock = MIN(srclen - srcpos, srclen); int lastFlag = (last && (srcBlock == srclen - srcpos)); - o = resample_process(resampler->resampler, resampler->factor, &src[srcpos], srcBlock, lastFlag, &srcused, - &dst[out], dstlen - out); + o = resample_process(resampler->resampler, resampler->factor, &src[srcpos], srcBlock, lastFlag, &srcused, &dst[out], dstlen - out); /* printf("resampling %d/%d (%d) %d %f\n", srcpos, srclen, MIN(dstlen-out, dstlen), srcused, factor); */ srcpos += srcused; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 59ce77fa33..26158ea951 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -164,8 +164,7 @@ struct switch_rtp { }; static int global_init = 0; -static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, - switch_frame_flag_t *flags); +static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, switch_frame_flag_t *flags); static switch_status_t ice_out(switch_rtp_t *rtp_session) { @@ -246,15 +245,14 @@ static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len) remote_ip = switch_get_addr(ipbuf, sizeof(ipbuf), rtp_session->from_addr); - switch_stun_packet_attribute_add_binded_address(rpacket, remote_ip, - switch_sockaddr_get_port(rtp_session->from_addr)); + switch_stun_packet_attribute_add_binded_address(rpacket, remote_ip, switch_sockaddr_get_port(rtp_session->from_addr)); bytes = switch_stun_packet_length(rpacket); switch_socket_sendto(rtp_session->sock, rtp_session->from_addr, 0, (void *) rpacket, &bytes); } } -SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) +SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t * pool) { if (global_init) { return; @@ -280,15 +278,13 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(void) } -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) { switch_socket_t *new_sock = NULL, *old_sock = NULL; switch_status_t status = SWITCH_STATUS_FALSE; *err = NULL; - if (switch_sockaddr_info_get(&rtp_session->local_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != - SWITCH_STATUS_SUCCESS) { + if (switch_sockaddr_info_get(&rtp_session->local_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) { *err = "Local Address Error!"; goto done; } @@ -343,13 +339,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_s return status; } -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) { *err = "Success"; - if (switch_sockaddr_info_get(&rtp_session->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != - SWITCH_STATUS_SUCCESS) { + if (switch_sockaddr_info_get(&rtp_session->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS) { *err = "Remote Address Error!"; return SWITCH_STATUS_FALSE; } @@ -363,9 +357,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) { switch_rtp_t *rtp_session = NULL; srtp_policy_t policy; @@ -418,16 +410,14 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session /* check that hex string is the right length */ if (len < MASTER_KEY_LEN * 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "error: too few digits in key/salt " - "(should be %d hexadecimal digits, found %d)\n", MASTER_KEY_LEN * 2, len); + "error: too few digits in key/salt " "(should be %d hexadecimal digits, found %d)\n", MASTER_KEY_LEN * 2, len); *err = "Crypt Error"; return SWITCH_STATUS_FALSE; } if (strlen(crypto_key) > MASTER_KEY_LEN * 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: too many digits in key/salt " - "(should be %d hexadecimal digits, found %u)\n", - MASTER_KEY_LEN * 2, (unsigned) strlen(crypto_key)); + "(should be %d hexadecimal digits, found %u)\n", MASTER_KEY_LEN * 2, (unsigned) strlen(crypto_key)); *err = "Crypt Error"; return SWITCH_STATUS_FALSE; } @@ -488,15 +478,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session } if (!switch_strlen_zero(timer_name)) { - if (switch_core_timer_init - (&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, - rtp_session->pool) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting timer [%s] %d bytes per %dms\n", - timer_name, samples_per_interval, ms_per_packet); + if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, rtp_session->pool) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet); } else { memset(&rtp_session->timer, 0, sizeof(rtp_session->timer)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error starting timer [%s], async RTP disabled\n", - timer_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error starting timer [%s], async RTP disabled\n", timer_name); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_USE_TIMER); } } @@ -513,15 +499,11 @@ 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) { switch_rtp_t *rtp_session; - if (switch_rtp_create - (&rtp_session, payload, samples_per_interval, ms_per_packet, flags, crypto_key, timer_name, err, - pool) != SWITCH_STATUS_SUCCESS) { + if (switch_rtp_create(&rtp_session, payload, samples_per_interval, ms_per_packet, flags, crypto_key, timer_name, err, pool) != SWITCH_STATUS_SUCCESS) { return NULL; } @@ -630,8 +612,7 @@ SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_se return rtp_session->sock; } -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) { rtp_session->samples_per_interval = samples_per_interval; } @@ -708,9 +689,7 @@ static void do_2833(switch_rtp_t *rtp_session) 4, 0, rtp_session->te, - rtp_session->dtmf_data.timestamp_dtmf, - rtp_session->dtmf_data.out_digit_seq, - rtp_session->dtmf_data.out_digit_ssrc, &flags); + rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_seq, rtp_session->dtmf_data.out_digit_ssrc, &flags); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d sofar=%u dur=%d seq=%d\n", loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf, @@ -723,8 +702,7 @@ static void do_2833(switch_rtp_t *rtp_session) } } - if (!rtp_session->dtmf_data.out_digit_dur && rtp_session->dtmf_data.dtmf_queue - && switch_queue_size(rtp_session->dtmf_data.dtmf_queue)) { + if (!rtp_session->dtmf_data.out_digit_dur && rtp_session->dtmf_data.dtmf_queue && switch_queue_size(rtp_session->dtmf_data.dtmf_queue)) { void *pop; if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) { @@ -756,14 +734,12 @@ static void do_2833(switch_rtp_t *rtp_session) switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, - rtp_session->dtmf_data.out_digit_seq, - rtp_session->dtmf_data.out_digit_ssrc, &flags); + rtp_session->dtmf_data.out_digit_seq, rtp_session->dtmf_data.out_digit_ssrc, &flags); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%d sofar=%u dur=%d seq=%d\n", rtp_session->dtmf_data.out_digit, - rtp_session->dtmf_data.timestamp_dtmf, - rtp_session->dtmf_data.out_digit_sofar, 0, rtp_session->dtmf_data.out_digit_seq); + rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, 0, rtp_session->dtmf_data.out_digit_seq); } free(rdigit); @@ -783,9 +759,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ while (switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); - status = - switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, - &bytes); + status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, &bytes); if (!SWITCH_STATUS_IS_BREAK(status) && rtp_session->timer.interval) { switch_core_timer_step(&rtp_session->timer); @@ -818,8 +792,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (stat) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp unprotection failed with code %d%s\n", stat, - stat == err_status_replay_fail ? " (replay check failed)" : - stat == err_status_auth_fail ? " (auth check failed)" : ""); + stat == err_status_replay_fail ? " (replay check failed)" : stat == err_status_auth_fail ? " (auth check failed)" : ""); return -1; } bytes = sbytes; @@ -833,8 +806,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ check = (uint8_t) (switch_core_timer_check(&rtp_session->timer) == SWITCH_STATUS_SUCCESS); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTO_CNG) && - rtp_session->timer.samplecount >= - (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 50))) { + rtp_session->timer.samplecount >= (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 50))) { uint8_t data[2] = { 0 }; switch_frame_flag_t flags = SFF_NONE; data[0] = 65; @@ -888,10 +860,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host, - switch_sockaddr_get_port(rtp_session->from_addr)); - switch_rtp_set_remote_address(rtp_session, tx_host, - switch_sockaddr_get_port(rtp_session->from_addr), &err); + "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host, switch_sockaddr_get_port(rtp_session->from_addr)); + switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), &err); } } switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); @@ -910,8 +880,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } if (rtp_session->invalid_handler) { - rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, - rtp_session->from_addr); + rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr); } return 0; } @@ -1017,9 +986,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_queue_dtmf(switch_rtp_t *rtp_session, p++; } - status = - switch_buffer_write(rtp_session->dtmf_data.dtmf_buffer, dtmf, - wr) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR; + status = switch_buffer_write(rtp_session->dtmf_data.dtmf_buffer, dtmf, wr) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_MEMERR; switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex); return status; @@ -1134,9 +1101,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp 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) { int bytes = 0; @@ -1159,8 +1124,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi return SWITCH_STATUS_SUCCESS; } -static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, - switch_frame_flag_t *flags) +static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, switch_payload_t payload, switch_frame_flag_t *flags) { switch_size_t bytes; uint8_t fwd = 0; @@ -1178,8 +1142,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data send_msg = (rtp_msg_t *) data; } else { uint8_t m = 0; - if (rtp_session->ts > rtp_session->last_write_ts + rtp_session->samples_per_interval - || rtp_session->ts == rtp_session->samples_per_interval) { + if (rtp_session->ts > rtp_session->last_write_ts + rtp_session->samples_per_interval || rtp_session->ts == rtp_session->samples_per_interval) { m++; } if (rtp_session->cn && payload != rtp_session->cng_pt) { @@ -1204,8 +1167,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data stat = srtp_protect(rtp_session->send_ctx, &send_msg->header, &sbytes); if (stat) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", - stat); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", stat); } bytes = sbytes; @@ -1218,8 +1180,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) && rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode && ((datalen == rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame) || - (datalen > SWITCH_RTP_CNG_PAYLOAD - && rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame == 0))) { + (datalen > SWITCH_RTP_CNG_PAYLOAD && rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame == 0))) { int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)]; uint32_t rate; uint32_t flags; @@ -1272,17 +1233,14 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data rtp_session->vad_data.hangover_hits--; } - if (diff >= rtp_session->vad_data.diff_level - || ++rtp_session->vad_data.hangunder_hits >= rtp_session->vad_data.hangunder) { + if (diff >= rtp_session->vad_data.diff_level || ++rtp_session->vad_data.hangunder_hits >= rtp_session->vad_data.hangunder) { switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING); send_msg->header.m = 1; - rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = - rtp_session->vad_data.cng_count = 0; + rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_TALK)) { switch_event_t *event; if (switch_event_create(&event, SWITCH_EVENT_TALK) == SWITCH_STATUS_SUCCESS) { - switch_channel_t *channel = - switch_core_session_get_channel(rtp_session->vad_data.session); + switch_channel_t *channel = switch_core_session_get_channel(rtp_session->vad_data.session); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } @@ -1295,13 +1253,11 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) { if (++rtp_session->vad_data.hangover_hits >= rtp_session->vad_data.hangover) { switch_clear_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING); - rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = - rtp_session->vad_data.cng_count = 0; + rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_NOTALK)) { switch_event_t *event; if (switch_event_create(&event, SWITCH_EVENT_NOTALK) == SWITCH_STATUS_SUCCESS) { - switch_channel_t *channel = - switch_core_session_get_channel(rtp_session->vad_data.session); + switch_channel_t *channel = switch_core_session_get_channel(rtp_session->vad_data.session); switch_channel_event_set_data(channel, event); switch_event_fire(&event); } @@ -1376,8 +1332,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session_t *session, - switch_codec_t *codec, switch_vad_flag_t flags) +SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session_t *session, switch_codec_t *codec, switch_vad_flag_t flags) { if (!switch_rtp_ready(rtp_session)) { @@ -1395,8 +1350,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session, codec->implementation->samples_per_second, codec->implementation->microseconds_per_frame / 1000, codec->implementation->number_of_channels, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, rtp_session->pool) != SWITCH_STATUS_SUCCESS) { + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, rtp_session->pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n"); return SWITCH_STATUS_FALSE; } @@ -1420,8 +1374,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session, return SWITCH_STATUS_SUCCESS; } -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) { if (!switch_rtp_ready(rtp_session)) { @@ -1463,8 +1416,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra } fwd = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && switch_test_flag(frame, SFF_RAW_RTP)) ? 1 : 0; - packetize = (rtp_session->samples_per_interval > frame->datalen - && (frame->payload == rtp_session->payload)) ? 1 : 0; + packetize = (rtp_session->samples_per_interval > frame->datalen && (frame->payload == rtp_session->payload)) ? 1 : 0; if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) { return -1; @@ -1508,9 +1460,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) { rtp_msg_t send_msg = { {0} }; switch_size_t bytes; @@ -1541,16 +1491,14 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, stat = srtp_protect(rtp_session->send_ctx, &send_msg.header, &sbytes); if (stat) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", - stat); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", stat); } bytes = sbytes; } - if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) &send_msg, &bytes) != - SWITCH_STATUS_SUCCESS) { + if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) &send_msg, &bytes) != SWITCH_STATUS_SUCCESS) { return -1; } return (int) bytes; diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c index 9b6a3ca445..5244fb5384 100644 --- a/src/switch_scheduler.c +++ b/src/switch_scheduler.c @@ -22,7 +22,7 @@ static struct { switch_memory_pool_t *memory_pool; } globals; -static void switch_scheduler_execute(switch_scheduler_task_container_t *tp) +static void switch_scheduler_execute(switch_scheduler_task_container_t * tp) { switch_event_t *event; //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing task %u %s (%s)\n", tp->task.task_id, tp->desc, switch_str_nil(tp->task.group)); @@ -50,7 +50,7 @@ static void switch_scheduler_execute(switch_scheduler_task_container_t *tp) } } -static void *SWITCH_THREAD_FUNC task_own_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC task_own_thread(switch_thread_t * thread, void *obj) { switch_scheduler_task_container_t *tp = (switch_scheduler_task_container_t *) obj; switch_memory_pool_t *pool; @@ -121,7 +121,7 @@ static int task_thread_loop(int done) return done; } -static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t *thread, void *obj) +static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t * thread, void *obj) { globals.task_thread_running = 1; @@ -144,9 +144,7 @@ static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t *th 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) { switch_scheduler_task_container_t *container, *tp; switch_event_t *event; diff --git a/src/switch_stun.c b/src/switch_stun.c index 178b5940d1..01f1d5ed49 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -113,7 +113,7 @@ SWITCH_DECLARE(void) switch_stun_random_string(char *buf, uint16_t len, char *se -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) { switch_stun_packet_t *packet; switch_stun_packet_attribute_t *attr; @@ -176,15 +176,14 @@ SWITCH_DECLARE(const char *) switch_stun_value_to_name(int32_t type, uint32_t va return "INVALID"; } -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) { switch_stun_ip_t *ip; uint8_t x, *i; char *p = ipstr; ip = (switch_stun_ip_t *) attribute->value; - i = (uint8_t *) & ip->address; + i = (uint8_t *) &ip->address; *ipstr = 0; for (x = 0; x < 4; x++) { sprintf(p, "%u%s", i[x], x == 3 ? "" : "."); @@ -194,8 +193,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_s return 1; } -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) { uint16_t cpylen; @@ -203,8 +201,7 @@ SWITCH_DECLARE(char *) switch_stun_packet_attribute_get_username(switch_stun_pac return memcpy(username, attribute->value, cpylen); } -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) { switch_stun_packet_header_t *header; @@ -222,23 +219,21 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_st return (switch_stun_packet_t *) buf; } -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) { switch_stun_packet_attribute_t *attribute; switch_stun_ip_t *ip; uint8_t *i, x; char *p = ipstr; - attribute = - (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length)); + attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length)); attribute->type = htons(SWITCH_STUN_ATTR_MAPPED_ADDRESS); attribute->length = htons(8); ip = (switch_stun_ip_t *) attribute->value; ip->port = htons(port); ip->family = 1; - i = (uint8_t *) & ip->address; + i = (uint8_t *) &ip->address; for (x = 0; x < 4; x++) { i[x] = (uint8_t) atoi(p); @@ -253,16 +248,14 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_binded_address(switch_s return 1; } -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) { switch_stun_packet_attribute_t *attribute; if (ulen % 4 != 0) { return 0; } - attribute = - (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length)); + attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length)); attribute->type = htons(SWITCH_STUN_ATTR_USERNAME); attribute->length = htons(ulen); if (username) { @@ -276,9 +269,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_username(switch_stun_pa } 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) { switch_sockaddr_t *local_addr = NULL, *remote_addr = NULL, *from_addr = NULL; switch_socket_t *sock = NULL; diff --git a/src/switch_swig.c b/src/switch_swig.c index 5c0fb18b90..ee62ca54a9 100644 --- a/src/switch_swig.c +++ b/src/switch_swig.c @@ -165,8 +165,7 @@ int fs_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, c return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int fs_switch_ivr_record_file(switch_core_session_t *session, - switch_file_handle_t *fh, char *file, switch_input_args_t *args, unsigned int limit) +int fs_switch_ivr_record_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args, unsigned int limit) { switch_status_t status; @@ -190,8 +189,7 @@ int fs_ivr_play_file2(switch_core_session_t *session, char *file) } -int fs_switch_ivr_collect_digits_callback(switch_core_session_t *session, - switch_input_args_t *args, unsigned int timeout) +int fs_switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, unsigned int timeout) { switch_status_t status; @@ -200,10 +198,7 @@ int fs_switch_ivr_collect_digits_callback(switch_core_session_t *session, } int fs_switch_ivr_collect_digits_count(switch_core_session_t *session, - char *buf, - unsigned int buflen, - unsigned int maxdigits, - const char *terminators, char *terminator, unsigned int timeout) + char *buf, unsigned int buflen, unsigned int maxdigits, const char *terminators, char *terminator, unsigned int timeout) { switch_status_t status; @@ -224,8 +219,7 @@ int fs_switch_ivr_collect_digits_count(switch_core_session_t *session, } */ -int fs_switch_ivr_originate(switch_core_session_t *session, - switch_core_session_t **bleg, char *bridgeto, uint32_t timelimit_sec) +int fs_switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, char *bridgeto, uint32_t timelimit_sec) /*const switch_state_handler_table_t *table, char * cid_name_override, char * cid_num_override, @@ -245,8 +239,7 @@ int fs_switch_ivr_originate(switch_core_session_t *session, timelimit = atoi(var); } - if (switch_ivr_originate(session, &peer_session, &cause, bridgeto, timelimit, NULL, NULL, NULL, NULL) != - SWITCH_STATUS_SUCCESS) { + if (switch_ivr_originate(session, &peer_session, &cause, bridgeto, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n"); switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); return; @@ -265,8 +258,7 @@ int fs_switch_ivr_session_transfer(switch_core_session_t *session, char *extensi return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } -int fs_switch_ivr_speak_text(switch_core_session_t *session, - char *tts_name, char *voice_name, uint32_t rate, char *text) +int fs_switch_ivr_speak_text(switch_core_session_t *session, char *tts_name, char *voice_name, uint32_t rate, char *text) { switch_status_t status; diff --git a/src/switch_utils.c b/src/switch_utils.c index 8cb1d5da73..1b6612690b 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -76,9 +76,7 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int fam if (WSAIoctl(tmp_socket, SIO_ROUTING_INTERFACE_QUERY, - address_info->ai_addr, - (DWORD) address_info->ai_addrlen, - &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL, NULL)) { + address_info->ai_addr, (DWORD) address_info->ai_addrlen, &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL, NULL)) { closesocket(tmp_socket); freeaddrinfo(address_info); @@ -286,7 +284,7 @@ SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key) return '\0'; } -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) { char *data, *p, *d; int count = 1, i = 0; @@ -395,8 +393,7 @@ SWITCH_DECLARE(const char *) switch_cut_path(const char *in) } -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) { size_t i; @@ -443,7 +440,7 @@ SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *sea return dest; } -SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms) +SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t * poll, int ms) { int nsds = 0; diff --git a/src/switch_xml.c b/src/switch_xml.c index f1749a7e21..fe3a3f64c2 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -136,8 +136,7 @@ SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(const char return sections; } -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) { switch_xml_binding_t *binding = NULL, *ptr = NULL; assert(function != NULL); @@ -164,8 +163,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function(switch_xml_searc } -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) { switch_xml_t p = NULL; @@ -776,9 +774,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len) else return switch_xml_err(root, d, "unclosed ') || (l && (*s != ']' || - *(s + strspn(s + 1, SWITCH_XML_WS) + 1) != '>'))); - l = (*s == '[') ? 1 : l) + for (l = 0; *s && ((!l && *s != '>') || (l && (*s != ']' || *(s + strspn(s + 1, SWITCH_XML_WS) + 1) != '>'))); l = (*s == '[') ? 1 : l) s += strcspn(s + 1, "[]>") + 1; if (!*s && e != '>') return switch_xml_err(root, d, "unclosed parent) ? xml->parent->txt : "";