FS-9924: Removed extra space in source files

This commit is contained in:
Sergey Safarov 2017-01-06 02:10:15 -05:00
parent 60d4e87487
commit df1ab07ca4
455 changed files with 9699 additions and 9698 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Mathieu Rene <mrene@avgs.ca>
*
* 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();

View File

@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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;
};

View File

@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* 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/)

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Eliot Gable <egable@gmail.com>
*
@ -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 <EM>pool</EM> 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:
* <PRE>
* 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
* </PRE>
* @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
* <PRE>
* 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
* <PRE>
* 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:
* <PRE>
* 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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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,

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,14 +22,14 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
* 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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,14 +22,14 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
* 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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,14 +22,14 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
* 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.
* <pre>
*
* EXAMPLE
*
* EXAMPLE
*
* [category1]
* var1 => val1
* var2 => val2

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Michael Jerris <mike@jerris.com>
*
@ -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.
*/

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_core_event_hook.h Core Event Hooks

View File

@ -1,5 +1,5 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -23,7 +23,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* 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, ...);

View File

@ -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);

View File

@ -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
*/

View File

@ -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

View File

@ -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.
*
*/

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Dragos Oancea <droancea@yahoo.com>
*
* switch_estimators.h -- Estimators for Packet Loss, Jitter, RTT , etc
@ -32,8 +32,8 @@
#ifndef SWITCH_ESTIMATORS_H
#define SWITCH_ESTIMATORS_H
#include <switch.h>
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*

View File

@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter AT 0xdecafbad dot com>
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_jitterbuffer.h -- Audio/Video Jitter Buffer

View File

@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,14 +22,14 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Rupa Schomaker <rupa@rupa.com>
*
* 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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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 {

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Luke Dashjr <luke@openmethods.com> (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;

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Brian K. West <brian@freeswitch.org>
*
@ -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,

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* switch_odbc.h -- ODBC

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Eliot Gable <egable@gmail.com>
*
@ -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.

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* 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 <windows.h>
/*
/*
* 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

View File

@ -2,23 +2,23 @@
* Copyright (c) 2009, Sangoma Technologies
* Moises Silva <moy@sangoma.com>
* 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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Michael Jerris <mike@jerris.com>
*
* 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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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 {

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -30,10 +30,10 @@
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
*
*/
/**
/**
* @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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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,

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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 */

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Bret McDanel <trixter AT 0xdecafbad dot com>
* Joseph Sullivan <jossulli@amazon.com>
@ -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
</pre>
*/
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 {
<pre>
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
</pre>
*/
@ -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
</pre>
*/
@ -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;

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
*
@ -42,7 +42,7 @@
#include <switch.h>
#include <math.h>
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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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.

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Mathieu Rene <mathieu.rene@gmail.com>
*
*
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Marc Olivier Chouinard <mochouinard@moctel.com>
*
*
@ -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);
}

View File

@ -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);

View File

@ -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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* Contributor(s):
*
* Piotr Gregor <piotrgregor@rsyncme.org>

View File

@ -1,4 +1,4 @@
/*
/*
* Contributor(s):
*
* Eric des Courtis <eric.des.courtis@benbria.com>
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* Contributor(s):
*
* Eric des Courtis <eric.des.courtis@benbria.com>

View File

@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
*
@ -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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Mathieu Rene <mrene@avgs.ca>
* Raymond Chandler <intralanman@freeswitch.org>
*
@ -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;

View File

@ -36,4 +36,4 @@
<!-- <tier agent="1000@default" queue="support@default" level="1" position="1"/> -->
</tiers>
</configuration>
</configuration>

View File

@ -17,12 +17,12 @@
<!-- comment out sql to not setup a database (directory) lookup -->
<param name="sql" value="
SELECT name||' ('||type||')' AS name
SELECT name||' ('||type||')' AS name
FROM phonebook p JOIN numbers n ON p.id = n.phonebook_id
WHERE n.number='${caller_id_number}'
WHERE n.number='${caller_id_number}'
LIMIT 1
"/>
<!-- comment out citystate-sql to not setup a database (city/state)
<!-- comment out citystate-sql to not setup a database (city/state)
lookup -->
<param name="citystate-sql" value="
SELECT ratecenter||' '||state as name

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Rupa Schomaker <rupa@rupa.com>
*
* mod_cidlookup.c -- API for querying cid->name services and local data
@ -39,7 +39,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_cidlookup_runtime);
SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_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_cidlookup, mod_cidlookup_load, mod_cidlookup_shutdown, NULL);
@ -90,7 +90,7 @@ static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
{
switch_cache_db_handle_t *dbh = NULL;
char *dsn;
if (!zstr(globals.odbc_dsn)) {
dsn = globals.odbc_dsn;
} else {
@ -100,7 +100,7 @@ static switch_cache_db_handle_t *cidlookup_get_db_handle(void)
if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) {
dbh = NULL;
}
return dbh;
}
@ -383,7 +383,7 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
/*
TIMEOUT_MS is introduced in 7.16.2, we have 7.16.0 in tree
TIMEOUT_MS is introduced in 7.16.2, we have 7.16.0 in tree
*/
#ifdef CURLOPT_TIMEOUT_MS
if (timeout > 0) {
@ -452,12 +452,12 @@ static cid_data_t *do_whitepages_lookup(switch_memory_pool_t *pool, switch_event
query = switch_event_expand_headers(event, "http://api.whitepages.com/reverse_phone/1.0/?phone=${whitepages-cid};api_key=${whitepages-api-key}");
do_lookup_url(pool, event, &xml_s, query, NULL, NULL, 0);
if (zstr(xml_s)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No XML returned for number %s\n", num);
goto done;
}
xml = switch_xml_parse_str_dup(xml_s);
if (!xml) {
@ -706,7 +706,7 @@ SWITCH_STANDARD_APP(cidlookup_app_function)
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_partner_uuid(channel);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
if (uuid) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
*
@ -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
*========================================

View File

@ -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
*========================================

View File

@ -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:

View File

@ -1,4 +1,4 @@
<!-- http://wiki.freeswitch.org/wiki/Mod_conference -->
<!-- http://wiki.freeswitch.org/wiki/Mod_conference -->
<!-- None of these paths are real if you want any of these options you need to really set them up -->
<configuration name="conference.conf" description="Audio Conference">
<!-- Advertise certain presence on startup . -->
@ -6,8 +6,8 @@
<room name="3001@$${domain}" status="FreeSWITCH"/>
</advertise>
<!-- These are the default keys that map when you do not specify a caller control group -->
<!-- Note: none and default are reserved names for group names. Disabled if dist-dtmf member flag is set. -->
<!-- These are the default keys that map when you do not specify a caller control group -->
<!-- Note: none and default are reserved names for group names. Disabled if dist-dtmf member flag is set. -->
<caller-controls>
<group name="default">
<control action="mute" digits="0"/>
@ -29,19 +29,19 @@
<profiles>
<!--If no profile is specified it will default to "default"-->
<profile name="default">
<!-- Directory to drop CDR's
<!-- Directory to drop CDR's
'auto' means $PREFIX/logs/conference_cdr/<confernece_uuid>.cdr.xml
a non-absolute path means $PREFIX/logs/<value>/<confernece_uuid>.cdr.xml
absolute path means <value>/<confernece_uuid>.cdr.xml
-->
<!-- <param name="cdr-log-dir" value="auto"/> -->
<!-- How to create a CDR event
<!-- How to create a CDR event
'content' means event body will contain CDR as XML
'file' means 'CDR-Path' header will contain a path to file created in 'cdr-log-dir'
'none' for no event
-->
<!-- <param name="cdr-event-mode" value="content"/> -->
<!-- Domain (for presence) -->
<param name="domain" value="$${domain}"/>
<!-- Sample Rate-->

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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) {

View File

@ -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];

View File

@ -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);
}

View File

@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Rupa Schomaker <rupa@rupa.com>
* Yossi Neiman <mishehu@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
@ -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: <data=\"%s\">\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;
}

View File

@ -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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Ken Rice <krice@freeswitch.org>
* Mathieu Rene <mathieu.rene@gmail.com>
@ -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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Marc Olivier Chouinard <mochouinard at moctel dot com>
* Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
*
@ -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;
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<include>
<include>
<extension name="test gateway distro">
<condition field="destination_number" expression="^(.*)$">
<action application="bridge" data="sofia/gateway/${distributor(test)}/$1"/>

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
*
@ -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) {

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Ken Rice <krice@freeswitch.org>
* Michael Murdock <mike at mmurdock dot org>
@ -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, "<varname>|<data>|<regex>", 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, "<info>", 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, "<jitterbuffer_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
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] <path>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", 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,
"<min> <max> <file> <var_name> <timeout> <terminators> <digit_timeout>", 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<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>] ['<failure_ext> [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, "<path>", SAF_NONE);

View File

@ -7,7 +7,7 @@
<!-- Default Technology and profile -->
<param name="default-techprofile" value="sofia/default"/>
<!-- IP or Hostname of Default Route -->
<param name="default-gateway" value="192.168.66.6"/>
@ -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 -->
<!-- <param name="custom-query" value="call FS_GET_SIP_LOCATION(%s);"/> -->
</settings>

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Jay Binks <jaybinks@gmail.com>
*
@ -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; inameserver<ENUM_MAXNAMESERVERS; inameserver++) {
if ( server_name[inameserver] != NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding Nameserver [%s]\n", server_name[inameserver]);
@ -488,9 +488,9 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
ldns_rdf_deep_free(serv_rdf);
added_server = 1;
}
}
}
}
}
}
if (!added_server) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Nameservers specified, using host default\n");
/* create a new resolver from /etc/resolv.conf */
@ -520,7 +520,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
if ((naptr = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NAPTR, LDNS_SECTION_ANSWER))) {
size_t i;
ldns_rr_list_sort(naptr);
ldns_rr_list_sort(naptr);
for (i = 0; i < ldns_rr_list_rr_count(naptr); i++) {
parse_naptr(ldns_rr_list_rr(naptr, i), number, results);
@ -535,7 +535,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
end:
switch_safe_free(name);
if (domain) {
ldns_rdf_deep_free(domain);
}
@ -556,7 +556,7 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
char *mnum = NULL, *mroot = NULL, *p;
char *server[ENUM_MAXNAMESERVERS];
int inameserver = 0;
int inameserver = 0;
char *argv[ ENUM_MAXNAMESERVERS ] = { 0 };
int argc;
int x = 0;
@ -580,12 +580,12 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
/* Empty the server array */
for(inameserver=0; inameserver<ENUM_MAXNAMESERVERS; inameserver++) {
server[inameserver] = NULL;
}
}
inameserver = 0;
/* check for enum_nameserver channel var */
if (channel) {
enum_nameserver = switch_channel_get_variable(channel, "enum_nameserver");
}
@ -691,7 +691,7 @@ SWITCH_STANDARD_APP(enum_app_function)
root = argv[1];
if (enum_lookup(root, dest, &results, channel, session) == SWITCH_STATUS_SUCCESS) {
switch_event_t *vars;
if (switch_channel_get_variables(channel, &vars) == SWITCH_STATUS_SUCCESS) {
switch_event_header_t *hi;
for (hi = vars->headers; 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;
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
*
@ -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);
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Marc Olivier Chouinard <mochouinard@moctel.com>
*
*
@ -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';

View File

@ -2,7 +2,7 @@
*
* Written by:
* Hongli Lai <hongli@telekabel.nl>
* tkorrovi <tkorrovi@altavista.net> on 2002/02/26.
* tkorrovi <tkorrovi@altavista.net> on 2002/02/26.
* Andrew Westcott <ajwestco@users.sourceforge.net>
*
* Offered for use in the public domain without any warranty.

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_expr.c -- Framework Demo Module

View File

@ -1,4 +1,4 @@
<!--
<!--
Parking extensions... transferring calls to 5900 will park them in a queue.
-->
<extension name="park">
@ -8,7 +8,7 @@
</condition>
</extension>
<!--
<!--
Parking pickup extension. Calling 5901 will pickup the call.
-->
<extension name="unpark">

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* 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;
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_fsk -- FSK data transfer

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* 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);
}
}
}

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
*
@ -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);

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Ken Rice <krice at suspicious dot org
* Mathieu Rene <mathieu.rene@gmail.com>
@ -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 [<realm>]"
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]/<realm>/<key>/<value>");
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);

View File

@ -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));

View File

@ -32,7 +32,7 @@
#include <mod_hiredis.h>
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;

View File

@ -457,7 +457,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hiredis_shutdown)
}
switch_core_hash_destroy(&(mod_hiredis_globals.profiles));
return SWITCH_STATUS_SUCCESS;
}

View File

@ -29,20 +29,20 @@
<permission name="set-vars" value="false">
<!-- default to "deny" or "allow" -->
<!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
<!--
<!--
<variable-list default="deny">
<variable name="caller_id_name"/>
<variable name="hangup"/>
<variable name="hangup"/>
</variable-list>
-->
</permission>
<permission name="get-vars" value="false">
<!-- default to "deny" or "allow" -->
<!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
<!--
<!--
<variable-list default="deny">
<variable name="caller_id_name"/>
<variable name="hangup"/>
<variable name="hangup"/>
</variable-list>
-->
</permission>
@ -58,15 +58,15 @@
<permission name="expand-vars" value="false">
<!-- default to "deny" or "allow" -->
<!-- type attr can be "deny" or "allow" nothing defaults to opposite of the list default so allow in this case -->
<!--
<!--
<variable-list default="deny">
<variable name="caller_id_name"/>
<variable name="hangup"/>
<variable name="hangup"/>
</variable-list>
<api-list default="deny">
<api name="expr"/>
<api name="lua"/>
<api name="lua"/>
</api-list>
-->
</permission>
@ -79,11 +79,11 @@
<permission name="conference" value="true"/>
<permission name="conference-set-profile" value="false"/>
</permissions>
<params>
<!-- default url can be overridden by app data -->
<param name="gateway-url" value="http://www.freeswitch.org/api/index.cgi" />
<!-- set this to provide authentication credentials to the server -->
<!--<param name="gateway-credentials" value="muser:mypass"/>-->
<!--<param name="auth-scheme" value="basic"/>-->

View File

@ -1,4 +1,4 @@
/*
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Raymond Chandler <intralanman@freeswitch.org>
* Seven Du <dujinfang@gmail.com>
@ -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(&params, 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, &params))) {
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(&params);
}
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, "{<param1>=<val1>}", 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);

View File

@ -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);

View File

@ -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);

View File

@ -1,5 +1,5 @@
<include>
<X-PRE-PROCESS cmd="set" data="AT_EPENT1=0 0 0 -1 -1 0 -1 0 -1 -1 0 -1"/>
<X-PRE-PROCESS cmd="set" data="AT_EPENT2=1 1 1 -1 -1 1 -1 1 -1 -1 1 -1"/>
<X-PRE-PROCESS cmd="set" data="AT_CPENT1=0 -1 -1 0 -1 0 0 0 -1 -1 0 -1"/>
@ -8,9 +8,9 @@
<X-PRE-PROCESS cmd="set" data="AT_CMAJ2=1 -1 1 1 -1 1 -1 1 1 -1 1 -1"/>
<X-PRE-PROCESS cmd="set" data="AT_BBLUES=1 -1 1 -1 -1 1 -1 1 1 1 -1 -1"/>
<X-PRE-PROCESS cmd="set" data="ATGPENT2=-1 1 -1 1 -1 1 -1 -1 1 -1 1 -1"/>
<extension name="101">
<condition field="destination_number" expression="^101$">
<extension name="101">
<condition field="destination_number" expression="^101$">
<!-- AUTOTALENT DEFAULTS -->
<!--
@ -65,13 +65,13 @@
<action application="set"><![CDATA[ladspa_params=${AT_TUNE} ${AT_FIXED} ${AT_PULL} ${AT_EPENT2} ${AT_AMOUNT} ${AT_SMOOTH} ${AT_SHIFT} ${AT_OUTSCALE} ${AT_LFODEPTH} ${AT_LFORATE} ${AT_LFOSHAPE} ${AT_LFOSYMM} ${AT_LFOQUANT} ${AT_FCORR} ${AT_FWARP} ${AT_MIX}]]></action>
<action application="ladspa_run" data="r|autotalent||${ladspa_params}"/>
<action application="ladspa_run" data="r|tap_chorusflanger||"/>
<action application="ladspa_run" data="r|phasers_1217.so|autoPhaser|"/>
<action application="bridge" data="sofia/internal/888@conference.freeswitch.org"/>
</condition>
</extension>
</condition>
</extension>
</include>

Some files were not shown because too many files have changed in this diff Show More