diff --git a/src/fs_encode.c b/src/fs_encode.c index a6192ac84f..235a5d9f11 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2015, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Rene * * fs_encode.c -- Encode a native file @@ -53,7 +53,7 @@ static void fs_encode_cleanup() switch_safe_free(SWITCH_GLOBAL_dirs.log_dir); } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { int r = 1; switch_bool_t verbose = SWITCH_FALSE; @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) i++; /* Load extra modules */ if (strchr(argv[i], ',')) { - extra_modules_count = switch_split(argv[i], ',', extra_modules); + extra_modules_count = switch_split(argv[i], ',', extra_modules); } else { extra_modules_count = 1; extra_modules[0] = argv[i]; @@ -136,24 +136,24 @@ int main(int argc, char *argv[]) break; } } - + if (argc - i < 2 || cmd_fail) { goto usage; } - + input = argv[i++]; output = argv[i++]; if (zstr(input) || zstr(output) || !(format = strchr(output, '.'))) { goto usage; } - + format++; - + if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Cannot init core [%s]\n", err); goto end; } - + switch_loadable_module_init(SWITCH_FALSE); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_TRUE, &err); switch_loadable_module_load_module("", "CORE_SPEEX_MODULE", SWITCH_TRUE, &err); @@ -165,17 +165,17 @@ int main(int argc, char *argv[]) goto end; } } - + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_spandsp", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Cannot init mod_spandsp [%s]\n", err); goto end; } - + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Cannot init mod_sndfile [%s]\n", err); goto end; } - + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_native_file", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Cannot init mod_native_file [%s]\n", err); goto end; @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Couldn't open %s\n", input); goto end; } - + if (verbose) { fprintf(stderr, "Opening file %s\n", output); @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", p, rate, ptime); goto end; } - + if (switch_core_codec_init_with_bitrate(&raw_codec, "L16", NULL, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", "L16", rate, ptime); goto end; @@ -231,9 +231,9 @@ int main(int argc, char *argv[]) if (switch_core_file_open(&fh_output, output, channels, codec.implementation->actual_samples_per_second, out_flags, NULL) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't open %s\n", output); - goto end; + goto end; } - + if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) { in_asis = 1; } @@ -249,9 +249,9 @@ int main(int argc, char *argv[]) switch_assert(sizeof(buf) >= len * 2); if (verbose) { - fprintf(stderr, "Frame size is %d\n", blocksize); + fprintf(stderr, "Frame size is %d\n", blocksize); } - + while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) { char encode_buf[2048]; uint32_t encoded_len = sizeof(buf); @@ -263,13 +263,13 @@ int main(int argc, char *argv[]) fprintf(stderr, "Codec encoder error\n"); goto end; } - + len = encoded_len; } else { if (!in_asis) { encoded_len = len; } else if (in_asis) { - + switch_core_codec_decode(&codec, &raw_codec, buf, @@ -289,14 +289,14 @@ int main(int argc, char *argv[]) fprintf(stderr, "Write error\n"); goto end; } - + if (len != encoded_len) { printf("Short write: wrote %"SWITCH_SIZE_T_FMT"/%d bytes\n", len, encoded_len); } - + len = blocksize; } - + r = 0; end: @@ -307,17 +307,17 @@ end: if (fh_input.file_interface) { - switch_core_file_close(&fh_input); + switch_core_file_close(&fh_input); } if (fh_output.file_interface) { - switch_core_file_close(&fh_output); + switch_core_file_close(&fh_output); } if (pool) { switch_core_destroy_memory_pool(&pool); } - + fs_encode_cleanup(); //switch_core_destroy(); diff --git a/src/include/g711.h b/src/include/g711.h index aac82a15ac..224e42f964 100644 --- a/src/include/g711.h +++ b/src/include/g711.h @@ -25,7 +25,7 @@ these routines are slow in C, is the lack of direct access to the CPU's "find the first 1" instruction. A little in-line assembler fixes that, and the conversion routines can be faster than lookup tables, in most real world usage. A "find the first 1" instruction is available on most modern CPUs, and is a -much underused feature. +much underused feature. If an assembly language method of bit searching is not available, these routines revert to a method that can be a little slow, so the cache thrashing might not diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index d3b9de1e80..83f93390bb 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -235,11 +235,11 @@ struct switch_media_bug { switch_image_t *spy_img[2]; switch_vid_spy_fmt_t spy_fmt; switch_thread_t *video_bug_thread; - + switch_buffer_t *text_buffer; char *text_framedata; uint32_t text_framesize; - + struct switch_media_bug *next; }; diff --git a/src/include/private/switch_hashtable_private.h b/src/include/private/switch_hashtable_private.h index fbd08f11d5..c12f11d917 100644 --- a/src/include/private/switch_hashtable_private.h +++ b/src/include/private/switch_hashtable_private.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * switch_hashtable_private.h -- Hashtable @@ -89,23 +89,23 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) { /* * Copyright (c) 2002, Christopher Clark * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/src/include/switch.h b/src/include/switch.h index e38846d6eb..89a79f1ee6 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * switch.h -- Main Library Header @@ -164,7 +164,7 @@ * - OpenBSD 5.x * * \section depends Dependencies - * Freeswitch makes heavy use of external libraries. + * Freeswitch makes heavy use of external libraries. * * libFreeSWITCH: * - APR (http://apr.apache.org) @@ -199,7 +199,7 @@ * * mod_b64 * - Base64 codec tranfers data base64 encoded (http://www.b64codec.org) - * + * * mod_bv * - BroadVoice16 (8kHz) and BroadVoice32 (16kHz) (https://www.broadcom.com/support/broadvoice) * @@ -219,7 +219,7 @@ * Directories * mod_ldap * - openldap (*nix only http://www.openldap.org/) - * + * * Endpoints * mod_portaudio * - portaudio (http://www.portaudio.com/) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 07f65063e6..2157007046 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Eliot Gable * @@ -31,7 +31,7 @@ */ /*! \file switch_apr.h \brief APR includes header - + The things powered by APR are renamed into the switch_ namespace to provide a cleaner look to things and helps me to document what parts of APR I am using I'd like to take this opportunity to thank APR for all the awesome stuff it does and for making my life much easier. @@ -53,7 +53,7 @@ typedef pthread_t switch_thread_id_t; SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void); -/*! \brief Compare two thread ids +/*! \brief Compare two thread ids * \param tid1 1st Thread ID to compare * \param tid2 2nd Thread ID to compare */ @@ -71,7 +71,7 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i */ /** * @defgroup switch_memory_pool Memory Pool Functions - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ /** The fundamental pool type */ @@ -142,7 +142,7 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first(switch_memory_pool_ /** * Continue iterating over the entries in a hash table. * @param ht The iteration state - * @return a pointer to the updated iteration state. NULL if there are no more + * @return a pointer to the updated iteration state. NULL if there are no more * entries. */ SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(switch_hash_index_t *ht); @@ -171,7 +171,7 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht); * The default hash function. * @param key pointer to the key. * @param klen the key length. - * + * */ SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen); @@ -180,7 +180,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw /** * @defgroup switch_time Time Routines - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ @@ -261,7 +261,7 @@ SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t * * format which requires the indicated amount of storage, * including the trailing NUL terminator. * @param date_str String to write to. - * @param t the time to convert + * @param t the time to convert */ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t); @@ -273,7 +273,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t 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 + * Convert time value from human readable format to a numeric apr_time_t * e.g. elapsed usec since epoch * @param result the resulting imploded time * @param input the input exploded time @@ -297,7 +297,7 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, sw /** * Sleep for the specified number of micro-seconds. * @param t desired amount of time to sleep. - * @warning May sleep for longer than the specified time. + * @warning May sleep for longer than the specified time. */ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t); SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t); @@ -449,7 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock /** * @defgroup switch_thread_cond Condition Variable Routines - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ @@ -496,8 +496,8 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *co * @param mutex the mutex that must be locked upon entering this function, * is released while the thread is asleep, and is again acquired before * returning from this function. - * @param timeout The amount of time in microseconds to wait. This is - * a maximum, not a minimum. If the condition is signaled, we + * @param timeout The amount of time in microseconds to wait. This is + * a maximum, not a minimum. If the condition is signaled, we * will wake up before this time, otherwise the error APR_TIMEUP * is returned. */ @@ -589,7 +589,7 @@ SWITCH_DECLARE(switch_status_t) switch_md5_string(char digest_str[SWITCH_MD5_DIG /** Opaque structure used for queue API */ typedef struct apr_queue_t switch_queue_t; -/** +/** * create a FIFO queue * @param queue The new queue * @param queue_capacity maximum size of the queue @@ -677,7 +677,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void /** * @defgroup switch_file_io File I/O Handling Functions - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ @@ -703,7 +703,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void /** - * @defgroup switch_file_permissions File Permissions flags + * @defgroup switch_file_permissions File Permissions flags * @ingroup switch_file_io * @{ */ @@ -784,7 +784,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void * SWITCH_FOPEN_CREATE create the file if not there * SWITCH_FOPEN_APPEND file ptr is set to end prior to all writes * SWITCH_FOPEN_TRUNCATE set length to zero if file exists - * SWITCH_FOPEN_BINARY not a text file (This flag is ignored on + * SWITCH_FOPEN_BINARY not a text file (This flag is ignored on * UNIX because it has no meaning) * SWITCH_FOPEN_BUFFERED buffer the data. Default is non-buffered * SWITCH_FOPEN_EXCL return error if APR_CREATE and file exists @@ -794,7 +794,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void * SWITCH_FOPEN_SHARELOCK Platform dependent support for higher * level locked read/write access to support * writes across process/machines - * SWITCH_FOPEN_NOCLEANUP Do not register a cleanup with the pool + * SWITCH_FOPEN_NOCLEANUP Do not register a cleanup with the pool * passed in on the pool argument (see below). * The apr_os_file_t handle in apr_file_t will not * be closed when the pool is destroyed. @@ -860,7 +860,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *b * Write data to the specified file. * @param thefile The file descriptor to write to. * @param buf The buffer which contains the data. - * @param nbytes On entry, the number of bytes to write; on exit, the number + * @param nbytes On entry, the number of bytes to write; on exit, the number * of bytes written. * * @remark apr_file_write will write up to the specified number of @@ -924,7 +924,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir); /** * @defgroup switch_thread_proc Threads and Process Functions - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ @@ -955,7 +955,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** /** * Set if newly created threads should be created in detached state. - * @param attr The threadattr to affect + * @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); @@ -975,7 +975,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre /** * @defgroup switch_network_io Network Routines - * @ingroup switch_apr + * @ingroup switch_apr * @{ */ @@ -1048,12 +1048,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock /** * Shutdown either reading, writing, or both sides of a socket. - * @param sock The socket to close + * @param sock The socket to close * @param how How to shutdown the socket. One of: *
  *            SWITCH_SHUTDOWN_READ         no longer allow read requests
  *            SWITCH_SHUTDOWN_WRITE        no longer allow write requests
- *            SWITCH_SHUTDOWN_READWRITE    no longer allow read or write requests 
+ *            SWITCH_SHUTDOWN_READWRITE    no longer allow read or write requests
  * 
* @see switch_shutdown_how_e * @remark This does not actually close the socket descriptor, it just @@ -1063,13 +1063,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, sw /** * Close a socket. - * @param sock The socket to close + * @param sock The socket to close */ SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock); /** * Bind the socket to its associated port - * @param sock The socket to bind + * @param sock The socket to bind * @param sa The socket address to bind to * @remark This may be where we will find out if there is any other process * using the selected port. @@ -1078,10 +1078,10 @@ SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch /** * Listen to a bound socket for connections. - * @param sock The socket to listen on + * @param sock The socket to listen on * @param backlog The number of outstanding connections allowed in the sockets * listen queue. If this value is less than zero, the listen - * queue size is set to zero. + * queue size is set to zero. */ SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog); @@ -1096,9 +1096,9 @@ SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int3 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 + * Issue a connection request to a socket either on the same machine * or a different one. - * @param sock The socket we wish to use for our side of the connection + * @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); @@ -1122,7 +1122,7 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw * @param sa The new apr_sockaddr_t. * @param hostname The hostname or numeric address string to resolve/parse, or * NULL to build an address that corresponds to 0.0.0.0 or :: - * @param family The address family to use, or SWITCH_UNSPEC if the system should + * @param family The address family to use, or SWITCH_UNSPEC if the system should * decide. * @param port The port number. * @param flags Special processing flags: @@ -1148,12 +1148,12 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s /** * Send data over a network. * @param sock The socket to send the data over. - * @param buf The buffer which contains the data to be sent. + * @param buf The buffer which contains the data to be sent. * @param len On entry, the number of bytes to send; on exit, the number * of bytes sent. * @remark *
- * This functions acts like a blocking write by default.  To change 
+ * This functions acts like a blocking write by default.  To change
  * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  * socket option.
  *
@@ -1173,7 +1173,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
  */
 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_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len);
 
 /**
@@ -1191,12 +1191,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
 /**
  * Read data from a network.
  * @param sock The socket to read the data from.
- * @param buf The buffer to store the data in. 
+ * @param buf The buffer to store the data in.
  * @param len On entry, the number of bytes to receive; on exit, the number
  *            of bytes received.
  * @remark
  * 
- * This functions acts like a blocking read by default.  To change 
+ * This functions acts like a blocking read by default.  To change
  * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  * socket option.
  * The number of bytes actually received is stored in argument 3.
@@ -1214,7 +1214,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *
  * @param sock The socket to set up.
  * @param opt The option we would like to configure.  One of:
  * 
- *            APR_SO_DEBUG      --  turn on debugging information 
+ *            APR_SO_DEBUG      --  turn on debugging information
  *            APR_SO_KEEPALIVE  --  keep connections active
  *            APR_SO_LINGER     --  lingers on close if data is present
  *            APR_SO_NONBLOCK   --  Turns blocking on/off for socket
@@ -1263,9 +1263,9 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock,
  * Join a Multicast Group
  * @param sock The socket to join a multicast group
  * @param join The address of the multicast group to join
- * @param iface Address of the interface to use.  If NULL is passed, the 
+ * @param iface Address of the interface to use.  If NULL is passed, the
  *              default multicast interface will be used. (OS Dependent)
- * @param source Source Address to accept transmissions from (non-NULL 
+ * @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);
@@ -1331,7 +1331,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
 
 /**
  * Setup a pollset object
- * @param pollset  The pointer in which to return the newly created object 
+ * @param pollset  The pointer in which to return the newly created object
  * @param size The maximum number of descriptors that this pollset can hold
  * @param pool The pool from which to allocate the pollset
  * @param flags Optional flags to modify the operation of the pollset.
@@ -1382,16 +1382,16 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset,
 
 /**
  * Poll the sockets in the poll structure
- * @param aprset The poll structure we will be using. 
+ * @param aprset The poll structure we will be using.
  * @param numsock The number of sockets we are polling
  * @param nsds The number of sockets signalled.
- * @param timeout The amount of time in microseconds to wait.  This is 
- *                a maximum, not a minimum.  If a socket is signalled, we 
- *                will wake up before this time.  A negative number means 
+ * @param timeout The amount of time in microseconds to wait.  This is
+ *                a maximum, not a minimum.  If a socket is signalled, we
+ *                will wake up before this time.  A negative number means
  *                wait until a socket is signalled.
- * @remark The number of sockets signalled is returned in the third argument. 
- *         This is a blocking call, and it will not return until either a 
- *         socket has been signalled, or the timeout has expired. 
+ * @remark The number of sockets signalled is returned in the third argument.
+ *         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);
 
@@ -1415,7 +1415,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, s
 SWITCH_DECLARE(switch_status_t) switch_socket_create_pollset(switch_pollfd_t ** poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
 
 SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct timeval *tvp);
-																
+
 
 /*!
   \brief Create a pollfd out of a socket
@@ -1442,14 +1442,14 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, swi
 /**
  * Get the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are getting a timeout for.
- * @param timeout The current timeout value in microseconds. 
+ * @param timeout The current timeout value in microseconds.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout);
 
 /**
  * Set the timeout value for a pipe or manipulate the blocking state.
  * @param thepipe The pipe we are setting a timeout on.
- * @param timeout The timeout value in microseconds.  Values < 0 mean wait 
+ * @param timeout The timeout value in microseconds.  Values < 0 mean wait
  *        forever, 0 means do not wait at all.
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout);
diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h
index 612d6b5c50..5578cd4f33 100644
--- a/src/include/switch_bitpack.h
+++ b/src/include/switch_bitpack.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -56,9 +56,9 @@ static inline char *print_bits(switch_byte_t byte, char *x)
 
 
 /*!
-  \defgroup bp1 Bitpacking 
+  \defgroup bp1 Bitpacking
   \ingroup core1
-  \{ 
+  \{
 */
 
 static const uint8_t SWITCH_BITPACKED_MASKS[] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 };
@@ -70,7 +70,7 @@ static const uint8_t SWITCH_REVERSE_BITPACKED_MASKS[] = { 255, 254, 252, 248, 24
   \param bitlen the number of bits per packet
   \param buf the buffer to use for storage
   \param buflen the length of the storage buffer
-  \param mode RFC3551 or AAL2 mode (curse you backwards folks) 
+  \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,
diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h
index e5af0baf0a..7025308544 100644
--- a/src/include/switch_buffer.h
+++ b/src/include/switch_buffer.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,14 +22,14 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
  * switch_buffer.h -- Data Buffering Code
  *
  */
-/** 
+/**
  * @file switch_buffer.h
  * @brief Data Buffering Code
  * @see switch_buffer
@@ -56,7 +56,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create_partition(switch_memory_poo
 SWITCH_DECLARE(switch_status_t) switch_buffer_set_partition_data(switch_buffer_t *buffer, void *data, switch_size_t datalen);
 SWITCH_DECLARE(switch_status_t) switch_buffer_reset_partition_data(switch_buffer_t *buffer);
 
-/*! \brief Allocate a new switch_buffer 
+/*! \brief Allocate a new switch_buffer
  * \param pool Pool to allocate the buffer from
  * \param buffer returned pointer to the new buffer
  * \param max_len length required by the buffer
@@ -64,7 +64,7 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_reset_partition_data(switch_buffer
  */
 SWITCH_DECLARE(switch_status_t) switch_buffer_create(_In_ switch_memory_pool_t *pool, _Out_ switch_buffer_t **buffer, _In_ switch_size_t max_len);
 
-/*! \brief Allocate a new dynamic switch_buffer 
+/*! \brief Allocate a new dynamic switch_buffer
  * \param buffer returned pointer to the new buffer
  * \param blocksize length to realloc by as data is added
  * \param start_len ammount of memory to reserve initially
@@ -79,25 +79,25 @@ SWITCH_DECLARE(void) switch_buffer_lock(_In_ switch_buffer_t *buffer);
 SWITCH_DECLARE(switch_status_t) switch_buffer_trylock(_In_ switch_buffer_t *buffer);
 SWITCH_DECLARE(void) switch_buffer_unlock(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the length of a switch_buffer_t 
+/*! \brief Get the length of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int size of the buffer.
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_len(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the freespace of a switch_buffer_t 
+/*! \brief Get the freespace of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int freespace in the buffer.
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(_In_ switch_buffer_t *buffer);
 
-/*! \brief Get the in use amount of a switch_buffer_t 
+/*! \brief Get the in use amount of a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \return int ammount of buffer curently in use
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(_In_ switch_buffer_t *buffer);
 
-/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available.  Remove read data from buffer. 
+/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available.  Remove read data from buffer.
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
@@ -105,7 +105,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(_In_ switch_buffer_t *buffer);
  */
 SWITCH_DECLARE(switch_size_t) switch_buffer_read(_In_ switch_buffer_t *buffer, _In_ void *data, _In_ switch_size_t datalen);
 
-/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available, without removing read data from buffer. 
+/*! \brief Read data from a switch_buffer_t up to the ammount of datalen if it is available, without removing read data from buffer.
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
@@ -115,7 +115,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_peek(_In_ switch_buffer_t *buffer, _
 
 SWITCH_DECLARE(switch_size_t) switch_buffer_peek_zerocopy(_In_ switch_buffer_t *buffer, _Out_ const void **ptr);
 
-/*! \brief Read data endlessly from a switch_buffer_t 
+/*! \brief Read data endlessly from a switch_buffer_t
  * \param buffer any buffer of type switch_buffer_t
  * \param data pointer to the read data to be returned
  * \param datalen amount of data to be returned
diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h
index 54fbcc062c..3f702fae08 100644
--- a/src/include/switch_caller.h
+++ b/src/include/switch_caller.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -45,7 +45,7 @@
  *
  *	In addition, this module implements an abstract interface for extensions and applications.
  *	A connected session's channel has one extension object which may have one or more applications
- *	linked into a stack which will be executed in order by the session's state machine when the 
+ *	linked into a stack which will be executed in order by the session's state machine when the
  *	current state is CS_EXECUTE.
  * @{
  */
@@ -217,7 +217,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application_printf(_In_ switch_
   \param ani ANI information
   \param aniii ANI II information
   \param rdnis RDNIS
-  \param source the source 
+  \param source the source
   \param context a logical context
   \param destination_number destination number
   \return a new profile object allocated from the session's memory pool
diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h
index f720bf2d98..b348dccc51 100644
--- a/src/include/switch_channel.h
+++ b/src/include/switch_channel.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,14 +22,14 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
  * switch_channel.h -- Media Channel Interface
  *
  */
-/** 
+/**
  * @file switch_channel.h
  * @brief Media Channel Interface
  * @see switch_channel
@@ -292,16 +292,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_transfer_variable_prefix(switch_c
 #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
 
 
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, 
-																		 const char *varname, const char *val, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel,
+																		 const char *varname, const char *val,
 																		 const char *export_varname,
 																		 switch_bool_t var_check);
 
-SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, 
+SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel,
 												   switch_event_t *var_event, const char *export_varname);
 
 #define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE)
-SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, 
+SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname,
 																	  const char *export_varname, const char *fmt, ...);
 
 SWITCH_DECLARE(void) switch_channel_set_scope_variables(switch_channel_t *channel, switch_event_t **event);
@@ -333,7 +333,7 @@ static inline int switch_channel_var_true(switch_channel_t *channel, const char
 SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel);
 
 /*!
- * \brief Stop iterating over channel variables. 
+ * \brief Stop iterating over channel variables.
  * \remark Unlocks the profile mutex initially locked in switch_channel_variable_first
  */
 SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
@@ -363,7 +363,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension(
 
 /*!
   \brief Test for presence of given flag on a given channel
-  \param channel channel to test 
+  \param channel channel to test
   \param flag to test
   \return TRUE if flags were present
 */
@@ -447,7 +447,7 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel);
 */
 #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_value(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_channel_t *channel,
 																		switch_ring_ready_t rv,
 																		const char *file, const char *func, int line);
 /*!
@@ -464,7 +464,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
 
 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_value(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel,
 																			 switch_ring_ready_t rv,
 																			 const char *file, const char *func, int line);
 
@@ -561,9 +561,9 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
   \return number of digits in the queue
 */
 SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(_In_ switch_channel_t *channel);
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel); 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_lock(switch_channel_t *channel);
 SWITCH_DECLARE(switch_status_t) switch_channel_try_dtmf_lock(switch_channel_t *channel);
-SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel); 
+SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *channel);
 
 
 /*!
@@ -658,7 +658,7 @@ SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel)
 SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel);
 SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel);
 
-SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate, 
+SWITCH_DECLARE(void) switch_channel_perform_set_callstate(switch_channel_t *channel, switch_channel_callstate_t callstate,
 														  const char *file, const char *func, int line);
 #define switch_channel_set_callstate(channel, state) switch_channel_perform_set_callstate(channel, state, __FILE__, __SWITCH_FUNC__, __LINE__)
 SWITCH_DECLARE(switch_channel_callstate_t) switch_channel_get_callstate(switch_channel_t *channel);
diff --git a/src/include/switch_config.h b/src/include/switch_config.h
index c0f5bbfa46..f403e15c9f 100644
--- a/src/include/switch_config.h
+++ b/src/include/switch_config.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,14 +22,14 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
  * switch_config.h -- Configuration File Parser
  *
  */
-/** 
+/**
  * @file switch_config.h
  * @brief Basic Configuration File Parser
  * @see config
@@ -42,8 +42,8 @@
  * or expanded to tie to external handlers in the future as necessary.
  * 
  *
- * EXAMPLE 
- * 
+ * EXAMPLE
+ *
  * [category1]
  * var1 => val1
  * var2 => val2
diff --git a/src/include/switch_console.h b/src/include/switch_console.h
index bcf956e2e9..d853ee4512 100644
--- a/src/include/switch_console.h
+++ b/src/include/switch_console.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
diff --git a/src/include/switch_core.h b/src/include/switch_core.h
index 33dd0d5d3f..128dec3f15 100644
--- a/src/include/switch_core.h
+++ b/src/include/switch_core.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Luke Dashjr  (OpenMethods, LLC)
  * Joseph Sullivan 
@@ -89,7 +89,7 @@ typedef struct device_uuid_node_s {
 } switch_device_node_t;
 
 typedef struct switch_device_stats_s {
-	uint32_t total; 
+	uint32_t total;
 	uint32_t total_in;
 	uint32_t total_out;
 	uint32_t offhook;
@@ -147,7 +147,7 @@ typedef void(*switch_device_state_function_t)(switch_core_session_t *session, sw
 #define MAX_FPLEN 64
 #define MAX_FPSTRLEN 192
 
-typedef struct dtls_fp_s { 
+typedef struct dtls_fp_s {
 	uint32_t len;
 	uint8_t data[MAX_FPLEN+1];
 	char *type;
@@ -251,9 +251,9 @@ static inline char *switch_must_strdup(const char *_s)
 
 
 /*!
-  \defgroup core1 Core Library 
+  \defgroup core1 Core Library
   \ingroup FREESWITCH
-  \{ 
+  \{
 */
 
 ///\defgroup mb1 Media Bugs
@@ -271,8 +271,8 @@ SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t
 #define switch_core_session_get_name(_s) switch_channel_get_name(switch_core_session_get_channel(_s))
 
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_pop(switch_core_session_t *orig_session, const char *function, switch_media_bug_t **pop);
-								
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session, 
+
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_exec_all(switch_core_session_t *orig_session,
 															   const char *function, switch_media_bug_exec_cb_t cb, void *user_data);
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_patch_video(switch_core_session_t *orig_session, switch_frame_t *frame);
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_count(switch_core_session_t *orig_session, const char *function);
@@ -408,7 +408,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all_function(_In_ s
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream);
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session);
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_core_session_t *orig_session, switch_core_session_t *new_session,
 																		switch_media_bug_callback_t callback, void * (*user_data_dup_func) (switch_core_session_t *, void *));
 
 
@@ -416,7 +416,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_callback(switch_c
   \brief Read a frame from the bug
   \param bug the bug to read from
   \param frame the frame to write the data to
-  \return the amount of data 
+  \return the amount of data
 */
 SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill);
 
@@ -482,7 +482,7 @@ SWITCH_DECLARE(int) switch_core_test_flag(int flag);
 ///\defgroup ss Startup/Shutdown
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initilize the core
   \param console optional FILE stream for output
   \param flags core flags
@@ -491,7 +491,7 @@ SWITCH_DECLARE(int) switch_core_test_flag(int flag);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
 
-/*! 
+/*!
   \brief Initilize the core and load modules
   \param console optional FILE stream for output
   \param flags core flags
@@ -500,21 +500,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
 
-/*! 
+/*!
   \brief Set/Get Session Limit
   \param new_limit new value (if > 0)
   \return the current session limit
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_limit(_In_ uint32_t new_limit);
 
-/*! 
+/*!
   \brief Set/Get Session Rate Limit
   \param new_limit new value (if > 0)
   \return the current session rate limit
 */
 SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(_In_ uint32_t new_limit);
 
-/*! 
+/*!
   \brief Destroy the core
   \note to be called at application shutdown
 */
@@ -535,7 +535,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_io_rwunlock(switch_core_sess
 SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a read lock on the session
   \param session the session to acquire from
   \return success if it is safe to read from the session
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock_hangup(_In
 																			 int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a read lock on the session
   \param session the session to acquire from
   \return success if it is safe to read from the session
@@ -568,7 +568,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock_hangup(_In_ switch
 SWITCH_DECLARE(void) switch_core_session_perform_write_lock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Acquire a write lock on the session
   \param session the session to acquire from
 */
@@ -582,7 +582,7 @@ SWITCH_DECLARE(void) switch_core_session_write_lock(_In_ switch_core_session_t *
 SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
 #endif
 
-/*! 
+/*!
   \brief Unlock a read or write lock on as given session
   \param session the session
 */
@@ -597,7 +597,7 @@ SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *se
 ///\defgroup sh State Handlers
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Add a global state handler
   \param state_handler a state handler to add
   \return the current index/priority of this handler
@@ -610,7 +610,7 @@ SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handle
 */
 SWITCH_DECLARE(void) switch_core_remove_state_handler(_In_ const switch_state_handler_table_t *state_handler);
 
-/*! 
+/*!
   \brief Access a state handler
   \param index the desired index to access
   \return the desired state handler table or NULL when it does not exist.
@@ -626,7 +626,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch
 ///\defgroup memp Memory Pooling/Allocation
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Create a new sub memory pool from the core's master pool
   \return SWITCH_STATUS_SUCCESS on success
 */
@@ -635,7 +635,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch
 SWITCH_DECLARE(int) switch_core_session_sync_clock(void);
 SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(_Inout_ switch_memory_pool_t **pool,
 																		_In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-/*! 
+/*!
   \brief Returns a subpool back to the main pool
   \return SWITCH_STATUS_SUCCESS on success
 */
@@ -646,13 +646,13 @@ SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool
 SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key);
 
 
-/*! 
+/*!
   \brief Start the session's state machine
   \param session the session on which to start the state machine
 */
 SWITCH_DECLARE(void) switch_core_session_run(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief determine if the session's state machine is running
   \param session the session on which to check
 */
@@ -662,7 +662,7 @@ SWITCH_DECLARE(unsigned int) switch_core_session_started(_In_ switch_core_sessio
 SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
 
-/*! 
+/*!
   \brief Allocate memory from the main pool with no intention of returning it
   \param _memory the number of bytes to allocate
   \return a void pointer to the allocated memory
@@ -674,7 +674,7 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t me
 SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file,
 												 _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Allocate memory directly from a memory pool
   \param _pool the memory pool to allocate from
   \param _mem the number of bytes to allocate
@@ -686,7 +686,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
 	 _Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file,
 																	const char *func, int line);
 
-/*! 
+/*!
   \brief Allocate memory from a session's pool
   \param _session the session to request memory from
   \param _memory the amount of memory to allocate
@@ -699,7 +699,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
 
 SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using permanent memory allocation
   \param _todup the string to duplicate
   \return a pointer to the newly duplicated string
@@ -710,7 +710,7 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *t
 SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file,
 														  _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using memory allocation from a session's pool
   \param _session a session to use for allocation
   \param _todup the string to duplicate
@@ -722,7 +722,7 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_sessi
 SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
 												  _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Copy a string using memory allocation from a given pool
   \param _pool the pool to use for allocation
   \param _todup the string to duplicate
@@ -770,7 +770,7 @@ SWITCH_DECLARE(char *) switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_
 SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, va_list ap);
 #endif
 
-/*! 
+/*!
   \brief Retrieve the memory pool from a session
   \param session the session to retrieve the pool from
   \return the session's pool
@@ -785,7 +785,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
 ///\defgroup sessm Session Creation / Management
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Allocate and return a new session from the core
   \param endpoint_interface the endpoint interface the session is to be based on
   \param pool the pool to use for the allocation (a new one will be used if NULL)
@@ -794,7 +794,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
 																		 _In_ switch_call_direction_t direction,
 																		 switch_originate_flag_t originate_flags,
-																		 _Inout_opt_ switch_memory_pool_t **pool, 
+																		 _Inout_opt_ switch_memory_pool_t **pool,
 																		 _In_opt_z_ const char *use_uuid);
 #define switch_core_session_request(_ep, _d, _f, _p) switch_core_session_request_uuid(_ep, _d, _f, _p, NULL)
 
@@ -803,7 +803,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_se
 SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
 														 _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
 
-/*! 
+/*!
   \brief Destroy a session and return the memory pool to the core
   \param session pointer to a pointer of the session to destroy
   \return
@@ -814,7 +814,7 @@ SWITCH_DECLARE(void) switch_core_session_destroy_state(switch_core_session_t *se
 SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session);
 SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force);
 
-/*! 
+/*!
   \brief Provide the total number of sessions
   \return the total number of allocated sessions
 */
@@ -822,14 +822,14 @@ SWITCH_DECLARE(uint32_t) switch_core_session_count(void);
 
 SWITCH_DECLARE(switch_size_t) switch_core_session_get_id(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Provide the current session_id
   \return the total number of allocated sessions since core startup
 */
 SWITCH_DECLARE(switch_size_t) switch_core_session_id(void);
 SWITCH_DECLARE(switch_size_t) switch_core_session_id_dec(void);
 
-/*! 
+/*!
   \brief Allocate and return a new session from the core based on a given endpoint module name
   \param endpoint_name the name of the endpoint module
   \param pool the pool to use
@@ -838,7 +838,7 @@ SWITCH_DECLARE(switch_size_t) switch_core_session_id_dec(void);
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name,
 																			_In_ switch_call_direction_t direction, _Inout_ switch_memory_pool_t **pool);
 
-/*! 
+/*!
   \brief Launch the session thread (state machine) on a given session
   \param session the session to activate the state machine on
   \return SWITCH_STATUS_SUCCESS if the thread was launched
@@ -849,21 +849,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_co
 SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp);
 SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve a pointer to the channel object associated with a given session
   \param session the session to retrieve from
   \return a pointer to the channel object
 */
 	 _Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Signal a session's state machine thread that a state change has occured
 */
 SWITCH_DECLARE(switch_mutex_t *) switch_core_session_get_mutex(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_session_wake_session_thread(_In_ switch_core_session_t *session);
 SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the unique identifier from a session
   \param session the session to retrieve the uuid from
   \return a string representing the uuid
@@ -871,21 +871,21 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_se
 SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
 
 
-/*! 
+/*!
   \brief Sets the log level for a session
-  \param session the session to set the log level on 
+  \param session the session to set the log level on
   \return SWITCH_STATUS_SUCCESS
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel);
 
 
-/*! 
+/*!
   \brief Get the log level for a session
-  \param session the session to get the log level from 
+  \param session the session to get the log level from
   \return the log level
 */
 SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session);
-								   
+
 SWITCH_DECLARE(switch_jb_t *) switch_core_session_get_jb(switch_core_session_t *session, switch_media_type_t type);
 SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec);
 SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session);
@@ -897,7 +897,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_terminators(switch_ivr_d
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data);
 SWITCH_DECLARE(void) switch_core_session_raw_read(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the unique identifier from the core
   \return a string representing the uuid
 */
@@ -908,7 +908,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate(const char *uuid_str, const char *file, const char *func, int line);
 
 
-/*! 
+/*!
   \brief Locate a session based on it's uuid
   \param uuid_str the unique id of the session you want to find
   \return the session or NULL
@@ -917,7 +917,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate
 
 #define switch_core_session_locate(uuid_str) switch_core_session_perform_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Locate a session based on it's uuid even if the channel is not ready
   \param uuid_str the unique id of the session you want to find
   \return the session or NULL
@@ -927,7 +927,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_force_locate
 #define switch_core_session_force_locate(uuid_str) switch_core_session_perform_force_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
 
 
-/*! 
+/*!
   \brief Retrieve a global variable from the core
   \param varname the name of the variable
   \return the value of the desired variable
@@ -940,7 +940,7 @@ SWITCH_DECLARE(const char *) switch_core_get_switchname(void);
 
 SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup);
 
-/*! 
+/*!
   \brief Add a global variable to the core
   \param varname the name of the variable
   \param value the value of the variable
@@ -949,7 +949,7 @@ SWITCH_DECLARE(char *) switch_core_get_domain(switch_bool_t dup);
 SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
 SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event);
 
-/*! 
+/*!
   \brief Conditionally add a global variable to the core
   \param varname the name of the variable
   \param value the value of the variable
@@ -962,7 +962,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_set_var_conditional(_In_z_ const char
 
 SWITCH_DECLARE(void) switch_core_dump_variables(_In_ switch_stream_handle_t *stream);
 
-/*! 
+/*!
   \brief Hangup all sessions
   \param cause the hangup cause to apply to the hungup channels
 */
@@ -974,10 +974,10 @@ typedef enum {
 	SHT_ANSWERED = (1 << 1)
 } switch_hup_type_t;
 
-/*! 
+/*!
   \brief Hangup all sessions which match a specific channel variable
   \param var_name The variable name to look for
-  \param var_val The value to look for 
+  \param var_val The value to look for
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(_In_ const char *var_name, _In_ const char *var_val, _In_
@@ -995,16 +995,16 @@ SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_vars_ans(_In_ switc
 																	 switch_call_cause_t cause, switch_hup_type_t type);
 #define switch_core_session_hupall_matching_vars(_vs, _c) switch_core_session_hupall_matching_vars_ans(_vs, _c, SHT_UNANSWERED | SHT_ANSWERED)
 
-/*! 
+/*!
   \brief Hangup all sessions that belong to an endpoint
-  \param endpoint_interface The endpoint interface 
+  \param endpoint_interface The endpoint interface
   \param cause the hangup cause to apply to the hungup channels
 */
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause);
 
-/*! 
+/*!
   \brief Get the session's partner (the session its bridged to)
-  \param session The session we're searching with 
+  \param session The session we're searching with
   \param partner [out] The session's partner, or NULL if it wasnt found
   \return SWITCH_STATUS_SUCCESS or SWITCH_STATUS_FALSE if this session isn't bridged
 */
@@ -1013,7 +1013,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_get_partner(switch_c
 
 #define switch_core_session_get_partner(_session, _partner) switch_core_session_perform_get_partner(_session, _partner, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Send a message to another session using it's uuid
   \param uuid_str the unique id of the session you want to send a message to
   \param message the switch_core_session_message_t object to send
@@ -1021,7 +1021,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_get_partner(switch_c
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(_In_z_ const char *uuid_str, _In_ switch_core_session_message_t *message);
 
-/*! 
+/*!
   \brief Queue a message on a session
   \param session the session to queue the message to
   \param message the message to queue
@@ -1035,7 +1035,7 @@ SWITCH_DECLARE(void) switch_core_session_free_message(switch_core_session_messag
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_signal_data(switch_core_session_t *session, void *signal_data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_signal_data(switch_core_session_t *session, void **signal_data);
 
-/*! 
+/*!
   \brief pass an indication message on a session
   \param session the session to pass the message across
   \param indication the indication message to pass
@@ -1044,7 +1044,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_signal_data(switch_c
 SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session,
 																	_In_ switch_core_session_message_types_t indication);
 
-/*! 
+/*!
   \brief Queue an indication message on a session
   \param session the session to queue the message to
   \param indication the indication message to queue
@@ -1053,7 +1053,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session,
 																	 _In_ switch_core_session_message_types_t indication);
 
-/*! 
+/*!
   \brief DE-Queue an message on a given session
   \param session the session to de-queue the message on
   \param message the de-queued message
@@ -1061,14 +1061,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message);
 
-/*! 
+/*!
   \brief Flush a message queue on a given session
   \param session the session to de-queue the message on
   \return SWITCH_STATUS_SUCCESS if the message was de-queued
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Queue an event on another session using its uuid
   \param uuid_str the unique id of the session you want to send a message to
   \param event the event to send
@@ -1078,8 +1078,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(_In_z_ const char
 
 SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
 
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param application_interface the interface of the application to execute
   \param arg application arguments
@@ -1090,8 +1090,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_sessio
 														 _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
 
 SWITCH_DECLARE(void) switch_core_session_video_reset(switch_core_session_t *session);
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param app the application's name
   \param arg application arguments
@@ -1105,8 +1105,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags);
 
-/*! 
-  \brief Execute an application on a session 
+/*!
+  \brief Execute an application on a session
   \param session the current session
   \param app the application's name
   \param arg application arguments
@@ -1114,7 +1114,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *ap
 */
 #define switch_core_session_execute_application(_a, _b, _c) switch_core_session_execute_application_get_flags(_a, _b, _c, NULL)
 
-/*! 
+/*!
   \brief Run a dialplan and execute an extension
   \param session the current session
   \param exten the interface of the application to execute
@@ -1127,7 +1127,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_co
 																  _In_z_ const char *exten,
 																  _In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
 
-/*! 
+/*!
   \brief Send an event to a session translating it to it's native message format
   \param session the session to receive the event
   \param event the event to receive
@@ -1135,7 +1135,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_co
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event);
 
-/*! 
+/*!
   \brief Retrieve private user data from a session
   \param session the session to retrieve from
   \return a pointer to the private data
@@ -1143,7 +1143,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(_In_ switch_co
 SWITCH_DECLARE(void *) switch_core_session_get_private_class(_In_ switch_core_session_t *session, _In_ switch_pvt_class_t index);
 #define switch_core_session_get_private(_s) switch_core_session_get_private_class(_s, SWITCH_PVT_PRIMARY)
 
-/*! 
+/*!
   \brief Add private user data to a session
   \param session the session to add used data to
   \param private_info the used data to add
@@ -1177,7 +1177,7 @@ SWITCH_DECLARE(int) switch_core_session_get_stream_count(_In_ switch_core_sessio
 
 SWITCH_DECLARE(const char *) switch_core_session_get_text_buffer(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Launch a thread designed to exist within the scope of a given session
   \param session a session to allocate the thread from
   \param func a function to execute in the thread
@@ -1186,13 +1186,13 @@ SWITCH_DECLARE(const char *) switch_core_session_get_text_buffer(switch_core_ses
 SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
 													   _In_ void *(*func) (switch_thread_t *, void *), _In_opt_ void *obj);
 
-/*! 
+/*!
   \brief Signal a thread using a thread session to terminate
   \param session the session to indicate to
 */
 SWITCH_DECLARE(void) switch_core_thread_session_end(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Launch a service thread on a session to drop inbound data
   \param session the session the launch thread on
 */
@@ -1200,7 +1200,7 @@ SWITCH_DECLARE(void) switch_core_service_session_av(_In_ switch_core_session_t *
 #define switch_core_service_session(_s) switch_core_service_session_av(_s, SWITCH_TRUE, SWITCH_FALSE)
 
 
-/*! 
+/*!
   \brief Request an outgoing session spawned from an existing session using a desired endpoing module
   \param session the originating session
   \param var_event switch_event_t containing paramaters
@@ -1219,7 +1219,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt
 																		 _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags,
 																		 switch_call_cause_t *cancel_cause);
 
-/*! 
+/*!
   \brief Receive a message on a given session
   \param session the session to receive the message from
   \param message the message to recieve
@@ -1231,7 +1231,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_
 #define switch_core_session_receive_message(_session, _message) switch_core_session_perform_receive_message(_session, _message, \
 																											__FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
   \brief Queue an event on a given session
   \param session the session to queue the message on
   \param event the event to queue
@@ -1240,7 +1240,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event);
 
 
-/*! 
+/*!
   \brief Indicate the number of waiting events on a session
   \param session the session to check
   \return the number of events
@@ -1248,11 +1248,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core
 SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_session_t *session);
 
 /*
-  Number of parsable messages waiting on the session. 
+  Number of parsable messages waiting on the session.
  */
 SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session);
 
-/*! 
+/*!
   \brief DE-Queue an event on a given session
   \param session the session to de-queue the message on
   \param event the de-queued event
@@ -1261,7 +1261,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_sessio
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event, switch_bool_t force);
 
-/*! 
+/*!
   \brief Queue a private event on a given session
   \param session the session to queue the message on
   \param event the event to queue
@@ -1272,14 +1272,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(_In_ swi
 																		switch_bool_t priority);
 
 
-/*! 
+/*!
   \brief Indicate the number of waiting private events on a session
   \param session the session to check
   \return the number of events
 */
 SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief DE-Queue a private event on a given session
   \param session the session to de-queue the message on
   \param event the de-queued event
@@ -1296,7 +1296,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(_In_ s
 SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session);
 
 
-/*! 
+/*!
   \brief Read a frame from a session
   \param session the session to read from
   \param frame a NULL pointer to a frame to aim at the newly read frame
@@ -1307,7 +1307,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_se
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
 															   int stream_id);
 
-/*! 
+/*!
   \brief Read a video frame from a session
   \param session the session to read from
   \param frame a NULL pointer to a frame to aim at the newly read frame
@@ -1317,7 +1317,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
 																	 int stream_id);
-/*! 
+/*!
   \brief Write a video frame to a session
   \param session the session to write to
   \param frame a pointer to a frame to write
@@ -1328,7 +1328,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch
 SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
 																	  int stream_id);
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(switch_core_session_t *session,
 																		switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
@@ -1336,14 +1336,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_impl(switch_core_s
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp);
 
-/*! 
+/*!
   \brief Reset the buffers and resampler on a session
   \param session the session to reset
   \param flush_dtmf flush all queued dtmf events too
 */
 SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec);
 
-/*! 
+/*!
   \brief Write a frame to a session
   \param session the session to write to
   \param frame the frame to write
@@ -1365,14 +1365,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ sw
 */
 #define switch_core_session_kill_channel(session, sig) switch_core_session_perform_kill_channel(session, __FILE__, __SWITCH_FUNC__, __LINE__, sig)
 
-/*! 
+/*!
   \brief Send DTMF to a session
   \param session session to send DTMF to
   \param dtmf dtmf to send to the session
   \return SWITCH_STATUS_SUCCESS if the dtmf was written
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf);
-/*! 
+/*!
   \brief Send DTMF to a session
   \param session session to send DTMF to
   \param dtmf_string string to send to the session
@@ -1380,7 +1380,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_s
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string);
 
-/*! 
+/*!
   \brief RECV DTMF on a session
   \param session session to recv DTMF from
   \param dtmf string to recv from the session
@@ -1394,7 +1394,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(_In_ switch_core_s
 ///\defgroup hashf Hash Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initialize a hash table
   \param hash a NULL pointer to a hash table to aim at the new hash
   \param pool the pool to use for the new hash
@@ -1405,14 +1405,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t *
 #define switch_core_hash_init_nocase(_hash) switch_core_hash_init_case(_hash, SWITCH_FALSE)
 
 
-/*! 
+/*!
   \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(_Inout_ switch_hash_t **hash);
 
-/*! 
+/*!
   \brief Insert data into a hash
   \param hash the hash to add data to
   \param key the name of the key to add the data to
@@ -1424,7 +1424,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_h
 #define switch_core_hash_insert(_h, _k, _d) switch_core_hash_insert_destructor(_h, _k, _d, NULL)
 
 
-/*! 
+/*!
   \brief Insert data into a hash
   \param hash the hash to add data to
   \param key the name of the key to add the data to
@@ -1435,7 +1435,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_h
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data,
 															   _In_opt_ switch_mutex_t *mutex);
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1444,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *hash, const char *key, const void *data, switch_thread_rwlock_t *rwlock);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1452,7 +1452,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_wrlock(switch_hash_t *ha
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1461,7 +1461,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_mutex_t *mutex);
 
-/*! 
+/*!
   \brief Delete data from a hash based on desired key
   \param hash the hash to delete from
   \param key the key from which to delete the data
@@ -1470,7 +1470,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete_locked(_In_ switch_hash_t *hash,
 */
 SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ switch_thread_rwlock_t *rwlock);
 
-/*! 
+/*!
   \brief Delete data from a hash based on callback function
   \param hash the hash to delete from
   \param callback the function to call which returns SWITCH_TRUE to delete, SWITCH_FALSE to preserve
@@ -1478,7 +1478,7 @@ SWITCH_DECLARE(void *) switch_core_hash_delete_wrlock(_In_ switch_hash_t *hash,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(_In_ switch_hash_t *hash, _In_ switch_hash_delete_callback_t callback, _In_opt_ void *pData);
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1487,7 +1487,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_multi(_In_ switch_hash_t
 SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key);
 
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1496,7 +1496,7 @@ SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ co
 */
 SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
 
-/*! 
+/*!
   \brief Retrieve data from a given hash
   \param hash the hash to retrieve from
   \param key the key to retrieve
@@ -1509,7 +1509,7 @@ SWITCH_DECLARE(void *) switch_core_hash_find_rdlock(_In_ switch_hash_t *hash, _I
  \brief Gets the first element of a hashtable
  \param deprecate_me [deprecated] NULL
  \param hash the hashtable to use
- \return The element, or NULL if it wasn't found 
+ \return The element, or NULL if it wasn't found
 */
 SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_first_iter(_In_ switch_hash_t *hash, switch_hash_index_t *hi);
 #define switch_core_hash_first(_h) switch_core_hash_first_iter(_h, NULL)
@@ -1530,10 +1530,10 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_core_hash_next(_In_ switch_hash_ind
 
 /*!
  \brief Gets the key and value of the current hash element
- \param hi The current element 
+ \param hi The current element
  \param key [out] the key
  \param klen [out] the key's size
- \param val [out] the value 
+ \param val [out] the value
 */
 SWITCH_DECLARE(void) switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
 									  const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
@@ -1551,7 +1551,7 @@ SWITCH_DECLARE(void *) switch_core_inthash_find(switch_inthash_t *hash, uint32_t
 ///\defgroup timer Timer Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Request a timer handle using given time module
   \param timer a timer object to allocate to
   \param timer_name the name of the timer module to use
@@ -1565,14 +1565,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, co
 
 SWITCH_DECLARE(void) switch_time_calibrate_clock(void);
 
-/*! 
+/*!
   \brief Wait for one cycle on an existing timer
   \param timer the timer to wait on
   \return the newest sample count
 */
 SWITCH_DECLARE(switch_status_t) switch_core_timer_next(switch_timer_t *timer);
 
-/*! 
+/*!
   \brief Step the timer one step
   \param timer the timer to wait on
   \return the newest sample count
@@ -1581,7 +1581,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_step(switch_timer_t *timer);
 
 SWITCH_DECLARE(switch_status_t) switch_core_timer_sync(switch_timer_t *timer);
 
-/*! 
+/*!
   \brief Check if the current step has been exceeded
   \param timer the timer to wait on
   \param step increment timer if a tick was detected
@@ -1589,7 +1589,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_sync(switch_timer_t *timer);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_timer_check(switch_timer_t *timer, switch_bool_t step);
 
-/*! 
+/*!
   \brief Destroy an allocated timer
   \param timer timer to destroy
   \return SWITCH_STATUS_SUCCESS after destruction
@@ -1600,7 +1600,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer)
 ///\defgroup codecs Codec Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Initialize a codec handle
   \param codec the handle to initilize
   \param codec_name the name of the codec module to use
@@ -1623,16 +1623,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
 																	int ms,
 																	int channels,
 																	uint32_t bitrate,
-																	uint32_t flags, 
-																	const switch_codec_settings_t *codec_settings, 
+																	uint32_t flags,
+																	const switch_codec_settings_t *codec_settings,
 																	switch_memory_pool_t *pool);
-								
-SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, 
+
+SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec,
 													   const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
 SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Encode data using a codec handle
   \param codec the codec handle to use
   \param other_codec the codec handle of the last codec used
@@ -1653,7 +1653,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
 														 uint32_t decoded_rate,
 														 void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
 
-/*! 
+/*!
   \brief Decode data using a codec handle
   \param codec the codec handle to use
   \param other_codec the codec handle of the last codec used
@@ -1694,8 +1694,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode_video(switch_codec_t *c
   \param ret_data a void pointer to a pointer of return data
   \return SWITCH_STATUS_SUCCESS if the command was received
 */
-SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec, 
-														  switch_codec_control_command_t cmd, 
+SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
+														  switch_codec_control_command_t cmd,
 														  switch_codec_control_type_t ctype,
 														  void *cmd_data,
 														  switch_codec_control_type_t atype,
@@ -1713,14 +1713,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_codec_decode_video(switch_codec_t *codec, switch_frame_t *frame);
 
-/*! 
+/*!
   \brief Destroy an initalized codec handle
   \param codec the codec handle to destroy
   \return SWITCH_STATUS_SUCCESS if the codec was destroyed
 */
 SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Assign the read codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1728,7 +1728,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Assign the original read codec to a given session.  This is the read codec used by an endpoint.
   \param session session to add the codec to
   \param codec the codec to add
@@ -1753,21 +1753,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_c
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
 
 
-/*! 
+/*!
   \brief Retrieve the read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the effevtive read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the write codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1775,21 +1775,21 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(_I
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Retrieve the effevtive write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the video_read codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1797,14 +1797,14 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_write_codec(_
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the video_read codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
 */
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(_In_ switch_core_session_t *session);
 
-/*! 
+/*!
   \brief Assign the video_write codec to a given session
   \param session session to add the codec to
   \param codec the codec to add
@@ -1812,7 +1812,7 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(_In_ s
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
 
-/*! 
+/*!
   \brief Retrieve the video_write codec from a given session
   \param session session to retrieve from
   \return a pointer to the codec
@@ -1823,14 +1823,14 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(_In_
 ///\defgroup db Database Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a core db (SQLite) file
   \param filename the path to the db file to open
   \return the db handle
 */
 SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename);
 
-/*! 
+/*!
   \brief Execute a sql stmt until it is accepted
   \param db the db handle
   \param sql the sql to execute
@@ -1844,7 +1844,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_db_persistant_execute_trans(switch_c
 
 
 
-/*! 
+/*!
   \brief perform a test query then perform a reactive query if the first one fails
   \param db the db handle
   \param test_sql the test sql
@@ -1865,7 +1865,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 															  _In_ uint32_t channels,
 															  _In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool);
 
-/*! 
+/*!
   \brief Open a media file using file format modules
   \param _fh a file handle to use
   \param _file_path the path to the file
@@ -1879,7 +1879,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 #define switch_core_file_open(_fh, _file_path, _channels, _rate, _flags, _pool) \
 	switch_core_perform_file_open(__FILE__, __SWITCH_FUNC__, __LINE__, _fh, _file_path, _channels, _rate, _flags, _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 data the buffer to read the data to
@@ -1888,7 +1888,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_read(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len);
 
-/*! 
+/*!
   \brief Write media to a file handle
   \param fh the file handle to write to
   \param data the buffer to write
@@ -1897,7 +1897,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(_In_ switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_write(_In_ switch_file_handle_t *fh, void *data, switch_size_t *len);
 
-/*! 
+/*!
   \brief Write media to a file handle
   \param fh the file handle to write to
   \param data the buffer to write
@@ -1917,7 +1917,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read_video(switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_seek(_In_ switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence);
 
-/*! 
+/*!
   \brief Set metadata to the desired string
   \param fh the file handle to set data to
   \param col the enum of the col name
@@ -1926,7 +1926,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(_In_ switch_file_handle_t
 */
 SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char *string);
 
-/*! 
+/*!
   \brief get metadata of the desired string
   \param fh the file handle to get data from
   \param col the enum of the col name
@@ -1936,7 +1936,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(_In_ switch_file_han
 SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(_In_ switch_file_handle_t *fh, switch_audio_col_t col, const char **string);
 
 
-/*! 
+/*!
   \brief Close an open file handle
   \param fh the file handle to close
   \return SWITCH_STATUS_SUCCESS if the file handle was closed
@@ -1954,7 +1954,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_file_has_video(switch_file_handle_t *f
 ///\defgroup speech ASR/TTS Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a speech handle
   \param sh a speech handle to use
   \param module_name the speech module to use
@@ -1969,10 +1969,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
 														const char *module_name,
 														const char *voice_name,
 														_In_ unsigned int rate,
-														_In_ unsigned int interval, 
+														_In_ unsigned int interval,
 														_In_ unsigned int channels,
 														switch_speech_flag_t *flags, _In_opt_ switch_memory_pool_t *pool);
-/*! 
+/*!
   \brief Feed text to the TTS module
   \param sh the speech handle to feed
   \param text the buffer to write
@@ -1981,13 +1981,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
 */
 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
   \param sh the speech handle
 */
 SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh);
 
-/*! 
+/*!
   \brief Set a text parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -1995,7 +1995,7 @@ SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh);
 */
 SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val);
 
-/*! 
+/*!
   \brief Set a numeric parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -2003,7 +2003,7 @@ SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *s
 */
 SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val);
 
-/*! 
+/*!
   \brief Set a float parameter on a TTS handle
   \param sh the speech handle
   \param param the parameter
@@ -2011,7 +2011,7 @@ SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t
 */
 SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val);
 
-/*! 
+/*!
   \brief Read rendered audio from the TTS module
   \param sh the speech handle to read
   \param data the buffer to read to
@@ -2021,7 +2021,7 @@ SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *
   \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
 */
 SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
-/*! 
+/*!
   \brief Close an open speech handle
   \param sh the speech handle to close
   \param flags flags in/out for fine tuning
@@ -2030,7 +2030,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle
 SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags);
 
 
-/*! 
+/*!
   \brief Open an asr handle
   \param ah the asr handle to open
   \param module_name the name of the asr module
@@ -2189,7 +2189,7 @@ SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *
 ///\defgroup dir Directory Service Functions
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Open a directory handle
   \param dh a directory handle to use
   \param module_name the directory module to use
@@ -2202,7 +2202,7 @@ SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *
 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);
 
-/*! 
+/*!
   \brief Query a directory handle
   \param dh a directory handle to use
   \param base the base to query against
@@ -2211,14 +2211,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_open(switch_directory_hand
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_query(switch_directory_handle_t *dh, char *base, char *query);
 
-/*! 
+/*!
   \brief Obtain the next record in a lookup
   \param dh a directory handle to use
   \return SWITCH_STATUS_SUCCESS if another record exists
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_handle_t *dh);
 
-/*! 
+/*!
   \brief Obtain the next name/value pair in the current record
   \param dh a directory handle to use
   \param var a pointer to pointer of the name to fill in
@@ -2227,7 +2227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_hand
 */
 SWITCH_DECLARE(switch_status_t) switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val);
 
-/*! 
+/*!
   \brief Close an open directory handle
   \param dh a directory handle to close
   \return SWITCH_STATUS_SUCCESS if handle was closed
@@ -2239,14 +2239,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_han
 ///\defgroup misc Misc
 ///\ingroup core1
 ///\{
-/*! 
+/*!
   \brief Retrieve a FILE stream of a given text channel name
   \param channel text channel enumeration
   \return a FILE stream
 */
 SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel_t channel);
 
-/*! 
+/*!
   \brief Determines if the core is ready to take calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
@@ -2254,25 +2254,25 @@ SWITCH_DECLARE(switch_bool_t) switch_core_ready(void);
 
 SWITCH_DECLARE(switch_bool_t) switch_core_running(void);
 
-/*! 
+/*!
   \brief Determines if the core is ready to take inbound calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
 SWITCH_DECLARE(switch_bool_t) switch_core_ready_inbound(void);
 
-/*! 
+/*!
   \brief Determines if the core is ready to place outbound calls
   \return SWITCH_TRUE or SWITCH_FALSE
 */
 SWITCH_DECLARE(switch_bool_t) switch_core_ready_outbound(void);
 
-/*! 
+/*!
   \brief return core flags
   \return core flags
 */
 SWITCH_DECLARE(switch_core_flag_t) switch_core_flags(void);
 
-/*! 
+/*!
   \brief Execute a management operation.
   \param relative_oid the relative oid of the operation.
   \param action the action to perform.
@@ -2282,14 +2282,14 @@ SWITCH_DECLARE(switch_core_flag_t) switch_core_flags(void);
 */
 SWITCH_DECLARE(switch_status_t) switch_core_management_exec(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen);
 
-/*! 
+/*!
   \brief Switch on the privilege awareness for the process and request required privileges
   \return 0 on success
 */
-								
+
 SWITCH_DECLARE(int32_t) switch_core_set_process_privileges(void);
 
-/*! 
+/*!
   \brief Set the maximum priority the process can obtain
   \return 0 on success
 */
@@ -2299,7 +2299,7 @@ SWITCH_DECLARE(int32_t) set_auto_priority(void);
 SWITCH_DECLARE(int32_t) set_realtime_priority(void);
 SWITCH_DECLARE(int32_t) set_low_priority(void);
 
-/*! 
+/*!
   \brief Change user and/or group of the running process
   \param user name of the user to switch to (or NULL)
   \param group name of the group to switch to (or NULL)
@@ -2312,7 +2312,7 @@ SWITCH_DECLARE(int32_t) set_low_priority(void);
 */
 SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group);
 
-/*! 
+/*!
   \brief Run endlessly until the system is shutdown
   \param bg divert console to the background
 */
@@ -2352,7 +2352,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, void *
 SWITCH_DECLARE(FILE *) switch_core_get_console(void);
 
 #ifndef SWIG
-/*! 
+/*!
   \brief Launch a thread
 */
 SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC * func) (switch_thread_t *, void *),
@@ -2372,14 +2372,14 @@ SWITCH_DECLARE(void) switch_core_set_globals(void);
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b);
 /*!
-  \brief Checks if a session is using a specific endpoint 
+  \brief Checks if a session is using a specific endpoint
   \param session the session
   \param endpoint_interface interface of the endpoint to check
   \return TRUE or FALSE
 */
 SWITCH_DECLARE(uint8_t) switch_core_session_check_interface(switch_core_session_t *session, const switch_endpoint_interface_t *endpoint_interface);
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_callback(switch_core_session_t *session,
 																			switch_core_video_thread_callback_func_t func, void *user_data);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_video_read_callback(switch_core_session_t *session, switch_frame_t *frame);
@@ -2391,7 +2391,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, cons
 
 SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name);
 SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname);
-/*! 
+/*!
  \brief Get the current epoch time in microseconds
  \return the current epoch time in microseconds
 */
@@ -2404,10 +2404,10 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void);
 SWITCH_DECLARE(void) switch_core_setrlimits(void);
 SWITCH_DECLARE(switch_time_t) switch_time_ref(void);
 SWITCH_DECLARE(void) switch_time_sync(void);
-/*! 
+/*!
  \brief Get the current epoch time
- \param [out] (optional) The current epoch time 
- \return The current epoch time 
+ \param [out] (optional) The current epoch time
+ \return The current epoch time
 */
 SWITCH_DECLARE(time_t) switch_epoch_time_now(time_t *t);
 SWITCH_DECLARE(const char *) switch_lookup_timezone(const char *tz_name);
@@ -2519,19 +2519,19 @@ static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_
 
 SWITCH_DECLARE(switch_cache_db_handle_type_t) switch_cache_db_get_type(switch_cache_db_handle_t *dbh);
 
-/*! 
+/*!
  \brief Returns the handle to the pool, immediately available for other
  		threads to use.
  \param [in] The handle
 */
 SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t ** dbh);
-/*! 
- \brief Returns the handle to the pool, handle is NOT available to 
+/*!
+ \brief Returns the handle to the pool, handle is NOT available to
  		other threads until the allocating thread actually terminates.
  \param [in] The handle
 */
 SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh);
-/*! 
+/*!
  \brief Gets a new cached handle from the pool, potentially creating a new connection.
  		The connection is bound to the thread until it (the thread) terminates unless
  		you dismiss rather than release.
@@ -2545,18 +2545,18 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
 															   const char *file, const char *func, int line);
 #define switch_cache_db_get_db_handle(_a, _b, _c) _switch_cache_db_get_db_handle(_a, _b, _c, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn, 
+SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle_dsn(switch_cache_db_handle_t **dbh, const char *dsn,
 																   const char *file, const char *func, int line);
 #define switch_cache_db_get_db_handle_dsn(_a, _b) _switch_cache_db_get_db_handle_dsn(_a, _b, __FILE__, __SWITCH_FUNC__, __LINE__)
 
-/*! 
+/*!
  \brief Executes the create schema sql
  \param [in] dbh The handle
  \param [in] sql - sql to run
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(switch_status_t) switch_cache_db_create_schema(switch_cache_db_handle_t *dbh, char *sql, char **err);
-/*! 
+/*!
  \brief Executes the sql and returns the result as a string
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2565,14 +2565,14 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_create_schema(switch_cache_db_ha
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t *dbh, char *sql, char *str, size_t len, char **err);
-/*! 
+/*!
  \brief Executes the sql
  \param [in] dbh The handle
  \param [in] sql - sql to run
  \param [out] err - Error if it exists
 */
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_handle_t *dbh, char *sql, char **err);
-/*! 
+/*!
  \brief Executes the sql and uses callback for row-by-row processing
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2583,7 +2583,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, const char *sql,
 																	 switch_core_db_callback_func_t callback, void *pdata, char **err);
 
-/*! 
+/*!
  \brief Executes the sql and uses callback for row-by-row processing
  \param [in] dbh The handle
  \param [in] sql - sql to run
@@ -2611,7 +2611,7 @@ SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh)
 */
 SWITCH_DECLARE(int) switch_cache_db_load_extension(switch_cache_db_handle_t *dbh, const char *extension);
 
-/*! 
+/*!
  \brief Provides some feedback as to the status of the db connection pool
  \param [in] stream stream for status
 */
@@ -2656,7 +2656,7 @@ SWITCH_DECLARE(uint32_t) switch_default_rate(const char *name, uint32_t number);
  \param [in] metadata - generic metadata supplied by module
  \param [out] err - Error if it exists
 */
-SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
+SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires,
 															 const char *network_ip, const char *network_port, const char *network_proto,
 															 const char *metadata);
 /*!
@@ -2716,7 +2716,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup);
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queue_manager_t **qmp);
 SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_init_name(const char *name,
-																   switch_sql_queue_manager_t **qmp, 
+																   switch_sql_queue_manager_t **qmp,
 																   uint32_t numq, const char *dsn, uint32_t max_trans,
 																   const char *pre_trans_execute,
 																   const char *post_trans_execute,
@@ -2745,7 +2745,7 @@ SWITCH_DECLARE(void) switch_sql_queue_manager_execute_sql_event_callback_err(swi
 																			 switch_core_db_event_callback_func_t callback,
 																			 switch_core_db_err_callback_func_t err_callback,
 																			 void *pdata);
-							
+
 SWITCH_DECLARE(pid_t) switch_fork(void);
 
 SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix);
diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h
index 28f23e6480..a2d0fd20f7 100644
--- a/src/include/switch_core_db.h
+++ b/src/include/switch_core_db.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Michael Jerris 
  *
@@ -43,7 +43,7 @@ SWITCH_BEGIN_EXTERN_C
  */
 /**
  * @defgroup switch_core_db Database Routines
- * @ingroup switch_sqlite_top 
+ * @ingroup switch_sqlite_top
  * @{
  */
 /**
@@ -60,7 +60,7 @@ typedef int (*switch_core_db_err_callback_func_t) (void *pArg, const char *errms
 ** These are special value for the destructor that is passed in as the
 ** final argument to routines like switch_core_db_result_blob().  If the destructor
 ** argument is SWITCH_CORE_DB_STATIC, it means that the content pointer is constant
-** and will never change.  It does not need to be destroyed.  The 
+** and will never change.  It does not need to be destroyed.  The
 ** SWITCH_CORE_DB_TRANSIENT value means that the content will likely change in
 ** the near future and that the db should make its own private copy of
 ** the content before returning.
@@ -107,7 +107,7 @@ SWITCH_DECLARE(int) switch_core_db_open(const char *filename, switch_core_db_t *
  * in a single column of the current result row of a query.  In every
  * case the first parameter is a pointer to the SQL statement that is being
  * executed (the switch_core_db_stmt_t* that was returned from switch_core_db_prepare()) and
- * the second argument is the index of the column for which information 
+ * the second argument is the index of the column for which information
  * should be returned.  iCol is zero-indexed.  The left-most column as an
  * index of 0.
  *
@@ -200,7 +200,7 @@ SWITCH_DECLARE(const char *) switch_core_db_errmsg(switch_core_db_t *db);
  *
  * The return value is is SWITCH_CORE_DB_OK if there are no errors and
  * some other return code if there is an error.  The particular
- * return value depends on the type of error. 
+ * return value depends on the type of error.
  *
  * If the query could not be executed because a database file is
  * locked or busy, then this function returns SWITCH_CORE_DB_BUSY.  (This
@@ -214,7 +214,7 @@ SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, s
  * SQL statement obtained by a previous call to switch_core_db_prepare().
  * If the statement was executed successfully, or
  * not executed at all, then SWITCH_CORE_DB_OK is returned. If execution of the
- * statement failed then an error code is returned. 
+ * statement failed then an error code is returned.
  *
  * This routine can be called at any point during the execution of the
  * virtual machine.  If the virtual machine has not completed execution
@@ -249,12 +249,12 @@ SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *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);
 
-/** 
+/**
  * After an SQL query has been compiled with a call to either
  * switch_core_db_prepare(), then this function must be
  * called one or more times to execute the statement.
  *
- * The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE, 
+ * The return value will be either SWITCH_CORE_DB_BUSY, SWITCH_CORE_DB_DONE,
  * SWITCH_CORE_DB_ROW, SWITCH_CORE_DB_ERROR, or SWITCH_CORE_DB_MISUSE.
  *
  * SWITCH_CORE_DB_BUSY means that the database engine attempted to open
@@ -265,12 +265,12 @@ SWITCH_DECLARE(int) switch_core_db_prepare(switch_core_db_t *db, const char *zSq
  * successfully.  switch_core_db_step() should not be called again on this virtual
  * machine.
  *
- * If the SQL statement being executed returns any data, then 
+ * If the SQL statement being executed returns any data, then
  * SWITCH_CORE_DB_ROW is returned each time a new row of data is ready
  * for processing by the caller. The values may be accessed using
  * the switch_core_db_column_*() functions described below. switch_core_db_step()
  * is called again to retrieve the next row of data.
- * 
+ *
  * SWITCH_CORE_DB_ERROR means that a run-time error (such as a constraint
  * violation) has occurred.  switch_core_db_step() should not be called again on
  * the VM. More information may be found by calling switch_core_db_errmsg().
@@ -303,7 +303,7 @@ SWITCH_DECLARE(int) switch_core_db_reset(switch_core_db_stmt_t *pStmt);
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -325,7 +325,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int(switch_core_db_stmt_t *pStmt, int i,
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -347,7 +347,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_int64(switch_core_db_stmt_t *pStmt, int
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * switch_core_db_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -377,7 +377,7 @@ SWITCH_DECLARE(int) switch_core_db_bind_text(switch_core_db_stmt_t *pStmt, int i
  * In every case, the first parameter is a pointer to the sqlite3_stmt
  * structure returned from switch_core_db_prepare().  The second parameter is the
  * index of the parameter.  The first parameter as an index of 1.  For
- * named parameters (":AAA" or "$VVV") you can use 
+ * named parameters (":AAA" or "$VVV") you can use
  * sqlite3_bind_parameter_index() to get the correct index value given
  * the parameters name.  If the same named parameter occurs more than
  * once, it is assigned the same index each time.
@@ -404,7 +404,7 @@ SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
  * Instead of invoking a user-supplied callback for each row of the
  * result, this routine remembers each row of the result in memory
  * obtained from malloc(), then returns all of the result after the
- * query has finished. 
+ * query has finished.
  *
  * As an example, suppose the query result where this table:
  *
@@ -431,11 +431,11 @@ SWITCH_DECLARE(int64_t) switch_core_db_last_insert_rowid(switch_core_db_t *db);
  * set to 2.  In general, the number of values inserted into azResult
  * will be ((*nrow) + 1)*(*ncolumn).
  *
- * After the calling function has finished using the result, it should 
- * pass the result data pointer to switch_core_db_free_table() in order to 
- * release the memory that was malloc-ed.  Because of the way the 
- * malloc() happens, the calling function must not try to call 
- * free() directly.  Only switch_core_db_free_table() is able to release 
+ * After the calling function has finished using the result, it should
+ * pass the result data pointer to switch_core_db_free_table() in order to
+ * release the memory that was malloc-ed.  Because of the way the
+ * malloc() happens, the calling function must not try to call
+ * free() directly.  Only switch_core_db_free_table() is able to release
  * the memory properly and safely.
  *
  * The return value of this routine is the same as from switch_core_db_exec().
@@ -542,7 +542,7 @@ SWITCH_DECLARE(int) switch_core_db_load_extension(switch_core_db_t *db, const ch
  *      INSERT INTO table1 VALUES('It's a happy day!');
  *
  * This second example is an SQL syntax error.  As a general rule you
- * should always use %q instead of %s when inserting text into a string 
+ * should always use %q instead of %s when inserting text into a string
  * literal.
  */
 
diff --git a/src/include/switch_core_event_hook.h b/src/include/switch_core_event_hook.h
index f991955bd4..2e847aaf8d 100644
--- a/src/include/switch_core_event_hook.h
+++ b/src/include/switch_core_event_hook.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  * switch_core_event_hook.h Core Event Hooks
diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h
index d794918cb3..cc053fe9b2 100644
--- a/src/include/switch_core_media.h
+++ b/src/include/switch_core_media.h
@@ -1,5 +1,5 @@
 
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -23,7 +23,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  * switch_core_media.c -- Core Media
@@ -134,7 +134,7 @@ typedef struct switch_core_media_params_s {
 	char *rtpip;
 	char *rtpip4;
 	char *rtpip6;
-	
+
 
 	char *remote_ip;
 	int remote_port;
@@ -185,7 +185,7 @@ static inline const char *switch_media_type2str(switch_media_type_t type)
 		return "video";
 	default:
 		return "!ERR";
-		
+
 	}
 }
 
@@ -201,7 +201,7 @@ SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_
 SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]);
 SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_session_t *session);
 SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type);
-SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session, 
+SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session,
 															  const char *varname,
 															  switch_media_type_t type, const char *crypto, int crypto_tag, switch_sdp_type_t sdp_type);
 
@@ -224,7 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 SWITCH_DECLARE(void) switch_core_media_check_video_codecs(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session_t *session, switch_frame_t **frame,
 															 switch_io_flag_t flags, int stream_id, switch_media_type_t type);
-SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_session_t *session,
 															  switch_frame_t *frame, switch_io_flag_t flags, int stream_id, switch_media_type_t type);
 SWITCH_DECLARE(int) switch_core_media_check_nat(switch_media_handle_t *smh, const char *network_ip);
 
@@ -237,9 +237,9 @@ SWITCH_DECLARE(void) switch_core_media_parse_media_flags(switch_core_session_t *
 SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_ext_address_lookup(switch_core_session_t *session, char **ip, switch_port_t *port, const char *sourceip);
-SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_process_t38_passthru(switch_core_session_t *session,
 																	   switch_core_session_t *other_session, switch_t38_options_t *t38_options);
-SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, switch_sdp_type_t sdp_type, 
+SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *session, switch_sdp_type_t sdp_type,
 													 const char *ip, switch_port_t port, const char *sr, int force);
 SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *session, const char *sdp_str, switch_bool_t dup);
 SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session);
@@ -295,14 +295,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
 																	 switch_payload_t *recv_ptP,
 																	 char **fmtpP);
 
-SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session, 
+SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session,
 																  switch_media_type_t type,
-																  const char *name, 
-																  const char *modname, 
+																  const char *name,
+																  const char *modname,
 																  const char *fmtp,
 																  switch_sdp_type_t sdp_type,
-																  uint32_t pt, 
-																  uint32_t rate, 
+																  uint32_t pt,
+																  uint32_t rate,
 																  uint32_t ptime,
 																  uint32_t channels,
 																  uint8_t negotiated);
@@ -315,10 +315,10 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp, const char
 SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, const char *cmd_buf, switch_core_session_t *session);
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_session_t *session,
 																switch_media_type_t mtype,
 																switch_io_type_t iotype,
-																switch_codec_control_command_t cmd, 
+																switch_codec_control_command_t cmd,
 																switch_codec_control_type_t ctype,
 																void *cmd_data,
 																switch_codec_control_type_t atype,
@@ -326,7 +326,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess
 																switch_codec_control_type_t *rtype,
 																void **ret_data);
 
-SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_bool_t) switch_core_media_codec_get_cap(switch_core_session_t *session,
 																switch_media_type_t mtype,
 																switch_codec_flag_t flag);
 
@@ -346,7 +346,7 @@ SWITCH_DECLARE(int) switch_core_media_check_engine_function(switch_core_session_
 SWITCH_DECLARE(void) switch_core_session_video_reinit(switch_core_session_t *session);
 SWITCH_DECLARE(switch_status_t) switch_core_media_read_lock_unlock(switch_core_session_t *session, switch_media_type_t type, switch_bool_t lock);
 
-#define switch_core_media_read_lock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_TRUE) 
+#define switch_core_media_read_lock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_TRUE)
 #define switch_core_media_read_unlock(_s, _t) switch_core_media_read_lock_unlock(_s, _t, SWITCH_FALSE)
 
 SWITCH_DECLARE(void) switch_core_session_stop_media(switch_core_session_t *session);
@@ -363,7 +363,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_reset_jb(switch_core_session_t
 SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(switch_core_session_t *session, uint32_t timeout_ms);
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_text_read_callback(switch_core_session_t *session,
 																		   switch_core_text_thread_callback_func_t func, void *user_data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_text_read_callback(switch_core_session_t *session, switch_frame_t *frame);
 SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
@@ -373,7 +373,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_text_frame(switch_core
 																	 int stream_id);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_create(switch_rtp_text_factory_t **tfP, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_destroy(switch_rtp_text_factory_t **tfP);															
+SWITCH_DECLARE(switch_status_t) switch_rtp_text_factory_destroy(switch_rtp_text_factory_t **tfP);
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_print(switch_core_session_t *session, const char *data);
 SWITCH_DECLARE(switch_status_t) switch_core_session_printf(switch_core_session_t *session, const char *fmt, ...);
diff --git a/src/include/switch_core_video.h b/src/include/switch_core_video.h
index babe865f4e..e7f98a8a7b 100644
--- a/src/include/switch_core_video.h
+++ b/src/include/switch_core_video.h
@@ -103,7 +103,7 @@ typedef enum {
 	SRM_180 = 180,  // Rotate 180 degrees.
 	SRM_270 = 270,  // Rotate 270 degrees clockwise.
 } switch_image_rotation_mode_t;
-	
+
 
 /*!\brief Open a descriptor, allocating storage for the underlying image
 *
@@ -318,7 +318,7 @@ SWITCH_DECLARE(void) switch_img_txt_handle_destroy(switch_img_txt_handle_t **han
 SWITCH_DECLARE(uint32_t) switch_img_txt_handle_render(switch_img_txt_handle_t *handle, switch_image_t *img,
 													  int x, int y, const char *text,
 													  const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle);
-						 
+
 
 SWITCH_DECLARE(void) switch_img_patch_hole(switch_image_t *IMG, switch_image_t *img, int x, int y, switch_image_rect_t *rect);
 
diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h
index ce068aed22..1e050b2846 100644
--- a/src/include/switch_cpp.h
+++ b/src/include/switch_cpp.h
@@ -96,7 +96,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 											const char *confirm_key,
 											const char *tts_engine,
 											const char *tts_voice,
-											int confirm_attempts, int inter_timeout, int digit_len, 
+											int confirm_attempts, int inter_timeout, int digit_len,
 											int timeout, int max_failures, int max_timeouts);
 		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
 		 SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
@@ -123,7 +123,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 void *threadState;		// pointer to the language specific thread state
 		 // eg, PyThreadState *threadState
 		 void *extra;			// currently used to store a switch_file_handle_t
-		 char *funcargs;		// extra string that will be passed to callback function 
+		 char *funcargs;		// extra string that will be passed to callback function
 	 } input_callback_state_t;
 
 	 typedef enum {
@@ -211,7 +211,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 // instead set them here first
 		 char *xml_cdr_text;
 		 void store_file_handle(switch_file_handle_t *fh);
-		 void *on_hangup;		// language specific callback function, cast as void * 
+		 void *on_hangup;		// language specific callback function, cast as void *
 		 switch_file_handle_t *fhp;
 		 char dtmf_buf[512];
 
@@ -251,9 +251,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 SWITCH_DECLARE(const char *) getState();
 
 	/** \brief Record to a file
-	 * \param file_name 
+	 * \param file_name
 	 * \param <[max_len]> maximum length of the recording in seconds
-	 * \param <[silence_threshold]> energy level audio must fall below 
+	 * \param <[silence_threshold]> energy level audio must fall below
 	 *        to be considered silence (500 is a good starting point).
 	 * \param <[silence_secs]> seconds of silence to interrupt the record.
 	 */
@@ -266,8 +266,8 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 
 	/** \brief Originate a call to a destination
 	 *
-	 * \param a_leg_session - the session where the call is originating from 
-	 *                        and also the session in which _this_ session was 
+	 * \param a_leg_session - the session where the call is originating from
+	 *                        and also the session in which _this_ session was
 	 *                        created
 	 * \param dest - a string representing destination, eg, sofia/mydomain.com/foo\@bar.com
 	 * \param timeout - time to wait for call to be answered
@@ -280,10 +280,10 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 SWITCH_DECLARE(virtual void) destroy(void);
 
 	/** \brief set a DTMF callback function
-	 * 
+	 *
 	 * The DTMF callback function will be set and persist
 	 * for the life of the session, and be called when a dtmf
-	 * is pressed by user during streamfile(), collectDigits(), and 
+	 * is pressed by user during streamfile(), collectDigits(), and
 	 * certain other methods are executing.
 	 *
 	 */
@@ -300,9 +300,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 SWITCH_DECLARE(int) collectDigits(int abs_timeout);
 		 SWITCH_DECLARE(int) collectDigits(int digit_timeout, int abs_timeout);
 
-	/** 
+	/**
 	 * Collect up to maxdigits digits worth of digits
-	 * and store them in dtmf_buf.  In the case of mod_python, the 
+	 * and store them in dtmf_buf.  In the case of mod_python, the
 	 * dtmf_buf parameter is configured to act as a _return_ value,
 	 * (see mod_python.i).  This does NOT call any callbacks upon
 	 * receiving dtmf digits.  For that, use collectDigits.
@@ -313,14 +313,14 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 SWITCH_DECLARE(int) transfer(char *extension, char *dialplan = NULL, char *context = NULL);
 
 
-		 SWITCH_DECLARE(char *) read(int min_digits, int max_digits, 
+		 SWITCH_DECLARE(char *) read(int min_digits, int max_digits,
 									 const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout = 0);
 
 	/** \brief Play a file into channel and collect dtmfs
-	 * 
+	 *
 	 * See API docs in switch_ivr.h: switch_play_and_get_digits(..)
 	 *
-	 * NOTE: this does not call any dtmf callbacks set by 
+	 * NOTE: this does not call any dtmf callbacks set by
 	 *       setDTMFCallback(..) as it uses its own internal callback
 	 *       handler.
 	 */
@@ -334,7 +334,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 	/** \brief Play a file that resides on disk into the channel
 	 *
 	 * \param file - the path to the .wav/.mp3 to be played
-	 * \param starting_sample_count - the index of the sample to 
+	 * \param starting_sample_count - the index of the sample to
 	 *                                start playing from
 	 * \return an int status code indicating success or failure
 	 *
@@ -374,7 +374,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
 		 virtual bool begin_allow_threads() = 0;
 		 virtual bool end_allow_threads() = 0;
 
-	/** \brief Get the uuid of this session	
+	/** \brief Get the uuid of this session
 	 * \return the uuid of this session
 	 */
 		 const char *get_uuid() const {
@@ -407,7 +407,7 @@ SWITCH_DECLARE(void) console_clean_log(char *msg);
 SWITCH_DECLARE(void) switch_msleep(unsigned ms);
 
 /** \brief bridge the audio of session_b into session_a
- * 
+ *
  * NOTE: the stuff regarding the dtmf callback might be completely
  *       wrong and has not been reviewed or tested
  */
diff --git a/src/include/switch_curl.h b/src/include/switch_curl.h
index e968d2d8dd..5872527865 100644
--- a/src/include/switch_curl.h
+++ b/src/include/switch_curl.h
@@ -54,7 +54,7 @@ SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_even
 #define switch_curl_easy_setopt curl_easy_setopt
 
 SWITCH_END_EXTERN_C
-																
+
 #endif
 
 
diff --git a/src/include/switch_dso.h b/src/include/switch_dso.h
index 1e89bcd4a5..e969f22eee 100644
--- a/src/include/switch_dso.h
+++ b/src/include/switch_dso.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cross Platform dso/dll load abstraction
  * Copyright(C) 2008 Michael Jerris
  *
@@ -13,7 +13,7 @@
  * code prove defective in any respect, you (not the initial developer or any other contributor)
  * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
  * constitutes an essential part of this license. No use of any covered code is authorized hereunder
- * except under this disclaimer. 
+ * except under this disclaimer.
  *
  */
 
diff --git a/src/include/switch_estimators.h b/src/include/switch_estimators.h
index a8c92c3f02..26d321cd30 100644
--- a/src/include/switch_estimators.h
+++ b/src/include/switch_estimators.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Dragos Oancea 
  *
  * switch_estimators.h -- Estimators for Packet Loss, Jitter, RTT , etc
@@ -32,8 +32,8 @@
 
 #ifndef SWITCH_ESTIMATORS_H
 #define SWITCH_ESTIMATORS_H
- 
- 
+
+
 #include 
 
 
@@ -41,27 +41,27 @@ SWITCH_BEGIN_EXTERN_C
 
 struct kalman_estimator_s {
 	/* initial values for the Kalman filter  */
-	float val_estimate_last ; 
-	float P_last ; 
+	float val_estimate_last ;
+	float P_last ;
 	/* the noise in the system:
-	The amount of noise in your measurements and the state-transitions 
-	(e.g. the standard deviation of the signal noise, and how 'wrong' your simplified model 
+	The amount of noise in your measurements and the state-transitions
+	(e.g. the standard deviation of the signal noise, and how 'wrong' your simplified model
 	of the state-transitions are) => These are Q and R matrices */
 	float Q ; /* the process noise covariance matrix  */
 	float R ; /* the measurement noise covariance matrix */
 	float K; /*  P_temp * H^T * (H* P_temp * H^T + R)^-1  */
 	float P; /*  the Kalman gain (calculated) */
 	float val_estimate; /*  x_temp_est + K * (z_measured - H * x_temp_est) */
-	float val_measured; /* the 'noisy' value we measured */ 
-}; 
+	float val_measured; /* the 'noisy' value we measured */
+};
 
 struct cusum_kalman_detector_s {
 	/* initial values for the CUSUM Kalman filter  */
 	float val_estimate_last;
-	float val_desired_last; 
+	float val_desired_last;
 	float P_last;
 	float K_last;
-	float delta; 
+	float delta;
 	float measurement_noise_e;
 	float variance_Re;
 	float measurement_noise_v;
@@ -73,14 +73,14 @@ struct cusum_kalman_detector_s {
 	/* for calculating variance */
 	float last_average;
 	float last_q;
-	float N; /*how many samples we have so far (eg: how many RTCP we received, granted that we can calculate RTT for each one of them)*/  
+	float N; /*how many samples we have so far (eg: how many RTCP we received, granted that we can calculate RTT for each one of them)*/
 };
 
 typedef struct kalman_estimator_s kalman_estimator_t;
 typedef struct cusum_kalman_detector_s cusum_kalman_detector_t;
 
 SWITCH_DECLARE(void) switch_kalman_init(kalman_estimator_t *est, float Q, float R);
-SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *detect_change, float epsilon,float h); 
+SWITCH_DECLARE(switch_bool_t) switch_kalman_cusum_init(cusum_kalman_detector_t *detect_change, float epsilon,float h);
 SWITCH_DECLARE(switch_bool_t) switch_kalman_estimate(kalman_estimator_t * est, float measurement, int system_model);
 SWITCH_DECLARE (switch_bool_t) switch_kalman_cusum_detect_change(cusum_kalman_detector_t * detector, float measurement, float rtt_avg);
 SWITCH_DECLARE(switch_bool_t) switch_kalman_is_slow_link(kalman_estimator_t * est_loss, kalman_estimator_t * est_rtt);
diff --git a/src/include/switch_event.h b/src/include/switch_event.h
index fc713fafff..2c6eb48388 100644
--- a/src/include/switch_event.h
+++ b/src/include/switch_event.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -31,20 +31,20 @@
  */
 /*! \file switch_event.h
     \brief Event System
-	
+
 	The event system uses a backend thread and an APR threadsafe FIFO queue to accept event objects from various threads
 	and allow the backend to take control and deliver the events to registered callbacks.
 
 	The typical usage would be to bind to one or all of the events and use a callback function to react in various ways
 	(see the more_xmpp_event_handler or mod_event_test modules for examples).
 
-	Builtin events are fired by the core at various points in the execution of the application and custom events can be 
+	Builtin events are fired by the core at various points in the execution of the application and custom events can be
 	reserved and registered so events from an external module can be rendered and handled by an another even handler module.
 
 	If the work time to process an event in a callback is anticipated to grow beyond a very small amount of time it is recommended
-	that you implement your own handler thread and FIFO queue so you can accept the events in the callback and queue them 
-	into your own thread rather than tie up the delivery agent.  It is in the opinion of the author that such a necessity 
-	should be judged on a per-use basis and therefore it does not fall within the scope of this system to provide that 
+	that you implement your own handler thread and FIFO queue so you can accept the events in the callback and queue them
+	into your own thread rather than tie up the delivery agent.  It is in the opinion of the author that such a necessity
+	should be judged on a per-use basis and therefore it does not fall within the scope of this system to provide that
 	functionality at a core level.
 
 */
@@ -52,7 +52,7 @@
 /*!
   \defgroup events Eventing Engine
   \ingroup core1
-  \{ 
+  \{
 */
 
 #ifndef SWITCH_EVENT_H
@@ -304,7 +304,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const cha
 SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *owner, const char *subclass_name);
 
 /*!
-  \brief Render a string representation of an event suitable for printing or network transport 
+  \brief Render a string representation of an event suitable for printing or network transport
   \param event the event to render
   \param str a string pointer to point at the allocated data
   \param encode url encode the headers
@@ -430,7 +430,7 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max);
 SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id);
 SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func);
 SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id);
-														  
+
 
 typedef void (*switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data);
 
diff --git a/src/include/switch_frame.h b/src/include/switch_frame.h
index 67be1e689f..54898eff3a 100644
--- a/src/include/switch_frame.h
+++ b/src/include/switch_frame.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
diff --git a/src/include/switch_hashtable.h b/src/include/switch_hashtable.h
index 80bc6ba5dc..8d1bc53b90 100644
--- a/src/include/switch_hashtable.h
+++ b/src/include/switch_hashtable.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  *
  * switch_hashtable.h -- Hashtable
@@ -39,7 +39,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
  *      v = (struct some_value *)   malloc(sizeof(struct some_value));
  *
  *      (initialise k and v to suitable values)
- * 
+ *
  *      if (! hashtable_insert(h,k,v) )
  *      {     exit(-1);               }
  *
@@ -53,7 +53,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
 
 /* Macros may be used to define type-safe(r) hashtable access functions, with
  * methods specialized to take known key and value types as parameters.
- * 
+ *
  * Example:
  *
  * Insert this at the start of your file:
@@ -83,7 +83,7 @@ typedef struct switch_hashtable_iterator switch_hashtable_iterator_t;
 
 /*****************************************************************************
  * create_hashtable
-   
+
  * @name                    create_hashtable
  * @param   minsize         minimum initial size of hashtable
  * @param   hashfunction    function for hashing keys
@@ -98,7 +98,7 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
 
 /*****************************************************************************
  * hashtable_insert
-   
+
  * @name        hashtable_insert
  * @param   h   the hashtable to insert into
  * @param   k   the key - hashtable claims ownership and will free on removal
@@ -135,7 +135,7 @@ switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hash
 
 /*****************************************************************************
  * hashtable_search
-   
+
  * @name        hashtable_search
  * @param   h   the hashtable to search
  * @param   k   the key to search for  - does not claim ownership
@@ -153,7 +153,7 @@ switch_hashtable_search(switch_hashtable_t *h, void *k);
 
 /*****************************************************************************
  * hashtable_remove
-   
+
  * @name        hashtable_remove
  * @param   h   the hashtable to remove the item from
  * @param   k   the key to search for  - does not claim ownership
@@ -172,7 +172,7 @@ switch_hashtable_remove(switch_hashtable_t *h, void *k);
 
 /*****************************************************************************
  * hashtable_count
-   
+
  * @name        hashtable_count
  * @param   h   the hashtable
  * @return      the number of items stored in the hashtable
@@ -183,7 +183,7 @@ switch_hashtable_count(switch_hashtable_t *h);
 
 /*****************************************************************************
  * hashtable_destroy
-   
+
  * @name        hashtable_destroy
  * @param   h   the hashtable
  * @param       free_values     whether to call 'free' on the remaining values
@@ -226,7 +226,7 @@ static inline uint32_t switch_hash_default(void *ky)
 	unsigned char *str = (unsigned char *) ky;
 	uint32_t hash = 0;
     int c;
-	
+
 	while ((c = *str)) {
 		str++;
         hash = c + (hash << 6) + (hash << 16) - hash;
@@ -240,7 +240,7 @@ static inline uint32_t switch_hash_default_ci(void *ky)
 	unsigned char *str = (unsigned char *) ky;
 	uint32_t hash = 0;
     int c;
-	
+
 	while ((c = switch_tolower(*str))) {
 		str++;
         hash = c + (hash << 6) + (hash << 16) - hash;
@@ -261,23 +261,23 @@ static inline uint32_t switch_hash_default_ci(void *ky)
 /*
  * Copyright (c) 2002, Christopher Clark
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h
index be3560e685..39f02339c8 100644
--- a/src/include/switch_ivr.h
+++ b/src/include/switch_ivr.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Neal Horman 
  * Bret McDanel 
@@ -31,7 +31,7 @@
  * switch_ivr.h -- IVR Library
  *
  */
-/** 
+/**
  * @file switch_ivr.h
  * @brief IVR Library
  * @see switch_ivr
@@ -75,7 +75,7 @@ typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
 /**
  * @defgroup switch_ivr IVR Library
  * @ingroup core1
- *	A group of core functions to do IVR related functions designed to be 
+ *	A group of core functions to do IVR related functions designed to be
  *	building blocks for a higher level IVR interface.
  * @{
  */
@@ -179,8 +179,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
   \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if all is well
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session, 
-																  const char *file, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_session_t *session,
+																  const char *file,
 																  const char *mod_name,
 																  const char *grammar,
 																  char **result,
@@ -585,7 +585,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_hangup(time_t runtime, const char *
   \param originator_uuid the uuid of the originator
   \param originatee_uuid the uuid of the originator
   \remark Any custom state handlers on both channels will be deleted
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uuid, const char *originatee_uuid);
 
@@ -670,11 +670,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha
 SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags);
 
 /*!
-  \brief Transfer variables from one session to another 
+  \brief Transfer variables from one session to another
   \param sessa the original session
   \param sessb the new session
   \param var the name of the variable to transfer (NULL for all)
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
@@ -689,14 +689,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_variable(switch_core_session
   \brief Create a digit stream parser object
   \param pool the pool to use for the new hash
   \param parser a pointer to the object pointer
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
 /*!
   \brief Destroy a digit stream parser object
   \param parser a pointer to the parser object
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
@@ -720,7 +720,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digits a string of digits to associate with an action
   \param data consumer data attached to this digit string
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
@@ -728,7 +728,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_
   \brief Delete a string to action mapping
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digits the digit string to be removed from the map
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
@@ -744,7 +744,7 @@ SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stre
 /*!
   \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 
+  \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream);
 
@@ -752,7 +752,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_s
   \brief Set a digit string terminator
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
   \param digit the terminator digit
-  \return SWITCH_STATUS_SUCCESS if all is well 
+  \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);
 
@@ -766,7 +766,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
  * @defgroup switch_ivr_menu IVR Menu Library
  * @ingroup switch_ivr
  *	IVR menu functions
- *	
+ *
  * @{
  */
 
@@ -918,9 +918,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
 												uint32_t max_digits,
 												const char *prompt_audio_file,
 												const char *var_name,
-												char *digit_buffer, 
-												switch_size_t digit_buffer_length, 
-												uint32_t timeout, 
+												char *digit_buffer,
+												switch_size_t digit_buffer_length,
+												uint32_t timeout,
 												const char *valid_terminators,
 												uint32_t digit_timeout);
 
@@ -977,7 +977,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_last_ping(switch_ivr_dmachin
 SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_name(switch_ivr_dmachine_t *dmachine);
 SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback);
 SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback);
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
 														   const char *name,
 														   switch_memory_pool_t *pool,
 														   uint32_t digit_timeout, uint32_t input_timeout,
@@ -987,10 +987,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t
 
 SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine);
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine,
 														 const char *realm,
-														 const char *digits, 
-                             switch_byte_t is_priority, 
+														 const char *digits,
+                             switch_byte_t is_priority,
 														 int32_t key,
 														 switch_ivr_dmachine_callback_t callback,
 														 void *user_data);
@@ -1019,7 +1019,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_sessi
 
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(switch_core_session_t *session);
-SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_core_session_t *session, const char *img_path,
 																	   switch_img_position_t pos, uint8_t alpha);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_capture_text(switch_core_session_t *session, switch_bool_t on);
diff --git a/src/include/switch_jitterbuffer.h b/src/include/switch_jitterbuffer.h
index e55bcbec28..5e53967b8b 100644
--- a/src/include/switch_jitterbuffer.h
+++ b/src/include/switch_jitterbuffer.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  * switch_jitterbuffer.h -- Audio/Video Jitter Buffer
diff --git a/src/include/switch_json.h b/src/include/switch_json.h
index e1d7f1e51b..af9412e4d7 100644
--- a/src/include/switch_json.h
+++ b/src/include/switch_json.h
@@ -1,16 +1,16 @@
 /*
   Copyright (c) 2009 Dave Gamble
- 
+
   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to deal
   in the Software without restriction, including without limitation the rights
   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   copies of the Software, and to permit persons to whom the Software is
   furnished to do so, subject to the following conditions:
- 
+
   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.
- 
+
   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,7 +36,7 @@ extern "C"
 #define cJSON_String 4
 #define cJSON_Array 5
 #define cJSON_Object 6
-	
+
 #define cJSON_IsReference 256
 
 /* The cJSON structure: */
@@ -81,7 +81,7 @@ SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char
 
 /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
 SWITCH_DECLARE(const char *)cJSON_GetErrorPtr(void);
-	
+
 /* These calls create a cJSON item of the appropriate type. */
 SWITCH_DECLARE(cJSON *)cJSON_CreateNull(void);
 SWITCH_DECLARE(cJSON *)cJSON_CreateTrue(void);
@@ -110,7 +110,7 @@ SWITCH_DECLARE(cJSON *)cJSON_DetachItemFromArray(cJSON *array,int which);
 SWITCH_DECLARE(void)   cJSON_DeleteItemFromArray(cJSON *array,int which);
 SWITCH_DECLARE(cJSON *)cJSON_DetachItemFromObject(cJSON *object,const char *string);
 SWITCH_DECLARE(void)   cJSON_DeleteItemFromObject(cJSON *object,const char *string);
-	
+
 /* Update array items. */
 SWITCH_DECLARE(void) cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
 SWITCH_DECLARE(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
diff --git a/src/include/switch_limit.h b/src/include/switch_limit.h
index 7999c85a02..27caa4d587 100644
--- a/src/include/switch_limit.h
+++ b/src/include/switch_limit.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,14 +22,14 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Rupa Schomaker 
  *
  * switch_limit.h - Limit generic implementations
  *
  */
 
- 
+
  /*!
   \defgroup limit1 LIMIT code
   \ingroup core1
@@ -40,7 +40,7 @@
 
 SWITCH_BEGIN_EXTERN_C
 
-/*! 
+/*!
   \brief Initilize the LIMIT Core System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
@@ -48,7 +48,7 @@ SWITCH_BEGIN_EXTERN_C
 SWITCH_DECLARE(void) switch_limit_init(switch_memory_pool_t *pool);
 
 /*!
-  \brief Increment resource.  
+  \brief Increment resource.
   \param backend to use
   \param realm
   \param resource
@@ -59,7 +59,7 @@ SWITCH_DECLARE(void) switch_limit_init(switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_limit_incr(const char *backend, switch_core_session_t *session, const char *realm, const char *resource, const int max, const int interval);
 
 /*!
-  \brief Release resource.  
+  \brief Release resource.
   \param backend to use
   \param realm
   \param resource
diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h
index 04cf75d3b7..9299857f68 100644
--- a/src/include/switch_loadable_module.h
+++ b/src/include/switch_loadable_module.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -33,7 +33,7 @@
     \brief Loadable Module Routines
 
 	This module is the gateway between external modules and the core of the application.
-	it contains all the access points to the various pluggable interfaces including the codecs 
+	it contains all the access points to the various pluggable interfaces including the codecs
 	and API modules.
 
 */
@@ -49,7 +49,7 @@ SWITCH_BEGIN_EXTERN_C
 /*!
   \defgroup mods Loadable Module Functions
   \ingroup core1
-  \{ 
+  \{
 */
 /*! \brief The abstraction of a loadable module */
 	struct switch_loadable_module_interface {
diff --git a/src/include/switch_log.h b/src/include/switch_log.h
index 62a9e42f15..f0df9d8315 100644
--- a/src/include/switch_log.h
+++ b/src/include/switch_log.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -70,21 +70,21 @@ SWITCH_BEGIN_EXTERN_C
 typedef switch_status_t (*switch_log_function_t) (const switch_log_node_t *node, switch_log_level_t level);
 
 
-/*! 
+/*!
   \brief Initilize the logging engine
   \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(_In_ switch_memory_pool_t *pool, _In_ switch_bool_t colorize);
 
-/*! 
+/*!
   \brief Shut down the logging engine
   \note to be called at application termination by the core
 */
 SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void);
 
 #ifndef SWIG
-/*! 
+/*!
   \brief Write log data to the logging engine
   \param channel the log channel to write to
   \param file the current file
@@ -101,7 +101,7 @@ SWITCH_DECLARE(void) switch_log_printf(_In_ switch_text_channel_t channel, _In_z
 									   _In_z_ const char *func, _In_ int line,
 									   _In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
 									   _In_z_ _Printf_format_string_ const char *fmt, ...) PRINTF_FUNCTION(7, 8);
-/*!								
+/*!
   \brief Write log data to the logging engine
   \param channel the log channel to write to
   \param file the current file
@@ -119,21 +119,21 @@ SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_
 										_In_opt_z_ const char *userdata, _In_ switch_log_level_t level, const char *fmt, va_list ap);
 
 #endif
-/*! 
+/*!
   \brief Shut down  the logging engine
   \note to be called at application termination by the core
 */
 SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(_In_ switch_log_function_t function, _In_ switch_log_level_t level, _In_ switch_bool_t is_console);
 SWITCH_DECLARE(switch_status_t) switch_log_unbind_logger(_In_ switch_log_function_t function);
 
-/*! 
+/*!
   \brief Return the name of the specified log level
   \param level the level
   \return the name of the log level
 */
 	 _Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
 
-/*! 
+/*!
   \brief Return the level number of the specified log level name
   \param str the name of the level
   \return the log level
diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h
index 0997bbeb05..79758ccf33 100644
--- a/src/include/switch_module_interfaces.h
+++ b/src/include/switch_module_interfaces.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Luke Dashjr  (OpenMethods, LLC)
  *
@@ -33,7 +33,7 @@
 /*! \file switch_module_interfaces.h
   \brief Module Interface Definitions
 
-  This module holds the definition of data abstractions used to implement various pluggable 
+  This module holds the definition of data abstractions used to implement various pluggable
   interfaces and pluggable event handlers.
 
 */
@@ -44,7 +44,7 @@
 #include "switch_resample.h"
 
 SWITCH_BEGIN_EXTERN_C
-/*! \brief A table of functions to execute at various states 
+/*! \brief A table of functions to execute at various states
  */
 	typedef enum {
 	SWITCH_SHN_ON_INIT,
@@ -106,7 +106,7 @@ struct switch_stream_handle {
 struct switch_io_event_hooks;
 struct switch_say_file_handle;
 
-typedef switch_call_cause_t (*switch_io_outgoing_channel_t)	
+typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
 	(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t,
 	 switch_call_cause_t *);
 typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -560,7 +560,7 @@ struct switch_chat_interface {
 	const char *interface_name;
 	/*! function to open the directory interface */
 	switch_status_t (*chat_send) (switch_event_t *message_event);
-								  
+
 	switch_thread_rwlock_t *rwlock;
 	int refs;
 	switch_mutex_t *reflock;
diff --git a/src/include/switch_nat.h b/src/include/switch_nat.h
index fbf7ee2090..e9dd324e67 100644
--- a/src/include/switch_nat.h
+++ b/src/include/switch_nat.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Brian K. West 
  *
@@ -51,16 +51,16 @@ typedef enum {
 
 SWITCH_DECLARE(const char *) switch_nat_get_type(void);
 
-/*! 
+/*!
   \brief Initilize the NAT Traversal System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
 */
 SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping);
 
-/*! 
+/*!
   \brief Initilize the rest of the NAT Traversal System
-  \note nat_init is called prior to some other modules being loaded.  
+  \note nat_init is called prior to some other modules being loaded.
         This method allows us to init the rest of the NAT system.
 */
 SWITCH_DECLARE(void) switch_nat_late_init(void);
@@ -95,7 +95,7 @@ SWITCH_DECLARE(void) switch_nat_set_mapping(switch_bool_t mapping);
  \brief Maps a port through the NAT Traversal System
  \param port Internal port to map
  \param proto Protocol
- \param external_port [out] Mapped external port 
+ \param external_port [out] Mapped external port
  \param sticky make the mapping permanent
 */
 SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port,
diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h
index 94f1806156..84e049a1ac 100644
--- a/src/include/switch_odbc.h
+++ b/src/include/switch_odbc.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  * switch_odbc.h -- ODBC
diff --git a/src/include/switch_pgsql.h b/src/include/switch_pgsql.h
index e09bcab743..6ded45bedf 100644
--- a/src/include/switch_pgsql.h
+++ b/src/include/switch_pgsql.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Eliot Gable 
  *
@@ -37,7 +37,7 @@
 
 #define DEFAULT_PGSQL_RETRIES 120
 
-SWITCH_BEGIN_EXTERN_C 
+SWITCH_BEGIN_EXTERN_C
 
 struct switch_pgsql_handle;
 struct switch_pgsql_result;
@@ -57,7 +57,7 @@ typedef enum {
 
 /*!
   \brief Create a new handle for the PGSQL connection.
-  \param dsn The DSN of the database to connect to. See documentation for PQconnectdb() at 
+  \param dsn The DSN of the database to connect to. See documentation for PQconnectdb() at
              http://www.postgresql.org/docs/9.0/static/libpq-connect.html. The DSN *MUST* be
 			 prefixed with 'pgsql;' to use the switch_cache_db* functionality. However, the DSN
 			 passed to this function directly *MUST NOT* be prefixed with 'pgsql;'.
@@ -82,7 +82,7 @@ SWITCH_DECLARE(switch_pgsql_status_t ) switch_pgsql_handle_disconnect(switch_pgs
 									   ) /* Emacs formatting issue */
 #endif
 /*!
-  \brief Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which 
+  \brief Connect to the database specified by the DSN passed to the switch_pgsql_handle_new() call which
          initialized this handle.
   \param The database handle to connect to the database.
   \return Returns SWITCH_PGSQL_SUCCESS or SWITCH_PGSQL_FAIL.
diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h
index 244afc1f21..4769a108a9 100644
--- a/src/include/switch_platform.h
+++ b/src/include/switch_platform.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  * switch_platform.h -- Platform Specific Header
@@ -51,10 +51,10 @@ SWITCH_BEGIN_EXTERN_C
 #define __SWITCH_FUNC__ (const char *)__func__
 #endif
 #ifdef _MSC_VER
-/* disable the following warnings 
- * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored. 
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
  * C4200: Non standard extension C zero sized array
- * C4204: nonstandard extension used : non-constant aggregate initializer 
+ * C4204: nonstandard extension used : non-constant aggregate initializer
  * C4706: assignment within conditional expression
  * C4819: The file contains a character that cannot be represented in the current code page
  * C4132: 'object' : const object should be initialized (fires innapropriately for prototyped forward declaration of cost var)
@@ -317,7 +317,7 @@ SWITCH_END_EXTERN_C
 #define NOIME
 #endif
 #include 
-/* 
+/*
  * Add a _very_few_ declarations missing from the restricted set of headers
  * (If this list becomes extensive, re-enable the required headers above!)
  * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
diff --git a/src/include/switch_profile.h b/src/include/switch_profile.h
index 6c0a90fcf1..e345b605d5 100644
--- a/src/include/switch_profile.h
+++ b/src/include/switch_profile.h
@@ -2,23 +2,23 @@
  * Copyright (c) 2009, Sangoma Technologies
  * Moises Silva 
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright
  * notice, this list of conditions and the following disclaimer.
- * 
+ *
  * * Redistributions in binary form must reproduce the above copyright
  * notice, this list of conditions and the following disclaimer in the
  * documentation and/or other materials provided with the distribution.
- * 
+ *
  * * Neither the name of the original author; nor the names of any contributors
  * may be used to endorse or promote products derived from this software
  * without specific prior written permission.
- * 
- * 
+ *
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,13 +36,13 @@
 struct profile_timer;
 typedef struct profile_timer switch_profile_timer_t;
 
-/*! 
+/*!
  * \brief create a new profile timer
  * \return profile timer structure previously created with new_profile_timer, NULL on error
  */
 SWITCH_DECLARE(switch_profile_timer_t *) switch_new_profile_timer(void);
 
-/*! 
+/*!
  * \brief provides the percentage of idle system time
  * \param p profile timer structure previously created with new_profile_timer
  * \param pointer to store the percentage of idle time
@@ -52,7 +52,7 @@ SWITCH_DECLARE(switch_profile_timer_t *) switch_new_profile_timer(void);
 SWITCH_DECLARE(switch_bool_t) switch_get_system_idle_time(switch_profile_timer_t *p, double *idle_percentage);
 
 
-/*! 
+/*!
  * \brief Deletes profile timer
  */
 SWITCH_DECLARE(void) switch_delete_profile_timer(switch_profile_timer_t **p);
diff --git a/src/include/switch_regex.h b/src/include/switch_regex.h
index 9f3f1d00c6..22147c1809 100644
--- a/src/include/switch_regex.h
+++ b/src/include/switch_regex.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Michael Jerris 
  *
  * switch_regex.h -- pcre wrapper and extensions Header
@@ -70,7 +70,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(const char *target, const cha
 */
 SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial_match);
 
-SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data, 
+SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data,
 										  int *ovector, const char *var, switch_cap_callback_t callback, void *user_data);
 
 SWITCH_DECLARE_NONSTD(void) switch_regex_set_var_callback(const char *var, const char *val, void *user_data);
diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h
index 4dd0e2c5e3..04f38f37ee 100644
--- a/src/include/switch_resample.h
+++ b/src/include/switch_resample.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -34,9 +34,9 @@
 
 	This module implements a generic interface for doing audio resampling it currently uses libresample but can be ported to
 	any resample library with a little effort.  I decided against making this interface pluggable because there are not many
-	options in terms of resample libraries so it seemed like a waste but I did opt to frontend the interface in case a better 
+	options in terms of resample libraries so it seemed like a waste but I did opt to frontend the interface in case a better
 	way comes along some day. =D
-	
+
 */
 #define switch_normalize_volume(x) if (x > 4) x = 4; if (x < -4) x = -4;
 #define switch_normalize_volume_granular(x) if (x > 13) x = 13; if (x < -13) x = -13;
@@ -49,7 +49,7 @@ SWITCH_BEGIN_EXTERN_C
 /*!
   \defgroup resamp Audio Resample Functions
   \ingroup core1
-  \{ 
+  \{
 */
 /*! \brief An audio resampling handle */
 	typedef struct {
diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h
index 885ee2ac12..3ae8bd586a 100644
--- a/src/include/switch_rtp.h
+++ b/src/include/switch_rtp.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -30,10 +30,10 @@
  * Marcel Barbulescu 
  *
  */
-/** 
+/**
  * @file switch_rtp.h
  * @brief RTP
- * 
+ *
  */
 
 #ifndef SWITCH_RTP_H
@@ -162,7 +162,7 @@ typedef enum { /* FMT Values for PSFB Payload Types http://www.iana.org/assignme
 	_RTCP_PSFB_TSTR  = 5, /* TSTR: Temporal-Spatial Trade-off Request RFC5104 */
 	_RTCP_PSFB_TSTN  = 6, /* TSTN: Temporal-Spatial Trade-off Notification RFC5104 */
 	_RTCP_PSFB_VBCM  = 7, /* VBCM: Video Back Channel Message RFC5104 */
-	_RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/ 
+	_RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/
 	_RTCP_PSFB_AFB   = 15 /* AFB Application layer FB */
 } rtcp_psfb_t;
 
@@ -180,7 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
 
 
 SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
-/*! 
+/*!
   \brief Initilize the RTP System
   \param pool the memory pool to use for long term allocations
   \note Generally called by the core_init
@@ -205,7 +205,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_ssrc(switch_rtp_t *rtp_ses
 */
 SWITCH_DECLARE(switch_port_t) switch_rtp_set_end_port(switch_port_t port);
 
-/*! 
+/*!
   \brief Request a new port to be used for media
   \param ip the ip to request a port from
   \return the new port to use
@@ -216,7 +216,7 @@ SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port)
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval);
-/*! 
+/*!
   \brief create a new RTP session handle
   \param new_rtp_session a poiter to aim at the new session
   \param payload the IANA payload number
@@ -260,7 +260,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
 											  switch_rtp_flag_t flags[], char *timer_name, const char **err, switch_memory_pool_t *pool);
 
 
-/*! 
+/*!
   \brief Assign a remote address to the RTP session
   \param rtp_session an RTP session to assign the remote address to
   \param host the ip or fqhn of the remote address
@@ -279,7 +279,7 @@ SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session
 SWITCH_DECLARE(switch_status_t) switch_rtp_udptl_mode(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Assign a local address to the RTP session
   \param rtp_session an RTP session to assign the local address to
   \param host the ip or fqhn of the local address
@@ -290,7 +290,7 @@ SWITCH_DECLARE(void) switch_rtp_reset(switch_rtp_t *rtp_session);
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, const char **err);
 
-/*! 
+/*!
   \brief Kill the socket on an existing RTP session
   \param rtp_session an RTP session to kill the socket of
 */
@@ -299,14 +299,14 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_flush(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Test if an RTP session is ready
   \param rtp_session an RTP session to test
   \return a true value if it's ready
 */
 SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Destroy an RTP session
   \param rtp_session an RTP session to destroy
 */
@@ -314,15 +314,15 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_sync_stats(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Acvite ICE on an RTP session
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin,
 														const char *password, const char *rpassword, ice_proto_t proto,
 														switch_core_media_ice_type_t type, ice_t *ice_params);
 
-/*! 
+/*!
   \brief Activate sending RTCP Sender Reports (SR's)
   \param send_rate interval in milliseconds to send at
   \return SWITCH_STATUS_SUCCESS
@@ -335,13 +335,13 @@ SWITCH_DECLARE(switch_timer_t *) switch_rtp_get_media_timer(switch_rtp_t *rtp_se
 SWITCH_DECLARE(switch_status_t) switch_rtp_set_video_buffer_size(switch_rtp_t *rtp_session, uint32_t frames, uint32_t max_frames);
 SWITCH_DECLARE(switch_status_t) switch_rtp_get_video_buffer_size(switch_rtp_t *rtp_session, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len);
 
-/*! 
+/*!
   \brief Acvite a jitter buffer on an RTP session
   \param rtp_session the rtp session
   \param queue_frames the number of frames to delay
   \return SWITCH_STATUS_SUCCESS
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session,
 																  uint32_t queue_frames,
 																  uint32_t max_queue_frames,
 																  uint32_t samples_per_packet, uint32_t samples_per_second);
@@ -379,28 +379,28 @@ SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_
 */
 SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flag);
 
-/*! 
+/*!
   \brief Retrieve the socket from an existing RTP session
   \param rtp_session the RTP session to retrieve the socket from
   \return the socket from the RTP session
 */
 SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session);
 SWITCH_DECLARE(void) switch_rtp_ping(switch_rtp_t *rtp_session);
-/*! 
+/*!
   \brief Get the default samples per interval for a given RTP session
   \param rtp_session the RTP session to get the samples per interval from
   \return the default samples per interval of the RTP session
 */
 SWITCH_DECLARE(uint32_t) switch_rtp_get_default_samples_per_interval(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Set the default payload number for a given RTP session
   \param rtp_session the RTP session to set the payload number on
-  \param payload the new default payload number 
+  \param payload the new default payload number
 */
 SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload);
 
-/*! 
+/*!
   \brief Get the default payload number for a given RTP session
   \param rtp_session the RTP session to get the payload number from
   \return the default payload of the RTP session
@@ -408,15 +408,15 @@ SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, s
 SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp_t *rtp_session);
 
 
-/*! 
+/*!
   \brief Set a callback function to execute when an invalid RTP packet is encountered
   \param rtp_session the RTP session
   \param on_invalid the function to set
-  \return 
+  \return
 */
 SWITCH_DECLARE(void) switch_rtp_set_invalid_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler_t on_invalid);
 
-/*! 
+/*!
   \brief Read data from a given RTP session
   \param rtp_session the RTP session to read from
   \param data the data to read
@@ -429,7 +429,7 @@ SWITCH_DECLARE(void) switch_rtp_set_invalid_handler(switch_rtp_t *rtp_session, s
 SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
 												switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
 
-/*! 
+/*!
   \brief Queue RFC2833 DTMF data into an RTP Session
   \param rtp_session the rtp session to use
   \param dtmf the dtmf digits to queue
@@ -437,7 +437,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
 
-/*! 
+/*!
   \brief Queue RFC2833 DTMF data into an RTP Session
   \param rtp_session the rtp session to use
   \param dtmf the dtmf digits to queue
@@ -460,7 +460,7 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_has_dtmf(switch_rtp_t *rtp_session);
 */
 SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_dtmf_t *dtmf);
 
-/*! 
+/*!
   \brief Read data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param data a pointer to point directly to the RTP read buffer
@@ -474,7 +474,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
 														 void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
 														 switch_io_flag_t io_flags);
 
-/*! 
+/*!
   \brief Read data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param frame a frame to populate with information
@@ -484,7 +484,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
 SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags);
 
 
-/*! 
+/*!
   \brief Read RTCP data from a given RTP session without copying
   \param rtp_session the RTP session to read from
   \param frame an RTCP frame to populate with information
@@ -512,7 +512,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session,
 */
 SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Write data to a given RTP session
   \param rtp_session the RTP session to write to
   \param frame the frame to write
@@ -520,7 +520,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_disable_vad(switch_rtp_t *rtp_session
 */
 SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame_t *frame);
 
-/*! 
+/*!
   \brief Write data with a specified payload and sequence number to a given RTP session
   \param rtp_session the RTP session to write to
   \param data data to write
@@ -536,21 +536,21 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, void *data, switch_size_t *bytes, switch_bool_t process_encryption);
 
-/*! 
+/*!
   \brief Retrieve the SSRC from a given RTP session
   \param rtp_session the RTP session to retrieve from
   \return the SSRC
 */
 SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session);
 
-/*! 
+/*!
   \brief Associate an arbitrary data pointer with and RTP session
   \param rtp_session the RTP session to assign the pointer to
   \param private_data the private data to assign
 */
 SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data);
 
-/*! 
+/*!
   \brief Set the payload type to consider RFC2833 DTMF
   \param rtp_session the RTP session to modify
   \param te the payload type
@@ -558,14 +558,14 @@ SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *pri
 SWITCH_DECLARE(void) switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te);
 SWITCH_DECLARE(void) switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_session, switch_payload_t te);
 
-/*! 
+/*!
   \brief Set the payload type for comfort noise
   \param rtp_session the RTP session to modify
   \param pt the payload type
 */
 SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt);
 
-/*! 
+/*!
   \brief Retrieve the private data from a given RTP session
   \param rtp_session the RTP session to retrieve the data from
   \return the pointer to the private data
diff --git a/src/include/switch_scheduler.h b/src/include/switch_scheduler.h
index dc23e9f87e..14403917ca 100644
--- a/src/include/switch_scheduler.h
+++ b/src/include/switch_scheduler.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -59,7 +59,7 @@ SWITCH_BEGIN_EXTERN_C
   \param group a group id tag to link multiple tasks to a single entity.
   \param cmd_id an arbitrary index number be used in the callback.
   \param cmd_arg user data to be passed to the callback.
-  \param flags flags to alter behaviour 
+  \param flags flags to alter behaviour
   \return the id of the task
 */
 SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h
index 59cbdd3215..f05a6e11df 100644
--- a/src/include/switch_stun.h
+++ b/src/include/switch_stun.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2014, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  *
  *
@@ -80,7 +80,7 @@ typedef enum {
 	SWITCH_STUN_ATTR_SOURCE_ADDRESS2 = 0x0012,	/* Address */
 	SWITCH_STUN_ATTR_DATA = 0x0013,	/* ByteString */
 	SWITCH_STUN_ATTR_OPTIONS = 0x8001,	/* UInt32 */
-	SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020,   /* Address */  
+	SWITCH_STUN_ATTR_XOR_MAPPED_ADDRESS = 0x0020,   /* Address */
 
 	/* ice crap */
 
diff --git a/src/include/switch_types.h b/src/include/switch_types.h
index b2b28e91d8..0ebcef406e 100644
--- a/src/include/switch_types.h
+++ b/src/include/switch_types.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
  * Copyright (C) 2005-2015, Anthony Minessale II 
  *
@@ -22,7 +22,7 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- * 
+ *
  * Anthony Minessale II 
  * Bret McDanel 
  * Joseph Sullivan 
@@ -644,7 +644,7 @@ typedef struct {
 	switch_size_t flush_packet_count;
 	switch_size_t largest_jb_size;
 	/* Jitter */
-	int64_t last_proc_time;		
+	int64_t last_proc_time;
 	int64_t jitter_n;
 	int64_t jitter_add;
 	int64_t jitter_addsq;
@@ -660,7 +660,7 @@ typedef struct {
 	double mean_interval;
 	int loss[LOST_BURST_CAPTURE];
 	int last_loss;
-	int recved;	
+	int recved;
 	int last_processed_seq;
 	switch_size_t flaws;
 	switch_size_t last_flaw;
@@ -688,7 +688,7 @@ typedef struct {
 	uint16_t cycle;               /* Packet loss calculation, sequence number cycle of the current RTCP report interval */
 	uint32_t bad_seq;             /* Bad SEQ found, used to detect reset on the other side */
 	uint16_t base_seq;            /* Packet loss calculation, first sequence number received */
-	uint32_t cum_lost;            /* Packet loss calculation, cumulative number of packet lost */ 
+	uint32_t cum_lost;            /* Packet loss calculation, cumulative number of packet lost */
 	uint32_t last_recv_lsr_local; /* RTT calculation, When receiving an SR we save our local timestamp in fraction of 65536 seconds */
 	uint32_t last_recv_lsr_peer;  /* RTT calculation, When receiving an SR we extract the middle 32bits of the remote NTP timestamp to include it in the next SR LSR */
 	uint32_t init;
@@ -725,7 +725,7 @@ typedef enum {
 	SWITCH_RTP_FLAG_DATAWAIT	  - Do not return from reads unless there is data even when non blocking
 	SWITCH_RTP_FLAG_BUGGY_2833    - Emulate the bug in cisco equipment to allow interop
 	SWITCH_RTP_FLAG_PASS_RFC2833  - Pass 2833 (ignore it)
-	SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle    
+	SWITCH_RTP_FLAG_AUTO_CNG      - Generate outbound CNG frames when idle
 
*/ typedef enum { @@ -804,10 +804,10 @@ typedef enum { final_duration - initial_timestamp = total_samples However, if the duration value exceeds the space allocated (16 bits), The sender should increment - the timestamp one unit and reset the duration to 0. + the timestamp one unit and reset the duration to 0. Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional - and is mistakenly done by many devices. + and is mistakenly done by many devices. The issue is that the Sonus expects everyone to do it this way instead of tolerating either way. Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF. @@ -825,19 +825,19 @@ typedef enum { */ - + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), /* Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. With this flag, we will only increment the timestamp when write packets even if they are eons apart. - + */ RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), /* - Our friends at Sonus also get real mad if the sequence number does not start at 0. + Our friends at Sonus also get real mad if the sequence number does not start at 0. Typically, we set this to a random starting value for your saftey. This is a security risk you take upon yourself when you enable this flag. */ @@ -849,9 +849,9 @@ typedef enum { Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. This flag will never send any. Sheesh.... */ - + RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6), - + /* Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take 2X as long as it should and sending an incorrect duration making the DTMF very delayed. @@ -890,12 +890,12 @@ typedef enum { */ RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10), - + /* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */ RTP_BUG_ACCEPT_ANY_PAYLOAD = (1 << 11), - /* + /* Make FS accept any payload type instead of dropping and returning CNG frame. Workaround while FS only supports a single payload per rtp session. This can be used by endpoint modules to detect payload changes and act appropriately (ex: sofia could send a reINVITE with single codec). This should probably be a flag, but flag enum is already full! @@ -1032,7 +1032,7 @@ typedef uint32_t switch_ivr_option_t; SWITCH_MESSAGE_REDIRECT_AUDIO - Indication to redirect audio to another location if possible SWITCH_MESSAGE_TRANSMIT_TEXT - A text message SWITCH_MESSAGE_INDICATE_ANSWER - indicate answer - SWITCH_MESSAGE_INDICATE_PROGRESS - indicate progress + SWITCH_MESSAGE_INDICATE_PROGRESS - indicate progress SWITCH_MESSAGE_INDICATE_BRIDGE - indicate a bridge starting SWITCH_MESSAGE_INDICATE_UNBRIDGE - indicate a bridge ending SWITCH_MESSAGE_INDICATE_TRANSFER - indicate a transfer is taking place @@ -1339,7 +1339,7 @@ typedef enum {
 CF_ANSWERED			- Channel is answered
 CF_OUTBOUND			- Channel is an outbound channel
-CF_EARLY_MEDIA		- Channel is ready for audio before answer 
+CF_EARLY_MEDIA		- Channel is ready for audio before answer
 CF_ORIGINATOR		- Channel is an originator
 CF_TRANSFER			- Channel is being transfered
 CF_ACCEPT_CNG		- Channel will accept CNG frames
@@ -1679,7 +1679,7 @@ typedef uint32_t switch_codec_flag_t;
 SWITCH_SPEECH_FLAG_HASTEXT =		(1 <<  0) - Interface is has text to read.
 SWITCH_SPEECH_FLAG_PEEK =			(1 <<  1) - Read data but do not erase it.
 SWITCH_SPEECH_FLAG_FREE_POOL =		(1 <<  2) - Free interface's pool on destruction.
-SWITCH_SPEECH_FLAG_BLOCKING =       (1 <<  3) - Indicate that a blocking call is desired 
+SWITCH_SPEECH_FLAG_BLOCKING =       (1 <<  3) - Indicate that a blocking call is desired
 SWITCH_SPEECH_FLAG_PAUSE = 			(1 <<  4) - Pause toggle for playback
 
*/ @@ -1780,8 +1780,8 @@ SMBF_STEREO - Record in stereo SMBF_ANSWER_REQ - Don't record until the channel is answered SMBF_BRIDGE_REQ - Don't record until the channel is bridged SMBF_THREAD_LOCK - Only let the same thread who created the bug remove it. -SMBF_PRUNE - -SMBF_NO_PAUSE - +SMBF_PRUNE - +SMBF_NO_PAUSE - SMBF_STEREO_SWAP - Record in stereo: Write Stream - left channel, Read Stream - right channel
*/ @@ -1925,7 +1925,7 @@ typedef uint32_t switch_io_flag_t; SWITCH_EVENT_BACKGROUND_JOB - Background Job SWITCH_EVENT_DETECTED_SPEECH - Detected Speech SWITCH_EVENT_DETECTED_TONE - Detected Tone - SWITCH_EVENT_PRIVATE_COMMAND - A private command event + SWITCH_EVENT_PRIVATE_COMMAND - A private command event SWITCH_EVENT_HEARTBEAT - Machine is alive SWITCH_EVENT_TRAP - Error Trap SWITCH_EVENT_ADD_SCHEDULE - Something has been scheduled @@ -2325,15 +2325,15 @@ typedef enum { SWITCH_IO_WRITE } switch_io_type_t; -typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *codec, - switch_codec_control_command_t cmd, +typedef switch_status_t (*switch_core_codec_control_func_t) (switch_codec_t *codec, + switch_codec_control_command_t cmd, switch_codec_control_type_t ctype, void *cmd_data, switch_codec_control_type_t atype, void *cmd_arg, switch_codec_control_type_t *rtype, void **ret_data); - + typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings); typedef switch_status_t (*switch_core_codec_fmtp_parse_func_t) (const char *fmtp, switch_codec_fmtp_t *codec_fmtp); @@ -2444,7 +2444,7 @@ typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr); - + struct switch_say_file_handle; typedef struct switch_say_file_handle switch_say_file_handle_t; diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index f54d1d1d2b..057e0c58b4 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Seven Du * @@ -42,7 +42,7 @@ #include #include -SWITCH_BEGIN_EXTERN_C +SWITCH_BEGIN_EXTERN_C #define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" @@ -72,18 +72,18 @@ static inline uint32_t switch_round_to_step(uint32_t num, uint32_t step) uint32_t x; if (!num) return 0; - + r = (num % step); x = num - r; - + if (r > step / 2) { x += step; } - + return x; } -/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii +/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii http://www.azillionmonkeys.com/qed/asmexample.html */ static inline uint32_t switch_toupper(uint32_t eax) @@ -94,7 +94,7 @@ ebx = (0x7f7f7f7ful & ebx) + 0x1a1a1a1aul; return eax - ebx; } -/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii +/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii http://www.azillionmonkeys.com/qed/asmexample.html */ static inline uint32_t switch_tolower(uint32_t eax) @@ -108,7 +108,7 @@ static inline uint32_t switch_tolower(uint32_t eax) #ifdef FS_64BIT -/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii +/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii http://www.azillionmonkeys.com/qed/asmexample.html */ static inline uint64_t switch_toupper64(uint64_t eax) @@ -119,7 +119,7 @@ uint64_t ebx = (0x7f7f7f7f7f7f7f7full & eax) + 0x0505050505050505ull; return eax - ebx; } -/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii +/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii http://www.azillionmonkeys.com/qed/asmexample.html */ static inline uint64_t switch_tolower64(uint64_t eax) @@ -186,7 +186,7 @@ static inline void switch_tolower_max(char *s) } -#else +#else static inline void switch_toupper_max(char *s) { @@ -213,7 +213,7 @@ static inline void switch_toupper_max(char *s) c++; l--; } - + } static inline void switch_tolower_max(char *s) @@ -241,7 +241,7 @@ static inline void switch_tolower_max(char *s) c++; l--; } - + } #endif @@ -314,7 +314,7 @@ static inline switch_bool_t switch_is_moh(const char *s) #define zset(_a, _b) if (!zstr(_b)) _a = _b -/* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found +/* find a character (find) in a string (in) and return a pointer to that point in the string where the character was found using the array (allowed) as allowed non-matching characters, when (allowed) is NULL, behaviour should be identical to strchr() */ static inline char *switch_strchr_strict(const char *in, char find, const char *allowed) @@ -343,12 +343,12 @@ static inline char *switch_strchr_strict(const char *in, char find, const char * acceptable = 1; break; } - + a++; } } - + if (!acceptable) return NULL; p++; @@ -410,7 +410,7 @@ static inline char *switch_print_bits(const unsigned char *byte, char *buf, swit k++; byte++; } - + if (buf[j-1] == ' ') j--; buf[j++] = '\0'; return buf; @@ -491,7 +491,7 @@ SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, /*! \brief Evaluate the truthfullness of a string expression \param expr a string expression - \return true or false + \return true or false */ static inline int switch_true(const char *expr) { @@ -523,7 +523,7 @@ static inline switch_byte_t switch_true_byte(const char *expr) /*! \brief Evaluate the falsefullness of a string expression \param expr a string expression - \return true or false + \return true or false */ static inline int switch_false(const char *expr) { @@ -725,7 +725,7 @@ static inline char *switch_sanitize_number(char *number) while ((q = strrchr(p, '@'))) *q = '\0'; - + for (i = 0; i < (int) strlen(warp); i++) { while (p && (q = strchr(p, warp[i]))) p = q + 1; @@ -1048,7 +1048,7 @@ static inline int32_t switch_calc_bitrate(int w, int h, int quality, double fps) /* KUSH GAUGE*/ if (!fps) fps = 15; - + r = (int32_t)((double)(w * h * fps * (quality ? quality : 1)) * 0.07) / 1000; if (!quality) r /= 2; @@ -1065,7 +1065,7 @@ static inline int32_t switch_parse_bandwidth_string(const char *bwv) if (!strcasecmp(bwv, "auto")) { return -1; - } + } if ((bw = (float) atof(bwv))) { if (bw < 0) return 0; @@ -1087,7 +1087,7 @@ static inline int switch_needs_url_encode(const char *s) const char hex[] = "0123456789ABCDEF"; const char *p, *e = end_of_p(s); - + for(p = s; p && *p; p++) { if (*p == '%' && e-p > 1) { if (strchr(hex, *(p+1)) && strchr(hex, *(p+2))) { @@ -1129,7 +1129,7 @@ static inline void switch_separate_file_params(const char *file, char **file_por *file_portion = NULL; *params_portion = NULL; - + while (*file == '{') { e = switch_find_end_paren(file, '{', '}'); file = e + 1; @@ -1144,7 +1144,7 @@ static inline void switch_separate_file_params(const char *file, char **file_por } else { *file_portion = (char *)space; } - + return; } diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 23596aedc6..e8e2a2bf92 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -101,7 +101,7 @@ struct switch_xml { uint32_t refs; }; -/*! +/*! * \brief Parses a string into a switch_xml_t, ensuring the memory will be freed with switch_xml_free * \param s The string to parse * \param dup true if you want the string to be strdup()'d automatically @@ -109,8 +109,8 @@ struct switch_xml { */ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_ switch_bool_t dup); -/*! - * \brief Parses a string into a switch_xml_t +/*! + * \brief Parses a string into a switch_xml_t * \param s The string to parse * \return the switch_xml_t or NULL if an error occured */ @@ -200,7 +200,7 @@ SWITCH_DECLARE(const char *) switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_ ///\brief Traverses the switch_xml structure to retrieve a specific subtag. Takes a ///\ variable length list of tag names and indexes. The argument list must be -///\ terminated by either an index of -1 or an empty string tag name. Example: +///\ terminated by either an index of -1 or an empty string tag name. Example: ///\ title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1); ///\ This retrieves the title of the 3rd book on the 1st shelf of library. ///\ Returns NULL if not found. diff --git a/src/include/switch_xml_config.h b/src/include/switch_xml_config.h index eea4dfe0a9..57a2cb455b 100644 --- a/src/include/switch_xml_config.h +++ b/src/include/switch_xml_config.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Rene * * @@ -96,7 +96,7 @@ typedef switch_status_t (*switch_xml_config_callback_t) (switch_xml_config_item_ switch_bool_t changed); /*! - * \brief A configuration instruction read by switch_xml_config_parse + * \brief A configuration instruction read by switch_xml_config_parse */ struct switch_xml_config_item { const char *key; /*< The key of the element, or NULL to indicate the end of the list */ @@ -122,29 +122,29 @@ SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *it const void *defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext); -/*! +/*! * \brief Gets the int representation of an enum * \param enum_options the switch_xml_config_enum_item_t array for this enum - * \param value string value to search + * \param value string value to search */ SWITCH_DECLARE(switch_status_t) switch_xml_config_enum_str2int(switch_xml_config_enum_item_t *enum_options, const char *value, int *out); -/*! +/*! * \brief Gets the string representation of an enum * \param enum_options the switch_xml_config_enum_item_t array for this enum - * \param value int value to search + * \param value int value to search */ SWITCH_DECLARE(const char *) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value); /*! - * \brief Prints out an item's documentation on the console + * \brief Prints out an item's documentation on the console * \param level loglevel to use * \param item item which the doc should be printed */ SWITCH_DECLARE(void) switch_xml_config_item_print_doc(int level, switch_xml_config_item_t *item); -/*! - * \brief Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t +/*! + * \brief Parses all the xml elements, following a ruleset defined by an array of switch_xml_config_item_t * \param xml The first element of the list to parse * \param reload true to skip all non-reloadable options * \param instructions instrutions on how to parse the elements @@ -156,12 +156,12 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse(switch_xml_t xml, switch * \brief Parses a module's settings * \param reload true to skip all non-reloadable options * \param file the configuration file to look for - * \param instructions the instructions + * \param instructions the instructions */ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_module_settings(const char *file, switch_bool_t reload, switch_xml_config_item_t *instructions); -/*! - * \brief Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t +/*! + * \brief Parses all of an event's elements, following a ruleset defined by an array of switch_xml_config_item_t * \param event The event structure containing the key and values to parse * \param reload true to skip all non-reloadable options * \param instructions instrutions on how to parse the elements @@ -171,10 +171,10 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev switch_xml_config_item_t *instructions); /*! - * \brief Parses a list of xml elements into an event + * \brief Parses a list of xml elements into an event * \param xml First element of the xml list to parse * \param keyname Name of the key attribute - * \param keyvalue Name of the value attribute + * \param keyvalue Name of the value attribute * \param event [out] event (if *event is NOT NULL, the headers will be appended to the existing event) */ SWITCH_DECLARE(switch_size_t) switch_event_import_xml(switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event); diff --git a/src/mod/applications/mod_abstraction/mod_abstraction.c b/src/mod/applications/mod_abstraction/mod_abstraction.c index a232848fe4..bb24ca4c75 100644 --- a/src/mod/applications/mod_abstraction/mod_abstraction.c +++ b/src/mod/applications/mod_abstraction/mod_abstraction.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -38,7 +38,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_abstraction_load); const char *global_cf = "abstraction.conf"; -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_abstraction, mod_abstraction_load, mod_abstraction_shutdown, NULL); @@ -86,12 +86,12 @@ SWITCH_STANDARD_API(api_abstraction_function) } switch_api_execute(destination, api_args, session, stream); - switch_safe_free(substituted); + switch_safe_free(substituted); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No match for API %s (%s != %s)\n", api_name, parse, cmd); } switch_regex_safe_free(re); - + } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API %s doesn't exist inside the xml structure. You might have forgot to reload the module after editing it\n", api_name); } diff --git a/src/mod/applications/mod_av/avcodec.c b/src/mod/applications/mod_av/avcodec.c index 4716d829c0..3d24279202 100644 --- a/src/mod/applications/mod_av/avcodec.c +++ b/src/mod/applications/mod_av/avcodec.c @@ -821,7 +821,7 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t width, uint32_t height) { int sane = 0; - + if (!context->encoder) { if (context->av_codec_id == AV_CODEC_ID_H264) { if (context->codec_settings.video.try_hardware_encoder && (context->encoder = avcodec_find_encoder_by_name("nvenc_h264"))) { @@ -889,7 +889,7 @@ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t widt } context->bandwidth *= 3; - + //context->encoder_ctx->bit_rate = context->bandwidth * 1024; context->encoder_ctx->width = context->codec_settings.video.width; context->encoder_ctx->height = context->codec_settings.video.height; @@ -1286,7 +1286,7 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t if (got_picture && decoded_len > 0) { int width = picture->width; int height = picture->height; - + if (!context->img || (context->img->d_w != width || context->img->d_h != height)) { switch_img_free(&context->img); context->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1); diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 8e2f72041d..4d87a50738 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -303,7 +303,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec } mst->st->id = fc->nb_streams - 1; c = mst->st->codec; - + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "id:%d den:%d num:%d\n", mst->st->id, mst->st->time_base.den, mst->st->time_base.num); if (threads > 4) { @@ -340,7 +340,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec } else { mm->fps = fps; } - + if (mm->vw && mm->vh) { mst->width = mm->vw; mst->height = mm->vh; @@ -392,7 +392,7 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec c->level = 52; break; } - + switch (mm->vencspd) { case SWITCH_VIDEO_ENCODE_SPEED_SLOW: av_opt_set(c->priv_data, "preset", "veryslow", 0); @@ -657,7 +657,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * goto top; } } else { - + size = switch_queue_size(eh->video_queue); if (size > 5 && !eh->finalize) { @@ -672,12 +672,12 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * } } } - + //switch_mutex_lock(eh->mutex); eh->in_callback = 1; - - av_init_packet(&pkt); + + av_init_packet(&pkt); if (eh->video_st->frame) { ret = av_frame_make_writable(eh->video_st->frame); @@ -688,7 +688,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * } fill_avframe(eh->video_st->frame, img); - + if (eh->finalize) { if (delta_i && !delta_avg) { delta_avg = (int)(double)(delta_sum / delta_i); @@ -714,13 +714,13 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * if (delta_tmp != last_ts) { delta_sum += delta_tmp; delta_i++; - + if (delta_i >= 60) { delta_avg = (int)(double)(delta_sum / delta_i); delta_i = 0; delta_sum = delta_avg; } - + eh->video_st->frame->pts = eh->timer->samplecount; } } @@ -977,12 +977,12 @@ SWITCH_STANDARD_APP(record_av_function) int offset = DFT_RECORD_OFFSET; int fps = codec.implementation->actual_samples_per_second / samples; int lead_frames = (offset * fps) / 1000; - + for (int x = 0; x < lead_frames; x++) { switch_buffer_write(buffer, buf, datalen); - } + } } - + while (switch_channel_ready(channel)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_SINGLE_READ, 0); @@ -1585,16 +1585,16 @@ again: *pts = vframe->pkt_pts; avframe2img(vframe, img); img->user_priv = pts; - + #ifdef ALT_WAY diff = sleep - (switch_time_now() - context->last_vid_push); - + if (diff > 0 && diff <= sleep) { switch_core_timer_next(&context->video_timer); } else { switch_core_timer_sync(&context->video_timer); } -#endif +#endif context->vid_ready = 1; switch_queue_push(context->eh.video_queue, img); @@ -1686,7 +1686,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa switch_status_t status = SWITCH_STATUS_SUCCESS; switch_set_string(file, path); - + if ((ext = strrchr((char *)path, '.')) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n"); return SWITCH_STATUS_GENERR; @@ -1923,7 +1923,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s switch_buffer_write(context->audio_buffer, data, datalen); } - + bytes = context->audio_st.frame->nb_samples * 2 * context->audio_st.st->codec->channels; @@ -1937,15 +1937,15 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s switch_buffer_write(context->audio_buffer, buf, bytes - inuse); } } - - + + while ((inuse = switch_buffer_inuse(context->audio_buffer)) >= bytes) { AVPacket pkt = { 0 }; int got_packet = 0; int ret; av_init_packet(&pkt); - + if (context->audio_st.resample_ctx) { // need resample int out_samples = avresample_get_out_samples(context->audio_st.resample_ctx, context->audio_st.frame->nb_samples); av_frame_make_writable(context->audio_st.frame); @@ -1955,7 +1955,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s ret = avresample_convert(context->audio_st.resample_ctx, context->audio_st.tmp_frame->data, 0, out_samples, (uint8_t **)context->audio_st.frame->data, 0, context->audio_st.frame->nb_samples); - + if (ret < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while converting %d samples, error text: %s\n", context->audio_st.frame->nb_samples, get_error_text(ret)); @@ -1964,7 +1964,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s context->audio_st.tmp_frame->pts = context->audio_st.next_pts; context->audio_st.next_pts += context->audio_st.frame->nb_samples; - ret = avcodec_encode_audio2(context->audio_st.st->codec, &pkt, context->audio_st.tmp_frame, &got_packet); + ret = avcodec_encode_audio2(context->audio_st.st->codec, &pkt, context->audio_st.tmp_frame, &got_packet); } else { av_frame_make_writable(context->audio_st.frame); switch_buffer_read(context->audio_buffer, context->audio_st.frame->data[0], bytes); @@ -2010,9 +2010,9 @@ static switch_status_t av_file_command(switch_file_handle_t *handle, switch_file switch(command) { case SCFC_FLUSH_AUDIO: - switch_mutex_lock(context->mutex); + switch_mutex_lock(context->mutex); switch_buffer_zero(context->audio_buffer); - switch_mutex_unlock(context->mutex); + switch_mutex_unlock(context->mutex); break; case SCFC_PAUSE_READ: if (context->read_paused) { @@ -2131,7 +2131,7 @@ static switch_status_t av_file_read(switch_file_handle_t *handle, void *data, si if (size == 0) { size_t blank = (handle->samplerate / 20) * 2 * handle->real_channels; - + if (need > blank) { need = blank; } @@ -2165,7 +2165,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f if ((flags & SVR_FLUSH)) { flush_video_queue(context->eh.video_queue, 1); } - + if ((flags & SVR_BLOCK)) { status = switch_queue_pop(context->eh.video_queue, &pop); } else { @@ -2185,7 +2185,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f return (flags & SVR_FLUSH) ? SWITCH_STATUS_BREAK : status; } -#else +#else static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) { @@ -2343,7 +2343,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "picture is too late, off: %" SWITCH_INT64_T_FMT " max delta: %" SWITCH_INT64_T_FMT " queue size:%u fps:%u/%0.2f\n", (int64_t)(now - mst->next_pts), max_delta, switch_queue_size(context->eh.video_queue), context->read_fps, handle->mm.fps); switch_img_free(&img); //max_delta = AV_TIME_BASE; - + if (switch_queue_size(context->eh.video_queue) > 0) { // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WTF again\n"); goto again; @@ -2351,7 +2351,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f mst->next_pts = 0; context->video_start_time = 0; return SWITCH_STATUS_BREAK; - } + } } if ((flags & SVR_BLOCK) || do_fl) { @@ -2369,7 +2369,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f return SWITCH_STATUS_BREAK; } } - + } else { return SWITCH_STATUS_BREAK; } diff --git a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c index 41ee16adf5..a6dab2be28 100644 --- a/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c +++ b/src/mod/applications/mod_avmd/avmd_desa2_tweaked.c @@ -1,4 +1,4 @@ -/* +/* * Contributor(s): * * Piotr Gregor diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index 9c6d4ba37b..b0d8655d6e 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -1,4 +1,4 @@ -/* +/* * Contributor(s): * * Eric des Courtis @@ -43,7 +43,7 @@ typedef union { float f; } float_conv_t; -/* +/* * Manipulate these parameters to change * mapping's resolution. The sine tone * of 1600Hz is detected even with 20 @@ -241,7 +241,7 @@ dump_table_summary(void) i_1 = index_from_float(1.0); di = (i_1 - i_0)/100; if (di == 0) di = 1; - + for (; i < ACOS_TABLE_LENGTH; i += di ) { f = float_from_index(i); diff --git a/src/mod/applications/mod_avmd/avmd_goertzel.c b/src/mod/applications/mod_avmd/avmd_goertzel.c index 3c58ffbe51..5f05c00b22 100644 --- a/src/mod/applications/mod_avmd/avmd_goertzel.c +++ b/src/mod/applications/mod_avmd/avmd_goertzel.c @@ -1,4 +1,4 @@ -/* +/* * Contributor(s): * * Eric des Courtis diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 04be96589f..17da3183a9 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -82,7 +82,7 @@ #define AVMD_MIN_FREQUENCY (440.0) /*! Minimum frequency as digital normalized frequency */ #define AVMD_MIN_FREQUENCY_R(r) ((2.0 * M_PI * AVMD_MIN_FREQUENCY) / (r)) -/*! +/*! * Maximum beep frequency in Hertz * Note: The maximum frequency the DESA-2 algorithm can uniquely * identify is 0.25 of the sampling rate. All the frequencies @@ -733,7 +733,7 @@ static void avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, d switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", "ERROR (TRUNCATED)"); } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detector-offset", buf); - + res = snprintf(buf, AVMD_CHAR_BUF_LEN, "%u", idx); if (res < 0 || res > AVMD_CHAR_BUF_LEN - 1) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_s), SWITCH_LOG_ERROR, "Error, truncated [%s], [%d] attempeted!\n", buf, res); @@ -1137,7 +1137,7 @@ static switch_status_t avmd_parse_cmd_data_one_entry(char *candidate, struct avm } /* this may be option parameter if valid */ - key = candidate_parsed[0]; /* option name */ + key = candidate_parsed[0]; /* option name */ if (zstr(key)) { /* empty key */ return SWITCH_STATUS_NOT_INITALIZED; } @@ -1399,7 +1399,7 @@ SWITCH_STANDARD_APP(avmd_start_app) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); goto end_unlock; } - + switch_mutex_lock(avmd_globals.mutex); ++avmd_globals.session_n; switch_mutex_unlock(avmd_globals.mutex); diff --git a/src/mod/applications/mod_bert/mod_bert.c b/src/mod/applications/mod_bert/mod_bert.c index 70badc1354..39756b06e9 100644 --- a/src/mod/applications/mod_bert/mod_bert.c +++ b/src/mod/applications/mod_bert/mod_bert.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2011, Anthony Minessale II * @@ -230,7 +230,7 @@ SWITCH_STANDARD_APP(bert_test_function) /* Proceed to read and process the received frame ... * Note that switch_core_session_read_frame is a blocking operation, we could do reathing in another thread like the playback() app - * does using switch_core_service_session() but OTOH that would lead to more load/cpu usage, extra threads being launched per call leg + * does using switch_core_service_session() but OTOH that would lead to more load/cpu usage, extra threads being launched per call leg * and most likely reduce the overall capacity of the test system */ status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { @@ -381,23 +381,23 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_TIMEOUT); return SWITCH_STATUS_TERM; } - + if (switch_event_reserve_subclass(BERT_EVENT_LOST_SYNC) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_LOST_SYNC); return SWITCH_STATUS_TERM; } - - + + if (switch_event_reserve_subclass(BERT_EVENT_IN_SYNC) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_IN_SYNC); return SWITCH_STATUS_TERM; } - - + + *module_interface = switch_loadable_module_create_module_interface(pool, modname); - SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE); return SWITCH_STATUS_SUCCESS; } @@ -406,7 +406,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown) switch_event_free_subclass(BERT_EVENT_TIMEOUT); switch_event_free_subclass(BERT_EVENT_LOST_SYNC); switch_event_free_subclass(BERT_EVENT_IN_SYNC); - + return SWITCH_STATUS_UNLOAD; } diff --git a/src/mod/applications/mod_blacklist/mod_blacklist.c b/src/mod/applications/mod_blacklist/mod_blacklist.c index 4a8c022c47..ce5d5a5c03 100644 --- a/src/mod/applications/mod_blacklist/mod_blacklist.c +++ b/src/mod/applications/mod_blacklist/mod_blacklist.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Rene * Raymond Chandler * @@ -53,19 +53,19 @@ static struct { switch_memory_pool_t *pool; } globals; -blacklist_t *blacklist_create(const char *name) +blacklist_t *blacklist_create(const char *name) { switch_memory_pool_t *pool = NULL; blacklist_t *bl = NULL; - + switch_core_new_memory_pool(&pool); bl = switch_core_alloc(pool, sizeof(*bl)); switch_assert(bl); bl->pool = pool; - + switch_core_hash_init(&bl->list); switch_mutex_init(&bl->list_mutex, SWITCH_MUTEX_NESTED, pool); - + return bl; } @@ -117,14 +117,14 @@ static switch_status_t do_config(switch_bool_t reload) /* Load up blacklists */ switch_xml_t xml, cfg, lists, list; switch_hash_index_t *hi = NULL; - + if (!(xml = switch_xml_open_cfg("mod_blacklist.conf", &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load configuration section\n"); return SWITCH_STATUS_FALSE; } - + switch_mutex_lock(globals.lists_mutex); - + /* Destroy any active lists */ while ((hi = switch_core_hash_first_iter( globals.lists, hi))) { const void *key; @@ -133,7 +133,7 @@ static switch_status_t do_config(switch_bool_t reload) blacklist_free((blacklist_t*)val); switch_core_hash_delete(globals.lists, (const char*)key); } - + if ((lists = switch_xml_child(cfg, "lists"))) { for (list = switch_xml_child(lists, "list"); list; list = list->next) { const char *name = switch_xml_attr_soft(list, "name"); @@ -151,9 +151,9 @@ static switch_status_t do_config(switch_bool_t reload) load_list(name, filename); } } - + switch_mutex_unlock(globals.lists_mutex); - + if (xml) { switch_xml_free(xml); xml = NULL; @@ -175,33 +175,33 @@ SWITCH_STANDARD_API(blacklist_api_function) char *data; int argc; char *argv[3]; - + data = strdup(cmd); trim(data); if (!(argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid usage\n"); goto done; } - + if (!strcasecmp(argv[0], "check")) { blacklist_t *bl = NULL; switch_bool_t result; - + if (argc < 2 || zstr(argv[1]) || zstr(argv[2])) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax"); goto done; } - + switch_mutex_lock(globals.lists_mutex); bl = switch_core_hash_find(globals.lists, argv[1]); switch_mutex_unlock(globals.lists_mutex); - + if (!bl) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]); stream->write_function(stream, "false"); goto done; } - + switch_mutex_lock(bl->list_mutex); result = (switch_bool_t)(intptr_t)switch_core_hash_find(bl->list, argv[2]); stream->write_function(stream, "%s", result ? "true" : "false"); @@ -212,17 +212,17 @@ SWITCH_STANDARD_API(blacklist_api_function) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax"); goto done; } - + switch_mutex_lock(globals.lists_mutex); bl = switch_core_hash_find(globals.lists, argv[1]); switch_mutex_unlock(globals.lists_mutex); - + if (!bl) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]); stream->write_function(stream, "-ERR Unknown blacklist\n"); goto done; } - + switch_mutex_lock(bl->list_mutex); switch_core_hash_insert(bl->list, argv[2], (void*)SWITCH_TRUE); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added [%s] to list [%s]\n", argv[2], argv[1]); @@ -234,17 +234,17 @@ SWITCH_STANDARD_API(blacklist_api_function) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wrong syntax"); goto done; } - + switch_mutex_lock(globals.lists_mutex); bl = switch_core_hash_find(globals.lists, argv[1]); switch_mutex_unlock(globals.lists_mutex); - + if (!bl) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown blacklist [%s]\n", argv[1]); stream->write_function(stream, "-ERR Unknown blacklist\n"); goto done; } - + switch_mutex_lock(bl->list_mutex); switch_core_hash_delete(bl->list, argv[2]); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Removed [%s] from list [%s]\n", argv[2], argv[1]); @@ -278,7 +278,7 @@ SWITCH_STANDARD_API(blacklist_api_function) } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Saving %s to %s\n", argv[1], filename); - + switch_mutex_lock(globals.lists_mutex); if (switch_file_open(&fd, filename, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_CREATE, SWITCH_FPROT_OS_DEFAULT, globals.pool) == SWITCH_STATUS_SUCCESS) { @@ -287,7 +287,7 @@ SWITCH_STANDARD_API(blacklist_api_function) switch_file_printf(fd, "%s\n", (char *)var); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "adding %s to the dump file\n", (char *)var); } - stream->write_function(stream, "+OK\n"); + stream->write_function(stream, "+OK\n"); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "couldn't open %s for writing\n", filename); } @@ -300,7 +300,7 @@ SWITCH_STANDARD_API(blacklist_api_function) } else if (!zstr(argv[0])) { stream->write_function(stream, "-ERR: No such command: %s (see 'blacklist help')\n", argv[0]); } - + done: switch_safe_free(data); return SWITCH_STATUS_SUCCESS; @@ -313,7 +313,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_blacklist_load) //switch_application_interface_t *app_interface; /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - + memset(&globals, 0, sizeof(globals)); globals.pool = pool; diff --git a/src/mod/applications/mod_callcenter/conf/autoload_configs/callcenter.conf.xml b/src/mod/applications/mod_callcenter/conf/autoload_configs/callcenter.conf.xml index 4db9ce55e6..326a33fe9b 100644 --- a/src/mod/applications/mod_callcenter/conf/autoload_configs/callcenter.conf.xml +++ b/src/mod/applications/mod_callcenter/conf/autoload_configs/callcenter.conf.xml @@ -36,4 +36,4 @@ - + diff --git a/src/mod/applications/mod_cidlookup/conf/autoload_configs/cidlookup.conf.xml b/src/mod/applications/mod_cidlookup/conf/autoload_configs/cidlookup.conf.xml index 40cb7b9410..80dad9f945 100644 --- a/src/mod/applications/mod_cidlookup/conf/autoload_configs/cidlookup.conf.xml +++ b/src/mod/applications/mod_cidlookup/conf/autoload_configs/cidlookup.conf.xml @@ -17,12 +17,12 @@ - * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Neal Horman * @@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_cluechoo_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_cluechoo_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL); @@ -102,7 +102,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cluechoo_shutdown) /*======================================== * sl.c: - * Copyright 1993,1998 Toyoda Masashi + * Copyright 1993,1998 Toyoda Masashi * (toyoda@is.titech.ac.jp) * Last Modified: 1998/ 7/22 *======================================== diff --git a/src/mod/applications/mod_cluechoo/sl.h b/src/mod/applications/mod_cluechoo/sl.h index 6bf90212c1..5a919cfa45 100644 --- a/src/mod/applications/mod_cluechoo/sl.h +++ b/src/mod/applications/mod_cluechoo/sl.h @@ -1,6 +1,6 @@ /*======================================== * sl.h: Text data of SL version 3.01 - * Copyright 1993 Toyoda Masashi + * Copyright 1993 Toyoda Masashi * (toyoda@is.titech.ac.jp) * Last Modified: 1992/12/23 *======================================== diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ae8bc8465b..29febefc53 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -445,7 +445,7 @@ SWITCH_STANDARD_API(list_users_function) } } } - + if (_domain) { tag_name = "domain"; key_name = "name"; @@ -3147,7 +3147,7 @@ SWITCH_STANDARD_API(uuid_drop_dtmf) if (argv[0]) { uuid = argv[0]; } - + if (argv[1]) { action = argv[1]; } @@ -3191,15 +3191,15 @@ SWITCH_STANDARD_API(uuid_drop_dtmf) switch_channel_set_variable(channel, "drop_dtmf", "false"); } } - + is_on = switch_channel_test_flag(channel, CF_DROP_DTMF); file = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_file", SWITCH_FALSE, -1); digits = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_digits", SWITCH_FALSE, -1); - stream->write_function(stream, "+OK %s is %s DTMF. mask_file: %s mask_digits: %s\n", uuid, is_on ? "dropping" : "not dropping", + stream->write_function(stream, "+OK %s is %s DTMF. mask_file: %s mask_digits: %s\n", uuid, is_on ? "dropping" : "not dropping", file ? file : "NONE", digits ? digits : "NONE"); - + switch_core_session_rwunlock(tsession); } else { stream->write_function(stream, "-ERR No such channel %s!\n", uuid); @@ -3308,7 +3308,7 @@ SWITCH_STANDARD_API(uuid_set_media_stats) static void jsonify_stats(cJSON *json, const char *name, switch_rtp_stats_t *stats) { cJSON *jstats = cJSON_CreateObject(); - cJSON_AddItemToObject(json, name, jstats); + cJSON_AddItemToObject(json, name, jstats); stats->inbound.std_deviation = sqrt(stats->inbound.variance); @@ -3345,7 +3345,7 @@ static void jsonify_stats(cJSON *json, const char *name, switch_rtp_stats_t *sta add_stat(stats->rtcp.packet_count, "rtcp_packet_count"); add_stat(stats->rtcp.octet_count, "rtcp_octet_count"); - + } static switch_bool_t true_enough(cJSON *json) @@ -3367,37 +3367,37 @@ SWITCH_STANDARD_JSON_API(json_stats_function) switch_core_session_t *tsession; reply = cJSON_CreateObject(); - *json_reply = reply; + *json_reply = reply; if (zstr(uuid)) { cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT")); goto end; } - + if ((tsession = switch_core_session_locate(uuid))) { cJSON *jevent; switch_rtp_stats_t *audio_stats = NULL, *video_stats = NULL; switch_core_media_set_stats(tsession); - + audio_stats = switch_core_media_get_stats(tsession, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(tsession)); video_stats = switch_core_media_get_stats(tsession, SWITCH_MEDIA_TYPE_VIDEO, switch_core_session_get_pool(tsession)); - + if (audio_stats) { jsonify_stats(reply, "audio", audio_stats); } - + if (video_stats) { jsonify_stats(reply, "video", video_stats); } - + if (true_enough(cdata) && switch_ivr_generate_json_cdr(tsession, &jevent, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { cJSON_AddItemToObject(reply, "channelData", jevent); } switch_core_session_rwunlock(tsession); - + status = SWITCH_STATUS_SUCCESS; } else { cJSON_AddItemToObject(reply, "response", cJSON_CreateString("Session does not exist")); @@ -4225,7 +4225,7 @@ SWITCH_STANDARD_API(uuid_video_bitrate_function) msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ; msg.numeric_arg = kps * 1024; msg.from = __FILE__; - + switch_core_session_receive_message(lsession, &msg); switch_core_session_video_reinit(lsession); switch_channel_video_sync(switch_core_session_get_channel(lsession)); @@ -4276,7 +4276,7 @@ SWITCH_STANDARD_API(uuid_codec_debug_function) msg.numeric_arg = level; msg.numeric_reply = type; msg.from = __FILE__; - + switch_core_session_receive_message(lsession, &msg); status = SWITCH_STATUS_SUCCESS; switch_core_session_rwunlock(lsession); @@ -4321,7 +4321,7 @@ SWITCH_STANDARD_API(uuid_codec_param_function) msg.string_array_arg[2] = argv[3]; msg.string_array_arg[3] = argv[4]; msg.from = __FILE__; - + switch_core_session_receive_message(lsession, &msg); status = SWITCH_STATUS_SUCCESS; switch_core_session_rwunlock(lsession); @@ -5918,7 +5918,7 @@ SWITCH_STANDARD_API(uuid_getvar_function) char *ptr = NULL; int idx = -1; char *vname = strdup(var_name); - + if ((ptr = strchr(vname, '[')) && strchr(ptr, ']')) { *ptr++ = '\0'; idx = atoi(ptr); @@ -5927,11 +5927,11 @@ SWITCH_STANDARD_API(uuid_getvar_function) free(vname); } - + if (!var_value) { var_value = switch_channel_get_variable(channel, var_name); } - + if (var_value != NULL) { stream->write_function(stream, "%s", var_value); } else { @@ -6389,7 +6389,7 @@ SWITCH_STANDARD_API(quote_shell_arg_function) } #define GETCPUTIME_SYNTAX "[reset]" -SWITCH_STANDARD_API(getcputime_function) +SWITCH_STANDARD_API(getcputime_function) { static int64_t reset_ums = 0, reset_kms = 0; // Last reset times in ms switch_cputime t = { 0 }; @@ -6885,14 +6885,14 @@ SWITCH_STANDARD_JSON_API(json_channel_data_function) reply = cJSON_CreateObject(); - *json_reply = reply; + *json_reply = reply; if (zstr(uuid)) { cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT")); goto end; } - + if ((tsession = switch_core_session_locate(uuid))) { cJSON *jevent; @@ -6901,7 +6901,7 @@ SWITCH_STANDARD_JSON_API(json_channel_data_function) } switch_core_session_rwunlock(tsession); - + status = SWITCH_STATUS_SUCCESS; } else { cJSON_AddItemToObject(reply, "response", cJSON_CreateString("Session does not exist")); @@ -6921,7 +6921,7 @@ SWITCH_STANDARD_JSON_API(json_execute_function) switch_core_session_t *tsession; reply = cJSON_CreateObject(); - *json_reply = reply; + *json_reply = reply; if (!data) { cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT")); @@ -6938,7 +6938,7 @@ SWITCH_STANDARD_JSON_API(json_execute_function) cJSON_AddItemToObject(reply, "response", cJSON_CreateString("INVALID INPUT")); goto end; } - + if ((tsession = switch_core_session_locate(uuid))) { if (switch_true(edata)) { cJSON *jevent = NULL; @@ -6974,7 +6974,7 @@ SWITCH_STANDARD_API(event_channel_broadcast_api_function) { cJSON *jdata = NULL; const char *channel; - + if (!cmd) { stream->write_function(stream, "-ERR parsing channel\n", SWITCH_VA_NONE); return SWITCH_STATUS_SUCCESS; @@ -6999,7 +6999,7 @@ SWITCH_STANDARD_API(event_channel_broadcast_api_function) } return SWITCH_STATUS_SUCCESS; - + } SWITCH_STANDARD_JSON_API(json_api_function) @@ -7024,7 +7024,7 @@ SWITCH_STANDARD_JSON_API(json_api_function) reply = cJSON_CreateObject(); SWITCH_STANDARD_STREAM(stream); - + if (cmd && (status = switch_api_execute(cmd->valuestring, arg ? arg->valuestring : NULL, session, &stream)) == SWITCH_STATUS_SUCCESS) { cJSON_AddItemToObject(reply, "message", cJSON_CreateString((char *) stream.data)); } else { @@ -7067,10 +7067,10 @@ SWITCH_STANDARD_JSON_API(json_status_function) cJSON_AddItemToObject(o, "seconds", cJSON_CreateNumber(duration.sec)); cJSON_AddItemToObject(o, "milliseconds", cJSON_CreateNumber(duration.ms)); cJSON_AddItemToObject(o, "microseconds", cJSON_CreateNumber(duration.mms)); - + cJSON_AddItemToObject(reply, "uptime", o); cJSON_AddItemToObject(reply, "version", cJSON_CreateString(switch_version_full_human())); - + o = cJSON_CreateObject(); cJSON_AddItemToObject(reply, "sessions", o); @@ -7091,7 +7091,7 @@ SWITCH_STANDARD_JSON_API(json_status_function) cJSON_AddItemToObject(oo, "max", cJSON_CreateNumber(sps)); cJSON_AddItemToObject(oo, "peak", cJSON_CreateNumber(max_sps)); cJSON_AddItemToObject(oo, "peak5Min", cJSON_CreateNumber(max_sps_fivemin)); - + o = cJSON_CreateObject(); cJSON_AddItemToObject(reply, "idleCPU", o); @@ -7099,7 +7099,7 @@ SWITCH_STANDARD_JSON_API(json_status_function) cJSON_AddItemToObject(o, "used", cJSON_CreateNumber(switch_core_min_idle_cpu(-1.0))); cJSON_AddItemToObject(o, "allowed", cJSON_CreateNumber(switch_core_idle_cpu())); - + if (switch_core_get_stacksizes(&cur, &max) == SWITCH_STATUS_SUCCESS) { o = cJSON_CreateObject(); cJSON_AddItemToObject(reply, "stackSizeKB", o); @@ -7107,10 +7107,10 @@ SWITCH_STANDARD_JSON_API(json_status_function) cJSON_AddItemToObject(o, "current", cJSON_CreateNumber((double)(cur / 1024))); cJSON_AddItemToObject(o, "max", cJSON_CreateNumber((double)(max / 1024))); } - + *json_reply = reply; - + return SWITCH_STATUS_SUCCESS; } @@ -7119,7 +7119,7 @@ SWITCH_STANDARD_API(json_function) cJSON *jcmd = NULL, *format = NULL; const char *message = ""; char *response = NULL; - + if (zstr(cmd)) { message = "No JSON supplied."; goto err; @@ -7142,13 +7142,13 @@ SWITCH_STANDARD_API(json_function) } else { response = cJSON_PrintUnformatted(jcmd); } - + stream->write_function(stream, "%s\n", switch_str_nil(response)); - + switch_safe_free(response); cJSON_Delete(jcmd); - + return SWITCH_STATUS_SUCCESS; err: diff --git a/src/mod/applications/mod_conference/conf/autoload_configs/conference.conf.xml b/src/mod/applications/mod_conference/conf/autoload_configs/conference.conf.xml index fad7820edd..7b9349fd09 100644 --- a/src/mod/applications/mod_conference/conf/autoload_configs/conference.conf.xml +++ b/src/mod/applications/mod_conference/conf/autoload_configs/conference.conf.xml @@ -1,4 +1,4 @@ - + @@ -6,8 +6,8 @@ - - + + @@ -29,19 +29,19 @@ - - - + diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index 6740844c7c..f56fcbb7e6 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -523,7 +523,7 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s if (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY) { return SWITCH_STATUS_SUCCESS; } - + if ((layer = conference_video_get_layer_locked(member))) { layer->clear = 1; conference_video_release_layer(&layer); @@ -1277,7 +1277,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit } else { group_name = argv[3]; } - + if (!group_name) { stream->write_function(stream, "Group name not specified.\n"); return SWITCH_STATUS_SUCCESS; @@ -1294,7 +1294,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit } stream->write_function(stream, "Change to layout group [%s]\n", group_name); - + if (argv[xx]) { if ((idx = atoi(argv[xx])) > 0) { idx--; @@ -1638,7 +1638,7 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi } layer = conference_video_get_layer_locked(member); - + if (!layer) { goto end; } @@ -2545,7 +2545,7 @@ switch_status_t conference_api_sub_record(conference_obj_t *conference, switch_s } if (id == 0 && conference->canvases[0]) id = 1; - + if (id > conference->canvas_count) { id = 1; } @@ -3001,7 +3001,7 @@ switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_str } member = conference_member_get_by_var(conference, var, val); - + if (member != NULL) { pfn(member, stream, argv[argn + 2]); switch_thread_rwlock_unlock(member->rwlock); diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 9828efba77..79f487fae9 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -45,7 +45,7 @@ static cJSON *get_canvas_info(mcu_canvas_t *canvas) { cJSON *obj = cJSON_CreateObject(); - + cJSON_AddItemToObject(obj, "canvasID", cJSON_CreateNumber(canvas->canvas_id)); cJSON_AddItemToObject(obj, "totalLayers", cJSON_CreateNumber(canvas->total_layers)); cJSON_AddItemToObject(obj, "layersUsed", cJSON_CreateNumber(canvas->layers_used)); @@ -53,7 +53,7 @@ static cJSON *get_canvas_info(mcu_canvas_t *canvas) if (canvas->vlayout) { cJSON_AddItemToObject(obj, "layoutName", cJSON_CreateString(canvas->vlayout->name)); } - + return obj; } @@ -188,24 +188,24 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json } if (member_id < 0) member_id = 0; } - + if (member_id > 0) { conference_member_t *member; - + if ((member = conference_member_get(conference, member_id))) { mcu_canvas_t *canvas; - + if ((canvas = conference_video_get_canvas_locked(member))) { cJSON *obj; - + if ((obj = get_canvas_info(canvas))) { - cJSON_AddItemToObject(obj, "layerID", cJSON_CreateNumber(member->video_layer_id)); + cJSON_AddItemToObject(obj, "layerID", cJSON_CreateNumber(member->video_layer_id)); cJSON_AddItemToArray(array, obj); } - + conference_video_release_canvas(&canvas); } - + switch_thread_rwlock_unlock(member->rwlock); } @@ -225,12 +225,12 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json switch_mutex_unlock(conference->canvas_mutex); } - + switch_thread_rwlock_unlock(conference->rwlock); } - + addobj = array; - + } else if (!strcasecmp(action, "list-videoLayouts")) { switch_hash_index_t *hi; void *val; @@ -245,15 +245,15 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json cJSON *obj = cJSON_CreateObject(); cJSON *resarray = cJSON_CreateArray(); int i; - + switch_core_hash_this(hi, &vvar, NULL, &val); vlayout = (video_layout_t *)val; for (i = 0; i < vlayout->layers; i++) { if (vlayout->images[i].res_id) { cJSON_AddItemToArray(resarray, cJSON_CreateString((char *)vlayout->images[i].res_id)); } - } - + } + cJSON_AddItemToObject(obj, "type", cJSON_CreateString("layout")); cJSON_AddItemToObject(obj, "name", cJSON_CreateString((char *)vvar)); cJSON_AddItemToObject(obj, "resIDS", resarray); @@ -274,11 +274,11 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json lg = (layout_group_t *) val; name = switch_mprintf("group:%s", (char *)vvar); - + for (vlnode = lg->layouts; vlnode; vlnode = vlnode->next) { cJSON_AddItemToArray(grouparray, cJSON_CreateString(vlnode->vlayout->name)); } - + cJSON_AddItemToObject(obj, "type", cJSON_CreateString("layoutGroup")); cJSON_AddItemToObject(obj, "name", cJSON_CreateString(name)); cJSON_AddItemToObject(obj, "groupLayouts", grouparray); diff --git a/src/mod/applications/mod_conference/conference_file.c b/src/mod/applications/mod_conference/conference_file.c index 801aab168a..230ffb10c9 100644 --- a/src/mod/applications/mod_conference/conference_file.c +++ b/src/mod/applications/mod_conference/conference_file.c @@ -277,7 +277,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u const char *canvasstr = switch_event_get_header(fnode->fh.params, "canvas"); const char *loopsstr = switch_event_get_header(fnode->fh.params, "loops"); int canvas_id = -1; - + if (loopsstr) { fnode->loops = atoi(loopsstr); diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index d022bea4b2..34da561764 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -800,8 +800,8 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob } member->loop_loop = 1; - - goto do_continue; + + goto do_continue; } if (switch_test_flag(read_frame, SFF_CNG)) { @@ -1003,7 +1003,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob } } } - + /* skip frames that are not actual media or when we are muted or silent */ if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS)) && conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD) diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index e05bbacd2f..2dc5ce5a5f 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -152,7 +152,7 @@ void conference_member_update_status_field(conference_member_t *member) if (!member->conference->la || !member->json || !member->status_field || conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) { return; } - + switch_live_array_lock(member->conference->la); if (!conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK)) { @@ -198,7 +198,7 @@ void conference_member_update_status_field(conference_member_t *member) if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) { video = cJSON_CreateObject(); - if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && + if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && member->video_layer_id > -1 && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY) { cJSON_AddItemToObject(video, "visible", cJSON_CreateTrue()); } else { @@ -423,7 +423,7 @@ conference_member_t *conference_member_get_by_var(conference_obj_t *conference, switch_mutex_lock(conference->member_mutex); for (member = conference->members; member; member = member->next) { const char *check_var; - + if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL)) { continue; } @@ -692,7 +692,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m switch_mutex_lock(member->audio_out_mutex); lock_member(member); switch_mutex_lock(conference->member_mutex); - + if (member->rec) { conference->recording_members++; } @@ -766,7 +766,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m member->energy_level = id; } } - + if ((var = switch_channel_get_variable_dup(member->channel, "video_initial_canvas", SWITCH_FALSE, -1))) { uint32_t id = atoi(var) - 1; if (id < conference->canvas_count) { @@ -777,16 +777,16 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m if ((var = switch_channel_get_variable_dup(member->channel, "video_initial_watching_canvas", SWITCH_FALSE, -1))) { uint32_t id = atoi(var) - 1; - + if (id == 0) { id = conference->canvas_count; } - + if (id <= conference->canvas_count && conference->canvases[id]) { member->watching_canvas_id = id; } } - + conference_video_reset_member_codec_index(member); if (has_video) { @@ -806,7 +806,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_in"))) { member->max_bw_in = switch_parse_bandwidth_string(var); } - + if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_out"))) { member->max_bw_out = switch_parse_bandwidth_string(var); @@ -816,7 +816,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m } } } - + switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id); switch_channel_set_variable_printf(channel, "conference_moderator", "%s", conference_utils_member_test_flag(member, MFLAG_MOD) ? "true" : "false"); switch_channel_set_variable_printf(channel, "conference_ghost", "%s", conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false"); @@ -958,7 +958,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m cJSON *dvars; switch_event_t *var_event; switch_event_header_t *hi; - + member->json = cJSON_CreateArray(); cJSON_AddItemToArray(member->json, cJSON_CreateStringPrintf("%0.4d", member->id)); cJSON_AddItemToArray(member->json, cJSON_CreateString(switch_channel_get_variable(member->channel, "caller_id_number"))); @@ -979,7 +979,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m for (hi = var_event->headers; hi; hi = hi->next) { if (!strncasecmp(hi->name, "verto_dvar_", 11)) { char *var = hi->name + 11; - + if (var) { cJSON_AddItemToObject(dvars, var, cJSON_CreateString(hi->value)); } @@ -1147,7 +1147,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m lock_member(member); conference_utils_member_clear_flag(member, MFLAG_INTREE); - + switch_safe_free(member->text_framedata); member->text_framesize = 0; if (member->text_buffer) { diff --git a/src/mod/applications/mod_conference/conference_record.c b/src/mod/applications/mod_conference/conference_record.c index 64a444cdee..f926d3043d 100644 --- a/src/mod/applications/mod_conference/conference_record.c +++ b/src/mod/applications/mod_conference/conference_record.c @@ -192,7 +192,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE; member->frame = switch_core_alloc(member->pool, member->frame_size); member->mux_frame = switch_core_alloc(member->pool, member->frame_size); - + if (conference->canvases[0]) { member->canvas_id = rec->canvas_id; canvas = conference->canvases[member->canvas_id]; diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 2cf5f58e54..850d274f96 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -113,7 +113,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int const char *val = NULL, *name = NULL, *bgimg = NULL; switch_bool_t auto_3d = SWITCH_FALSE; int border = 0; - + if ((val = switch_xml_attr(x_layout, "name"))) { name = val; } @@ -126,7 +126,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int auto_3d = switch_true(switch_xml_attr(x_layout, "auto-3d-position")); bgimg = switch_xml_attr(x_layout, "bgimg"); - + if ((val = switch_xml_attr(x_layout, "border"))) { border = atoi(val); if (border < 0) border = 0; @@ -147,7 +147,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int if ((val = switch_xml_attr(x_image, "x"))) { x = atoi(val); } - + if ((val = switch_xml_attr(x_image, "y"))) { y = atoi(val); } @@ -171,7 +171,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int if ((val = switch_xml_attr(x_image, "floor-only"))) { flooronly = floor = switch_true(val); } - + if ((val = switch_xml_attr(x_image, "file-only"))) { fileonly = switch_true(val); } @@ -187,7 +187,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int if ((val = switch_xml_attr(x_image, "audio-position"))) { audio_position = val; } - + if ((val = switch_xml_attr(x_image, "border"))) { border = atoi(val); @@ -203,9 +203,9 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int if (hscale == -1) { hscale = scale; } - + if (!border) border = conference->video_border_size; - + if (fileonly) { floor = flooronly = 0; } @@ -220,8 +220,8 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int vlayout->images[vlayout->layers].flooronly = flooronly; vlayout->images[vlayout->layers].fileonly = fileonly; vlayout->images[vlayout->layers].overlap = overlap; - - + + if (res_id) { vlayout->images[vlayout->layers].res_id = switch_core_strdup(conference->pool, res_id); } @@ -256,7 +256,7 @@ void conference_video_parse_layouts(conference_obj_t *conference, int WIDTH, int vlayout->images[vlayout->layers].audio_position = switch_core_strdup(conference->pool, audio_position); } } - + vlayout->layers++; } @@ -341,7 +341,7 @@ void conference_video_clear_layer(mcu_layer_t *layer) layer->banner_patched = 0; layer->refresh = 1; - + } void conference_video_reset_layer(mcu_layer_t *layer) @@ -421,7 +421,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, layer->bug_frame.img = NULL; switch_thread_rwlock_unlock(layer->member->rwlock); } - + layer->bugged = 0; } @@ -538,7 +538,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, if (!layer->img) { layer->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, img_w, img_h, 1); } - + if (layer->banner_img && !layer->banner_patched) { switch_img_fill(layer->canvas->img, layer->x_pos + layer->geometry.border, layer->y_pos + layer->geometry.border, layer->screen_w, layer->screen_h, &layer->canvas->letterbox_bgcolor); switch_img_fit(&layer->banner_img, layer->screen_w, layer->screen_h, SWITCH_FIT_SIZE); @@ -556,13 +556,13 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, if (layer->geometry.border) { switch_img_fill(IMG, x_pos, y_pos, img_w, img_h, &layer->canvas->border_color); } - + img_w -= (layer->geometry.border * 2); img_h -= (layer->geometry.border * 2); switch_img_scale(img, &layer->img, img_w, img_h); - if (layer->img) { + if (layer->img) { switch_img_patch(IMG, layer->img, x_pos + layer->geometry.border, y_pos + layer->geometry.border); } @@ -586,7 +586,7 @@ void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, } } - + layer->last_img_addr = img_addr; } else { @@ -644,7 +644,7 @@ mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member) conference_video_release_canvas(&canvas); } } - + return layer; } @@ -660,7 +660,7 @@ void conference_video_release_layer(mcu_layer_t **layer) switch_mutex_unlock(canvas->mutex); conference_video_release_canvas(&canvas); - + *layer = NULL; } @@ -686,7 +686,7 @@ void conference_video_release_canvas(mcu_canvas_t **canvasP) mcu_canvas_t *canvas = NULL; switch_assert(canvasP); - + canvas = *canvasP; if (!canvas) return; @@ -708,7 +708,7 @@ void conference_video_detach_video_layer(conference_member_t *member) mcu_canvas_t *canvas = NULL; if (member->canvas_id < 0) return; - + if (!(canvas = conference_video_get_canvas_locked(member))) { return; } @@ -718,7 +718,7 @@ void conference_video_detach_video_layer(conference_member_t *member) if (member->video_layer_id < 0) { goto end; } - + layer = &canvas->layers[member->video_layer_id]; if (layer->geometry.audio_position) { @@ -745,7 +745,7 @@ void conference_video_detach_video_layer(conference_member_t *member) if (conference_utils_test_flag(member->conference, CFLAG_JSON_STATUS)) { conference_member_update_status_field(member); } - + if (canvas->bgimg) { conference_video_set_canvas_bgimg(canvas, NULL); } @@ -754,7 +754,7 @@ void conference_video_detach_video_layer(conference_member_t *member) switch_mutex_unlock(canvas->mutex); conference_video_release_canvas(&canvas); - + } @@ -1125,7 +1125,7 @@ void conference_video_init_canvas_layers(conference_obj_t *conference, mcu_canva layer->idx = i; layer->refresh = 1; - + layer->screen_w = (uint32_t)(canvas->img->d_w * layer->geometry.scale / VIDEO_LAYOUT_SCALE); layer->screen_h = (uint32_t)(canvas->img->d_h * layer->geometry.hscale / VIDEO_LAYOUT_SCALE); @@ -1177,7 +1177,7 @@ void conference_video_init_canvas_layers(conference_obj_t *conference, mcu_canva if (conference->video_canvas_bgimg && !vlayout->bgimg) { conference_video_set_canvas_bgimg(canvas, conference->video_canvas_bgimg); } - + switch_mutex_unlock(canvas->mutex); switch_thread_rwlock_unlock(canvas->video_rwlock); @@ -1196,7 +1196,7 @@ switch_status_t conference_video_set_canvas_bgimg(mcu_canvas_t *canvas, const ch } else { scaled = 1; } - + if (!canvas->bgimg) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open image for bgimg\n"); return SWITCH_STATUS_FALSE; @@ -1434,7 +1434,7 @@ video_layout_t *conference_video_find_best_layout(conference_obj_t *conference, for (vlnode = lg->layouts; vlnode; vlnode = vlnode->next) { int x, file_layers = 0, member_count = (int)count - file_count, total = vlnode->vlayout->layers; - + for (x = total; x >= 0; x--) { if (vlnode->vlayout->images[x].fileonly) { file_layers++; @@ -1462,7 +1462,7 @@ video_layout_t *conference_video_get_layout(conference_obj_t *conference, const } else { vlayout = switch_core_hash_find(conference->layout_hash, video_layout_name); } - + return vlayout; } @@ -1473,9 +1473,9 @@ void conference_video_vmute_snap(conference_member_t *member, switch_bool_t clea if (member->canvas_id > -1 && member->video_layer_id > -1) { mcu_layer_t *layer = NULL; mcu_canvas_t *canvas = NULL; - + if ((canvas = conference_video_get_canvas_locked(member))) { - + switch_mutex_lock(canvas->mutex); layer = &canvas->layers[member->video_layer_id]; switch_img_free(&layer->mute_img); @@ -1522,7 +1522,7 @@ void conference_video_canvas_set_fnode_layer(mcu_canvas_t *canvas, conference_fi if (canvas->layout_floor_id > -1) { idx = canvas->layout_floor_id; xlayer = &canvas->layers[idx]; - + if (xlayer->fnode && xlayer->fnode != fnode) { idx = -1; } @@ -1615,7 +1615,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ } else { pop_status = switch_frame_buffer_pop(member->fb, &pop); } - + if (pop_status == SWITCH_STATUS_SUCCESS) { mcu_layer_t *layer = NULL; mcu_canvas_t *canvas = NULL; @@ -1623,14 +1623,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ if (!pop) { break; } - + if (loops == 0 || loops == 50) { switch_core_media_gen_key_frame(member->session); switch_core_session_request_video_refresh(member->session); } loops++; - + if ((switch_size_t)pop != 1) { frame = (switch_frame_t *) pop; if (switch_test_flag(frame, SFF_ENCODED)) { @@ -1641,23 +1641,23 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ if (!switch_test_flag(frame, SFF_ENCODED) || frame->m) { switch_time_t now = switch_time_now(); - + if (last) { int delta = (int)(now - last); if (delta > member->conference->video_fps.ms * 5000) { - switch_core_session_request_video_refresh(member->session); + switch_core_session_request_video_refresh(member->session); } } last = now; - + } switch_frame_buffer_free(member->fb, &frame); } - canvas = NULL; + canvas = NULL; layer = NULL; patched = 0; @@ -1774,7 +1774,7 @@ void conference_video_check_recording(conference_obj_t *conference, mcu_canvas_t if (!imember->rec) { continue; } - + if (!conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS) && canvas && imember->canvas_id != canvas->canvas_id) { continue; } @@ -1805,10 +1805,10 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo canvas = conference_video_get_canvas_locked(member); if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS) && - (!switch_channel_test_flag(member->channel, CF_VIDEO_READY) || + (!switch_channel_test_flag(member->channel, CF_VIDEO_READY) || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE))) { - + if (canvas) { conference_video_release_canvas(&canvas); } @@ -1821,7 +1821,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo member->avatar_patched = 0; - if (!force && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && + if (!force && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) { conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO); switch_core_session_request_video_refresh(member->session); @@ -1888,7 +1888,7 @@ void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t * mcu_layer_t *layer = &canvas->layers[fnode->layer_id]; switch_frame_t file_frame = { 0 }; switch_status_t status = switch_core_file_read_video(&fnode->fh, &file_frame, SVR_FLUSH); - + if (status == SWITCH_STATUS_SUCCESS) { switch_img_free(&layer->cur_img); layer->cur_img = file_frame.img; @@ -1904,7 +1904,7 @@ void conference_video_patch_fnode(mcu_canvas_t *canvas, conference_file_node_t * void conference_video_fnode_check(conference_file_node_t *fnode, int canvas_id) { mcu_canvas_t *canvas = NULL; - + if (switch_core_file_has_video(&fnode->fh, SWITCH_TRUE) && switch_core_file_read_video(&fnode->fh, NULL, SVR_CHECK) == SWITCH_STATUS_BREAK) { int full_screen = 0; char *res_id = NULL; @@ -1915,7 +1915,7 @@ void conference_video_fnode_check(conference_file_node_t *fnode, int canvas_id) } fnode->canvas_id = canvas_id; } - + canvas = fnode->conference->canvases[fnode->canvas_id]; if (fnode->fh.params && fnode->conference->canvas_count == 1) { full_screen = switch_true(switch_event_get_header(fnode->fh.params, "full-screen")); @@ -1969,7 +1969,7 @@ switch_status_t conference_video_find_layer(conference_obj_t *conference, mcu_ca if (!layer && (canvas->layers_used < canvas->total_layers || (avatar_layers && !member->avatar_png_img) || conference_utils_member_test_flag(member, MFLAG_MOD)) && - (member->avatar_png_img || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && + (member->avatar_png_img || (switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE))) { /* find an empty layer */ @@ -2050,7 +2050,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t //if (member->avatar_png_img && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && conference_utils_member_test_flag(member, MFLAG_ACK_VIDEO)) { // switch_img_free(&member->avatar_png_img); //} - + if (switch_channel_test_flag(member->channel, CF_VIDEO_READY)) { do { if (switch_queue_trypop(member->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { @@ -2063,13 +2063,13 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t size = switch_queue_size(member->video_queue); } while(size > 0); - if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && - member->video_layer_id > -1 && + if (conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && + member->video_layer_id > -1 && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE ) { switch_vid_params_t vid_params = { 0 }; - + switch_core_media_get_vid_params(member->session, &vid_params); if (!vid_params.fps) { @@ -2081,7 +2081,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t if ((member->good_img % (int)(vid_params.fps * 10)) == 0) { conference_video_reset_video_bitrate_counters(member); } - + if (member->auto_avatar && member->good_img > vid_params.fps * 3) { conference_video_check_flush(member, SWITCH_TRUE); } @@ -2123,7 +2123,7 @@ void conference_video_set_incoming_bitrate(conference_member_t *member, int kps, if (!force && kps < member->managed_kps && member->conference->auto_kps_debounce) { member->auto_kps_debounce_ticks = member->conference->auto_kps_debounce / member->conference->video_fps.ms; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s setting bitrate debounce timer to %dms\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s setting bitrate debounce timer to %dms\n", switch_channel_get_name(member->channel), member->conference->auto_kps_debounce); member->managed_kps = kps; member->managed_kps_set = 0; @@ -2133,8 +2133,8 @@ void conference_video_set_incoming_bitrate(conference_member_t *member, int kps, msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ; msg.numeric_arg = kps * 1024; msg.from = __FILE__; - - switch_core_session_receive_message(member->session, &msg); + + switch_core_session_receive_message(member->session, &msg); member->managed_kps_set = 1; member->managed_kps = kps; @@ -2167,7 +2167,7 @@ void conference_video_set_max_incoming_bitrate(conference_obj_t *conference, int conference_video_set_max_incoming_bitrate_member(imember, kps); } } - switch_mutex_unlock(conference->member_mutex); + switch_mutex_unlock(conference->member_mutex); } void conference_video_set_absolute_incoming_bitrate(conference_obj_t *conference, int kps) @@ -2180,7 +2180,7 @@ void conference_video_set_absolute_incoming_bitrate(conference_obj_t *conference conference_video_set_absolute_incoming_bitrate_member(imember, kps); } } - switch_mutex_unlock(conference->member_mutex); + switch_mutex_unlock(conference->member_mutex); } void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_t *layer) @@ -2189,8 +2189,8 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ int kps = 0, kps_in = 0; int max = 0; int min_layer = 0, min = 0; - - if (!conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) || + + if (!conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) || switch_channel_test_flag(member->channel, CF_VIDEO_BITRATE_UNMANAGABLE)) { return; } @@ -2212,7 +2212,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ } return; } - + if (vid_params.width != member->vid_params.width || vid_params.height != member->vid_params.height) { switch_core_session_request_video_refresh(member->session); conference_video_clear_managed_kps(member); @@ -2224,7 +2224,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ return; } - if ((kps_in = switch_calc_bitrate(vid_params.width, vid_params.height, + if ((kps_in = switch_calc_bitrate(vid_params.width, vid_params.height, member->conference->video_quality, (int)(member->conference->video_fps.fps))) < 512) { kps_in = 512; } @@ -2237,9 +2237,9 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ min_layer = kps / 2; min = kps_in / 2; - + if (min_layer > min) min = min_layer; - + if (member->conference->max_bw_in) { max = member->conference->max_bw_in; } else { @@ -2294,7 +2294,7 @@ static void wait_for_canvas(mcu_canvas_t *canvas) for (i = 0; i < canvas->total_layers; i++) { mcu_layer_t *layer = &canvas->layers[i]; - + if (layer->need_patch) { if (layer->member_id && layer->member && conference_utils_member_test_flag(layer->member, MFLAG_RUNNING) && layer->member->fb) { switch_frame_buffer_trypush(layer->member->fb, (void *) 1); @@ -2323,18 +2323,18 @@ static void personal_attach(mcu_layer_t *layer, conference_member_t *member) layer->avatar_patched = 0; switch_img_free(&layer->banner_img); switch_img_free(&layer->logo_img); - + if (layer->geometry.audio_position) { conference_api_sub_position(member, NULL, layer->geometry.audio_position); } - + if (member->channel) { var = NULL; if (member->video_banner_text || (var = switch_channel_get_variable_dup(member->channel, "video_banner_text", SWITCH_FALSE, -1))) { conference_video_layer_set_banner(member, layer, var); } - + var = NULL; if (member->video_logo || (var = switch_channel_get_variable_dup(member->channel, "video_logo_path", SWITCH_FALSE, -1))) { @@ -2342,7 +2342,7 @@ static void personal_attach(mcu_layer_t *layer, conference_member_t *member) } } } - + layer->member_id = member->id; } @@ -2376,7 +2376,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr canvas->video_layout_group = conference->video_layout_group; packet = switch_core_alloc(conference->pool, SWITCH_RTP_MAX_BUF_LEN); - + while (conference_globals.running && !conference_utils_test_flag(conference, CFLAG_DESTRUCT) && conference_utils_test_flag(conference, CFLAG_VIDEO_MUXING)) { switch_bool_t need_refresh = SWITCH_FALSE, send_keyframe = SWITCH_FALSE, need_reset = SWITCH_FALSE; switch_time_t now; @@ -2429,14 +2429,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr int no_muted = conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS); int no_av = conference_utils_test_flag(imember->conference, CFLAG_VIDEO_REQUIRED_FOR_CANVAS); int seen = conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN); - - if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && + + if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!no_av || (no_av && !imember->avatar_png_img)) && imember->canvas_id == canvas->canvas_id && imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && imember->video_media_flow != SWITCH_MEDIA_FLOW_INACTIVE) { video_count++; } - + } @@ -2470,7 +2470,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (members_with_avatar != conference->members_with_avatar) { count_changed = 1; } - + if (conference_utils_test_flag(conference, CFLAG_REFRESH_LAYOUT)) { count_changed = 1; conference_utils_clear_flag(conference, CFLAG_REFRESH_LAYOUT); @@ -2490,7 +2490,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (count_changed && !personal) { layout_group_t *lg = NULL; video_layout_t *vlayout = NULL; - + if (canvas->video_layout_group && (lg = switch_core_hash_find(conference->layout_group_hash, canvas->video_layout_group))) { if ((vlayout = conference_video_find_best_layout(conference, lg, canvas->video_count, file_count)) && vlayout != canvas->vlayout) { switch_mutex_lock(conference->member_mutex); @@ -2618,17 +2618,17 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr continue; } - if (conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) && + if (conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) && !conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN) && imember->video_layer_id > -1) { conference_video_detach_video_layer(imember); switch_img_free(&imember->video_mute_img); - + if (imember->id == imember->conference->video_floor_holder) { conference_video_set_floor_holder(conference, NULL, SWITCH_FALSE); } else if (imember->id == imember->conference->last_video_floor_holder) { conference->last_video_floor_holder = 0; } - + switch_core_session_rwunlock(imember->session); continue; } @@ -2707,15 +2707,15 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } if (!layer->mute_patched) { - + if (!imember->video_mute_img) { conference_video_vmute_snap(imember, SWITCH_FALSE); } - + if (imember->video_mute_img || layer->mute_img) { conference_video_clear_layer(layer); - - if (!layer->mute_img) { + + if (!layer->mute_img) { if (imember->video_mute_img) { //layer->mute_img = switch_img_read_png(imember->video_mute_png, SWITCH_IMG_FMT_I420); switch_img_copy(imember->video_mute_img, &layer->mute_img); @@ -2768,7 +2768,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr layout_group_t *lg = NULL; video_layout_t *vlayout = NULL; conference_member_t *omember; - + if (video_key_freq && (now - last_key_time) > video_key_freq) { send_keyframe = SWITCH_TRUE; last_key_time = now; @@ -2777,7 +2777,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_mutex_lock(conference->member_mutex); for (imember = conference->members; imember; imember = imember->next) { - + if (!imember->rec && (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS)) { @@ -2797,12 +2797,12 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr conference_video_init_canvas_layers(conference, imember->canvas, conference->new_personal_vlayout); layout_applied++; } - + if (imember->channel && switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) { switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ); send_keyframe = SWITCH_TRUE; } - + if (count_changed) { int total = last_video_count; int kps; @@ -2812,12 +2812,12 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr total += conference->members_with_avatar; } - if (total > 0 && - (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || - conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN)) && + if (total > 0 && + (!conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || + conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN)) && imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) { - + total--; } @@ -2826,21 +2826,21 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (conference->members_with_video == 1 && file_count) { total = 0; } - + if (canvas->video_layout_group && (lg = switch_core_hash_find(conference->layout_group_hash, canvas->video_layout_group))) { if ((vlayout = conference_video_find_best_layout(conference, lg, total + file_count, file_count))) { conference_video_init_canvas_layers(conference, imember->canvas, vlayout); } } - - if (imember->channel && !switch_channel_test_flag(imember->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && + + if (imember->channel && !switch_channel_test_flag(imember->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && conference_utils_test_flag(conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE)) { switch_core_media_get_vid_params(imember->session, &vid_params); kps = switch_calc_bitrate(vid_params.width, vid_params.height, conference->video_quality, (int)(imember->conference->video_fps.fps)); conference_video_set_incoming_bitrate(imember, kps, SWITCH_TRUE); } } - + if (imember->session && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) { conference_video_pop_next_image(imember, &imember->pcanvas_img); } @@ -2856,10 +2856,10 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } switch_mutex_lock(conference->mutex); - + if (check_async_file && conference->async_fnode) { switch_status_t st = switch_core_file_read_video(&conference->async_fnode->fh, &file_frame, SVR_FLUSH); - + if (st == SWITCH_STATUS_SUCCESS) { if ((async_file_img = file_frame.img)) { switch_img_free(&file_imgs[j]); @@ -2887,8 +2887,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr for (imember = conference->members; imember; imember = imember->next) { int i = 0; mcu_layer_t *floor_layer = NULL; - - if (!imember->rec && + + if (!imember->rec && (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) || !imember->canvas || (switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(imember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) || @@ -2907,19 +2907,19 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (!file_count && imember->canvas->layout_floor_id > -1 && imember->conference->video_floor_holder && imember->id != imember->conference->video_floor_holder) { - + if ((omember = conference_member_get(imember->conference, imember->conference->video_floor_holder))) { if (conference->members_with_video + conference->members_with_avatar == 1 || imember != omember) { layer = &imember->canvas->layers[imember->canvas->layout_floor_id]; floor_layer = layer; layer = NULL; } - + switch_thread_rwlock_unlock(omember->rwlock); } } - + for (omember = conference->members; omember; omember = omember->next) { mcu_layer_t *layer = NULL; switch_image_t *use_img = NULL; @@ -2928,7 +2928,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) { continue; } - + if (conference->members_with_video + conference->members_with_avatar != 1 && imember == omember) { continue; } @@ -2936,7 +2936,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (file_count && (conference->members_with_video + conference->members_with_avatar == 1)) { floor_layer = NULL; } - + if (!file_count && floor_layer && omember->id == conference->video_floor_holder) { layer = floor_layer; } else { @@ -2945,7 +2945,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr i++; } } - + if (i < imember->canvas->total_layers) { layer = &imember->canvas->layers[i++]; } @@ -2960,11 +2960,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } use_img = omember->pcanvas_img; - + if (files_playing && layer && layer == &imember->canvas->layers[imember->canvas->layout_floor_id]) { use_img = NULL; } - + if (layer) { if (use_img && !omember->avatar_png_img) { @@ -3010,7 +3010,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr conference_video_scale_and_patch(layer, img, SWITCH_FALSE); } } - + if (imember->session) { switch_core_session_rwunlock(imember->session); } @@ -3025,7 +3025,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr for (imember = conference->members; imember; imember = imember->next) { switch_frame_t *dupframe; - if (!imember->rec && + if (!imember->rec && (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) || !imember->canvas || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS)) { continue; @@ -3040,7 +3040,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } write_frame.img = imember->canvas->img; - + if (imember->rec) { switch_core_file_write_video(&imember->rec->fh, &write_frame); } else { @@ -3066,7 +3066,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_mutex_unlock(conference->member_mutex); } else { - + if (conference->async_fnode && (conference->async_fnode->canvas_id == canvas->canvas_id || conference->async_fnode->canvas_id == -1)) { if (conference->async_fnode->layer_id > -1) { conference_video_patch_fnode(canvas, conference->async_fnode); @@ -3170,11 +3170,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } else if (file_img) { switch_img_free(&file_img); } - + write_frame.img = write_img; wait_for_canvas(canvas); - + if (canvas->recording) { conference_video_check_recording(conference, canvas, &write_frame); } @@ -3196,14 +3196,14 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr timestamp, need_refresh, send_keyframe, need_reset); if (canvas->video_write_bandwidth) { - switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, + switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL); canvas->video_write_bandwidth = 0; } } } - + switch_mutex_lock(conference->member_mutex); for (imember = conference->members; imember; imember = imember->next) { switch_frame_t *dupframe; @@ -3218,7 +3218,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; } - + if (need_refresh) { switch_core_session_request_video_refresh(imember->session); } @@ -3545,7 +3545,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_ conference_video_write_canvas_image_to_codec_group(conference, canvas, write_codecs[i], i, timestamp, need_refresh, send_keyframe, need_reset); if (canvas->video_write_bandwidth) { - switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, + switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL); canvas->video_write_bandwidth = 0; } @@ -3562,7 +3562,7 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_ continue; } - + if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; @@ -3771,7 +3771,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_ } conference_video_release_canvas(&canvas); } - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding video floor %s\n", switch_channel_get_name(member->channel)); @@ -3916,15 +3916,15 @@ void conference_video_write_frame(conference_obj_t *conference, conference_membe if (want_refresh) { for (imember = conference->members; imember; imember = imember->next) { switch_core_session_t *isession = imember->session; - + if (!isession || switch_core_session_read_lock(isession) != SWITCH_STATUS_SUCCESS) { continue; } - + if (switch_channel_test_flag(imember->channel, CF_VIDEO_READY) ) { - switch_core_session_request_video_refresh(imember->session); + switch_core_session_request_video_refresh(imember->session); } - + switch_core_session_rwunlock(isession); } } @@ -3969,7 +3969,7 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, if (conference_utils_test_flag(member->conference, CFLAG_VIDEO_MUXING)) { switch_image_t *img_copy = NULL; - if (frame->img && (member->video_layer_id > -1 || member->canvas) && + if (frame->img && (member->video_layer_id > -1 || member->canvas) && conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) && switch_queue_size(member->video_queue) < member->conference->video_fps.fps * 2 && !member->conference->playing_video_file) { @@ -3992,7 +3992,7 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session, } else { switch_img_copy(frame->img, &img_copy); } - + if (switch_queue_trypush(member->video_queue, img_copy) != SWITCH_STATUS_SUCCESS) { switch_img_free(&img_copy); } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b21bd40cd7..866fadef27 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -258,16 +258,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob const char *caller_id_name = switch_channel_get_variable(imember->channel, "caller_id_name"); unsigned char CR[3] = TEXT_UNICODE_LINEFEED; - + switch_mutex_lock(imember->text_mutex); framedatalen = strlen(imember->text_framedata) + strlen(caller_id_name) + 6; switch_zmalloc(framedata, framedatalen); - + switch_snprintf(framedata, framedatalen, "%s::\n%s", caller_id_name, imember->text_framedata); memcpy(framedata + strlen(framedata), CR, sizeof(CR)); - + frame.data = framedata; frame.datalen = framedatalen; @@ -277,9 +277,9 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob switch_core_session_write_text_frame(omember->session, &frame, 0, 0); } } - + free(framedata); - + imember->text_framedata[0] = '\0'; switch_mutex_unlock(imember->text_mutex); @@ -295,7 +295,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob if (conference_utils_member_test_flag(imember, MFLAG_RUNNING) && imember->session) { switch_channel_t *channel = switch_core_session_get_channel(imember->session); switch_media_flow_t video_media_flow; - + if ((!floor_holder || (imember->score_iir > SCORE_IIR_SPEAKING_MAX && (floor_holder->score_iir < SCORE_IIR_SPEAKING_MIN)))) {// && //(!conference_utils_test_flag(conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) { floor_holder = imember; @@ -316,18 +316,18 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob } } - if (switch_channel_ready(channel) && - switch_channel_test_flag(channel, CF_VIDEO_READY) && - imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && - !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && - (!conference_utils_test_flag(conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || + if (switch_channel_ready(channel) && + switch_channel_test_flag(channel, CF_VIDEO_READY) && + imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && + !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && + (!conference_utils_test_flag(conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) || conference_utils_member_test_flag(imember, MFLAG_CAN_BE_SEEN))) { members_with_video++; } - if (switch_channel_ready(channel) && - switch_channel_test_flag(channel, CF_VIDEO_READY) && - imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && + if (switch_channel_ready(channel) && + switch_channel_test_flag(channel, CF_VIDEO_READY) && + imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY && !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN)) { members_seeing_video++; } @@ -455,7 +455,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob } } else if (conference->fnode->type == NODE_TYPE_FILE) { switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len); - + if (conference->fnode->fh.vol) { switch_change_sln_volume_granular((void *)file_frame, (uint32_t)file_sample_len * conference->fnode->fh.channels, conference->fnode->fh.vol); @@ -470,13 +470,13 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob if (--conference->fnode->loops < 0) { conference->fnode->loops = -1; } - + if (conference->fnode->loops) { uint32_t pos = 0; switch_core_file_seek(&conference->fnode->fh, &pos, 0, SEEK_SET); } } - + if (!conference->fnode->loops) { conference->fnode->done++; } @@ -501,13 +501,13 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob if (--conference->async_fnode->loops < 0) { conference->async_fnode->loops = -1; } - + if (conference->async_fnode->loops) { uint32_t pos = 0; switch_core_file_seek(&conference->async_fnode->fh, &pos, 0, SEEK_SET); } } - + if (!conference->async_fnode->loops) { conference->async_fnode->done++; } @@ -1814,17 +1814,17 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, memcpy(tmp, member->text_framedata, member->text_framesize); switch_assert(tmp); - + member->text_framesize = inuse + 1024; - + free(member->text_framedata); member->text_framedata = tmp; } bytes = switch_buffer_read(member->text_buffer, member->text_framedata, inuse); - *(member->text_framedata + bytes) = '\0'; - + *(member->text_framedata + bytes) = '\0'; + /* for(p = member->text_framedata; p && *p; p++) { if (*p > 32 && *p < 127) { @@ -1837,7 +1837,7 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, } */ } - + switch_mutex_unlock(member->text_mutex); return SWITCH_STATUS_SUCCESS; @@ -2986,7 +2986,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "video-kps-debounce must be 0 or higher\n"); } - + } else if (!strcasecmp(var, "video-mode") && !zstr(val)) { if (!strcasecmp(val, "passthrough")) { conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH; @@ -3129,7 +3129,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co if (!video_border_color) { video_border_color = "#000000"; } - + if (!video_super_canvas_bgcolor) { video_super_canvas_bgcolor = "#068df3"; } @@ -3146,7 +3146,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co conference->no_video_avatar = switch_core_strdup(conference->pool, no_video_avatar); } - + conference->video_canvas_bgcolor = switch_core_strdup(conference->pool, video_canvas_bgcolor); conference->video_border_color = switch_core_strdup(conference->pool, video_border_color); conference->video_super_canvas_bgcolor = switch_core_strdup(conference->pool, video_super_canvas_bgcolor); @@ -3529,7 +3529,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co switch_live_array_set_command_handler(conference->la, conference_event_la_command_handler); } - + end: switch_mutex_unlock(conference_globals.hash_mutex); diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 4499fe4cea..72996d52b9 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Rupa Schomaker * Yossi Neiman * Seven Du @@ -45,7 +45,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_curl_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_curl, mod_curl_load, mod_curl_shutdown, NULL); @@ -273,14 +273,14 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data) char *data = NULL; char tmp[32], *f = NULL; switch_curl_slist_t *header = http_data->headers; - + if(!top || !headers) { cJSON_Delete(headers); - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to alloc memory for cJSON structures.\n"); goto curl_json_output_end; } - + switch_snprintf(tmp, sizeof(tmp), "%ld", http_data->http_response_code); cJSON_AddItemToObject(top, "status_code", cJSON_CreateString(tmp)); if (http_data->http_response) { @@ -334,7 +334,7 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data) f = cJSON_PrintUnformatted(top); data = switch_core_strdup(pool, f); switch_safe_free(f); - + curl_json_output_end: cJSON_Delete(top); /* should free up all children */ return data; @@ -344,7 +344,7 @@ static size_t http_sendfile_response_callback(void *ptr, size_t size, size_t nme { register unsigned int realsize = (unsigned int) (size * nmemb); http_sendfile_data_t *http_data = data; - + if(http_data->sendfile_response_count + realsize < HTTP_SENDFILE_RESPONSE_SIZE) { // I'm not sure why we need the (realsize+1) here, but it truncates the data by 1 char if I don't do this @@ -356,7 +356,7 @@ static size_t http_sendfile_response_callback(void *ptr, size_t size, size_t nme switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Response page is more than %d bytes long, truncating.\n", HTTP_SENDFILE_RESPONSE_SIZE); realsize = 0; } - + return realsize; } @@ -365,53 +365,53 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) { uint8_t count; http_data->curl_handle = curl_easy_init(); - + if (!strncasecmp(http_data->url, "https", 5)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", http_data->url); curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYHOST, 0); } - - /* From the docs: - * Optionally, you can provide data to POST using the CURLOPT_READFUNCTION and CURLOPT_READDATA + + /* From the docs: + * Optionally, you can provide data to POST using the CURLOPT_READFUNCTION and CURLOPT_READDATA * options but then you must make sure to not set CURLOPT_POSTFIELDS to anything but NULL * curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data)); * curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data); */ - + // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data); - + curl_easy_setopt(http_data->curl_handle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(http_data->curl_handle, CURLOPT_MAXREDIRS, 15); curl_easy_setopt(http_data->curl_handle, CURLOPT_URL, http_data->url); curl_easy_setopt(http_data->curl_handle, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(http_data->curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0"); - + http_data->sendfile_response = switch_core_alloc(http_data->pool, sizeof(char) * HTTP_SENDFILE_RESPONSE_SIZE); memset(http_data->sendfile_response, 0, sizeof(char) * HTTP_SENDFILE_RESPONSE_SIZE); - + // Set the function where we will copy out the response body data to curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEFUNCTION, http_sendfile_response_callback); curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEDATA, (void *) http_data); - - /* Add the file to upload as a POST form field */ + + /* Add the file to upload as a POST form field */ curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, http_data->filename_element_name, CURLFORM_FILE, http_data->filename_element, CURLFORM_END); - + if(!zstr(http_data->extrapost_elements)) { // Now to parse out the individual post element/value pairs char *argv[64] = { 0 }; // Probably don't need 64 but eh does it really use that much memory? uint32_t argc = 0; char *temp_extrapost = switch_core_strdup(http_data->pool, http_data->extrapost_elements); - + argc = switch_separate_string(temp_extrapost, '&', argv, (sizeof(argv) / sizeof(argv[0]))); - + for(count = 0; count < argc; count++) { char *argv2[4] = { 0 }; uint32_t argc2 = switch_separate_string(argv[count], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))); - + if(argc2 == 2) { switch_url_decode(argv2[0]); switch_url_decode(argv2[1]); @@ -419,19 +419,19 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data) } } } - - /* Fill in the submit field too, even if this isn't really needed */ + + /* Fill in the submit field too, even if this isn't really needed */ curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "or_die", CURLFORM_END); - - /* what URL that receives this POST */ + + /* what URL that receives this POST */ curl_easy_setopt(http_data->curl_handle, CURLOPT_HTTPPOST, http_data->formpost); - + // This part actually fires off the curl, captures the HTTP response code, and then frees up the handle. curl_easy_perform(http_data->curl_handle); curl_easy_getinfo(http_data->curl_handle, CURLINFO_RESPONSE_CODE, &http_data->http_response_code); - + curl_easy_cleanup(http_data->curl_handle); - + // Clean up the form data from POST curl_formfree(http_data->formpost); } @@ -454,14 +454,14 @@ static switch_status_t http_sendfile_test_file_open(http_sendfile_data_t *http_d else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create event to notify of failure to open file %s\n", http_data->filename_element); } - + if((switch_test_flag(http_data, CSO_STREAM) || switch_test_flag(http_data, CSO_NONE)) && http_data->stream) http_data->stream->write_function(http_data->stream, "-Err Unable to open file %s\n", http_data->filename_element); - + if(switch_test_flag(http_data, CSO_NONE) && !http_data->stream) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "curl_sendfile: Unable to open file %s\n", http_data->filename_element); } - + return retval; } @@ -474,31 +474,31 @@ static void http_sendfile_success_report(http_sendfile_data_t *http_data, switch char *code_as_string = switch_core_alloc(http_data->pool, 16); memset(code_as_string, 0, 16); switch_snprintf(code_as_string, 16, "%d", http_data->http_response_code); - + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Command-Execution-Identifier", http_data->identifier_str); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Filename", http_data->filename_element); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File-Access", "Success"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "REST-HTTP-Code", code_as_string); switch_event_add_body(event, "%s", http_data->sendfile_response); - + switch_event_fire(&event); switch_event_destroy(&event); } else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create a event to report on success of curl_sendfile.\n"); } - + if((switch_test_flag(http_data, CSO_STREAM) || switch_test_flag(http_data, CSO_NONE) || switch_test_flag(http_data, CSO_EVENT)) && http_data->stream) { if(http_data->http_response_code == 200) http_data->stream->write_function(http_data->stream, "+200 Ok\n"); else http_data->stream->write_function(http_data->stream, "-%d Err\n", http_data->http_response_code); - + if(http_data->sendfile_response_count && switch_test_flag(http_data, CSO_STREAM)) http_data->stream->write_function(http_data->stream, "%s\n", http_data->sendfile_response); } - + if(switch_test_flag(http_data, CSO_NONE) && !http_data->stream) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Sending of file %s to url %s resulted with code %lu\n", http_data->filename_element, http_data->url, http_data->http_response_code); } @@ -512,31 +512,31 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) http_sendfile_data_t *http_data = NULL; switch_memory_pool_t *pool = switch_core_session_get_pool(session); switch_channel_t *channel = switch_core_session_get_channel(session); - + assert(channel != NULL); - + http_data = switch_core_alloc(pool, sizeof(http_sendfile_data_t)); memset(http_data, 0, sizeof(http_sendfile_data_t)); - + http_data->pool = pool; - + // Either the parameters are provided on the data="" or else they are provided as chanvars. No mixing & matching if(!zstr(data)) { http_data->mydata = switch_core_strdup(http_data->pool, data); - - if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) + + if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { uint8_t i = 0; - + if (argc < 2 || argc > 5) goto http_sendfile_app_usage; - + http_data->url = switch_core_strdup(http_data->pool, argv[i++]); - + switch_url_decode(argv[i]); argc2 = switch_separate_string(argv[i++], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))); - + if(argc2 == 2) { http_data->filename_element_name = switch_core_strdup(pool, argv2[0]); @@ -544,11 +544,11 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) } else goto http_sendfile_app_usage; - + if(argc > 2) { http_data->extrapost_elements = switch_core_strdup(pool, argv[i++]); - + if(argc > 3) { if(!strncasecmp(argv[i++], "event", 5)) @@ -556,7 +556,7 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) switch_set_flag(http_data, CSO_EVENT); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting output to event handler.\n"); } - + if(argc > 4) { if(strncasecmp(argv[i], "uuid", 4)) @@ -572,16 +572,16 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) { char *send_output = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_report", SWITCH_TRUE, -1); char *identifier = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_identifier", SWITCH_TRUE, -1); - + http_data->url = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_url", SWITCH_TRUE, -1); http_data->filename_element_name = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_filename_element", SWITCH_TRUE, -1); http_data->filename_element = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_filename", SWITCH_TRUE, -1); http_data->extrapost_elements = (char *) switch_channel_get_variable_dup(channel, "curl_sendfile_extrapost", SWITCH_TRUE, -1); - - + + if(zstr(http_data->url) || zstr(http_data->filename_element) || zstr(http_data->filename_element_name)) goto http_sendfile_app_usage; - + if(!zstr(send_output)) { if(!strncasecmp(send_output, "event", 5)) @@ -599,7 +599,7 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) switch_set_flag(http_data, CSO_NONE); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No parameter specified for curl_sendfile_report. Setting default of 'none'.\n"); } - + if(!zstr(identifier)) { if(!strncasecmp(identifier, "uuid", 4)) @@ -608,33 +608,33 @@ SWITCH_STANDARD_APP(http_sendfile_app_function) http_data->identifier_str = identifier; } } - + switch_url_decode(http_data->filename_element_name); switch_url_decode(http_data->filename_element); - + // We need to check the file now... if(http_sendfile_test_file_open(http_data, event) != SWITCH_STATUS_SUCCESS) goto http_sendfile_app_done; - + switch_file_close(http_data->file_handle); - + switch_url_decode(http_data->url); - + http_sendfile_initialize_curl(http_data); - + http_sendfile_success_report(http_data, event); - + goto http_sendfile_app_done; - + http_sendfile_app_usage: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure: Usage: \nOr you can set chanvars curl_senfile_url, curl_sendfile_filename_element, curl_sendfile_filename, curl_sendfile_extrapost\n", HTTP_SENDFILE_APP_SYNTAX); - + http_sendfile_app_done: if (http_data->headers) { switch_curl_slist_free_all(http_data->headers); } - + return; } @@ -648,7 +648,7 @@ SWITCH_STANDARD_API(http_sendfile_function) http_sendfile_data_t *http_data = NULL; switch_memory_pool_t *pool = NULL; switch_event_t *event = NULL; - + if(zstr(cmd)) { status = SWITCH_STATUS_SUCCESS; @@ -664,31 +664,31 @@ SWITCH_STANDARD_API(http_sendfile_function) switch_core_new_memory_pool(&pool); new_memory_pool = SWITCH_TRUE; // So we can properly destroy the memory pool } - + http_data = switch_core_alloc(pool, sizeof(http_sendfile_data_t)); memset(http_data, 0, sizeof(http_sendfile_data_t)); - + http_data->mydata = switch_core_strdup(pool, cmd); http_data->stream = stream; http_data->pool = pool; - - // stream->write_function(stream,"\ncmd is %s\nmydata is %s\n", cmd, http_data->mydata); - - if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) + + // stream->write_function(stream,"\ncmd is %s\nmydata is %s\n", cmd, http_data->mydata); + + if ((argc = switch_separate_string(http_data->mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { uint8_t i = 0; - + if (argc < 2 || argc > 5) { status = SWITCH_STATUS_SUCCESS; goto http_sendfile_usage; } - + http_data->url = switch_core_strdup(pool, argv[i++]); - + switch_url_decode(argv[i]); argc2 = switch_separate_string(argv[i++], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))); - + if(argc2 == 2) { http_data->filename_element_name = switch_core_strdup(pool, argv2[0]); @@ -696,14 +696,14 @@ SWITCH_STANDARD_API(http_sendfile_function) } else goto http_sendfile_usage; - + switch_url_decode(http_data->filename_element_name); switch_url_decode(http_data->filename_element); - + if(argc > 2) { http_data->extrapost_elements = switch_core_strdup(pool, argv[i++]); - + if(argc > 3) { if(!strncasecmp(argv[i], "event", 5)) @@ -719,31 +719,31 @@ SWITCH_STANDARD_API(http_sendfile_function) { if(strncasecmp(argv[i], "none", 4)) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Invalid 4th parameter set for curl_sendfile. Defaulting to \"none\"\n"); - + switch_set_flag(http_data, CSO_NONE); } - + i++; - + if(argc > 4) http_data->identifier_str = switch_core_strdup(pool, argv[i++]); } } } - + // We need to check the file now... if(http_sendfile_test_file_open(http_data, event) != SWITCH_STATUS_SUCCESS) goto http_sendfile_done; - - + + switch_file_close(http_data->file_handle); - + switch_url_decode(http_data->url); - + http_sendfile_initialize_curl(http_data); - + http_sendfile_success_report(http_data, event); - + status = SWITCH_STATUS_SUCCESS; goto http_sendfile_done; @@ -756,12 +756,12 @@ http_sendfile_done: { switch_curl_slist_free_all(http_data->headers); } - + if (new_memory_pool == SWITCH_TRUE) { switch_core_destroy_memory_pool(&pool); } - + return status; } @@ -1030,7 +1030,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load) SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX); SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request", curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); - + SWITCH_ADD_API(api_interface, "curl_sendfile", "curl_sendfile API", http_sendfile_function, HTTP_SENDFILE_SYNTAX); SWITCH_ADD_APP(app_interface, "curl_sendfile", "Send a file and some optional post variables via HTTP", "Send a file and some optional post variables via HTTP", http_sendfile_app_function, HTTP_SENDFILE_APP_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); @@ -1045,7 +1045,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown) { switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT); - + /* Cleanup dynamically allocated config settings */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/applications/mod_cv/mod_cv.cpp b/src/mod/applications/mod_cv/mod_cv.cpp index 42b826e9a8..c3a0376b3b 100644 --- a/src/mod/applications/mod_cv/mod_cv.cpp +++ b/src/mod/applications/mod_cv/mod_cv.cpp @@ -728,11 +728,11 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi switch_img_to_raw(frame->img, context->rawImage->imageData, context->rawImage->widthStep, SWITCH_IMG_FMT_RGB24); detectAndDraw(context); - + if (context->shape_idx && context->shape[0].w && context->last_shape[0].w) { int max, min; int pct; - + if (context->shape[0].w > context->last_shape[0].w) { max = context->shape[0].w; min = context->last_shape[0].w; @@ -742,7 +742,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi } pct = 100 - (((double)min / (double)max) * 100.0f ); - + if (pct > 25) { context->detected.simo_count = 0; memset(context->last_shape, 0, sizeof(context->last_shape[0]) * MAX_SHAPES); @@ -1331,7 +1331,7 @@ SWITCH_STANDARD_API(cv_bug_api_function) flags = SMBF_VIDEO_PATCH; } - if ((status = switch_core_media_bug_add(rsession, function, NULL, + if ((status = switch_core_media_bug_add(rsession, function, NULL, cv_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Failure!\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); @@ -1367,7 +1367,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_VIDEO_DETECT); return SWITCH_STATUS_TERM; } - + *module_interface = switch_loadable_module_create_module_interface(pool, modname); MODULE_INTERFACE = *module_interface; @@ -1390,7 +1390,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown) { switch_event_free_subclass(MY_EVENT_VIDEO_DETECT); - + return SWITCH_STATUS_UNLOAD; } diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index f5682000df..0e3e227de7 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Ken Rice * Mathieu Rene @@ -89,7 +89,7 @@ switch_cache_db_handle_t *limit_get_db_handle(void) { switch_cache_db_handle_t *dbh = NULL; char *dsn; - + if (!zstr(globals.odbc_dsn)) { dsn = globals.odbc_dsn; } else { @@ -99,7 +99,7 @@ switch_cache_db_handle_t *limit_get_db_handle(void) if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { dbh = NULL; } - + return dbh; } @@ -158,7 +158,7 @@ static char * limit_execute_sql2str(char *sql, char *str, size_t len) cbt.len = len; limit_execute_sql_callback(sql, sql2str_callback, &cbt); - + return cbt.buf; } @@ -229,7 +229,7 @@ SWITCH_LIMIT_RELEASE(limit_release_db) } limit_execute_sql(sql); switch_safe_free(sql); - + return SWITCH_STATUS_SUCCESS; } @@ -238,12 +238,12 @@ SWITCH_LIMIT_USAGE(limit_usage_db) char usagestr[128] = ""; int usage = 0; char *sql = NULL; - + sql = switch_mprintf("select count(hostname) from limit_data where realm='%q' and id='%q'", realm, resource); limit_execute_sql2str(sql, usagestr, sizeof(usagestr)); switch_safe_free(sql); usage = atoi(usagestr); - + return usage; } @@ -253,7 +253,7 @@ SWITCH_LIMIT_RESET(limit_reset_db) sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname); limit_execute_sql(sql); switch_safe_free(sql); - + return SWITCH_STATUS_SUCCESS; } @@ -262,7 +262,7 @@ SWITCH_LIMIT_STATUS(limit_status_db) char count[128] = ""; char *ret = NULL; char *sql = NULL; - + sql = switch_mprintf("select count(hostname) from limit_data where hostname='%q'", globals.hostname); limit_execute_sql2str(sql, count, sizeof(count)); switch_safe_free(sql); @@ -686,7 +686,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load) /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; - + } diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index a214003cf7..61a05a93a5 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * Emmanuel Schmidbauer * @@ -194,7 +194,7 @@ switch_cache_db_handle_t *directory_get_db_handle(void) { switch_cache_db_handle_t *dbh = NULL; char *dsn; - + if (!zstr(globals.odbc_dsn)) { dsn = globals.odbc_dsn; } else { @@ -204,7 +204,7 @@ switch_cache_db_handle_t *directory_get_db_handle(void) if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { dbh = NULL; } - + return dbh; } @@ -661,7 +661,7 @@ static switch_status_t populate_database(switch_core_session_t *session, dir_pro sql = generate_sql_entry_for_user(session, ux, profile->use_number_alias); switch_xml_free(ux); } - + } else { sql = generate_sql_entry_for_user(session, ut, profile->use_number_alias); } @@ -677,7 +677,7 @@ static switch_status_t populate_database(switch_core_session_t *session, dir_pro sql = NULL; } } - + if (++count >= 100) { count = 0; sql = switch_mprintf("BEGIN;%s;COMMIT;", sqlvalues); @@ -1018,7 +1018,7 @@ SWITCH_STANDARD_APP(directory_function) switch_copy_string(s_param.profile, profile_name, 255); switch_copy_string(s_param.domain, domain_name, 255); - if (!(search_by = switch_channel_get_variable(channel, "directory_search_order"))) { + if (!(search_by = switch_channel_get_variable(channel, "directory_search_order"))) { search_by = profile->search_order; } diff --git a/src/mod/applications/mod_distributor/conf/dialplan/distributor.xml b/src/mod/applications/mod_distributor/conf/dialplan/distributor.xml index 95f322a042..5a717e91de 100644 --- a/src/mod/applications/mod_distributor/conf/dialplan/distributor.xml +++ b/src/mod/applications/mod_distributor/conf/dialplan/distributor.xml @@ -1,5 +1,5 @@ - + diff --git a/src/mod/applications/mod_distributor/mod_distributor.c b/src/mod/applications/mod_distributor/mod_distributor.c index b02b438669..cbdcc987ed 100644 --- a/src/mod/applications/mod_distributor/mod_distributor.c +++ b/src/mod/applications/mod_distributor/mod_distributor.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Neal Horman * @@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_distributor_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_distributor_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_distributor_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_distributor, mod_distributor_load, mod_distributor_shutdown, NULL); @@ -173,7 +173,7 @@ static int load_config(int reloading) switch_zmalloc(node, sizeof(*node)); node->name = strdup(name_attr); node->wval = tmp; - + if (np) { np->next = node; } else { @@ -228,7 +228,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex for (;;) { top: - + if (++loops > 1000) { break; } @@ -253,7 +253,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex if (match) { int i; - + match->cur_weight++; list->lastnode = match; list->last = mx; @@ -266,7 +266,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex goto top; } } - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Choose %s\n", match->name); return match; @@ -279,7 +279,7 @@ static struct dist_node *find_next(struct dist_list *list, int etotal, char **ex } } - + return NULL; } @@ -294,7 +294,7 @@ static char *dist_engine(const char *name) int argc = 0; char *argv[100] = { 0 }; - + if ((except = strchr(myname, ' '))) { *except++ = '\0'; argc = switch_split(except, ' ', argv); @@ -443,7 +443,7 @@ SWITCH_STANDARD_API(distributor_ctl_function) *e++ = '\0'; if ((np = find_node(list, argv[i]))) { int tmp = -1; - + if (e) { tmp = atoi(e); } @@ -476,7 +476,7 @@ SWITCH_STANDARD_API(distributor_ctl_function) } } } - + err: if (err) { diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f63b5b3330..9e9f446549 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2015, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Ken Rice * Michael Murdock @@ -129,7 +129,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", switch_channel_get_name(channel), match->match_digits); if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { @@ -137,14 +137,14 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", switch_core_session_get_name(use_session)); } } /* send it back around and skip the dmachine */ switch_channel_queue_dtmf_string(channel, match->match_digits); - + if (use_session != session) { switch_core_session_rwunlock(use_session); } @@ -166,7 +166,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) int x = 0; char *flags = ""; - if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) { + if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) { if (switch_core_session_get_partner(act->session, &use_session) != SWITCH_STATUS_SUCCESS) { use_session = act->session; } @@ -183,14 +183,14 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) switch_channel_set_variable(channel, "last_matching_digits", match->match_digits); - + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", switch_channel_get_name(channel), act->string, act->value); if (!strncasecmp(string, "exec", 4)) { char *e; - + string += 4; if (*string == ':') { string++; @@ -220,7 +220,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", switch_core_session_get_name(use_session)); } } @@ -244,7 +244,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) switch_api_execute(string, act->value, NULL, &stream); if (stream.data) { switch_channel_set_variable(channel, "bind_digit_action_api_result", (char *)stream.data); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed, %s\n", switch_core_session_get_name(use_session), act->string, act->value, (char *)stream.data); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s] api executed\n", @@ -252,7 +252,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) } switch_safe_free(stream.data); } - + if (use_session != act->session) { switch_core_session_rwunlock(use_session); @@ -275,7 +275,7 @@ static switch_digit_action_target_t str2target(const char *target_str) if (!strcasecmp(target_str, "both")) { return DIGIT_TARGET_BOTH; } - + return DIGIT_TARGET_SELF; } @@ -341,7 +341,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function) return; } - + if ((dmachine = switch_core_session_get_dmachine(session, target))) { switch_ivr_dmachine_set_realm(dmachine, realm); } @@ -349,7 +349,7 @@ SWITCH_STANDARD_APP(digit_action_set_realm_function) } -static void bind_to_session(switch_core_session_t *session, +static void bind_to_session(switch_core_session_t *session, const char *arg0, const char *arg1, const char *arg2, const char *arg3, switch_digit_action_target_t target, switch_digit_action_target_t bind_target) { @@ -367,16 +367,16 @@ static void bind_to_session(switch_core_session_t *session, if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) { digit_timeout = switch_atoul(var); } - + if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) { input_timeout = switch_atoul(var); } - + switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session); switch_core_session_set_dmachine(session, dmachine, target); } - + act = switch_core_session_alloc(session, sizeof(*act)); act->realm = switch_core_session_strdup(session, arg0); act->input = switch_core_session_strdup(session, arg1); @@ -404,7 +404,7 @@ static void bind_to_session(switch_core_session_t *session, } switch_ivr_dmachine_bind(dmachine, act->realm, act->input, is_priority, 0, digit_action_callback, act); - + if ((terminators = switch_channel_get_variable(channel, "bda_terminators"))) { switch_ivr_dmachine_set_terminators(dmachine, terminators); } @@ -617,7 +617,7 @@ SWITCH_STANDARD_APP(keepalive_function) msg.message_id = SWITCH_MESSAGE_INDICATE_KEEPALIVE; msg.numeric_arg = seconds; switch_core_session_receive_message(session, &msg); - + switch_core_session_enable_heartbeat(session, seconds); return; } @@ -660,7 +660,7 @@ SWITCH_STANDARD_APP(rename_function) switch_file_rename(argv[0], argv[1], switch_core_session_get_pool(session)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RENAME: %s %s\n", switch_channel_get_name(switch_core_session_get_channel(session)), argv[0], argv[1]); - + } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", RENAME_SYNTAX); } @@ -672,7 +672,7 @@ SWITCH_STANDARD_APP(transfer_vars_function) char *argv[1] = { 0 }; int argc; char *lbuf = NULL; - + if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { switch_core_session_t *nsession = NULL; @@ -922,7 +922,7 @@ SWITCH_STANDARD_APP(eavesdrop_function) switch_safe_free(e_data.uuid_list[x]); } e_data.total = 0; - + if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Database Error!\n"); break; @@ -1056,7 +1056,7 @@ SWITCH_STANDARD_APP(ring_ready_function) return; } } - + switch_channel_ring_ready(switch_core_session_get_channel(session)); } @@ -1182,7 +1182,7 @@ SWITCH_STANDARD_APP(sched_transfer_function) id = switch_ivr_schedule_transfer(when, switch_core_session_get_uuid(session), argv[1], argv[2], argv[3]); snprintf(ids, sizeof(ids), "%u", id); - switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids); + switch_channel_set_variable(switch_core_session_get_channel(session), "last_sched_id", ids); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Args\n"); } @@ -1377,7 +1377,7 @@ SWITCH_STANDARD_APP(pre_answer_function) { switch_channel_t *channel = switch_core_session_get_channel(session); const char *arg = (char *) data; - + if (!zstr(arg)) { if (switch_stristr("is_conference", arg)) { switch_channel_set_flag(channel, CF_CONFERENCE); @@ -1559,9 +1559,9 @@ static void base_set (switch_core_session_t *session, const char *data, switch_s expanded = switch_channel_expand_variables(channel, val); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s [%s]=[%s]\n", what, switch_channel_get_name(channel), var, expanded ? expanded : "UNDEF"); - + switch_channel_add_variable_var_check(channel, var, expanded, SWITCH_FALSE, stack); if (expanded && expanded != val) { @@ -1586,11 +1586,11 @@ SWITCH_STANDARD_APP(multiset_function) arg = switch_core_session_strdup(session, arg); argc = switch_split(arg, delim, array); - + for(i = 0; i < argc; i++) { base_set(session, array[i], SWITCH_STACK_BOTTOM); } - + } else { base_set(session, data, SWITCH_STACK_BOTTOM); @@ -1933,7 +1933,7 @@ SWITCH_STANDARD_API(strftime_api_function) if (!zstr(q) && (p = strchr(q, '|'))) { *p++ = '\0'; - + thetime = switch_time_make(atol(q), 0); q = p + 1; } else { @@ -2226,7 +2226,7 @@ SWITCH_STANDARD_APP(park_state_function) /********************************************************************************/ /* - dtmf handler function you can hook up to be executed when a digit is dialed during playback + dtmf handler function you can hook up to be executed when a digit is dialed during playback if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) @@ -2451,7 +2451,7 @@ static switch_status_t tmp_hanguphook(switch_core_session_t *session) if (!zstr(bond)) { switch_core_session_t *b_session; - + if ((b_session = switch_core_session_locate(bond))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); if (switch_channel_up(b_channel)) { @@ -2710,7 +2710,7 @@ SWITCH_STANDARD_APP(read_function) valid_terminators = "#"; } - switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators, + switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators, digit_timeout); } @@ -2799,7 +2799,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) } switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators, - prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), + prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout, transfer_on_failure); } @@ -3066,7 +3066,7 @@ SWITCH_STANDARD_APP(capture_function) int ovector[30] = {0}; char *lbuf; int proceed; - + if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) { if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { @@ -3075,7 +3075,7 @@ SWITCH_STANDARD_APP(capture_function) switch_regex_safe_free(re); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No data specified.\n"); - } + } } SWITCH_STANDARD_APP(record_function) @@ -3164,7 +3164,7 @@ SWITCH_STANDARD_APP(record_session_function) path = switch_core_session_strdup(session, data); - /* Search for a space then a plus followed by only numbers at the end of the path, + /* Search for a space then a plus followed by only numbers at the end of the path, if found trim any spaces to the left/right of the plus use the left side as the path and right side as a time limit on the recording */ @@ -3385,7 +3385,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) moh = switch_channel_get_hold_music(caller_channel); } - if (!zstr(moh) && !strcasecmp(moh, "silence")) { + if (!zstr(moh) && !strcasecmp(moh, "silence")) { moh = NULL; } @@ -3427,7 +3427,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) if (fail) { int64_t wait = (int64_t)campon_sleep * 1000000; - + while (stake.running && wait > 0 && switch_channel_ready(caller_channel)) { switch_yield(100000); wait -= 100000; @@ -3436,8 +3436,8 @@ SWITCH_STANDARD_APP(audio_bridge_function) } } - status = switch_ivr_originate(NULL, &peer_session, - &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE, + status = switch_ivr_originate(NULL, &peer_session, + &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE, switch_channel_get_cause_ptr(caller_channel)); @@ -3564,19 +3564,19 @@ static void pickup_send_presence(const char *key_name) switch_event_t *event; int count; - + dup_key_name = strdup(key_name); key_name = dup_key_name; if ((domain_name = strchr(dup_key_name, '@'))) { *domain_name++ = '\0'; } - + if (zstr(domain_name)) { dup_domain_name = switch_core_get_domain(SWITCH_TRUE); domain_name = dup_domain_name; } - + if (zstr(domain_name)) { domain_name = "cluecon.com"; } @@ -3591,7 +3591,7 @@ static void pickup_send_presence(const char *key_name) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id); - + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -3609,7 +3609,7 @@ static void pickup_send_presence(const char *key_name) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", dup_id); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", dup_id); - + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -3620,13 +3620,13 @@ static void pickup_send_presence(const char *key_name) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "terminated"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-direction", "inbound"); switch_event_fire(&event); - } + } } - + switch_safe_free(dup_domain_name); switch_safe_free(dup_key_name); switch_safe_free(dup_id); - + } static void pickup_pres_event_handler(switch_event_t *event) @@ -3667,7 +3667,7 @@ static void pickup_pres_event_handler(switch_event_t *event) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name); - + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d call%s)", count, count == 1 ? "" : "s"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "active"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -3681,7 +3681,7 @@ static void pickup_pres_event_handler(switch_event_t *event) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", PICKUP_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", key_name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", key_name, domain_name); - + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -3751,7 +3751,7 @@ static char *pickup_pop_uuid(const char *key, const char *uuid) if ((head = switch_core_hash_find(globals.pickup_hash, key))) { switch_core_hash_delete(globals.pickup_hash, key); - + if (uuid) { pickup_node_t *np, *lp = NULL; @@ -3762,14 +3762,14 @@ static char *pickup_pop_uuid(const char *key, const char *uuid) } else { head = np->next; } - + node = np; break; } lp = np; } - + } else { node = head; head = head->next; @@ -3786,13 +3786,13 @@ static char *pickup_pop_uuid(const char *key, const char *uuid) free(node->key); free(node); } - + switch_mutex_unlock(globals.pickup_mutex); if (r) pickup_send_presence(key); switch_safe_free(dup_key); - + return r; } @@ -3829,7 +3829,7 @@ static switch_status_t pickup_event_handler(switch_core_session_t *session) return SWITCH_STATUS_FALSE; case CS_HANGUP: { - + if (switch_channel_test_flag(channel, CF_CHANNEL_SWAP)) { const char *key = switch_channel_get_variable(channel, "channel_swap_uuid"); switch_core_session_t *swap_session; @@ -3903,7 +3903,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio switch_core_session_set_private(nsession, tech_pvt); - + nchannel = switch_core_session_get_channel(nsession); switch_channel_set_cap(nchannel, CC_PROXY_MEDIA); switch_channel_set_cap(nchannel, CC_BYPASS_MEDIA); @@ -3912,7 +3912,7 @@ static switch_call_cause_t pickup_outgoing_channel(switch_core_session_t *sessio switch_channel_set_caller_profile(nchannel, caller_profile); switch_channel_set_state(nchannel, CS_ROUTING); - + *new_session = nsession; @@ -3963,7 +3963,7 @@ SWITCH_STANDARD_APP(pickup_function) if ((uuid = pickup_pop_uuid((char *)data, NULL))) { if ((pickup_session = switch_core_session_locate(uuid))) { switch_channel_t *pickup_channel = switch_core_session_get_channel(pickup_session); - switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel), + switch_caller_profile_t *pickup_caller_profile = switch_channel_get_caller_profile(pickup_channel), *caller_profile = switch_channel_get_caller_profile(channel); const char *name, *num; switch_event_t *event; @@ -3974,10 +3974,10 @@ SWITCH_STANDARD_APP(pickup_function) switch_channel_set_variable(channel, hp->name, hp->value); } - + switch_channel_set_flag(pickup_channel, CF_CHANNEL_SWAP); switch_channel_set_variable(pickup_channel, "channel_swap_uuid", switch_core_session_get_uuid(session)); - + name = caller_profile->caller_id_name; num = caller_profile->caller_id_number; @@ -3986,11 +3986,11 @@ SWITCH_STANDARD_APP(pickup_function) caller_profile->callee_id_name = name; caller_profile->callee_id_number = num; - + if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) { const char *partner_uuid = switch_channel_get_partner_uuid(channel); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV"); - + if (partner_uuid) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", partner_uuid); } @@ -4221,7 +4221,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, } var_event = NULL; } - + if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", user, domain); cause = SWITCH_CAUSE_SUBSCRIBER_ABSENT; @@ -4345,7 +4345,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, switch_safe_free(d_dest); } } - + if (new_channel && x_user) { if ((x_params = switch_xml_child(x_user, "variables"))) { for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { @@ -4493,7 +4493,7 @@ SWITCH_STANDARD_APP(detect_silence_function) } static switch_status_t event_chat_send(switch_event_t *message_event) - + { switch_event_t *event; const char *to; @@ -4512,7 +4512,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event) if (switch_event_fire(&event) == SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_SUCCESS; } - + switch_event_destroy(&event); return SWITCH_STATUS_MEMERR; @@ -4521,7 +4521,7 @@ static switch_status_t event_chat_send(switch_event_t *message_event) static switch_status_t api_chat_send(switch_event_t *message_event) { const char *proto; - const char *from; + const char *from; const char *to; //const char *subject; //const char *body; @@ -4534,7 +4534,7 @@ static switch_status_t api_chat_send(switch_event_t *message_event) //subject = switch_event_get_header(message_event, "subject"); //body = switch_event_get_body(message_event); type = switch_event_get_header(message_event, "type"); - hint = switch_event_get_header(message_event, "hint"); + hint = switch_event_get_header(message_event, "hint"); if (to) { @@ -4610,7 +4610,7 @@ SWITCH_STANDARD_APP(limit_function) mydata = switch_core_session_strdup(session, data); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } - + backend = argv[0]; /* must have at least one item */ @@ -4618,10 +4618,10 @@ SWITCH_STANDARD_APP(limit_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "USAGE: limit %s\n", LIMIT_USAGE); return; } - + /* if this is an invalid backend, fallback to db backend */ /* TODO: remove this when we can! */ - if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && + if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && !switch_loadable_module_get_limit_interface(backend)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown backend '%s'. To maintain backwards compatability, falling back on db backend and shifting argumens. Either update your diaplan to include the backend, fix the typo, or load the appropriate limit implementation module.\n", backend); mydata = switch_core_session_sprintf(session, "db %s", data); @@ -4709,9 +4709,9 @@ SWITCH_STANDARD_APP(limit_execute_function) mydata = switch_core_session_strdup(session, data); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } - + /* backwards compat version, if we have 5, just prepend with db and reparse */ - if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && + if (switch_true(switch_channel_get_variable(channel, "switch_limit_backwards_compat_flag")) && argc == 5) { mydata = switch_core_session_sprintf(session, "db %s", data); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -4758,7 +4758,7 @@ SWITCH_STANDARD_APP(limit_execute_function) /* Only release the resource if we are still in CS_EXECUTE */ if (switch_channel_get_state(switch_core_session_get_channel(session)) == CS_EXECUTE) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "immediately releasing\n"); - switch_limit_release(backend, session, realm, id); + switch_limit_release(backend, session, realm, id); } } } @@ -4902,12 +4902,12 @@ static switch_status_t next_file(switch_file_handle_t *handle) } if (context->file && switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { /* TODO handle other data type flags */ - switch_size_t len; + switch_size_t len; uint16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; switch_status_t stat; switch_file_handle_t fh = { 0 }; - if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, + if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) { do { len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels; @@ -4916,7 +4916,7 @@ static switch_status_t next_file(switch_file_handle_t *handle) } } while (stat == SWITCH_STATUS_SUCCESS); - switch_core_file_close(&fh); + switch_core_file_close(&fh); switch_file_remove(context->file, handle->memory_pool); } else { @@ -4962,7 +4962,7 @@ static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsig context->index = -1; return next_file(handle); } - + if (!handle->seekable) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); return SWITCH_STATUS_NOTIMPL; @@ -5004,7 +5004,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle, file_string_context_t *context = handle->private_info; file_string_audio_col_t *col_ptr = context->audio_cols; - while (col_ptr && col != col_ptr->col) { + while (col_ptr && col != col_ptr->col) { col_ptr = col_ptr->next; } @@ -5017,7 +5017,7 @@ static switch_status_t file_string_file_set_string(switch_file_handle_t *handle, col_ptr->next = context->audio_cols; context->audio_cols = col_ptr; } - + return switch_core_file_set_string(&context->fh, col, string); } @@ -5232,7 +5232,7 @@ static switch_status_t read_frame_callback(switch_core_session_t *session, switc } return switch_channel_test_app_flag_key(rf->key, channel, MUTEX_FLAG_WAIT) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; - + } static void free_node(mutex_node_t **npp) @@ -5256,7 +5256,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master) for (np = master->list; np; np = np->next) { if (np && !strcmp(np->uuid, uuid)) { switch_core_event_hook_remove_state_change(session, mutex_hanguphook); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s canceled\n", switch_core_session_get_uuid(session), switch_core_session_get_name(session), master->key); @@ -5269,7 +5269,7 @@ static void cancel(switch_core_session_t *session, master_mutex_t *master) } free_node(&np); - + break; } @@ -5288,7 +5288,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current) if (!master || !master->list) { goto end; } - + while (master->list) { mutex_node_t *np; @@ -5302,14 +5302,14 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ADVANCE POP %p\n", (void *)np); free_node(&np); } - + if (master->list) { switch_core_session_t *session; if ((session = switch_core_session_locate(master->list->uuid))) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s mutex %s advanced\n", switch_channel_get_name(channel), master->key); switch_channel_set_app_flag_key(master->key, channel, MUTEX_FLAG_SET); switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_WAIT); @@ -5327,7 +5327,7 @@ static void advance(master_mutex_t *master, switch_bool_t pop_current) switch_mutex_unlock(globals.mutex_mutex); - + } static void confirm(switch_core_session_t *session, master_mutex_t *master) @@ -5346,7 +5346,7 @@ static void confirm(switch_core_session_t *session, master_mutex_t *master) if (!strcmp(master->list->uuid, switch_core_session_get_uuid(session))) { switch_channel_clear_app_flag_key(master->key, channel, MUTEX_FLAG_SET); switch_core_event_hook_remove_state_change(session, mutex_hanguphook); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s cleared\n", switch_core_session_get_uuid(session), switch_channel_get_name(channel), master->key); advance(master, SWITCH_TRUE); @@ -5396,7 +5396,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s switch_mutex_unlock(globals.mutex_mutex); return SWITCH_FALSE; } - + if (!(master = switch_core_hash_find(globals.mutex_hash, key))) { master = switch_core_alloc(globals.pool, sizeof(*master)); master->key = switch_core_strdup(globals.pool, key); @@ -5406,7 +5406,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXIST MASTER %s %p\n", key, (void *) master); } - + if (on) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "HIT ON\n"); @@ -5430,7 +5430,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s switch_channel_clear_app_flag_key(key, channel, MUTEX_FLAG_WAIT); switch_channel_set_private(channel, "_mutex_master", master); switch_core_event_hook_add_state_change(session, mutex_hanguphook); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", switch_core_session_get_uuid(session), switch_channel_get_name(channel), key); switch_mutex_unlock(globals.mutex_mutex); @@ -5444,7 +5444,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s } switch_mutex_unlock(globals.mutex_mutex); - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s mutex %s is busy, waiting...\n", switch_channel_get_name(channel), key); if ((feedback = switch_channel_get_variable(channel, "mutex_feedback"))) { @@ -5456,19 +5456,19 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s if ((rf.exten = switch_channel_get_variable(channel, "mutex_orbit_exten"))) { to_val = 60; } - + if ((var = switch_channel_get_variable(channel, "mutex_timeout"))) { long tmp = atol(var); - + if (tmp > 0) { to_val = tmp; } } - + if (to_val) { switch_codec_implementation_t read_impl; switch_core_session_get_read_impl(session, &read_impl); - + rf.to = (1000 / (read_impl.microseconds_per_packet / 1000)) * to_val; rf.dp = switch_channel_get_variable(channel, "mutex_orbit_dialplan"); rf.context = switch_channel_get_variable(channel, "mutex_orbit_context"); @@ -5500,7 +5500,7 @@ static switch_bool_t do_mutex(switch_core_session_t *session, const char *key, s if (switch_channel_test_app_flag_key(key, channel, MUTEX_FLAG_WAIT) || !switch_channel_up(channel)) { cancel(session, master); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s %s mutex %s acquired\n", switch_core_session_get_uuid(session), switch_channel_get_name(channel), key); switch_core_event_hook_add_state_change(session, mutex_hanguphook); @@ -5534,7 +5534,7 @@ SWITCH_STANDARD_APP(mutex_function) } do_mutex(session, key, on); - + } @@ -5587,7 +5587,7 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj) if (switch_ivr_originate(NULL, &session, &cause, pd->dial_str, 60, NULL, NULL, NULL, NULL, pd->var_event, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS) { switch_channel_t *channel = switch_core_session_get_channel(session); - + switch_channel_set_variable(channel, "page_file", pd->path); mypd = switch_core_session_alloc(session, sizeof(*mypd)); @@ -5613,14 +5613,14 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj) return NULL; } -static void launch_call(const char *dial_str, - const char *path, const char *exten, const char *context, const char *dp, +static void launch_call(const char *dial_str, + const char *path, const char *exten, const char *context, const char *dp, switch_mutex_t *mutex, uint32_t *counter, switch_event_t **var_event) { switch_thread_data_t *td; switch_memory_pool_t *pool; page_data_t *pd; - + switch_core_new_memory_pool(&pool); pd = switch_core_alloc(pool, sizeof(*pd)); @@ -5648,7 +5648,7 @@ static void launch_call(const char *dial_str, td->obj = pd; switch_thread_pool_launch_thread(&td); - + } typedef struct call_monitor_s { @@ -5689,7 +5689,7 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj) while (data && *data && *data == ' ') { data++; } - + while (*data == '<') { char *parsed = NULL; @@ -5716,15 +5716,15 @@ void *SWITCH_THREAD_FUNC call_monitor_thread(switch_thread_t *thread, void *obj) } while (sent < size) { - do { - switch_mutex_lock(mutex); + do { + switch_mutex_lock(mutex); busy = (counter >= cm->chunk_size); switch_mutex_unlock(mutex); - - if (busy) { + + if (busy) { switch_yield(100000); - } - + } + } while (busy); launch_call(argv[sent++], cm->path, cm->exten, cm->context, cm->dp, mutex, &counter, &var_event); @@ -5755,7 +5755,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin switch_thread_data_t *td; switch_memory_pool_t *pool; call_monitor_t *cm; - + switch_core_new_memory_pool(&pool); cm = switch_core_alloc(pool, sizeof(*cm)); @@ -5777,7 +5777,7 @@ static void launch_call_monitor(const char *path, int del, const char *data, uin td->obj = cm; switch_thread_pool_launch_thread(&td); - + } @@ -5814,10 +5814,10 @@ SWITCH_STANDARD_APP(page_function) if ((l = switch_channel_get_variable(channel, "page_dp"))) { dp = l; } - + l = switch_channel_get_variable(channel, "page_record_limit"); - + if (l) { if (*l == '+') { l++; @@ -5866,7 +5866,7 @@ SWITCH_STANDARD_APP(page_function) } switch_ivr_play_file(session, NULL, beep, NULL); - + switch_ivr_record_file(session, &fh, path, &args, limit); } @@ -5874,7 +5874,7 @@ SWITCH_STANDARD_APP(page_function) if (zstr(exten)) { exten = switch_core_session_sprintf(session, "playback:%s", path); } - + if (switch_file_exists(path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { launch_call_monitor(path, del, pdata, chunk_size, exten, context, dp); } else { @@ -5909,7 +5909,7 @@ SWITCH_STANDARD_API(page_api_function) while (data && *data && *data == ' ') { data++; } - + while (*data == '(') { char *parsed = NULL; @@ -5928,7 +5928,7 @@ SWITCH_STANDARD_API(page_api_function) if (!var_event) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); goto end; - } + } pdata = data; @@ -5948,7 +5948,7 @@ SWITCH_STANDARD_API(page_api_function) if ((l = switch_event_get_header(var_event, "page_dp"))) { dp = l; } - + if ((l = switch_event_get_header(var_event, "page_chunk_size"))) { uint32_t tmp = switch_atoui(l); @@ -5967,7 +5967,7 @@ SWITCH_STANDARD_API(page_api_function) oexten = switch_mprintf("playback:%s", path); exten = oexten; } - + if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) { launch_call_monitor(path, 0, pdata, chunk_size, exten, context, dp); } else { @@ -5976,7 +5976,7 @@ SWITCH_STANDARD_API(page_api_function) end: - + switch_safe_free(odata); switch_safe_free(oexten); @@ -6217,16 +6217,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "blind_transfer_ack", "", "", blind_transfer_ack_function, "[true|false]", SAF_NONE); - SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", + SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", "bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); - SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var", + SWITCH_ADD_APP(app_interface, "capture", "capture data into a var", "capture data into a var", capture_function, "||", SAF_SUPPORT_NOMEDIA); - SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", + SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); - SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "", + SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "", digit_action_set_realm_function, DIGIT_ACTION_SET_REALM_USAGE, SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", @@ -6258,7 +6258,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "set_media_stats", "Set Media Stats", "Set Media Stats", set_media_stats_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "stop", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); - SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution", + SWITCH_ADD_APP(app_interface, "set_zombie_exec", "Enable Zombie Execution", "Enable Zombie Execution", zombie_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA); @@ -6311,7 +6311,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "video_decode", "Set video decode.", "Set video decode.", video_set_decode_function, "[[on|wait]|off]", SAF_NONE); SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "", SAF_SUPPORT_NOMEDIA); - SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", + SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", jitterbuffer_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "", SAF_SUPPORT_NOMEDIA); @@ -6377,10 +6377,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "loop_playback", "Playback File looply", "Playback a file to the channel looply for limted times", loop_playback_function, "[+loops] ", SAF_NONE); SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "", SAF_NONE); - SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, + SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, " ", SAF_NONE); SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits", - play_and_get_digits_function, + play_and_get_digits_function, "\n\t [] [' [failure_dp [failure_context]]']", SAF_NONE); SWITCH_ADD_APP(app_interface, "stop_video_write_overlay", "Stop video write overlay", "Stop video write overlay", stop_video_write_overlay_session_function, "", SAF_NONE); diff --git a/src/mod/applications/mod_easyroute/conf/autoload_configs/easyroute.conf.xml b/src/mod/applications/mod_easyroute/conf/autoload_configs/easyroute.conf.xml index 350a50989b..2ae834be70 100644 --- a/src/mod/applications/mod_easyroute/conf/autoload_configs/easyroute.conf.xml +++ b/src/mod/applications/mod_easyroute/conf/autoload_configs/easyroute.conf.xml @@ -7,7 +7,7 @@ - + @@ -21,7 +21,7 @@ call_limit varchar(16) - contains optional call limit tech_prefix varchar(128) - tech prefix used to build dial string (ex: sofia/default ) acctcode varchar(128) - used to set channel variable acctcode for logging into the CDRs - destination_number varchar(16) - Number returning for the query for building the dial string. (ex: 18005551212) + destination_number varchar(16) - Number returning for the query for building the dial string. (ex: 18005551212) See Documentation on the Wiki for further information --> diff --git a/src/mod/applications/mod_easyroute/mod_easyroute.c b/src/mod/applications/mod_easyroute/mod_easyroute.c index 980e845e50..18f634e393 100644 --- a/src/mod/applications/mod_easyroute/mod_easyroute.c +++ b/src/mod/applications/mod_easyroute/mod_easyroute.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 8d74ba0033..a00095e531 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Jay Binks * @@ -117,7 +117,7 @@ static switch_status_t load_config(void) globals.timeout = 5000; globals.retries = 3; globals.random = 0; - + if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "name"); @@ -165,8 +165,8 @@ static switch_status_t load_config(void) HKEY hKey; DWORD data_sz; char* buf; - RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_QUERY_VALUE, &hKey); if (hKey) { @@ -249,7 +249,7 @@ static void add_result(enum_record_t **results, int order, int preference, char new_result->service = strdup(service); new_result->route = strdup(route); new_result->supported = supported; - + if (!*results) { *results = new_result; @@ -310,7 +310,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t char *packstr; char *regex, *replace; - + if (zstr(str)) { if (str != NULL) { /* In this case ldns_rr2str returned a malloc'd null terminated string */ @@ -339,7 +339,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t if (zstr(service) || zstr(packstr)) { goto end; } - + if (!zstr(argv[4])) { order = atoi(argv[4]); } @@ -355,7 +355,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t } else { goto end; } - + for (p = replace; p && *p; p++) { if (*p == '\\') { *p = '$'; @@ -388,11 +388,11 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t } else { orig_uri = replace; } - + switch_mutex_lock(MUTEX); for (route = globals.route_order; route; route = route->next) { char *uri = orig_uri; - + if (strcasecmp(service, route->service)) { continue; } @@ -429,13 +429,13 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t supported++; add_result(results, order, preference, service, uri, supported); - + } switch_safe_free(uri_expanded); switch_safe_free(substituted_2); switch_regex_safe_free(re2); } - switch_mutex_unlock(MUTEX); + switch_mutex_unlock(MUTEX); if (!supported) { add_result(results, order, preference, service, orig_uri, 0); @@ -449,7 +449,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t end: switch_safe_free(str); - + return; } @@ -471,15 +471,15 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); goto end; } - + if (!(domain = ldns_dname_new_frm_str(name))) { goto end; } - + if (server_name) { res = ldns_resolver_new(); switch_assert(res); - + for(inameserver=0; inameserverheaders; hi; hi = hi->next) { @@ -921,7 +921,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown) switch_safe_free(globals.root); switch_safe_free(globals.isn_root); - + return SWITCH_STATUS_UNLOAD; } diff --git a/src/mod/applications/mod_esf/mod_esf.c b/src/mod/applications/mod_esf/mod_esf.c index d295ca4ae0..4ac8e16071 100644 --- a/src/mod/applications/mod_esf/mod_esf.c +++ b/src/mod/applications/mod_esf/mod_esf.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -165,7 +165,7 @@ SWITCH_STANDARD_APP(bcast_function) const char *codec_name = "PCMU"; int read_rate = 8000; int need_transcode = 0; - + inc_serno(); switch_core_session_get_read_impl(session, &read_impl); @@ -313,7 +313,7 @@ SWITCH_STANDARD_APP(bcast_function) goto fail; } - + while (!ready) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -333,7 +333,7 @@ SWITCH_STANDARD_APP(bcast_function) alert_packet->audio_header.codec = 0x00; alert_packet->audio_header.flags = 0; - + if ((var = switch_channel_get_variable(channel, "esf_multicast_write_codec"))) { if (!strcasecmp(var, "PCMU")) { codec_name = var; @@ -379,7 +379,7 @@ SWITCH_STANDARD_APP(bcast_function) goto fail; } } - + if (!(rtp_port = switch_rtp_request_port(source_ip))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Port Error\n"); @@ -393,7 +393,7 @@ SWITCH_STANDARD_APP(bcast_function) alert_packet->audio_header.codec, 160, 20000, flags, "soft", &err, switch_core_session_get_pool(session)); - + if (!switch_rtp_ready(rtp_session)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error\n"); goto fail; @@ -420,7 +420,7 @@ SWITCH_STANDARD_APP(bcast_function) strncpy((char *)polycom_packet->cid, caller_id_name, sizeof(polycom_packet->cid)); polycom_packet->cid_len = 13; - + polycom_packet->op = 0x0F; polycom_packet->channel = 0x1a; polycom_packet->serno = htonl(get_serno()); @@ -485,27 +485,27 @@ SWITCH_STANDARD_APP(bcast_function) ebuf = read_frame->data; encoded_datalen = read_frame->datalen; } - + switch_rtp_write_frame(rtp_session, read_frame); - + seq += 160; - + alert_packet->audio_header.seq = htonl(seq); - + if (last_polycom_len) { memcpy(alert_packet->data, last_polycom_buf, last_polycom_len); memcpy(alert_packet->data + last_polycom_len, ebuf, encoded_datalen); } else { memcpy(alert_packet->data, ebuf, encoded_datalen); } - + bytes = sizeof(*alert_packet) + encoded_datalen + last_polycom_len; switch_socket_sendto(socket, polycom_addr, 0, (void *) polycom_buf, &bytes); - + last_polycom_len = encoded_datalen; memcpy((void *)last_polycom_buf, (void *)ebuf, last_polycom_len); - + } else { bytes = read_frame->packetlen; switch_socket_sendto(socket, audio_addr, 0, read_frame->packet, &bytes); @@ -543,7 +543,7 @@ SWITCH_STANDARD_APP(bcast_function) if (socket) { switch_socket_close(socket); } - + if (polycom_socket) { switch_socket_close(polycom_socket); } diff --git a/src/mod/applications/mod_esl/mod_esl.c b/src/mod/applications/mod_esl/mod_esl.c index eced37f48c..159d18ed28 100644 --- a/src/mod/applications/mod_esl/mod_esl.c +++ b/src/mod/applications/mod_esl/mod_esl.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -38,7 +38,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_esl_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_esl_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_esl_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_esl, mod_esl_load, mod_esl_shutdown, NULL); @@ -65,7 +65,7 @@ SWITCH_STANDARD_API(single_esl_api_function) if (password && (host = strchr(password, ' '))) { *host++ = '\0'; - } + } if (host && (s_timeout = strchr(host, ' '))) { *s_timeout++ = '\0'; diff --git a/src/mod/applications/mod_expr/conio.h b/src/mod/applications/mod_expr/conio.h index a83971fdd6..24f9a84aee 100644 --- a/src/mod/applications/mod_expr/conio.h +++ b/src/mod/applications/mod_expr/conio.h @@ -2,7 +2,7 @@ * * Written by: * Hongli Lai - * tkorrovi on 2002/02/26. + * tkorrovi on 2002/02/26. * Andrew Westcott * * Offered for use in the public domain without any warranty. diff --git a/src/mod/applications/mod_expr/mod_expr.c b/src/mod/applications/mod_expr/mod_expr.c index c2f94b4d2f..48a6421d00 100644 --- a/src/mod/applications/mod_expr/mod_expr.c +++ b/src/mod/applications/mod_expr/mod_expr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_expr.c -- Framework Demo Module diff --git a/src/mod/applications/mod_fifo/conf/dialplan/fifo.xml b/src/mod/applications/mod_fifo/conf/dialplan/fifo.xml index b85e792992..0c2368763b 100644 --- a/src/mod/applications/mod_fifo/conf/dialplan/fifo.xml +++ b/src/mod/applications/mod_fifo/conf/dialplan/fifo.xml @@ -1,4 +1,4 @@ - @@ -8,7 +8,7 @@ - diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index ee9b52e6bc..2b00f0d7d3 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -84,7 +84,7 @@ SWITCH_MODULE_DEFINITION(mod_fifo, mod_fifo_load, mod_fifo_shutdown, NULL); * who will be available to answer a single caller. In ringall this * maximum is the number who will be called, in enterprise the need defines * how many agents will be called. outbound_per_cycle_min will define - * the minimum agents who will be called to answer a caller regardless of + * the minimum agents who will be called to answer a caller regardless of * need, giving the enterprise strategy the ability to ring through more * than one agent for one caller. @@ -1999,19 +1999,19 @@ static int place_call_enterprise_callback(void *pArg, int argc, char **argv, cha * care of invoking the handler. * * Within the ringall call strategy outbound_per_cycle is used to define - * how many agents exactly are assigned to the caller. With ringall if + * how many agents exactly are assigned to the caller. With ringall if * multiple callers are calling in and one is answered, because the call * is assigned to all agents the call to the agents that is not answered * will be lose raced and the other agents will drop the call before the - * next one will begin to ring. When oubound_per_cycle is used in the + * next one will begin to ring. When oubound_per_cycle is used in the * enterprise strategy it acts as a maximum value for how many agents - * are rung at once on any call, the caller is not assigned to any agent + * are rung at once on any call, the caller is not assigned to any agent * until the call is answered. Enterprise only rings the number of phones * that are needed, so outbound_per_cycle as a max does not give you the * effect of ringall. outbound_per_cycle_min defines how many agents minimum * will be rung by an incoming caller through fifo, which can give a ringall * effect. outbound_per_cycle and outbound_per_cycle_min both default to 1. - * + * */ static int find_consumers(fifo_node_t *node) { @@ -4083,7 +4083,7 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve switch_xml_set_attr_d(x_fifo, "outbound_per_cycle", tmp); switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_per_cycle_min); - switch_xml_set_attr_d(x_fifo, "outbound_per_cycle_min", tmp); + switch_xml_set_attr_d(x_fifo, "outbound_per_cycle_min", tmp); switch_snprintf(tmp, sizeof(buffer), "%u", node->ring_timeout); switch_xml_set_attr_d(x_fifo, "ring_timeout", tmp); diff --git a/src/mod/applications/mod_fsk/fsk.c b/src/mod/applications/mod_fsk/fsk.c index 773b0deaae..94fd98e7a8 100644 --- a/src/mod/applications/mod_fsk/fsk.c +++ b/src/mod/applications/mod_fsk/fsk.c @@ -211,7 +211,7 @@ dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr) /* * dsp_fsk_destroy * - * Destroys a handle, releasing any associated memory. Sets handle pointer to NULL + * Destroys a handle, releasing any associated memory. Sets handle pointer to NULL * so A destroyed handle can not be used for anything after the destroy. */ @@ -306,11 +306,11 @@ dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample) if (handle->cellpos > 1.0) { handle->cellpos -= 1.0; - + switch (handle->state) { case FSK_STATE_DATA: - { - + { + (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit); } break; diff --git a/src/mod/applications/mod_fsk/fsk.h b/src/mod/applications/mod_fsk/fsk.h index b098444d03..4299e29885 100644 --- a/src/mod/applications/mod_fsk/fsk.h +++ b/src/mod/applications/mod_fsk/fsk.h @@ -109,5 +109,5 @@ void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample); extern fsk_modem_definition_t fsk_modem_definitions[]; -#endif +#endif diff --git a/src/mod/applications/mod_fsk/fsk_callerid.c b/src/mod/applications/mod_fsk/fsk_callerid.c index 24acb75d90..a5b5746559 100644 --- a/src/mod/applications/mod_fsk/fsk_callerid.c +++ b/src/mod/applications/mod_fsk/fsk_callerid.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_fsk -- FSK data transfer @@ -39,7 +39,7 @@ void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t bsp->datalen = datalen; bsp->endian = endian; bsp->ss = ss; - + if (endian < 0) { bsp->top = bsp->bit_index = 7; bsp->bot = 0; @@ -53,7 +53,7 @@ void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t int8_t bitstream_get_bit(bitstream_t *bsp) { int8_t bit = -1; - + if (bsp->byte_index >= bsp->datalen) { goto done; @@ -71,19 +71,19 @@ int8_t bitstream_get_bit(bitstream_t *bsp) } bit = (bsp->data[bsp->byte_index] >> (bsp->bit_index)) & 1; - + if (bsp->bit_index == bsp->bot) { bsp->bit_index = bsp->top; if (bsp->ss) { bsp->ssv = 2; goto done; - } + } if (++bsp->byte_index > bsp->datalen) { bit = -1; goto done; } - + } else { bsp->bit_index = bsp->bit_index + bsp->endian; } @@ -109,7 +109,7 @@ static void fsk_byte_handler (void *x, int data) if (state->dlen) { goto add_byte; } - + if (state->bpos == 1) { state->blen = byte; @@ -189,7 +189,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat size_t i; int sum = 0; - + top: if (state->checksum != 0 || state->ppos >= state->dlen - 1) { @@ -201,7 +201,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat sum += state->buf[i]; } state->checksum = sum % 256; - state->ppos = 2; + state->ppos = 2; if (state->buf[0] != CID_TYPE_MDMF && state->buf[0] != CID_TYPE_SDMF) { state->checksum = -1; @@ -224,7 +224,7 @@ switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **dat } } *data = (char *)&state->buf[state->ppos]; - state->ppos += *len; + state->ppos += *len; return SWITCH_STATUS_SUCCESS; } else if (state->buf[0] == CID_TYPE_MDMF) { *type = state->buf[state->ppos++]; @@ -277,7 +277,7 @@ int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsi memset(buf, 0, bufsize); state->buf = buf; state->bufsize = bufsize; - + dsp_fsk_attr_init (&fsk1200_attr); dsp_fsk_attr_set_samplerate (&fsk1200_attr, rate); dsp_fsk_attr_set_bytehandler (&fsk1200_attr, fsk_byte_handler, state); @@ -293,7 +293,7 @@ int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsi size_t fsk_modulator_generate_bit(fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, size_t buflen) { size_t i; - + for(i = 0 ; i < buflen; i++) { fsk_trans->bit_accum += fsk_trans->bit_factor; if (fsk_trans->bit_accum >= FSK_MOD_FACTOR) { @@ -333,7 +333,7 @@ void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans) uint32_t i = 0; size_t r = 0; int8_t bit = 0; - + for (i = 0; i < fsk_trans->chan_sieze_bits; i++) { if ((r = fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != SWITCH_STATUS_SUCCESS) { @@ -344,7 +344,7 @@ void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans) } bit = !bit; } - + } diff --git a/src/mod/applications/mod_fsk/fsk_callerid.h b/src/mod/applications/mod_fsk/fsk_callerid.h index 0813ba18b3..ce5b16615d 100644 --- a/src/mod/applications/mod_fsk/fsk_callerid.h +++ b/src/mod/applications/mod_fsk/fsk_callerid.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_fsk -- FSK data transfer diff --git a/src/mod/applications/mod_fsk/mod_fsk.c b/src/mod/applications/mod_fsk/mod_fsk.c index 566de16138..1e22cff74f 100644 --- a/src/mod/applications/mod_fsk/mod_fsk.c +++ b/src/mod/applications/mod_fsk/mod_fsk.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_fsk.c -- FSK data transfer @@ -36,7 +36,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fsk_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_fsk_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_fsk_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_fsk, mod_fsk_load, mod_fsk_shutdown, NULL); @@ -46,7 +46,7 @@ switch_status_t my_write_sample(int16_t *buf, size_t buflen, void *user_data) switch_buffer_t *buffer = (switch_buffer_t *) user_data; switch_buffer_write(buffer, buf, buflen * 2); - + return SWITCH_STATUS_SUCCESS; } @@ -62,7 +62,7 @@ static switch_status_t write_fsk_data(uint32_t rate, int32_t db, switch_buffer_t switch_size_t plen = 0; memset(&fsk_trans, 0, sizeof(fsk_trans)); - + time(&now); localtime_r(&now, &tm); strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm); @@ -91,7 +91,7 @@ static switch_status_t write_fsk_data(uint32_t rate, int32_t db, switch_buffer_t } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding [%s][%s]\n", hp->name, hp->value); - + if (!strcasecmp(name, "phone_num")) { fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NUM, (uint8_t *)hp->value, strlen(hp->value)); } else if (!strcasecmp(name, "phone_name")) { @@ -122,14 +122,14 @@ SWITCH_STANDARD_APP(fsk_send_function) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_frame_t *read_frame; switch_status_t status; - + if (data) { switch_ivr_sleep(session, 1000, SWITCH_TRUE, NULL); switch_core_session_send_dtmf_string(session, (const char *) data); switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL); } - + if (switch_core_session_set_codec_slin(session, &sdata) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "FAILURE\n"); @@ -139,7 +139,7 @@ SWITCH_STANDARD_APP(fsk_send_function) { switch_buffer_create_dynamic(&buffer, 1024, 2048, 0); switch_channel_get_variables(channel, &event); - + write_fsk_data(sdata.codec.implementation->actual_samples_per_second, -14, buffer, event, "fsk_"); while(switch_channel_ready(channel)) { @@ -149,14 +149,14 @@ SWITCH_STANDARD_APP(fsk_send_function) { break; } - if ((sdata.write_frame.datalen = switch_buffer_read(buffer, sdata.write_frame.data, + if ((sdata.write_frame.datalen = switch_buffer_read(buffer, sdata.write_frame.data, sdata.codec.implementation->decoded_bytes_per_packet)) <= 0) { break; } - + if (sdata.write_frame.datalen < sdata.codec.implementation->decoded_bytes_per_packet) { - memset((char *)sdata.write_frame.data + sdata.write_frame.datalen, 255, + memset((char *)sdata.write_frame.data + sdata.write_frame.datalen, 255, sdata.codec.implementation->decoded_bytes_per_packet - sdata.write_frame.datalen); sdata.write_frame.datalen = sdata.codec.implementation->decoded_bytes_per_packet; } @@ -168,7 +168,7 @@ SWITCH_STANDARD_APP(fsk_send_function) { switch_buffer_destroy(&buffer); switch_core_codec_destroy(&sdata.codec); switch_core_session_set_read_codec(session, NULL); - + } typedef struct { @@ -191,11 +191,11 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat case SWITCH_ABC_TYPE_INIT: { switch_codec_implementation_t read_impl = { 0 }; switch_core_session_get_read_impl(pvt->session, &read_impl); - + if (fsk_demod_init(&pvt->fsk_data, read_impl.actual_samples_per_second, pvt->fbuf, sizeof(pvt->fbuf))) { return SWITCH_FALSE; } - + break; } case SWITCH_ABC_TYPE_CLOSE: @@ -224,10 +224,10 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat int total = 0; switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA); - + while(fsk_data_parse(&pvt->fsk_data, &type, &sp, &mlen) == SWITCH_STATUS_SUCCESS) { char *varname = NULL, *val, *p; - + switch_copy_string(str, sp, mlen+1); *(str+mlen) = '\0'; switch_clean_string(str); @@ -258,7 +258,7 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat if (varname && val) { total++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n", switch_channel_get_name(channel), varname, val); switch_channel_set_variable(channel, varname, val); if (event) { @@ -272,21 +272,21 @@ static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_dat switch_event_destroy(&event); } } - + if (total && (app_var = switch_channel_get_variable(channel, "execute_on_fsk"))) { char *app_arg; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n", switch_channel_get_name(channel), app_var); if ((app_arg = strchr(app_var, ' '))) { *app_arg++ = '\0'; } switch_core_session_execute_application(pvt->session, app_var, app_arg); } - + pvt->skip = 10; } - + memset(rframe->data, 255, rframe->datalen); if (type == SWITCH_ABC_TYPE_READ_REPLACE) { @@ -359,12 +359,12 @@ switch_status_t fsk_detect_session(switch_core_session_t *session, const char *f } -SWITCH_STANDARD_APP(fsk_recv_function) +SWITCH_STANDARD_APP(fsk_recv_function) { fsk_detect_session(session, data); } -SWITCH_STANDARD_APP(fsk_display_function) +SWITCH_STANDARD_APP(fsk_display_function) { /* expected to be called via 'execute_on_fsk' -- passes display update over FSK */ @@ -380,7 +380,7 @@ SWITCH_STANDARD_APP(fsk_display_function) if (zstr(cid_name)) { cid_name = cid_num; } - + if (zstr(cid_num)) { return; } @@ -409,13 +409,13 @@ SWITCH_STANDARD_APP(fsk_display_function) } } -SWITCH_STANDARD_APP(fsk_simplify_function) +SWITCH_STANDARD_APP(fsk_simplify_function) { /* expected to be called via 'execute_on_fsk' -- redirects call to point-to-point and eliminates legs in the middle */ switch_channel_t *channel = switch_core_session_get_channel(session); const char *sip_uri, *fsk_simplify_profile, *fsk_simplify_context; char *bridgeto; - + if (!(sip_uri = switch_channel_get_variable(channel, "fsk_uri"))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Missing URI field!\n", switch_channel_get_name(channel)); } @@ -431,21 +431,21 @@ SWITCH_STANDARD_APP(fsk_simplify_function) switch_channel_t *pchannel; bridgeto = switch_core_session_sprintf(session, "bridge:sofia/%s/sip:%s", fsk_simplify_profile, sip_uri); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s transfering to [%s]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s transfering to [%s]\n", switch_channel_get_name(channel), bridgeto); - + if (switch_core_session_get_partner(session, &psession) == SWITCH_STATUS_SUCCESS) { pchannel = switch_core_session_get_channel(psession); switch_channel_set_flag(pchannel, CF_REDIRECT); switch_channel_set_flag(pchannel, CF_TRANSFER); } - + switch_ivr_session_transfer(session, bridgeto, "inline", fsk_simplify_context); if (psession) { switch_ivr_session_transfer(psession, "sleep:5000", "inline", NULL); - switch_core_session_rwunlock(psession); + switch_core_session_rwunlock(psession); } } } diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index e99022cee8..7408767719 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Seven Du * @@ -124,14 +124,14 @@ SWITCH_STANDARD_APP(record_fsv_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s waiting for video.\n", switch_channel_get_name(channel)); count = 100; if (!--sanity) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", switch_channel_get_name(channel)); switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Got timeout while waiting for video"); goto done; } } } - + if (!switch_channel_ready(channel)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not ready.\n", switch_channel_get_name(channel)); switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "Channel not ready"); @@ -241,7 +241,7 @@ SWITCH_STANDARD_APP(record_fsv_function) } break; } - + if (mutex) { switch_mutex_unlock(mutex); } @@ -442,7 +442,7 @@ SWITCH_STANDARD_APP(play_fsv_function) if (terminators && !strcasecmp(terminators, "none")) { terminators = NULL; - } + } if (terminators && strchr(terminators, dtmf.digit)) { @@ -452,7 +452,7 @@ SWITCH_STANDARD_APP(play_fsv_function) } } } - + } switch_core_thread_session_end(session); @@ -625,7 +625,7 @@ SWITCH_STANDARD_APP(play_yuv_function) break; } } - + if (read_frame) { memset(read_frame->data, 0, read_frame->datalen); switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); @@ -699,7 +699,7 @@ static void decode_video_thread(switch_core_session_t *session, void *obj) switch_core_session_request_video_refresh(session); count = 1; } - + if (frame && frame->datalen > 0) { switch_core_session_write_video_frame(session, frame, SWITCH_IO_FLAG_NONE, 0); diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index a7c2cb6aee..ed86ab34fb 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Ken Rice @@ -98,18 +98,18 @@ typedef struct { const char *username; const char *password; int port; - + int interval; - + esl_handle_t handle; switch_hash_t *index; switch_thread_rwlock_t *rwlock; switch_memory_pool_t *pool; - + switch_bool_t running; switch_thread_t *thread; - + limit_remote_state_t state; } limit_remote_t; @@ -232,24 +232,24 @@ SWITCH_HASH_DELETE_FUNC(limit_hash_cleanup_delete_callback) { if (item->total_usage == 0 && item->rate_usage == 0) { /* Noone is using this item anymore */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Freeing limit item: %s\n", (const char *) key); - + free(item); return SWITCH_TRUE; } - + return SWITCH_FALSE; } -SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback) +SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback) { limit_hash_item_t *item = (limit_hash_item_t *) val; switch_time_t now = (switch_time_t)(intptr_t)pData; - + if (item->last_update != now) { free(item); return SWITCH_TRUE; } - + return SWITCH_FALSE; } @@ -262,7 +262,7 @@ SWITCH_STANDARD_SCHED_FUNC(limit_hash_cleanup_callback) } switch_thread_rwlock_unlock(globals.limit_hash_rwlock); - if (globals.limit_hash) { + if (globals.limit_hash) { task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL; } } @@ -323,7 +323,7 @@ SWITCH_LIMIT_RELEASE(limit_release_hash) } switch_thread_rwlock_unlock(globals.limit_hash_rwlock); - + return SWITCH_STATUS_SUCCESS; } @@ -338,7 +338,7 @@ SWITCH_LIMIT_USAGE(limit_usage_hash) hash_key = switch_mprintf("%s_%s", realm, resource); remote_usage = get_remote_usage(hash_key); - + count = remote_usage.total_usage; *rcount = remote_usage.rate_usage; @@ -382,15 +382,15 @@ SWITCH_LIMIT_STATUS(limit_status_hash) switch_hash_index_t *hi = NULL; int count = 0; char *ret = NULL; - + switch_thread_rwlock_rdlock(globals.limit_hash_rwlock); - + for (hi = switch_core_hash_first(globals.limit_hash); hi; switch_core_hash_next(hi)) { count++; } - + switch_thread_rwlock_unlock(globals.limit_hash_rwlock); - + ret = switch_mprintf("There are %d elements being tracked.", count); return ret; */ @@ -577,7 +577,7 @@ SWITCH_STANDARD_API(hash_api_function) } #define HASH_DUMP_SYNTAX "all|limit|db []" -SWITCH_STANDARD_API(hash_dump_function) +SWITCH_STANDARD_API(hash_dump_function) { int mode; switch_hash_index_t *hi; @@ -586,7 +586,7 @@ SWITCH_STANDARD_API(hash_dump_function) char *mydata = NULL; int realm = 0; char *realmvalue = NULL; - + if (zstr(cmd)) { stream->write_function(stream, "Usage: "HASH_DUMP_SYNTAX"\n"); goto done; @@ -600,8 +600,8 @@ SWITCH_STANDARD_API(hash_dump_function) if (argc == 2) { realm = 1; realmvalue = switch_mprintf("%s_", argv[1]); - } - + } + if (!strcmp(cmd, "all")) { mode = 3; } else if (!strcmp(cmd, "limit")) { @@ -612,7 +612,7 @@ SWITCH_STANDARD_API(hash_dump_function) stream->write_function(stream, "Usage: "HASH_DUMP_SYNTAX"\n"); goto done; } - + if (mode & 1) { switch_thread_rwlock_rdlock(globals.limit_hash_rwlock); for (hi = switch_core_hash_first(globals.limit_hash); hi; hi = switch_core_hash_next(&hi)) { @@ -621,14 +621,14 @@ SWITCH_STANDARD_API(hash_dump_function) switch_ssize_t keylen; limit_hash_item_t *item; switch_core_hash_this(hi, &key, &keylen, &val); - + item = (limit_hash_item_t *)val; stream->write_function(stream, "L/%s/%d/%d/%d/%d\n", key, item->total_usage, item->rate_usage, item->interval, item->last_check); } switch_thread_rwlock_unlock(globals.limit_hash_rwlock); } - + if (mode & 2) { switch_thread_rwlock_rdlock(globals.db_hash_rwlock); for (hi = switch_core_hash_first(globals.db_hash); hi; hi = switch_core_hash_next(&hi)) { @@ -646,7 +646,7 @@ SWITCH_STANDARD_API(hash_dump_function) } switch_thread_rwlock_unlock(globals.db_hash_rwlock); } - + done: switch_safe_free(mydata); switch_safe_free(realmvalue); @@ -655,38 +655,38 @@ SWITCH_STANDARD_API(hash_dump_function) } #define HASH_REMOTE_SYNTAX "list|kill [name]|rescan" -SWITCH_STANDARD_API(hash_remote_function) +SWITCH_STANDARD_API(hash_remote_function) { //int argc; char *argv[10]; char *dup = NULL; - + if (zstr(cmd)) { stream->write_function(stream, "-ERR Usage: "HASH_REMOTE_SYNTAX"\n"); return SWITCH_STATUS_SUCCESS; } - + dup = strdup(cmd); - + switch_split(dup, ' ', argv); if (argv[0] && !strcmp(argv[0], "list")) { switch_hash_index_t *hi; stream->write_function(stream, "Remote connections:\nName\t\t\tState\n"); - + switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); for (hi = switch_core_hash_first(globals.remote_hash); hi; hi = switch_core_hash_next(&hi)) { - void *val; + void *val; const void *key; switch_ssize_t keylen; limit_remote_t *item; switch_core_hash_this(hi, &key, &keylen, &val); - + item = (limit_remote_t *)val; - stream->write_function(stream, "%s\t\t\t%s\n", item->name, state_str(item->state)); + stream->write_function(stream, "%s\t\t\t%s\n", item->name, state_str(item->state)); } switch_thread_rwlock_unlock(globals.remote_hash_rwlock); stream->write_function(stream, "+OK\n"); - + } else if (argv[0] && !strcmp(argv[0], "kill")) { const char *name = argv[1]; limit_remote_t *remote; @@ -697,15 +697,15 @@ SWITCH_STANDARD_API(hash_remote_function) switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); remote = switch_core_hash_find(globals.remote_hash, name); switch_thread_rwlock_unlock(globals.remote_hash_rwlock); - + if (remote) { limit_remote_destroy(&remote); switch_thread_rwlock_wrlock(globals.remote_hash_rwlock); switch_core_hash_delete(globals.remote_hash, name); switch_thread_rwlock_unlock(globals.remote_hash_rwlock); - - stream->write_function(stream, "+OK\n"); + + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR No such remote instance %s\n", name); } @@ -714,9 +714,9 @@ SWITCH_STANDARD_API(hash_remote_function) stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR Usage: "HASH_REMOTE_SYNTAX"\n"); - + } - + done: switch_safe_free(dup); @@ -724,11 +724,11 @@ done: return SWITCH_STATUS_SUCCESS; } -limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t port, const char *username, const char *password, int interval) +limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t port, const char *username, const char *password, int interval) { limit_remote_t *r; switch_memory_pool_t *pool; - + switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); if (switch_core_hash_find(globals.remote_hash, name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Already have a remote instance named %s\n", name); @@ -736,11 +736,11 @@ limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t return NULL; } switch_thread_rwlock_unlock(globals.remote_hash_rwlock); - + if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { return NULL; } - + r = switch_core_alloc(pool, sizeof(limit_remote_t)); r->pool = pool; r->name = switch_core_strdup(r->pool, name); @@ -749,10 +749,10 @@ limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t r->username = switch_core_strdup(r->pool, username); r->password = switch_core_strdup(r->pool, password); r->interval = interval; - + switch_thread_rwlock_create(&r->rwlock, pool); switch_core_hash_init(&r->index); - + switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); switch_core_hash_insert(globals.remote_hash, name, r); switch_thread_rwlock_unlock(globals.remote_hash_rwlock); @@ -776,17 +776,17 @@ void limit_remote_destroy(limit_remote_t **r) /* Free hashtable data */ for (hi = switch_core_hash_first((*r)->index); hi; hi = switch_core_hash_next(&hi)) { - void *val; + void *val; const void *key; switch_ssize_t keylen; switch_core_hash_this(hi, &key, &keylen, &val); free(val); } - + switch_thread_rwlock_unlock((*r)->rwlock); switch_thread_rwlock_destroy((*r)->rwlock); - + switch_core_destroy_memory_pool(&((*r)->pool)); *r = NULL; } @@ -796,21 +796,21 @@ void limit_remote_destroy(limit_remote_t **r) static limit_hash_item_t get_remote_usage(const char *key) { limit_hash_item_t usage = { 0 }; switch_hash_index_t *hi; - + switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); for (hi = switch_core_hash_first(globals.remote_hash); hi; hi = switch_core_hash_next(&hi)) { - void *val; + void *val; const void *hashkey; switch_ssize_t keylen; limit_remote_t *remote; limit_hash_item_t *item; switch_core_hash_this(hi, &hashkey, &keylen, &val); - + remote = (limit_remote_t *)val; if (remote->state != REMOTE_UP) { continue; } - + switch_thread_rwlock_rdlock(remote->rwlock); if ((item = switch_core_hash_find(remote->index, key))) { usage.total_usage += item->total_usage; @@ -821,9 +821,9 @@ static limit_hash_item_t get_remote_usage(const char *key) { } switch_thread_rwlock_unlock(remote->rwlock); } - + switch_thread_rwlock_unlock(globals.remote_hash_rwlock); - + return usage; } @@ -835,7 +835,7 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi if (esl_connect_timeout(&remote->handle, remote->host, (esl_port_t)remote->port, remote->username, remote->password, 5000) == ESL_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected to remote FreeSWITCH (%s) at %s:%d\n", remote->name, remote->host, remote->port); - + remote->state = REMOTE_UP; } else { esl_disconnect(&remote->handle); @@ -860,20 +860,20 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi switch_time_t now = switch_epoch_time_now(NULL); while (p && *p) { /* We are getting the limit data as: - L/key/usage/rate/interval/last_checked + L/key/usage/rate/interval/last_checked */ if ((p2 = strchr(p, '\n'))) { *p2++ = '\0'; } - - /* Now p points at the beginning of the current line, + + /* Now p points at the beginning of the current line, p2 at the start of the next one */ if (*p == 'L') { /* Limit data */ - char *argv[5]; + char *argv[5]; int argc = switch_split(p+2, '/', argv); - + if (argc < 5) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[%s] Protocol error: missing argument in line: %s\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "[%s] Protocol error: missing argument in line: %s\n", remote->name, p); } else { limit_hash_item_t *item; @@ -890,11 +890,11 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi switch_thread_rwlock_unlock(remote->rwlock); } } - + p = p2; } free(data); - + /* Now free up anything that wasn't in this update since it means their usage is 0 */ switch_thread_rwlock_wrlock(remote->rwlock); switch_core_hash_delete_multi(remote->index, limit_hash_remote_cleanup_callback, (void*)(intptr_t)now); @@ -902,12 +902,12 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi } } } - + switch_yield(remote->interval * 1000); } - + remote->thread = NULL; - + return NULL; } @@ -927,7 +927,7 @@ static void do_config(switch_bool_t reload) int interval = 0; limit_remote_t *remote; switch_threadattr_t *thd_attr = NULL; - + if (reload) { switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); if (switch_core_hash_find(globals.remote_hash, name)) { @@ -940,15 +940,15 @@ static void do_config(switch_bool_t reload) if (!zstr(szport)) { port = (uint16_t)atoi(szport); } - + if (!zstr(szinterval)) { interval = atoi(szinterval); } - + remote = limit_remote_create(name, host, port, username, password, interval); - - remote->state = REMOTE_DOWN; - + + remote->state = REMOTE_DOWN; + switch_threadattr_create(&thd_attr, remote->pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&remote->thread, thd_attr, limit_remote_thread, remote, remote->pool); @@ -990,24 +990,24 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_hash_load) switch_scheduler_add_task(switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL, limit_hash_cleanup_callback, "limit_hash_cleanup", "mod_hash", 0, NULL, SSHF_NONE); - + SWITCH_ADD_APP(app_interface, "hash", "Insert into the hashtable", HASH_DESC, hash_function, HASH_USAGE, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC) SWITCH_ADD_API(commands_api_interface, "hash", "hash get/set", hash_api_function, "[insert|delete|select]///"); SWITCH_ADD_API(commands_api_interface, "hash_dump", "dump hash/limit_hash data (used for synchronization)", hash_dump_function, HASH_DUMP_SYNTAX); SWITCH_ADD_API(commands_api_interface, "hash_remote", "hash remote", hash_remote_function, HASH_REMOTE_SYNTAX); - + switch_console_set_complete("add hash insert"); switch_console_set_complete("add hash delete"); switch_console_set_complete("add hash select"); - + switch_console_set_complete("add hash_remote list"); switch_console_set_complete("add hash_remote kill"); switch_console_set_complete("add hash_remote rescan"); - + do_config(SWITCH_FALSE); /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_SUCCESS; } @@ -1015,25 +1015,25 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) { switch_hash_index_t *hi = NULL; switch_bool_t remote_clean = SWITCH_TRUE; - + switch_scheduler_del_task_group("mod_hash"); /* Kill remote connections, destroy needs a wrlock so we unlock after finding a pointer */ while(remote_clean) { - void *val; + void *val; const void *key = NULL; switch_ssize_t keylen; limit_remote_t *item = NULL; - + switch_thread_rwlock_rdlock(globals.remote_hash_rwlock); if ((hi = switch_core_hash_first(globals.remote_hash))) { switch_core_hash_this(hi, &key, &keylen, &val); item = (limit_remote_t *)val; } switch_thread_rwlock_unlock(globals.remote_hash_rwlock); - - if (!item) { - remote_clean = SWITCH_FALSE; + + if (!item) { + remote_clean = SWITCH_FALSE; } else { limit_remote_destroy(&item); switch_thread_rwlock_wrlock(globals.remote_hash_rwlock); @@ -1044,7 +1044,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) switch_thread_rwlock_wrlock(globals.limit_hash_rwlock); switch_thread_rwlock_wrlock(globals.db_hash_rwlock); - + while ((hi = switch_core_hash_first_iter( globals.limit_hash, hi))) { void *val = NULL; const void *key; @@ -1053,7 +1053,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) free(val); switch_core_hash_delete(globals.limit_hash, key); } - + while ((hi = switch_core_hash_first_iter( globals.db_hash, hi))) { void *val = NULL; const void *key; @@ -1064,7 +1064,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) } switch_core_hash_destroy(&globals.limit_hash); - switch_core_hash_destroy(&globals.db_hash); + switch_core_hash_destroy(&globals.db_hash); switch_core_hash_destroy(&globals.remote_hash); switch_thread_rwlock_unlock(globals.limit_hash_rwlock); diff --git a/src/mod/applications/mod_hiredis/hiredis_profile.c b/src/mod/applications/mod_hiredis/hiredis_profile.c index f108e1ac75..a5fbec1da8 100644 --- a/src/mod/applications/mod_hiredis/hiredis_profile.c +++ b/src/mod/applications/mod_hiredis/hiredis_profile.c @@ -119,7 +119,7 @@ switch_status_t hiredis_profile_create(hiredis_profile_t **new_profile, char *na { hiredis_profile_t *profile = NULL; switch_memory_pool_t *pool = NULL; - + switch_core_new_memory_pool(&pool); profile = switch_core_alloc(pool, sizeof(hiredis_profile_t)); diff --git a/src/mod/applications/mod_hiredis/hiredis_utils.c b/src/mod/applications/mod_hiredis/hiredis_utils.c index 95e1503a0c..e90ba6c1ee 100644 --- a/src/mod/applications/mod_hiredis/hiredis_utils.c +++ b/src/mod/applications/mod_hiredis/hiredis_utils.c @@ -32,7 +32,7 @@ #include -switch_status_t mod_hiredis_do_config() +switch_status_t mod_hiredis_do_config() { char *conf = "hiredis.conf"; switch_xml_t xml, cfg, profiles, profile, connections, connection, params, param; @@ -43,7 +43,7 @@ switch_status_t mod_hiredis_do_config() } if ( (profiles = switch_xml_child(cfg, "profiles")) != NULL) { - for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) { + for (profile = switch_xml_child(profiles, "profile"); profile; profile = profile->next) { hiredis_profile_t *new_profile = NULL; uint8_t ignore_connect_fail = 0; uint8_t ignore_error = 0; @@ -79,10 +79,10 @@ switch_status_t mod_hiredis_do_config() /* Add connection to profile */ if ( (connections = switch_xml_child(profile, "connections")) != NULL) { - for (connection = switch_xml_child(connections, "connection"); connection; connection = connection->next) { + for (connection = switch_xml_child(connections, "connection"); connection; connection = connection->next) { char *host = NULL, *password = NULL; uint32_t port = 0, timeout_ms = 0, max_connections = 0; - + for (param = switch_xml_child(connection, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); if ( !strncmp(var, "hostname", 8) ) { @@ -114,9 +114,9 @@ switch_status_t mod_hiredis_do_config() switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profiles config is missing\n"); goto err; } - + return SWITCH_STATUS_SUCCESS; - + err: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n"); return SWITCH_STATUS_GENERR; diff --git a/src/mod/applications/mod_hiredis/mod_hiredis.c b/src/mod/applications/mod_hiredis/mod_hiredis.c index 6fe1a2db70..7472c0298a 100644 --- a/src/mod/applications/mod_hiredis/mod_hiredis.c +++ b/src/mod/applications/mod_hiredis/mod_hiredis.c @@ -457,7 +457,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hiredis_shutdown) } switch_core_hash_destroy(&(mod_hiredis_globals.profiles)); - + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/applications/mod_httapi/conf/autoload_configs/httapi.conf.xml b/src/mod/applications/mod_httapi/conf/autoload_configs/httapi.conf.xml index 68ab548183..e643566703 100644 --- a/src/mod/applications/mod_httapi/conf/autoload_configs/httapi.conf.xml +++ b/src/mod/applications/mod_httapi/conf/autoload_configs/httapi.conf.xml @@ -29,20 +29,20 @@ - - @@ -58,15 +58,15 @@ - @@ -79,11 +79,11 @@ - + - + diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 59b0148a35..76304f4dca 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Raymond Chandler * Seven Du @@ -238,7 +238,7 @@ SWITCH_STANDARD_API(httapi_api_function) static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) { action_binding_t *action_binding = (action_binding_t *) match->user_data; - + action_binding->client->matching_action_binding = action_binding; action_binding->match_digits = switch_core_strdup(action_binding->client->pool, match->match_digits); @@ -250,7 +250,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t action_binding_t *action_binding = (action_binding_t *) match->user_data; action_binding->client->no_matching_action_binding = action_binding; - + return SWITCH_STATUS_BREAK; } @@ -339,7 +339,7 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi } - if (client->profile->perms.get_vars && + if (client->profile->perms.get_vars && (!client->profile->var_params.get_var_list || switch_event_check_permission_list(client->profile->var_params.get_var_list, var))) { const char *vval = switch_channel_get_variable(client->channel, var); if (vval) { @@ -351,12 +351,12 @@ static switch_status_t parse_get_var(const char *tag_name, client_t *client, swi } return SWITCH_STATUS_SUCCESS; - + } static switch_status_t parse_continue(const char *tag_name, client_t *client, switch_xml_t tag, const char *body) { - + return SWITCH_STATUS_SUCCESS; } @@ -364,7 +364,7 @@ static switch_status_t parse_log(const char *tag_name, client_t *client, switch_ { const char *level = switch_xml_attr(tag, "level"); const char *clean = switch_xml_attr(tag, "clean"); - + if (switch_true(clean)) { console_clean_log(level, body); } else { @@ -414,7 +414,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw say_method = switch_xml_attr(tag, "method"); say_gender = switch_xml_attr(tag, "gender"); text = switch_xml_attr(tag, "text"); - + if (zstr(text)) { if (!zstr(file)) { text = file; @@ -427,9 +427,9 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "speak: missing required attributes or text! (language) (type) (method) \n"); return SWITCH_STATUS_FALSE; } - + say = 1; - + } else if (!strcasecmp(tag_name, "speak")) { tts_engine = switch_xml_attr(tag, "engine"); tts_voice = switch_xml_attr(tag, "voice"); @@ -470,7 +470,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw char *p; SWITCH_STANDARD_STREAM(stream); - + cmd = switch_mprintf("%s|name_path", id); switch_api_execute("vm_prefs", cmd, NULL, &stream); @@ -501,7 +501,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw text = free_string; switch_ivr_play_file(client->session, NULL, "voicemail/vm-person.wav", &nullargs); - + } switch_safe_free(resp); @@ -527,7 +527,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid digit timeout [%s]\n", digit_timeout_); } } - + if (input_timeout_) { tmp = atol(input_timeout_); @@ -541,7 +541,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw if ((bind = switch_xml_child(tag, "bind"))) { action_binding_t *action_binding; const char *realm = "default"; - + input++; @@ -550,9 +550,9 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw top_action_binding->action = (char *) action; top_action_binding->error_file = (char *)error_file; - switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, + switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, NULL, digit_nomatch_action_callback, top_action_binding); - + while(bind) { action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding)); action_binding->realm = (char *) realm; @@ -562,11 +562,11 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw action_binding->strip = (char *) switch_xml_attr(bind, "strip"); action_binding->error_file = (char *) error_file; action_binding->parent = top_action_binding; - + switch_ivr_dmachine_bind(dmachine, action_binding->realm, action_binding->input, 0, 0, digit_action_callback, action_binding); bind = bind->next; } - + switch_ivr_dmachine_set_realm(dmachine, realm); if (!zstr(terminators)) { switch_ivr_dmachine_set_terminators(dmachine, terminators); @@ -597,7 +597,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw char *result = NULL; status = switch_ivr_play_and_detect_speech(client->session, file, sp_engine, sp_grammar, &result, input_timeout, args); - + if (!zstr(result)) { switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, name, result); switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "input_type", "detected_speech"); @@ -642,7 +642,7 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw break; } } while (loops-- > 0); - + if (submit) { if (client->matching_action_binding) { @@ -660,26 +660,26 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, name, client->matching_action_binding->match_digits); switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "input_type", "dtmf"); } - + if (client->matching_action_binding->action) { sub_action = client->matching_action_binding->action; } else if (client->matching_action_binding->parent && client->matching_action_binding->parent->action) { sub_action = client->matching_action_binding->parent->action; } } - + if (!sub_action && top_action_binding && top_action_binding->action) { sub_action = top_action_binding->action; } - + if (sub_action && client->matching_action_binding && client->matching_action_binding->match_digits) { if (!strncasecmp(sub_action, "dial:", 5)) { char *context = NULL; char *dp = NULL; - + if (client->profile->perms.dial.set_context) { context = switch_core_session_strdup(client->session, sub_action + 5); - + if ((dp = strchr(context, ':'))) { *dp++ = '\0'; if (!client->profile->perms.dial.set_dp) { @@ -690,19 +690,19 @@ static switch_status_t parse_playback(const char *tag_name, client_t *client, sw switch_ivr_session_transfer(client->session, client->matching_action_binding->match_digits, dp, context); status = SWITCH_STATUS_FALSE; - + } else { switch_event_add_header_string(client->params, SWITCH_STACK_BOTTOM, "url", sub_action); } } } - + if (dmachine) { switch_ivr_dmachine_destroy(&dmachine); } switch_safe_free(free_string); - + return status; } @@ -713,7 +713,7 @@ static switch_status_t parse_conference(const char *tag_name, client_t *client, const char *profile_name = switch_xml_attr(tag, "profile"); const char *pin = switch_xml_attr(tag, "pin"); const char *flags = switch_xml_attr(tag, "flags"); - + if (!client->profile->perms.conference.enabled) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Permission Denied!\n"); switch_channel_hangup(client->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -742,7 +742,7 @@ static switch_status_t parse_conference(const char *tag_name, client_t *client, static switch_status_t parse_dial(const char *tag_name, client_t *client, switch_xml_t tag, const char *body) { - const char *context = NULL; + const char *context = NULL; const char *dp = NULL; const char *cid_name = NULL; const char *cid_number = NULL; @@ -779,7 +779,7 @@ static switch_status_t parse_dial(const char *tag_name, client_t *client, switch cid_number = switch_channel_get_variable(client->channel, "caller_id_number"); } - str = switch_core_session_sprintf(client->session, + str = switch_core_session_sprintf(client->session, "{origination_caller_id_name='%s',origination_caller_id_number='%s'}%s", cid_name, cid_number, body); switch_core_session_execute_application(client->session, "bridge", str); @@ -812,7 +812,7 @@ static switch_status_t parse_sms(const char *tag_name, client_t *client, switch_ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", switch_channel_get_variable(client->channel, "caller_id_number")); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain"); - + if (body) { switch_event_add_body(event, "%s", body); } @@ -856,7 +856,7 @@ static switch_status_t parse_execute(const char *tag_name, client_t *client, swi if (!client->profile->perms.expand_vars) { const char *p; - + for(p = data; p && *p; p++) { if (*p == '$') { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Expand Variables: Permission Denied!\n"); @@ -929,16 +929,16 @@ static switch_status_t parse_record_call(const char *tag_name, client_t *client, } else { client->record.action = (char *) action; client->record.name = (char *)name; - client->record.file = switch_core_session_sprintf(client->session, "%s%s%s.wav", + client->record.file = switch_core_session_sprintf(client->session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(client->session)); record_file = client->record.file; } - + if (limit_) { limit = atoi(limit_); if (limit < 0) limit = 0; } - + switch_ivr_record_session(client->session, (char *)record_file, limit, NULL); @@ -982,7 +982,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit if (zstr(file)) { return SWITCH_STATUS_FALSE; } - + fname = switch_core_strdup(client->pool, file); for(p = fname; p && *p; p++) { @@ -1006,7 +1006,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit tmp_record_path = fname; http = 1; } else { - tmp_record_path = switch_core_sprintf(client->pool, "%s%s%s_%s.%s", + tmp_record_path = switch_core_sprintf(client->pool, "%s%s%s_%s.%s", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, fname, ext); } @@ -1045,19 +1045,19 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid digit timeout [%s]\n", digit_timeout_); } } - + if ((bind = switch_xml_child(tag, "bind"))) { action_binding_t *action_binding; const char *realm = "default"; - + top_action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding)); top_action_binding->client = client; top_action_binding->action = (char *) action; top_action_binding->error_file = (char *)error_file; - switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, + switch_ivr_dmachine_create(&dmachine, "HTTAPI", NULL, digit_timeout, 0, NULL, digit_nomatch_action_callback, top_action_binding); - + while(bind) { action_binding = switch_core_session_alloc(client->session, sizeof(*action_binding)); action_binding->realm = (char *) realm; @@ -1066,11 +1066,11 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit action_binding->action = (char *) switch_xml_attr(bind, "action"); action_binding->error_file = (char *) error_file; action_binding->parent = top_action_binding; - + switch_ivr_dmachine_bind(dmachine, action_binding->realm, action_binding->input, 0, 0, digit_action_callback, action_binding); bind = bind->next; } - + switch_ivr_dmachine_set_realm(dmachine, realm); if (!zstr(terminators)) { switch_ivr_dmachine_set_terminators(dmachine, terminators); @@ -1092,7 +1092,7 @@ static switch_status_t parse_record(const char *tag_name, client_t *client, swit switch_file_handle_t fh = { 0 }; fh.thresh = thresh; fh.silence_hits = silence_hits; - + status = switch_ivr_record_file(client->session, &fh, tmp_record_path, args, record_limit); } @@ -1142,7 +1142,7 @@ static switch_status_t parse_common(const char *tag_name, client_t *client, swit if (tmp_action) { switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "url", tmp_action); } - + return SWITCH_STATUS_SUCCESS; } @@ -1155,7 +1155,7 @@ static switch_status_t parse_xml(client_t *client) if ((len = switch_buffer_peek_zerocopy(client->buffer, &bdata)) && switch_buffer_len(client->buffer) > len) { switch_xml_t xml, tag, category; - + if (globals.debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Debugging Return Data:\n%s\n", (char *)bdata); } @@ -1165,7 +1165,7 @@ static switch_status_t parse_xml(client_t *client) if (client->profile->perms.set_params) { if ((category = switch_xml_child(xml, "params"))) { tag = category->child; - + while(tag) { if (!zstr(tag->name)) { char *val = tag->txt; @@ -1182,7 +1182,7 @@ static switch_status_t parse_xml(client_t *client) if (client->profile->perms.set_vars) { if ((category = switch_xml_child(xml, "variables"))) { tag = category->child; - + while(tag) { if (!zstr(tag->name)) { char *val = tag->txt; @@ -1190,8 +1190,8 @@ static switch_status_t parse_xml(client_t *client) val = NULL; } - if (client->profile->perms.set_vars && - (!client->profile->var_params.set_var_list || + if (client->profile->perms.set_vars && + (!client->profile->var_params.set_var_list || switch_event_check_permission_list(client->profile->var_params.set_var_list, tag->name))) { switch_channel_set_variable(client->channel, tag->name, val); } else { @@ -1204,7 +1204,7 @@ static switch_status_t parse_xml(client_t *client) } if ((category = switch_xml_child(xml, "work"))) { - + tag = category->child; status = SWITCH_STATUS_SUCCESS; @@ -1219,18 +1219,18 @@ static switch_status_t parse_xml(client_t *client) if (tag->txt && client->profile->perms.expand_vars) { switch_channel_get_variables(client->channel, &templ_data); switch_event_merge(templ_data, client->params); - expanded = switch_event_expand_headers_check(templ_data, tag->txt, - client->profile->var_params.expand_var_list, + expanded = switch_event_expand_headers_check(templ_data, tag->txt, + client->profile->var_params.expand_var_list, client->profile->var_params.api_list, 0); switch_event_destroy(&templ_data); } runs++; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Process Tag: [%s]\n", tag->name); - + parse_common(tag->name, client, tag, expanded); status = handler(tag->name, client, tag, expanded); - + if (expanded && expanded != tag->txt) { free(expanded); } @@ -1249,15 +1249,15 @@ static switch_status_t parse_xml(client_t *client) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No instructions found in result!\n"); status = SWITCH_STATUS_FALSE; } - + switch_xml_free(xml); } } - + return status; } - + static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *userdata) { @@ -1285,7 +1285,7 @@ static size_t get_header_callback(void *ptr, size_t size, size_t nmemb, void *us switch_event_add_header_string(client->headers, SWITCH_STACK_BOTTOM, header, val); } - + switch_safe_free(header); return realsize; } @@ -1305,7 +1305,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data) } switch_buffer_write(client->buffer, ptr, realsize); - + return realsize; } @@ -1313,7 +1313,7 @@ static void client_destroy(client_t **client) { if (client && *client) { switch_memory_pool_t *pool; - + switch_event_destroy(&(*client)->headers); switch_event_destroy(&(*client)->params); switch_event_destroy(&(*client)->one_time_params); @@ -1333,7 +1333,7 @@ static void client_reset(client_t *client) switch_event_destroy(&client->one_time_params); switch_event_create(&client->one_time_params, SWITCH_EVENT_CLONE); client->one_time_params->flags |= EF_UNIQ_HEADERS; - + switch_event_create(&client->headers, SWITCH_EVENT_CLONE); @@ -1367,13 +1367,13 @@ static client_t *client_create(switch_core_session_t *session, const char *profi client->pool = pool; switch_event_create(&client->headers, SWITCH_EVENT_CLONE); - + if (session) { client->session = session; client->channel = switch_core_session_get_channel(session); } - + client->profile = profile; client->max_bytes = HTTAPI_MAX_API_BYTES; @@ -1406,7 +1406,7 @@ static void cleanup_attachments(client_t *client) if (switch_file_exists(hp->value, client->pool) == SWITCH_STATUS_SUCCESS) { unlink(hp->value); } - } + } } } @@ -1416,7 +1416,7 @@ size_t put_file_read( void *ptr, size_t size, size_t nmemb, void *userdata) } static switch_status_t httapi_sync(client_t *client) - + { switch_CURL *curl_handle = NULL; char *data = NULL; @@ -1433,7 +1433,7 @@ static switch_status_t httapi_sync(client_t *client) FILE *fd = NULL; char *creds, *dup_creds = NULL, *ua = NULL; - + if (client->one_time_params && client->one_time_params->headers) { save_params = client->params; switch_event_dup(&client->params, save_params); @@ -1449,7 +1449,7 @@ static switch_status_t httapi_sync(client_t *client) if (zstr(ua)) { ua = client->profile->ua; } - + if (!(session_id = switch_event_get_header(client->params, "HTTAPI_SESSION_ID"))) { if (client->channel && !(session_id = switch_channel_get_variable(client->channel, "HTTAPI_SESSION_ID"))) { session_id = switch_core_session_get_uuid(client->session); @@ -1471,7 +1471,7 @@ static switch_status_t httapi_sync(client_t *client) } get_style_method = method ? strcasecmp(method, "post") : 1; - + switch_event_add_header_string(client->params, SWITCH_STACK_TOP, "session_id", session_id); dynamic_url = switch_event_expand_headers(client->params, url); @@ -1484,7 +1484,7 @@ static switch_status_t httapi_sync(client_t *client) } if (!put_file) { - switch_curl_process_form_post_params(client->params, curl_handle, &formpost); + switch_curl_process_form_post_params(client->params, curl_handle, &formpost); } if (formpost) { @@ -1495,11 +1495,11 @@ static switch_status_t httapi_sync(client_t *client) if (get_style_method) { char *tmp = switch_mprintf("%s%c%s", dynamic_url, strchr(dynamic_url, '?') != NULL ? '&' : '?', data); - + if (dynamic_url != url) { free(dynamic_url); } - + dynamic_url = tmp; } } @@ -1525,7 +1525,7 @@ static switch_status_t httapi_sync(client_t *client) if ((p = strstr(q, "://"))) { *(p+3) = '\0'; } - + p = switch_mprintf("%s%s", q, r); if (p) { free(dynamic_url); @@ -1546,9 +1546,9 @@ static switch_status_t httapi_sync(client_t *client) *p = '\0'; if ((q = strchr(dup_creds, '@'))) *q = '\0'; - + creds = dup_creds; - + p = switch_mprintf("%s%s", p, use_url); free(dynamic_url); dynamic_url = p; @@ -1593,7 +1593,7 @@ static switch_status_t httapi_sync(client_t *client) curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl_handle, CURLOPT_READDATA, fd); curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, put_file_read); - + } else if (formpost) { curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost); } else { @@ -1646,7 +1646,7 @@ static switch_status_t httapi_sync(client_t *client) } else { switch_curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); } - + if (client->profile->ssl_cacert_file) { switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, client->profile->ssl_cacert_file); @@ -1891,7 +1891,7 @@ static switch_status_t do_config(void) profile->perms.set_params = 1; profile->perms.conference.enabled = 1; profile->perms.dial.enabled = 1; - + if ((tag = switch_xml_child(profile_tag, "conference"))) { for (param = switch_xml_child(tag, "param"); param; param = param->next) { @@ -1937,7 +1937,7 @@ static switch_status_t do_config(void) switch_xml_t x_list, x_var; if ((x_list = switch_xml_child(param, "variable-list"))) { char *var = (char *) switch_xml_attr_soft(param, "default"); - + profile->var_params.default_allow = (var && !strcasecmp(var, "allow")); switch_event_create(&profile->var_params.set_var_list, SWITCH_EVENT_CLONE); profile->var_params.set_var_list->flags |= EF_UNIQ_HEADERS; @@ -1965,7 +1965,7 @@ static switch_status_t do_config(void) switch_xml_t x_list, x_var; if ((x_list = switch_xml_child(param, "variable-list"))) { char *var = (char *) switch_xml_attr_soft(param, "default"); - + profile->var_params.default_allow = (var && !strcasecmp(var, "allow")); switch_event_create(&profile->var_params.get_var_list, SWITCH_EVENT_CLONE); profile->var_params.get_var_list->flags |= EF_UNIQ_HEADERS; @@ -1990,12 +1990,12 @@ static switch_status_t do_config(void) profile->perms.extended_data = switch_true_byte(val); } else if (!strcasecmp(var, "execute-apps")) { profile->perms.execute_apps = switch_true_byte(val); - + if (profile->perms.execute_apps) { switch_xml_t x_list, x_app; if ((x_list = switch_xml_child(param, "application-list"))) { char *var = (char *) switch_xml_attr_soft(param, "default"); - + profile->dial_params.default_allow = (var && !strcasecmp(var, "allow")); switch_event_create(&profile->dial_params.app_list, SWITCH_EVENT_CLONE); profile->dial_params.app_list->flags |= EF_UNIQ_HEADERS; @@ -2016,7 +2016,7 @@ static switch_status_t do_config(void) } } } - + } else if (!strcasecmp(var, "expand-vars")) { profile->perms.expand_vars = switch_true_byte(val); @@ -2024,7 +2024,7 @@ static switch_status_t do_config(void) switch_xml_t x_list, x_var, x_api; if ((x_list = switch_xml_child(param, "variable-list"))) { char *var = (char *) switch_xml_attr_soft(param, "default"); - + profile->var_params.default_allow = (var && !strcasecmp(var, "allow")); switch_event_create(&profile->var_params.expand_var_list, SWITCH_EVENT_CLONE); profile->var_params.expand_var_list->flags |= EF_UNIQ_HEADERS; @@ -2047,7 +2047,7 @@ static switch_status_t do_config(void) if ((x_list = switch_xml_child(param, "api-list"))) { char *api = (char *) switch_xml_attr_soft(param, "default"); - + profile->var_params.default_allow = (api && !strcasecmp(api, "allow")); switch_event_create(&profile->var_params.api_list, SWITCH_EVENT_CLONE); profile->var_params.api_list->flags |= EF_UNIQ_HEADERS; @@ -2202,7 +2202,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "exiting", "true"); - + if (client->record.file) { char *key = switch_core_sprintf(client->pool, "attach_file:%s:%s.wav", client->record.name, switch_core_session_get_uuid(session)); switch_ivr_stop_record_session(client->session, client->record.file); @@ -2221,7 +2221,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_event_add_header_string(client->one_time_params, SWITCH_STACK_BOTTOM, "exiting", "true"); } } - + httapi_sync(client); client_destroy(&client); @@ -2264,7 +2264,7 @@ SWITCH_STANDARD_APP(httapi_function) } else { url = data; } - + if (!zstr(url) && switch_stristr("://", url)) { if (!params) { switch_event_create(¶ms, SWITCH_EVENT_CLONE); @@ -2288,7 +2288,7 @@ SWITCH_STANDARD_APP(httapi_function) if (zstr(profile_name) && !(profile_name = switch_channel_get_variable(channel, "httapi_profile"))) { profile_name = "default"; } - + if ((client = client_create(session, profile_name, ¶ms))) { switch_channel_set_private(channel, "_HTTAPI_CLIENT_", client); switch_channel_add_state_handler(channel, &state_handlers); @@ -2346,7 +2346,7 @@ SWITCH_STANDARD_APP(httapi_function) switch_safe_free(parsed); - + } @@ -2355,7 +2355,7 @@ SWITCH_STANDARD_APP(httapi_function) static const char *find_ext(const char *in) { const char *p = in + (strlen(in) - 1); - + while(p >= in && *p) { if (*p == '/') return NULL; if (*p == '.') return (p+1); @@ -2379,11 +2379,11 @@ static char *load_cache_data(http_file_context_t *context, const char *url) if (context->url_params) { ext = switch_event_get_header(context->url_params, "ext"); } - + if (zstr(ext)) { ext = find_ext(url); } - + if (ext && (p = strchr(ext, '?'))) { dext = strdup(ext); if ((p = strchr(dext, '?'))) { @@ -2432,7 +2432,7 @@ static size_t save_file_callback(void *ptr, size_t size, size_t nmemb, void *dat unsigned char *buffer = (unsigned char *) ptr; client->bytes += realsize; - + if (client->bytes > client->max_bytes) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int) client->bytes); client->err = 1; @@ -2468,14 +2468,14 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char const char *profile_name = NULL; int tries = 10; - if (context->url_params) { + if (context->url_params) { profile_name = switch_event_get_header(context->url_params, "profile_name"); } if (zstr(profile_name)) { if (globals.profile) profile_name = globals.profile->name; } - + if (zstr(profile_name)) { profile_name = "default"; } @@ -2500,7 +2500,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char if (context->url_params) { ua = switch_event_get_header(context->url_params, "user_agent"); } - + if (zstr(ua)) { ua = "mod_httapi/1.0"; } @@ -2520,7 +2520,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char if ((p = strstr(q, "://"))) { *(p+3) = '\0'; } - + p = switch_mprintf("%s%s", q, r); dynamic_url = p; free(q); @@ -2617,12 +2617,12 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); switch_curl_easy_setopt(curl_handle, CURLOPT_USERPWD, dup_creds); } - + switch_curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, ua); switch_curl_easy_perform(curl_handle); switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &code); switch_curl_easy_cleanup(curl_handle); - + if (client->fd > -1) { close(client->fd); client->fd = -1; @@ -2645,7 +2645,7 @@ static switch_status_t fetch_cache_data(http_file_context_t *context, const char case 404: status = SWITCH_STATUS_NOTFOUND; break; - + default: status = SWITCH_STATUS_FALSE; break; @@ -2695,7 +2695,7 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char } else if (headers && (cc = switch_event_get_header(headers, "Cache-Control"))) { if ((p = switch_stristr("max-age=", cc))) { p += 8; - + if (!zstr(p)) { x = atoi(p); @@ -2710,11 +2710,11 @@ static switch_status_t write_meta_file(http_file_context_t *context, const char } } - switch_snprintf(write_data, sizeof(write_data), + switch_snprintf(write_data, sizeof(write_data), "%" TIME_T_FMT ":%s", switch_epoch_time_now(NULL) + ttl, data); - + status = write(fd, write_data, (int)strlen(write_data) + 1) > 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } @@ -2737,7 +2737,7 @@ static void lock_file(http_file_context_t *context, switch_bool_t lock) switch_yield(100000); } } while(x); - + switch_core_hash_insert(globals.request_hash, context->dest_url, (void *)1); switch_mutex_unlock(globals.request_mutex); } else { @@ -2768,7 +2768,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char if (context->url_params) { ext = switch_event_get_header(context->url_params, "ext"); } - + if (zstr(ext)) { ext = find_ext(context->cache_file); } @@ -2787,7 +2787,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char unreachable = 1; } } - + if (zstr(ext) && headers && (ct = switch_event_get_header(headers, "content-type"))) { newext = switch_core_mime_type2ext(ct); } @@ -2803,7 +2803,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char status = SWITCH_STATUS_NOTFOUND; goto end; } - + if (!unreachable && !zstr(context->metadata)) { metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s", url, @@ -2818,7 +2818,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char switch_goto_status(SWITCH_STATUS_SUCCESS, end); } } - + switch_event_destroy(&headers); } @@ -2836,9 +2836,9 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char switch_event_get_header_nil(headers, "content-length"), ext ); - + write_meta_file(context, metadata, headers); - + if (switch_file_exists(context->cache_file, context->pool) == SWITCH_STATUS_SUCCESS) { status = SWITCH_STATUS_SUCCESS; } @@ -2851,7 +2851,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char } switch_event_destroy(&headers); - + return status; } @@ -2916,21 +2916,21 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path, context->fh.samples = handle->samples; context->fh.samplerate = handle->samplerate; context->fh.prefix = handle->prefix; - - + + if (context->url_params) { context->write.file_name = switch_event_get_header(context->url_params, "file"); context->write.profile_name = switch_event_get_header(context->url_params, "profile"); context->write.method = switch_event_get_header(context->url_params, "method"); context->write.name = switch_event_get_header(context->url_params, "name"); } - + if (!context->write.file_name) { char *p; if ((p = strrchr(context->dest_url, '/'))) { p++; context->write.file_name = switch_core_strdup(context->pool, p); - } + } } if (!context->write.file_name) { @@ -2943,16 +2943,16 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path, } else { ext = "wav"; } - + if (!context->write.profile_name) context->write.profile_name = "default"; if (!context->write.method) context->write.method = !strcasecmp(ext, "cgi") ? "post" : "put"; if (!context->write.name) context->write.name = "recorded_file"; switch_uuid_str(context->write.uuid_str, sizeof(context->write.uuid_str)); - + context->write.file = switch_core_sprintf(context->pool, "%s%s%s_%s", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, context->write.uuid_str, context->write.file_name); - + if (switch_core_file_open(&context->fh, context->write.file, handle->channels, handle->samplerate, handle->flags, NULL) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_GENERR; @@ -2971,11 +2971,11 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path, if (status != SWITCH_STATUS_SUCCESS) { return status; } - + if ((status = switch_core_file_open(&context->fh, - context->cache_file, - handle->channels, - handle->samplerate, + context->cache_file, + handle->channels, + handle->samplerate, handle->flags, NULL)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid cache file %s opening url %s Discarding file.\n", context->cache_file, path); unlink(context->cache_file); @@ -3051,12 +3051,12 @@ static switch_status_t http_file_file_close(switch_file_handle_t *handle) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find suitable profile\n"); switch_event_destroy(¶ms); } - + unlink(context->write.file); return SWITCH_STATUS_SUCCESS; } - + if (context->del_on_close) { if (context->cache_file) { unlink(context->cache_file); @@ -3075,7 +3075,7 @@ static switch_status_t http_file_file_close(switch_file_handle_t *handle) static switch_status_t http_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags) { http_file_context_t *context = handle->private_info; - + return switch_core_file_read_video(&context->fh, frame, flags); } @@ -3089,7 +3089,7 @@ static switch_status_t http_file_write_video(switch_file_handle_t *handle, switc static switch_status_t http_file_write(switch_file_handle_t *handle, void *data, size_t *len) { http_file_context_t *context = handle->private_info; - + return switch_core_file_write(&context->fh, data, len); } @@ -3127,7 +3127,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) switch_application_interface_t *app_interface; switch_file_interface_t *http_file_interface; switch_file_interface_t *https_file_interface; - + /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -3165,11 +3165,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) https_file_interface->file_seek = http_file_file_seek; https_file_interface->file_read_video = http_file_read_video; https_file_interface->file_write_video = http_file_write_video; - + switch_snprintf(globals.cache_path, sizeof(globals.cache_path), "%s%shttp_file_cache", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR); switch_dir_make_recursive(globals.cache_path, SWITCH_DEFAULT_DIR_PERMS, pool); - + switch_core_hash_init(&globals.profile_hash); switch_core_hash_init(&globals.request_hash); switch_core_hash_init_case(&globals.parse_hash, SWITCH_FALSE); @@ -3198,14 +3198,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) if (do_config() != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } - + SWITCH_ADD_API(httapi_api_interface, "httapi", "HT-TAPI Hypertext Telephony API", httapi_api_function, HTTAPI_SYNTAX); - SWITCH_ADD_APP(app_interface, "httapi", - "HT-TAPI Hypertext Telephony API", + SWITCH_ADD_APP(app_interface, "httapi", + "HT-TAPI Hypertext Telephony API", "HT-TAPI Hypertext Telephony API", httapi_function, "{=}", SAF_SUPPORT_NOMEDIA); - + switch_console_set_complete("add httapi debug_on"); @@ -3233,9 +3233,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_httapi_shutdown) } - switch_core_hash_destroy(&globals.profile_hash); - switch_core_hash_destroy(&globals.parse_hash); - + switch_core_hash_destroy(&globals.profile_hash); + switch_core_hash_destroy(&globals.parse_hash); + while (globals.hash_root) { ptr = globals.hash_root; switch_core_hash_destroy(&ptr->hash); diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 92c88e54b9..6e753d3f53 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -359,7 +359,7 @@ static switch_status_t http_put(url_cache_t *cache, http_profile_t *profile, swi switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url); - /* we want to use our own read function so we can send a portion of the file */ + /* we want to use our own read function so we can send a portion of the file */ switch_curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, read_callback); switch_curl_easy_setopt(curl_handle, CURLOPT_READDATA, &block_info); diff --git a/src/mod/applications/mod_http_cache/test_aws/main.c b/src/mod/applications/mod_http_cache/test_aws/main.c index 77b5ee99f2..2608802fbb 100644 --- a/src/mod/applications/mod_http_cache/test_aws/main.c +++ b/src/mod/applications/mod_http_cache/test_aws/main.c @@ -86,7 +86,7 @@ static void test_parse_url(void) parse_url(strdup("https://my-bucket-with-dash.s3-us-west-2.amazonaws.com/greeting/file/1002/Lumino.mp3"), NULL, "s3", &bucket, &object); ASSERT_STRING_EQUALS("my-bucket-with-dash", bucket); ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object); - + parse_url(strdup("http://quotes.s3.foo.bar.s3.amazonaws.com/greeting/file/1002/Lumino.mp3"), NULL, "s3", &bucket, &object); ASSERT_STRING_EQUALS("quotes.s3.foo.bar", bucket); ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object); diff --git a/src/mod/applications/mod_ladspa/conf/dialplan/00_ladspa.xml b/src/mod/applications/mod_ladspa/conf/dialplan/00_ladspa.xml index a26b193ef5..c950e1b3c0 100644 --- a/src/mod/applications/mod_ladspa/conf/dialplan/00_ladspa.xml +++ b/src/mod/applications/mod_ladspa/conf/dialplan/00_ladspa.xml @@ -1,5 +1,5 @@ - + @@ -8,9 +8,9 @@ - - - + + + diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index ffec25f7a8..af460e7523 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_snom.c -- SNOM Specific Features diff --git a/src/mod/applications/mod_sonar/mod_sonar.c b/src/mod/applications/mod_sonar/mod_sonar.c index ebf641a351..52bd5ebf17 100644 --- a/src/mod/applications/mod_sonar/mod_sonar.c +++ b/src/mod/applications/mod_sonar/mod_sonar.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,13 +22,13 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * William King * Seven Du * * mod_sonar.c -- Sonar ping timer * - * + * */ /* @@ -54,7 +54,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_sonar_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_sonar, mod_sonar_load, mod_sonar_shutdown, NULL); @@ -95,7 +95,7 @@ switch_bool_t sonar_ping_callback(switch_core_session_t *session, const char *ap ph->max = MAX(ph->max, diff); ph->min = MIN(ph->min, diff); ph->samples[ph->received++] = diff; - + return SWITCH_TRUE; } @@ -123,16 +123,16 @@ SWITCH_STANDARD_APP(sonar_app) } else if (loops > 1024) { loops = 1024; } - + switch_channel_answer(channel); switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL); switch_channel_set_private(channel, "__sonar_ping__", &ph); - switch_ivr_tone_detect_session(session, + switch_ivr_tone_detect_session(session, "soar_ping", "1004", - "r", 0, + "r", 0, 1, NULL, NULL, sonar_ping_callback); - + switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL); ph.min = 999999; @@ -147,7 +147,7 @@ SWITCH_STANDARD_APP(sonar_app) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost sonar ping\n"); } } - + switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL); switch_ivr_stop_tone_detect_session(session); @@ -223,7 +223,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load) return SWITCH_STATUS_TERM; } - + /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -240,7 +240,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown) { switch_event_free_subclass("sonar::ping"); - + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp index decc7ae848..734a09ba4e 100644 --- a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp +++ b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_soundtouch.cpp -- Example of writeable media bugs @@ -293,7 +293,7 @@ SWITCH_STANDARD_APP(soundtouch_start_function) n++; } else if (strchr(argv[x], 's')) { /*12.0f taken from soundtouch conversion to octaves*/ - sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); + sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); n++; } else if (strchr(argv[x], 't')) { sth->tempo = normalize_soundtouch_value('t', atof(argv[x])); @@ -405,7 +405,7 @@ SWITCH_STANDARD_API(soundtouch_api_function) n++; } else if (strchr(argv[x], 's')) { /*12.0f taken from soundtouch conversion to octaves*/ - sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); + sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) ); n++; } else if (strchr(argv[x], 't')) { sth->tempo = normalize_soundtouch_value('t', atof(argv[x])); @@ -450,9 +450,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load) switch_api_interface_t *api_interface; /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); + *module_interface = switch_loadable_module_create_module_interface(pool, modname); - SWITCH_ADD_APP(app_interface, "soundtouch", "Alter the audio stream", "Alter the audio stream pitch/rate/tempo", + SWITCH_ADD_APP(app_interface, "soundtouch", "Alter the audio stream", "Alter the audio stream pitch/rate/tempo", soundtouch_start_function, "[send_leg] [hook_dtmf] [-]s [-]o p r t", SAF_NONE); SWITCH_ADD_API(api_interface, "soundtouch", "soundtouch", soundtouch_api_function, SOUNDTOUCH_API_SYNTAX); diff --git a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml index da5d2f3fe9..5979819f42 100644 --- a/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml +++ b/src/mod/applications/mod_spandsp/conf/autoload_configs/spandsp.conf.xml @@ -1,7 +1,7 @@ - + diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 27089ada4f..6e14ca5095 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Bret McDanel * John Wehle (john@feith.com) @@ -211,7 +211,7 @@ switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile) switch_cache_db_handle_t *dbh = NULL; char *dsn; - + if (!zstr(profile->odbc_dsn)) { dsn = profile->odbc_dsn; } else { @@ -221,7 +221,7 @@ switch_cache_db_handle_t *vm_get_db_handle(vm_profile_t *profile) if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { dbh = NULL; } - + return dbh; } @@ -537,7 +537,7 @@ static switch_status_t vm_config_validate_samplerate(switch_xml_config_item_t *i } /*! - * \brief Sets the profile's configuration instructions + * \brief Sets the profile's configuration instructions */ vm_profile_t *profile_set_config(vm_profile_t *profile) { @@ -546,7 +546,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) profile->config_str_pool.pool = profile->pool; /* - SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, + SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, pointer, default, options, help_syntax, help_description) */ @@ -689,7 +689,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) &profile->db_password_override, SWITCH_FALSE, NULL, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "allow-empty-password-auth", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->allow_empty_password_auth, SWITCH_TRUE, NULL, NULL, NULL); - SWITCH_CONFIG_SET_ITEM(profile->config[i++], "auto-playback-recordings", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->auto_playback_recordings, SWITCH_FALSE, NULL, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(profile->config[i++], "auto-playback-recordings", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->auto_playback_recordings, SWITCH_FALSE, NULL, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "send-full-vm-header", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->send_full_vm_header, SWITCH_FALSE, NULL, NULL, NULL); switch_assert(i < VM_PROFILE_CONFIGITEM_COUNT); @@ -917,7 +917,7 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key - || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key + || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key || dtmf->digit == *cc->profile->repeat_msg_key || dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key || dtmf->digit == *cc->profile->forward_key)) { @@ -1601,16 +1601,16 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t msg.string_arg = cid_buf; msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending display update [%s] to %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending display update [%s] to %s\n", cid_buf, switch_channel_get_name(channel)); switch_core_session_receive_message(session, &msg); - + if (!zstr(cbt->cid_number) && (switch_true(switch_channel_get_variable(channel, "vm_announce_cid")))) { TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_PHONE_NUMBER_MACRO, cbt->cid_number, NULL, NULL)); } - + args.input_callback = cancel_on_dtmf; - + switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->repeat_msg_key, profile->save_file_key, profile->delete_file_key, profile->email_key, profile->callback_key, profile->forward_key, cbt->email ? ":" : "", cbt->email ? cbt->email : ""); @@ -1726,7 +1726,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t TRY_CODE(switch_ivr_read (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0)); - cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name, + cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name, new_file_path, cbt->cid_number, cbt->cid_name); switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); @@ -1734,9 +1734,9 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t status = switch_xml_locate_user_merged("id:number-alias", vm_cc, cbt->domain, NULL, &x_user, my_params); switch_event_destroy(&my_params); - + if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain); TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); continue; @@ -1914,7 +1914,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t static void update_mwi(vm_profile_t *profile, const char *id, const char *domain_name, const char *myfolder, mwi_reason_t reason) { const char *yn = "no"; - const char *update_reason = mwi_reason2str(reason); + const char *update_reason = mwi_reason2str(reason); int total_new_messages = 0; int total_saved_messages = 0; int total_new_urgent_messages = 0; @@ -2043,7 +2043,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (vm_auto_play && !switch_true(vm_auto_play)) { auto_play = 0; } - + folder_args.input_callback = cancel_on_dtmf; folder_args.buf = &global_buf; folder_args.buflen = sizeof(global_buf); @@ -2084,7 +2084,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p continue; } } - + if (auto_play && !heard_auto_new && total_new_messages + total_new_urgent_messages > 0) { heard_auto_new = 1; play_msg_type = MSG_NEW; @@ -2158,7 +2158,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p } else if (cbt.move == VM_MOVE_SAME) { cur_message -= 1; } - + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { break; } @@ -2280,7 +2280,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE, NULL, NULL)); switch_file_rename(tmp_file_path, file_path, switch_core_session_get_pool(session)); - + sql = switch_mprintf("update voicemail_prefs set greeting_path='%q' where username='%q' and domain='%q'", file_path, myid, domain_name); @@ -2311,7 +2311,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p fail = 0; switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", VM_ENTER_PASS_MACRO, profile->terminator_key); TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key, 0)); - + switch_event_create_subclass(¶ms, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Action", "change-password"); @@ -2319,23 +2319,23 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name); switch_channel_event_set_data(channel, params); - + if (zstr(buf) && !profile->allow_empty_password_auth) { fail = 1; } if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"), &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) { switch_xml_t x_result; - + if ((x_result = switch_xml_child(xx_user, "result"))) { if (!switch_true(switch_xml_attr_soft(x_result, "success"))) { fail = 1; } } - + switch_xml_free(xx_domain_root); } - + if (fail) { /* add feedback for user - let him/her know that the password they tried to change to is not allowed */ switch_ivr_phrase_macro(session, VM_CHANGE_PASS_FAIL_MACRO, NULL, NULL, NULL); @@ -2718,9 +2718,9 @@ static switch_status_t deliver_vm(vm_profile_t *profile, const char *read_flags, switch_event_t *params, switch_memory_pool_t *pool, - const char *caller_id_name, - const char *caller_id_number, - const char *forwarded_by, + const char *caller_id_name, + const char *caller_id_number, + const char *forwarded_by, switch_bool_t copy, const char *use_uuid, switch_core_session_t *session) { char *file_path = NULL, *dir_path = NULL; @@ -2964,7 +2964,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_account", myid); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_domain", domain_name); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_number", caller_id_number); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_formatted_caller_id_number", formatted_cid_num); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_formatted_caller_id_number", formatted_cid_num); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_caller_id_name", caller_id_name); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_file_path", file_path); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_read_flags", read_flags); @@ -3055,7 +3055,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, if (zstr(vm_notify_email)) { vm_notify_email = vm_email; } - + if (zstr(profile->notify_email_headers)) { headers = switch_mprintf("From: FreeSWITCH mod_voicemail <%s@%s>\n" "Subject: Voicemail from %s %s\nX-Priority: %d", myid, domain_name, caller_id_name, caller_id_number, priority); @@ -3172,7 +3172,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t char *forwarded_by = NULL; char *read_flags = NORMAL_FLAG_STRING; char *dup_domain = NULL; - + if (zstr(data)) { status = SWITCH_STATUS_FALSE; goto end; @@ -3302,8 +3302,8 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_xml_merge_user(ut, x_domain, group); switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); - status = deliver_vm(profile, ut, domain, path, 0, read_flags, - my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, + status = deliver_vm(profile, ut, domain, path, 0, read_flags, + my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&my_params); } @@ -3326,7 +3326,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_xml_merge_user(ut, x_domain, group); switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); - status = deliver_vm(profile, ut, domain, path, 0, read_flags, + status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&my_params); @@ -3341,7 +3341,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) { switch_xml_merge_user(ut, x_domain, x_group); switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); - status = deliver_vm(profile, ut, domain, path, 0, read_flags, + status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&my_params); @@ -3370,7 +3370,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p char sql[256]; prefs_callback_t cbt; switch_uuid_t tmp_uuid; - char tmp_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + char tmp_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; char *file_path = NULL; char *dir_path = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -3582,7 +3582,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p int argc; char *argv[4]; char *mycmd; - + if ((!zstr(operator_ext) && (mycmd = switch_core_session_strdup(session, operator_ext))) || (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext)))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -4026,7 +4026,7 @@ static void actual_message_query_handler(switch_event_t *event) if ((profile = (vm_profile_t *) switch_core_hash_find(globals.profile_hash, domain))) { parse_profile(); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cound not find a profile for domain: [%s] Returning 0 messages\nWhen message-query-exact-match is enabled you must have a dedicated vm profile per distinct domain name you wish to use.\n", domain); } } else { @@ -4358,7 +4358,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames) holder->stream->write_function(holder->stream, "
Message from %s %s

\n", argv[5], argv[6]); holder->stream->write_function(holder->stream, "Priority: %s
\n" "Created: %s
\n" "Last Heard: %s
\n" "Duration: %s
\n", - //"Delete This Message

", + //"Delete This Message

", strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str); switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date); @@ -4616,7 +4616,7 @@ static int api_del_callback(void *pArg, int argc, char **argv, char **columnName { unlink(argv[3]); - + return 0; } @@ -4635,7 +4635,7 @@ SWITCH_STANDARD_API(voicemail_delete_api_function) } id = strdup(cmd); - + if (!id) { stream->write_function(stream, "Allocation Error\n"); return SWITCH_STATUS_SUCCESS; @@ -4658,16 +4658,16 @@ SWITCH_STANDARD_API(voicemail_delete_api_function) if (domain && profile_name && (profile = get_profile(profile_name))) { - + if (uuid) { sql = switch_mprintf("select username, domain, in_folder, file_path from voicemail_msgs where uuid='%q'", uuid); } else { sql = switch_mprintf("select username, domain, in_folder, file_path from voicemail_msgs where username='%q' and domain='%q'", id, domain); } - + vm_execute_sql_callback(profile, profile->mutex, sql, api_del_callback, profile); switch_safe_free(sql); - + if (uuid) { sql = switch_mprintf("delete from voicemail_msgs where uuid='%q'", uuid); } else { @@ -4676,9 +4676,9 @@ SWITCH_STANDARD_API(voicemail_delete_api_function) vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(sql); - + update_mwi(profile, id, domain, "inbox", MWI_REASON_DELETE); - + stream->write_function(stream, "%s", "+OK\n"); profile_rwunlock(profile); } else { @@ -4713,7 +4713,7 @@ SWITCH_STANDARD_API(voicemail_read_api_function) stream->write_function(stream, "Allocation failure\n"); return SWITCH_STATUS_SUCCESS; } - + if ((p = strchr(id, '@'))) { *p++ = '\0'; domain = e = p; @@ -4746,7 +4746,7 @@ SWITCH_STANDARD_API(voicemail_read_api_function) if (mread > -1 && domain && profile_name && (profile = get_profile(profile_name))) { - + if (mread) { if (uuid) { sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where uuid='%q'", (long) switch_epoch_time_now(NULL), uuid); @@ -4763,9 +4763,9 @@ SWITCH_STANDARD_API(voicemail_read_api_function) vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(sql); - + update_mwi(profile, id, domain, "inbox", MWI_REASON_READ); - + stream->write_function(stream, "%s", "+OK\n"); profile_rwunlock(profile); @@ -4800,7 +4800,7 @@ static int api_list_callback(void *pArg, int argc, char **argv, char **columnNam } else { stream->write_function(stream, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9]); } - + return 0; } @@ -4819,7 +4819,7 @@ SWITCH_STANDARD_API(voicemail_list_api_function) } id = strdup(cmd); - + if (!id) { stream->write_function(stream, "Allocation Error\n"); return SWITCH_STATUS_SUCCESS; @@ -4848,11 +4848,11 @@ SWITCH_STANDARD_API(voicemail_list_api_function) if (domain && profile_name && (profile = get_profile(profile_name))) { if (uuid) { sql = switch_mprintf("select created_epoch, read_epoch, username, domain, in_folder, file_path, uuid, cid_name, cid_number, message_len, " - "'%q' from voicemail_msgs where username='%q' and domain='%q' and uuid='%q'", + "'%q' from voicemail_msgs where username='%q' and domain='%q' and uuid='%q'", format, id, domain, uuid); } else { sql = switch_mprintf("select created_epoch, read_epoch, username, domain, in_folder, file_path, uuid, cid_name, cid_number, message_len, " - "'%q' from voicemail_msgs where username='%q' and domain='%q'", + "'%q' from voicemail_msgs where username='%q' and domain='%q'", format, id, domain); } @@ -4862,7 +4862,7 @@ SWITCH_STANDARD_API(voicemail_list_api_function) vm_execute_sql_callback(profile, profile->mutex, sql, api_list_callback, stream); switch_safe_free(sql); - + if (!strcasecmp(format, "xml")) { stream->write_function(stream, "\n"); } @@ -5234,10 +5234,10 @@ not implemented yet profile_rwunlock(profile); - /* TODO If no slot requested, returned currently selected and figure out the slot number from the file name. + /* TODO If no slot requested, returned currently selected and figure out the slot number from the file name. * IF slot provided, check if file exist, check if it currently selected */ if (zstr(res)) { - stream->write_function(stream, "-ERR No greeting found\n"); + stream->write_function(stream, "-ERR No greeting found\n"); } else { switch_event_t *my_params = NULL; char *ebuf = NULL; @@ -5682,7 +5682,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_undelete_function) sql = switch_mprintf("UPDATE voicemail_msgs SET flags='' WHERE username='%q' AND domain='%q' AND uuid = '%q'", id, domain, uuid); vm_execute_sql(profile, sql, profile->mutex); profile_rwunlock(profile); - + stream->write_function(stream, "-OK\n"); done: switch_core_destroy_memory_pool(&pool); @@ -5754,10 +5754,10 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function) if (!strcasecmp(var, "vm-enabled")) { vm_enabled = !switch_false(val); - } + } if (!strcasecmp(var, "vm-password")) { user_xml_password = val; - } + } } sql = switch_mprintf("SELECT password FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain); @@ -5865,7 +5865,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_forward_function) switch_uuid_format(tmp_uuid_str, &tmp_uuid); new_file_path = switch_core_sprintf(pool, "%s%smsg_%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, tmp_uuid_str); - + if (vm_merge_media_files(test, new_file_path) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Error Merging the file\n"); switch_event_destroy(&cbt.my_params); @@ -6099,7 +6099,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) if (zstr(profile->email_headers)) { headers = switch_core_sprintf(pool, "From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d", - id, domain, switch_event_get_header(cbt.my_params, "VM-Message-Caller-Name"), + id, domain, switch_event_get_header(cbt.my_params, "VM-Message-Caller-Name"), switch_event_get_header(cbt.my_params, "VM-Message-Caller-Number"), priority); } else { headers = switch_event_expand_headers(cbt.my_params, profile->email_headers); diff --git a/src/mod/applications/mod_voicemail_ivr/conf/autoload_configs/voicemail_ivr.conf.xml b/src/mod/applications/mod_voicemail_ivr/conf/autoload_configs/voicemail_ivr.conf.xml index 502578ee64..489232b745 100644 --- a/src/mod/applications/mod_voicemail_ivr/conf/autoload_configs/voicemail_ivr.conf.xml +++ b/src/mod/applications/mod_voicemail_ivr/conf/autoload_configs/voicemail_ivr.conf.xml @@ -150,7 +150,7 @@ - + diff --git a/src/mod/applications/mod_voicemail_ivr/config.c b/src/mod/applications/mod_voicemail_ivr/config.c index b2b7d40116..504795f099 100644 --- a/src/mod/applications/mod_voicemail_ivr/config.c +++ b/src/mod/applications/mod_voicemail_ivr/config.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -60,7 +60,7 @@ void menu_init(vmivr_profile_t *profile, vmivr_menu_t *menu) { switch_event_merge(menu_default, menu->event_settings); switch_event_destroy(&menu->event_settings); } - + switch_event_create(&menu->event_settings, SWITCH_EVENT_REQUEST_PARAMS); switch_event_merge(menu->event_settings, profile->event_settings); switch_event_merge(menu->event_settings, menu_default); @@ -188,7 +188,7 @@ vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) { if (!(profile = switch_core_session_alloc(session, sizeof(vmivr_profile_t)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n"); - goto end; + goto end; } profile->name = profile_name; diff --git a/src/mod/applications/mod_voicemail_ivr/config.h b/src/mod/applications/mod_voicemail_ivr/config.h index 8eb124a48b..bab57ba5b5 100644 --- a/src/mod/applications/mod_voicemail_ivr/config.h +++ b/src/mod/applications/mod_voicemail_ivr/config.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * diff --git a/src/mod/applications/mod_voicemail_ivr/ivr.c b/src/mod/applications/mod_voicemail_ivr/ivr.c index 5b7f97529b..3ebcba8490 100644 --- a/src/mod/applications/mod_voicemail_ivr/ivr.c +++ b/src/mod/applications/mod_voicemail_ivr/ivr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -51,7 +51,7 @@ static int match_dtmf(switch_core_session_t *session, ivre_data_t *loc) { if (is_invalid[j]) continue; - test[0] = loc->dtmf_stored[i]; + test[0] = loc->dtmf_stored[i]; if (loc->dtmf_accepted[j][i] == 'N' && atoi(test) >= 2 && atoi(test) <= 9) cMatch = SWITCH_TRUE; if (loc->dtmf_accepted[j][i] == 'X' && atoi(test) >= 0 && atoi(test) <= 9) { @@ -69,7 +69,7 @@ static int match_dtmf(switch_core_session_t *session, ivre_data_t *loc) { if (i == strlen(loc->dtmf_accepted[j]) - 1 && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] == '.') { loc->completeMatch = loc->dtmf_accepted[j]; - } + } if (i == loc->dtmf_received - 1 && loc->dtmf_received == strlen(loc->dtmf_accepted[j]) && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] != '.') { loc->completeMatch = loc->dtmf_accepted[j]; continue; @@ -105,7 +105,7 @@ static switch_status_t cb_on_dtmf(switch_core_session_t *session, void *input, s case SWITCH_INPUT_TYPE_DTMF: { switch_dtmf_t *dtmf = (switch_dtmf_t *) input; - switch_bool_t audio_was_stopped = loc->audio_stopped; + switch_bool_t audio_was_stopped = loc->audio_stopped; loc->audio_stopped = SWITCH_TRUE; if (loc->dtmf_received >= sizeof(loc->dtmf_stored)) { diff --git a/src/mod/applications/mod_voicemail_ivr/ivr.h b/src/mod/applications/mod_voicemail_ivr/ivr.h index cca9c24658..de7321a3ff 100644 --- a/src/mod/applications/mod_voicemail_ivr/ivr.h +++ b/src/mod/applications/mod_voicemail_ivr/ivr.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * diff --git a/src/mod/applications/mod_voicemail_ivr/menu.c b/src/mod/applications/mod_voicemail_ivr/menu.c index 8906c756a9..a34c291f74 100644 --- a/src/mod/applications/mod_voicemail_ivr/menu.c +++ b/src/mod/applications/mod_voicemail_ivr/menu.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -110,7 +110,7 @@ void vmivr_menu_main(switch_core_session_t *session, vmivr_profile_t *profile) { menu.ivre_d.result = RES_FOUND; action = action_on_new_message; action_on_new_message_occured = SWITCH_TRUE; - + } else { ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout); } @@ -199,7 +199,7 @@ void vmivr_menu_navigator(switch_core_session_t *session, vmivr_profile_t *profi goto done; } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API message list return invalid result : %s(%s)\n", profile->api_msg_list, cmd); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API message list return invalid result : %s(%s)\n", profile->api_msg_list, cmd); goto done; } @@ -227,7 +227,7 @@ void vmivr_menu_navigator(switch_core_session_t *session, vmivr_profile_t *profi if (msg_undeleted) { msg_undeleted = SWITCH_FALSE; ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "ack"), "undeleted", menu.phrase_params, NULL, 0); - } + } if (msg_saved) { msg_saved = SWITCH_FALSE; ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "ack"), "saved", menu.phrase_params, NULL, 0); @@ -309,14 +309,14 @@ action: vmivr_api_execute(session, profile->api_msg_delete, cmd); msg_deleted = SWITCH_TRUE; - + if (action_on_delete) { action = action_on_delete; - goto action; + goto action; } else { skip_header = skip_playback = SWITCH_TRUE; } - } else { + } else { cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(menu.phrase_params, "VM-Message-UUID")); vmivr_api_execute(session, profile->api_msg_undelete, cmd); @@ -405,7 +405,7 @@ void vmivr_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile forward_msg = SWITCH_FALSE; } else if (!strcasecmp(action, "prepend")) { /* Prepend record msg */ vmivr_menu_t sub_menu = { "std_record_message" }; - + const char *tmp_filepath = NULL; const char *record_format = NULL; @@ -413,7 +413,7 @@ void vmivr_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile /* Initialize Menu Configs */ menu_init(profile, &sub_menu); - + record_format = switch_event_get_header(sub_menu.event_settings, "Record-Format"); tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format); @@ -787,7 +787,7 @@ switch_status_t vmivr_menu_record(switch_core_session_t *session, vmivr_profile_ const char *rec_silence_threshold = switch_event_get_header(menu->event_settings, "Record-Silence-Threshold"); const char *rec_silence_samplerate = switch_event_get_header(menu->event_settings, "Record-Sample-Rate"); const char *rec_maximum_length = switch_event_get_header(menu->event_settings, "Record-Maximum-Length"); - const char *rec_minimum_length = switch_event_get_header(menu->event_settings, "Record-Minimum-Length"); + const char *rec_minimum_length = switch_event_get_header(menu->event_settings, "Record-Minimum-Length"); switch_size_t record_length = 0; /* Prepare Recording File Handle */ diff --git a/src/mod/applications/mod_voicemail_ivr/menu.h b/src/mod/applications/mod_voicemail_ivr/menu.h index a299d31dc7..0e0c329889 100644 --- a/src/mod/applications/mod_voicemail_ivr/menu.h +++ b/src/mod/applications/mod_voicemail_ivr/menu.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * diff --git a/src/mod/applications/mod_voicemail_ivr/mod_voicemail_ivr.c b/src/mod/applications/mod_voicemail_ivr/mod_voicemail_ivr.c index 006fde5fa8..cafe24d2df 100644 --- a/src/mod/applications/mod_voicemail_ivr/mod_voicemail_ivr.c +++ b/src/mod/applications/mod_voicemail_ivr/mod_voicemail_ivr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * @@ -39,7 +39,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_voicemail_ivr_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_voicemail_ivr_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_ivr_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_voicemail_ivr, mod_voicemail_ivr_load, mod_voicemail_ivr_shutdown, NULL); @@ -54,7 +54,7 @@ SWITCH_STANDARD_APP(voicemail_ivr_function) const char *domain = NULL; const char *profile_name = NULL; vmivr_profile_t *profile = NULL; - char *argv[6] = { 0 }; + char *argv[6] = { 0 }; char *mydata = NULL; if (!zstr(data)) { diff --git a/src/mod/applications/mod_voicemail_ivr/utils.c b/src/mod/applications/mod_voicemail_ivr/utils.c index 1f54f91e2b..7ea72cbcae 100644 --- a/src/mod/applications/mod_voicemail_ivr/utils.c +++ b/src/mod/applications/mod_voicemail_ivr/utils.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * diff --git a/src/mod/applications/mod_voicemail_ivr/utils.h b/src/mod/applications/mod_voicemail_ivr/utils.h index e497ec6101..92239a9211 100644 --- a/src/mod/applications/mod_voicemail_ivr/utils.h +++ b/src/mod/applications/mod_voicemail_ivr/utils.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Marc Olivier Chouinard * * diff --git a/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml b/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml index cf4aa92f41..cf431de700 100644 --- a/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml +++ b/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml @@ -1,12 +1,12 @@ - - - - - + + + + + \ No newline at end of file diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index c368c28b24..b66581ca2b 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,17 +22,17 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * * mod_cepstral.c -- Cepstral Interface - * - * Contains some material derived from the Cepstral Swift SDK, by - * permission. You are free to copy and modify the source under the - * terms of FreeSWITCH itself, without additional permission from + * + * Contains some material derived from the Cepstral Swift SDK, by + * permission. You are free to copy and modify the source under the + * terms of FreeSWITCH itself, without additional permission from * Cepstral - * + * * */ #ifdef __ICC diff --git a/src/mod/asr_tts/mod_flite/mod_flite.c b/src/mod/asr_tts/mod_flite/mod_flite.c index b21b86b841..2118825295 100644 --- a/src/mod/asr_tts/mod_flite/mod_flite.c +++ b/src/mod/asr_tts/mod_flite/mod_flite.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian West * Raymond Chandler * diff --git a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c index 9264f0ec22..1d9906d0a9 100644 --- a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c +++ b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2009, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * mod_tts_commandline.c -- System command ASR TTS Interface @@ -204,7 +204,7 @@ static void tts_commandline_speech_flush_tts(switch_speech_handle_t *sh) { tts_commandline_t *info = (tts_commandline_t *) sh->private_info; assert(info != NULL); - + if (info->fh != NULL && info->fh->file_interface != NULL) { switch_core_file_close(info->fh); } diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index c1e89be89f..7909c077ba 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -625,7 +625,7 @@ static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const ch lname = zstr(name) ? "" : switch_core_strdup(pool, name); lsession_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid); - + if (zstr(name)) { lname = ""; } else { @@ -4397,17 +4397,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CREATE); return SWITCH_STATUS_TERM; } - + if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CLOSE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CLOSE); return SWITCH_STATUS_TERM; } - + if (switch_event_reserve_subclass(MY_EVENT_PROFILE_OPEN) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_OPEN); return SWITCH_STATUS_TERM; } - + /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -4468,7 +4468,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown) switch_event_free_subclass(MY_EVENT_PROFILE_CREATE); switch_event_free_subclass(MY_EVENT_PROFILE_CLOSE); switch_event_free_subclass(MY_EVENT_PROFILE_OPEN); - + synth_shutdown(); recog_shutdown(); diff --git a/src/mod/codecs/mod_amr/amr_be.c b/src/mod/codecs/mod_amr/amr_be.c index 6dc8376258..0613ad1736 100644 --- a/src/mod/codecs/mod_amr/amr_be.c +++ b/src/mod/codecs/mod_amr/amr_be.c @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Dragos Oancea * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -42,13 +42,13 @@ extern const int switch_amr_frame_sizes[]; /* Bandwidth Efficient AMR-NB */ /* https://tools.ietf.org/html/rfc4867#page-17 */ -extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n) +extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n) { uint8_t save_toc, ft; save_toc = shift_buf[1]; - /* we must convert OA TOC -> BE TOC */ + /* we must convert OA TOC -> BE TOC */ /* OA TOC 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ @@ -68,8 +68,8 @@ extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n) +-+-+-+-+-+-+ |F| FT |Q| +-+-+-+-+-+-+ - F = 0 , FT = XXXX , Q = 1 - eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a + F = 0 , FT = XXXX , Q = 1 + eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a */ ft = save_toc >> 3 ; /* drop Q, P1, P2 */ @@ -86,19 +86,19 @@ extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n) shift_buf[1] |= 1 << 7; } else { /* reset last bit of TOC instead of P2 */ - shift_buf[1] &= ~(1 << 7); + shift_buf[1] &= ~(1 << 7); } return SWITCH_TRUE; } -extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) +extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) { int framesz, index, ft; uint8_t shift_tocs[2] = {0x00, 0x00}; uint8_t *shift_buf; - memcpy(shift_tocs, encoded_buf, 2); + memcpy(shift_tocs, encoded_buf, 2); /* shift for BE */ switch_amr_array_lshift(4, shift_tocs, 2); ft = shift_tocs[0] >> 3; @@ -117,7 +117,7 @@ extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *t return SWITCH_TRUE; } -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amr/amr_be.h b/src/mod/codecs/mod_amr/amr_be.h index c870018814..7d49b6b8b6 100644 --- a/src/mod/codecs/mod_amr/amr_be.h +++ b/src/mod/codecs/mod_amr/amr_be.h @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Dragos Oancea * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -37,10 +37,10 @@ #define __AMR_BE_H__ /* Bandwidth Efficient AMR */ -extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n); +extern switch_bool_t switch_amr_pack_be(unsigned char *shift_buf, int n); extern switch_bool_t switch_amr_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len); -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amr/bitshift.c b/src/mod/codecs/mod_amr/bitshift.c index 825433cd9f..fd3fc55606 100644 --- a/src/mod/codecs/mod_amr/bitshift.c +++ b/src/mod/codecs/mod_amr/bitshift.c @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Paolo Missiaggia * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -61,7 +61,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len) buf[i] = ((buf[i] & first_byte) << lshift); return (0); } -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amr/bitshift.h b/src/mod/codecs/mod_amr/bitshift.h index f448ecf652..5adc4b53f9 100644 --- a/src/mod/codecs/mod_amr/bitshift.h +++ b/src/mod/codecs/mod_amr/bitshift.h @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Paolo Missiaggia * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -42,7 +42,7 @@ */ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len); -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index c111d8d04d..5f18feab7c 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Brian K. West * Dragos Oancea @@ -48,9 +48,9 @@ SWITCH_MODULE_DEFINITION(mod_amr, mod_amr_load, NULL, NULL); #include "amr_be.h" /* * Check section 8.1 of rfc3267 for possible sdp options. - * - * SDP Example - * + * + * SDP Example + * * a=fmtp:97 mode-set=0,2,5,7; mode-change-period=2; mode-change-neighbor=1 * * Class A total speech @@ -176,7 +176,7 @@ static switch_bool_t switch_amr_pack_oa(unsigned char *shift_buf, int n) return SWITCH_TRUE; } -static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) +static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) { uint8_t *tocs; int framesz, index, not_last_frame, q, ft; @@ -185,30 +185,30 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat if (!encoded_buf) { return SWITCH_FALSE; } - + /* payload format can be OA (octed-aligned) or BE (bandwidth efficient)*/ if (payload_format) { /* OA */ encoded_buf++; /* CMR skip */ - tocs = encoded_buf; + tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMR_MODES) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMR decoder (OA): Invalid Table Of Contents (TOC): 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amr_frame_sizes[index]; - not_last_frame = (tocs[0] >> 7) & 1; - q = (tocs[0] >> 2) & 1; + not_last_frame = (tocs[0] >> 7) & 1; + q = (tocs[0] >> 2) & 1; ft = tocs[0] >> 3 ; ft &= ~(1 << 5); /* Frame Type*/ } else { /* BE */ - memcpy(shift_tocs, encoded_buf, 2); + memcpy(shift_tocs, encoded_buf, 2); /* shift for BE */ switch_amr_array_lshift(4, shift_tocs, 2); - not_last_frame = (shift_tocs[0] >> 7) & 1; - q = (shift_tocs[0] >> 2) & 1; + not_last_frame = (shift_tocs[0] >> 7) & 1; + q = (shift_tocs[0] >> 2) & 1; ft = shift_tocs[0] >> 3 ; ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; @@ -219,9 +219,9 @@ static switch_bool_t switch_amr_info(unsigned char *encoded_buf, int encoded_dat framesz = switch_amr_frame_sizes[index]; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", print_text, payload_format ? "OA":"BE", ft, q, not_last_frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMR encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", print_text, payload_format ? "OA":"BE", framesz, encoded_data_len); return SWITCH_TRUE; @@ -257,8 +257,8 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); codec_fmtp.private_info = &amr_codec_settings; - /* "mode" may mean two different things: - * "Octed Aligned" or "Bandwidth Efficient" encoding mode , + /* "mode" may mean two different things: + * "Octed Aligned" or "Bandwidth Efficient" encoding mode , * or the actual bitrate which is set with FMTP param "mode-set". */ /* https://tools.ietf.org/html/rfc4867 */ @@ -266,7 +266,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ /* bitrate = value read from config file or default mode 7 */ context->enc_mode = globals.default_bitrate; - /* set octet-align = 0 - it must be 0 by default when there is no "octet-align" param in FMTP, per RFC : + /* set octet-align = 0 - it must be 0 by default when there is no "octet-align" param in FMTP, per RFC : * * "octet-align: Permissible values are 0 and 1. If 1, octet-aligned * operation SHALL be used. If 0 or if not present, @@ -288,7 +288,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ if (!strcasecmp(data, "octet-align")) { if (atoi(arg)) { switch_set_flag(context, AMR_OPT_OCTET_ALIGN); - } + } } else if (!strcasecmp(data, "mode-change-neighbor")) { if (atoi(arg)) { switch_set_flag(context, AMR_OPT_MODE_CHANGE_NEIGHBOR); @@ -346,7 +346,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ context->enc_mode); } else { /* some UEs reject the call with 488 if mode-change-capability is not 2 */ - switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", + switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode); } codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp); @@ -412,14 +412,14 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec, return SWITCH_STATUS_FALSE; } - /* set CMR + TOC (F + 3 bits of FT) , 1111 = CMR: No mode request */ - *(switch_byte_t *) encoded_data = 0xf0; + /* set CMR + TOC (F + 3 bits of FT) , 1111 = CMR: No mode request */ + *(switch_byte_t *) encoded_data = 0xf0; *encoded_data_len = n; if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) { - /* this function does nothing for now - the payload is already OA + /* this function does nothing for now - the payload is already OA as it comes out of the encoding function */ - switch_amr_pack_oa(shift_buf, n); + switch_amr_pack_oa(shift_buf, n); *encoded_data_len = n + 1; } else { switch_amr_pack_be(shift_buf, n); @@ -427,7 +427,7 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec, /* mode 1 = 103 speech bits -> 104 bytes - 1 padding bit */ /* mode 5 = 159 speech bits -> 160 bytes - 1 padding bit */ if ((context->enc_mode == 5 ) || (context->enc_mode == 1) || (context->enc_mode == 0)) { - /* modes 0,1 and 5 have only 1 padding bit and due to shifting + /* modes 0,1 and 5 have only 1 padding bit and due to shifting * we may have an extra 0 byte at the end of the voice payload (bit stuffing) */ if (shift_buf[n-1] != 0x0) { *encoded_data_len = n + 1; @@ -456,7 +456,7 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec, #else struct amr_context *context = codec->private_info; unsigned char *buf = encoded_data; - uint8_t tmp[SWITCH_AMR_OUT_MAX_SIZE]; + uint8_t tmp[SWITCH_AMR_OUT_MAX_SIZE]; if (!context) { return SWITCH_STATUS_FALSE; @@ -466,12 +466,12 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec, switch_amr_info(buf, encoded_data_len, switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, "AMR decoder"); } - if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) { + if (switch_test_flag(context, AMR_OPT_OCTET_ALIGN)) { /* Octed Aligned */ if (!switch_amr_unpack_oa(buf, tmp, encoded_data_len)) { return SWITCH_STATUS_FALSE; } - } else { + } else { /* Bandwidth Efficient */ if (!switch_amr_unpack_be(buf, tmp, encoded_data_len)) { return SWITCH_STATUS_FALSE; @@ -514,32 +514,32 @@ static switch_status_t switch_amr_control(switch_codec_t *codec, if (!strcasecmp(cmd, "increase")) { if (context->enc_mode < SWITCH_AMR_MODES - 1) { int mode_step = 2; /*this is the mode, not the actual bitrate*/ - context->enc_mode = context->enc_mode + mode_step; + context->enc_mode = context->enc_mode + mode_step; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMR encoder: Adjusting mode to %d (increase)\n", context->enc_mode); } - } + } } else if (!strcasecmp(cmd, "decrease")) { if (context->enc_mode > 0) { int mode_step = 2; /*this is the mode, not the actual bitrate*/ - context->enc_mode = context->enc_mode - mode_step; + context->enc_mode = context->enc_mode - mode_step; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMR encoder: Adjusting mode to %d (decrease)\n", context->enc_mode); } } } else if (!strcasecmp(cmd, "default")) { context->enc_mode = globals.default_bitrate; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMR encoder: Adjusting mode to %d (default)\n", context->enc_mode); } } else { /*minimum bitrate (AMR mode)*/ context->enc_mode = 0; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMR encoder: Adjusting mode to %d (minimum)\n", context->enc_mode); } } @@ -547,14 +547,14 @@ static switch_status_t switch_amr_control(switch_codec_t *codec, break; default: break; - } - + } + return SWITCH_STATUS_SUCCESS; #endif } static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align) -{ +{ char buf[256] = { 0 }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "octet-align=%d; ", octet_align); @@ -567,7 +567,7 @@ static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "max-red=0; mode-change-capability=2; "); } -#endif +#endif if (end_of(buf) == ' ') { *(end_of_p(buf) - 1) = '\0'; } @@ -591,11 +591,11 @@ SWITCH_STANDARD_API(mod_amr_debug) stream->write_function(stream, "AMR Debug: off\n"); } else { stream->write_function(stream, "-USAGE: %s\n", AMRWB_DEBUG_SYNTAX); - } + } } return SWITCH_STATUS_SUCCESS; } -#endif +#endif /* Registration */ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) @@ -640,7 +640,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) switch_console_set_complete("add amr_debug on"); switch_console_set_complete("add amr_debug off"); -#endif +#endif SWITCH_ADD_CODEC(codec_interface, "AMR / Octet Aligned"); @@ -657,9 +657,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) 320, /* number of bytes per frame decompressed */ #ifndef AMR_PASSTHROUGH SWITCH_AMR_OUT_MAX_SIZE, /* number of bytes per frame compressed */ -#else +#else 0, /* number of bytes per frame compressed */ -#endif +#endif 1, /* number of channels represented */ 1, /* number of frames per network packet */ switch_amr_init, /* function to initialize a codec handle using this implementation */ @@ -682,9 +682,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) 320, /* number of bytes per frame decompressed */ #ifndef AMR_PASSTHROUGH SWITCH_AMR_OUT_MAX_SIZE, /* number of bytes per frame compressed */ -#else +#else 0, /* number of bytes per frame compressed */ -#endif +#endif 1, /* number of channels represented */ 1, /* number of frames per network packet */ switch_amr_init, /* function to initialize a codec handle using this implementation */ diff --git a/src/mod/codecs/mod_amrwb/amrwb_be.c b/src/mod/codecs/mod_amrwb/amrwb_be.c index 12489d8256..c668ac94cb 100644 --- a/src/mod/codecs/mod_amrwb/amrwb_be.c +++ b/src/mod/codecs/mod_amrwb/amrwb_be.c @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Dragos Oancea * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -43,13 +43,13 @@ extern const int switch_amrwb_frame_sizes[]; /* https://tools.ietf.org/html/rfc4867#page-17 */ /* this works the same as in AMR NB*/ -extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n) +extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n) { uint8_t save_toc, ft; save_toc = shift_buf[1]; - /* we must convert OA TOC -> BE TOC */ + /* we must convert OA TOC -> BE TOC */ /* OA TOC 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ @@ -69,8 +69,8 @@ extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n) +-+-+-+-+-+-+ |F| FT |Q| +-+-+-+-+-+-+ - F = 0 , FT = XXXX , Q = 1 - eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a + F = 0 , FT = XXXX , Q = 1 + eg: Frame Types (FT): ftp://www.3gpp.org/tsg_sa/TSG_SA/TSGS_04/Docs/PDF/SP-99253.pdf - table 1a */ ft = save_toc >> 3 ; /* drop Q, P1, P2 */ @@ -87,19 +87,19 @@ extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n) shift_buf[1] |= 1 << 7; } else { /* reset last bit of TOC instead of P2 */ - shift_buf[1] &= ~(1 << 7); + shift_buf[1] &= ~(1 << 7); } return SWITCH_TRUE; } -extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) +extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len) { int framesz, index, ft; uint8_t shift_tocs[2] = {0x00, 0x00}; uint8_t *shift_buf; - memcpy(shift_tocs, encoded_buf, 2); + memcpy(shift_tocs, encoded_buf, 2); /* shift for BE */ switch_amr_array_lshift(4, shift_tocs, 2); ft = shift_tocs[0] >> 3; @@ -118,7 +118,7 @@ extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t return SWITCH_TRUE; } -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amrwb/amrwb_be.h b/src/mod/codecs/mod_amrwb/amrwb_be.h index 6a871b4f0c..f01f7b6383 100644 --- a/src/mod/codecs/mod_amrwb/amrwb_be.h +++ b/src/mod/codecs/mod_amrwb/amrwb_be.h @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Dragos Oancea * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -37,10 +37,10 @@ #define __AMRWB_BE_H__ /* Bandwidth Efficient AMR-WB */ -extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n); +extern switch_bool_t switch_amrwb_pack_be(unsigned char *shift_buf, int n); extern switch_bool_t switch_amrwb_unpack_be(unsigned char *encoded_buf, uint8_t *tmp, int encoded_len); -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amrwb/bitshift.c b/src/mod/codecs/mod_amrwb/bitshift.c index 825433cd9f..fd3fc55606 100644 --- a/src/mod/codecs/mod_amrwb/bitshift.c +++ b/src/mod/codecs/mod_amrwb/bitshift.c @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Paolo Missiaggia * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -61,7 +61,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len) buf[i] = ((buf[i] & first_byte) << lshift); return (0); } -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amrwb/bitshift.h b/src/mod/codecs/mod_amrwb/bitshift.h index f448ecf652..5adc4b53f9 100644 --- a/src/mod/codecs/mod_amrwb/bitshift.h +++ b/src/mod/codecs/mod_amrwb/bitshift.h @@ -2,23 +2,23 @@ * Copyright (c) 2016, Athonet (www.athonet.com) * Paolo Missiaggia * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -42,7 +42,7 @@ */ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len); -#endif +#endif /* For Emacs: * Local Variables: diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index 60cf954428..19cde02adf 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Brian K. West * Dragos Oancea @@ -117,7 +117,7 @@ static switch_bool_t switch_amrwb_unpack_oa(unsigned char *buf, uint8_t *tmp, in } tmp[0] = tocs[0]; memcpy(&tmp[1], buf, framesz); - + return SWITCH_TRUE; } @@ -127,7 +127,7 @@ static switch_bool_t switch_amrwb_pack_oa(unsigned char *shift_buf, int n) return SWITCH_TRUE; } -static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) +static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_data_len, int payload_format, char *print_text) { uint8_t *tocs; int framesz, index, not_last_frame, q, ft; @@ -136,29 +136,29 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d if (!encoded_buf) { return SWITCH_FALSE; } - + /* payload format can be OA (octed-aligned) or BE (bandwidth efficient)*/ if (payload_format) { /* OA */ encoded_buf++; /* CMR skip */ - tocs = encoded_buf; + tocs = encoded_buf; index = (tocs[0] >> 3) & 0x0f; if (index > SWITCH_AMRWB_MODES) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AMRWB decoder (OA): Invalid TOC 0x%x\n", index); return SWITCH_FALSE; } framesz = switch_amrwb_frame_sizes[index]; - not_last_frame = (tocs[0] >> 7) & 1; - q = (tocs[0] >> 2) & 1; + not_last_frame = (tocs[0] >> 7) & 1; + q = (tocs[0] >> 2) & 1; ft = tocs[0] >> 3; ft &= ~(1 << 5); /* Frame Type */ } else { /* BE */ - memcpy(shift_tocs, encoded_buf, 2); + memcpy(shift_tocs, encoded_buf, 2); /* shift for BE */ switch_amr_array_lshift(4, shift_tocs, 2); - not_last_frame = (shift_tocs[0] >> 7) & 1; - q = (shift_tocs[0] >> 2) & 1; + not_last_frame = (shift_tocs[0] >> 7) & 1; + q = (shift_tocs[0] >> 2) & 1; ft = shift_tocs[0] >> 3; ft &= ~(1 << 5); /* Frame Type */ index = (shift_tocs[0] >> 3) & 0x0f; @@ -169,13 +169,13 @@ static switch_bool_t switch_amrwb_info(unsigned char *encoded_buf, int encoded_d framesz = switch_amrwb_frame_sizes[index]; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): FT: [0x%x] Q: [0x%x] Frame flag: [%d]\n", print_text, payload_format ? "OA":"BE", ft, q, not_last_frame); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s (%s): AMRWB encoded voice payload sz: [%d] : | encoded_data_len: [%d]\n", print_text, payload_format ? "OA":"BE", framesz, encoded_data_len); return SWITCH_TRUE; -} +} #endif static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) @@ -200,8 +200,8 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla return SWITCH_STATUS_FALSE; } else { - /* "mode" may mean two different things: - * "Octed Aligned" or "Bandwidth Efficient" encoding mode , + /* "mode" may mean two different things: + * "Octed Aligned" or "Bandwidth Efficient" encoding mode , * or the actual bitrate which is set with FMTP param "mode-set". */ /* https://tools.ietf.org/html/rfc4867 */ @@ -279,10 +279,10 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla } if (!globals.volte) { - switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", + switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode); } else { - switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", + switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d; max-red=0; mode-change-capability=2", switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode); } codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp); @@ -346,12 +346,12 @@ static switch_status_t switch_amrwb_encode(switch_codec_t *codec, return SWITCH_STATUS_FALSE; } - /* set CMR + TOC (F + 3 bits of FT), 1111 = CMR: No mode request */ + /* set CMR + TOC (F + 3 bits of FT), 1111 = CMR: No mode request */ *(switch_byte_t *) encoded_data = 0xf0; *encoded_data_len = n; if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) { - switch_amrwb_pack_oa(shift_buf, n); /* the payload is OA as it + switch_amrwb_pack_oa(shift_buf, n); /* the payload is OA as it comes out of the encoding function */ *encoded_data_len = n + 1; } else { @@ -380,7 +380,7 @@ static switch_status_t switch_amrwb_decode(switch_codec_t *codec, #else struct amrwb_context *context = codec->private_info; unsigned char *buf = encoded_data; - uint8_t tmp[SWITCH_AMRWB_OUT_MAX_SIZE]; + uint8_t tmp[SWITCH_AMRWB_OUT_MAX_SIZE]; if (!context) { return SWITCH_STATUS_FALSE; @@ -390,12 +390,12 @@ static switch_status_t switch_amrwb_decode(switch_codec_t *codec, switch_amrwb_info(buf, encoded_data_len, switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, "AMRWB decoder"); } - if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) { + if (switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN)) { /* Octed Aligned */ if (!switch_amrwb_unpack_oa(buf, tmp, encoded_data_len)) { return SWITCH_STATUS_FALSE; } - } else { + } else { /* Bandwidth Efficient */ if (!switch_amrwb_unpack_be(buf, tmp, encoded_data_len)) { return SWITCH_STATUS_FALSE; @@ -436,32 +436,32 @@ static switch_status_t switch_amrwb_control(switch_codec_t *codec, if (!strcasecmp(cmd, "increase")) { if (context->enc_mode < SWITCH_AMRWB_MODES - 1) { int mode_step = 2; /*this is the mode, not the actual bitrate*/ - context->enc_mode = context->enc_mode + mode_step; + context->enc_mode = context->enc_mode + mode_step; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMRWB encoder: Adjusting mode to %d (increase)\n", context->enc_mode); } - } + } } else if (!strcasecmp(cmd, "decrease")) { if (context->enc_mode > 0) { int mode_step = 2; /*this is the mode, not the actual bitrate*/ - context->enc_mode = context->enc_mode - mode_step; + context->enc_mode = context->enc_mode - mode_step; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMRWB encoder: Adjusting mode to %d (decrease)\n", context->enc_mode); } } } else if (!strcasecmp(cmd, "default")) { context->enc_mode = globals.default_bitrate; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMRWB encoder: Adjusting mode to %d (default)\n", context->enc_mode); } } else { /*minimum bitrate (AMRWB mode)*/ context->enc_mode = 0; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AMRWB encoder: Adjusting mode to %d (minimum)\n", context->enc_mode); } } @@ -469,14 +469,14 @@ static switch_status_t switch_amrwb_control(switch_codec_t *codec, break; default: break; - } - + } + return SWITCH_STATUS_SUCCESS; } -#endif +#endif static char *generate_fmtp(switch_memory_pool_t *pool , int octet_align) -{ +{ char buf[256] = { 0 }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "octet-align=%d; ", octet_align); @@ -563,31 +563,31 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load) switch_console_set_complete("add amrwb_debug off"); #else #define SWITCH_AMRWB_OUT_MAX_SIZE 0 -#endif +#endif SWITCH_ADD_CODEC(codec_interface, "AMR-WB / Octet Aligned"); default_fmtp_oa = generate_fmtp(pool, 1); switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", default_fmtp_oa, + SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", default_fmtp_oa, 16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1, switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy); #ifndef AMRWB_PASSTHROUGH codec_interface->implementations->codec_control = switch_amrwb_control; -#endif +#endif SWITCH_ADD_CODEC(codec_interface, "AMR-WB / Bandwidth Efficient"); default_fmtp_be = generate_fmtp(pool, 0); switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, 110, "AMR-WB", default_fmtp_be, - 16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1, + SWITCH_CODEC_TYPE_AUDIO, 110, "AMR-WB", default_fmtp_be, + 16000, 16000, 23850, 20000, 320, 640, SWITCH_AMRWB_OUT_MAX_SIZE, 1, 1, switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy); #ifndef AMRWB_PASSTHROUGH codec_interface->implementations->codec_control = switch_amrwb_control; -#endif +#endif /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/codecs/mod_b64/mod_b64.c b/src/mod/codecs/mod_b64/mod_b64.c index a7180260af..8f2b035055 100644 --- a/src/mod/codecs/mod_b64/mod_b64.c +++ b/src/mod/codecs/mod_b64/mod_b64.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian K. West * * mod_b64.c -- The B64 ultra-low delay audio codec (http://www.b64-codec.org/) @@ -53,7 +53,7 @@ static int rot(char *p, char min, char max, int i) { int r = 0; int c; - + if (*p >= min && *p <= max) { if ((c = *p + i) <= max) { *p = c; @@ -119,7 +119,7 @@ static switch_status_t switch_codec_b64_decode(switch_codec_t *codec, p += HLEN; encoded_data = p; encoded_data_len -= HLEN; - + rot13_buffer(encoded_data, encoded_data_len); switch_b64_decode(encoded_data, decoded_data, *decoded_data_len); *decoded_data_len = codec->implementation->decoded_bytes_per_packet; @@ -160,14 +160,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_b64_load) switch_codec_b64_encode, /* function to encode raw data into encoded data */ switch_codec_b64_decode, /* function to decode encoded data into raw data */ switch_codec_b64_destroy); /* deinitalize a codec handle using this implementation */ - + bytes *= 2; samples *= 2; rate *= 2; bits *= 2; - + } - + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/codecs/mod_bv/mod_bv.c b/src/mod/codecs/mod_bv/mod_bv.c index 352e171859..be79ddbd5e 100644 --- a/src/mod/codecs/mod_bv/mod_bv.c +++ b/src/mod/codecs/mod_bv/mod_bv.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian K. West * * mod_bv.c -- BroadVoice16 and BroadVoice32 audio codecs (http://www.broadcom.com/support/broadvoice/) diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c index 998fb3c3e4..9edd464197 100644 --- a/src/mod/codecs/mod_codec2/mod_codec2.c +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -32,8 +32,8 @@ #include #include -/* Uncomment to log input/output data for debugging -#define LOG_DATA +/* Uncomment to log input/output data for debugging +#define LOG_DATA #define CODEC2_DEBUG */ @@ -42,7 +42,7 @@ #ifdef CODEC2_DEBUG #define codec2_assert(_x) switch_assert(_x) #else -#define codec2_assert(_x) +#define codec2_assert(_x) #endif SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load); @@ -56,7 +56,7 @@ struct codec2_context { int nbit; /* nr of bits per frame */ int nbyte; /* nr of bytes per frame */ int nsam; /* nr of samples per frame */ -#ifdef LOG_DATA +#ifdef LOG_DATA FILE *encoder_in; FILE *encoder_out; FILE *encoder_out_unpacked; @@ -107,13 +107,13 @@ static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_fl } else { /* 3200 might be better for VOIP, but forcing 2400 for backwards compatibility */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mode not supported, forcing CODEC2_MODE_2400. You can try mode 3200 too!\n"); - context->mode = CODEC2_MODE_2400; + context->mode = CODEC2_MODE_2400; } - + if (encoding) { context->encoder = codec2_create(context->mode); } - + if (decoding) { context->decoder = codec2_create(context->mode); } @@ -126,32 +126,32 @@ static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_fl context->nbyte = (context->nbit + 7) / 8; codec->private_info = context; - -#ifdef LOG_DATA + +#ifdef LOG_DATA { - + int c = c2_count++; char buf[1024]; - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logging as /tmp/c2-%d-*\n", c); - + if (encoding) { snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-in", c); context->encoder_in = fopen(buf, "w"); - + snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out", c); context->encoder_out = fopen(buf, "w"); - + snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out-unpacked", c); context->encoder_out_unpacked = fopen(buf, "w"); } if (decoding) { snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-in", c); context->decoder_in = fopen(buf, "w"); - + snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out", c); context->decoder_out = fopen(buf, "w"); - + snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out-unpacked", c); context->decoder_in_unpacked = fopen(buf, "w"); } @@ -171,23 +171,23 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ unsigned int *flag) { struct codec2_context *context = codec->private_info; - + codec2_assert(decoded_data_len == context->nsam * 2); - -#ifdef LOG_DATA + +#ifdef LOG_DATA fwrite(decoded_data, decoded_data_len, 1, context->encoder_in); fflush(context->encoder_in); #endif codec2_encode(context->encoder, encoded_data, decoded_data); - -#ifdef LOG_DATA + +#ifdef LOG_DATA fwrite(encode_buf, sizeof(encode_buf), 1, context->encoder_out_unpacked); fflush(context->encoder_out_unpacked); fwrite(encoded_data, context->nbyte, 1, context->encoder_out); fflush(context->encoder_out); #endif - + *encoded_data_len = context->nbyte; return SWITCH_STATUS_SUCCESS; @@ -204,32 +204,32 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec, unsigned int *flag) { struct codec2_context *context = codec->private_info; - + codec2_assert(encoded_data_len == 8); - -#ifdef LOG_DATA + +#ifdef LOG_DATA fwrite(encoded_data, encoded_data_len, 1, context->decoder_in); fflush(context->decoder_in); fwrite(bits, sizeof(bits), 1, context->decoder_in_unpacked); fflush(context->decoder_in_unpacked); #endif - + codec2_decode(context->decoder, decoded_data, encoded_data); -#ifdef LOG_DATA +#ifdef LOG_DATA fwrite(decoded_data, context->nsam, 2, context->decoder_out); fflush(context->decoder_out); #endif *decoded_data_len = context->nsam * 2; /* eg: 160 samples for 3200,2400 */ - + return SWITCH_STATUS_SUCCESS; } static switch_status_t switch_codec2_destroy(switch_codec_t *codec) { struct codec2_context *context = codec->private_info; - + codec2_destroy(context->encoder); codec2_destroy(context->decoder); @@ -266,7 +266,7 @@ static switch_status_t codec2_load_config(switch_bool_t reload) { switch_xml_t cfg, xml = NULL, param, settings; switch_status_t status = SWITCH_STATUS_SUCCESS; - codec2_prefs.mode = 2400 ; + codec2_prefs.mode = 2400 ; if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opening of %s failed\n", cf); @@ -283,7 +283,7 @@ static switch_status_t codec2_load_config(switch_bool_t reload) { } } } - + if (xml) { switch_xml_free(xml); } @@ -301,14 +301,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load) } *module_interface = switch_loadable_module_create_module_interface(pool, modname); - + /*there is no API call to retrieve ptime per mode, so hardcoding here*/ if ((codec2_prefs.mode == 3200) ||(codec2_prefs.mode == 2400)) { codec2_prefs.ptime = 20000; - codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME; + codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME; } else { codec2_prefs.ptime = 40000; - codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME * 2; + codec2_prefs.samples_per_frame = CODEC2_SAMPLES_PER_FRAME * 2; } SWITCH_ADD_CODEC(codec_interface, "CODEC2 3200/2400/1400/1200bps"); diff --git a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c index 5927d16ae7..df09429ced 100644 --- a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c +++ b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -41,7 +41,7 @@ /* * some rules to keep in mind for G729 (the frame size may be different for G723) - * we cannot write more than SFRAME_SIZE (320) - sizeof(struct rtp_packet) which + * we cannot write more than SFRAME_SIZE (320) - sizeof(struct rtp_packet) which * seems to be 266 bytes * if we write less than 160 bytes (1 ulaw frame which is 20 bytes of G729 bytes, a read will block forever) * TODO: do buffering ourselves to provide just the fixed amount of samples that the card expects @@ -60,7 +60,7 @@ static uint32_t total_encoders_usage = 0; static uint32_t total_decoders = 0; static uint32_t total_decoders_usage = 0; -/* +/* Zaptel/DAHDI definitions to not require the headers installed Zaptel and DAHDI are binary compatible (at least in the transcoder interface) */ @@ -122,7 +122,7 @@ static int32_t switch_dahdi_get_transcoder(struct dahdi_transcoder_formats *fmts if (fcntl(fd, F_SETFL, fdflags)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set non-block mode in %s transcoder FD: %s\n", transcoder_name, strerror(errno)); - /* should we abort? this may cause channels to hangup when overruning the device + /* should we abort? this may cause channels to hangup when overruning the device * see jira dahdi codec issue MODCODEC-8 (Hung Calls and Codec DAHDI G.729A 8.0k decoder error!) * */ } @@ -216,7 +216,7 @@ static switch_status_t switch_dahdi_init(switch_codec_t *codec, switch_codec_fla context->encoding_fd = -1; context->decoding_fd = -1; - /* ulaw requires 8 times more storage than g729 and 12 times more than G723, right? + /* ulaw requires 8 times more storage than g729 and 12 times more than G723, right? * this can be used to calculate the target buffer when encoding and decoding * */ context->codec_r = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) diff --git a/src/mod/codecs/mod_g723_1/mod_g723_1.c b/src/mod/codecs/mod_g723_1/mod_g723_1.c index 4e565a129a..76d62e5d3a 100644 --- a/src/mod/codecs/mod_g723_1/mod_g723_1.c +++ b/src/mod/codecs/mod_g723_1/mod_g723_1.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Brian K. West * diff --git a/src/mod/codecs/mod_g729/mod_g729.c b/src/mod/codecs/mod_g729/mod_g729.c index 2dfb1275b0..abd6c6330c 100644 --- a/src/mod/codecs/mod_g729/mod_g729.c +++ b/src/mod/codecs/mod_g729/mod_g729.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Michael Jerris * diff --git a/src/mod/codecs/mod_h26x/mod_h26x.c b/src/mod/codecs/mod_h26x/mod_h26x.c index b3ef2e55d3..4d82322936 100644 --- a/src/mod/codecs/mod_h26x/mod_h26x.c +++ b/src/mod/codecs/mod_h26x/mod_h26x.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index f472cc46b0..14d67d372e 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian K. West * * mod_ilbc.c -- ilbc Codec Module diff --git a/src/mod/codecs/mod_isac/bandwidth_estimator.c b/src/mod/codecs/mod_isac/bandwidth_estimator.c index 85912efbc8..c84ace38c5 100644 --- a/src/mod/codecs/mod_isac/bandwidth_estimator.c +++ b/src/mod/codecs/mod_isac/bandwidth_estimator.c @@ -522,7 +522,7 @@ WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl( { if(index > 11) { - index -= 12; + index -= 12; /* compute the jitter estimate as decoded on the other side */ bwest_str->send_max_delay_avg = 0.9f * bwest_str->send_max_delay_avg + 0.1f * (float)MAX_ISAC_MD; diff --git a/src/mod/codecs/mod_isac/complex_fft.c b/src/mod/codecs/mod_isac/complex_fft.c index 1e8503c245..fa09636f7b 100644 --- a/src/mod/codecs/mod_isac/complex_fft.c +++ b/src/mod/codecs/mod_isac/complex_fft.c @@ -251,7 +251,7 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode) "r"(wri), "r"(frfi_r), "r"(CFFTRND)); __asm__("smladx %0, %1, %2, %3" : "=r"(ti32) : "r"(wri), "r"(frfi_r), "r"(CFFTRND)); - + #else tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j]) - WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j + 1]) + CFFTRND; diff --git a/src/mod/codecs/mod_isac/cross_correlation.c b/src/mod/codecs/mod_isac/cross_correlation.c index 726a74967b..936ae6877f 100644 --- a/src/mod/codecs/mod_isac/cross_correlation.c +++ b/src/mod/codecs/mod_isac/cross_correlation.c @@ -163,7 +163,7 @@ void WebRtcSpl_CrossCorrelation(WebRtc_Word32* cross_correlation, WebRtc_Word16* seq2Ptr = seq2 + (step_seq2 * i); (*CrossCorrPtr) = 0; -#ifndef _ARM_OPT_ +#ifndef _ARM_OPT_ #ifdef _WIN32 #pragma message("NOTE: default implementation is used") #endif diff --git a/src/mod/codecs/mod_isac/encode.c b/src/mod/codecs/mod_isac/encode.c index 75cd726507..66b80244a8 100644 --- a/src/mod/codecs/mod_isac/encode.c +++ b/src/mod/codecs/mod_isac/encode.c @@ -933,7 +933,7 @@ WebRtcIsac_EncodeUb12( WebRtcIsac_GetLpcGain(s2nr, percepFilterParams, SUBFRAMES, lpcGains, corr, varscale); - + /* Store the state of arithmetic coder before coding LPC gains */ transcodingParam.W_upper = ISACencUB_obj->bitstr_obj.W_upper; diff --git a/src/mod/codecs/mod_isac/encode_lpc_swb.h b/src/mod/codecs/mod_isac/encode_lpc_swb.h index e7f1a76af2..84c7ec0d26 100644 --- a/src/mod/codecs/mod_isac/encode_lpc_swb.h +++ b/src/mod/codecs/mod_isac/encode_lpc_swb.h @@ -151,7 +151,7 @@ WebRtc_Word16 WebRtcIsac_CorrelateInterVec( * WebRtcIsac_AddLarMean() * * This is the inverse of WebRtcIsac_RemoveLarMean() - * + * * Input: * -data : pointer to mean-removed LAR:s. * -bandwidth : indicates if the given LAR vectors belong @@ -220,7 +220,7 @@ WebRtc_Word16 WebRtcIsac_DecorrelateLPGain( * WebRtcIsac_QuantizeLpcGain() * * Quantize the decorrelated log-domain gains. - * + * * Input: * -lpcGain : uncorrelated LPC gains. * diff --git a/src/mod/codecs/mod_isac/fft.c b/src/mod/codecs/mod_isac/fft.c index c8247983aa..4164d3b59b 100644 --- a/src/mod/codecs/mod_isac/fft.c +++ b/src/mod/codecs/mod_isac/fft.c @@ -212,7 +212,7 @@ int WebRtcIsac_Fftns(unsigned int ndim, const int dims[], { max_factors = (int)nSpan; } - if ((int)nSpan > max_perm) + if ((int)nSpan > max_perm) { max_perm = (int)nSpan; } diff --git a/src/mod/codecs/mod_isac/mod_isac.c b/src/mod/codecs/mod_isac/mod_isac.c index 0685878811..5746e62aa7 100644 --- a/src/mod/codecs/mod_isac/mod_isac.c +++ b/src/mod/codecs/mod_isac/mod_isac.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -59,7 +59,7 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag codec->private_info = context; err = WebRtcIsac_Create(&context->ISAC_main_inst); - + if (err < 0) return SWITCH_STATUS_FALSE; @@ -95,9 +95,9 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag return SWITCH_STATUS_FALSE; } } - - + + if (WebRtcIsac_SetMaxRate(context->ISAC_main_inst, codec->implementation->bits_per_second) < 0) { return SWITCH_STATUS_FALSE; } @@ -126,13 +126,13 @@ static switch_status_t switch_isac_encode(switch_codec_t *codec, switch_codec_t len = WebRtcIsac_Encode(context->ISAC_main_inst, in, out); in += rise; } - + if (len < 0) { return SWITCH_STATUS_GENERR; } *encoded_data_len = (uint32_t) len; - + return SWITCH_STATUS_SUCCESS; } @@ -159,9 +159,9 @@ static switch_status_t switch_isac_decode(switch_codec_t *codec, *decoded_data_len = 0; return SWITCH_STATUS_GENERR; } - + *decoded_data_len = (uint32_t) len * 2; - + return SWITCH_STATUS_SUCCESS; } @@ -170,7 +170,7 @@ static switch_status_t switch_isac_destroy(switch_codec_t *codec) struct isac_context *context = codec->private_info; WebRtcIsac_Free(context->ISAC_main_inst); - + return SWITCH_STATUS_SUCCESS; } @@ -183,90 +183,90 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_isac_codec_load) SWITCH_ADD_CODEC(codec_interface, "isac"); /* 8.0kbit */ - switch_core_codec_add_implementation(pool, codec_interface, + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, - 99, + 99, "isac", - "ibitrate=32000;maxbitrate=53400", - 16000, - 16000, - 53400, - 30000, - 480, - 960, - 0, - 1, - 3, - switch_isac_init, + "ibitrate=32000;maxbitrate=53400", + 16000, + 16000, + 53400, + 30000, + 480, + 960, + 0, + 1, + 3, + switch_isac_init, switch_isac_encode, switch_isac_decode, switch_isac_destroy); - switch_core_codec_add_implementation(pool, codec_interface, + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, - 99, + 99, "isac", - "ibitrate=32000;maxbitrate=53400", - 16000, - 16000, - 53400, - 60000, - 960, - 1920, - 0, - 1, - 6, - switch_isac_init, - switch_isac_encode, - switch_isac_decode, - switch_isac_destroy); - - - - - switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, - 99, - "isac", - "ibitrate=32000;maxbitrate=160000", - 32000, - 32000, - 160000, - 30000, - 960, - 1920, - 0, - 1, - 6, - switch_isac_init, + "ibitrate=32000;maxbitrate=53400", + 16000, + 16000, + 53400, + 60000, + 960, + 1920, + 0, + 1, + 6, + switch_isac_init, switch_isac_encode, switch_isac_decode, switch_isac_destroy); - switch_core_codec_add_implementation(pool, codec_interface, + + + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, - 99, + 99, "isac", - "ibitrate=32000;maxbitrate=160000", - 32000, - 32000, - 160000, - 60000, - 1920, - 3840, - 0, - 1, - 6, - switch_isac_init, + "ibitrate=32000;maxbitrate=160000", + 32000, + 32000, + 160000, + 30000, + 960, + 1920, + 0, + 1, + 6, + switch_isac_init, switch_isac_encode, switch_isac_decode, switch_isac_destroy); - - + + switch_core_codec_add_implementation(pool, codec_interface, + SWITCH_CODEC_TYPE_AUDIO, + 99, + "isac", + "ibitrate=32000;maxbitrate=160000", + 32000, + 32000, + 160000, + 60000, + 1920, + 3840, + 0, + 1, + 6, + switch_isac_init, + switch_isac_encode, + switch_isac_decode, + switch_isac_destroy); + + + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/codecs/mod_isac/resample_by_2.c b/src/mod/codecs/mod_isac/resample_by_2.c index e239db75c0..ead598d2c6 100644 --- a/src/mod/codecs/mod_isac/resample_by_2.c +++ b/src/mod/codecs/mod_isac/resample_by_2.c @@ -40,7 +40,7 @@ static __inline WebRtc_Word32 MUL_ACCUM_1(WebRtc_Word32 tbl_value, // Return: Return: state + (((diff << 1) * tbl_value) >> 32) // // The reason to introduce this function is that, in case we can't use smlawb -// instruction (in MUL_ACCUM_1) due to input value range, we can still use +// instruction (in MUL_ACCUM_1) due to input value range, we can still use // smmla to save some cycles. static __inline WebRtc_Word32 MUL_ACCUM_2(WebRtc_Word32 tbl_value, diff --git a/src/mod/codecs/mod_isac/signal_processing_library.h b/src/mod/codecs/mod_isac/signal_processing_library.h index 651a68c8b4..4433bc175f 100644 --- a/src/mod/codecs/mod_isac/signal_processing_library.h +++ b/src/mod/codecs/mod_isac/signal_processing_library.h @@ -1652,7 +1652,7 @@ void WebRtcSpl_SynthesisQMF(const WebRtc_Word16* low_band, // WebRtc_Word16 WebRtcSpl_SatW32ToW16(...) // // This function saturates a 32-bit word into a 16-bit word. -// +// // Input: // - value32 : The value of a 32-bit word. // @@ -1664,7 +1664,7 @@ void WebRtcSpl_SynthesisQMF(const WebRtc_Word16* low_band, // // This function multiply a 16-bit word by a 16-bit word, and accumulate this // value to a 32-bit integer. -// +// // Input: // - a : The value of the first 16-bit word. // - b : The value of the second 16-bit word. diff --git a/src/mod/codecs/mod_isac/spectrum_ar_model_tables.h b/src/mod/codecs/mod_isac/spectrum_ar_model_tables.h index 159245bd98..b6ea85ba77 100644 --- a/src/mod/codecs/mod_isac/spectrum_ar_model_tables.h +++ b/src/mod/codecs/mod_isac/spectrum_ar_model_tables.h @@ -11,7 +11,7 @@ /* * spectrum_ar_model_tables.h * - * This file contains definitions of tables with AR coefficients, + * This file contains definitions of tables with AR coefficients, * Gain coefficients and cosine tables. * */ diff --git a/src/mod/codecs/mod_mp4v/mod_mp4v.c b/src/mod/codecs/mod_mp4v/mod_mp4v.c index cc77a3d4e8..685e6756c7 100644 --- a/src/mod/codecs/mod_mp4v/mod_mp4v.c +++ b/src/mod/codecs/mod_mp4v/mod_mp4v.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/codecs/mod_openh264/mod_openh264.cpp b/src/mod/codecs/mod_openh264/mod_openh264.cpp index b497ed2386..841e9efcd7 100644 --- a/src/mod/codecs/mod_openh264/mod_openh264.cpp +++ b/src/mod/codecs/mod_openh264/mod_openh264.cpp @@ -82,7 +82,7 @@ typedef struct h264_codec_context_s { int FillSpecificParameters(h264_codec_context_t *context) { int sane = 0; SEncParamExt *param; - + param = &context->encoder_params; if (!context->codec_settings.video.width) { @@ -216,11 +216,11 @@ static switch_size_t buffer_h264_nalu(h264_codec_context_t *context, switch_fram /* hack for phones sending sps/pps with frame->m = 1 such as grandstream */ if ((nalu_type == 7 || nalu_type == 8) && frame->m) frame->m = SWITCH_FALSE; - + if (nalu_type == 28) { // 0x1c FU-A int start = *(data + 1) & 0x80; int end = *(data + 1) & 0x40; - + nalu_type = *(data + 1) & 0x1f; //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "WTF start:%d end:%d mark:%d\n", start, end, frame->m); @@ -731,8 +731,8 @@ end: return status; } -static switch_status_t switch_h264_control(switch_codec_t *codec, - switch_codec_control_command_t cmd, +static switch_status_t switch_h264_control(switch_codec_t *codec, + switch_codec_control_command_t cmd, switch_codec_control_type_t ctype, void *cmd_data, switch_codec_control_type_t atype, @@ -746,7 +746,7 @@ static switch_status_t switch_h264_control(switch_codec_t *codec, switch(cmd) { case SCC_VIDEO_GEN_KEYFRAME: - context->need_key_frame = 1; + context->need_key_frame = 1; break; case SCC_VIDEO_BANDWIDTH: { diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 3ff5a6a465..35db781df6 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -181,7 +181,7 @@ static uint32_t switch_opus_encoder_set_audio_bandwidth(OpusEncoder *encoder_obj opus_encoder_ctl(encoder_object, OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_SUPERWIDEBAND)); opus_encoder_ctl(encoder_object, OPUS_SET_SIGNAL(OPUS_AUTO)); return OPUS_BANDWIDTH_SUPERWIDEBAND; - } + } /* Audio Bandwidth: 0-20000Hz Sampling Rate: 48000Hz */ opus_encoder_ctl(encoder_object, OPUS_SET_BANDWIDTH(OPUS_AUTO)); opus_encoder_ctl(encoder_object, OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND)); @@ -360,7 +360,7 @@ static char *gen_fmtp(opus_codec_settings_t *settings, switch_memory_pool_t *poo } -static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_length_bytes) +static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_length_bytes) { /* nb_silk_frames: number of silk-frames (10 or 20 ms) in an opus frame: 0, 1, 2 or 3 */ /* computed from the 5 MSB (configuration) of the TOC byte (payload[0]) */ @@ -370,7 +370,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng /* p0p1 = 1 or 2 => nb_opus_frames = 2 */ /* p0p1 = 3 => given by the 6 LSB of payload[1] */ - int nb_silk_frames, nb_opus_frames, n, i; + int nb_silk_frames, nb_opus_frames, n, i; opus_int16 frame_sizes[48]; const unsigned char *frame_data[48]; @@ -378,12 +378,12 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "corrupted packet (invalid size)\n"); return SWITCH_FALSE; } - if (payload[0] & 0x80) { + if (payload[0] & 0x80) { /* this scares users and its harmless so commenting it */ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FEC in CELT_ONLY mode ?!\n"); return SWITCH_FALSE; } - + if ((nb_opus_frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL)) <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OPUS_INVALID_PACKET ! nb_opus_frames: %d\n", nb_opus_frames); return SWITCH_FALSE; @@ -396,7 +396,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng if(nb_silk_frames == 0) { nb_silk_frames = 1; } - if ((nb_silk_frames == 1) && (nb_opus_frames == 1)) { + if ((nb_silk_frames == 1) && (nb_opus_frames == 1)) { for (n = 0; n <= (payload[0]&0x4) ; n++) { /* mono or stereo: 10,20 ms */ if (frame_data[0][0] & (0x80 >> ((n + 1) * (nb_silk_frames + 1) - 1))) { return SWITCH_TRUE; /* frame has FEC */ @@ -407,7 +407,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng for (i=0 ; i < nb_opus_frames; i++ ) { /* only mono Opus frames */ LBRR_flag = (frame_data[i][0] >> (7 - nb_silk_frames)) & 0x1; if (LBRR_flag) { - return SWITCH_TRUE; /* one of the silk frames has FEC */ + return SWITCH_TRUE; /* one of the silk frames has FEC */ } } } @@ -432,17 +432,17 @@ static int switch_opus_get_fec_bitrate(int fs, int loss) if (loss <= 0){ return SWITCH_STATUS_FALSE; - } + } if (fs == 8000) { - if (loss >=25) { + if (loss >=25) { return threshold_bitrates[24]; } else { return threshold_bitrates[loss-1]; } } - return SWITCH_STATUS_FALSE ; + return SWITCH_STATUS_FALSE ; } static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint32_t samples_per_second, char *print_text) @@ -476,11 +476,11 @@ static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint3 nb_channels = opus_packet_get_nb_channels(payload); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: opus_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s] channels[%d]\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: opus_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s] channels[%d]\n", print_text, nb_opus_frames, nb_samples, audiobandwidth_str, len, has_fec ? "yes" : "no", nb_channels); return SWITCH_STATUS_SUCCESS; -} +} static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { @@ -576,18 +576,18 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag } /* https://tools.ietf.org/html/rfc7587 */ - if (opus_codec_settings.maxaveragebitrate) { + if (opus_codec_settings.maxaveragebitrate) { opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_codec_settings.maxaveragebitrate)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set bitrate based on maxaveragebitrate value found in SDP or local config [%dbps]\n", opus_codec_settings.maxaveragebitrate); } else { opus_encoder_ctl(context->encoder_object, OPUS_SET_BANDWIDTH(OPUS_AUTO)); opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(bitrate_bps)); /* OPUS_AUTO */ - opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&bitrate_bps)); /* return average bps for this audio bandwidth */ + opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&bitrate_bps)); /* return average bps for this audio bandwidth */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set bitrate to local settings [%dbps]\n", bitrate_bps); } /* Another fmtp setting from https://tools.ietf.org/html/rfc7587 - "RTP Payload Format for the Opus Speech and Audio Codec" */ if (opus_codec_settings.maxplaybackrate) { - opus_int32 audiobandwidth; + opus_int32 audiobandwidth; char audiobandwidth_str[32] = {0}; audiobandwidth = switch_opus_encoder_set_audio_bandwidth(context->encoder_object,opus_codec_settings.maxplaybackrate); @@ -617,15 +617,15 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag if (opus_codec_settings.useinbandfec) { /* FEC on the encoder: start the call with a preconfigured packet loss percentage */ int fec_bitrate = opus_codec_settings.maxaveragebitrate; - int loss_percent = opus_prefs.plpct ; + int loss_percent = opus_prefs.plpct ; opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC(opus_codec_settings.useinbandfec)); opus_encoder_ctl(context->encoder_object, OPUS_SET_PACKET_LOSS_PERC(loss_percent)); - if (opus_prefs.keep_fec){ - fec_bitrate = switch_opus_get_fec_bitrate(enc_samplerate,loss_percent); + if (opus_prefs.keep_fec){ + fec_bitrate = switch_opus_get_fec_bitrate(enc_samplerate,loss_percent); /* keep a bitrate for which the encoder will always add FEC */ if (fec_bitrate != SWITCH_STATUS_FALSE) { - opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(fec_bitrate)); - /* will override the maxaveragebitrate set in opus.conf.xml */ + opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(fec_bitrate)); + /* will override the maxaveragebitrate set in opus.conf.xml */ opus_codec_settings.maxaveragebitrate = fec_bitrate; } context->control_state.keep_fec = opus_prefs.keep_fec; @@ -691,8 +691,8 @@ static switch_status_t switch_opus_destroy(switch_codec_t *codec) if (context->decoder_object) { switch_core_session_t *session = codec->session; if (session) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus decoder stats: Frames[%d] PLC[%d] FEC[%d]\n", - context->decoder_stats.frame_counter, context->decoder_stats.plc_counter-context->decoder_stats.fec_counter, context->decoder_stats.fec_counter); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus decoder stats: Frames[%d] PLC[%d] FEC[%d]\n", + context->decoder_stats.frame_counter, context->decoder_stats.plc_counter-context->decoder_stats.fec_counter, context->decoder_stats.fec_counter); } opus_decoder_destroy(context->decoder_object); context->decoder_object = NULL; @@ -817,40 +817,40 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, frame.data = buf; frame.buflen = sizeof(buf); - + if (globals.debug || context->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Missing %s %u Checking JB\n", seq ? "SEQ" : "TS", seq ? seq : ts); } - + if (switch_jb_peek_frame(jb, ts, seq, 1, &frame) == SWITCH_STATUS_SUCCESS) { if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Lookahead frame found: %u:%u\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Lookahead frame found: %u:%u\n", frame.timestamp, frame.seq); } - + if ((fec = switch_opus_has_fec(frame.data, frame.datalen))) { encoded_data = frame.data; encoded_data_len = frame.datalen; } - + if (globals.debug || context->debug) { if (fec) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC info available in packet with SEQ: %d LEN: %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC info available in packet with SEQ: %d LEN: %d\n", frame.seq, frame.datalen); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO FEC info in this packet with SEQ: %d LEN: %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO FEC info in this packet with SEQ: %d LEN: %d\n", frame.seq, frame.datalen); } } } } } - + opus_decoder_ctl(context->decoder_object, OPUS_GET_LAST_PACKET_DURATION(&last_frame_size)); if (last_frame_size) frame_size = last_frame_size; - + if (globals.debug || context->debug) { if (opus_prefs.use_jb_lookahead || context->use_jb_lookahead) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MISSING FRAME: %s\n", fec ? "Look-ahead FEC" : "PLC"); @@ -865,7 +865,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, if (globals.debug || context->debug > 1) { int samplerate = context->dec_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000); switch_opus_info(encoded_data, encoded_data_len, - samplerate ? samplerate : codec->implementation->actual_samples_per_second, + samplerate ? samplerate : codec->implementation->actual_samples_per_second, !encoded_data ? "PLC correction" : fec ? "FEC correction" : "decode"); } @@ -910,7 +910,7 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, opus_int32 ret = 0; opus_int32 total_len = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; - + if (!context) { switch_goto_status(SWITCH_STATUS_FALSE, end); } @@ -932,12 +932,12 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, dec_ptr_buf = (int16_t *)decoded_data; for (i = 0; i < nb_frames; i++) { /* set inband FEC ON or OFF for the next Opus frame */ - if (i == (nb_frames - 1) && want_fec) { - /* When FEC is enabled for Opus frame N, LBRR is stored during regular encoding of */ + if (i == (nb_frames - 1) && want_fec) { + /* When FEC is enabled for Opus frame N, LBRR is stored during regular encoding of */ /* this Opus frame N, and this LBRR data will be packed with the regular encoding */ /* data of Opus frame N+1. We enable FEC on our last Opus frame which is to be packed, just */ /* to actually have it stored in the first Opus frame, that is when switch_opus_encode_repacketize() */ - /* is called again to pack the next big 80,100 or 120 ms frame. */ + /* is called again to pack the next big 80,100 or 120 ms frame. */ toggle_fec = 1; /* FEC ON for the last frame */ } @@ -1199,19 +1199,19 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, } } if (opus_prefs.adjust_bitrate) { - /* make bitrate adjust the step , but keep it as a multiple of 400 (see OpusFAQ). + /* make bitrate adjust the step , but keep it as a multiple of 400 (see OpusFAQ). * usual RTCP interval is 5 seconds which is long time - the step should be bigger. */ - /* step's value should depend on packet loss too, to decrease more abrubtly + /* step's value should depend on packet loss too, to decrease more abrubtly * at high packet loss. */ int base_step = 400; /*bps*/ int range = context->codec_settings.maxaveragebitrate - SWITCH_OPUS_MIN_BITRATE; float steps = (float)((float)(range / 100) / base_step); - int br_step = (int)(round(steps) * base_step) * plpct; + int br_step = (int)(round(steps) * base_step) * plpct; if (globals.debug || context->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, - SWITCH_LOG_DEBUG, "Opus encoder: bitrate increase/decrease step now is: %d bps, range:%d\n", br_step, range); + switch_log_printf(SWITCH_CHANNEL_LOG, + SWITCH_LOG_DEBUG, "Opus encoder: bitrate increase/decrease step now is: %d bps, range:%d\n", br_step, range); } - context->control_state.increase_step = context->control_state.decrease_step = br_step; + context->control_state.increase_step = context->control_state.decrease_step = br_step; } context->old_plpct = plpct; } @@ -1224,7 +1224,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, opus_int32 current_bitrate=context->control_state.current_bitrate; if (!strcasecmp(cmd, "increase")) { /* https://wiki.xiph.org/OpusFAQ - "[...]Opus scales from about 6 to 512 kb/s, in increments of 0.4 kb/s (one byte with 20 ms frames). + "[...]Opus scales from about 6 to 512 kb/s, in increments of 0.4 kb/s (one byte with 20 ms frames). Opus can have more than 1200 possible bitrates[...]" */ int br_step = context->control_state.increase_step?context->control_state.increase_step:400; opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(¤t_bitrate)); @@ -1232,7 +1232,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(current_bitrate+br_step)); if ((context->control_state.keep_fec) && (current_bitrate > SWITCH_OPUS_MIN_FEC_BITRATE)) { opus_prefs.keep_fec = 1; /* enable back FEC if it was disabled by SCC_AUDIO_ADJUST_BITRATE, we have enough network bandwidth now */ - } + } if (globals.debug || context->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (increase)\n", current_bitrate+br_step); } @@ -1242,7 +1242,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(¤t_bitrate)); if (current_bitrate > SWITCH_OPUS_MIN_BITRATE) { if (context->control_state.keep_fec) { - /* no point to try to keep FEC enabled anymore, + /* no point to try to keep FEC enabled anymore, * we're low on network bandwidth (that's why we ended up here) */ opus_prefs.keep_fec = 0; } @@ -1256,7 +1256,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(opus_prefs.maxaveragebitrate)); if (context->control_state.keep_fec) { opus_prefs.keep_fec = 1; /* enable back FEC, we have enough network bandwidth now */ - } + } if (globals.debug || context->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (configured maxaveragebitrate)\n", opus_prefs.maxaveragebitrate); } @@ -1265,7 +1265,7 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, opus_encoder_ctl(context->encoder_object, OPUS_SET_BITRATE(SWITCH_OPUS_MIN_BITRATE)); if (context->control_state.keep_fec) { opus_prefs.keep_fec = 0; /* do not enforce FEC anymore, we're low on network bandwidth */ - } + } if (globals.debug || context->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: Adjusting bitrate to %d (minimum)\n", SWITCH_OPUS_MIN_BITRATE); } @@ -1398,7 +1398,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load) switch_opus_decode, /* function to decode encoded data into raw data */ switch_opus_destroy); /* deinitalize a codec handle using this implementation */ codec_interface->implementations->codec_control = switch_opus_control; - + bytes *= 2; samples *= 2; mss *= 2; diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 6ce31b1402..506df4c4c8 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -2,23 +2,23 @@ * Copyright (c) 2010, Sangoma Technologies * Moises Silva * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * * Neither the name of the original author; nor the names of any contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -44,7 +44,7 @@ SWITCH_MODULE_DEFINITION(mod_sangoma_codec, mod_sangoma_codec_load, mod_sangoma_ /* it seemed we need higher PTIME than the calling parties, so we assume nobody will use higher ptime than 40 */ #define SANGOMA_DEFAULT_SAMPLING_RATE 80 -#define SANGOMA_TRANSCODE_CONFIG "sangoma_codec.conf" +#define SANGOMA_TRANSCODE_CONFIG "sangoma_codec.conf" /* \brief vocallos configuration */ static sngtc_init_cfg_t g_init_cfg; @@ -131,7 +131,7 @@ struct codec_data { /* packet counters */ unsigned long tx; unsigned long rx; - unsigned long ticks; + unsigned long ticks; /* Lost packets */ long lastrxseqno; @@ -213,7 +213,7 @@ static int sangoma_create_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t *p switch_port_t rtp_port; local_ip_addr.s_addr = htonl(host_ip); - + switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip)); /* request a port */ @@ -235,7 +235,7 @@ static int sangoma_release_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t p switch_port_t rtp_port = p_rtp_port; local_ip_addr.s_addr = htonl(host_ip); - + switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip)); /* release the port */ @@ -264,8 +264,8 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r /* * We *MUST* use a new pool - * Do not use the session pool since the session may go away while the RTP socket should linger around - * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call) + * Do not use the session pool since the session may go away while the RTP socket should linger around + * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call) * also do not use the module pool otherwise memory would keep growing because switch_rtp_destroy does not * free the memory used (is assumed it'll be freed when the pool is destroyed) */ @@ -273,19 +273,19 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r if (status != SWITCH_STATUS_SUCCESS) { return -1; } - + local_ip_addr.s_addr = htonl(codec_req_leg->host_ip); switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip)); sngtc_codec_ipv4_hex_to_str(codec_reply_leg->codec_ip, codec_ip); iana = codec_id_to_iana(codec_req_leg->codec_id); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Creating RTP session for host (%s/%d) vocallo(%s/%d) Iana=%d CodecId=%d ms=%d idx=%lu\n", - local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->codec_id, + local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->codec_id, codec_req_leg->ms*1000, sess->sessid); /* create the RTP socket */ - rtp_session = switch_rtp_new(local_ip, rtp_port, - codec_ip, codec_reply_leg->codec_udp_port, + rtp_session = switch_rtp_new(local_ip, rtp_port, + codec_ip, codec_reply_leg->codec_udp_port, iana, sess->impl->samples_per_packet, codec_req_leg->ms * 1000, /* microseconds per packet */ @@ -320,7 +320,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f uint32_t encoding, decoding; struct sangoma_transcoding_session *sess = NULL; vocallo_codec_t *vcodec; - + encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); decoding = (flags & SWITCH_CODEC_FLAG_DECODE); @@ -342,11 +342,11 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f switch_assert(sess->impl); vcodec = get_codec_from_iana(codec->implementation->ianacode, codec->implementation->bits_per_second); - + if (encoding) { sess->encoder.request.usr_priv = sess; sess->encoder.request.a.host_ip = g_rtpip; - sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000 + sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000 ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->encoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; @@ -362,7 +362,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f sess->decoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->decoder.request.b.host_ip = g_rtpip; - sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000 + sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000 ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->decoder.request.b.ms = codec->implementation->microseconds_per_packet/1000; @@ -509,7 +509,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } /* do the writing */ - memset(&linear_frame, 0, sizeof(linear_frame)); + memset(&linear_frame, 0, sizeof(linear_frame)); linear_frame.source = __SWITCH_FUNC__; linear_frame.data = decoded_byteswapped_data; linear_frame.datalen = decoded_data_len; @@ -528,7 +528,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } if (res < i) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to Sangoma encoder RTP session, but wrote %d bytes.\n", i, res); return SWITCH_STATUS_FALSE; } @@ -569,7 +569,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec if (encoded_frame.payload != codec->implementation->ianacode) { if (sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_152 || sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_133) { - /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work, + /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work, * some codecs checks cannot be completely done, like iLBC */ if (encoded_frame.payload != IANA_ILBC_152_8000_1 && encoded_frame.payload != IANA_ILBC_133_8000_1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting either %d or %d\n", @@ -588,7 +588,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec /* if there is something where we want to write, we're dropping it */ sess->encoder.rxdiscarded++; #if 0 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding encoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding encoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen, sess->sessid, sess->encoder.queue_windex, sess->encoder.queue_rindex); #endif SAFE_INDEX_INC(sess->encoder.rtp_queue, sess->encoder.queue_rindex); @@ -603,7 +603,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec /* monitor the queue size */ sess->encoder.queue_size++; if (sess->encoder.queue_size > sess->encoder.queue_max_ever) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->encoder.queue_size, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->encoder.queue_size, sess->encoder.queue_windex, sess->encoder.queue_rindex); sess->encoder.queue_max_ever = sess->encoder.queue_size; } @@ -732,7 +732,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } if (res < encoded_data_len) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to Sangoma decoder RTP session, but wrote %d bytes.\n", encoded_data_len, res); return SWITCH_STATUS_FALSE; @@ -778,7 +778,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses /* if there is something where we want to write, we're dropping it */ sess->decoder.rxdiscarded++; #if 0 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding decoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding decoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen, sess->sessid, sess->decoder.queue_windex, sess->decoder.queue_rindex); #endif SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_rindex); @@ -799,7 +799,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses /* monitor the queue size */ sess->decoder.queue_size++; if (sess->decoder.queue_size > sess->decoder.queue_max_ever) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->decoder.queue_size, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->decoder.queue_size, sess->decoder.queue_windex, sess->decoder.queue_rindex); sess->decoder.queue_max_ever = sess->decoder.queue_size; } @@ -856,10 +856,10 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses static switch_status_t switch_sangoma_destroy(switch_codec_t *codec) { struct sangoma_transcoding_session *sess = codec->private_info; - /* things that you may do here is closing files, sockets or other resources used during the codec session + /* things that you may do here is closing files, sockets or other resources used during the codec session * no need to free memory allocated from the pool though, the owner of the pool takes care of that */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sangoma destroy called.\n"); - + switch_mutex_lock(g_sessions_lock); if (sess->encoder.txrtp) { @@ -868,7 +868,7 @@ static switch_status_t switch_sangoma_destroy(switch_codec_t *codec) if (sess->decoder.txrtp) { sngtc_free_transcoding_session(&sess->decoder.reply); } - + switch_core_hash_delete(g_sessions_hash, sess->hashkey); memset(sess, 0, sizeof(*sess)); @@ -965,9 +965,9 @@ SWITCH_STANDARD_API(sangoma_function) stream->write_function(stream, STATS_FORMAT, - sessid_str, + sessid_str, sess->impl->iananame, - sess->encoder.txrtp ? "Yes" : "No", + sess->encoder.txrtp ? "Yes" : "No", sess->decoder.txrtp ? "Yes" : "No", encoder_tx_str, encoder_rx_str, @@ -988,12 +988,12 @@ SWITCH_STANDARD_API(sangoma_function) if (argc < 2) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } ret = sscanf(argv[1], "%lu", &sessid); if (ret != 1) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } sess = sangoma_find_session(sessid); if (!sess) { @@ -1016,7 +1016,7 @@ SWITCH_STANDARD_API(sangoma_function) stream->write_function(stream, "-- Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); - + stats = switch_rtp_get_stats(sess->encoder.txrtp, NULL); stream->write_function(stream, "-- Outbound Stats --\n"); @@ -1048,12 +1048,12 @@ SWITCH_STANDARD_API(sangoma_function) if (argc < 2) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } ret = sscanf(argv[1], "%lu", &sessid); if (ret != 1) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } sess = sangoma_find_session(sessid); if (!sess) { stream->write_function(stream, "Failed to find session %lu\n", sessid); @@ -1069,12 +1069,12 @@ SWITCH_STANDARD_API(sangoma_function) if (argc < 2) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } ret = sscanf(argv[1], "%lu", &sessid); if (ret != 1) { stream->write_function(stream, "%s", SANGOMA_SYNTAX); goto done; - } + } sess = sangoma_find_session(sessid); if (!sess) { stream->write_function(stream, "Failed to find session %lu\n", sessid); @@ -1230,7 +1230,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to detect vocallo modules\n"); return SWITCH_STATUS_FALSE; } - + if (sngtc_activate_modules(&g_init_cfg, &activated)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to activate vocallo modules\n"); return SWITCH_STATUS_FALSE; @@ -1259,14 +1259,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) /* check if the codec is in the load list, otherwise skip it */ if (strcasecmp(g_codec_register_list, "all") && !strcasestr(g_codec_register_list, g_codec_map[c].iana_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the load list\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the load list\n", g_codec_map[c].iana_name); continue; } /* load it unless is named in the noload list */ if (strcasestr(g_codec_noregister_list, g_codec_map[c].iana_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the noload list\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the noload list\n", g_codec_map[c].iana_name); continue; } @@ -1283,7 +1283,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registering implementations for codec %s\n", g_codec_map[c].iana_name); - /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface + /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface * list the core keeps, gets a codec id and set the given codec name to it. * At this point there is an empty shell codec interface registered, but not yet implementations */ SWITCH_ADD_CODEC(codec_interface, g_codec_map[c].fs_name); @@ -1341,7 +1341,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ - + break; case SNGTC_CODEC_ILBC_133: case SNGTC_CODEC_ILBC_152: diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index 8da1c541c7..e437ed7df7 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Brian K. West * @@ -36,7 +36,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load); SWITCH_MODULE_DEFINITION(mod_silk, mod_silk_load, NULL, NULL); -#define MAX_BYTES_PER_FRAME 250 +#define MAX_BYTES_PER_FRAME 250 #define MAX_INPUT_FRAMES 5 #define MAX_LBRR_DELAY 2 #define MAX_FRAME_LENGTH 480 @@ -158,8 +158,8 @@ static switch_status_t switch_silk_fmtp_parse(const char *fmtp, switch_codec_fmt -static switch_status_t switch_silk_init(switch_codec_t *codec, - switch_codec_flag_t freeswitch_flags, +static switch_status_t switch_silk_init(switch_codec_t *codec, + switch_codec_flag_t freeswitch_flags, const switch_codec_settings_t *codec_settings) { struct silk_context *context = NULL; @@ -177,7 +177,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); codec_fmtp.private_info = &silk_codec_settings; switch_silk_fmtp_parse(codec->fmtp_in, &codec_fmtp); - + codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "useinbandfec=%s; usedtx=%s; maxaveragebitrate=%d", silk_codec_settings.useinbandfec ? "1" : "0", silk_codec_settings.usedtx ? "1" : "0", @@ -187,13 +187,13 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, if (SKP_Silk_SDK_Get_Encoder_Size(&encSizeBytes)) { return SWITCH_STATUS_FALSE; } - + context->enc_state = switch_core_alloc(codec->memory_pool, encSizeBytes); if (SKP_Silk_SDK_InitEncoder(context->enc_state, &context->encoder_object)) { return SWITCH_STATUS_FALSE; } - + context->encoder_object.API_sampleRate = codec->implementation->actual_samples_per_second; context->encoder_object.maxInternalSampleRate = codec->implementation->actual_samples_per_second; @@ -208,7 +208,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, if (decoding) { switch_set_flag(codec, SWITCH_CODEC_FLAG_HAS_PLC); - + if (SKP_Silk_SDK_Get_Decoder_Size(&decSizeBytes)) { return SWITCH_STATUS_FALSE; } @@ -236,25 +236,25 @@ void printSilkError(SKP_int16 ret){ switch (ret) { case SKP_SILK_NO_ERROR: message = "No errors"; break; - case SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES: + case SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES: message = "Input length is not multiplum of 10 ms, or length is longer than the packet length"; break; - case SKP_SILK_ENC_FS_NOT_SUPPORTED: + case SKP_SILK_ENC_FS_NOT_SUPPORTED: message = "Sampling frequency not 8000 , 12000, 16000 or 24000 Hertz"; break; case SKP_SILK_ENC_PACKET_SIZE_NOT_SUPPORTED: message ="Packet size not 20, 40 , 60 , 80 or 100 ms "; - break; - case SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT: + break; + case SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT: message = "Allocated payload buffer too short"; break; - case SKP_SILK_ENC_INVALID_LOSS_RATE: + case SKP_SILK_ENC_INVALID_LOSS_RATE: message = " Loss rate not between 0 and 100 % "; break; case SKP_SILK_ENC_INVALID_COMPLEXITY_SETTING: message = "Complexity setting not valid, use 0 ,1 or 2"; break; - case SKP_SILK_ENC_INVALID_INBAND_FEC_SETTING: + case SKP_SILK_ENC_INVALID_INBAND_FEC_SETTING: message = "Inband FEC setting not valid, use 0 or 1 "; break; case SKP_SILK_ENC_INVALID_DTX_SETTING: @@ -266,7 +266,7 @@ void printSilkError(SKP_int16 ret){ case SKP_SILK_DEC_INVALID_SAMPLING_FREQUENCY: message = "Output sampling frequency lower than internal decoded sampling frequency"; break; - case SKP_SILK_DEC_PAYLOAD_TOO_LARGE: + case SKP_SILK_DEC_PAYLOAD_TOO_LARGE: message = "Payload size exceeded the maximum allowed 1024 bytes"; break; case SKP_SILK_DEC_PAYLOAD_ERROR : @@ -288,7 +288,7 @@ static switch_status_t switch_silk_encode(switch_codec_t *codec, struct silk_context *context = codec->private_info; SKP_int16 ret; SKP_int16 pktsz = (SKP_int16)context->encoder_object.packetSize; - SKP_int16 nBytes = MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES; + SKP_int16 nBytes = MAX_BYTES_PER_FRAME * MAX_INPUT_FRAMES; SKP_int16 *lindata = (SKP_int16 *)decoded_data; SKP_int16 samples = (SKP_int16)(decoded_data_len /sizeof(SKP_int16)); *encoded_data_len = 0; @@ -299,7 +299,7 @@ static switch_status_t switch_silk_encode(switch_codec_t *codec, pktsz, encoded_data, &nBytes); - + if (ret) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SKP_Silk_Encode returned %d!\n", ret); printSilkError(ret); @@ -323,7 +323,7 @@ static switch_status_t switch_silk_decode(switch_codec_t *codec, uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag) { struct silk_context *context = codec->private_info; - SKP_int16 ret, len; + SKP_int16 ret, len; int16_t *target = decoded_data; switch_core_session_t *session = codec->session; switch_jb_t *jb = NULL; diff --git a/src/mod/codecs/mod_siren/mod_siren.c b/src/mod/codecs/mod_siren/mod_siren.c index 783f47427b..3c6a7f1c89 100644 --- a/src/mod/codecs/mod_siren/mod_siren.c +++ b/src/mod/codecs/mod_siren/mod_siren.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,13 +22,13 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian K. West * Steve Underwood * * mod_siren.c -- ITU-T G.722.1 (Siren7) and ITU-T G.722.1 Annex C (Siren14) licensed from Polycom(R) * - * Using mod_siren in a commercial product will require you to acquire a patent + * Using mod_siren in a commercial product will require you to acquire a patent * license directly from Polycom(R) for your company. * * http://www.polycom.com/usa/en/company/about_us/technology/siren_g7221/siren_g7221.html diff --git a/src/mod/codecs/mod_skel_codec/mod_skel_codec.c b/src/mod/codecs/mod_skel_codec/mod_skel_codec.c index e83ccc0a6e..e22b5fa762 100644 --- a/src/mod/codecs/mod_skel_codec/mod_skel_codec.c +++ b/src/mod/codecs/mod_skel_codec/mod_skel_codec.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -29,7 +29,7 @@ */ /* - * Other source of reference for module building: + * Other source of reference for module building: * src/mod/applications/mod_skel/mod_skel.c * http://files.freeswitch.org/cluecon_2009/presentations/Silva_FreeSWITCH_Modules_For_Asterisk_Devs.ppt * You can load this codec with this command: @@ -145,7 +145,7 @@ static switch_status_t switch_skel_decode(switch_codec_t *codec, /* codec sessio static switch_status_t switch_skel_destroy(switch_codec_t *codec) { - /* things that you may do here is closing files, sockets or other resources used during the codec session + /* things that you may do here is closing files, sockets or other resources used during the codec session * no need to free memory allocated from the pool though, the owner of the pool takes care of that */ struct skel_context *context = codec->private_info; context->encodes = 0; @@ -153,7 +153,7 @@ static switch_status_t switch_skel_destroy(switch_codec_t *codec) return SWITCH_STATUS_SUCCESS; } -/* A standard API registered by the this codec module, APIs can be executed from CLI, mod_event_socket, or many other interfaces +/* A standard API registered by the this codec module, APIs can be executed from CLI, mod_event_socket, or many other interfaces * any information or actions you want to publish for users on demand is typically exposed through an API */ SWITCH_STANDARD_API(skel_sayhi) /* static switch_status_t skel_sayhi(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream) */ @@ -168,20 +168,20 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skel_codec_load) /* the codec interface that will be registered with the core */ switch_codec_interface_t *codec_interface; - /* the API interface, only needed if you wish to register APIs + /* the API interface, only needed if you wish to register APIs * (like commands exposed through CLI, mod_event_socket or any other FS interface capable of executing APIs) */ switch_api_interface_t *api_interface; - /* The core gives us a blank module interface pointer and a pool of memory, we allocate memory from that pool to create our module interface + /* The core gives us a blank module interface pointer and a pool of memory, we allocate memory from that pool to create our module interface * and set the pointer to that chunk of allocated memory */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface list the core keeps, + /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface list the core keeps, * gets a codec id and set the given codec name to it. * At this point there is an empty shell codec interface registered, but not yet implementations */ SWITCH_ADD_CODEC(codec_interface, "SKEL 8.0k"); /* 8.0kbit */ - /* Now add as many codec implementations as needed, typically this is done inside a for loop where the packetization size is + /* Now add as many codec implementations as needed, typically this is done inside a for loop where the packetization size is * incremented (10ms, 20ms, 30ms etc) as needed */ switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ diff --git a/src/mod/codecs/mod_theora/mod_theora.c b/src/mod/codecs/mod_theora/mod_theora.c index 6cc4039856..e1733d44fc 100644 --- a/src/mod/codecs/mod_theora/mod_theora.c +++ b/src/mod/codecs/mod_theora/mod_theora.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c index 0384e7af3e..691b640a78 100644 --- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c +++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_dialplan_asterisk.c -- Asterisk extensions.conf style dialplan parser. diff --git a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c index 0997224dd8..9865f6ef39 100644 --- a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c +++ b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 6dba64121d..005276dcd3 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -93,9 +93,9 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app, } else { \ tzoff = NULL; \ } \ - } while(tzoff) + } while(tzoff) -static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, +static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, switch_caller_extension_t **extension, const char *exten_name, int recur) { switch_xml_t xcond, xaction, xexpression, xregex; @@ -131,7 +131,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * switch_snprintf(nbuf, sizeof(nbuf), "%s_recur_%d", exten_name, recur); exten_name = nbuf; - + space[j++] = '|'; for (i = 0; i < recur; i++) { @@ -143,17 +143,17 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } } } - + if ((req_nesta = switch_xml_attr(xexten, "require-nested"))) { req_nest = switch_true(req_nesta); } if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space, recur, exten_name, req_nest ? "TRUE" : "FALSE"); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, "%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space, recur, exten_name, req_nest ? "TRUE" : "FALSE"); } @@ -197,7 +197,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * do_break_a = NULL; } } - + if (time_match == 1) { if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, @@ -222,8 +222,8 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } proceed = 0; } - - + + if ((regex_rule = (char *) switch_xml_attr(xcond, "regex"))) { int all = !strcasecmp(regex_rule, "all"); int xor = !strcasecmp(regex_rule, "xor"); @@ -237,7 +237,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * int regex_time_match; check_tz(); regex_time_match = switch_xml_std_datetime_check(xregex, tzoff ? &offset : NULL, tzname_); - + if (regex_time_match == 1) { if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, @@ -266,17 +266,17 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } else { expression = (char *) switch_xml_attr_soft(xregex, "expression"); } - + if ((expression_expanded = switch_channel_expand_variables(channel, expression)) == expression) { expression_expanded = NULL; } else { expression = expression_expanded; } - + total++; - + field = (char *) switch_xml_attr(xregex, "field"); - + if (field) { if (strchr(field, '$')) { if ((field_expanded = switch_channel_expand_variables(channel, field)) == field) { @@ -291,7 +291,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * if (!field_data) { field_data = ""; } - + if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { if ( switch_core_test_flag(SCF_DIALPLAN_TIMESTAMPS) ) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, @@ -338,23 +338,23 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * fail++; if (all) break; } - + if (field && strchr(expression, '(')) { char var[256]; switch_snprintf(var, sizeof(var), "DP_REGEX_MATCH_%d", total); switch_channel_set_variable(channel, var, NULL); switch_capture_regex(re, proceed, field_data, ovector, var, switch_regex_set_var_callback, session); - + switch_safe_free(save_expression); switch_safe_free(save_field_data); switch_regex_safe_free(save_re); - + save_expression = strdup(expression); save_field_data = strdup(field_data); save_re = re; save_proceed = proceed; - + re = NULL; } @@ -370,7 +370,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } } else { if ((all && !fail) || (!all && pass)) { - anti_action = SWITCH_FALSE; + anti_action = SWITCH_FALSE; } } @@ -388,7 +388,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * } else { expression = expression_expanded; } - + if (field) { if (strchr(field, '$')) { if ((field_expanded = switch_channel_expand_variables(channel, field)) == field) { @@ -445,7 +445,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t * if (save_re) { re = save_re; save_re = NULL; - + expression = expression_expanded = save_expression; save_expression = NULL; field_data = field_expanded = save_field_data; diff --git a/src/mod/directories/mod_ldap/mod_ldap.c b/src/mod/directories/mod_ldap/mod_ldap.c index 18e06be046..fd7bbd43c3 100644 --- a/src/mod/directories/mod_ldap/mod_ldap.c +++ b/src/mod/directories/mod_ldap/mod_ldap.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/endpoints/mod_alsa/mod_alsa.c b/src/mod/endpoints/mod_alsa/mod_alsa.c index f7d933b29e..ecb7c53eb3 100644 --- a/src/mod/endpoints/mod_alsa/mod_alsa.c +++ b/src/mod/endpoints/mod_alsa/mod_alsa.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -163,8 +163,8 @@ SWITCH_STANDARD_API(pa_cmd); -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 72c29a9a5d..898b21345f 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -161,7 +161,7 @@ typedef struct mdl_transport { unsigned int ssrc; char local_user[17]; - char local_pass[17]; + char local_pass[17]; char *remote_user; char *remote_pass; int ptime; @@ -170,18 +170,18 @@ typedef struct mdl_transport { switch_codec_t read_codec; switch_codec_t write_codec; - + switch_frame_t read_frame; - + uint32_t codec_rate; char *codec_name; - + switch_payload_t codec_num; switch_payload_t r_codec_num; - + char *stun_ip; uint16_t stun_port; - + switch_rtp_t *rtp_session; ldl_transport_type_t type; @@ -206,9 +206,9 @@ typedef struct mdl_transport { char *local_crypto_key; char *remote_crypto_key; - + ldl_crypto_data_t *local_crypto_data; - + } mdl_transport_t; @@ -224,7 +224,7 @@ struct private_object { const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS]; unsigned int num_codecs; - mdl_transport_t transports[LDL_TPORT_MAX+1]; + mdl_transport_t transports[LDL_TPORT_MAX+1]; ldl_session_t *dlsession; @@ -331,7 +331,7 @@ static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile) { switch_cache_db_handle_t *dbh = NULL; char *dsn; - + if (!zstr(profile->odbc_dsn)) { dsn = profile->odbc_dsn; } else { @@ -341,7 +341,7 @@ static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile) if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { dbh = NULL; } - + return dbh; } @@ -598,9 +598,9 @@ static switch_status_t chat_send(switch_event_t *message_event) char *user = NULL, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL; mdl_profile_t *profile = NULL; const char *proto; - const char *from; - const char *from_full; - const char *to_full; + const char *from; + const char *from_full; + const char *to_full; const char *to; const char *body; const char *hint; @@ -617,7 +617,7 @@ static switch_status_t chat_send(switch_event_t *message_event) profile_name = switch_event_get_header(message_event, "ldl_profile"); switch_assert(proto != NULL); - + if (from && (f_user = strdup(from))) { if ((f_host = strchr(f_user, '@'))) { *f_host++ = '\0'; @@ -644,13 +644,13 @@ static switch_status_t chat_send(switch_event_t *message_event) from = hint; } else { char *p; - + if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { from = ffrom = strdup(profile->login); } else { from = ffrom = switch_mprintf("%s+%s", proto, from); } - + if ((p = strchr(from, '/'))) { *p = '\0'; } @@ -943,14 +943,14 @@ static int get_codecs(struct private_object *tech_pvt) codec_order_last = globals.codec_order_last; codec_order_p = globals.codec_order; } - + if (codec_string) { if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, NULL, SWITCH_MAX_CODECS, codec_order_p, 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(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n"); return 0; @@ -994,7 +994,7 @@ static void handle_thread_launch(ldl_handle_t *handle) } -switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, +switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction) { unsigned char b64_key[512] = ""; @@ -1043,7 +1043,7 @@ switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_ } -static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, +static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, const char *key_str, switch_rtp_crypto_direction_t direction) { unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN]; @@ -1083,11 +1083,11 @@ static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, memcpy(tech_pvt->transports[ttype].remote_raw_key, key, SWITCH_RTP_KEY_LEN); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, "%s Setting %s crypto key\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); tech_pvt->transports[ttype].has_crypto++; - + return SWITCH_STATUS_SUCCESS; } @@ -1100,7 +1100,7 @@ static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, } -static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype) +static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype) { if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { @@ -1114,19 +1114,19 @@ static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t tty if (tech_pvt->transports[ttype].crypto_type) { - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, - SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type, + switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, + SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->transports[ttype].crypto_type, tech_pvt->transports[ttype].local_raw_key, SWITCH_RTP_KEY_LEN); - - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, - SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_tag, - tech_pvt->transports[ttype].crypto_type, + + switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, + SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_tag, + tech_pvt->transports[ttype].crypto_type, tech_pvt->transports[ttype].remote_raw_key, SWITCH_RTP_KEY_LEN); - + switch_channel_set_variable(tech_pvt->channel, "jingle_secure_audio_confirmed", "true"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, "%s %s crypto confirmed\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); } @@ -1203,7 +1203,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt) tech_pvt->transports[LDL_TPORT_RTP].write_codec.session = tech_pvt->session; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].write_codec.implementation->samples_per_second); - + switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec); switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].write_codec); } @@ -1221,23 +1221,23 @@ static int activate_audio_rtp(struct private_object *tech_pvt) } if (tech_pvt->transports[LDL_TPORT_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_RTP].local_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_RTP].local_port, - tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, - tech_pvt->transports[LDL_TPORT_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_RTP].local_port, + tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, + tech_pvt->transports[LDL_TPORT_RTP].remote_ip, tech_pvt->transports[LDL_TPORT_RTP].remote_port, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet - + ); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_RTP].local_port, - tech_pvt->transports[LDL_TPORT_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_RTP].local_port, + tech_pvt->transports[LDL_TPORT_RTP].remote_ip, tech_pvt->transports[LDL_TPORT_RTP].remote_port, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, @@ -1283,20 +1283,20 @@ static int activate_audio_rtp(struct private_object *tech_pvt) if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { - switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR, + switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR, tech_pvt->transports[LDL_TPORT_RTCP].remote_port, SWITCH_FALSE); } try_secure(tech_pvt, LDL_TPORT_RTP); - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_RTP].remote_user, + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_RTP].remote_user, tech_pvt->transports[LDL_TPORT_RTP].local_user, - tech_pvt->transports[LDL_TPORT_RTP].remote_pass, NULL, + tech_pvt->transports[LDL_TPORT_RTP].remote_pass, NULL, IPR_RTP, ICE_GOOGLE_JINGLE, 0); - + if ((vad_in && inb) || (vad_out && !inb)) { if (switch_rtp_enable_vad(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec, SWITCH_VAD_FLAG_TALKING) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VAD ERROR %s\n", err); @@ -1308,18 +1308,18 @@ static int activate_audio_rtp(struct private_object *tech_pvt) } //switch_rtp_set_cng_pt(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 13); switch_rtp_set_telephony_event(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 101); - + if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_RTCP].remote_user, + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_RTCP].remote_user, tech_pvt->transports[LDL_TPORT_RTCP].local_user, - tech_pvt->transports[LDL_TPORT_RTCP].remote_pass, + tech_pvt->transports[LDL_TPORT_RTCP].remote_pass, NULL, IPR_RTCP, ICE_GOOGLE_JINGLE, 0); - + } - + } @@ -1341,7 +1341,7 @@ static int activate_video_rtp(struct private_object *tech_pvt) switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; int r = 1, locked = 0; - + if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { r = 1; goto end; } @@ -1353,7 +1353,7 @@ static int activate_video_rtp(struct private_object *tech_pvt) if (zstr(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp codecs received!\n"); - r = 0; goto end; + r = 0; goto end; } if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) { @@ -1418,23 +1418,23 @@ static int activate_video_rtp(struct private_object *tech_pvt) if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet - + ); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, @@ -1468,32 +1468,32 @@ static int activate_video_rtp(struct private_object *tech_pvt) switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc); if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { - switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR, + switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port, SWITCH_FALSE); } try_secure(tech_pvt, LDL_TPORT_VIDEO_RTP); - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user, + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user, NULL, NULL, IPR_RTP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass); switch_channel_set_flag(channel, CF_VIDEO); switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); //switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); - + if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { - - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user, + + switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, + tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].local_user, NULL, NULL, IPR_RTCP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_pass); } - + } end: @@ -1529,7 +1529,7 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip; char *err = NULL, *address = NULL; - + if (!force && tech_pvt->transports[ttype].ready) { return 0; } @@ -1594,14 +1594,14 @@ static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_ty cand->password = tech_pvt->transports[ttype].local_pass; cand->pref = 1; cand->protocol = "udp"; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send %s Candidate %s:%d [%s]\n", ldl_transport_type_str(ttype), cand->address, cand->port, cand->username); - + tech_pvt->transports[ttype].ready = 1; - + return 1; } @@ -1637,15 +1637,15 @@ static int do_candidates(struct private_object *tech_pvt, int force) } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n", tech_pvt->transports[LDL_TPORT_RTP].accepted, tech_pvt->transports[LDL_TPORT_RTP].total); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n", tech_pvt->transports[LDL_TPORT_RTCP].accepted, tech_pvt->transports[LDL_TPORT_RTCP].total); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n", tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].total); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n", tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].total); @@ -1691,9 +1691,9 @@ static void setup_codecs(struct private_object *tech_pvt) dft_video = idx; } } - + if (dft_audio == -1 && dft_video == -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n"); return; } @@ -1745,7 +1745,7 @@ static void setup_codecs(struct private_object *tech_pvt) payloads[1].width = 600; payloads[1].height = 400; payloads[1].framerate = 30; - + idx++; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have video codec.\n"); @@ -1771,8 +1771,8 @@ static void setup_codecs(struct private_object *tech_pvt) tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, idx, switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT, - &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc, - tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data, + &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc, + tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_crypto_data); @@ -1885,7 +1885,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session) if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { switch_rtp_ping(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); - } + } switch_yield(20000); } @@ -1908,7 +1908,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session) } ret = SWITCH_STATUS_SUCCESS; - switch_channel_audio_sync(channel); + switch_channel_audio_sync(channel); goto done; @@ -1920,8 +1920,8 @@ static switch_status_t negotiate_media(switch_core_session_t *session) return ret; } -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ @@ -2028,7 +2028,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt->profile) { switch_thread_rwlock_unlock(tech_pvt->profile->rwlock); - + if (tech_pvt->profile->purge) { mdl_profile_t *profile = tech_pvt->profile; if (switch_core_hash_delete(globals.profile_hash, profile->name)) { @@ -2074,7 +2074,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) ldl_session_terminate(tech_pvt->dlsession); switch_set_flag_locked(tech_pvt, TFLAG_TERM); } - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel)); @@ -2172,7 +2172,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (switch_test_flag(tech_pvt, TFLAG_IO)) { //switch_status_t status; - + switch_assert(tech_pvt->transports[LDL_TPORT_RTP].rtp_session != NULL); tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; @@ -2302,7 +2302,7 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session, tech_pvt = (struct private_object *) switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { return SWITCH_STATUS_GENERR; } @@ -2314,9 +2314,9 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session, return SWITCH_STATUS_GENERR; } } - + tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 0; - + while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) { tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.flags = SFF_NONE; switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame, flags); @@ -2328,7 +2328,7 @@ static switch_status_t channel_read_video_frame(switch_core_session_t *session, } *frame = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame; - + return SWITCH_STATUS_SUCCESS; } @@ -2702,7 +2702,7 @@ static switch_status_t list_profiles(const char *line, const char *cursor, switc } } else { switch_console_push_match(&my_matches, profile->name); - } + } } if (my_matches) { @@ -3220,13 +3220,13 @@ static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_pr (new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count) ) { uint32_t i; - + if (!(((!new_profile->odbc_dsn && !profile->odbc_dsn) || - (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) + (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) )) { return SWITCH_FALSE; } - + for (i = 0; i < new_profile->acl_count; i++) { if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) { @@ -3560,9 +3560,9 @@ static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id) switch_safe_free(xmlstr); } -static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject) +static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject) { - + ldl_candidate_t *candidates; unsigned int len = 0; unsigned int x, choice = 0, ok = 0; @@ -3598,12 +3598,12 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session } for (y = 0; y < tech_pvt->profile->acl_count; y++) { - + if (switch_check_network_list_ip(candidates[x].address, tech_pvt->profile->acl[y])) { choice = x; ok = 1; } - + if (ok) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]); @@ -3616,13 +3616,13 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session } } else { for (x = 0; x < len; x++) { - + if (tech_pvt->profile->lanaddr) { lanaddr = strncasecmp(candidates[x].address, tech_pvt->profile->lanaddr, strlen(tech_pvt->profile->lanaddr)) ? 0 : 1; } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n", ldl_transport_type_str(ttype), candidates[x].address, candidates[x].port); @@ -3655,7 +3655,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session end_candidates: - + if (ok) { ldl_payload_t payloads[5]; char *key; @@ -3664,7 +3664,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session if (tech_pvt->transports[ttype].accepted) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n", tech_pvt->transports[ttype].remote_ip, tech_pvt->transports[ttype].remote_port); //goto end; } @@ -3675,7 +3675,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session //goto end; } - + memset(payloads, 0, sizeof(payloads)); tech_pvt->transports[ttype].accepted++; @@ -3693,7 +3693,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session tech_pvt->transports[ttype].crypto_type = 0; } } - + if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); //ldl_session_accept_candidate(dlsession, &candidates[choice]); @@ -3758,7 +3758,7 @@ static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session } -static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session, +static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, ldl_payload_t *payloads, unsigned int len) { struct private_object *tech_pvt = NULL; @@ -3766,7 +3766,7 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess unsigned int x, y; int match = 0; - tech_pvt = switch_core_session_get_private(session); + tech_pvt = switch_core_session_get_private(session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len); for (x = 0; x < len; x++) { @@ -3775,7 +3775,7 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess for (y = 0; y < tech_pvt->num_codecs; y++) { char *name = tech_pvt->codecs[y]->iananame; - if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) || + if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) || (ttype == LDL_TPORT_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_AUDIO)) { continue; } @@ -3792,10 +3792,10 @@ static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_sess } else { match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0; } - + if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) { tech_pvt->transports[ttype].codec_index = y; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n", ldl_transport_type_str(ttype), y, payloads[x].name, payloads[x].id); @@ -3841,7 +3841,7 @@ static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t tech_pvt = switch_core_session_get_private(session); - + if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_RTP, payloads, len)) == LDL_STATUS_SUCCESS) { match++; } @@ -3863,7 +3863,7 @@ static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t return status; } - + 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) @@ -4060,21 +4060,21 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", hint); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ldl_profile", profile->name); - + if (msg) { switch_event_add_body(event, "%s", msg); } } else { abort(); } - + switch_safe_free(from_user); if (!zstr(msg)) { if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */ switch_core_chat_send(proto, event); } - + switch_core_chat_send("GLOBAL", event); } @@ -4237,15 +4237,15 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (switch_stristr("voice.google.com", from)) { char *id = switch_core_session_strdup(session, from); char *p; - + if ((p = strchr(id, '@'))) { *p++ = '\0'; cid_name = "Google Voice"; cid_num = id; } - + ldl_session_set_gateway(dlsession); - + do_candidates(tech_pvt, 1); } @@ -4289,7 +4289,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi switch_safe_free(tmp); } - + if (!tech_pvt->caller_profile) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten); @@ -4321,7 +4321,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession)); ldl_session_set_private(dlsession, session); - + switch_channel_set_name(channel, "DingaLing/new"); switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { @@ -4395,7 +4395,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (dl_signal) { ldl_payload_t *payloads; unsigned int len = 0; - + if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { if (msg && !strcasecmp(msg, "accept")) { switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); @@ -4433,9 +4433,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi status = LDL_STATUS_SUCCESS; status = parse_candidates(dlsession, session, LDL_TPORT_RTP, subject); - status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); + status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); status = parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject); - status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject); + status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject); } break; diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 80bee58265..75f62148e3 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -219,7 +219,7 @@ struct GSMopenHandles { #endif //WIN32 -/*! +/*! * \brief structure for storing the results of AT commands, in an array of AT_MESG_MAX_LINES * AT_MESG_MAX_LENGTH chars */ struct s_result { diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index eb2e8c75d5..bfd465501a 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1086,7 +1086,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us } else if (option_debug) { DEBUGA_GSMOPEN("|%s| +CNUM: Subscriber number = %s, Type = %d\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], number, type); } - + /* Copy only the first number listed if there are more then one */ if (tech_pvt->requesting_subscriber_number && !strlen(tech_pvt->subscriber_number)) strncpy(tech_pvt->subscriber_number, number, sizeof(tech_pvt->subscriber_number)); @@ -1496,8 +1496,8 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us //identifying dcs alphabet according to GSM 03.38 Cell Broadcast Data Coding Scheme //CBDataCodingScheme should be used here, but it appears to be buggy (ucs2 messages are not recognized) - int alphabet = DCS_RESERVED_ALPHABET; - if (dcs == 0x11) { + int alphabet = DCS_RESERVED_ALPHABET; + if (dcs == 0x11) { alphabet = DCS_SIXTEEN_BIT_ALPHABET; } else if ((dcs & 0xF0) <= 0x30){ alphabet = DCS_DEFAULT_ALPHABET; @@ -1531,7 +1531,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us ERRORA("USSD data coding scheme not supported=%d\n", GSMOPEN_P_LOG, dcs); } - NOTICA("USSD received: status=%d, message='%s', dcs='%d'\n", + NOTICA("USSD received: status=%d, message='%s', dcs='%d'\n", GSMOPEN_P_LOG, tech_pvt->ussd_status, tech_pvt->ussd_message, dcs); ussd_incoming(tech_pvt); @@ -1841,7 +1841,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us #if 0 char letsee[1024]; memset(letsee, '\0', sizeof(letsee)); - + DEBUGA_GSMOPEN("about to letsee\n", GSMOPEN_P_LOG); try { sprintf(letsee, "|%s|\n", sms->toString().c_str()); @@ -1852,7 +1852,7 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us return -1; } DEBUGA_GSMOPEN("after letsee\n", GSMOPEN_P_LOG); - + DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, letsee); #endif //0 memset(content2, '\0', sizeof(content2)); @@ -3041,7 +3041,7 @@ int gsmopen_ussd(private_t *tech_pvt, char *ussd, int waittime) memset(at_command, '\0', sizeof(at_command)); tech_pvt->ussd_received = 0; - if (tech_pvt->ussd_request_encoding == USSD_ENCODING_PLAIN + if (tech_pvt->ussd_request_encoding == USSD_ENCODING_PLAIN ||tech_pvt->ussd_request_encoding == USSD_ENCODING_AUTO) { snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_enc.c_str()); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); @@ -3058,7 +3058,7 @@ int gsmopen_ussd(private_t *tech_pvt, char *ussd, int waittime) snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_hex.c_str()); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); } else if (tech_pvt->ussd_request_encoding == USSD_ENCODING_HEX_8BIT) { - string ussd_h8 = bufToHex((const unsigned char*)ussd_enc.c_str(), ussd_enc.length()); + string ussd_h8 = bufToHex((const unsigned char*)ussd_enc.c_str(), ussd_enc.length()); snprintf(at_command, sizeof(at_command), "AT+CUSD=1,\"%s\",15", ussd_h8.c_str()); res = gsmopen_serial_write_AT_ack(tech_pvt, at_command); } else if (tech_pvt->ussd_request_encoding == USSD_ENCODING_UCS2) { diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index afd0993159..20697adda4 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -259,7 +259,7 @@ static switch_status_t list_interfaces(const char *line, const char *cursor, swi *matches = my_matches; status = SWITCH_STATUS_SUCCESS; } - + return status; } @@ -1261,7 +1261,7 @@ static switch_status_t load_config(int reload_type) //int controldevice_audio_speed = 115200; //FIXME TODO uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO const char *gsmopen_serial_sync_period = "300"; //FIXME TODO - const char *imei = ""; + const char *imei = ""; const char *imsi = ""; tech_pvt = NULL; @@ -1580,15 +1580,15 @@ static switch_status_t load_config(int reload_type) globals.GSMOPEN_INTERFACES[interface_id].gsmopen_serial_sync_period = atoi(gsmopen_serial_sync_period); globals.GSMOPEN_INTERFACES[interface_id].ussd_request_encoding = - strcasecmp(ussd_request_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : - strcasecmp(ussd_request_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : - strcasecmp(ussd_request_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : + strcasecmp(ussd_request_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : + strcasecmp(ussd_request_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : + strcasecmp(ussd_request_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : strcasecmp(ussd_request_encoding, "ucs2") == 0 ? USSD_ENCODING_UCS2 : USSD_ENCODING_AUTO; globals.GSMOPEN_INTERFACES[interface_id].ussd_response_encoding = - strcasecmp(ussd_response_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : - strcasecmp(ussd_response_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : - strcasecmp(ussd_response_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : + strcasecmp(ussd_response_encoding, "plain") == 0 ? USSD_ENCODING_PLAIN : + strcasecmp(ussd_response_encoding, "hex7") == 0 ? USSD_ENCODING_HEX_7BIT : + strcasecmp(ussd_response_encoding, "hex8") == 0 ? USSD_ENCODING_HEX_8BIT : strcasecmp(ussd_response_encoding, "ucs2") == 0 ? USSD_ENCODING_UCS2 : USSD_ENCODING_AUTO; globals.GSMOPEN_INTERFACES[interface_id].controldevice_speed = controldevice_speed; //FIXME @@ -2224,7 +2224,7 @@ private_t *find_available_gsmopen_interface_rr(private_t *tech_pvt_calling) switch_mutex_unlock(globals.mutex); return tech_pvt; } - } + } } switch_mutex_unlock(globals.mutex); @@ -2757,7 +2757,7 @@ SWITCH_STANDARD_API(gsmopen_ussd_function) stream->write_function(stream, "ERROR, usage: %s", USSD_SYNTAX); goto end; } - + if (argc >= 3 && strcasecmp(argv[2], "nowait")==0) { waittime = 0; } @@ -2794,10 +2794,10 @@ SWITCH_STANDARD_API(gsmopen_ussd_function) stream->write_function(stream, "ERROR: no response received\n"); } else { stream->write_function(stream, "Status: %d%s\n", tech_pvt->ussd_status, - tech_pvt->ussd_status == 0 ? " - completed" : - tech_pvt->ussd_status == 1 ? " - action required" : + tech_pvt->ussd_status == 0 ? " - completed" : + tech_pvt->ussd_status == 1 ? " - action required" : tech_pvt->ussd_status == 2 ? " - error" : ""); - if (strlen(tech_pvt->ussd_message) != 0) + if (strlen(tech_pvt->ussd_message) != 0) stream->write_function(stream, "Text: %s\n", tech_pvt->ussd_message); } } diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 4f4c112857..8816252aea 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1,4 +1,4 @@ -/* +/* * H323 endpoint interface for Freeswitch Modular Media Switching Software Library / * Soft-Switch Application * @@ -19,9 +19,9 @@ * * Contributor(s): * Jan Willamowius. - * - * - * + * + * + * * * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * @@ -207,7 +207,7 @@ void h_timer(unsigned sec) #else timeval timeout; timeout.tv_sec = sec; - timeout.tv_usec = 0; + timeout.tv_usec = 0; select(0, NULL, NULL, NULL, &timeout); #endif } @@ -255,7 +255,7 @@ class FSTrace : public ostream { *pptr() = (char)c; bufSize++; } - + if (bufSize != 0) { char *bufPtr = pbase(); char *bufEndPtr = NULL; @@ -263,11 +263,11 @@ class FSTrace : public ostream { bufPtr[bufSize] = '\0'; int line = 0; char *p; - + char *file = NULL; switch_log_level_t level; - + switch (strtoul(bufPtr, &file, 10)) { case 1 : level = SWITCH_LOG_INFO; @@ -279,7 +279,7 @@ class FSTrace : public ostream { if (file) { while (isspace(*file)) file++; - + if (file && (bufPtr = strchr(file, '(')) && (bufEndPtr = strchr(bufPtr, ')'))) { char *e; @@ -300,7 +300,7 @@ class FSTrace : public ostream { } } } - + switch_text_channel_t tchannel = SWITCH_CHANNEL_ID_LOG; if (!bufPtr) { @@ -316,7 +316,7 @@ class FSTrace : public ostream { switch_log_printf(tchannel, file, func, line, NULL, level, fmt, bufPtr); } - + } return 0; @@ -352,7 +352,7 @@ PString GetH245CodecName(const H323Capability* cap) case H245_AudioCapability::e_gsmFullRate: case H245_AudioCapability::e_gsmHalfRate: case H245_AudioCapability::e_gsmEnhancedFullRate: - return "GSM"; + return "GSM"; } return "L16"; } @@ -369,7 +369,7 @@ FSProcess::~FSProcess(){ bool FSProcess::Initialise(switch_loadable_module_interface_t *iface) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "======>FSProcess::Initialise [%p]\n", this); - + m_h323endpoint = new FSH323EndPoint(); return m_h323endpoint != NULL && m_h323endpoint->Initialise(iface); } @@ -388,13 +388,13 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface) m_freeswitch->interface_name = modulename; m_freeswitch->io_routines = &h323fs_io_routines; m_freeswitch->state_handler = &h323fs_event_handlers; - + PString codec = ((const char *)mod_h323_globals.codec_string); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config capability %s \n", (const char *)codec); - if (!codec.IsEmpty()) { + if (!codec.IsEmpty()) { const char** f = h323_formats; - for (; *f; f += 2) { + for (; *f; f += 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Find capability %s to %s\n",f[1], (const char *)codec); if (codec.Find(f[1]) != P_MAX_INDEX) { PString tmp = f[0]; @@ -410,15 +410,15 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface) AddAllCapabilities(0, 0, tmp); num = GetCapabilities().GetSize() - init; } - if (num) + if (num) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H.323 added %d capabilities '%s' \n",num,(const char *)tmp); else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 failed to add capability '%s' \n",(const char *)tmp); - - } + + } } } - + if (m_fax_old_asn) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "--->fax_old_asn\n"); SetT38_IFP_PRE(); @@ -427,16 +427,16 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "--->fax_asn\n"); SetCapability(0, 0, new FSH323_T38Capability(OpalT38_IFP_COR)); } - + AddAllUserInputCapabilities(0, 1); - + DisableFastStart(!m_faststart); DisableH245Tunneling(!m_h245tunneling); DisableH245inSetup(!m_h245insetup); DisableDetectInBandDTMF(!m_dtmfinband); if (!m_endpointname.IsEmpty()) SetLocalUserName(m_endpointname); - + if (m_listeners.empty()) { StartListener(""); } else { @@ -452,7 +452,7 @@ bool FSH323EndPoint::Initialise(switch_loadable_module_interface_t *iface) m_thread->SetAutoDelete(); m_thread->Resume(); } - + return TRUE; } @@ -464,7 +464,7 @@ switch_status_t FSH323EndPoint::ReadConfig(int reload) switch_status_t status = SWITCH_STATUS_SUCCESS; switch_memory_pool_t *pool = NULL; - + if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); return status; @@ -551,7 +551,7 @@ switch_status_t FSH323EndPoint::ReadConfig(int reload) m_ai = atoi(val); } else if (!strcasecmp(var, "fax-old-asn")) { m_fax_old_asn = switch_true(val); - } + } } } @@ -606,7 +606,7 @@ FSH323EndPoint::FSH323EndPoint() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this); terminalType = e_GatewayAndMC; -} +} FSH323EndPoint::~FSH323EndPoint() { @@ -628,12 +628,12 @@ H323Connection *FSH323EndPoint::CreateConnection( } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------> SWITCH_CALL_DIRECTION_INBOUND\n"); } - - switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(), + + switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(), (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL); if (fsSession == NULL) return NULL; - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------> fsSession = %p\n",fsSession); switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession); @@ -641,7 +641,7 @@ H323Connection *FSH323EndPoint::CreateConnection( switch_core_session_destroy(&fsSession); return NULL; } - + return new FSH323Connection(*this, transport, callReference, (switch_caller_profile_t *)userData, fsSession, fsChannel); } @@ -670,7 +670,7 @@ void FSH323EndPoint::StartGkClient(int retry, PString* gkAddress,PString* gkIden if (m_stop_gk) { m_stop_gk = false; return; - } + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Wait next go connect gatekeeper %d\n",retry); h_timer(retry); if (m_stop_gk) { @@ -681,7 +681,7 @@ void FSH323EndPoint::StartGkClient(int retry, PString* gkAddress,PString* gkIden } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n", - (const char *)GetGatekeeper()->GetName()); + (const char *)GetGatekeeper()->GetName()); m_thread = NULL; } @@ -692,7 +692,7 @@ void FSH323EndPoint::StopGkClient() if (m_thread) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stop gatekeeper thread\n"); m_stop_gk = true; - + while (m_stop_gk){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Wait stop gatekeeper thread\n"); h_timer(2); @@ -727,11 +727,11 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran tech_pvt->me = this; tech_pvt->active_connection = true; switch_core_session_set_private(m_fsSession, tech_pvt); - + switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession)); switch_mutex_init(&tech_pvt->h323_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession)); switch_mutex_init(&tech_pvt->h323_io_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession)); - + if (outbound_profile != NULL) { SetLocalPartyName(outbound_profile->caller_id_number); SetDisplayName(outbound_profile->caller_id_name); @@ -745,7 +745,7 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran switch_channel_set_state(m_fsChannel, CS_INIT); } -} +} FSH323Connection::~FSH323Connection() { @@ -764,13 +764,13 @@ FSH323Connection::~FSH323Connection() } else if (m_RTPlocalPort) { switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort); } - + tech_pvt->me = NULL; tech_pvt->active_connection = false; // switch_mutex_unlock(tech_pvt->h323_mutex); // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); switch_safe_free(tech_pvt->token); -} +} void FSH323Connection::AttachSignalChannel(const PString & token, H323Transport * channel, @@ -796,7 +796,7 @@ bool FSH323Connection::SetLocalCapabilities() if (!mod_h323_globals.codec_string) return false; - + bool nocodecs = true; bool changed = false; @@ -813,7 +813,7 @@ bool FSH323Connection::SetLocalCapabilities() if (fastStartChannels[idx].GetCapability() == localCapabilities[i]) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Removing fast start channel %s '%s' (%s)\n",GetDirections[fastStartChannels[idx].GetDirection()],(const char*)fname,(const char*)format); fastStartChannels.RemoveAt(idx--); - } + } } localCapabilities.Remove(fname); i--; @@ -825,7 +825,7 @@ bool FSH323Connection::SetLocalCapabilities() if (nocodecs) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No codecs remaining for H323 connection [%p]\n",this); changed = false; - ClearCall(EndedByCapabilityExchange); + ClearCall(EndedByCapabilityExchange); } return changed; @@ -836,12 +836,12 @@ bool FSH323Connection::decodeCapability(const H323Capability& capability, const switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::decodeCapability [%p]\n",this); PString fname((const char *)capability.GetFormatName()); - + if (fname.Find("{sw}") == (fname.GetLength() - 4)) fname = fname.Mid(0,fname.GetLength()-4); if (fname.Find("{hw}") == (fname.GetLength() - 4)) fname = fname.Mid(0,fname.GetLength()-4); - + OpalMediaFormat oformat(fname, false); int pload = oformat.GetPayloadType(); const char *format = 0; @@ -853,7 +853,7 @@ bool FSH323Connection::decodeCapability(const H323Capability& capability, const break; } } - + if (format) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"capability '%s' format '%s' %d\n",(const char*)fname,format,pload); if (capabName) @@ -872,7 +872,7 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString const H323SignalPDU &setupPDU, H323SignalPDU &connectPDU) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnAnswerCall caller = %s [%p]\n",(const char*)caller,this); - + if (m_fsSession == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Session request failed.\n"); return H323Connection::AnswerCallDenied; @@ -902,14 +902,14 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString else { PString callnam; if (q931.GetCalledPartyNumber(callnam)) { - called=(const char *)callnam; + called=(const char *)callnam; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Called-Party-Number = %s\n",(const char*)called); } } - + PIPSocket::Address remote_network_addr; GetSignallingChannel()->GetRemoteAddress().GetIpAddress(remote_network_addr); - + switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession), NULL, /** username */ @@ -976,7 +976,7 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString H323Channel* FSH323Connection::CreateRealTimeLogicalChannel(const H323Capability& capability,H323Channel::Directions dir,unsigned sessionID,const H245_H2250LogicalChannelParameters* param, RTP_QOS * rtpqos) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::CreateRealTimeLogicalChannel [%p]\n",this); - + H323TransportAddress m_h323transportadd = GetSignallingChannel()->GetLocalAddress(); m_h323transportadd.GetIpAddress(m_RTPlocalIP); if (!m_RTPlocalPort) { @@ -996,7 +996,7 @@ PBoolean FSH323Connection::OnStartLogicalChannel(H323Channel & channel) PBoolean FSH323Connection::OnCreateLogicalChannel(const H323Capability& capability, H323Channel::Directions dir, unsigned& errorCode) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnCreateLogicalChannel ('%s',%s) [%p]\n",(const char *)capability.GetFormatName(),GetDirections[dir],this); - + return H323Connection::OnCreateLogicalChannel(capability,dir,errorCode); } @@ -1011,7 +1011,7 @@ void FSH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession); } tech_pvt->me = NULL; - switch_channel_hangup(switch_core_session_get_channel(m_fsSession),(switch_call_cause_t)pdu.GetQ931().GetCause()); + switch_channel_hangup(switch_core_session_get_channel(m_fsSession),(switch_call_cause_t)pdu.GetQ931().GetCause()); return H323Connection::OnReceivedReleaseComplete(pdu); } @@ -1042,7 +1042,7 @@ bool FSH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------> after callProceedingPDU.BuildCallProceeding connectionState = %s [%p]\n",ConnectionStatesNames[connectionState],this); if (connectionState == ShuttingDownConnection){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------> connectionState = ShuttingDownConnection [%p]\n",this); - return false; + return false; } if (SendFastStartAcknowledge(callProceeding.m_fastStart)) { @@ -1069,7 +1069,7 @@ bool FSH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU) return false; } - return true; + return true; } bool FSH323Connection::OnReceivedCallProceeding(const H323SignalPDU & pdu) @@ -1094,7 +1094,7 @@ bool FSH323Connection::OnReceivedCallProceeding(const H323SignalPDU & pdu) bool FSH323Connection::OnSendCallProceeding(H323SignalPDU & callProceedingPDU) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendCallProceeding fastStartState = %s [%p]\n",FastStartStateNames[fastStartState],this); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendCallProceeding fastStartState = %s [%p]\n",FastStartStateNames[fastStartState],this); return false; // return true; @@ -1102,7 +1102,7 @@ bool FSH323Connection::OnSendCallProceeding(H323SignalPDU & callProceedingPDU) bool FSH323Connection::OnSendReleaseComplete(H323SignalPDU & pdu) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendReleaseComplete cause = %u\n",(switch_call_cause_t)pdu.GetQ931().GetCause()); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSendReleaseComplete cause = %u\n",(switch_call_cause_t)pdu.GetQ931().GetCause()); switch_channel_hangup(m_fsChannel, (switch_call_cause_t) pdu.GetQ931().GetCause()); return H323Connection::OnSendReleaseComplete(pdu); @@ -1127,19 +1127,19 @@ bool FSH323Connection::OnReceivedCapabilitySet(const H323Capabilities & remoteCa return false; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>END H323Connection::OnReceivedCapabilitySet [%p]\n",this); - + for (int i = 0; i < remoteCapabilities.GetSize(); ++i) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities = %s\n",(const char*)(remoteCapabilities[i].GetFormatName())); } - + H323Capability * cap = remoteCapabilities.FindCapability(H323Capability::e_Audio); if (cap == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities is NULL \n"); return false; } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Capabilities not NULL \n"); - - return connectionState != ShuttingDownConnection; + + return connectionState != ShuttingDownConnection; } bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PString &user) @@ -1147,7 +1147,7 @@ bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PStrin switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnAlerting user = %s [%p]\n",(const char *)user,this); unsigned pi; switch_channel_mark_ring_ready(m_fsChannel); - + if (!alertingPDU.GetQ931().GetProgressIndicator(pi)) pi = 0; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----------->OnAlerting PI = %u\n",pi); @@ -1164,7 +1164,7 @@ bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PStrin void FSH323Connection::AnsweringCall(AnswerCallResponse response) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::AnsweringCall [%p]\n",this); - + switch (response) { case AnswerCallDeferredWithMedia:{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Answering call: %s\n",GetAnswerCallResponse[response]); @@ -1198,15 +1198,15 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response) } fac.IncludeOptionalField(H225_Facility_UUIE::e_h245Address); controlChannel->SetUpTransportPDU(fac.m_h245Address, TRUE); - } + } else sendPDU = FALSE; } -*/ - const char *vpi = switch_channel_get_variable(m_fsChannel, "progress-indication"); +*/ + const char *vpi = switch_channel_get_variable(m_fsChannel, "progress-indication"); unsigned pi = 8; if (vpi){ - pi = atoi(vpi); + pi = atoi(vpi); } else pi = m_endpoint->m_pi; if ((pi< 1) || (pi > 8)||(pi == 7)) pi = 8; @@ -1220,7 +1220,7 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response) Unlock(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->UnLock\n"); return; - } + } case AnswerCallPending :{ if (alertingPDU != NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->Lock\n"); @@ -1229,17 +1229,17 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->Lock ok\n"); // send Q931 Alerting PDU switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Sending Alerting PDU\n"); - - const char *vai = switch_channel_get_variable(m_fsChannel, "alerting-indication"); + + const char *vai = switch_channel_get_variable(m_fsChannel, "alerting-indication"); unsigned ai = 0; if (vai){ - ai = atoi(vai); + ai = atoi(vai); } else ai = m_endpoint->m_ai; if ((ai< 0) || (ai > 8)||(ai == 7)) ai = 8; if (ai > 0) (*alertingPDU).GetQ931().SetProgressIndicator(ai); - + HandleTunnelPDU(alertingPDU); WriteSignalPDU(*alertingPDU); alertingTime = PTime(); @@ -1250,20 +1250,20 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response) } } default :H323Connection::AnsweringCall(response); - } + } } void FSH323Connection::OnEstablished() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnEstablished [%p]\n",this); - if(m_startRTP) + if(m_startRTP) switch_channel_mark_answered(m_fsChannel); else m_ChannelAnswer = true; if (m_active_channel_fax) RequestModeChangeT38("T.38\nT.38"); - else + else m_active_channel_fax = true; } PBoolean FSH323Connection::OnRequestModeChange(const H245_RequestMode & pdu, @@ -1292,7 +1292,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) for (PINDEX i = 0; i < newMode.GetSize(); i++) { H323Capability * capability = localCapabilities.FindCapability(newMode[i]); if (PAssertNULL(capability) != NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Open channel after mode change: %s\n",(const char*)(capability->GetFormatName())); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Open channel after mode change: %s\n",(const char*)(capability->GetFormatName())); if (capability->GetMainType() == H323Capability::e_Data){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"capability->GetMainType() = H323Capability::e_Data\n"); H245_DataMode & type = newMode[i].m_type; @@ -1308,18 +1308,18 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"switch_core_session_alloc t38_options\n"); } t38_options->T38VendorInfo = "0 0 0"; - + t38_options->T38FaxVersion = (uint16_t)profile.m_version; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxVersion:%lu\n",(unsigned long)profile.m_version); t38_options->T38MaxBitRate = type.m_bitRate*100; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38MaxBitRate:%d\n",t38_options->T38MaxBitRate); - if (profile.m_fillBitRemoval) + if (profile.m_fillBitRemoval) t38_options->T38FaxFillBitRemoval = SWITCH_TRUE; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxFillBitRemoval:%d\n",(int)profile.m_fillBitRemoval); if (profile.m_transcodingMMR) t38_options->T38FaxTranscodingMMR = SWITCH_TRUE; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxTranscodingMMR:%d\n",(int)profile.m_transcodingMMR); - if (profile.m_transcodingJBIG) + if (profile.m_transcodingJBIG) t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxTranscodingJBIG:%d\n",(int)profile.m_transcodingJBIG); if (profile.m_t38FaxRateManagement.GetTag() == H245_T38FaxRateManagement::e_transferredTCF) @@ -1336,10 +1336,10 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) else t38_options->T38FaxUdpEC = "t38UDPRedundancy"; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"T38FaxUdpEC:%s\n",t38_options->T38FaxUdpEC); - const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); + const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); if (uuid != NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",uuid); - + switch_core_session_t *session = switch_core_session_locate(switch_channel_get_partner_uuid(m_fsChannel)); if (session) { switch_channel_t * channel = switch_core_session_get_channel(session); @@ -1351,19 +1351,19 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) switch_core_session_rwunlock(session); }else{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no session\n"); - } - - + } + + switch_core_session_message_t msg = { 0 }; int insist = 0; const char *v; if ((v = switch_channel_get_variable(m_fsChannel, "fax_enable_t38_insist"))) { insist = switch_true(v); - } + } msg.from = switch_channel_get_name(m_fsChannel); msg.message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA; msg.numeric_arg = insist; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",switch_channel_get_uuid(switch_core_session_get_channel(switch_channel_get_session(m_fsChannel)))); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",switch_channel_get_uuid(switch_core_session_get_channel(switch_channel_get_session(m_fsChannel)))); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"uuid:%s\n",uuid); switch_core_session_message_send(uuid,&msg); } else { @@ -1371,7 +1371,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) } } } - } + } } H323Connection::OnModeChanged(newMode); } @@ -1379,7 +1379,7 @@ void FSH323Connection::OnModeChanged(const H245_ModeDescription & newMode) bool FSH323Connection::OnSendSignalSetup(H323SignalPDU & setupPDU) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>PFSH323Connection::OnSendSignalSetup [%p]\n",this); - setupPDU.GetQ931().SetBearerCapabilities(Q931::TransferSpeech, 1); + setupPDU.GetQ931().SetBearerCapabilities(Q931::TransferSpeech, 1); return true; } @@ -1397,14 +1397,14 @@ void FSH323Connection::setRemoteAddress(const char* remoteIP, WORD remotePort) switch_status_t FSH323Connection::on_execute() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_execute [%p]\n",this); - + return SWITCH_STATUS_SUCCESS; } switch_status_t FSH323Connection::on_routing() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_routing [%p]\n",this); - + return SWITCH_STATUS_SUCCESS; } @@ -1417,7 +1417,7 @@ switch_status_t FSH323Connection::kill_channel(int sig) if (!tech_pvt) { return SWITCH_STATUS_FALSE; } - + switch (sig) { case SWITCH_SIG_BREAK: if (switch_rtp_ready(tech_pvt->rtp_session)) { @@ -1427,7 +1427,7 @@ switch_status_t FSH323Connection::kill_channel(int sig) case SWITCH_SIG_KILL: default: m_rxAudioOpened.Signal(); - m_txAudioOpened.Signal(); + m_txAudioOpened.Signal(); if (switch_rtp_ready(tech_pvt->rtp_session)) { if ((m_rtp_resetting == 1)) { switch_core_session_unlock_codec_read(m_fsSession); @@ -1523,12 +1523,12 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); AnsweringCall(AnswerCallPending); AnsweringCall(AnswerCallDeferredWithMedia); - + if (m_txChannel && m_rxChannel){ if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) { switch_channel_mark_pre_answered(m_fsChannel); } - } else { + } else { m_callOnPreAnswer = true; if (fastStartState == FastStartDisabled){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->m_txAudioOpened.Wait START [%p]\n",this); @@ -1544,10 +1544,10 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t } AnsweringCall(H323Connection::AnswerCallNow); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Media started on connection [%p]\n",this); - + if (m_txChannel && m_rxChannel){ if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->switch_channel_mark_answered(m_fsChannel) [%p]\n",this); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-------------------->switch_channel_mark_answered(m_fsChannel) [%p]\n",this); switch_channel_mark_answered(m_fsChannel); } } else{ @@ -1573,7 +1573,7 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); if (m_active_channel_fax) RequestModeChangeT38("T.38\nT.38"); - else + else m_active_channel_fax = true; break; } @@ -1625,7 +1625,7 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t } default:{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Received message id = %d [%p]\n", msg->message_id,this); - } + } } return SWITCH_STATUS_SUCCESS; @@ -1664,14 +1664,14 @@ switch_status_t FSH323Connection::on_init() switch_status_t FSH323Connection::on_exchange_media() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_exchange_media [%p]\n",this); - + return SWITCH_STATUS_SUCCESS; } switch_status_t FSH323Connection::on_soft_execute() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::on_soft_execute [%p]\n",this); - + return SWITCH_STATUS_SUCCESS; } @@ -1759,7 +1759,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc switch_set_flag_locked(tech_pvt, TFLAG_READING); if (!switch_channel_ready(m_fsChannel)) { - switch_clear_flag_locked(tech_pvt, TFLAG_READING); + switch_clear_flag_locked(tech_pvt, TFLAG_READING); #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n"); #endif @@ -1789,7 +1789,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n\n"); #endif - return status; + return status; } // PTRACE(4, "mod_h323\t--------->\n source = "<read_frame.source<< "\n packetlen = "<read_frame.packetlen<<"\n datalen = "<read_frame.datalen<<"\n samples = "<read_frame.samples<<"\n rate = "<read_frame.rate<<"\n payload = "<<(int)tech_pvt->read_frame.payload<<"\n timestamp = "<read_frame.timestamp<<"\n seq = "<read_frame.seq<<"\n ssrc = "<read_frame.ssrc); @@ -1817,7 +1817,7 @@ switch_status_t FSH323Connection::read_audio_frame(switch_frame_t **frame, switc switch_mutex_unlock(tech_pvt->h323_io_mutex); switch_clear_flag_locked(tech_pvt, TFLAG_READING); - + *frame = &tech_pvt->read_frame; #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::read_audio_frame END\n\n"); @@ -1831,11 +1831,11 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame [%p]\n",this); #endif - + /*switch_channel_t *channel = NULL; h323_private_t *tech_pvt = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; - + channel = switch_core_session_get_channel(m_fsSession); assert(channel != NULL); @@ -1860,14 +1860,14 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc switch_status_t status = SWITCH_STATUS_SUCCESS; h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession); switch_assert(tech_pvt != NULL); - + if (!switch_channel_ready(m_fsChannel)) { #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n"); #endif return SWITCH_STATUS_FALSE; } - + while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) { if (switch_channel_ready(m_fsChannel)) { switch_yield(10000); @@ -1878,7 +1878,7 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc return SWITCH_STATUS_GENERR; } } - + if (!switch_core_codec_ready(&tech_pvt->read_codec) || !tech_pvt->read_codec.implementation) { #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n"); @@ -1894,11 +1894,11 @@ switch_status_t FSH323Connection::write_audio_frame(switch_frame_t *frame, switc } switch_set_flag_locked(tech_pvt, TFLAG_WRITING); - + if (switch_rtp_write_frame(tech_pvt->rtp_session, frame) < 0) { status = SWITCH_STATUS_GENERR; } - + switch_clear_flag_locked(tech_pvt, TFLAG_WRITING); #ifdef DEBUG_RTP_PACKETS switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::write_audio_frame END\n\n"); @@ -1923,9 +1923,9 @@ switch_status_t FSH323Connection::write_video_frame(switch_frame_t *frame, switc FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connection, const H323Capability& capability, - Directions direction, + Directions direction, unsigned sessionID, - const PIPSocket::Address& ip, + const PIPSocket::Address& ip, WORD dataPort) : H323_ExternalRTPChannel(connection, capability, direction, sessionID,ip,dataPort) , m_conn(&connection) @@ -1934,23 +1934,23 @@ FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connectio , m_RTPlocalPort(dataPort) , m_sessionID(sessionID) , m_rtp_resetting(0) -{ +{ m_RTPlocalIP = (const char *)ip.AsString(); SetExternalAddress(H323TransportAddress(ip, dataPort), H323TransportAddress(ip, dataPort+1)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel sessionID = %d :%s addr = %s:%d [%p]\n",sessionID,GetDirections[GetDirection()],(const char*)m_RTPlocalIP,m_RTPlocalPort,this); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel sessionID = %d :%s addr = %s:%d [%p]\n",sessionID,GetDirections[GetDirection()],(const char*)m_RTPlocalIP,m_RTPlocalPort,this); m_fsChannel = switch_core_session_get_channel(m_fsSession); //SetExternalAddress(H323TransportAddress(localIpAddress, m_RTPlocalPort), H323TransportAddress(localIpAddress, m_RTPlocalPort+1)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------->capability.GetPayloadType() return = %s\n",((capability.GetPayloadType() <= RTP_DataFrame::LastKnownPayloadType)?PayloadTypesNames[capability.GetPayloadType()]:"[pt=128]")); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------->capability.GetFormatName() return = %s\n",(const char*)(capability.GetFormatName())); - + PString fname((const char *)capability.GetFormatName()); - + if (fname.Find("{sw}") == (fname.GetLength() - 4)) fname = fname.Mid(0,fname.GetLength()-4); if (fname.Find("{hw}") == (fname.GetLength() - 4)) fname = fname.Mid(0,fname.GetLength()-4); - + OpalMediaFormat format(fname, FALSE); m_format = &format; payloadCode = (BYTE)format.GetPayloadType(); @@ -1960,12 +1960,12 @@ FSH323_ExternalRTPChannel::FSH323_ExternalRTPChannel(FSH323Connection& connectio FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel() { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel %s [%p]\n",GetDirections[GetDirection()],this); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::~FSH323_ExternalRTPChannel %s [%p]\n",GetDirections[GetDirection()],this); if (m_rtp_resetting) { switch_core_session_unlock_codec_read(m_fsSession); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_read [%p]\n",m_fsSession); switch_core_session_unlock_codec_write(m_fsSession); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession); } } @@ -1981,19 +1981,19 @@ PBoolean FSH323_ExternalRTPChannel::Start() char * timer_name = NULL; const char *var; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->m_sessionID = %d m_active_sessionID = %d\n",sessionID,m_conn->m_active_sessionID); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->m_sessionID = %d m_active_sessionID = %d\n",sessionID,m_conn->m_active_sessionID); if (!(m_conn && H323_ExternalRTPChannel::Start())) { switch_mutex_unlock(tech_pvt->h323_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); return false; } - + if ((tech_pvt->me == NULL) || ((tech_pvt->me != NULL) && tech_pvt->me->m_channel_hangup)) { switch_mutex_unlock(tech_pvt->h323_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); return false; } - + if ((m_conn->m_active_sessionID != 0) && (m_conn->m_active_sessionID != sessionID)) { if (switch_core_codec_ready(&tech_pvt->read_codec) || switch_core_codec_ready(&tech_pvt->write_codec)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->Changing Codec to %s\n",(const char*)GetH245CodecName(m_capability)); @@ -2048,14 +2048,14 @@ PBoolean FSH323_ExternalRTPChannel::Start() } default:break; } - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetFrameSize() return = %u\n",(unsigned)m_format->GetFrameSize()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetFrameTime() return = %u\n",m_format->GetFrameTime()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->payloadCode = %d\n",(int)payloadCode); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->m_codec_ms return = %u\n",m_codec_ms); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->m_capability->GetFormatName() return = %s\n",(const char*)(m_capability->GetFormatName())); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->GetH245CodecName() return = %s\n",(const char*)GetH245CodecName(m_capability)); - + if (GetDirection() == IsReceiver) { codec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec; //m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer; @@ -2068,14 +2068,14 @@ PBoolean FSH323_ExternalRTPChannel::Start() //m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer; } } - + tech_pvt->read_frame.codec = &tech_pvt->read_codec; /* Set codec here - no need to set it every time a frame is read */ if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP 8000, m_codec_ms, 1, // Channels SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, // Settings switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) { - + if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP 8000, 0, 1, // Channels SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, // Settings @@ -2095,7 +2095,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() if (GetDirection() == IsReceiver) { //m_readFrame.rate = tech_pvt->read_codec.implementation->actual_samples_per_second; - + if (isAudio) { switch_core_session_set_read_codec(m_fsSession, codec); /*if (switch_core_timer_init(m_switchTimer, @@ -2103,7 +2103,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() codec->implementation->microseconds_per_packet / 1000, codec->implementation->samples_per_packet, switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) { - + switch_core_codec_destroy(codec); codec = NULL; switch_mutex_unlock(tech_pvt->h323_mutex); @@ -2135,35 +2135,35 @@ PBoolean FSH323_ExternalRTPChannel::Start() return false; } switch_channel_set_variable(m_fsChannel,"timer_name","soft");*/ - } + } } else { switch_core_session_set_video_write_codec(m_fsSession, codec); switch_channel_set_flag(m_fsChannel, CF_VIDEO); } } - + // PTRACE(4, "mod_h323\tSet " << ((GetDirection() == IsReceiver)? " read" : " write") << ' ' // << m_capability->GetMainType() << " codec to << " << m_capability << " for connection " << *this); - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Set %s %s codec to %s for connection [%p]\n",((GetDirection() == IsReceiver)? " read" : " write") ,GetMainTypes[m_capability->GetMainType()],(const char*)m_capability->GetFormatName(),this); - + PIPSocket::Address remoteIpAddress; - GetRemoteAddress(remoteIpAddress,m_RTPremotePort); + GetRemoteAddress(remoteIpAddress,m_RTPremotePort); m_RTPremoteIP = (const char *)remoteIpAddress.AsString(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->tech_pvt->rtp_session = [%p]\n",tech_pvt->rtp_session); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->samples_per_packet = %lu\n", codec->implementation->samples_per_packet); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->actual_samples_per_second = %lu\n", codec->implementation->actual_samples_per_second); - + bool ch_port = false; if (tech_pvt->rtp_session != NULL){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------->old remote port = %d new remote port = %d\n",switch_rtp_get_remote_port(tech_pvt->rtp_session),m_RTPremotePort); if ((switch_rtp_get_remote_port(tech_pvt->rtp_session) != m_RTPremotePort) && (GetDirection() != IsReceiver) && (m_conn->m_rtp_resetting == 1)){ ch_port = true; m_conn->m_startRTP = false; - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_lock_codec_read [%p]\n",m_fsSession); - switch_core_session_lock_codec_read(m_fsSession); + switch_core_session_lock_codec_read(m_fsSession); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_lock\n"); switch_mutex_lock(tech_pvt->h323_io_mutex); switch_clear_flag_locked(tech_pvt, TFLAG_IO); @@ -2173,8 +2173,8 @@ PBoolean FSH323_ExternalRTPChannel::Start() switch_rtp_destroy(&tech_pvt->rtp_session); } } - - if ((!m_conn->m_startRTP)) { + + if ((!m_conn->m_startRTP)) { flags[SWITCH_RTP_FLAG_DATAWAIT] = (switch_rtp_flag_t)1; flags[SWITCH_RTP_FLAG_RAW_WRITE] = (switch_rtp_flag_t)1; @@ -2196,7 +2196,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() (const char *)m_RTPremoteIP, m_RTPremotePort, (switch_payload_t)payloadCode, - codec->implementation->samples_per_packet, + codec->implementation->samples_per_packet, codec->implementation->microseconds_per_packet, flags, timer_name, &err, switch_core_session_get_pool(m_fsSession)); @@ -2207,7 +2207,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() switch_channel_set_flag(m_fsChannel, CF_FS_RTP); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err)); - switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_mutex_unlock(tech_pvt->h323_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); return SWITCH_STATUS_FALSE; @@ -2225,7 +2225,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->External RTP address %s:%u\n",(const char*)m_RTPremoteIP,m_RTPremotePort); - + if (GetDirection() == IsReceiver) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_lock\n"); switch_mutex_lock(tech_pvt->h323_io_mutex); @@ -2233,7 +2233,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() switch_mutex_unlock(tech_pvt->h323_io_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_io_mutex_unlock\n"); } - + if (m_conn->m_rtp_resetting) { if (GetDirection() == IsReceiver) { switch_core_session_unlock_codec_read(m_fsSession); @@ -2242,25 +2242,25 @@ PBoolean FSH323_ExternalRTPChannel::Start() switch_core_session_unlock_codec_write(m_fsSession); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession); if (m_conn->m_callOnPreAnswer) { - switch_core_session_unlock_codec_read(m_fsSession); + switch_core_session_unlock_codec_read(m_fsSession); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_read [%p]\n",m_fsSession); } } } - + if (GetDirection() == IsReceiver) m_conn->m_rxAudioOpened.Signal(); else - m_conn->m_txAudioOpened.Signal(); - + m_conn->m_txAudioOpened.Signal(); + if (m_conn->m_ChannelAnswer && m_conn->m_rxChannel && m_conn->m_txChannel) switch_channel_mark_answered(m_fsChannel); - + if ((m_conn->m_ChannelProgress && m_conn->m_rxChannel)||(m_conn->m_callOnPreAnswer && m_conn->m_txChannel)) switch_channel_mark_pre_answered(m_fsChannel); if (m_capability->GetMainType() == H323Capability::e_Data && m_conn->m_rxChannel && m_conn->m_txChannel) { - const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); + const char *uuid = switch_channel_get_partner_uuid(m_fsChannel); if (uuid != NULL){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------------------->switch_rtp_udptl_mode\n"); switch_rtp_udptl_mode(tech_pvt->rtp_session); @@ -2279,7 +2279,7 @@ PBoolean FSH323_ExternalRTPChannel::Start() PBoolean FSH323_ExternalRTPChannel::OnReceivedPDU(const H245_H2250LogicalChannelParameters& param, unsigned& errorCode) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323_ExternalRTPChannel::OnReceivedPDU [%p]\n",this); - + if (!H323_ExternalRTPChannel::OnReceivedPDU(param,errorCode)) return true; PIPSocket::Address remoteIpAddress; @@ -2312,25 +2312,25 @@ void FSH323_ExternalRTPChannel::OnSendOpenAck(H245_H2250LogicalChannelAckParamet FSH323Connection * FSH323EndPoint::FSMakeCall(const PString & dest, void *userData) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSMakeCall DST NUMBER = %s [%p]\n",(const char*)dest,this); - + FSH323Connection * connection; PString token; H323Transport *transport = NULL; - + if (listeners.GetSize() > 0) { H323TransportAddress taddr = listeners[0].GetTransportAddress(); PIPSocket::Address addr; WORD port; - if (taddr.GetIpAndPort(addr, port)) { + if (taddr.GetIpAndPort(addr, port)) { if (addr) { transport = new H323TransportTCP(*this, addr,false); - if (!transport) + if (!transport) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Unable to create transport for outgoing call\n"); } } else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----> Unable to get address and port\n"); } - + if (!(connection = (FSH323Connection *)H323EndPoint::MakeCall(dest, token, userData))) { return NULL; } @@ -2344,7 +2344,7 @@ static switch_call_cause_t create_outgoing_channel(switch_core_session_t *sessio switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>create_outgoing_channel DST NUMBER = %s\n",outbound_profile->destination_number); - + FSH323Connection * connection; if (h323_process == NULL) { return SWITCH_CAUSE_CRASH; @@ -2365,7 +2365,7 @@ static switch_status_t on_destroy(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>on_destroy\n"); h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session); - + if (tech_pvt) { if (tech_pvt->read_codec.implementation) { switch_core_codec_destroy(&tech_pvt->read_codec); @@ -2400,7 +2400,7 @@ static switch_status_t on_hangup(switch_core_session_t *session) FSH323Connection *me = tech_pvt->me; FSH323EndPoint & ep = h323_process->GetH323EndPoint(); tech_pvt->me = NULL; - + if (me) { if (me->m_rtp_resetting == 1) { switch_core_session_unlock_codec_read(session); @@ -2424,7 +2424,7 @@ static switch_status_t on_hangup(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> () = %d\n",trylock); if (trylock == 1) { const PString currentToken(tech_pvt->token); - FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken); + FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken); if (connection) { connection->Unlock(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> connection->UnLock()\n"); @@ -2453,6 +2453,6 @@ static switch_status_t on_hangup(switch_core_session_t *session) } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "H323 connection was cleared successfully\n"); - + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_h323/mod_h323.h b/src/mod/endpoints/mod_h323/mod_h323.h index 085f061d62..9c15ae44d5 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.h +++ b/src/mod/endpoints/mod_h323/mod_h323.h @@ -1,4 +1,4 @@ -/* +/* * H323 endpoint interface for Freeswitch Modular Media Switching Software Library / * Soft-Switch Application * @@ -18,9 +18,9 @@ * License. * * Contributor(s): - * - * - * + * + * + * * * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * @@ -125,13 +125,13 @@ const char* const GetMainTypes[H323Capability::e_NumMainTypes+1] = { "ExtendVideo", "GenericControl", "ConferenceControl", - "NumMainTypes" + "NumMainTypes" }; extern void SetT38_IFP_PRE(); class OpalMediaFormat; class H245_T38FaxProfile; -class OpalT38Protocol; +class OpalT38Protocol; extern const OpalMediaFormat & GetOpalT38_IFP_COR(); extern const OpalMediaFormat & GetOpalT38_IFP_PRE(); @@ -218,7 +218,7 @@ switch_status_t name(type1 name1) switch_status_t name(type1 name1, type2 name2, type3 name3) class FSH323EndPoint; -class FSProcess:public PLibraryProcess { +class FSProcess:public PLibraryProcess { PCLASSINFO(FSProcess, PLibraryProcess); public: @@ -267,7 +267,7 @@ class FSH323EndPoint:public H323EndPoint { switch_endpoint_interface_t *GetSwitchInterface() const { return m_freeswitch; - } + } FSH323Connection *FSMakeCall(const PString & dest, void *userData); list < FSListener > m_listeners; int m_ai; @@ -351,7 +351,7 @@ class FSH323Connection:public H323Connection { const H245_MultiplexCapability * muxCap, H245_TerminalCapabilitySetReject & reject); switch_core_session_t *GetSession() const { return m_fsSession; - } + } FSH323EndPoint* GetEndPoint() const{ return m_endpoint; } @@ -359,7 +359,7 @@ class FSH323Connection:public H323Connection { virtual void OnUserInputTone(char, unsigned, unsigned, unsigned); virtual void OnUserInputString(const PString & value); void CleanUpOnCall(); - + DECLARE_CALLBACK0(on_init); DECLARE_CALLBACK0(on_routing); DECLARE_CALLBACK0(on_execute); @@ -437,19 +437,19 @@ class BaseG7231Capab:public H323AudioCapability { public: BaseG7231Capab(const char *fname, bool annexA = true) : H323AudioCapability(7, 4), m_name(fname), m_aa(annexA) { - } + } virtual PObject *Clone() const { return new BaseG7231Capab(*this); - } + } virtual unsigned GetSubType() const { return H245_AudioCapability::e_g7231; - } + } virtual PString GetFormatName() const { return m_name; - } + } virtual H323Codec *CreateCodec(H323Codec::Direction direction) const { return 0; - } + } virtual Comparison Compare(const PObject & obj) const { Comparison res = H323AudioCapability::Compare(obj); if (res != EqualTo) @@ -460,7 +460,7 @@ class BaseG7231Capab:public H323AudioCapability { if (m_aa && !aa) return GreaterThan; return EqualTo; - } + } virtual bool OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const { pdu.SetTag(GetSubType()); H245_AudioCapability_g7231 & g7231 = pdu; @@ -487,7 +487,7 @@ class BaseG729Capab:public H323AudioCapability { public: BaseG729Capab(const char *fname, unsigned type = H245_AudioCapability::e_g729) : H323AudioCapability(24, 6), m_name(fname), m_type(type) { - } + } virtual PObject *Clone() const { return new BaseG729Capab(*this); @@ -500,7 +500,7 @@ class BaseG729Capab:public H323AudioCapability { } virtual H323Codec *CreateCodec(H323Codec::Direction direction) const { return 0; - } + } protected: const char *m_name; unsigned m_type; @@ -513,7 +513,7 @@ class BaseGSM0610Cap:public H323AudioCapability { BaseGSM0610Cap(const char *fname, unsigned type = H245_AudioCapability::e_gsmFullRate) : H323AudioCapability(24, 2), m_name(fname), m_type(type), m_comfortNoise(0), m_scrambled(0) { - } + } virtual PObject *Clone() const { return new BaseGSM0610Cap(*this); } @@ -564,8 +564,8 @@ class FSH323_T38Capability : public H323_T38Capability virtual PObject * Clone() const { return new FSH323_T38Capability(*this); } - virtual PString GetFormatName() const { - return mediaFormat; + virtual PString GetFormatName() const { + return mediaFormat; } virtual H323Channel * CreateChannel( H323Connection & connection, diff --git a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml index 069792935c..6778ef7cb2 100644 --- a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml +++ b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml @@ -8,7 +8,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Endpoint 1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --> - + @@ -37,7 +37,7 @@ can make line noise really loud. @@ -36,7 +36,7 @@ - - - @@ -77,13 +77,13 @@ - - - - - @@ -165,50 +165,50 @@ - - - - - - diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 2dc4046420..44675c3c8b 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Moises Silva (Multiple endpoints work sponsored by Comrex Corporation) * Raymond Chandler @@ -275,8 +275,8 @@ static int get_dev_by_name(char *name, int in); static int get_dev_by_number(char *numstr, int in); SWITCH_STANDARD_API(pa_cmd); -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ @@ -316,7 +316,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) } if (!tech_pvt->audio_endpoint && - switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && + switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_AUTO_ANSWER)) { add_pvt(tech_pvt, PA_SLAVE); @@ -363,7 +363,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) switch_channel_mark_ring_ready(channel); } - while (switch_channel_get_state(channel) == CS_ROUTING && + while (switch_channel_get_state(channel) == CS_ROUTING && !switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) { switch_size_t olen = globals.readfile_timer.samples; @@ -396,8 +396,8 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) switch_core_file_seek(&fh, &pos, 0, SEEK_SET); } - if (globals.ring_stream && (! switch_test_flag(globals.call_list, TFLAG_MASTER) || - ( !globals.no_ring_during_call && globals.main_stream != globals.ring_stream)) ) { //if there is a ring stream and not an active call or if there is an active call and we are allowed to ring during it AND the ring stream is not the main stream + if (globals.ring_stream && (! switch_test_flag(globals.call_list, TFLAG_MASTER) || + ( !globals.no_ring_during_call && globals.main_stream != globals.ring_stream)) ) { //if there is a ring stream and not an active call or if there is an active call and we are allowed to ring during it AND the ring stream is not the main stream WriteAudioStream(globals.ring_stream->stream, abuf, (long) olen, 0, &globals.ring_stream->write_timer); } } else { @@ -438,7 +438,7 @@ static switch_status_t channel_on_execute(switch_core_session_t *session) static audio_stream_t* find_audio_stream(int indev, int outdev, int already_locked) { audio_stream_t *cur_stream; - + if (! globals.stream_list) { return NULL; } @@ -494,7 +494,7 @@ static switch_status_t validate_main_audio_stream() } globals.main_stream = get_audio_stream(globals.indev, globals.outdev); - + if (globals.main_stream) { return SWITCH_STATUS_SUCCESS; } @@ -537,7 +537,7 @@ static switch_status_t destroy_actual_stream(audio_stream_t *stream) CloseAudioStream(stream->stream); stream->stream = NULL; - + if (stream->write_timer.timer_interface) { switch_core_timer_destroy(&stream->write_timer); } @@ -548,12 +548,12 @@ static switch_status_t destroy_actual_stream(audio_stream_t *stream) static switch_status_t destroy_audio_stream(int indev, int outdev) { audio_stream_t *stream; - + switch_mutex_lock(globals.streams_lock); stream = find_audio_stream(indev, outdev,1); if (stream == NULL) { switch_mutex_unlock(globals.streams_lock); - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_FALSE; } remove_stream(stream, 1); @@ -700,7 +700,7 @@ static void remove_pvt(private_t *tech_pvt) switch_mutex_lock(globals.pvt_lock); for (tp = globals.call_list; tp; tp = tp->next) { - + if (tp == tech_pvt) { if (switch_test_flag(tp, TFLAG_MASTER)) { switch_clear_flag_locked(tp, TFLAG_MASTER); @@ -839,8 +839,8 @@ static switch_status_t channel_endpoint_read(audio_endpoint_t *endpoint, switch_ endpoint->read_frame.data = endpoint->read_buf; endpoint->read_frame.buflen = sizeof(endpoint->read_buf); endpoint->read_frame.source = __FILE__; - samples = ReadAudioStream(endpoint->in_stream->stream, - endpoint->read_frame.data, STREAM_SAMPLES_PER_PACKET(endpoint->in_stream), + samples = ReadAudioStream(endpoint->in_stream->stream, + endpoint->read_frame.data, STREAM_SAMPLES_PER_PACKET(endpoint->in_stream), endpoint->inchan, &endpoint->read_timer); if (!samples) { @@ -866,7 +866,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (tech_pvt->audio_endpoint) { return channel_endpoint_read(tech_pvt->audio_endpoint, frame); } - + if (!globals.main_stream) { goto normal_return; } @@ -975,8 +975,8 @@ static switch_status_t channel_endpoint_write(audio_endpoint_t *endpoint, switch if (!switch_test_flag(endpoint->master, TFLAG_IO)) { return SWITCH_STATUS_SUCCESS; } - WriteAudioStream(endpoint->out_stream->stream, (short *)frame->data, - (int)(frame->datalen / sizeof(SAMPLE)), + WriteAudioStream(endpoint->out_stream->stream, (short *)frame->data, + (int)(frame->datalen / sizeof(SAMPLE)), endpoint->outchan, &(endpoint->write_timer)); return SWITCH_STATUS_SUCCESS; } @@ -1106,7 +1106,7 @@ static int release_stream_channel(shared_audio_stream_t *stream, int index, int if (!stream) { return rc; } - + switch_mutex_lock(stream->mutex); if (input) { @@ -1187,7 +1187,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "Invalid portaudio endpoint %s\n", endpoint_name); goto error; } - + switch_mutex_lock(endpoint->mutex); if (endpoint->master) { @@ -1197,12 +1197,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } codec_ms = endpoint->in_stream ? endpoint->in_stream->codec_ms : endpoint->out_stream->codec_ms; - samples_per_packet = endpoint->in_stream ? + samples_per_packet = endpoint->in_stream ? STREAM_SAMPLES_PER_PACKET(endpoint->in_stream) : STREAM_SAMPLES_PER_PACKET(endpoint->out_stream); sample_rate = endpoint->in_stream ? endpoint->in_stream->sample_rate : endpoint->out_stream->sample_rate; if (switch_core_timer_init(&endpoint->read_timer, - globals.timer_name, codec_ms, + globals.timer_name, codec_ms, samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to setup read timer for endpoint '%s'!\n", endpoint->name); goto error; @@ -1210,21 +1210,21 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi /* The write timer must be setup regardless */ if (switch_core_timer_init(&endpoint->write_timer, - globals.timer_name, codec_ms, + globals.timer_name, codec_ms, samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to setup read timer for endpoint '%s'!\n", endpoint->name); goto error; } if (switch_core_codec_init(&endpoint->read_codec, - "L16", NULL, NULL, sample_rate, codec_ms, 1, + "L16", NULL, 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"); goto error; } if (switch_core_codec_init(&endpoint->write_codec, - "L16", NULL, NULL, sample_rate, codec_ms, 1, + "L16", NULL, 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"); goto error; @@ -1232,7 +1232,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_session_set_read_codec(tech_pvt->session, &endpoint->read_codec); switch_core_session_set_write_codec(tech_pvt->session, &endpoint->write_codec); - /* try to acquire the stream */ + /* try to acquire the stream */ if (take_stream_channel(endpoint->in_stream, endpoint->inchan, 1)) { retcause = SWITCH_CAUSE_USER_BUSY; goto error; @@ -1452,7 +1452,7 @@ static switch_status_t load_streams(switch_xml_t streams) if (!strcmp(var, "indev")) { devval = check_device(val, 1); if (devval < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid indev specified for stream '%s'\n", stream_name); stream->indev = -1; continue; @@ -1461,7 +1461,7 @@ static switch_status_t load_streams(switch_xml_t streams) } else if (!strcmp(var, "outdev")) { devval = check_device(val, 0); if (devval < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid outdev specified for stream '%s'\n", stream_name); stream->outdev = -1; continue; @@ -1470,7 +1470,7 @@ static switch_status_t load_streams(switch_xml_t streams) } else if (!strcmp(var, "sample-rate")) { stream->sample_rate = atoi(val); if (stream->sample_rate < MIN_STREAM_SAMPLE_RATE) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid sample rate specified for stream '%s', forcing to 8000\n", stream_name); stream->sample_rate = MIN_STREAM_SAMPLE_RATE; } @@ -1485,18 +1485,18 @@ static switch_status_t load_streams(switch_xml_t streams) } else if (!strcmp(var, "channels")) { stream->channels = atoi(val); if (stream->channels < 1 || stream->channels > MAX_IO_CHANNELS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid number of channels specified for stream '%s', forcing to 1\n", stream_name); stream->channels = 1; } } } if (stream->indev < 0 && stream->outdev < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You need at least one device for stream '%s'\n", stream_name); continue; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created stream '%s', sample-rate = %d, codec-ms = %d\n", stream->name, stream->sample_rate, stream->codec_ms); switch_core_hash_insert(globals.sh_streams, stream->name, stream); } @@ -1553,7 +1553,7 @@ static shared_audio_stream_t *check_stream(char *streamstr, int check_input, int if (!check_input && stream->outdev < 0) { return NULL; } - + *chanindex = cnum; return stream; @@ -1597,7 +1597,7 @@ static switch_status_t load_endpoints(switch_xml_t endpoints) stream = check_stream(val, 1, &endpoint->inchan) ; if (!stream) { endpoint->in_stream = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid instream specified for endpoint '%s'\n", endpoint_name); continue; } @@ -1605,7 +1605,7 @@ static switch_status_t load_endpoints(switch_xml_t endpoints) } else if (!strcmp(var, "outstream")) { stream = check_stream(val, 0, &endpoint->outchan); if (!stream) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid outstream specified for endpoint '%s'\n", endpoint_name); endpoint->out_stream = NULL; continue; @@ -1614,18 +1614,18 @@ static switch_status_t load_endpoints(switch_xml_t endpoints) } } if (!endpoint->in_stream && !endpoint->out_stream) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You need at least one stream for endpoint '%s'\n", endpoint_name); continue; } if (check_stream_compat(endpoint->in_stream, endpoint->out_stream)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Incompatible input and output streams for endpoint '%s'\n", endpoint_name); continue; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Created endpoint '%s', instream = %s, outstream = %s\n", endpoint->name, - endpoint->in_stream ? endpoint->in_stream->name : "(none)", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, + "Created endpoint '%s', instream = %s, outstream = %s\n", endpoint->name, + endpoint->in_stream ? endpoint->in_stream->name : "(none)", endpoint->out_stream ? endpoint->out_stream->name : "(none)"); switch_core_hash_insert(globals.endpoints, endpoint->name, endpoint); } @@ -1823,7 +1823,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown) switch_event_free_subclass(MY_EVENT_ERROR_AUDIO_DEV); switch_event_free_subclass(MY_EVENT_CALL_HELD); switch_event_free_subclass(MY_EVENT_CALL_RESUMED); - + switch_safe_free(globals.dialplan); switch_safe_free(globals.context); @@ -1992,7 +1992,7 @@ static switch_status_t play_dev(switch_stream_handle_t *stream, int outdev, char if (globals.destroying_streams || ! audio_stream->stream) { break; } - + WriteAudioStream(audio_stream->stream, abuf, (long) olen, 0, &(audio_stream->write_timer)); wrote += (int) olen; if (samples) { @@ -2275,7 +2275,7 @@ static switch_status_t create_codecs(int restart) switch_core_codec_destroy(&globals.write_codec); switch_core_timer_destroy(&globals.read_timer); switch_core_timer_destroy(&globals.readfile_timer); - + return SWITCH_STATUS_FALSE; } } @@ -2315,11 +2315,11 @@ PaError open_shared_audio_stream(shared_audio_stream_t *shstream, const PaStream { PaError err; if (inputParameters->device != -1) { - err = OpenAudioStream(&shstream->stream, inputParameters->device != -1 ? inputParameters : NULL, - outputParameters->device != -1 ? outputParameters : NULL, shstream->sample_rate, + err = OpenAudioStream(&shstream->stream, inputParameters->device != -1 ? inputParameters : NULL, + outputParameters->device != -1 ? outputParameters : NULL, shstream->sample_rate, paClipOff, STREAM_SAMPLES_PER_PACKET(shstream), globals.dual_streams); } else { - err = OpenAudioStream(&shstream->stream, NULL, outputParameters, shstream->sample_rate, + err = OpenAudioStream(&shstream->stream, NULL, outputParameters, shstream->sample_rate, paClipOff, STREAM_SAMPLES_PER_PACKET(shstream), 0); } if (err != paNoError) { @@ -2348,11 +2348,11 @@ static int create_shared_audio_stream(shared_audio_stream_t *shstream) outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; } - + err = open_shared_audio_stream(shstream, &inputParameters, &outputParameters); if (err != paNoError) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Error opening audio device retrying (indev = %d, outdev = %d, error = %s)\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Error opening audio device retrying (indev = %d, outdev = %d, error = %s)\n", inputParameters.device, outputParameters.device, Pa_GetErrorText(err)); switch_yield(1000000); err = open_shared_audio_stream(shstream, &inputParameters, &outputParameters); @@ -2367,7 +2367,7 @@ static int create_shared_audio_stream(shared_audio_stream_t *shstream) } return -1; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created shared audio stream %s: %d channels %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created shared audio stream %s: %d channels %d\n", shstream->name, shstream->sample_rate, shstream->channels); return 0; } @@ -2422,7 +2422,7 @@ static audio_stream_t *create_audio_stream(int indev, int outdev) outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; } - + err = open_audio_stream(&(stream->stream), &inputParameters, &outputParameters); if (err != paNoError) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n"); @@ -2518,7 +2518,7 @@ static switch_status_t list_endpoints(char **argv, int argc, switch_stream_handl switch_core_hash_this(hi, &var, NULL, &val); e = val; stream->write_function(stream, "%s> instream: %s, outstream: %s\n", - e->name, e->in_stream ? e->in_stream->name : "(none)", + e->name, e->in_stream ? e->in_stream->name : "(none)", e->out_stream ? e->out_stream->name : "(none)"); cnt++; } @@ -3200,9 +3200,9 @@ SWITCH_STANDARD_API(pa_cmd) } else if (argv[1] && !strcmp(argv[0], "outdev")) { func = set_outdev; } else if (argv[1] && argv[2] && !strcmp(argv[0], "preparestream")) { - func = prepare_stream; + func = prepare_stream; } else if (argv[1] && argv[2] && !strcmp(argv[0], "switchstream")) { - func = switch_stream; + func = switch_stream; } else if (argv[1] && !strcmp(argv[0], "ringdev")) { func = set_ringdev; } else if ((argv[1] && !strcmp(argv[0], "play"))) { diff --git a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c index f48a7e06c9..00e5f3a982 100644 --- a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c +++ b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.c @@ -35,13 +35,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h index ae026c02dd..05e0602529 100644 --- a/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h +++ b/src/mod/endpoints/mod_portaudio/pa_ringbuffer.h @@ -36,13 +36,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index cb7ae53ab3..fc4a2b9b40 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -30,13 +30,13 @@ */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ @@ -72,7 +72,7 @@ static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf); /************************************************************************/ /* Called from PortAudio. - * Read and write data + * Read and write data */ static int iblockingIOCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData) diff --git a/src/mod/endpoints/mod_portaudio/pablio.h b/src/mod/endpoints/mod_portaudio/pablio.h index 2202d849ec..c40aac7a16 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.h +++ b/src/mod/endpoints/mod_portaudio/pablio.h @@ -38,13 +38,13 @@ extern "C" { */ /* - * The text above constitutes the entire PortAudio license; however, + * The text above constitutes the entire PortAudio license; however, * the PortAudio community also makes the following non-binding requests: * * Any person wishing to distribute modifications to the Software is * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the * license above. */ diff --git a/src/mod/endpoints/mod_reference/mod_reference.c b/src/mod/endpoints/mod_reference/mod_reference.c index 7d1bb028e4..e9e5b19bc4 100644 --- a/src/mod/endpoints/mod_reference/mod_reference.c +++ b/src/mod/endpoints/mod_reference/mod_reference.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -124,8 +124,8 @@ static void tech_init(private_t *tech_pvt, switch_core_session_t *session) tech_pvt->session = session; } -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ diff --git a/src/mod/endpoints/mod_rtc/mod_rtc.c b/src/mod/endpoints/mod_rtc/mod_rtc.c index 2ef2bac87f..bda5f33f3e 100644 --- a/src/mod/endpoints/mod_rtc/mod_rtc.c +++ b/src/mod/endpoints/mod_rtc/mod_rtc.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -61,7 +61,7 @@ typedef struct { switch_core_session_t *session; switch_caller_profile_t *caller_profile; switch_media_handle_t *media_handle; - switch_core_media_params_t mparams; + switch_core_media_params_t mparams; } private_object_t; static struct { @@ -74,8 +74,8 @@ static struct { /* BODY OF THE MODULE */ /*************************************************************************************************************************************************************/ -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ @@ -131,7 +131,7 @@ switch_status_t rtc_on_destroy(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC DESTROY\n", switch_channel_get_name(channel)); switch_media_handle_destroy(session); - + return SWITCH_STATUS_SUCCESS; } @@ -247,7 +247,7 @@ static switch_status_t rtc_receive_message(switch_core_session_t *session, switc case SWITCH_MESSAGE_INDICATE_ANSWER: case SWITCH_MESSAGE_INDICATE_PROGRESS: { - + if (((var = switch_channel_get_variable(channel, "rtp_secure_media"))) && (switch_true(var) || switch_core_media_crypto_str2type(var) != CRYPTO_INVALID)) { switch_channel_set_flag(tech_pvt->channel, CF_SECURE); @@ -324,7 +324,7 @@ void rtc_attach_private(switch_core_session_t *session, private_object_t *tech_p switch_assert(session != NULL); switch_assert(tech_pvt != NULL); - + switch_core_session_add_stream(session, NULL); tech_pvt->session = session; @@ -362,7 +362,7 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session, *new_session = NULL; - if (!(nsession = switch_core_session_request_uuid(rtc_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, + if (!(nsession = switch_core_session_request_uuid(rtc_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool, switch_event_get_header(var_event, "origination_uuid")))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); goto error; @@ -384,7 +384,7 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session, if ((hval = switch_event_get_header(var_event, "rtc_secure_media"))) { switch_channel_set_variable(nchannel, "rtc_secure_media", hval); } - + rtc_attach_private(nsession, tech_pvt, NULL); @@ -418,11 +418,11 @@ static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session, return cause; } -static int rtc_recover_callback(switch_core_session_t *session) +static int rtc_recover_callback(switch_core_session_t *session) { private_object_t *tech_pvt = rtc_new_pvt(session); rtc_attach_private(session, tech_pvt, NULL); - + return 1; } diff --git a/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c b/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c index 887cfec26c..7e86847cb0 100644 --- a/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c +++ b/src/mod/endpoints/mod_rtmp/libamf/src/amf0.c @@ -41,7 +41,7 @@ static amf0_data * amf0_list_insert_before(amf0_list * list, amf0_node * node, a if (new_node != NULL) { new_node->next = node; new_node->prev = node->prev; - + if (node->prev != NULL) { node->prev->next = new_node; } @@ -317,7 +317,7 @@ static amf0_data * amf0_array_read(read_proc_t read_proc, void * user_data) { uint32_t array_size; if (read_proc(&array_size, sizeof(uint32_t), user_data) == sizeof(uint32_t)) { array_size = swap_uint32(array_size); - + for (i = 0; i < array_size; ++i) { element = amf0_data_read(read_proc, user_data); @@ -651,7 +651,7 @@ void amf0_data_free(amf0_data * data) { if (data->u.string_data.mbstr) { free(data->u.string_data.mbstr); data->u.string_data.mbstr = NULL; - } + } break; case AMF0_TYPE_NULL: break; case AMF0_TYPE_UNDEFINED: break; diff --git a/src/mod/endpoints/mod_rtmp/libamf/src/hash.c b/src/mod/endpoints/mod_rtmp/libamf/src/hash.c index eaea511b14..bedaee635f 100644 --- a/src/mod/endpoints/mod_rtmp/libamf/src/hash.c +++ b/src/mod/endpoints/mod_rtmp/libamf/src/hash.c @@ -144,7 +144,7 @@ static void insertElement( static void rehash(Hash *pH, int new_size){ struct _ht *new_ht; /* The new hash table */ HashElem *elem, *next_elem; /* For looping over existing elements */ - + assert( (new_size & (new_size-1))==0 ); new_ht = (struct _ht *)pH->xMalloc( new_size*sizeof(struct _ht) ); if( new_ht==0 ) return; @@ -170,7 +170,7 @@ static HashElem *findElementGivenHash( ){ HashElem *elem; /* Used to loop thru the element list */ int count; /* Number of elements left to test */ - + if( pH->ht ){ struct _ht *pEntry = &pH->ht[h]; elem = pEntry->chain; @@ -262,7 +262,7 @@ void * HashInsert( int h; /* the hash of the key modulo hash table size */ HashElem *elem; /* Used to loop thru the element list */ HashElem *new_elem; /* New element added to the pH */ - + assert( pH!=0 ); hraw = binHash(pKey, nKey); assert( (pH->htsize & (pH->htsize-1))==0 ); diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 715e13dc95..76d4ea563d 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -2017,7 +2017,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rtmp_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_ATTACH); return SWITCH_STATUS_TERM; } - + memset(&rtmp_globals, 0, sizeof(rtmp_globals)); switch_mutex_init(&rtmp_globals.mutex, SWITCH_MUTEX_NESTED, pool); @@ -2118,7 +2118,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rtmp_shutdown) switch_event_free_subclass(RTMP_EVENT_LOGOUT); switch_event_free_subclass(RTMP_EVENT_DETACH); switch_event_free_subclass(RTMP_EVENT_ATTACH); - + switch_mutex_lock(rtmp_globals.mutex); while ((hi = switch_core_hash_first_iter(rtmp_globals.profile_hash, hi))) { void *val; diff --git a/src/mod/endpoints/mod_rtmp/rtmp_sig.c b/src/mod/endpoints/mod_rtmp/rtmp_sig.c index c319fc7881..42b29fe4c1 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp_sig.c +++ b/src/mod/endpoints/mod_rtmp/rtmp_sig.c @@ -279,7 +279,7 @@ RTMP_INVOKE_FUNCTION(rtmp_i_publish) amf0_object_add(object, "description", amf0_str("description")); amf0_object_add(object, "details", amf0_str("details")); amf0_object_add(object, "clientid", amf0_number_new(217834719)); - + rtmp_send_invoke_free(rsession, RTMP_DEFAULT_STREAM_NOTIFY, 0, state->stream_id, amf0_str("onStatus"), amf0_number_new(0), diff --git a/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml b/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml index abc81a43cb..c119b7cc33 100644 --- a/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml +++ b/src/mod/endpoints/mod_skinny/conf/dialplan/skinny-patterns.xml @@ -25,6 +25,6 @@ You can place files in the skinny-patterns directory to get included. --> - + diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 9239f9ea19..7d7e6a4b2f 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -112,7 +112,7 @@ char *skinny_format_message(const char *str) /* Look for \200, if found, next character indicates string id */ char match = (char) 128; - + tmp = switch_mprintf(""); if (zstr(str)) { @@ -343,7 +343,7 @@ switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, l result = switch_core_session_locate(uuid); #endif if(!result) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to find session %s on %s:%d, line %d\n", uuid, listener->device_name, listener->device_instance, *line_instance_p); } @@ -359,7 +359,7 @@ switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile) { switch_cache_db_handle_t *dbh = NULL; char *dsn; - + if (!zstr(profile->odbc_dsn)) { dsn = profile->odbc_dsn; } else { @@ -369,7 +369,7 @@ switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile) if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { dbh = NULL; } - + return dbh; } @@ -454,7 +454,7 @@ void skinny_line_perform_set_state(const char *file, const char *func, int line, skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Line %d, Call %d Change State to %s (%d)\n", line_instance, call_id, - skinny_call_state2str(call_state), call_state); + skinny_call_state2str(call_state), call_state); } @@ -534,7 +534,7 @@ uint32_t skinny_line_count_active(listener_t *listener) "SELECT call_state FROM skinny_active_lines " "WHERE device_name='%q' AND device_instance=%d " "AND call_state not in (%d,%d,%d)", - listener->device_name, listener->device_instance, + listener->device_name, listener->device_instance, SKINNY_ON_HOOK, SKINNY_IN_USE_REMOTELY, SKINNY_HOLD ))) { @@ -564,7 +564,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n", - tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, + tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, tech_pvt->rm_encoding, tech_pvt->codec_ms); switch_core_session_lock_codec_write(tech_pvt->session); @@ -616,14 +616,14 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) if (switch_rtp_ready(tech_pvt->rtp_session)) { switch_assert(tech_pvt->read_codec.implementation); - if (switch_rtp_change_interval(tech_pvt->rtp_session, + if (switch_rtp_change_interval(tech_pvt->rtp_session, tech_pvt->read_impl.microseconds_per_packet, tech_pvt->read_impl.samples_per_packet ) != SWITCH_STATUS_SUCCESS) { switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_goto_status(SWITCH_STATUS_FALSE, end); + switch_goto_status(SWITCH_STATUS_FALSE, end); } } @@ -683,8 +683,8 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi tech_pvt->session = session; } -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ @@ -730,7 +730,7 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener); if(listener) { - if(!strcmp(device_name, helper->listener->device_name) + if(!strcmp(device_name, helper->listener->device_name) && (device_instance == helper->listener->device_instance) && (line_instance == helper->line_instance)) {/* the calling line */ helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan); @@ -859,7 +859,7 @@ int channel_on_execute_callback(void *pArg, int argc, char **argv, char **column skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener); if(listener) { - if(!strcmp(device_name, helper->listener->device_name) + if(!strcmp(device_name, helper->listener->device_name) && (device_instance == helper->listener->device_instance) && (line_instance == helper->line_instance)) {/* the calling line */ helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan); @@ -1030,8 +1030,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN if(listener) { if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_CONNECTED)) { /* calling parties */ send_stop_tone(listener, line_instance, call_id); - send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); - send_clear_prompt_status(listener, line_instance, call_id); + send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); + send_clear_prompt_status(listener, line_instance, call_id); } send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); @@ -1065,8 +1065,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN send_define_current_time_date(listener); listener->digit_timeout_time = 0; - skinny_log_ls(listener, helper->tech_pvt->session, SWITCH_LOG_DEBUG, - "channel_on_hangup_callback - cause=%s [%d], call_state = %s [%d]\n", + skinny_log_ls(listener, helper->tech_pvt->session, SWITCH_LOG_DEBUG, + "channel_on_hangup_callback - cause=%s [%d], call_state = %s [%d]\n", switch_channel_cause2str(helper->cause), helper->cause, skinny_call_state2str(call_state), call_state); @@ -1099,7 +1099,7 @@ switch_status_t channel_on_hangup(switch_core_session_t *session) switch_clear_flag_locked(tech_pvt, TFLAG_IO); - skinny_log_s(session, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP [%s]\n", + skinny_log_s(session, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP [%s]\n", switch_channel_get_name(channel), switch_channel_cause2str(cause)); helper.tech_pvt= tech_pvt; @@ -1631,7 +1631,7 @@ void skinny_clean_device_from_db(listener_t *listener, char *device_name) skinny_profile_t *profile = listener->profile; char *sql; - skinny_log_l(listener, SWITCH_LOG_DEBUG, + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Clean device from DB with name '%s'\n", device_name); @@ -1668,7 +1668,7 @@ void skinny_clean_device_from_db(listener_t *listener, char *device_name) } } else { - skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Clean device from DB, missing device name.\n"); } } @@ -1679,7 +1679,7 @@ void skinny_clean_listener_from_db(listener_t *listener) skinny_profile_t *profile = listener->profile; char *sql; - skinny_log_l(listener, SWITCH_LOG_DEBUG, + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Clean listener from DB with name '%s' and instance '%d'\n", listener->device_name, listener->device_instance); @@ -1716,7 +1716,7 @@ void skinny_clean_listener_from_db(listener_t *listener) } } else { - skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Clean listener from DB, missing device name.\n"); } } @@ -1930,7 +1930,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_event_fire(&event); } break; - default: + default: skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Communication Error\n"); } switch_safe_free(request); @@ -2436,9 +2436,9 @@ static switch_status_t load_skinny_config(void) switch_snprintf(dbname, sizeof(dbname), "skinny_%s", profile->name); profile->dbname = switch_core_strdup(profile->pool, dbname); - - - + + + if ((dbh = skinny_get_db_handle(profile))) { switch_cache_db_test_reactive(dbh, "select count(*) from skinny_devices", NULL, devices_sql); switch_cache_db_test_reactive(dbh, "select count(*) from skinny_lines", NULL, lines_sql); @@ -2446,7 +2446,7 @@ static switch_status_t load_skinny_config(void) switch_cache_db_test_reactive(dbh, "select count(*) from skinny_active_lines", NULL, active_lines_sql); switch_cache_db_release_db_handle(&dbh); } - + skinny_profile_respawn(profile, 0); /* Register profile */ diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index b5aed9e42c..69096ab64e 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -140,15 +140,15 @@ struct skinny_profile { char *dbname; char *odbc_dsn; switch_odbc_handle_t *master_odbc; - switch_mutex_t *sql_mutex; + switch_mutex_t *sql_mutex; /* stats */ uint32_t ib_calls; uint32_t ob_calls; uint32_t ib_failed_calls; - uint32_t ob_failed_calls; + uint32_t ob_failed_calls; /* listener */ int listener_threads; - switch_mutex_t *listener_mutex; + switch_mutex_t *listener_mutex; switch_socket_t *sock; switch_mutex_t *sock_mutex; struct listener *listeners; @@ -266,7 +266,7 @@ struct private_object { uint32_t transfer_from_call_id; /* codec */ - char *iananame; + char *iananame; switch_codec_t read_codec; switch_codec_t write_codec; switch_codec_implementation_t read_impl; diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 98ee68c8e9..f79f36c014 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -397,7 +397,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_forward_stat_message(c skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { - send_forward_stat(listener, number); + send_forward_stat(listener, number); stream->write_function(stream, "+OK\n"); } else { @@ -419,7 +419,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_display_prompt_status_ skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { - send_display_prompt_status(listener, 0, display, 0, 0); + send_display_prompt_status(listener, 0, display, 0, 0); stream->write_function(stream, "+OK\n"); } else { diff --git a/src/mod/endpoints/mod_skinny/skinny_api.h b/src/mod/endpoints/mod_skinny/skinny_api.h index a2381d8d0c..e246957f0d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.h +++ b/src/mod/endpoints/mod_skinny/skinny_api.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index c73c9069ee..e345f00930 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -556,7 +556,7 @@ switch_status_t perform_send_start_tone(listener_t *listener, message->data.start_tone.call_id = call_id; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n", + "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n", skinny_tone2str(tone), line_instance, call_id); return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -610,7 +610,7 @@ switch_status_t perform_send_forward_stat(listener_t *listener, skinny_message_t *message; skinny_create_message(message, FORWARD_STAT_MESSAGE, forward_stat); - + if ( number && number[0] ) { message->data.forward_stat.active_forward = 1; @@ -672,7 +672,7 @@ switch_status_t perform_send_set_speaker_mode(listener_t *listener, return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } -switch_status_t perform_send_srvreq_response(listener_t *listener, +switch_status_t perform_send_srvreq_response(listener_t *listener, const char *file, const char *func, int line, char *ip, uint32_t port) { @@ -720,7 +720,7 @@ switch_status_t perform_send_start_media_transmission(listener_t *listener, /* ... */ skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n", + "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n", conference_id, pass_thru_party_id); return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -742,7 +742,7 @@ switch_status_t perform_send_stop_media_transmission(listener_t *listener, /* ... */ skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2 (%d)\n", + "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2 (%d)\n", conference_id, pass_thru_party_id, conference_id2); return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -832,7 +832,7 @@ switch_status_t perform_send_define_time_date(listener_t *listener, if ( listener->profile->debug >= 9 ) { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", + "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week); } @@ -1036,7 +1036,7 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener, tmp = skinny_format_message(display); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", + "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", timeout, tmp, line_instance, call_id); switch_safe_free(tmp); @@ -1066,7 +1066,7 @@ switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, message->data.display_prompt_status.call_id = call_id; skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", + "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", timeout, skinny_textid2str(display_textid), line_instance, call_id); return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -1166,7 +1166,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener, tmp = skinny_format_message(notify); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n", + "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n", message_timeout, priority, tmp); switch_safe_free(tmp); @@ -1175,7 +1175,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener, } -switch_status_t perform_send_reset(listener_t *listener, +switch_status_t perform_send_reset(listener_t *listener, const char *file, const char *func, int line, uint32_t reset_type) { @@ -1227,7 +1227,7 @@ switch_status_t perform_send_data(listener_t *listener, return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } -switch_status_t perform_send_extended_data(listener_t *listener, +switch_status_t perform_send_extended_data(listener_t *listener, const char *file, const char *func, int line, uint32_t message_type, uint32_t application_id, @@ -1268,7 +1268,7 @@ switch_status_t perform_send_extended_data(listener_t *listener, switch_copy_string(message->data.extended_data.data, data, data_length); skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n", + "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n", application_id, line_instance, call_id ); return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -1314,7 +1314,7 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file ptr = (char *) reply; if (listener_is_ready(listener)) { - if (listener->profile->debug >= 10 || + if (listener->profile->debug >= 10 || (listener->profile->debug >= 9 && reply->type != KEEP_ALIVE_ACK_MESSAGE)) { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending %s (type=%x,length=%d).\n", diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index a0c5ad6260..0ae1772521 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -314,7 +314,7 @@ typedef struct { uint32_t serviceNumber; /*!< Service Number */ } levelPreference_t; /*!< Level Preference Structure */ -/*! +/*! * \brief Layout Config Structure (Update Capabilities Message Struct) * \since 20080111 */ @@ -344,7 +344,7 @@ typedef struct { skinny_codecs payload_capability; /*!< PayLoad Capability */ uint32_t maxFramesPerPacket; /*!< Maximum Number of Frames per IP Packet */ uint32_t unknown[2]; /*!< this are related to G.723 */ -} audioCap_t; +} audioCap_t; /*! * \brief Video Capabilities Structure @@ -418,7 +418,7 @@ struct PACKED update_capabilities_message { dataCap_t dataCaps[SKINNY_MAX_DATA_CAPABILITIES]; /*!< Data Capabilities */ uint32_t unknown; /*!< Unknown */ -}; +}; /* ServiceUrlStatReqMessage */ diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index e0ec67e180..86b4730786 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * @@ -136,7 +136,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l channel = switch_core_session_get_channel(nsession); - snprintf(name, sizeof(name), "SKINNY/%s/%s:%d/%d", listener->profile->name, + snprintf(name, sizeof(name), "SKINNY/%s/%s:%d/%d", listener->profile->name, listener->device_name, listener->device_instance, *line_instance_p); switch_channel_set_name(channel, name); @@ -187,7 +187,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l if (switch_channel_get_state(channel) == CS_NEW) { switch_channel_set_state(channel, CS_HIBERNATE); } else { - skinny_log_ls_msg(listener, nsession, SWITCH_LOG_CRIT, + skinny_log_ls_msg(listener, nsession, SWITCH_LOG_CRIT, "Wow! this channel should be in CS_NEW state, but it is not!\n"); } @@ -269,7 +269,7 @@ found: action = SKINNY_ACTION_WAIT; *data = switch_core_session_strdup(session, current_application->application_data); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unknown skinny dialplan application %s\n", current_application->application_name); } } @@ -293,7 +293,7 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list // get listener profile setting for ringdown/autodial // if initial offhook - and we have a ringdown/autodial configured, just dial it in one shot if (!dest && append_dest == '\0' && listener->ext_autodial ) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "triggering auto dial to (%s)\n", listener->ext_autodial); tech_pvt->caller_profile->destination_number = switch_core_strdup(tech_pvt->caller_profile->pool, listener->ext_autodial); @@ -430,7 +430,7 @@ int skinny_session_send_call_info_all_callback(void *pArg, int argc, char **argv struct skinny_session_send_call_info_all_helper *helper = pArg; listener_t *listener = NULL; - skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, + skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener); if(listener) { skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance); @@ -502,38 +502,38 @@ int skinny_session_set_variables_callback(void *pArg, int argc, char **argv, cha listener = helper->listener; if ( ! listener ) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, "no defined listener on channel var setup, will not attempt to set variables\n"); return(0); } /* Process through and extract any variables from the user and set in the channel */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, - "searching for user (id=%s) in profile %s in channel var setup\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + "searching for user (id=%s) in profile %s in channel var setup\n", listener->device_name, listener->profile->domain); - if (switch_xml_locate_user("id", listener->device_name, listener->profile->domain, "", + if (switch_xml_locate_user("id", listener->device_name, listener->profile->domain, "", &xroot, &xdomain, &xuser, NULL, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, "unable to find user (id=%s) in channel var setup\n", listener->device_name); } if ( xuser ) { char *uid = (char *) switch_xml_attr_soft(xuser, "id"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, "found user (id=%s) in channel var setup\n", uid); if ((xvariables = switch_xml_child(xuser, "variables"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, "found variables section in user xml"); - + for (xvariable = switch_xml_child(xvariables, "variable"); xvariable; xvariable = xvariable->next) { char *name = (char *) switch_xml_attr_soft(xvariable, "name"); char *value = (char *) switch_xml_attr_soft(xvariable, "value"); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_DEBUG, "found variable (%s=%s) for user (%s) in channel var setup\n", name, value, listener->device_name); switch_channel_set_variable_name_printf(helper->channel, value, "%s", name); @@ -604,7 +604,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN listener_t *listener = NULL; uint32_t active_calls = 0; - skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, + skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener); if(listener && helper->tech_pvt->session && helper->remote_session) { switch_channel_t *channel = switch_core_session_get_channel(helper->tech_pvt->session); @@ -612,10 +612,10 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN helper->lines_count++; switch_channel_set_variable(channel, "effective_callee_id_number", value); switch_channel_set_variable(channel, "effective_callee_id_name", caller_name); - + active_calls = skinny_line_count_active(listener); - skinny_log_l(listener, SWITCH_LOG_DEBUG, + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Ring Lines Callback with Callee Number (%s), Caller Name (%s), Dest Number (%s), Active Calls (%d)\n", value, caller_name, helper->tech_pvt->caller_profile->destination_number, active_calls); @@ -627,7 +627,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN msg.from = __FILE__; if (switch_core_session_receive_message(helper->remote_session, &msg) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(helper->tech_pvt->session), SWITCH_LOG_WARNING, "Unable to send SWITCH_MESSAGE_INDICATE_DISPLAY message to channel %s\n", switch_core_session_get_uuid(helper->remote_session)); } @@ -742,7 +742,7 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener); if(listener) { - if(!strcmp(device_name, helper->listener->device_name) + if(!strcmp(device_name, helper->listener->device_name) && (device_instance == helper->listener->device_instance) && (line_instance == helper->line_instance)) {/* the answering line */ /* nothing */ @@ -941,7 +941,7 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener channel2 = switch_core_session_get_channel(session2); local_uuid2 = switch_channel_get_uuid(channel2); remote_uuid2 = switch_channel_get_partner_uuid(channel2); - skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: tx from session - local_uuid=%s remote_uuid=%s local_uuid2=%s remote_uuid2=%s\n", + skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: tx from session - local_uuid=%s remote_uuid=%s local_uuid2=%s remote_uuid2=%s\n", local_uuid, remote_uuid, local_uuid2, remote_uuid2); skinny_log_ls(listener, session2, SWITCH_LOG_INFO, "SST: attempting ivr bridge from (%s) to (%s)\n", remote_uuid, remote_uuid2); @@ -1186,7 +1186,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r } /* we clean up device above, so this below block will never trigger. I don't - know the full details of why there would be multiple listeners with + know the full details of why there would be multiple listeners with the same device - maybe a VGC or similar? Not really high priority for support at the moment, but may need to revisit this later */ @@ -1511,7 +1511,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle last number redial stimulus message, couldn't create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); break; case SKINNY_BUTTON_SPEED_DIAL: @@ -1543,7 +1543,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess if(session) { status = skinny_session_transfer(session, listener, line_instance); - } + } break; case SKINNY_BUTTON_VOICEMAIL: skinny_create_incoming_session(listener, &line_instance, &session); @@ -1551,7 +1551,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0); break; @@ -1574,7 +1574,7 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess } switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - } + } else { status = skinny_session_answer(session, listener, line_instance); } @@ -1674,7 +1674,7 @@ switch_status_t skinny_handle_on_hook_message(listener_t *listener, skinny_messa "AND skinny_active_lines.device_instance = skinny_lines.device_instance " "AND skinny_active_lines.line_instance = skinny_lines.line_instance " "WHERE skinny_lines.device_name='%q' AND skinny_lines.device_instance=%d", - listener->device_name, listener->device_instance))) + listener->device_name, listener->device_instance))) { skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_hangup_active_calls_callback, &helper); switch_safe_free(sql); @@ -1694,7 +1694,7 @@ switch_status_t skinny_handle_forward_stat_req_message(listener_t *listener, ski message->data.forward_stat.line_instance = request->data.forward_stat_req.line_instance; if ( listener->profile->debug >= 9 ) { - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", request->data.forward_stat_req.line_instance); } skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -2102,7 +2102,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON); } } else { - skinny_log_l(listener, SWITCH_LOG_WARNING, "Unable to find session for call id=%d.\n", + skinny_log_l(listener, SWITCH_LOG_WARNING, "Unable to find session for call id=%d.\n", request->data.open_receive_channel_ack.pass_thru_party_id); } end: @@ -2131,7 +2131,7 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_ if (message) { skinny_send_reply_quiet(listener, message, SWITCH_FALSE); } else { - skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default .\n", + skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default .\n", listener->profile->name); } @@ -2166,7 +2166,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); break; case SOFTKEY_NEWCALL: @@ -2235,7 +2235,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0); break; case SOFTKEY_CALLPICKUP: @@ -2245,7 +2245,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0); break; case SOFTKEY_CFWDALL: @@ -2254,7 +2254,7 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n"); return SWITCH_STATUS_FALSE; } - skinny_session_process_dest(session, listener, line_instance, + skinny_session_process_dest(session, listener, line_instance, empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0); break; default: @@ -2283,7 +2283,7 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t message->data.unregister_ack.unregister_status = 0; /* OK */ skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Unregister with Status (%d)\n", message->data.unregister_ack.unregister_status); - + skinny_send_reply_quiet(listener, message, SWITCH_TRUE); /* Close socket */ @@ -2316,7 +2316,7 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk message->data.soft_key_template.soft_key[i].soft_key_event = soft_key_template_default_events[i]; } - + if ( listener->profile->debug >= 9 ) { skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Template Request with Default Template\n"); } @@ -2343,7 +2343,7 @@ switch_status_t skinny_headset_status_message(listener_t *listener, skinny_messa } if ( listener->profile->debug >= 9 ) { - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n", + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n", skinny_accessory_state2str(request->data.headset_status.mode)); } @@ -2388,7 +2388,7 @@ switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.data.call_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.data.transaction_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.data.data_length); - + tmp = malloc(request->data.data.data_length + 1); memcpy(tmp, request->data.data.data, request->data.data.data_length); @@ -2644,7 +2644,7 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t * switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request) { - if (listener->profile->debug >= 10 || + if (listener->profile->debug >= 10 || (listener->profile->debug >= 9 && request->type != KEEP_ALIVE_MESSAGE)) { skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); @@ -2726,7 +2726,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re case UPDATE_CAPABILITIES_MESSAGE: return skinny_handle_updatecapabilities(listener, request); case SERVER_REQ_MESSAGE: - return skinny_handle_server_req_message(listener, request); + return skinny_handle_server_req_message(listener, request); default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); diff --git a/src/mod/endpoints/mod_skinny/skinny_server.h b/src/mod/endpoints/mod_skinny/skinny_server.h index d39a796b12..da29b4577e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.h +++ b/src/mod/endpoints/mod_skinny/skinny_server.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 87d0412dfe..e5a1eb02a8 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 40abce5c71..b16f6aca73 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2010, Mathieu Parent * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Mathieu Parent * * diff --git a/src/mod/endpoints/mod_skypopen/configs/client.c b/src/mod/endpoints/mod_skypopen/configs/client.c index 062281d641..f437ccce86 100644 --- a/src/mod/endpoints/mod_skypopen/configs/client.c +++ b/src/mod/endpoints/mod_skypopen/configs/client.c @@ -1,11 +1,11 @@ //gcc -Wall -ggdb client.c -o client -lX11 -lpthread /* - - Interactive client for the Skype API + + Interactive client for the Skype API USAGE: client [Xserver instance] -# ./client :103 +# ./client :103 */ diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index bb5343aa28..ccfcc0d567 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -435,8 +435,8 @@ static switch_status_t interface_exists(char *the_interface) } -/* - State methods they get called when the state changes to the specific state +/* + State methods they get called when the state changes to the specific state returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. */ @@ -2486,7 +2486,7 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) switch_mutex_lock(globals.mutex); /* Fact is the real interface start from 1 */ - //XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-) + //XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-) for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) { int interface_id; @@ -3384,7 +3384,7 @@ struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct Sky } #endif -// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? int skypopen_list_size(struct SkypopenList *list) { return list->entries; diff --git a/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c index af30080ce2..52101f171b 100644 --- a/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c +++ b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c @@ -1,4 +1,4 @@ -//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 +//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 #include "skypiax.h" /* LOCKS */ @@ -95,13 +95,13 @@ const struct ast_channel_tech skypiax_tech = { #endif /* ASTERISK_VERSION_1_4 */ }; -/*! \brief fake skypiax_pvt structure values, +/*! \brief fake skypiax_pvt structure values, * just for logging purposes */ struct skypiax_pvt skypiax_log_struct = { .name = "none", }; -/*! \brief Default skypiax_pvt structure values, +/*! \brief Default skypiax_pvt structure values, * used by skypiax_mkif to initialize the interfaces */ struct skypiax_pvt skypiax_default = { .interface_state = SKYPIAX_STATE_DOWN, @@ -121,14 +121,14 @@ struct skypiax_pvt skypiax_default = { .skypiax_dir_entry_extension_prefix = 6, }; -/*! +/*! * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif */ struct skypiax_pvt *skypiax_iflist = NULL; #ifdef ASTERISK_VERSION_1_6 struct ast_cli_entry myclis[] = { -/* +/* * CLI do not works since some time on 1.6, they changed the CLI mechanism */ #if 0 @@ -286,7 +286,7 @@ int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t d return res; } -/*! \brief PBX interface function -build skypiax pvt structure +/*! \brief PBX interface function -build skypiax pvt structure * skypiax calls initiated by the PBX arrive here */ struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause) { @@ -584,7 +584,7 @@ struct ast_frame *skypiax_read(struct ast_channel *c) return &f; } -/*! \brief Initiate skypiax call from PBX +/*! \brief Initiate skypiax call from PBX * used from the dial() application */ int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout) @@ -788,7 +788,7 @@ struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context) * \brief Load the module into Asterisk and start its threads * * This function register the module into Asterisk, - * create the interfaces for the channels, + * create the interfaces for the channels, * start the auxiliary threads for the interfaces, * then start a monitor thread. The monitor thread * will signal Asterisk when an interface receive a call. @@ -901,7 +901,7 @@ int load_module(void) * \brief Unload the module from Asterisk and shutdown its threads * * This function unregister the module from Asterisk, - * destroy the interfaces for the channels, + * destroy the interfaces for the channels, * shutdown the auxiliary threads for the interfaces, * then shutdown its monitor thread. * @@ -1363,9 +1363,9 @@ int skypiax_restart_monitor(void) return 0; } -/*! \brief The skypiax monitoring thread +/*! \brief The skypiax monitoring thread * \note This thread monitors all the skypiax interfaces that are not in a call - * (and thus do not have a separate thread) indefinitely + * (and thus do not have a separate thread) indefinitely * */ void *skypiax_do_monitor(void *data) { @@ -1439,7 +1439,7 @@ void *skypiax_do_monitor(void *data) /* If there are errors... */ if (res < 0) { - if (errno == EINTR) /* EINTR is just the select + if (errno == EINTR) /* EINTR is just the select being interrupted by a SIGURG, or so */ continue; else { @@ -1483,10 +1483,10 @@ void *skypiax_do_monitor(void *data) } /*! - * \brief Initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) + * \brief Initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) * \param p the skypiax_pvt of the interface * - * This function initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_init for ALSA, oss_init for OSS, winmm_init for Windows Multimedia, etc and return the result + * This function initialize the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_init for ALSA, oss_init for OSS, winmm_init for Windows Multimedia, etc and return the result * * \return zero on success, -1 on error. */ @@ -1497,7 +1497,7 @@ int skypiax_sound_init(struct skypiax_pvt *p) } /*! - * \brief Shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) + * \brief Shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces) * \param p the skypiax_pvt of the interface * * This function shutdown the soundcard channels (input and output) used by one interface (a multichannel soundcard can be used by multiple interfaces). It simply pass its parameters to the right function for the sound system for which has been compiled, eg. alsa_shutdown for ALSA, oss_shutdown for OSS, winmm_shutdown for Windows Multimedia, etc and return the result @@ -2035,7 +2035,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) int friends_count = 0; while (p->skype_friends[0] == '\0') { - /* FIXME needs a timeout, can't wait forever! + /* FIXME needs a timeout, can't wait forever! * eg. when skype is running but not connected! */ usleep(100); friends_count++; @@ -2063,9 +2063,9 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) * So, we have the Skype username (the HANDLE, I think is called). * But we want to call the names we see in the Skype contact list * So, let's check the DISPLAYNAME (the end user modified contact name) - * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME + * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME * if the end user has not modify it) - * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the + * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the * Skipe username (the HANDLE) */ @@ -2074,7 +2074,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) skypiax_signaling_write(p, msg_to_skype); int displayname_count = 0; while (p->skype_displayname[0] == '\0') { - /* FIXME needs a timeout, can't wait forever! + /* FIXME needs a timeout, can't wait forever! * eg. when skype is running but not connected! */ usleep(100); displayname_count++; @@ -2090,9 +2090,9 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) where2 = strstr(p->skype_displayname, "DISPLAYNAME "); if (where2) { - /* there can be some *smart* that makes a displayname + /* there can be some *smart* that makes a displayname * that is different than firstlast, */ - /* maybe initials, simbols, slashes, + /* maybe initials, simbols, slashes, * something smartish... let's check */ if (where2[12] != '\0') { @@ -2153,7 +2153,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) skypiax_signaling_write(p, msg_to_skype); int fullname_count = 0; while (p->skype_fullname[0] == '\0') { - /* FIXME needs a timeout, can't wait forever! + /* FIXME needs a timeout, can't wait forever! * eg. when skype is running but not connected! */ usleep(100); fullname_count++; @@ -2167,7 +2167,7 @@ int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]) where2 = strstr(p->skype_fullname, "FULLNAME "); if (where2) { - /* there can be some *smart* that makes a fullname + /* there can be some *smart* that makes a fullname * that is different than firstlast, */ /* maybe initials, simbols, slashes, * something smartish... let's check */ diff --git a/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h index e16edc9f11..d960f80a07 100644 --- a/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h +++ b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h @@ -1,4 +1,4 @@ -//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 +//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 #ifndef _SKYPIAX_H_ #define _SKYPIAX_H_ @@ -194,7 +194,7 @@ void ast_unregister_atexit(void (*func) (void)); /* in asterisk.h, but some aste #define SKYPIAX_FRAME_SIZE 160 /* SKYPIAX INTERNAL STRUCTS */ -/*! +/*! * \brief structure for exchanging messages with the skype client */ #ifdef WANT_SKYPE_X11 @@ -235,7 +235,7 @@ struct SkypiaxHandles { #endif //WIN32 -/*! +/*! * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif */ struct skypiax_pvt { diff --git a/src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c index 6fb88079d5..3155bf05e9 100644 --- a/src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c +++ b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c @@ -469,7 +469,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops { struct snd_pcm_str *stream = &pcm->streams[direction]; struct snd_pcm_substream *substream; - + for (substream = stream->substream; substream != NULL; substream = substream->next) substream->ops = ops; } @@ -485,7 +485,7 @@ EXPORT_SYMBOL(snd_pcm_set_ops); void snd_pcm_set_sync(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; - + runtime->sync.id32[0] = substream->pcm->card->number; runtime->sync.id32[1] = -1; runtime->sync.id32[2] = -1; @@ -498,7 +498,7 @@ EXPORT_SYMBOL(snd_pcm_set_sync); * Standard ioctl routine */ -static inline unsigned int div32(unsigned int a, unsigned int b, +static inline unsigned int div32(unsigned int a, unsigned int b, unsigned int *r) { if (b == 0) { @@ -757,7 +757,7 @@ void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, /** * snd_interval_ratnum - refine the interval value * @i: interval to refine - * @rats_count: number of ratnum_t + * @rats_count: number of ratnum_t * @rats: ratnum_t array * @nump: pointer to store the resultant numerator * @denp: pointer to store the resultant denominator @@ -811,7 +811,7 @@ int snd_interval_ratnum(struct snd_interval *i, } t.min = div_down(best_num, best_den); t.openmin = !!(best_num % best_den); - + result_num = best_num; result_diff = best_diff; result_den = best_den; @@ -922,7 +922,7 @@ static int snd_interval_ratden(struct snd_interval *i, } t.min = div_down(best_num, best_den); t.openmin = !!(best_num % best_den); - + best_num = best_den = best_diff = 0; for (k = 0; k < rats_count; ++k) { unsigned int num; @@ -1081,7 +1081,7 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, constrs->rules_num++; va_end(args); return 0; -} +} EXPORT_SYMBOL(snd_pcm_hw_rule_add); @@ -1147,7 +1147,7 @@ EXPORT_SYMBOL(snd_pcm_hw_constraint_integer); * @var: hw_params variable to apply the range * @min: the minimal value * @max: the maximal value - * + * * Apply the min/max range constraint to an interval parameter. */ int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, @@ -1169,7 +1169,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, { struct snd_pcm_hw_constraint_list *list = rule->private; return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask); -} +} /** @@ -1178,7 +1178,7 @@ static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, * @cond: condition bits * @var: hw_params variable to apply the list constraint * @l: list - * + * * Apply the list of constraints to an interval parameter. */ int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, @@ -1215,7 +1215,7 @@ static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params, * @var: hw_params variable to apply the ratnums constraint * @r: struct snd_ratnums constriants */ -int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, struct snd_pcm_hw_constraint_ratnums *r) @@ -1248,7 +1248,7 @@ static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params, * @var: hw_params variable to apply the ratdens constraint * @r: struct snd_ratdens constriants */ -int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, struct snd_pcm_hw_constraint_ratdens *r) @@ -1279,7 +1279,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, * @width: sample bits width * @msbits: msbits width */ -int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, +int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsigned int cond, unsigned int width, unsigned int msbits) @@ -1312,7 +1312,7 @@ int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsigned long step) { - return snd_pcm_hw_rule_add(runtime, cond, var, + return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_step, (void *) step, var, -1); } @@ -1329,7 +1329,7 @@ static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm }; return snd_interval_list(hw_param_interval(params, rule->var), ARRAY_SIZE(pow2_sizes), pow2_sizes, 0); -} +} /** * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule @@ -1341,7 +1341,7 @@ int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var) { - return snd_pcm_hw_rule_add(runtime, cond, var, + return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_pow2, NULL, var, -1); } @@ -1459,8 +1459,8 @@ static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params, * values > minimum. Reduce configuration space accordingly. * Return the minimum. */ -int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, - struct snd_pcm_hw_params *params, +int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) { int changed = _snd_pcm_hw_param_first(params, var); @@ -1505,7 +1505,7 @@ static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params, * values < maximum. Reduce configuration space accordingly. * Return the maximum. */ -int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, +int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) { @@ -1731,7 +1731,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream, case SNDRV_PCM_STATE_DRAINING: if (is_playback) err = -EPIPE; - else + else avail = 0; /* indicate draining */ goto _endloop; case SNDRV_PCM_STATE_OPEN: @@ -1758,7 +1758,7 @@ static int wait_for_avail_min(struct snd_pcm_substream *substream, *availp = avail; return err; } - + static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream, unsigned int hwoff, unsigned long data, unsigned int off, @@ -1777,12 +1777,12 @@ static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream, } return 0; } - + typedef int (*transfer_f)(struct snd_pcm_substream *substream, unsigned int hwoff, unsigned long data, unsigned int off, snd_pcm_uframes_t size); -static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, +static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, unsigned long data, snd_pcm_uframes_t size, int nonblock, @@ -1955,7 +1955,7 @@ static int snd_pcm_lib_writev_transfer(struct snd_pcm_substream *substream, } return 0; } - + snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames) @@ -1978,7 +1978,7 @@ snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, EXPORT_SYMBOL(snd_pcm_lib_writev); -static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream, +static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream, unsigned int hwoff, unsigned long data, unsigned int off, snd_pcm_uframes_t frames) @@ -2109,7 +2109,7 @@ snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __u struct snd_pcm_runtime *runtime; int nonblock; int err; - + err = pcm_sanity_check(substream); if (err < 0) return err; @@ -2157,7 +2157,7 @@ static int snd_pcm_lib_readv_transfer(struct snd_pcm_substream *substream, } return 0; } - + snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames) diff --git a/src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c index 0b6a7fd20a..36ee1efba4 100644 --- a/src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c +++ b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c @@ -159,7 +159,7 @@ char *snd_pcm_hw_param_names[] = { }; #endif -int snd_pcm_hw_refine(struct snd_pcm_substream *substream, +int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { unsigned int k; @@ -212,7 +212,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); printk(" -> "); @@ -221,8 +221,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, #ifdef RULES_DEBUG if (i->empty) printk("empty\n"); - else - printk("%c%u %u%c\n", + else + printk("%c%u %u%c\n", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); #endif @@ -234,7 +234,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, for (k = 0; k < constrs->rules_num; k++) rstamps[k] = 0; - for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) + for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0; do { again = 0; @@ -264,7 +264,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); } @@ -280,7 +280,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, if (i->empty) printk("empty"); else - printk("%c%u %u%c", + printk("%c%u %u%c", i->openmin ? '(' : '[', i->min, i->max, i->openmax ? ')' : ']'); } @@ -658,7 +658,7 @@ static int snd_pcm_status_user(struct snd_pcm_substream *substream, { struct snd_pcm_status status; int res; - + memset(&status, 0, sizeof(status)); res = snd_pcm_status(substream, &status); if (res < 0) @@ -673,7 +673,7 @@ static int snd_pcm_channel_info(struct snd_pcm_substream *substream, { struct snd_pcm_runtime *runtime; unsigned int channel; - + channel = info->channel; runtime = substream->runtime; //giovanni snd_pcm_stream_lock_irq(substream); @@ -694,7 +694,7 @@ static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, { struct snd_pcm_channel_info info; int res; - + if (copy_from_user(&info, _info, sizeof(info))) return -EFAULT; res = snd_pcm_channel_info(substream, &info); @@ -785,7 +785,7 @@ static int snd_pcm_action_single(struct action_ops *ops, int state) { int res; - + res = ops->pre_action(substream, state); if (res < 0) return res; @@ -1543,7 +1543,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime; struct snd_card *card; int result = 0; - + if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; runtime = substream->runtime; @@ -1779,7 +1779,7 @@ static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, return snd_interval_list(hw_param_interval(params, rule->var), snd_pcm_known_rates.count, snd_pcm_known_rates.list, hw->rates); -} +} static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) @@ -1792,7 +1792,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, t.openmax = 0; t.integer = 1; return snd_interval_refine(hw_param_interval(params, rule->var), &t); -} +} int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) { @@ -1819,98 +1819,98 @@ int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_sample_bits, NULL, - SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_FORMAT, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_div, NULL, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mul, NULL, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_mulkdiv, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, snd_pcm_hw_rule_muldivk, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_muldivk, (void*) 8, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, snd_pcm_hw_rule_mulkdiv, (void*) 1000000, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -1974,7 +1974,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) if (err < 0) return err; - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, snd_pcm_hw_rule_buffer_bytes_max, substream, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); if (err < 0) @@ -1988,7 +1988,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) } if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) { - err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_rule_rate, hw, SNDRV_PCM_HW_PARAM_RATE, -1); if (err < 0) @@ -2424,7 +2424,7 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream) snd_pcm_stream_unlock_irq(substream); return err; } - + static int snd_pcm_delay(struct snd_pcm_substream *substream, snd_pcm_sframes_t __user *res) { @@ -2464,7 +2464,7 @@ static int snd_pcm_delay(struct snd_pcm_substream *substream, err = -EFAULT; return err; } - + static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, struct snd_pcm_sync_ptr __user *_sync_ptr) { @@ -2478,7 +2478,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) return -EFAULT; if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control))) - return -EFAULT; + return -EFAULT; status = runtime->status; control = runtime->control; if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { @@ -2509,7 +2509,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) { struct snd_pcm_runtime *runtime = substream->runtime; int arg; - + if (get_user(arg, _arg)) return -EFAULT; if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST) @@ -2519,7 +2519,7 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; return 0; } - + static int snd_pcm_common_ioctl1(struct file *file, struct snd_pcm_substream *substream, unsigned int cmd, void __user *arg) @@ -2781,7 +2781,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, { mm_segment_t fs; int result; - + fs = snd_enter_user(); switch (substream->stream) { case SNDRV_PCM_STREAM_PLAYBACK: @@ -3019,7 +3019,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, { struct snd_pcm_substream *substream = area->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3058,7 +3058,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, { struct snd_pcm_substream *substream = area->vm_private_data; struct snd_pcm_runtime *runtime; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3136,7 +3136,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, unsigned long offset; struct page * page; size_t dma_bytes; - + if (substream == NULL) return VM_FAULT_SIGBUS; runtime = substream->runtime; @@ -3278,9 +3278,9 @@ EXPORT_SYMBOL(snd_pcm_mmap_data); static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) { struct snd_pcm_file * pcm_file; - struct snd_pcm_substream *substream; + struct snd_pcm_substream *substream; unsigned long offset; - + pcm_file = file->private_data; substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index bfa228d9b7..32acb46790 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -473,7 +473,7 @@ int skypopen_init_module(void) return result; } - /* + /* * allocate the devices -- we can't have them static, as the number * can be specified at load time */ diff --git a/src/mod/endpoints/mod_skypopen/oss/skypopen.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h index 2b0527eeb9..3486bccdd1 100644 --- a/src/mod/endpoints/mod_skypopen/oss/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -29,16 +29,16 @@ #if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18) -#define CENTOS_5 +#define CENTOS_5 #define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */ #endif /* CentOS 5.x */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) -#define WANT_HRTIMER +#define WANT_HRTIMER #endif /* HRTIMER */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) -#define WANT_DEFINE_SPINLOCK +#define WANT_DEFINE_SPINLOCK #endif /* DEFINE_SPINLOCK */ #define SKYPOPEN_BLK 1920 @@ -57,13 +57,13 @@ struct skypopen_dev { struct cdev cdev; /* Char device structure */ wait_queue_head_t inq; /* read and write queues */ wait_queue_head_t outq; /* read and write queues */ -#ifndef WANT_HRTIMER +#ifndef WANT_HRTIMER struct timer_list timer_inq; struct timer_list timer_outq; -#else// WANT_HRTIMER +#else// WANT_HRTIMER struct hrtimer timer_inq; struct hrtimer timer_outq; -#endif// WANT_HRTIMER +#endif// WANT_HRTIMER int timer_inq_started; int timer_outq_started; int opened; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index a64cbd074d..d001af16ab 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1391,13 +1391,13 @@ int skypopen_audio_init(private_t *tech_pvt) #ifdef WIN32 enum { - SKYPECONTROLAPI_ATTACH_SUCCESS = 0, /* Client is successfully + SKYPECONTROLAPI_ATTACH_SUCCESS = 0, /* Client is successfully attached and API window handle can be found in wParam parameter */ SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION = 1, /* Skype has acknowledged connection request and is waiting for confirmation from the user. */ - /* The client is not yet attached + /* The client is not yet attached * and should wait for SKYPECONTROLAPI_ATTACH_SUCCESS message */ SKYPECONTROLAPI_ATTACH_REFUSED = 2, /* User has explicitly denied access to client */ @@ -1405,8 +1405,8 @@ enum { at the moment. For example, this happens when no user is currently logged in. */ - /* Client should wait for - * SKYPECONTROLAPI_ATTACH_API_AVAILABLE + /* Client should wait for + * SKYPECONTROLAPI_ATTACH_API_AVAILABLE * broadcast before making any further */ /* connection attempts. */ SKYPECONTROLAPI_ATTACH_API_AVAILABLE = 0x8001 @@ -2080,7 +2080,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) } if (continue_is_broken) { XFlush(disp); - skypopen_sleep(20000); //20 msec + skypopen_sleep(20000); //20 msec WARNINGA("continue_is_broken\n", SKYPOPEN_P_LOG); continue; } diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 36502849d4..7c802aa43b 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -495,9 +495,9 @@ really need to change this. --> - + --> - + diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index 8df561a139..7d23815585 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Andrew Thompson * Rob Charlton @@ -42,7 +42,7 @@ /* Stolen from code added to ei in R12B-5. * Since not everyone has this version yet; - * provide our own version. + * provide our own version. * */ #define put8(s,n) do { \ @@ -132,7 +132,7 @@ void ei_encode_switch_event_tag(ei_x_buff * ebuf, switch_event_t *event, char *t ei_encode_switch_event_headers(ebuf, event); } -/* function to make rpc call to remote node to retrieve a pid - +/* function to make rpc call to remote node to retrieve a pid - calls module:function(Ref). The response comes back as {rex, {Ref, Pid}} */ diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 56f0c45850..292134d716 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Andrew Thompson * Rob Charlton @@ -180,7 +180,7 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff * /* reply mutex is locked */ if ((p = find_fetch_reply(uuid_str))) { switch (p->state) { - case reply_waiting: + case reply_waiting: { /* clone the reply so it doesn't get destroyed on us */ ei_x_buff *nbuf = malloc(sizeof(*nbuf)); @@ -188,14 +188,14 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff * memcpy(nbuf->buff, buf->buff, buf->buffsz); nbuf->index = buf->index; nbuf->buffsz = buf->buffsz; - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got reply for %s\n", uuid_str); - + /* copy info into the reply struct */ p->state = reply_found; p->reply = nbuf; strncpy(p->winner, listener->peer_nodename, MAXNODELEN); - + /* signal waiting thread that its time to wake up */ switch_thread_cond_signal(p->ready_or_found); /* reply OK */ @@ -440,7 +440,7 @@ static switch_status_t handle_msg_session_event(listener_t *listener, erlang_msg switch_thread_rwlock_unlock(session->event_rwlock); switch_thread_rwlock_unlock(session->rwlock); - + ei_x_encode_atom(rbuf, "ok"); } else { ei_x_encode_tuple_header(rbuf, 2); @@ -838,7 +838,7 @@ static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_ } else if (!fail) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, key, value); } - + /* Do not free malloc here! The above commands utilize the raw allocated memory and skip any copying/duplication. Faster. */ } @@ -891,7 +891,7 @@ static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_ fail = SWITCH_TRUE; break; } - + ei_get_type(buf->buff, &buf->index, &type, &size); value = malloc(size + 1); @@ -1233,7 +1233,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, switch_core_hash_this(iter, &key, NULL, &val); se = (session_elem_t*)val; if (switch_test_flag(se, LFLAG_WAITING_FOR_PID) && se->spawn_reply && !strncmp(se->spawn_reply->hash, hash, 100)) { - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found matching session for %s : %s\n", hash, se->uuid_str); switch_mutex_lock(se->spawn_reply->mutex); @@ -1256,7 +1256,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, if (found) { return SWITCH_STATUS_FALSE; - } + } ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 2cc7d680e3..51839141e9 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Andrew Thompson * Rob Charlton @@ -409,7 +409,7 @@ static void destroy_session_elem(session_elem_t *session_element) session_elem_t *find_session_elem_by_uuid(listener_t *listener, const char *uuid) { session_elem_t *session = NULL; - + switch_thread_rwlock_rdlock(listener->session_rwlock); if ((session = (session_elem_t*)switch_core_hash_find(listener->sessions, uuid))) { switch_thread_rwlock_rdlock(session->rwlock); @@ -430,7 +430,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) switch_thread_rwlock_rdlock(listener->session_rwlock); for (iter = switch_core_hash_first(listener->sessions); iter; iter = switch_core_hash_next(&iter)) { switch_core_hash_this(iter, &key, NULL, &val); - + if (((session_elem_t*)val)->process.type == ERLANG_PID && !ei_compare_pids(pid, &((session_elem_t*)val)->process.pid)) { session = (session_elem_t*)val; switch_thread_rwlock_rdlock(session->rwlock); @@ -443,7 +443,7 @@ session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid *pid) return session; } -static fetch_reply_t *new_fetch_reply(const char *uuid_str) +static fetch_reply_t *new_fetch_reply(const char *uuid_str) { fetch_reply_t *reply = NULL; switch_memory_pool_t *pool = NULL; @@ -456,7 +456,7 @@ static fetch_reply_t *new_fetch_reply(const char *uuid_str) reply = switch_core_alloc(pool, sizeof(*reply)); switch_assert(reply != NULL); memset(reply, 0, sizeof(*reply)); - + reply->uuid_str = switch_core_strdup(pool, uuid_str); reply->pool = pool; switch_thread_cond_create(&reply->ready_or_found, pool); @@ -471,7 +471,7 @@ static fetch_reply_t *new_fetch_reply(const char *uuid_str) return reply; } -static void destroy_fetch_reply(fetch_reply_t *reply) +static void destroy_fetch_reply(fetch_reply_t *reply) { switch_core_hash_delete_locked(mod_erlang_event_globals.fetch_reply_hash, reply->uuid_str, mod_erlang_event_globals.fetch_reply_mutex); /* lock so nothing can have it while we delete it */ @@ -484,7 +484,7 @@ static void destroy_fetch_reply(fetch_reply_t *reply) switch_core_destroy_memory_pool(&(reply->pool)); } -fetch_reply_t *find_fetch_reply(const char *uuid) +fetch_reply_t *find_fetch_reply(const char *uuid) { fetch_reply_t *reply = NULL; @@ -736,7 +736,7 @@ static switch_status_t check_attached_sessions(listener_t *listener, int *msgs_s /*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "flushed event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */ - /* events from attached sessions are wrapped in a {call_event,} tuple + /* events from attached sessions are wrapped in a {call_event,} tuple to distinguish them from normal events (if they are sent to the same process) */ @@ -776,7 +776,7 @@ static switch_status_t check_attached_sessions(listener_t *listener, int *msgs_s /*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "popped event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */ - /* events from attached sessions are wrapped in a {call_event,} tuple + /* events from attached sessions are wrapped in a {call_event,} tuple to distinguish them from normal events (if they are sent to the same process) */ ei_x_buff ebuf; @@ -1227,7 +1227,7 @@ static int config(void) prefs.compat_rel = 0; prefs.max_event_bulk = 1; prefs.max_log_bulk = 1; - + if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); @@ -1531,14 +1531,14 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul /* insert the waiting marker */ switch_set_flag(session_element, LFLAG_WAITING_FOR_PID); - + /* attach the session to the listener */ add_session_elem_to_listener(listener, session_element); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Added session to listener\n"); switch_mutex_lock(p->mutex); - + if (!strcmp(function, "!")) { /* send a message to request a pid */ ei_x_buff rbuf; @@ -1668,7 +1668,7 @@ SWITCH_STANDARD_APP(erlang_outbound_function) return; } - + /* first work out if there is a listener already talking to the node we want to talk to */ listener = find_listener(node); /* if there is no listener, then create one */ diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 3ec5e5aad5..2f2c0ed059 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Andrew Thompson * Rob Charlton diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 97fb934262..011166b270 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index e463bf3f83..415e30131a 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Seven Du * @@ -313,7 +313,7 @@ static void event_handler(switch_event_t *event) const char *hval; send = 0; - + for (hp = l->filters->headers; hp; hp = hp->next) { if ((hval = switch_event_get_header(event, hp->name))) { const char *comp_to = hp->value; @@ -515,8 +515,8 @@ SWITCH_STANDARD_APP(socket_function) switch_ivr_parse_all_events(session); - if (switch_channel_get_state(channel) != CS_HIBERNATE && - !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_RESET) + if (switch_channel_get_state(channel) != CS_HIBERNATE && + !switch_channel_test_flag(channel, CF_REDIRECT) && !switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_RESET) && (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var)))) { switch_channel_set_state(channel, CS_EXECUTE); } @@ -602,7 +602,7 @@ static void remove_listener(listener_t *listener) static void send_disconnect(listener_t *listener, const char *message) { - + char disco_buf[512] = ""; switch_size_t len, mlen; @@ -611,7 +611,7 @@ static void send_disconnect(listener_t *listener, const char *message) } mlen = strlen(message); - + if (listener->session) { switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" "Controlled-Session-UUID: %s\n" @@ -1226,7 +1226,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, ptr = (mbuf + pos); } - + status = switch_socket_recv(listener->sock, ptr, &mlen); if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { @@ -1298,7 +1298,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, status = switch_socket_recv(listener->sock, p, &mlen); if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { - free(body); + free(body); switch_goto_status(SWITCH_STATUS_FALSE, end); } @@ -1426,7 +1426,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, } } - if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) && + if (switch_test_flag(listener, LFLAG_HANDLE_DISCO) && listener->linger_timeout != (time_t) -1 && switch_epoch_time_now(NULL) > listener->linger_timeout) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "linger timeout, closing socket\n"); status = SWITCH_STATUS_FALSE; @@ -1437,23 +1437,23 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, switch_set_flag_locked(listener, LFLAG_HANDLE_DISCO); if (switch_test_flag(listener, LFLAG_LINGER)) { char disco_buf[512] = ""; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %d\n", + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(listener->session), SWITCH_LOG_DEBUG, "%s Socket Linger %d\n", switch_channel_get_name(channel), (int)listener->linger_timeout); - + switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" "Controlled-Session-UUID: %s\n" - "Content-Disposition: linger\n" + "Content-Disposition: linger\n" "Channel-Name: %s\n" "Linger-Time: %d\n" - "Content-Length: 0\n\n", + "Content-Length: 0\n\n", switch_core_session_get_uuid(listener->session), switch_channel_get_name(channel), (int)listener->linger_timeout); if (listener->linger_timeout != (time_t) -1) { listener->linger_timeout += switch_epoch_time_now(NULL); } - + len = strlen(disco_buf); switch_socket_send(listener->sock, disco_buf, &len); } else { @@ -1608,7 +1608,7 @@ static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd, switch_bool_t ok = SWITCH_TRUE; top: - + if (!switch_core_hash_find(listener->allowed_api_hash, check_cmd)) { ok = SWITCH_FALSE; goto end; @@ -1662,7 +1662,7 @@ static void set_all_custom(listener_t *listener) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ADDING CUSTOM EVENT: %s\n", m->val); switch_core_hash_insert(listener->event_hash, m->val, MARKER); } - + switch_console_free_matches(&events); } } @@ -1674,7 +1674,7 @@ static void set_allowed_custom(listener_t *listener) void *val; switch_assert(listener->allowed_event_hash); - + for (hi = switch_core_hash_first(listener->allowed_event_hash); hi; hi = switch_core_hash_next(&hi)) { switch_core_hash_this(hi, &var, NULL, &val); switch_core_hash_insert(listener->event_hash, (char *)var, MARKER); @@ -1759,7 +1759,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even *tmp++ = '\0'; pass = tmp; } - + if (zstr(user) || zstr(domain_name)) { switch_snprintf(reply, reply_len, "-ERR invalid"); switch_clear_flag_locked(listener, LFLAG_RUNNING); @@ -2039,11 +2039,11 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if ((uuid = cmd + 9)) { char *fmt; strip_cr(uuid); - + if ((fmt = strchr(uuid, ' '))) { *fmt++ = '\0'; } - + if (!(listener->session = switch_core_session_locate(uuid))) { if (fmt) { switch_snprintf(reply, reply_len, "-ERR invalid uuid"); @@ -2060,7 +2060,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even listener->format = EVENT_FORMAT_PLAIN; } else if (!strcasecmp(fmt, "json")) { listener->format = EVENT_FORMAT_JSON; - } + } } switch_set_flag_locked(listener, LFLAG_SESSION); @@ -2216,7 +2216,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even const char *uuid = NULL; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; switch_uuid_str(uuid_str, sizeof(uuid_str)); - + switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-UUID", uuid_str); strip_cr(cmd); @@ -2274,7 +2274,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even if ((arg_copy = strchr(api_copy, ' '))) { *arg_copy++ = '\0'; } - + ok = auth_api_command(listener, api_copy, arg_copy); free(api_copy); @@ -2284,13 +2284,13 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even goto done; } } - + if (!(acs.console_execute = switch_true(console_execute))) { if ((arg = strchr(api_cmd, ' '))) { *arg++ = '\0'; } } - + acs.listener = listener; acs.api_cmd = api_cmd; acs.arg = arg; @@ -3011,13 +3011,13 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime) if (listener->sa && (listener->remote_port = switch_sockaddr_get_port(listener->sa))) { launch_listener_thread(listener); continue; - } + } } - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initilizing connection\n"); close_socket(&listener->sock); expire_listener(&listener); - + } end: diff --git a/src/mod/event_handlers/mod_event_test/mod_event_test.c b/src/mod/event_handlers/mod_event_test/mod_event_test.c index fe8e78e45e..b01b8083e6 100644 --- a/src/mod/event_handlers/mod_event_test/mod_event_test.c +++ b/src/mod/event_handlers/mod_event_test/mod_event_test.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp index e29e710f13..b7f517bac2 100644 --- a/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp +++ b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp @@ -26,7 +26,7 @@ public: // Use the JSON string as the message body zmq::message_t msg(pjson, strlen(pjson), free_message_data, NULL); - + // Send the message _publisher.send(msg); } @@ -78,7 +78,7 @@ public: void Listen() { // All we do is sit here and block the run loop thread so it doesn't return // it seems that if you want to keep your module running you can't return from the run loop - + char_msg msg; while(true) { // Listen for term message diff --git a/src/mod/event_handlers/mod_format_cdr/conf/autoload_configs/format_cdr.conf.xml b/src/mod/event_handlers/mod_format_cdr/conf/autoload_configs/format_cdr.conf.xml index 3e5cdaf153..1b44a273b0 100644 --- a/src/mod/event_handlers/mod_format_cdr/conf/autoload_configs/format_cdr.conf.xml +++ b/src/mod/event_handlers/mod_format_cdr/conf/autoload_configs/format_cdr.conf.xml @@ -1,6 +1,6 @@ - @@ -35,7 +35,7 @@ - + @@ -43,15 +43,15 @@ - - - + + + - + - diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index 7e1383aa71..a6eddc9f8e 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Brian West * Bret McDanel * Justin Cassidy @@ -89,7 +89,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_json_cdr_shutdown); SWITCH_MODULE_DEFINITION(mod_json_cdr, mod_json_cdr_load, mod_json_cdr_shutdown, NULL); -/* this function would have access to the HTML returned by the webserver, we don't need it +/* this function would have access to the HTML returned by the webserver, we don't need it * and the default curl activity is to print to stdout, something not as desirable * so we have a dummy function here */ @@ -207,12 +207,12 @@ static void backup_cdr(cdr_data_t *data) switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_INFO, "Backup file %s\n", path); if (path) { -#ifdef _MSC_VER +#ifdef _MSC_VER mode_t mode = S_IRUSR | S_IWUSR; -#else +#else mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; -#endif - if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)) > -1) { +#endif + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)) > -1) { switch_size_t json_len = strlen(json_text); switch_ssize_t wrote = 0, x; do { x = write(fd, json_text, json_len); @@ -231,18 +231,18 @@ static void backup_cdr(cdr_data_t *data) char ebuf[512] = { 0 }; switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_ERROR, "Can't open %s! [%s]\n", path, switch_strerror_r(errno, ebuf, sizeof(ebuf))); - + } switch_safe_free(path); } } } else { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(data->uuid), SWITCH_LOG_NOTICE, "Not writing to file\n"); - } + } } - -void destroy_cdr_data(cdr_data_t *data) + +void destroy_cdr_data(cdr_data_t *data) { switch_safe_free(data->json_text); switch_safe_free(data->json_text_escaped); @@ -314,7 +314,7 @@ static void process_cdr(cdr_data_t *data) curl_json_text = switch_mprintf("cdr=%s", data->json_text_escaped); switch_assert(curl_json_text != NULL); - + } else { headers = switch_curl_slist_append(headers, "Content-Type: application/json"); curl_json_text = (char *)data->json_text; @@ -463,15 +463,15 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error Generating Data!\n"); return SWITCH_STATUS_FALSE; } - + cdr_data = malloc(sizeof(cdr_data_t)); switch_assert(cdr_data); - + json_text = cJSON_PrintUnformatted(json_cdr); if (globals.url_count && globals.encode) { switch_size_t need_bytes = strlen(json_text) * 3; - + json_text_escaped = malloc(need_bytes); switch_assert(json_text_escaped); memset(json_text_escaped, 0, need_bytes); @@ -500,12 +500,12 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) if (switch_queue_trypush(globals.queue, cdr_data) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to push cdr to queue\n"); backup_cdr(cdr_data); - destroy_cdr_data(cdr_data); + destroy_cdr_data(cdr_data); } } else { process_cdr(cdr_data); } - + cJSON_Delete(json_cdr); return SWITCH_STATUS_SUCCESS; @@ -649,7 +649,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load) globals.base_err_log_dir[globals.err_dir_count++] = switch_core_sprintf(globals.pool, "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val); } } - + } } else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) { globals.enable_cacert_check = 1; @@ -744,7 +744,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_json_cdr_shutdown) } switch_safe_free(globals.log_dir); - + for (;err_dir_index < globals.err_dir_count; err_dir_index++) { switch_safe_free(globals.err_log_dir[err_dir_index]); } diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_node.c b/src/mod/event_handlers/mod_kazoo/kazoo_node.c index ed4ed0f0fd..1748b7c3ee 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_node.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_node.c @@ -207,7 +207,7 @@ SWITCH_DECLARE(switch_status_t) kazoo_api_execute(const char *cmd, const char *a cmd_used = (char *) cmd; arg_used = (char *) arg; - + if (!stream->param_event) { switch_event_create(&stream->param_event, SWITCH_EVENT_API); @@ -246,7 +246,7 @@ SWITCH_DECLARE(switch_status_t) kazoo_api_execute(const char *cmd, const char *a if (cmd_used != cmd) { switch_safe_free(cmd_used); } - + if (arg_used != arg) { switch_safe_free(arg_used); } diff --git a/src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c b/src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c index 7a744dbc6e..1ca10a72d7 100644 --- a/src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c +++ b/src/mod/event_handlers/mod_odbc_cdr/mod_odbc_cdr.c @@ -304,7 +304,7 @@ static switch_status_t odbc_cdr_reporting(switch_core_session_t *session) char *full_path = NULL; switch_stream_handle_t stream_field = { 0 }; switch_stream_handle_t stream_value = { 0 }; - switch_bool_t insert_fail = SWITCH_FALSE; + switch_bool_t insert_fail = SWITCH_FALSE; SWITCH_STANDARD_STREAM(stream_field); SWITCH_STANDARD_STREAM(stream_value); diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index aecbaf0c62..490a7911f1 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Chris Parker * Mathieu Rene * @@ -225,7 +225,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) return SWITCH_STATUS_TERM; } */ - + if ((signal_bond = switch_channel_get_partner_uuid(channel)) && !zstr(signal_bond)) { if (rc_avpair_add(rad_config, &send, PW_FS_OTHER_LEG_ID, (void*) signal_bond, -1, PW_FS_PEC) == NULL) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str); @@ -687,10 +687,10 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) rc_destroy(rad_config); goto end; } - + { const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound"; - + if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str); rc_destroy(rad_config); diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h index a3effad005..0257f61303 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Chris Parker * * Description: Contains definitions and structs used by the radius cdr module. diff --git a/src/mod/event_handlers/mod_rayo/iks_helpers.c b/src/mod/event_handlers/mod_rayo/iks_helpers.c index 4a290b9130..707350a97d 100644 --- a/src/mod/event_handlers/mod_rayo/iks_helpers.c +++ b/src/mod/event_handlers/mod_rayo/iks_helpers.c @@ -541,7 +541,7 @@ void iks_sha_print_base64(iksha *sha, char *buf) hex_digit[1] = hex_buf[i + 1]; bin_buf[i / 2] = strtol(hex_digit, NULL, 16); } - + switch_b64_encode(bin_buf, SHA_1_HASH_BUF_SIZE / 2, (unsigned char *)buf, SHA_1_HASH_BUF_SIZE); } diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index fd72b43378..7a7a46c346 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -4072,7 +4072,7 @@ SWITCH_STANDARD_APP(rayo_app) } } if (!call) { - /* this scenario can only happen if a call was originated through a mechanism other than + /* this scenario can only happen if a call was originated through a mechanism other than and then the rayo APP was executed to offer control */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Outbound call that wasn't created with , will try to offer control\n"); } @@ -5179,7 +5179,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load) return SWITCH_STATUS_TERM; } - + *module_interface = switch_loadable_module_create_module_interface(pool, modname); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading module\n"); @@ -5288,7 +5288,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load) * Shutdown module. Notifies threads to stop. */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rayo_shutdown) -{ +{ switch_status_t result; switch_event_free_subclass("rayo::cpa"); diff --git a/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c b/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c index a2fa679a2b..19f2ddafd7 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_cpa_component.c @@ -262,7 +262,7 @@ static void rayo_cpa_component_hangup(const char *jid, void *user_data) } /** - * Handle hungup call event + * Handle hungup call event */ static void on_channel_hangup_complete_event(switch_event_t *event) { @@ -353,7 +353,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, /* acknowledge command */ rayo_component_send_start(RAYO_COMPONENT(component), iq); - /* TODO hangup race condition */ + /* TODO hangup race condition */ subscribe(switch_core_session_get_uuid(session), "hangup", RAYO_JID(component)); /* ready to forward detector events */ @@ -374,7 +374,7 @@ switch_status_t rayo_cpa_component_load(switch_loadable_module_interface_t **mod rayo_actor_command_handler_add(RAT_CALL_COMPONENT, "cpa", "set:"RAYO_EXT_NS":stop", stop_cpa_component); switch_event_bind("rayo_cpa_component", SWITCH_EVENT_CUSTOM, "rayo::cpa", on_rayo_cpa_detector_event, NULL); switch_event_bind("rayo_cpa_component", SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE, NULL, on_channel_hangup_complete_event, NULL); - + globals.pool = pool; switch_core_hash_init(&globals.subscribers); switch_mutex_init(&globals.subscribers_mutex, SWITCH_MUTEX_NESTED, pool); diff --git a/src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c b/src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c index 0905f6e547..ef00f3968d 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c +++ b/src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c @@ -219,7 +219,7 @@ SWITCH_STANDARD_API(rayo_cpa_detector_api) cmd_dup = strdup(cmd); argc = switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0])); - + if (argc != 3) { stream->write_function(stream, "-ERR: USAGE %s\n", RAYO_CPA_DETECTOR_SYNTAX); } else { diff --git a/src/mod/event_handlers/mod_rayo/rayo_input_component.c b/src/mod/event_handlers/mod_rayo/rayo_input_component.c index 77855463d6..6e1feefb82 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -280,7 +280,7 @@ static switch_status_t input_handler_on_dtmf(switch_core_session_t *session, con switch_hash_index_t *hi; switch_mutex_lock(handler->mutex); - + /* check input on each component */ for (hi = switch_core_hash_first(handler->dtmf_components); hi; hi = switch_core_hash_next(&hi)) { const void *jid; diff --git a/src/mod/event_handlers/mod_rayo/sasl.c b/src/mod/event_handlers/mod_rayo/sasl.c index c93146d13b..4277ea305b 100644 --- a/src/mod/event_handlers/mod_rayo/sasl.c +++ b/src/mod/event_handlers/mod_rayo/sasl.c @@ -63,7 +63,7 @@ void parse_plain_auth_message(const char *message, char **authzid, char **authci } else { *authzid = strdup(decoded); } - + end: switch_safe_free(decoded); } diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp.c b/src/mod/event_handlers/mod_smpp/mod_smpp.c index c18761b158..e04bea31a3 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp.c +++ b/src/mod/event_handlers/mod_smpp/mod_smpp.c @@ -47,7 +47,7 @@ switch_status_t mod_smpp_interface_chat_send(switch_event_t *event) if (zstr(gw_name)) { gw_name = "default"; } - + gateway = switch_core_hash_find(mod_smpp_globals.gateways, gw_name); if (!gateway) { @@ -86,17 +86,17 @@ SWITCH_STANDARD_APP(mod_smpp_app_send_function) if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) { return; } - + /* Copy over recognized channel vars. Then call the chat send function */ /* Cycle through all of the channel headers, and ones with 'smpp_' prefix copy over without the prefix */ for ( chan_var = switch_channel_variable_first(channel); chan_var; chan_var = chan_var->next) { if ( !strncmp(chan_var->name, "smpp_", 5) ) { switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name + 5, chan_var->value); } else { - switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name, chan_var->value); + switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, chan_var->name, chan_var->value); } } - + /* Unlock the channel variables */ switch_channel_variable_last(channel); mod_smpp_chat_send_function(message, data); @@ -137,7 +137,7 @@ SWITCH_STANDARD_API(mod_smpp_send_api) if (switch_event_create(&message, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) { switch_goto_status(SWITCH_STATUS_GENERR, done); } - + switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "to_user", argv[1]); switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, "from_user", argv[2]); switch_event_set_body(message, argv[3]); @@ -149,10 +149,10 @@ SWITCH_STANDARD_API(mod_smpp_send_api) done: switch_safe_free(cmd_dup); return status; - + } -switch_status_t mod_smpp_do_config() +switch_status_t mod_smpp_do_config() { char *conf = "smpp.conf"; switch_xml_t xml, cfg, gateways, gateway, params, param; @@ -163,11 +163,11 @@ switch_status_t mod_smpp_do_config() } if ( (gateways = switch_xml_child(cfg, "gateways")) != NULL) { - for (gateway = switch_xml_child(gateways, "gateway"); gateway; gateway = gateway->next) { + for (gateway = switch_xml_child(gateways, "gateway"); gateway; gateway = gateway->next) { mod_smpp_gateway_t *new_gateway = NULL; char *host = NULL, *system_id = NULL, *password = NULL, *profile = NULL, *system_type = NULL; int port = 0, debug = 0; - + char *name = (char *)switch_xml_attr_soft(gateway, "name"); // Load params @@ -202,9 +202,9 @@ switch_status_t mod_smpp_do_config() switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateways config is missing\n"); goto err; } - + return SWITCH_STATUS_SUCCESS; - + err: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Configuration failed\n"); return SWITCH_STATUS_GENERR; @@ -220,12 +220,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_smpp_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - + memset(&mod_smpp_globals, 0, sizeof(mod_smpp_globals_t)); mod_smpp_globals.pool = pool; mod_smpp_globals.debug = 0; switch_core_hash_init(&(mod_smpp_globals.gateways)); - + if ( mod_smpp_do_config() != SWITCH_STATUS_SUCCESS ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load due to bad configs\n"); return SWITCH_STATUS_TERM; @@ -234,9 +234,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_smpp_load) SWITCH_ADD_CHAT(mod_smpp_chat_interface, "smpp", mod_smpp_interface_chat_send); SWITCH_ADD_API(mod_smpp_api_interface, "smpp_debug", "mod_smpp toggle debug", mod_smpp_debug_api, NULL); SWITCH_ADD_API(mod_smpp_api_interface, "smpp_send", "mod_smpp send", mod_smpp_send_api, NULL); - SWITCH_ADD_CHAT_APP(mod_smpp_chat_app_interface, "smpp_send", "send message to gateway", "send message to gateway", + SWITCH_ADD_CHAT_APP(mod_smpp_chat_app_interface, "smpp_send", "send message to gateway", "send message to gateway", mod_smpp_chat_send_function, "", SCAF_NONE); - SWITCH_ADD_APP(mod_smpp_app_interface, "smpp_send", NULL, NULL, mod_smpp_app_send_function, + SWITCH_ADD_APP(mod_smpp_app_interface, "smpp_send", NULL, NULL, mod_smpp_app_send_function, "smpp_send", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); /* indicate that the module should continue to be loaded */ diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp.h b/src/mod/event_handlers/mod_smpp/mod_smpp.h index 318ceb765d..3320a7829b 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp.h +++ b/src/mod/event_handlers/mod_smpp/mod_smpp.h @@ -77,7 +77,7 @@ typedef struct mod_smpp_message_s { /* mod_smpp_gateway.c */ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway); switch_status_t mod_smpp_gateway_connect(mod_smpp_gateway_t *gateway); -switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char*host, int port, int debug, char *system_id, +switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char*host, int port, int debug, char *system_id, char *password, char *system_type, char *profile); switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gateway); switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switch_event_t *message); diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c b/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c index 7125f04e0f..e4a927b111 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c +++ b/src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c @@ -36,11 +36,11 @@ static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *thread, void *obj); -switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char *host, int port, int debug, char *system_id, +switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, char *host, int port, int debug, char *system_id, char *password, char *system_type, char *profile) { mod_smpp_gateway_t *gateway = NULL; switch_memory_pool_t *pool = NULL; - + switch_core_new_memory_pool(&pool); gateway = switch_core_alloc(pool, sizeof(mod_smpp_gateway_t)); @@ -57,13 +57,13 @@ switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, cha gateway->system_type = system_type ? switch_core_strdup(gateway->pool, system_type) : "freeswitch_smpp"; gateway->profile = profile ? switch_core_strdup(gateway->pool, profile) : "default"; - if ( switch_sockaddr_info_get(&(gateway->socketaddr), gateway->host, SWITCH_INET, + if ( switch_sockaddr_info_get(&(gateway->socketaddr), gateway->host, SWITCH_INET, gateway->port, 0, mod_smpp_globals.pool) != SWITCH_STATUS_SUCCESS ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get socketaddr info\n"); goto err; } - if ( switch_socket_create(&(gateway->socket), switch_sockaddr_get_family(gateway->socketaddr), + if ( switch_socket_create(&(gateway->socket), switch_sockaddr_get_family(gateway->socketaddr), SOCK_STREAM, SWITCH_PROTO_TCP, mod_smpp_globals.pool) != SWITCH_STATUS_SUCCESS ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create the socket\n"); goto err; @@ -84,7 +84,7 @@ switch_status_t mod_smpp_gateway_create(mod_smpp_gateway_t **gw, char *name, cha switch_core_hash_insert(mod_smpp_globals.gateways, name, (void *) gateway); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Gateway %s created\n", gateway->host); - + *gw = gateway; return SWITCH_STATUS_SUCCESS; @@ -110,15 +110,15 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) { req_b->addr_ton = 1; strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range)); - + if ( gateway->system_id ) { strncpy((char *)req_b->system_id, gateway->system_id, sizeof(req_b->system_id)); } - + if ( gateway->password ) { strncpy((char *)req_b->password, gateway->password, sizeof(req_b->password)); } - + if ( gateway->system_type ) { strncpy((char *)req_b->system_type, gateway->system_type, sizeof(req_b->system_type)); } @@ -146,7 +146,7 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) { switch_goto_status(SWITCH_STATUS_GENERR, done); } - if( write_len != local_buffer_len ){ + if( write_len != local_buffer_len ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -170,7 +170,7 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) { if ( req_b ) { switch_safe_free(req_b); } - + return status; } @@ -182,7 +182,7 @@ switch_status_t mod_smpp_gateway_connect(mod_smpp_gateway_t *gateway) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to connect the socket %d\n", status); return SWITCH_STATUS_GENERR; } - + if ( mod_smpp_gateway_authenticate(gateway) != SWITCH_STATUS_SUCCESS ) { return SWITCH_STATUS_GENERR; } @@ -210,7 +210,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw switch_goto_status(SWITCH_STATUS_GENERR, done); } - if ( read_len != 4 ){ + if ( read_len != 4 ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in recv(PEEK) %d\n", (unsigned int )read_len); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -218,7 +218,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw read_len = ntohl(*local_buffer32 ); if ( read_len > 1500 ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Corrupted PDU size from gateway [%s]\n", gateway->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Corrupted PDU size from gateway [%s]\n", gateway->name); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -252,14 +252,14 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw case DELIVER_SM: if ( gennack->command_status == ESME_ROK ) { deliver_sm_t *res = (deliver_sm_t *) data; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New SMS received from[%s] to[%s] message[%s]\n", + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New SMS received from[%s] to[%s] message[%s]\n", res->source_addr, res->destination_addr, res->short_message); - + mod_smpp_message_decode(gateway, res, &evt); } break; - case ENQUIRE_LINK: + case ENQUIRE_LINK: case ENQUIRE_LINK_RESP: case SUBMIT_SM_RESP: switch (gennack->command_status) { @@ -287,7 +287,7 @@ switch_status_t mod_smpp_gateway_connection_read(mod_smpp_gateway_t *gateway, sw *event = evt; } - done: + done: switch_safe_free(local_buffer); return status; } @@ -332,7 +332,7 @@ static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *th } mod_smpp_gateway_send_deliver_sm_response(gateway, event); - + switch_core_chat_send("smpp", event); switch_event_destroy(&event); /* Fire message to the chat plan, then respond */ @@ -345,7 +345,7 @@ static void *SWITCH_THREAD_FUNC mod_smpp_gateway_read_thread(switch_thread_t *th if ( event ) { char *str = NULL; switch_event_serialize(event, &str, SWITCH_FALSE); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown packet event: %s\n", str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown packet event: %s\n", str); switch_safe_free(str); } } @@ -383,7 +383,7 @@ switch_status_t mod_smpp_gateway_send_enquire_link_response(mod_smpp_gateway_t * switch_goto_status(SWITCH_STATUS_GENERR, done); } - if( write_len != local_buffer_len ){ + if( write_len != local_buffer_len ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -424,7 +424,7 @@ switch_status_t mod_smpp_gateway_send_deliver_sm_response(mod_smpp_gateway_t *ga switch_goto_status(SWITCH_STATUS_GENERR, done); } - if( write_len != local_buffer_len ){ + if( write_len != local_buffer_len ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -464,7 +464,7 @@ switch_status_t mod_smpp_gateway_send_unbind(mod_smpp_gateway_t *gateway) switch_goto_status(SWITCH_STATUS_GENERR, done); } - if( write_len != local_buffer_len ){ + if( write_len != local_buffer_len ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Was not able to send entire buffer\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -475,16 +475,16 @@ switch_status_t mod_smpp_gateway_send_unbind(mod_smpp_gateway_t *gateway) return status; } -switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gw) +switch_status_t mod_smpp_gateway_destroy(mod_smpp_gateway_t **gw) { mod_smpp_gateway_t *gateway = NULL; if ( !gw || !*gw ) { return SWITCH_STATUS_SUCCESS; } - + gateway = *gw; - + switch_core_hash_delete(mod_smpp_globals.gateways, gateway->name); gateway->running = 0; @@ -518,7 +518,7 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc int local_buffer_len = sizeof(local_buffer); switch_status_t status = SWITCH_STATUS_SUCCESS; switch_size_t write_len = 0; - + if ( mod_smpp_message_create(gateway, message, &msg) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to send message due to message_create failure\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); @@ -527,14 +527,14 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc memset(local_buffer, 0, sizeof(local_buffer)); if( smpp34_pack2( local_buffer, sizeof(local_buffer), &local_buffer_len, (void*)&(msg->req)) != 0 ){ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Unable to encode message:%d:\n%s\n", smpp34_errno, smpp34_strerror); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Unable to encode message:%d:\n%s\n", smpp34_errno, smpp34_strerror); switch_goto_status(SWITCH_STATUS_GENERR, done); } write_len = local_buffer_len; if ( mod_smpp_gateway_get_next_sequence(gateway, &(msg->req.sequence_number)) ) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to fetch next gateway sequence number\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to fetch next gateway sequence number\n"); switch_goto_status(SWITCH_STATUS_GENERR, done); } @@ -547,7 +547,7 @@ switch_status_t mod_smpp_gateway_send_message(mod_smpp_gateway_t *gateway, switc switch_goto_status(SWITCH_STATUS_GENERR, done); } - if ( write_len != local_buffer_len ){ + if ( write_len != local_buffer_len ){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "smpp: Did not send all of message to gateway"); switch_goto_status(SWITCH_STATUS_GENERR, done); } diff --git a/src/mod/event_handlers/mod_smpp/mod_smpp_message.c b/src/mod/event_handlers/mod_smpp/mod_smpp_message.c index 6c168b5b83..a7407102bc 100644 --- a/src/mod/event_handlers/mod_smpp/mod_smpp_message.c +++ b/src/mod/event_handlers/mod_smpp/mod_smpp_message.c @@ -36,7 +36,7 @@ switch_status_t mod_smpp_message_encode_body(char *body, int length, unsigned char *bin, uint8_t *enc_length) { int i = 0; - + for ( i = 0; i < length; i++ ) { bin[i*2] = body[i] / 16; bin[i*2 + 1] = body[i] % 16; @@ -46,13 +46,13 @@ switch_status_t mod_smpp_message_encode_body(char *body, int length, unsigned ch return SWITCH_STATUS_SUCCESS; } -/* +/* Scratch notes taken during development/interop: char *message = "5361792048656c6c6f20746f204d79204c6974746c6520467269656e64"; ''.join('%02x' % ord(c) for c in u'Скажите привет моему маленькому другу'.encode('utf16')) - Variable length UTF-16 russian text: + Variable length UTF-16 russian text: char *message = "fffe21043a043004360438044204350420003f044004380432043504420420003c043e0435043c04430420003c0430043b0435043d044c043a043e043c044304200034044004430433044304"; char *mesg_txt = "This is a test SMS message from FreeSWITCH over SMPP"; @@ -62,7 +62,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even { mod_smpp_message_t *msg = calloc(1, sizeof(mod_smpp_message_t)); char *body = switch_event_get_body(event); - + assert(*message == NULL); if ( !body ) { @@ -87,7 +87,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even msg->req.sm_default_msg_id = 0; msg->req.data_coding = 0; msg->req.source_addr_ton = 1; - msg->req.source_addr_npi = 1; + msg->req.source_addr_npi = 1; msg->req.dest_addr_ton = 1; msg->req.dest_addr_npi = 1; msg->req.esm_class = 1; /* 0 => default, 1 => datagram, 2 => forward(transaction), 3 => store and forward @@ -104,7 +104,7 @@ switch_status_t mod_smpp_message_create(mod_smpp_gateway_t *gateway, switch_even snprintf((char *)msg->req.short_message, sizeof(msg->req.short_message), "%s", body); msg->req.sm_length = strlen(body); - if ( 0 && mod_smpp_message_encode_body(body, strlen(body), + if ( 0 && mod_smpp_message_encode_body(body, strlen(body), (unsigned char *) &(msg->req.short_message), &(msg->req.sm_length)) != SWITCH_STATUS_SUCCESS ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to encode message body\n"); goto err; @@ -124,7 +124,7 @@ switch_status_t mod_smpp_message_decode(mod_smpp_gateway_t *gateway, deliver_sm_ char *str = NULL; if (switch_event_create(&evt, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new event\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new event\n"); } switch_event_add_header_string(evt, SWITCH_STACK_BOTTOM, "endpoint", "mod_smpp"); @@ -173,7 +173,7 @@ switch_status_t mod_smpp_message_decode(mod_smpp_gateway_t *gateway, deliver_sm_ switch_status_t mod_smpp_message_destroy(mod_smpp_message_t **msg) { if ( msg ) { - switch_safe_free(*msg); + switch_safe_free(*msg); } return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index e0dbe7caba..9ec2928152 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -26,7 +26,7 @@ * Contributor(s): * Daniel Swarbrick * Stefan Knoblich - * + * * mod_snmp.c -- SNMP AgentX Subagent Module * */ diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index 4b76b9d046..dd29939e6a 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -26,7 +26,7 @@ * Contributor(s): * Daniel Swarbrick * Stefan Knoblich - * + * * mod_snmp.c -- SNMP AgentX Subagent Module * */ diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index fe564cbf46..0cd3ea3728 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -26,7 +26,7 @@ * Contributor(s): * Daniel Swarbrick * Stefan Knoblich - * + * * subagent.h -- SNMP Agent Definitions * */ diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index accbb8d460..6428421994 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Cesar Cepeda * Emmanuel Schmidbauer @@ -159,7 +159,7 @@ switch_status_t list_streams_full(const char *line, const char *cursor, switch_c const void *vvar; switch_console_callback_match_t *my_matches = NULL; switch_status_t status = SWITCH_STATUS_FALSE; - + switch_mutex_lock(globals.mutex); for (hi = switch_core_hash_first(globals.source_hash); hi; hi = switch_core_hash_next(&hi)) { switch_core_hash_this(hi, &vvar, NULL, &val); @@ -172,12 +172,12 @@ switch_status_t list_streams_full(const char *line, const char *cursor, switch_c switch_console_push_match(&my_matches, (const char *) vvar); } switch_mutex_unlock(globals.mutex); - + if (my_matches) { *matches = my_matches; status = SWITCH_STATUS_SUCCESS; } - + return status; } @@ -269,7 +269,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void while (RUNNING && !source->stopped && source->ready) { const char *fname; - + if (source->dir_handle) { switch_dir_close(source->dir_handle); source->dir_handle = NULL; @@ -373,7 +373,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void if ((p = strrchr(tmp_buf, '/'))) { *p++ = '\0'; - switch_snprintf(png_buf, sizeof(png_buf), "%s/art/%s.png", tmp_buf, p); + switch_snprintf(png_buf, sizeof(png_buf), "%s/art/%s.png", tmp_buf, p); if (switch_file_exists(png_buf, temp_pool) == SWITCH_STATUS_SUCCESS) { source->cover_art = switch_img_read_png(png_buf, SWITCH_IMG_FMT_I420); } @@ -382,24 +382,24 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void source->serno++; switch_safe_free(source->banner_txt); title = artist = NULL; - + switch_core_file_get_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, &artist); switch_core_file_get_string(&fh, SWITCH_AUDIO_COL_STR_TITLE, &title); if (!title && !artist) { char *e, *p, *args[3]; int argc; - + switch_set_string(tmp_space, path_buf); p = tmp_space; - + while((e = strchr(p, '/'))) { *e = '\0'; p = e+1; } argc = switch_split(p, '-', args); - + if (argc > 0) { while(*args[0] == ' ') { args[0]++; @@ -408,7 +408,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void while(end_of(args[0]) == ' ') { end_of(args[0]) = '\0'; } - + artist = args[0]; if (argc > 1) { @@ -430,17 +430,17 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void artist = NULL; } } - + if (title && (source->cover_art || switch_core_file_has_video(&fh, SWITCH_TRUE))) { const char *format = "#cccccc:#333333:FreeSans.ttf:3%:"; - + if (artist) { source->banner_txt = switch_mprintf("%s%s (%s)", format, title, artist); } else { source->banner_txt = switch_mprintf("%s%s", format, title); } } - + while (RUNNING && !source->stopped) { int is_open; @@ -448,13 +448,13 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_core_timer_next(&source->timer); olen = source->samples; - + if (source->chime_total) { if (source->chime_counter > 0) { source->chime_counter -= (int32_t)source->samples; } - + if (!switch_test_flag((&source->chime_fh), SWITCH_FILE_OPEN) && source->chime_counter <= 0) { char *val; @@ -497,19 +497,19 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void source->hup = 0; if (is_open) { is_open = 0; - + switch_core_file_close(use_fh); flush_video_queue(source->video_q); switch_buffer_zero(audio_buffer); if (use_fh == &source->chime_fh) { source->chime_counter = source->rate * source->chime_freq; switch_core_file_close(&fh); - use_fh = &fh; + use_fh = &fh; } goto retry; } } - + if (is_open) { int svr = 0; @@ -548,7 +548,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void switch_core_file_read(&fh, source->abuf, &olen); olen = source->samples; } - + switch_assert(source->abuflen >= olen * 2 * source->channels); if (switch_core_file_read(use_fh, source->abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) { @@ -573,7 +573,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void goto retry; } } - + if (source->total) { if (source->energy_avg && source->agc) { @@ -602,17 +602,17 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void void *pop; uint32_t bused = 0; local_stream_context_t *cp = NULL; - + switch_assert(source->abuflen <= source->prebuf); used = switch_buffer_read(audio_buffer, dist_buf, source->abuflen); - + switch_mutex_lock(source->mutex); for (cp = source->context_list; cp && RUNNING; cp = cp->next) { if (!cp->ready) { continue; } - + switch_mutex_lock(cp->audio_mutex); if (switch_test_flag(cp->handle, SWITCH_FILE_OPEN)) { @@ -625,7 +625,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void bused = (uint32_t)switch_buffer_inuse(cp->audio_buffer); if (bused > source->samples * 768) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld\n", cp->func, cp->file, cp->line, bused, (long)source->samples); switch_buffer_zero(cp->audio_buffer); } else { @@ -635,7 +635,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void } switch_mutex_unlock(source->mutex); - + while (switch_queue_trypop(source->video_q, &pop) == SWITCH_STATUS_SUCCESS) { switch_image_t *img; switch_image_t *imgcp = NULL; @@ -681,7 +681,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void } } } - } + } switch_img_free(&img); } } @@ -782,7 +782,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void } switch_safe_free(source->banner_txt); - + if (switch_test_flag((&fh), SWITCH_FILE_OPEN)) { switch_core_file_close(&fh); } @@ -875,7 +875,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons //} pool = handle->memory_pool; - + if ((context = switch_core_alloc(pool, sizeof(*context))) == 0) { abort(); } @@ -902,7 +902,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons goto end; } - if (!switch_core_has_video() || + if (!switch_core_has_video() || (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && !source->has_video && !source->blank_img && !source->cover_art && !source->banner_txt)) { switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO); } @@ -949,21 +949,21 @@ static switch_status_t local_stream_file_close(switch_file_handle_t *handle) last->next = cp->next; } else { source->context_list = cp->next; - } + } break; } last = cp; } switch_mutex_lock(context->audio_mutex); - + if (source->has_video) { flush_video_queue(context->video_q); switch_queue_trypush(context->video_q, NULL); switch_queue_interrupt_all(context->video_q); flush_video_queue(context->video_q); } - + source->total--; switch_img_free(&context->banner_img); @@ -1004,7 +1004,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle if (src_img) { switch_image_t *img = NULL; - + if (context->sent_png && --context->sent_png > 0) { return SWITCH_STATUS_BREAK; } @@ -1042,7 +1042,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle if (!(context->ready && context->source->ready)) { return SWITCH_STATUS_FALSE; } - + while (!(flags & SVR_BLOCK) && switch_queue_size(context->video_q) < buf_qsize) { return SWITCH_STATUS_BREAK; } @@ -1078,7 +1078,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle switch_img_fill(frame->img, 0, 0, frame->img->d_w, frame->img->d_h, &bgcolor); context->pop_count--; } - + now = switch_micro_time_now(); if (context->banner_img) { @@ -1093,7 +1093,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle context->serno = context->source->serno; context->pop_count = 5; } - + if (context->source->banner_txt) { if ((!context->banner_timeout || context->banner_timeout >= now)) { if (context->newres) { @@ -1116,12 +1116,12 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle switch_img_overlay(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h, context->source->text_opacity); } - if (frame->img && context->source->logo_img && + if (frame->img && context->source->logo_img && (context->source->logo_always || context->banner_img) && frame->img->d_w >= context->source->logo_img->d_w) { int x = 0, y = 0; - + switch_img_find_position(context->source->logo_pos, - frame->img->d_w, frame->img->d_h, + frame->img->d_w, frame->img->d_h, context->source->logo_img->d_w, context->source->logo_img->d_h, &x, &y); @@ -1145,7 +1145,7 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void *len = 0; return SWITCH_STATUS_FALSE; } - + if (context->source->has_video) { if (!switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { switch_set_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO); @@ -1163,7 +1163,7 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void *len = bytes / 2 / context->source->channels; } else { size_t blank; - + switch_assert(handle->samplerate <= 48000); switch_assert(handle->real_channels <= 2); @@ -1443,7 +1443,7 @@ SWITCH_STANDARD_API(local_stream_function) stream->write_function(stream, "+OK stream: %s", local_stream_name); } } - + } else if (!strcasecmp(argv[0], "show")) { switch_hash_index_t *hi; const void *var; @@ -1500,12 +1500,12 @@ SWITCH_STANDARD_API(local_stream_function) } } } - + goto done; - + usage: stream->write_function(stream, "-USAGE: %s\n", LOCAL_STREAM_SYNTAX); - + done: switch_safe_free(mycmd); @@ -1526,7 +1526,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_local_stream_load) if (!launch_streams(NULL)) { return SWITCH_STATUS_GENERR; } - + *module_interface = switch_loadable_module_create_module_interface(pool, modname); file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); file_interface->interface_name = modname; diff --git a/src/mod/formats/mod_native_file/mod_native_file.c b/src/mod/formats/mod_native_file/mod_native_file.c index d2db2b1b52..1ea69c404b 100644 --- a/src/mod/formats/mod_native_file/mod_native_file.c +++ b/src/mod/formats/mod_native_file/mod_native_file.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * diff --git a/src/mod/formats/mod_png/mod_png.c b/src/mod/formats/mod_png/mod_png.c index da4a326d43..67ea090495 100644 --- a/src/mod/formats/mod_png/mod_png.c +++ b/src/mod/formats/mod_png/mod_png.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2015, Anthony Minessale II * @@ -67,7 +67,7 @@ static switch_status_t png_file_open(switch_file_handle_t *handle, const char *p return SWITCH_STATUS_GENERR; } ext++; - + if ((context = (png_file_context_t *)switch_core_alloc(handle->memory_pool, sizeof(png_file_context_t))) == 0) { return SWITCH_STATUS_MEMERR; } @@ -190,7 +190,7 @@ static switch_status_t png_file_read(switch_file_handle_t *handle, void *data, s status = SWITCH_STATUS_FALSE; switch_goto_status(status, end); } - + memset(data, 0, *len * 2 * handle->channels); end: @@ -295,7 +295,7 @@ static switch_bool_t write_png_bug_callback(switch_media_bug_t *bug, void *user_ switch_img_write_png(frame->img, data->path); return SWITCH_FALSE; } - + if (!data->write_img) { switch_img_copy(frame->img, &data->write_img); } @@ -352,7 +352,7 @@ SWITCH_STANDARD_API(uuid_write_png_function) stream->write_function(stream, "-USAGE: [concat | split ]\n"); goto end; } - + uuid = argv[0]; if (!(session_ = switch_core_session_locate(uuid))) { @@ -448,7 +448,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_png_load) SWITCH_ADD_API(api_interface, "uuid_write_png", "grab an image from a call",uuid_write_png_function, ""); switch_console_set_complete("add uuid_write_png ::console::list_uuid"); - + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/formats/mod_shell_stream/mod_shell_stream.c b/src/mod/formats/mod_shell_stream/mod_shell_stream.c index 07e0e41ce7..2cb38d24cc 100644 --- a/src/mod/formats/mod_shell_stream/mod_shell_stream.c +++ b/src/mod/formats/mod_shell_stream/mod_shell_stream.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_shell_stream.c -- Local Streaming Audio @@ -176,7 +176,7 @@ static switch_status_t shell_stream_file_close(switch_file_handle_t *handle) if (context->thread) { switch_thread_join(&st, context->thread); } - + if (context->audio_buffer) { switch_buffer_destroy(&context->audio_buffer); } diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 66cfa13682..b736042abb 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Rupa Schomaker * John Wehle @@ -478,7 +478,7 @@ static int sockopt_callback(void *clientp, curl_socket_t curlfd, switch_mutex_lock(context->audio_mutex); context->curlfd = curlfd; switch_mutex_unlock(context->audio_mutex); - + return 0; } @@ -752,16 +752,16 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char } context->channels = handle->channels; - + if (globals.brate) { lame_set_brate(context->gfp, globals.brate); } else { lame_set_brate(context->gfp, 16 * (handle->samplerate / 8000) * handle->channels); } - + lame_set_num_channels(context->gfp, handle->channels); lame_set_in_samplerate(context->gfp, handle->samplerate); - + if (globals.resample) { lame_set_out_samplerate(context->gfp, globals.resample); } else { @@ -880,7 +880,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char } else { const char *mask = "wb+"; - + if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { mask = "ab+"; } @@ -979,7 +979,7 @@ static switch_status_t shout_file_read(switch_file_handle_t *handle, void *data, if (newbytes < bytes) { bytes = newbytes; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with %ds of empty audio. (%s)\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with %ds of empty audio. (%s)\n", context->buffer_seconds, context->stream_url); memset(data, 255, bytes); diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 6c714af11e..974fa89530 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -225,7 +225,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha handle->pos = sf_seek(context->handle, frames, SEEK_END); } else if (switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { handle->pos = sf_seek(context->handle, frames, SEEK_SET); - } else { + } else { sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames)); } @@ -279,7 +279,7 @@ static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned sndfile_context *context = handle->private_info; sf_count_t count; switch_status_t r = SWITCH_STATUS_SUCCESS; - + if (!handle->seekable) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); return SWITCH_STATUS_NOTIMPL; @@ -289,10 +289,10 @@ static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned r = SWITCH_STATUS_BREAK; count = sf_seek(context->handle, -1, SEEK_END); } - + *cur_sample = (unsigned int) count; - handle->pos = *cur_sample; - + handle->pos = *cur_sample; + return r; } diff --git a/src/mod/formats/mod_tone_stream/mod_tone_stream.c b/src/mod/formats/mod_tone_stream/mod_tone_stream.c index 90d1fec0cf..3e8a2a87be 100644 --- a/src/mod/formats/mod_tone_stream/mod_tone_stream.c +++ b/src/mod/formats/mod_tone_stream/mod_tone_stream.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -56,7 +56,7 @@ static switch_status_t silence_stream_file_open(switch_file_handle_t *handle, co } sh = switch_core_alloc(handle->memory_pool, sizeof(*sh)); - + if (ms > 0) { sh->samples = (handle->samplerate / 1000) * ms; } else { @@ -151,7 +151,7 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const if (handle->params) { if ((tmp = switch_event_get_header(handle->params, "loops"))) { loops = atoi(tmp); - switch_buffer_set_loops(audio_buffer, loops); + switch_buffer_set_loops(audio_buffer, loops); } } diff --git a/src/mod/formats/mod_vlc/mod_vlc.c b/src/mod/formats/mod_vlc/mod_vlc.c index 3cd8a2cebb..21abee61ed 100644 --- a/src/mod/formats/mod_vlc/mod_vlc.c +++ b/src/mod/formats/mod_vlc/mod_vlc.c @@ -41,7 +41,7 @@ * To playback a video file * play_video /tmp/test.mp4 * - * Notes: + * Notes: * * Audio Requires at least libvlc version 1.2 * Video Requires at least libvlc 2.0.2 @@ -182,7 +182,7 @@ void log_cb(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_ ret = switch_vasprintf(&ldata, fmt, args); if (ret == -1) return; - + if (end_of(ldata) == '\n') { switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, fslevel, "VLC: %s", ldata); } else { @@ -191,7 +191,7 @@ void log_cb(void *data, int level, const libvlc_log_t *ctx, const char *fmt, va_ switch_safe_free(ldata); } - + void yuyv_to_i420(uint8_t *pixels, void *out_buffer, int src_width, int src_height) @@ -254,7 +254,7 @@ static libvlc_media_t *get_list_media(vlc_video_context_t *vcontext) libvlc_media_list_t *ml = libvlc_media_subitems(vcontext->m); if (ml) { int i, count = libvlc_media_list_count(ml); - + for (i = 0; i < count; i++) { libvlc_media_t *media = libvlc_media_list_item_at_index(ml, i); if (media) return media; @@ -426,7 +426,7 @@ static void vlc_video_unlock_callback(void *data, void *id, void *const *p_pixel switch_assert(context->img); yuyv_to_i420(*p_pixels, context->img->img_data, context->width, context->height); - + switch_mutex_unlock(context->video_mutex); } @@ -440,7 +440,7 @@ static void vlc_video_channel_unlock_callback(void *data, void *id, void *const if (context->channel && !switch_channel_test_flag(context->channel, CF_VIDEO)) return; if (!context->img) context->img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, context->width, context->height, 0); switch_assert(context->img); - + yuyv_to_i420(*p_pixels, context->img->img_data, context->width, context->height); switch_mutex_unlock(context->video_mutex); @@ -541,13 +541,13 @@ static int vlc_imem_get_callback(void *data, const char *cookie, int64_t *dts, i vlc_file_context_t *context = (vlc_file_context_t *) data; //int samples = 0; int bytes = 0, bread = 0, blen = 0; - + if (context->playing == 0) return -1; switch_mutex_lock(context->audio_mutex); blen = switch_buffer_inuse(context->audio_buffer); - + if (!(bytes = blen)) { *size = 0; *output = NULL; @@ -566,7 +566,7 @@ static int vlc_imem_get_callback(void *data, const char *cookie, int64_t *dts, i bread = switch_buffer_read(context->audio_buffer, *output, bytes); switch_mutex_unlock(context->audio_mutex); - + *size = (size_t) bread; return 0; @@ -578,7 +578,7 @@ void vlc_imem_release_callback(void *data, const char *cookie, size_t size, void //free(unknown); } -static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image_t *img) +static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image_t *img) { switch_memory_pool_t *pool; char *imem_main, *imem_slave; @@ -623,7 +623,7 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image switch_mutex_init(&vcontext->video_mutex, SWITCH_MUTEX_NESTED, vcontext->pool); switch_thread_cond_create(&vcontext->cond, vcontext->pool); switch_thread_cond_create(&acontext->cond, acontext->pool); - + switch_core_timer_init(&vcontext->timer, "soft", 1, 1000, vcontext->pool); vcontext->timer.start -= 60000000; switch_core_timer_sync(&vcontext->timer); @@ -655,25 +655,25 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image "samplerate=%d:" "channels=%d:" "id=1:" - "caching=0", + "caching=0", vcontext->samplerate, vcontext->channels); - + vcontext->m = libvlc_media_new_location(acontext->vlc_handle, imem_main); - - libvlc_media_add_option_flag( vcontext->m, imem_slave, libvlc_media_option_trusted ); + + libvlc_media_add_option_flag( vcontext->m, imem_slave, libvlc_media_option_trusted ); if (vcontext->m == NULL) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for writing\n", acontext->path); return SWITCH_STATUS_FALSE; } - + vcontext->mp = libvlc_media_player_new_from_media(vcontext->m); vcontext->samples = 0; vcontext->pts = 0; - + acontext->vcontext = vcontext; - + return SWITCH_STATUS_SUCCESS; } @@ -719,7 +719,7 @@ static switch_status_t vlc_file_av_open(switch_file_handle_t *handle, const char vcontext->playing = 0; vcontext->err = 0; - + vcontext->mp = libvlc_media_player_new_from_media(vcontext->m); if (!handle->samplerate) { @@ -741,7 +741,7 @@ static switch_status_t vlc_file_av_open(switch_file_handle_t *handle, const char vcontext->channels = handle->channels; libvlc_audio_set_format(vcontext->mp, "S16N", vcontext->samplerate, handle->channels); - + m_event_manager = libvlc_media_event_manager(vcontext->m); libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext); @@ -806,8 +806,8 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p if (handle->mm.fps > 0.0f) { handle->mm.keyint = (int) 2.0f * handle->mm.fps; } - - path = switch_core_sprintf(context->pool, + + path = switch_core_sprintf(context->pool, "#transcode{" "venc=x264{keyint=%d}," "vcodec=h264," @@ -821,7 +821,7 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p "access=avio," "mux=flv," "dst=rtmp://%s" - "}", + "}", handle->mm.keyint, handle->mm.ab, handle->mm.vb, handle->mm.channels, handle->mm.samplerate, path); } @@ -829,7 +829,7 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p context->path = switch_core_strdup(context->pool, path); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC attempt to open %s %s %s %s\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC attempt to open %s %s %s %s\n", context->path, switch_test_flag(handle, SWITCH_FILE_FLAG_READ) ? "read" : "", switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE) ? "write" : "", switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) ? "video" : "" @@ -893,13 +893,13 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p context->channels = handle->channels; libvlc_audio_set_format(context->mp, "S16N", context->samplerate, handle->channels); - + m_event_manager = libvlc_media_event_manager(context->m); libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_state_callback, (void *) context); mp_event_manager = libvlc_media_player_event_manager(context->mp); libvlc_event_attach(mp_event_manager, libvlc_MediaPlayerEncounteredError, vlc_mediaplayer_error_callback, (void *) context); - + libvlc_audio_set_callbacks(context->mp, vlc_auto_play_callback, NULL,NULL,NULL,NULL, (void *) context); libvlc_media_player_play(context->mp); @@ -910,10 +910,10 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p switch_core_sprintf(context->pool, "--sout=%s", path) }; int opts_count = 2; - + if ( !handle->samplerate) handle->samplerate = 16000; - + context->samplerate = handle->samplerate; context->channels = handle->channels; @@ -944,14 +944,14 @@ static switch_status_t vlc_file_open(switch_file_handle_t *handle, const char *p } if (!is_stream && switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { - if (switch_file_open(&fd, realpath, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE | SWITCH_FOPEN_TRUNCATE, + if (switch_file_open(&fd, realpath, SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE | SWITCH_FOPEN_TRUNCATE, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) == SWITCH_STATUS_SUCCESS) { switch_file_close(fd); } else { return SWITCH_STATUS_GENERR; } } - + return SWITCH_STATUS_SUCCESS; } @@ -979,19 +979,19 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data } status = libvlc_media_get_state(vcontext->m); - + if (status == libvlc_Error) { vcontext->err = acontext->err = 1; return SWITCH_STATUS_GENERR; } - + while (!vcontext->err && vcontext->playing == 0) { libvlc_media_t *newmedia; - switch_mutex_lock(acontext->cond_mutex); - switch_thread_cond_wait(acontext->cond, acontext->cond_mutex); - switch_mutex_unlock(acontext->cond_mutex); + switch_mutex_lock(acontext->cond_mutex); + switch_thread_cond_wait(acontext->cond, acontext->cond_mutex); + switch_mutex_unlock(acontext->cond_mutex); //switch_yield(50000); @@ -1000,16 +1000,16 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data if (status == 6) { int done = 1; newmedia = get_list_media(vcontext); - + if (newmedia) { libvlc_event_manager_t *m_event_manager; - + libvlc_media_player_set_media(vcontext->mp, newmedia); libvlc_media_release(vcontext->m); vcontext->m = newmedia; - + m_event_manager = libvlc_media_event_manager(vcontext->m); - libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext); + libvlc_event_attach(m_event_manager, libvlc_MediaStateChanged, vlc_media_av_state_callback, (void *) acontext); if (libvlc_media_player_play(vcontext->mp) != -1) { done = 0; @@ -1040,7 +1040,7 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data switch_mutex_lock(vcontext->audio_mutex); read = switch_buffer_read(vcontext->audio_buffer, data, bytes); switch_mutex_unlock(vcontext->audio_mutex); - + status = libvlc_media_get_state(vcontext->m); if (!read && (status == libvlc_Stopped || status == libvlc_Ended || status == libvlc_Error)) { @@ -1078,27 +1078,27 @@ static switch_status_t vlc_file_read(switch_file_handle_t *handle, void *data, s } status = libvlc_media_get_state(context->m); - + if (status == libvlc_Error) { return SWITCH_STATUS_GENERR; } - switch_mutex_lock(context->cond_mutex); + switch_mutex_lock(context->cond_mutex); while (context->playing == 0 && status != libvlc_Ended && status != libvlc_Error) { - switch_thread_cond_wait(context->cond, context->cond_mutex); + switch_thread_cond_wait(context->cond, context->cond_mutex); status = libvlc_media_get_state(context->m); } - switch_mutex_lock(context->cond_mutex); + switch_mutex_lock(context->cond_mutex); if (context->err == 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error\n"); return SWITCH_STATUS_FALSE; } - switch_mutex_lock(context->audio_mutex); + switch_mutex_lock(context->audio_mutex); read = switch_buffer_read(context->audio_buffer, data, bytes); switch_mutex_unlock(context->audio_mutex); - + status = libvlc_media_get_state(context->m); if (!read && (status == libvlc_Stopped || status == libvlc_Ended || status == libvlc_Error)) { @@ -1131,7 +1131,7 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_ if (vcontext->err) { return SWITCH_STATUS_FALSE; } - + if ((flags & SVR_CHECK)) { return SWITCH_STATUS_BREAK; } @@ -1146,7 +1146,7 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_ if (vcontext->err) { return SWITCH_STATUS_FALSE; } - + if ((flags & SVR_BLOCK)) { status = switch_queue_pop(vcontext->video_queue, &pop); } else { @@ -1196,7 +1196,7 @@ static switch_status_t vlc_file_write_video(switch_file_handle_t *handle, switch if (frame->img) { switch_image_t *img_copy = NULL; vlc_frame_data_t *fdata = NULL; - + switch_img_copy(frame->img, &img_copy); switch_zmalloc(fdata, sizeof(*fdata)); @@ -1226,7 +1226,7 @@ static switch_status_t vlc_file_av_write(switch_file_handle_t *handle, void *dat if (!vcontext) { return SWITCH_STATUS_SUCCESS; - } + } if (!vcontext->vid_ready) { return SWITCH_STATUS_SUCCESS; @@ -1249,7 +1249,7 @@ static switch_status_t vlc_file_av_write(switch_file_handle_t *handle, void *dat if (!vcontext->playing) { - vcontext->playing = 1; + vcontext->playing = 1; libvlc_media_player_play(vcontext->mp); } @@ -1268,10 +1268,10 @@ static switch_status_t vlc_file_write(switch_file_handle_t *handle, void *data, switch_mutex_lock(context->audio_mutex); context->samples += *len; switch_buffer_write(context->audio_buffer, data, bytes); - switch_mutex_unlock(context->audio_mutex); + switch_mutex_unlock(context->audio_mutex); if (!context->playing) { - context->playing = 1; + context->playing = 1; libvlc_media_player_play(context->mp); } @@ -1288,13 +1288,13 @@ static switch_status_t vlc_file_av_close(switch_file_handle_t *handle) return SWITCH_STATUS_FALSE; } } - + vcontext->ending = 1; if (vcontext && vcontext->video_queue) { switch_queue_push(vcontext->video_queue, NULL); } - + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE) && switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { if (vcontext->cond && switch_mutex_trylock(vcontext->cond_mutex) == SWITCH_STATUS_SUCCESS) { @@ -1309,7 +1309,7 @@ static switch_status_t vlc_file_av_close(switch_file_handle_t *handle) while((vcontext->audio_buffer && switch_buffer_inuse(vcontext->audio_buffer)) || switch_queue_size(vcontext->video_queue)) { libvlc_state_t status = libvlc_media_get_state(vcontext->m); - + if (status == libvlc_Ended || status == libvlc_Error || status == libvlc_Stopped ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "VLC done. status = %d\n", status); break; @@ -1346,9 +1346,9 @@ static switch_status_t vlc_file_command(switch_file_handle_t *handle, switch_fil switch(command) { case SCFC_FLUSH_AUDIO: - switch_mutex_lock(context->audio_mutex); + switch_mutex_lock(context->audio_mutex); switch_buffer_zero(context->audio_buffer); - switch_mutex_unlock(context->audio_mutex); + switch_mutex_unlock(context->audio_mutex); break; default: break; @@ -1366,7 +1366,7 @@ static switch_status_t vlc_file_close(switch_file_handle_t *handle) if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) { return vlc_file_av_close(handle); } - + context->playing = 0; libvlc_media_player_stop(context->mp); @@ -1378,7 +1378,7 @@ static switch_status_t vlc_file_close(switch_file_handle_t *handle) switch_mutex_unlock(context->audio_mutex); if (context->m) libvlc_media_release(context->m); - + if (context->vlc_handle) libvlc_release(context->vlc_handle); return SWITCH_STATUS_SUCCESS; @@ -1590,7 +1590,7 @@ SWITCH_STANDARD_APP(play_video_function) if( context->mp ) libvlc_media_player_stop(context->mp); if( context->m ) libvlc_media_release(context->m); - + context->playing = 0; switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "OK"); @@ -1623,30 +1623,30 @@ int vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t * int r = 0; if (!context->ending) { - switch_mutex_lock(context->cond_mutex); + switch_mutex_lock(context->cond_mutex); //while (!switch_queue_size(context->video_queue)) { // switch_yield(20000); //} //if (!switch_queue_size(context->video_queue)) { - // switch_thread_cond_wait(context->cond, context->cond_mutex); + // switch_thread_cond_wait(context->cond, context->cond_mutex); //} - switch_mutex_unlock(context->cond_mutex); + switch_mutex_unlock(context->cond_mutex); } - + if (*cookie == 'v') { switch_image_t *img = NULL; vlc_frame_data_t *fdata = NULL; void *pop; - + if (switch_queue_trypop(context->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { img = (switch_image_t *) pop; } else { goto nada; } - + fdata = (vlc_frame_data_t *) img->user_priv; - + *dts = *pts = fdata->pts; *size = img->d_w * img->d_h * 2; @@ -1657,7 +1657,7 @@ int vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t * context->video_frame_buffer_len = *size; context->video_frame_buffer = switch_core_alloc(context->pool, context->video_frame_buffer_len); } - + *output = context->video_frame_buffer; switch_img_to_raw(img, *output, 0, SWITCH_IMG_FMT_YUY2); switch_img_free(&img); @@ -1667,12 +1667,12 @@ int vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t * switch_mutex_lock(context->audio_mutex); if (context->sync_offset < 0 && !context->sync_ready) { uint32_t need = (context->samplerate / 1000) * abs(context->sync_offset / 1000) * context->channels * 2; - + if (context->audio_frame_buffer_len < need) { context->audio_frame_buffer_len = need; context->audio_frame_buffer = switch_core_alloc(context->pool, context->audio_frame_buffer_len); } - + memset(context->audio_frame_buffer, 0, need); *pts = *dts = context->pts; *size = need; @@ -1682,7 +1682,7 @@ int vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t * switch_mutex_unlock(context->audio_mutex); return 0; } - + if ((blen = switch_buffer_inuse(context->audio_buffer))) { uint32_t read_bytes = 0; int64_t lpts; @@ -1751,7 +1751,7 @@ int vlc_write_video_imem_get_callback(void *data, const char *cookie, int64_t * void vlc_write_video_imem_release_callback(void *data, const char *cookie, size_t size, void *unknown) { - + } static switch_status_t video_read_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data) @@ -1768,7 +1768,7 @@ static switch_status_t video_read_callback(switch_core_session_t *session, switc switch_core_timer_sync(&context->timer); fdata->pts = context->timer.samplecount; switch_mutex_unlock(context->audio_mutex); - + img_copy->user_priv = (void *) fdata; switch_queue_push(context->video_queue, img_copy); @@ -1847,7 +1847,7 @@ SWITCH_STANDARD_APP(capture_video_function) switch_core_timer_init(&context->timer, "soft", 1, 1000, context->pool); - switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ); + switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ); switch_core_media_get_vid_params(session, &vid_params); switch_channel_set_flag(channel, CF_VIDEO_ECHO); switch_core_session_raw_read(session); @@ -1878,19 +1878,19 @@ SWITCH_STANDARD_APP(capture_video_function) "samplerate=%d:" "channels=%d:" "id=1:" - "caching=0", + "caching=0", context->samplerate, context->channels); - + context->m = libvlc_media_new_location(vlc_handle, imem_main); - - libvlc_media_add_option_flag( context->m, imem_slave, libvlc_media_option_trusted ); + + libvlc_media_add_option_flag( context->m, imem_slave, libvlc_media_option_trusted ); if ( context->m == NULL ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VLC error opening %s for writing\n", data); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return ; } - + context->mp = libvlc_media_player_new_from_media(context->m); context->samples = 0; @@ -1904,7 +1904,7 @@ SWITCH_STANDARD_APP(capture_video_function) switch_channel_audio_sync(channel); - + if (offset) { context->sync_offset = offset * 1000; } @@ -1916,7 +1916,7 @@ SWITCH_STANDARD_APP(capture_video_function) if (!SWITCH_READ_ACCEPTABLE(status)) { break; } - + if (switch_test_flag(read_frame, SFF_CNG)) { audio_data = audio_data_buf; audio_datalen = read_impl.decoded_bytes_per_packet; @@ -1956,18 +1956,18 @@ SWITCH_STANDARD_APP(capture_video_function) break; } } - + vlc_status = libvlc_media_get_state(context->m); if (vlc_status == libvlc_Ended || vlc_status == libvlc_Error || vlc_status == libvlc_Stopped ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "VLC done. status = %d\n", vlc_status); break; - } + } } switch_core_session_set_video_read_callback(session, NULL, NULL); context->ending = 1; - + if (switch_mutex_trylock(context->cond_mutex) == SWITCH_STATUS_SUCCESS) { switch_thread_cond_signal(context->cond); switch_mutex_unlock(context->cond_mutex); @@ -2089,7 +2089,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co tech_pvt->audio_datalen = SWITCH_RECOMMENDED_BUFFER_SIZE; tech_pvt->audio_data = switch_core_session_alloc(session, tech_pvt->audio_datalen); - + if (osession) { switch_core_session_get_read_impl(osession, &tech_pvt->read_impl); } else { @@ -2102,7 +2102,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co if (val) tmp = atoi(val); if (tmp == 0) tmp = 20; tech_pvt->read_impl.microseconds_per_packet = tmp * 1000; - + tech_pvt->read_impl.iananame = "L16"; tmp = 0; @@ -2204,7 +2204,7 @@ static switch_status_t setup_tech_pvt(switch_core_session_t *osession, switch_co libvlc_audio_set_format(context->mp, "S16N", tech_pvt->read_impl.actual_samples_per_second, tech_pvt->read_impl.number_of_channels); libvlc_audio_set_callbacks(context->mp, vlc_play_audio_callback, NULL,NULL,NULL,NULL, (void *) context); - + libvlc_video_set_format_callbacks(context->mp, video_format_setup_callback, video_format_clean_callback); libvlc_video_set_callbacks(context->mp, vlc_video_lock_callback, vlc_video_channel_unlock_callback, vlc_video_display_callback, context); @@ -2280,7 +2280,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) void *pop; while (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { - switch_image_t *img = (switch_image_t *) pop; + switch_image_t *img = (switch_image_t *) pop; switch_img_free(&img); } } @@ -2503,7 +2503,7 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit switch_channel_t *channel; vlc_private_t *tech_pvt; void *pop; - + channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -2511,12 +2511,12 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit switch_assert(tech_pvt != NULL); switch_assert(tech_pvt->context); - + switch_img_free(&tech_pvt->read_video_frame.img); if (tech_pvt->context->video_queue) { while(switch_queue_size(tech_pvt->context->video_queue) > 1) { - if (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) { switch_image_t *img = (switch_image_t *) pop; switch_img_free(&img); } else { @@ -2524,9 +2524,9 @@ static switch_status_t vlc_read_video_frame(switch_core_session_t *session, swit } } if (switch_queue_pop(tech_pvt->context->video_queue, &pop) == SWITCH_STATUS_SUCCESS) { - switch_image_t *img = (switch_image_t *) pop; + switch_image_t *img = (switch_image_t *) pop; if (!img) return SWITCH_STATUS_FALSE; - + tech_pvt->read_video_frame.img = img; *frame = &tech_pvt->read_video_frame; switch_set_flag(*frame, SFF_RAW_RTP); @@ -2612,7 +2612,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vlc_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - + vlc_file_supported_formats[argc++] = "vlc"; vlc_file_supported_formats[argc++] = "mp4"; /* maybe add config for this mod to enable or disable these */ vlc_file_supported_formats[argc++] = "mov"; diff --git a/src/mod/formats/mod_webm/mod_webm.cpp b/src/mod/formats/mod_webm/mod_webm.cpp index da804eac24..e22072e841 100644 --- a/src/mod/formats/mod_webm/mod_webm.cpp +++ b/src/mod/formats/mod_webm/mod_webm.cpp @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2015, Anthony Minessale II * @@ -309,7 +309,7 @@ static switch_status_t webm_file_write(switch_file_handle_t *handle, void *data, buf, &size, &encoded_rate, NULL); } - + if (size > 0) { // timecode still need to figure out for sync @@ -391,7 +391,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%02x %02x %02x | len:%d m:%d st:%d i:%d\n", hdr[0], hdr[1], hdr[2], datalen, frame->m, start_bit, is_iframe); - + if (!context->video) { context->video_track_id = context->segment->AddVideoTrack(frame->img->d_w, frame->img->d_h, 0); @@ -411,7 +411,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame const void *data; int duration = 0; - + switch_buffer_peek_zerocopy(context->buf, &data); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VID samplecount: %u\n", context->timer.samplecount); @@ -430,7 +430,7 @@ static switch_status_t do_write_video(switch_file_handle_t *handle, switch_frame } end: - + return status; } diff --git a/src/mod/languages/mod_basic/mod_basic.c b/src/mod/languages/mod_basic/mod_basic.c index 90926ef535..1ef1bf3bc1 100644 --- a/src/mod/languages/mod_basic/mod_basic.c +++ b/src/mod/languages/mod_basic/mod_basic.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2012, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * @@ -37,7 +37,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_basic_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_basic_runtime); SWITCH_MODULE_LOAD_FUNCTION(mod_basic_load); -/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) * Defines a switch_loadable_module_function_table_t and a static const char[] modname */ SWITCH_MODULE_DEFINITION(mod_basic, mod_basic_load, mod_basic_shutdown, NULL); @@ -58,7 +58,7 @@ static switch_status_t do_config(switch_bool_t reload) static void _on_error(mb_interpreter_t* s, mb_error_e e, char* m, int p, unsigned short row, unsigned short col, int abort_code) { mb_unrefvar(s); if(SE_NO_ERR != e) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error:\n [POS] %d, [ROW] %d, [COL] %d,\n [CODE] %d, [MESSAGE] %s, [ABORT CODE] %d\n", p, row, col, e, m, abort_code); } } @@ -71,7 +71,7 @@ typedef struct fs_data { } fs_data_t; -static int fun_execute(mb_interpreter_t* s, void** l) +static int fun_execute(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -104,10 +104,10 @@ static int fun_execute(mb_interpreter_t* s, void** l) end: return result; -} +} -static int fun_setvar(mb_interpreter_t* s, void** l) +static int fun_setvar(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -139,9 +139,9 @@ static int fun_setvar(mb_interpreter_t* s, void** l) end: return result; -} +} -static int fun_getarg(mb_interpreter_t* s, void** l) +static int fun_getarg(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -171,7 +171,7 @@ static int fun_getarg(mb_interpreter_t* s, void** l) return result; } -static int fun_getvar(mb_interpreter_t* s, void** l) +static int fun_getvar(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -188,7 +188,7 @@ static int fun_getvar(mb_interpreter_t* s, void** l) if (var.type == MB_DT_STRING && fsdata->session) { switch_channel_t *channel = switch_core_session_get_channel(fsdata->session); const char *value = switch_channel_get_variable(channel, var.value.string); - + mb_push_string(s, l, strdup(value)); } else { @@ -201,9 +201,9 @@ static int fun_getvar(mb_interpreter_t* s, void** l) end: return result; -} +} -static int fun_api(mb_interpreter_t* s, void** l) +static int fun_api(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -238,10 +238,10 @@ static int fun_api(mb_interpreter_t* s, void** l) end: return result; -} +} -static int fun_log(mb_interpreter_t* s, void** l) +static int fun_log(mb_interpreter_t* s, void** l) { int result = MB_FUNC_OK; fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); @@ -262,7 +262,7 @@ static int fun_log(mb_interpreter_t* s, void** l) if (level.type == MB_DT_STRING && data.type == MB_DT_STRING) { switch_log_level_t fslevel = SWITCH_LOG_DEBUG; - + fslevel = switch_log_str2level(level.value.string); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fsdata->session), fslevel, "%s\n", data.value.string); } else { @@ -274,25 +274,25 @@ static int fun_log(mb_interpreter_t* s, void** l) end: return result; -} +} -static int bprint(const char *fmt, ...) +static int bprint(const char *fmt, ...) { char *data = NULL; va_list ap; int ret = 0; - + va_start(ap, fmt); ret = switch_vasprintf(&data, fmt, ap); va_end(ap); - + if (data) { switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s\n", data); } - switch_safe_free(data); - + switch_safe_free(data); + return ret; } @@ -329,7 +329,7 @@ SWITCH_STANDARD_APP(basic_function) } mb_open(&bi); - mb_set_error_handler(bi, _on_error); + mb_set_error_handler(bi, _on_error); mb_set_printer(bi, bprint); fsdata.session = session; mb_set_user_data(bi, (void *) &fsdata); @@ -340,7 +340,7 @@ SWITCH_STANDARD_APP(basic_function) mb_register_func(bi, "FS_SETVAR", fun_setvar); mb_register_func(bi, "FS_API", fun_api); mb_register_func(bi, "FS_LOG", fun_log); - + if (mb_load_file(bi, file) == MB_FUNC_OK) { mb_run(bi); } else { @@ -358,7 +358,7 @@ SWITCH_STANDARD_API(basic_api_function) { basic_function(session, cmd); - + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/languages/mod_basic/my_basic.h b/src/mod/languages/mod_basic/my_basic.h index 0ce58587c4..91e87de02b 100644 --- a/src/mod/languages/mod_basic/my_basic.h +++ b/src/mod/languages/mod_basic/my_basic.h @@ -233,7 +233,7 @@ MBAPI int mb_gets(char* buf, int s); MBAPI void mb_set_user_data(mb_interpreter_t* s, void *ptr); MBAPI void *mb_get_user_data(mb_interpreter_t* s); - + #ifdef MB_COMPACT_MODE # pragma pack() #endif /* MB_COMPACT_MODE */ diff --git a/src/mod/languages/mod_java/modjava.c b/src/mod/languages/mod_java/modjava.c index 7068720eb5..3290d49c57 100644 --- a/src/mod/languages/mod_java/modjava.c +++ b/src/mod/languages/mod_java/modjava.c @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2007, Damjan Jovanovic * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Damjan Jovanovic * * @@ -299,7 +299,7 @@ static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm char *derr = NULL; pJNI_CreateJavaVM = (jint (*)(JavaVM **, void **, void *))switch_dso_func_sym(javaVMHandle, "JNI_CreateJavaVM", &derr); - + if (!derr) { JNIEnv *env; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index cc5705f90c..43d00865cf 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -29,7 +29,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup); void Session::destroy(const char *err) { - + if (!allocated) { return; } @@ -157,7 +157,7 @@ void Session::do_hangup_hook() docall(L, arg_count, 1, 1, 0); const char *err = lua_tostring(L, -1); - + switch_channel_set_variable(channel, "lua_hangup_hook_return_val", err); if (!zstr(err)) { @@ -200,7 +200,7 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup) coresession = (Session *) vs; } } - + if (!(coresession && coresession->hook_state)) { return SWITCH_STATUS_FALSE; } @@ -356,15 +356,15 @@ Dbh::Dbh(char *dsn, char *user, char *pass) dbh = NULL; err = NULL; char *tmp = NULL; - + if (!zstr(user) || !zstr(pass)) { - tmp = switch_mprintf("%s%s%s%s%s", dsn, + tmp = switch_mprintf("%s%s%s%s%s", dsn, zstr(user) ? "" : ":", zstr(user) ? "" : user, zstr(pass) ? "" : ":", zstr(pass) ? "" : pass ); - + dsn = tmp; } @@ -375,7 +375,7 @@ Dbh::Dbh(char *dsn, char *user, char *pass) } switch_safe_free(tmp); - + } Dbh::~Dbh() @@ -449,11 +449,11 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) ret = lua_tonumber(lua_fun->L, -1); lua_pop(lua_fun->L, 1); - + if (ret != 0) { return 1; } - + return 0; /* 0 to continue with next row */ } diff --git a/src/mod/languages/mod_lua/lua/lgc.c b/src/mod/languages/mod_lua/lua/lgc.c index 535e988ae0..af001682c4 100644 --- a/src/mod/languages/mod_lua/lua/lgc.c +++ b/src/mod/languages/mod_lua/lua/lgc.c @@ -1053,7 +1053,7 @@ static lu_mem singlestep (lua_State *L) { g->gcstate = GCSatomic; /* finish mark phase */ g->GCestimate = g->GCmemtrav; /* save what was counted */; work = atomic(L); /* add what was traversed by 'atomic' */ - g->GCestimate += work; /* estimate of total memory traversed */ + g->GCestimate += work; /* estimate of total memory traversed */ sw = entersweep(L); return work + sw * GCSWEEPCOST; } diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 8eb68c5a2d..b28d16f715 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -1,4 +1,4 @@ -/* +/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2014, Anthony Minessale II * @@ -22,7 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * * mod_lua.c -- Lua @@ -102,7 +102,7 @@ int docall(lua_State * L, int narg, int nresults, int perror, int fatal) if (!zstr(err)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err); } - + // pass error up to top if (fatal) { lua_error(L); @@ -143,7 +143,7 @@ static int lua_parse_and_execute(lua_State * L, char *input_code, switch_core_se } while(input_code && (*input_code == ' ' || *input_code == '\n' || *input_code == '\r')) input_code++; - + if (*input_code == '~') { char *buff = input_code + 1; error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0, 1); //lua_pcall(L, 0, 0, 0); @@ -274,12 +274,12 @@ static switch_xml_t lua_fetch(const char *section, lua_getglobal(L, "XML_STRING"); str = lua_tostring(L, -1); - + if (str) { if (zstr(str)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n"); - } else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) { - /* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str + } else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) { + /* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str and saves this duplcate as root->m which is freed when switch_xml_free is issued */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n"); @@ -308,7 +308,7 @@ static switch_status_t do_config(void) switch_xml_t cfg, xml, settings, param, hook; switch_stream_handle_t path_stream = {0}; switch_stream_handle_t cpath_stream = {0}; - + if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf); return SWITCH_STATUS_TERM; @@ -423,7 +423,7 @@ static switch_status_t do_config(void) } switch_safe_free(path_stream.data); - + switch_xml_free(xml); return SWITCH_STATUS_SUCCESS; @@ -689,7 +689,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load) SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "