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);
* @{
*/
/** The fundamental pool type */
- typedef struct apr_pool_t switch_memory_pool_t;
+typedef struct apr_pool_t switch_memory_pool_t;
/**
* 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);
/** @} */
* @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.
* @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.
* @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);
/** @} */
* 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.
* @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.
* @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.
*/
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);
/** @} */
/**
* @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
* @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
* @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
* @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.
* 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
* 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);
/** @} */
/** 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);
/** @} */
* 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
* 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
* 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
* 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.
* 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);
/** @} */
* 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);
/** @} */
* @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
* @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
* @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.
* @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
* @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
* @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);
/** @} */
* @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.
* @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.
* @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.
* @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);
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
* @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);
/** @} */
* @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.
* @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
* @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.
* 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
* @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
* @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);
/**
* </PRE>
* @param p The pool for the apr_sockaddr_t and associated storage.
*/
- SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname,
- int32_t family, switch_port_t port, int32_t flags,
- switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
+ int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t * pool);
/**
* Send data over a network.
* APR_EINTR is never returned.
* </PRE>
*/
- SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len);
/**
* @param sock The socket to send from
* @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
* @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);
/**
* APR_EINTR is never returned.
* </PRE>
*/
- SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char *buf, switch_size_t *len);
/**
* Setup socket options for the specified socket
* </PRE>
* @param on Value for the option.
*/
- SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on);
+SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on);
/**
* Setup socket timeout for the specified socket
* t < 0 -- read and write calls block
* </PRE>
*/
- SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t);
+SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock, switch_interval_time_t t);
/**
* Join a Multicast Group
* @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);
* 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
* 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
* 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
\param pool the memory pool to use
\return SWITCH_STATUS_SUCCESS when successful
*/
- SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock,
- int16_t flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t * sock, int16_t flags, switch_memory_pool_t * pool);
/** @} */
/** @} */
/** @} */
- SWITCH_END_EXTERN_C
+SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
\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;
* \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
* \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
\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
\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);
/*!
\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,
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
\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
\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
/** @} */
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
\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
\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
\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
\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
\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
\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.
\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
* 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
*/
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)
*/
#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
#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
\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
\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
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
\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
\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
/** @} */
/*!
\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:
*/
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
\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
///\{
#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
/*!
#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
/*!
#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
/*!
\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
\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
\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
\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
\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
\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
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
/*!
\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
\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
\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
\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
\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
\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
\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
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
\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
\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
\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);
/*!
\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);
/*!
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
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
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
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
\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
\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
\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
\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"
/*!
\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)
\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
\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
\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);
/*!
*/
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
\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
\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
*/
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
\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
\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
\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
\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);
/*!
/*!
\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
* 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);
* 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
* 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
* 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.
* 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
*
* 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
* 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(),
*
* 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().
*
* 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 */
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);
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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
\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);
/*!
\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.
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
\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
\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
\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
\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);
/*!
\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);
/*!
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
\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
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
*/
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
\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
\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
\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);
/*!
\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
\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
\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);
/******************************************************************************************************/
\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
\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
\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
\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
\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
\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);
/******************************************************************************************************/
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;
/******************************************************************************************************/
*\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.
*\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);
/*!
*\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);
/*!
*\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;
*\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
*\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:
\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);
/*!
\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
\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);
\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);
\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
/*! \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 */
/*! 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);
/*! 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;
};
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;
#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;
#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
* @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);
/*!
\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
\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
///\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
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_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);
/*!
\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
\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
\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
\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
\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
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
*/
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
* 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
*
* 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(),
* 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(),
* 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(),
* 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(),
* 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(),
* 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(),
* 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(),
* 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(),
* 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.
* $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
* 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
* 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
* 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.
* 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
* 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
*
* @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
* 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
* 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
*
* 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
* 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
*
* 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
*
* 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
*
* 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
* 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
* 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
* 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
*
****** 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
* 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
* 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
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.
* 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
* 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
** 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
* 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.
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
* 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
* 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
* 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
* 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
* 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().
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
* 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
* 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
*
* 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
*/
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
*
* 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
* 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
*
****** 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
* 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
* 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
* 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
* 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
* 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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
/**
* 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
* 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
/** @} */
/** @} */
\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
\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
\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);
/*!
\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
\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);
/*!
\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
\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);
#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,
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;
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);
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 */
\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
\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
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);
///\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
///\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);
///\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
///\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
&& !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. */
/*.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 */
"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());
refresh++;
r = atoi(refresh);
if (r > 0) {
- stream->write_function(stream,
- "<META HTTP-EQUIV=REFRESH CONTENT=\"%d; URL=/api/status?refresh=%d%s\">\n", r, r,
- html ? "html=1" : "");
+ stream->write_function(stream, "<META HTTP-EQUIV=REFRESH CONTENT=\"%d; URL=/api/status?refresh=%d%s\">\n", r, r, html ? "html=1" : "");
}
}
}
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;
}
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");
}
-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 };
}
-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;
}
-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;
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 };
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;
}
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);
}
assert(cmd != NULL);
tm = strdup(cmd);
assert(tm != NULL);
-
+
if ((dcmd = strchr(tm, ' '))) {
uint32_t id;
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;
}
for (x = 0; x < argc; x++) {
if (holder->http) {
holder->stream->write_function(holder->stream, "<td>");
- holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x],
- x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
+ holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
} else {
holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ",");
}
for (x = 0; x < argc; x++) {
if (holder->http) {
holder->stream->write_function(holder->stream, "<td>");
- holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "",
- x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
+ holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
} else {
- holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "",
- x == (argc - 1) ? "\n" : ",");
+ holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : ",");
}
}
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'");
}
/*.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;
/* 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);
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);
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);
}
/* 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;
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) {
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);
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);
}
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);
}
}
}
/* 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;
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;
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);
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;
}
/* 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;
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);
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);
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;
}
/* 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;
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, */
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;
}
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);
}
}
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 */
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);
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;
}
/* 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 };
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;
}
}
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;
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);
}
/* 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;
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;
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;
/* 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;
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;
}
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;
}
}
/* 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;
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");
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);
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;
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 {
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;
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");
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;
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;
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;
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;
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;
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;
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;
}
-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;
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;
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);
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;
#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;
}
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;
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++;
}
}
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;
/* 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);
}
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;
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);
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;
/* 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;
/* 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)) {
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);
/* 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--;
/* 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 {
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;
}
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;
}
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];
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;
}
}
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;
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);
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);
}
}
}
/* 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;
// 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;
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");
}
}
}
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");
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);
}
}
/* 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;
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;
}
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);
}
}
} 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);
}
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;
// 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);
/*.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 */
/*.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;
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;
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;
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 {
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;
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);
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);
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);
}
}
}
/*.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) {
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:{
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);
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
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;
}
}
-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) {
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;
}
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,
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;
}
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 };
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;
}
/*.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 */
/*.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;
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)
{
/*.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 */
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:{
}
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;
}
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++) {
#else
snprintf(buf + len, sizeof(buf) - len,
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
- "Select one of the following news sources, followed by the pound key or press 0 to exit. "
- ",<break time=\"600ms\"/>");
+ "Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
#endif
len = (int32_t) strlen(buf);
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;
}
}
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);
}
}
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);
}
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;
};
-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;
/*.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;
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];
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;
#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
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;
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");
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
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");
/*.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";
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;
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;
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;
}
-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;
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;
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;
};
-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;
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;
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;
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;
}
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;
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;
}
/*.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;
};
#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;
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");
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");
/*.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;
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;
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;
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;
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;
}
}
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;
/*.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;
};
#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;
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");
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;
}
}
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");
}
}
} 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;
/*.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;
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;
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;
}
}
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;
}
/*.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 */
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;
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;
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;
}
}
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;
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;
-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 */
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;
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;
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;
};
-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;
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;
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;
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;
/*.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;
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;
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) {
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;
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;
/*.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;
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;
}
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;
}
/*.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();
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) {
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;
}
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;
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;
}
- 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);
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 */
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 {
/* 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;
}
}
/*.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 */
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;
}
}
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 {
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);
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,
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);
}
- 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;
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;
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;
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;
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);
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;
}
-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;
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;
}
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;
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);
}
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);
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);
}
- 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);
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);
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;
}
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) {
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;
*/
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;
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;
}
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;
}
}
-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) {
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;
}
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;
}
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) {
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 {
"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;
}
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");
}
}
}
-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;
}
if (!(vcard = switch_xml_child(user, "vcard"))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find <vcard> tag for user [%s@%s]\n", to_user,
- to_host);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find <vcard> tag for user [%s@%s]\n", to_user, to_host);
goto end;
}
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;
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);
}
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);
}
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);
}
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, '+')) {
}
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) {
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;
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;
}
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;
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");
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;
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);
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;
}
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
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);
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),
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);
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",
} 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;
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;
}
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);
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;
}
-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;
}
#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;
*/
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;
}
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);
}
-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) {
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);
}
}
}
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;
}
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) {
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 {
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;
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 {
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;
}
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;
}
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);
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));
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);
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;
}
}
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);
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;
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;
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;
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;
*/
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) {
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);
}
-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;
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;
}
}
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;
}
/*******************************************************************/
-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;
}
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;
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;
}
}
/* 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;
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);
}
}
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;
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;
}
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);
}
}
- 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;
}
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);
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");
"pa devlist\n"
"pa indev [#<num>|<partial name>\n"
"pa outdev [#<num>|<partial name>\n"
- "pa ringdev [#<num>|<partial name>\n"
- "--------------------------------------------------------------------------------\n";
+ "pa ringdev [#<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "%s", usage_string);
** 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);
** 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);
@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.
@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.
/************************************************************************/
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);
* 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;
*
*/
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;
/* 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;
*/
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);
"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[] =
" 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
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);
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);
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);
}
-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;
}
-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;
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;
}
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) {
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);
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);
}
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);
}
}
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);
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 =
}
-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];
-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;
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);
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;
}
if (!tech_pvt->from_str) {
tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, "\"%s\" <sip:%s@%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);
}
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);
}
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);
}
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;
//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);
if ((tech_pvt->from_str = switch_core_session_sprintf(session, "\"%s\" <sip:%s@%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);
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");
}
}
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) {
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());
}
}
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;
}
}
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);
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);
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",
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;
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) {
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;
}
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;
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;
}
}
-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;
#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;
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));
}
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);
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;
}
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;
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());
}
};
-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;
}
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;
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;
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;
}
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;
}
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);
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);
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;
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
(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
}
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);
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;
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)");
}
}
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;
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);
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)) {
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());
}
}
&& (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);
}
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);
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);
}
-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;
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;
}
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;
}
snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s;%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 <sip:%s@%s:%s>",
- display, contact->m_url->url_user, contact->m_url->url_host, port);
+ snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
}
}
}
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 {
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;
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());
}
}
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) {
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);
"</status>\r\n"
"</tuple>\r\n"
"<dm:person id='p06360c4a'>\r\n"
- "<rpid:activities>\r\n"
- "<rpid:%s/>\r\n" "</rpid:activities>%s</dm:person>\r\n" "</presence>", id, open, rpid, note);
+ "<rpid:activities>\r\n" "<rpid:%s/>\r\n" "</rpid:activities>%s</dm:person>\r\n" "</presence>", id, open, rpid, note);
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);
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;
if (contact->m_url->url_params) {
contact_str = switch_mprintf("%s <sip:%s@%s:%s;%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 <sip:%s@%s:%s>",
- display, contact->m_url->url_user, contact->m_url->url_host, port);
+ contact_str = switch_mprintf("%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
}
}
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);
}
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());
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);
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;
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;
}
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;
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;
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);
}
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) {
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;
}
} 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 {
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);
}
-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;
}
-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
//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;
}
}
-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] = "";
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);
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) {
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] = "";
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),
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) {
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);
}
}
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;
}
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);
}
}
- 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;
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;
}
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) {
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;
}
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)))) {
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 {
#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;
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());
}
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);
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;
}
}
}
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;
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;
}
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;
}
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);
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;
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);
}
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;
}
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);
}
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)) {
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)) {
}
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)) {
}
-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;
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;
}
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;
}
}
/*- 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)
:"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)
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;
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;
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;
/* 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;
}
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);
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");
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;
{
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;
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;
{
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;
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;
}
-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 (;;) {
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);
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;
}
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;
}
}
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;
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;
-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;
}
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 {
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;
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;
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] = "";
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;
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;
}
}
} 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;
}
}
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();
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);
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) {
}
#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;
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;
}
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;
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);
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;
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);
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;
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;
}
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);
}
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);
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;
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);
}
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;
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;
}
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);
}
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);
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);
}
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;
}
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;
}
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 {
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) {
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;
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;
}
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;
}
}
}
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;
}
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;
}
-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;
}
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;
}
}
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;
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++;
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;
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
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;
}
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;
}
-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;
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
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);
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;
}
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;
}
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);
// 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;
*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;
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;
*/
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;
}
- 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);
}
-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;
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;
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);
}
-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;
}
}
-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;
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);
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);
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;
}
-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;
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;
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;
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);
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);
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);
-
- 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);
+ 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);
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
globals.panic = 1;
continue;
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);
}
}
}
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;
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);
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);
}
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);
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;
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
// 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();
};
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;
}
}
};
-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));
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;
}
*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;
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;
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)
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;
}
}
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;
}
};
-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) {
-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;
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);
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);
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;
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");
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;
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];
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) {
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);
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;
}
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;
}
#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;
#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;
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;
}
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;
}
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);
}
/*.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;
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;
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;
}
-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",
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);
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;
}
}
-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));
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;
}
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;
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;
}
-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];
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)
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
}
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);
}
* 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;
/*
* 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;
/*
* 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;
}
#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];
/*
* 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];
/*
* 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;
#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;
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;
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;
}
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 {
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;
}
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;
}
}
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;
}
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;
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;
}
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:
/*.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";
}
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;
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;
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;
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));
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++;
- 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) {
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;
* 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;
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");
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;
}
/*
*
*/
-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);
}
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);
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;
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;
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;
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 *);
}
{
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)))
}
{
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)))
}
{
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)))
{
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;
}
}
{
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;
}
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)))
}
{
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)))
}
{
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)))
}
{
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)))
}
{
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)))
}
{
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)))
/* -------- 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}
};
#include <switch.h>
extern void *globalDTMFCallbackFunction;
- extern switch_status_t PythonDTMFCallback(switch_core_session * session,
- void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
+ extern switch_status_t PythonDTMFCallback(switch_core_session * session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
class SessionContainer {
private:
/*.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;
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) {
* 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)
#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
SWIGRUNTIME PyObject *PySwigObject_repr(PySwigObject * v) {
char result[SWIG_BUFFER_SIZE];
- return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
- PyString_FromFormat("<Swig Object at %s>", result) : 0;
+ return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? PyString_FromFormat("<Swig Object at %s>", result) : 0;
}
SWIGRUNTIME PyObject *PySwigObject_str(PySwigObject * v) {
#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;
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;
}
{
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) {
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))
}
{
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) {
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) {
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))
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))
}
{
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) {
/* -------- 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 };
};
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} };
SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * v) {
v = v;
return PyString_FromString("<Swig global variables>");
- }
- SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
+ } SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
swig_globalvar *var;
flags = flags;
fprintf(fp, "Swig global variables { ");
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) {
/* 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;
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))) {
}
}
}
}
-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;
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;
}
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;
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;
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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;
}
*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;
}
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;
}
*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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
};
-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))) {
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;
}
}
}
caller_profile = switch_caller_profile_new(pool,
- 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) {
+ 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) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
goto done;
}
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);
}
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;
}
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;
}
-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;
/*.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;
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]));
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;
{
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;
}
}
/* 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;
}
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;
}
/* 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;
}
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 {
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 */
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);
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");
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;
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 {
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;
}
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
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;
}
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");
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;
}}\
-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;
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) {
}
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;
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;
}
-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;
}
-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;
}
-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;
-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;
/*.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;
/*.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) {
/*.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);
}
-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;
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;
}
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;
}
-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;
}
-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;
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);
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);
}
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")) {
/* 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);
}
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);
}
/* 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);
}
/* 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);
}
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);
}
/* 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);
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);
}
/* 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);
}
/* 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;
/* 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;
/* 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);
}
/* 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);
}
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;
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;
#include <switch.h>
#include <switch_caller.h>
-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,
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)
{
}
-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) {
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];
}
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;
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;
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);
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;
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);
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);
}
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);
{
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[] = {
}
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;
} 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);
}
} 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) {
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 */
}
/* 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) {
}
-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);
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) {
}
}
- 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) {
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) {
}
}
-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) {
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;
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;
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 };
}
-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);
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);
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);
}
}
-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;
}
-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;
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) {
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);
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);
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;
}
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);
#include <switch.h>
#include <switch_config.h>
-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;
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) {
}
-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) {
-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;
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);
}
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;
}
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);
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)
}
-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];
}
}
-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;
*/
-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;
}
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;
}
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;
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);
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);
#include <switch.h>
#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;
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);
}
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);
}
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;
/* 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;
}
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;
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);
}
- 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);
}
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);
}
- 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);
}
}
-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);
}
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);
}
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);
}
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);
}
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);
}
}
-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;
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;
}
#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;
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;
#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;
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;
}
-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;
}
-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;
}
-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;
}
-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;
}
-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;
}
-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;
}
-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;
#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;
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);
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);
#include <switch.h>
#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);
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);
}
#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;
}
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;
}
}
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;
}
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:
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;
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;
} 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;
}
}
- 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;
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) {
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;
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;
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;
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;
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) {
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;
}
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;
}
}
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);
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;
}
}
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:
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;
}
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) {
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;
}
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;
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;
}
}
};
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) {
}
-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;
}
-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;
}
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;
}
}
#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;
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) {
}
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);
}
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;
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;
}
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;
}
-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;
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) {
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);
};
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;
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;
#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
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
}
}
}
#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)
{
}
#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)
{
#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
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;
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;
}
}
}
}
- 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;
}
}
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;
}
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))) {
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;
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;
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;
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;
}
-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;
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;
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;
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;
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;
}
}
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);
}
-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;
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;
}
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;
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;
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;
}
-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;
#include <switch.h>
#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);
}
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);
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;
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;
}
#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;
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;
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:
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"));
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:
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:
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;
}
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");
}
-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;;
" 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"
" 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);
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");
}
}
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)));
}
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");
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);
}
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);
}
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);
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
}
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
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 {
}
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
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 {
}
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
}
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
}
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
}
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
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 {
}
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
#include <switch.h>
#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;
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;
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;;
}
-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) {
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];
{
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;
}
}
-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;
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;
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;
}
}
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 {
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;
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;
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;
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);
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);
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;
}
// 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) {
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;
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;
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;
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;
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;
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;
}
}
// 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
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;
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;
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;
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++))) {
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) {
}
-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;
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;
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;
}
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);
}
-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;
}
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;
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");
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;
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);
}
}
-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);
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 {
}
-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);
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);
}
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;
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)
return SWITCH_STATUS_SUCCESS;
}
-
-
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;
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);
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);
}
}
}
} 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);
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);
/* 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);
}
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);
}
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;
}
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);
/*.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;
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);
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);
}
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;
}
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;
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));
}
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;
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) {
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;
}
-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;
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;
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;
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;
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;
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);
}
}
}
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);
}
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;
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:
}
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);
}
}
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) {
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;
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);
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;
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;
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;
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");
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);
}
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);
}
}
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);
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;
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;
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);
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]);
}
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);
}
}
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);
}
}
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);
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;
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 {
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);
}
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;
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;
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;
} 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)) {
}
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))
}
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;
}
}
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 {
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));
}
}
}
-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] = "";
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");
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);
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);
}
}
}
}
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];
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;
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 {
#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];
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;
}
"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);
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;
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;
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
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) {
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) {
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");
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];
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;
}
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;
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);
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++) {
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)
{
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);
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);
}
}
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);
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) {
}
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);
}
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) {
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) {
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);
}
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);
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]);
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);
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);
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);
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);
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);
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");
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;
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);
}
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
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;
}
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);
}
}
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;
}
-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;
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;
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 */
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);
}
-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;;
#include <switch.h>
#include <pcre.h>
\r \rSWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
- int options,
- const char **errorptr,
- int *erroroffset, \rconst unsigned char *tables) \r
+ int options, const char **errorptr, int *erroroffset, \rconst unsigned char *tables) \r
{
\rreturn pcre_compile(pattern, options, errorptr, erroroffset, tables);
\r}
-\r\rSWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject,
- int *ovector,
- int stringcount, int stringnumber, char *buffer, int size)
+\r\rSWITCH_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);
}
SWITCH_DECLARE(void) switch_regex_free(void *data)
{
pcre_free(data);
-\r} \r\rSWITCH_DECLARE(int) switch_regex_perform(char *field, char *expression, switch_regex_t **new_re, int *ovector,
- uint32_t olen)
+\r} \r\rSWITCH_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;
}
-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] = "";
}
//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) {
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;
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;
}
-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;
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;
};
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)
{
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;
}
-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;
}
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;
}
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;
/* 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;
}
}
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);
}
}
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;
}
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;
}
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,
}
}
- 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) {
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);
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);
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;
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;
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);
}
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;
}
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;
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;
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;
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) {
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_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;
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);
}
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);
}
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)) {
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;
}
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)) {
}
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;
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;
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;
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));
}
}
-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;
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;
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;
-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;
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 ? "" : ".");
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;
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;
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);
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) {
}
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;
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;
}
-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;
}
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;
}
*/
-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,
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;
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;
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);
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;
}
-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;
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;
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);
}
-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;
else
return switch_xml_err(root, d, "unclosed <![CDATA[");
} else if (!strncmp(s, "!DOCTYPE", 8)) { // dtd
- for (l = 0; *s && ((!l && *s != '>') || (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 <!DOCTYPE");
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)
{
switch_xml_t conf = NULL;
switch_xml_t tag = NULL;
}
}
- if ((conf = switch_xml_find_child(xml, "section", "name", section)) &&
- (tag = switch_xml_find_child(conf, tag_name, key_name, key_value))) {
+ if ((conf = switch_xml_find_child(xml, "section", "name", section)) && (tag = switch_xml_find_child(conf, tag_name, key_name, key_value))) {
*node = tag;
*root = xml;
return SWITCH_STATUS_SUCCESS;
switch_thread_rwlock_wrlock(RWLOCK);
}
- snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR,
- "freeswitch.xml");
+ snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
if ((new_main = switch_xml_parse_file(path_buf))) {
*err = switch_xml_error(new_main);
}
-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_xml_t xml;
XML_MEMORY_POOL = pool;
assert(MAIN_XML_ROOT != NULL);
- if (switch_xml_locate("configuration", "configuration", "name", file_path, &xml, &cfg, params) ==
- SWITCH_STATUS_SUCCESS) {
+ if (switch_xml_locate("configuration", "configuration", "name", file_path, &xml, &cfg, params) == SWITCH_STATUS_SUCCESS) {
*node = cfg;
}
// Encodes ampersand sequences appending the results to *dst, reallocating *dst
// if length excedes max. a is non-zero for attribute encoding. Returns *dst
-static char *switch_xml_ampencode(const char *s, switch_size_t len, char **dst, switch_size_t *dlen, switch_size_t *max,
- short a)
+static char *switch_xml_ampencode(const char *s, switch_size_t len, char **dst, switch_size_t *dlen, switch_size_t *max, short a)
{
const char *e = NULL;
// Recursively converts each tag to xml appending it to *s. Reallocates *s if
// its length excedes max. start is the location of the previous tag in the
// parent tag's character content. Returns *s.
-static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, switch_size_t *max,
- switch_size_t start, char ***attr, uint32_t * count)
+static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, switch_size_t *max, switch_size_t start, char ***attr, uint32_t * count)
{
int i, j;
char *txt = (xml->parent) ? xml->parent->txt : "";