more error checking.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6954 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-12-22 01:00:10 +00:00
parent 0db0451306
commit 2847d1c04e
13 changed files with 146 additions and 132 deletions

View File

@ -218,8 +218,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug
\param new_allocator new pointer for the return value
\return SWITCH_STATUS_SUCCESS if the operation was a success
*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(switch_port_t start,
switch_port_t end, switch_port_flag_t flags, switch_core_port_allocator_t **new_allocator);
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
_In_ switch_port_t end,
_In_ switch_port_flag_t flags,
_Out_ switch_core_port_allocator_t **new_allocator);
/*!
\brief Get a port from the port allocator
@ -227,14 +229,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(switch_port_t sta
\param port a pointer to the port
\return SUCCESS
*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(switch_core_port_allocator_t *alloc, switch_port_t *port_ptr);
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(switch_core_port_allocator_t *alloc, switch_port_t port);
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(_In_ switch_core_port_allocator_t *alloc, _Out_ switch_port_t *port_ptr);
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(_In_ switch_core_port_allocator_t *alloc, _In_ switch_port_t port);
/*!
\brief destroythe port allocator
\param alloc the allocator object
*/
SWITCH_DECLARE(void) switch_core_port_allocator_destroy(switch_core_port_allocator_t **alloc);
SWITCH_DECLARE(void) switch_core_port_allocator_destroy(_Inout_ switch_core_port_allocator_t **alloc);
///\}
///\defgroup ss Startup/Shutdown
@ -247,7 +249,7 @@ SWITCH_DECLARE(void) switch_core_port_allocator_destroy(switch_core_port_allocat
\param err a pointer to set any errors to
\note to be called at application startup
*/
SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err);
SWITCH_DECLARE(switch_status_t) switch_core_init(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
/*!
\brief Initilize the core and load modules
@ -256,21 +258,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
\param err a pointer to set any errors to
\note to be called at application startup instead of switch_core_init. Includes module loading.
*/
SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t flags, switch_bool_t console, const char **err);
SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err);
/*!
\brief Set/Get Session Limit
\param new_limit new value (if > 0)
\return the current session limit
*/
SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit);
SWITCH_DECLARE(uint32_t) switch_core_session_limit(_In_ uint32_t new_limit);
/*!
\brief Set/Get Session Rate Limit
\param new_limit new value (if > 0)
\return the current session rate limit
*/
SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(uint32_t new_limit);
SWITCH_DECLARE(uint32_t) switch_core_sessions_per_second(_In_ uint32_t new_limit);
/*!
\brief Destroy the core
@ -296,7 +298,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(switch_cor
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_read_lock(session) switch_core_session_perform_read_lock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(_In_ switch_core_session_t *session);
#endif
@ -311,7 +313,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_write_lock(session) switch_core_session_perform_write_lock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_write_lock(_In_ switch_core_session_t *session);
#endif
#ifdef SWITCH_DEBUG_RWLOCKS
@ -325,7 +327,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_rwunlock(session) switch_core_session_perform_rwunlock(session, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_rwunlock(_In_ switch_core_session_t *session);
#endif
///\}
@ -338,17 +340,18 @@ SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session
\param state_handler a state handler to add
\return the current index/priority of this handler
*/
SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_table_t *state_handler);
SWITCH_DECLARE(int) switch_core_add_state_handler(_In_ const switch_state_handler_table_t *state_handler);
/*!
\brief Access a state handler
\param index the desired index to access
\return the desired state handler table or NULL when it does not exist.
*/
SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handler(int index);
SWITCH_DECLARE(const switch_state_handler_table_t *) switch_core_get_state_handler(_In_ int index);
///\}
SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(_Out_ switch_memory_pool_t **pool,
_In_z_ const char *file, _In_z_ const char *func, _In_ int line);
///\defgroup memp Memory Pooling/Allocation
///\ingroup core1
@ -359,7 +362,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
*/
#define switch_core_new_memory_pool(p) switch_core_perform_new_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__)
SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_memory_pool_t **pool, const char *file, const char *func, int line);
SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(_Inout_ switch_memory_pool_t **pool,
_In_z_ const char *file, _In_z_ const char *func, _In_ int line);
/*!
\brief Returns a subpool back to the main pool
\return SWITCH_STATUS_SUCCESS on success
@ -370,13 +374,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
\brief Start the session's state machine
\param session the session on which to start the state machine
*/
SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_run(_In_ switch_core_session_t *session);
/*!
\brief determine if the session's state machine is running
\param session the session on which to check
*/
SWITCH_DECLARE(unsigned int) switch_core_session_running(switch_core_session_t *session);
SWITCH_DECLARE(unsigned int) switch_core_session_running(_In_ switch_core_session_t *session);
/*!
\brief Allocate memory from the main pool with no intention of returning it
@ -384,7 +388,7 @@ SWITCH_DECLARE(unsigned int) switch_core_session_running(switch_core_session_t *
\return a void pointer to the allocated memory
\note this memory never goes out of scope until the core is destroyed
*/
SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory);
SWITCH_DECLARE(void *) switch_core_permanent_alloc(_In_ switch_size_t memory);
/*!
\brief Allocate memory directly from a memory pool
@ -392,7 +396,7 @@ SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory);
\param memory the number of bytes to allocate
\return a void pointer to the allocated memory
*/
SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size_t memory);
SWITCH_DECLARE(void *) switch_core_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory);
/*!
\brief Allocate memory from a session's pool
@ -401,14 +405,14 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size
\return a void pointer to the newly allocated memory
\note the memory will be in scope as long as the session exists
*/
SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session, switch_size_t memory);
SWITCH_DECLARE(void *) switch_core_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory);
/*!
\brief Copy a string using permanent memory allocation
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
SWITCH_DECLARE(char *) switch_core_permanent_strdup(const char *todup);
SWITCH_DECLARE(char *) switch_core_permanent_strdup(_In_z_ const char *todup);
/*!
\brief Copy a string using memory allocation from a session's pool
@ -416,7 +420,7 @@ SWITCH_DECLARE(char *) switch_core_permanent_strdup(const char *todup);
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session, const char *todup);
SWITCH_DECLARE(char *) switch_core_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup);
/*!
\brief Copy a string using memory allocation from a given pool
@ -424,7 +428,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char *todup);
SWITCH_DECLARE(char *) switch_core_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup);
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the session
@ -433,7 +437,7 @@ SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char
\param ... The arguments to use while printing the data
\return The new string
*/
SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *session, const char *fmt, ...);
SWITCH_DECLARE(char *) switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt, ...);
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the pool
@ -442,7 +446,7 @@ SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *sessio
\param ... The arguments to use while printing the data
\return The new string
*/
SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const char *fmt, ...);
SWITCH_DECLARE(char *) switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, ...);
/*!
\brief Retrieve the memory pool from a session
@ -450,7 +454,7 @@ SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const cha
\return the session's pool
\note to be used sparingly
*/
SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session_t *session);
SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(_In_ switch_core_session_t *session);
///\}
///\defgroup sessm Session Creation / Management
@ -462,11 +466,12 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_
\param pool the pool to use for the allocation (a new one will be used if NULL)
\return the newly created session
*/
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch_endpoint_interface_t
*endpoint_interface, switch_memory_pool_t **pool);
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(_In_ const switch_endpoint_interface_t *endpoint_interface,
_Inout_opt_ switch_memory_pool_t **pool);
SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t **session, const char *file, const char *func, int line);
SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
_In_z_ const char *file, _In_z_ const char *func, _In_ int line);
/*!
\brief Destroy a session and return the memory pool to the core
@ -493,33 +498,33 @@ SWITCH_DECLARE(switch_size_t) switch_core_session_id(void);
\param pool the pool to use
\return the newly created session
*/
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t **pool);
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ char *endpoint_name, _Inout_ switch_memory_pool_t **pool);
/*!
\brief Launch the session thread (state machine) on a given session
\param session the session to activate the state machine on
\return SWITCH_STATUS_SUCCESS if the thread was launched
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_core_session_t *session);
/*!
\brief Retrieve a pointer to the channel object associated with a given session
\param session the session to retrieve from
\return a pointer to the channel object
*/
SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(switch_core_session_t *session);
SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
/*!
\brief Signal a session's state machine thread that a state change has occured
*/
SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the unique identifier from a session
\param session the session to retrieve the uuid from
\return a string representing the uuid
*/
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session_t *session);
SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the unique identifier from the core
@ -540,7 +545,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const
#ifdef SWITCH_DEBUG_RWLOCKS
#define switch_core_session_locate(uuid_str) switch_core_session_perform_locate(uuid_str, __FILE__, __SWITCH_FUNC__, __LINE__)
#else
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(const char *uuid_str);
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(_In_z_ const char *uuid_str);
#endif
/*!
@ -548,20 +553,20 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(const char *u
\param varname the name of the variable
\return the value of the desired variable
*/
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname);
SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname);
/*!
\brief Add a global variable to the core
\param varname the name of the variable
\param value the value of the variable
*/
SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *value);
SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
/*!
\brief Hangup All Sessions
\param cause the hangup cause to apply to the hungup channels
*/
SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause);
SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
/*!
\brief Send a message to another session using it's uuid
@ -569,7 +574,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause);
\param message the switch_core_session_message_t object to send
\return the status returned by the message handler
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str, switch_core_session_message_t *message);
SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(_In_z_ char *uuid_str, _In_ switch_core_session_message_t *message);
/*!
\brief Queue a message on a session
@ -577,7 +582,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str,
\param message the message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(_In_ switch_core_session_t *session, _In_ switch_core_session_message_t *message);
/*!
\brief pass an indication message on a session
@ -585,7 +590,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_se
\param indication the indication message to pass
\return SWITCH_STATUS_SUCCESS if the message was passed
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
/*!
\brief Queue an indication message on a session
@ -593,7 +598,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_
\param indication the indication message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
/*!
\brief DE-Queue an message on a given session
@ -601,14 +606,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core
\param message the de-queued message
\return the SWITCH_STATUS_SUCCESS if the message was de-queued
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_session_t *session, switch_core_session_message_t **message);
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(_In_ switch_core_session_t *session, _Out_ switch_core_session_message_t **message);
/*!
\brief Flush a message queue on a given session
\param session the session to de-queue the message on
\return the SWITCH_STATUS_SUCCESS if the message was de-queued
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(_In_ switch_core_session_t *session);
/*!
\brief Queue an event on another session using its uuid
@ -1191,12 +1196,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
\param pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the handle is opened
*/
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handle_t *sh,
const char *module_name,
const char *voice_name,
unsigned int rate,
unsigned int interval,
switch_speech_flag_t *flags, switch_memory_pool_t *pool);
_In_ unsigned int rate,
_In_ unsigned int interval,
switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
/*!
\brief Feed text to the TTS module
\param sh the speech handle to feed

View File

@ -814,8 +814,9 @@ SWITCH_STANDARD_API(tone_detect_session_function)
mydata = strdup(cmd);
switch_assert(mydata != NULL);
if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3) {
if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3 || !argv[0]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "-ERR INVALID ARGS!\n");
return SWITCH_STATUS_SUCCESS;
}
@ -1206,15 +1207,15 @@ SWITCH_STANDARD_API(session_record_function)
path = argv[2];
limit = argv[3] ? atoi(argv[3]) : 0;
if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
goto usage;
}
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
return SWITCH_STATUS_SUCCESS;
}
if (switch_strlen_zero(action) || switch_strlen_zero(path)) {
goto usage;
}
if (!strcasecmp(action, "start")) {
switch_ivr_record_session(rsession, path, limit, NULL);
} else if (!strcasecmp(action, "stop")) {
@ -1273,15 +1274,15 @@ SWITCH_STANDARD_API(session_displace_function)
limit = argv[3] ? atoi(argv[3]) : 0;
flags = argv[4];
if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
goto usage;
}
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
return SWITCH_STATUS_SUCCESS;
}
if (switch_strlen_zero(action) || switch_strlen_zero(path)) {
goto usage;
}
if (!strcasecmp(action, "start")) {
switch_ivr_displace_session(rsession, path, limit, flags);
} else if (!strcasecmp(action, "stop")) {

View File

@ -4599,63 +4599,63 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
var = buf;
}
if (!strcasecmp(var, "rate")) {
if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
rate_name = val;
} else if (!strcasecmp(var, "domain")) {
} else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
domain = val;
} else if (!strcasecmp(var, "interval")) {
} else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
interval_name = val;
} else if (!strcasecmp(var, "timer-name")) {
} else if (!strcasecmp(var, "timer-name") && !switch_strlen_zero(val)) {
timer_name = val;
} else if (!strcasecmp(var, "tts-engine")) {
} else if (!strcasecmp(var, "tts-engine") && !switch_strlen_zero(val)) {
tts_engine = val;
} else if (!strcasecmp(var, "tts-voice")) {
} else if (!strcasecmp(var, "tts-voice") && !switch_strlen_zero(val)) {
tts_voice = val;
} else if (!strcasecmp(var, "enter-sound")) {
} else if (!strcasecmp(var, "enter-sound") && !switch_strlen_zero(val)) {
enter_sound = val;
} else if (!strcasecmp(var, "exit-sound")) {
} else if (!strcasecmp(var, "exit-sound") && !switch_strlen_zero(val)) {
exit_sound = val;
} else if (!strcasecmp(var, "alone-sound")) {
} else if (!strcasecmp(var, "alone-sound") && !switch_strlen_zero(val)) {
alone_sound = val;
} else if (!strcasecmp(var, "perpetual-sound")) {
} else if (!strcasecmp(var, "perpetual-sound") && !switch_strlen_zero(val)) {
perpetual_sound = val;
} else if (!strcasecmp(var, "moh-sound")) {
} else if (!strcasecmp(var, "moh-sound") && !switch_strlen_zero(val)) {
moh_sound = val;
} else if (!strcasecmp(var, "ack-sound")) {
} else if (!strcasecmp(var, "ack-sound") && !switch_strlen_zero(val)) {
ack_sound = val;
} else if (!strcasecmp(var, "nack-sound")) {
} else if (!strcasecmp(var, "nack-sound") && !switch_strlen_zero(val)) {
nack_sound = val;
} else if (!strcasecmp(var, "muted-sound")) {
} else if (!strcasecmp(var, "muted-sound") && !switch_strlen_zero(val)) {
muted_sound = val;
} else if (!strcasecmp(var, "unmuted-sound")) {
} else if (!strcasecmp(var, "unmuted-sound") && !switch_strlen_zero(val)) {
unmuted_sound = val;
} else if (!strcasecmp(var, "locked-sound")) {
} else if (!strcasecmp(var, "locked-sound") && !switch_strlen_zero(val)) {
locked_sound = val;
} else if (!strcasecmp(var, "is-locked-sound")) {
} else if (!strcasecmp(var, "is-locked-sound") && !switch_strlen_zero(val)) {
is_locked_sound = val;
} else if (!strcasecmp(var, "is-unlocked-sound")) {
} else if (!strcasecmp(var, "is-unlocked-sound") && !switch_strlen_zero(val)) {
is_unlocked_sound = val;
} else if (!strcasecmp(var, "member-flags")) {
} else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
member_flags = val;
} else if (!strcasecmp(var, "kicked-sound")) {
} else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
kicked_sound = val;
} else if (!strcasecmp(var, "pin")) {
} else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
pin = val;
} else if (!strcasecmp(var, "pin-sound")) {
} else if (!strcasecmp(var, "pin-sound") && !switch_strlen_zero(val)) {
pin_sound = val;
} else if (!strcasecmp(var, "bad-pin-sound")) {
} else if (!strcasecmp(var, "bad-pin-sound") && !switch_strlen_zero(val)) {
bad_pin_sound = val;
} else if (!strcasecmp(var, "energy-level")) {
} else if (!strcasecmp(var, "energy-level") && !switch_strlen_zero(val)) {
energy_level = val;
} else if (!strcasecmp(var, "caller-id-name")) {
} else if (!strcasecmp(var, "caller-id-name") && !switch_strlen_zero(val)) {
caller_id_name = val;
} else if (!strcasecmp(var, "caller-id-number")) {
} else if (!strcasecmp(var, "caller-id-number") && !switch_strlen_zero(val)) {
caller_id_number = val;
} else if (!strcasecmp(var, "caller-controls")) {
} else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
caller_controls = val;
} else if (!strcasecmp(var, "sound-prefix")) {
} else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
sound_prefix = val;
} else if (!strcasecmp(var, "max-members")) {
} else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(val)) {
errno = 0; // sanity first
max_members = strtol(val, NULL, 0); // base 0 lets 0x... for hex 0... for octal and base 10 otherwise through
if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) {
@ -4664,9 +4664,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
max_members = 0; // set to 0 to disable max counts
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
}
} else if (!strcasecmp(var, "max-members-sound")) {
} else if (!strcasecmp(var, "max-members-sound") && !switch_strlen_zero(val)) {
maxmember_sound = val;
} else if (!strcasecmp(var, "anounce-count")) {
} else if (!strcasecmp(var, "anounce-count") && !switch_strlen_zero(val)) {
errno = 0; // safety first
anounce_count = strtol(val, NULL, 0);
if (errno == ERANGE || errno == EINVAL) {
@ -4728,9 +4728,15 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
/* initialize the conference object with settings from the specified profile */
conference->pool = pool;
conference->profile_name = switch_core_strdup(conference->pool, switch_xml_attr_soft(cfg.profile, "name"));
conference->timer_name = switch_core_strdup(conference->pool, timer_name);
conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
if (timer_name) {
conference->timer_name = switch_core_strdup(conference->pool, timer_name);
}
if (tts_engine) {
conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
}
if (tts_voice) {
conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
}
conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);

View File

@ -461,7 +461,7 @@ static switch_status_t load_config(void)
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid threshold value [%s] must be between 0 and 1000 ms\n", val);
}
} else if (!strcasecmp(var, "tone-spec")) {
} else if (!strcasecmp(var, "tone-spec") && !switch_strlen_zero(val)) {
tone_spec = val;
} else if (!strcasecmp(var, "digit-timeout")) {
int tmp = 0;

View File

@ -1335,14 +1335,14 @@ static switch_status_t channel_waitfor_write(switch_core_session_t *session, int
}
static switch_status_t channel_send_dtmf(switch_core_session_t *session, char *dtmf)
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
struct private_object *tech_pvt = NULL;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%s]\n", dtmf);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF [%c]\n", dtmf->digit);
return switch_rtp_queue_rfc2833(tech_pvt->rtp_session, dtmf);
@ -1627,7 +1627,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
char *profile_name;
char *callto;
char idbuf[1024];
char *full_id;
char *full_id = NULL;
char sess_id[11] = "";
char *dnis = NULL;
char workspace[1024] = "";
@ -1716,7 +1716,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
tech_pvt->recip = switch_core_session_strdup(*new_session, full_id);
tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
if (dnis) {
tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@ -1956,25 +1958,25 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
#endif
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
} else if (!strcasecmp(var, "dialplan")) {
} else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
profile->dialplan = switch_core_strdup(module_pool, val);
#ifdef AUTO_REPLY // gotta fix looping on this
} else if (!strcasecmp(var, "auto-reply")) {
profile->auto_reply = switch_core_strdup(module_pool, val);
#endif
} else if (!strcasecmp(var, "name")) {
} else if (!strcasecmp(var, "name") && !switch_strlen_zero(val)) {
profile->name = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "message")) {
} else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
profile->message = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-ip")) {
profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
} else if (!strcasecmp(var, "ext-rtp-ip")) {
profile->extip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
} else if (!strcasecmp(var, "server")) {
} else if (!strcasecmp(var, "server") && !switch_strlen_zero(val)) {
profile->server = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-timer-name")) {
} else if (!strcasecmp(var, "rtp-timer-name") && !switch_strlen_zero(val)) {
profile->timer_name = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "lanaddr")) {
} else if (!strcasecmp(var, "lanaddr") && !switch_strlen_zero(val)) {
profile->lanaddr = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "tls")) {
if (switch_true(val)) {
@ -1986,11 +1988,11 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
} else if (val && !strcasecmp(val, "md5")) {
profile->user_flags |= LDL_FLAG_SASL_MD5;
}
} else if (!strcasecmp(var, "exten")) {
} else if (!strcasecmp(var, "exten") && !switch_strlen_zero(val)) {
profile->exten = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "context")) {
} else if (!strcasecmp(var, "context") && !switch_strlen_zero(val)) {
profile->context = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "auto-login")) {
} else if (!strcasecmp(var, "auto-login") && !switch_strlen_zero(val)) {
if (switch_true(val)) {
switch_set_flag(profile, TFLAG_AUTO);
}

View File

@ -176,9 +176,9 @@ static switch_status_t de_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -176,9 +176,9 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t en_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -176,9 +176,9 @@ static switch_status_t es_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t es_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -176,9 +176,9 @@ static switch_status_t fr_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -176,9 +176,9 @@ static switch_status_t it_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -176,9 +176,9 @@ static switch_status_t nl_say_general_count(switch_core_session_t *session,
char sbuf[13] = "";
switch_status_t status;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@ -426,9 +426,9 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
char *dollars = NULL;
char *cents = NULL;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");

View File

@ -564,7 +564,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (caller_profile_override) {
new_profile = switch_caller_profile_dup(pool, caller_profile_override);
new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data);
new_profile->destination_number = switch_core_strdup(new_profile->pool, switch_str_nil(chan_data));
new_profile->uuid = SWITCH_BLANK_STRING;
new_profile->chan_name = SWITCH_BLANK_STRING;
} else {

View File

@ -279,7 +279,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
switch_stun_packet_attribute_t *attr;
switch_size_t bytes = 0;
char username[33] = { 0 };
char rip[16];
char rip[16] = { 0 };
uint16_t rport = 0;
switch_time_t started = 0;
unsigned int elapsed = 0;