SWITCH_DECLARE(switch_size_t) switch_buffer_len(switch_buffer_t *buffer)
{
- assert(buffer != NULL);
+ switch_assert(buffer != NULL);
return buffer->datalen;
SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(switch_buffer_t *buffer)
{
- assert(buffer != NULL);
+ switch_assert(buffer != NULL);
if (switch_test_flag(buffer, SWITCH_BUFFER_FLAG_DYNAMIC)) {
if (buffer->max_len) {
SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(switch_buffer_t *buffer)
{
- assert(buffer != NULL);
+ switch_assert(buffer != NULL);
return buffer->used;
}
{
switch_size_t reading = 0;
- assert(buffer != NULL);
+ switch_assert(buffer != NULL);
if (buffer->used < 1) {
buffer->used = 0;
{
switch_size_t reading = 0;
- assert(buffer != NULL);
- assert(data != NULL);
+ switch_assert(buffer != NULL);
+ switch_assert(data != NULL);
if (buffer->used < 1) {
{
switch_size_t freespace, actual_freespace;
- assert(buffer != NULL);
- assert(data != NULL);
- assert(buffer->data != NULL);
+ switch_assert(buffer != NULL);
+ switch_assert(data != NULL);
+ switch_assert(buffer->data != NULL);
if (!datalen) {
return buffer->used;
SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer_t *buffer)
{
- assert(buffer != NULL);
- assert(buffer->data != NULL);
+ switch_assert(buffer != NULL);
+ switch_assert(buffer->data != NULL);
buffer->used = 0;
buffer->actually_used = 0;
switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
- assert(profile != NULL);
+ switch_assert(profile != NULL);
if (!context) {
context = "default";
switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
- assert(profile != NULL);
+ switch_assert(profile != NULL);
profile_dup(tocopy->username, profile->username, pool);
profile_dup(tocopy->dialplan, profile->dialplan, pool);
{
switch_caller_application_t *caller_application = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
if ((caller_application = switch_core_session_alloc(session, sizeof(switch_caller_application_t))) != 0) {
caller_application->application_name = switch_core_session_strdup(session, application_name);
SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause(switch_channel_t *channel)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
return channel->hangup_cause;
}
{
switch_channel_timetable_t *times = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (channel->caller_profile) {
switch_mutex_lock(channel->profile_mutex);
times = channel->caller_profile->times;
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t *pool)
{
- assert(pool != NULL);
+ switch_assert(pool != NULL);
if (((*channel) = switch_core_alloc(pool, sizeof(switch_channel_t))) == 0) {
return SWITCH_STATUS_MEMERR;
{
switch_size_t has;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
has = switch_buffer_inuse(channel->dtmf_buffer);
switch_mutex_unlock(channel->dtmf_mutex);
switch_size_t wr = 0;
const char *p;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
switch_size_t bytes;
switch_event_t *event;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
if ((bytes = switch_buffer_read(channel->dtmf_buffer, dtmf, len)) > 0) {
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state,
uint32_t flags)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
channel->state = state;
channel->flags = flags;
channel->session = session;
SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname)
{
const char *v = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (!(v = switch_event_get_header(channel->variables, (char*)varname))) {
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!channel->vi) {
return;
}
{
switch_event_header_t *hi = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if ((hi = channel->variables->headers)) {
channel->vi = 1;
SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_core_hash_insert_locked(channel->private_hash, key, private_info, channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, const char *key)
{
void *val;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex);
return val;
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_name(switch_channel_t *channel, const char *name)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
channel->name = NULL;
if (name) {
char *uuid = switch_core_session_get_uuid(channel->session);
SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
return channel->name ? channel->name : "N/A";
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!switch_strlen_zero(varname)) {
switch_mutex_lock(channel->profile_mutex);
SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
return switch_test_flag(channel, flags) ? 1 : 0;
}
{
const char *uuid;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
{
const char *uuid;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_set_flag_locked(channel, flags);
}
SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
channel->state_flags |= flags;
SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_clear_flag_locked(channel, flags);
}
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel)
{
switch_channel_state_t state;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
state = channel->state;
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel)
{
switch_channel_state_t state;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
state = channel->running_state;
{
uint8_t ret = 0;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
!switch_test_flag(channel, CF_TRANSFER)) {
int ok = 0;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
last_state = channel->state;
/* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
if (channel->state < CS_HANGUP) {
/* not cool lets crash this bad boy and figure out wtf is going on */
- assert(0);
+ switch_assert(0);
}
}
done:
vval = (char *) hi->value;
x++;
- assert(vvar && vval);
+ switch_assert(vvar && vval);
snprintf(buf, sizeof(buf), "variable_%s", vvar);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, "%s", vval);
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
char *uuid = NULL;
- assert(channel != NULL);
- assert(channel->session != NULL);
+ switch_assert(channel != NULL);
+ switch_assert(channel->session != NULL);
switch_mutex_lock(channel->profile_mutex);
- assert(caller_profile != NULL);
+ switch_assert(caller_profile != NULL);
uuid = switch_core_session_get_uuid(channel->session);
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
profile = channel->caller_profile;
switch_mutex_unlock(channel->profile_mutex);
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
caller_profile->next = channel->caller_profile->originator_caller_profile;
channel->caller_profile->originator_caller_profile = caller_profile;
}
- assert(channel->caller_profile->originator_caller_profile->next != channel->caller_profile->originator_caller_profile);
+ switch_assert(channel->caller_profile->originator_caller_profile->next != channel->caller_profile->originator_caller_profile);
switch_mutex_unlock(channel->profile_mutex);
}
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
caller_profile->next = channel->caller_profile->originatee_caller_profile;
channel->caller_profile->originatee_caller_profile = caller_profile;
}
- assert(channel->caller_profile->originatee_caller_profile->next != channel->caller_profile->originatee_caller_profile);
+ switch_assert(channel->caller_profile->originatee_caller_profile->next != channel->caller_profile->originatee_caller_profile);
switch_mutex_unlock(channel->profile_mutex);
}
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel)
{
- assert(channel != NULL);
- assert(channel->session != NULL);
+ switch_assert(channel != NULL);
+ switch_assert(channel->session != NULL);
return switch_core_session_get_uuid(channel->session);
}
{
int x, index;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
for (x = 0; x < SWITCH_MAX_STATE_HANDLERS; x++) {
if (channel->state_handlers[x] == state_handler) {
{
const switch_state_handler_table_t *h = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (index > SWITCH_MAX_STATE_HANDLERS || index > channel->state_handler_index) {
return NULL;
switch_mutex_lock(channel->flag_mutex);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
channel->state_handler_index = 0;
if (state_handler) {
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
caller_extension->next = channel->caller_profile->caller_extension;
{
switch_caller_extension_t *extension = NULL;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
extension = channel->caller_profile->caller_extension;
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_channel_t *channel,
const char *file, const char *func, int line, switch_call_cause_t hangup_cause)
{
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) {
switch_core_session_message_t msg;
switch_status_t status;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
switch_core_session_message_t msg;
switch_status_t status;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
const char *uuid;
switch_core_session_t *other_session;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
switch_core_session_message_t msg;
switch_status_t status;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
sub_val = switch_channel_get_variable(channel, vname);
if (offset || ooffset) {
cloned_sub_val = strdup(sub_val);
- assert(cloned_sub_val);
+ switch_assert(cloned_sub_val);
sub_val = cloned_sub_val;
}
}
encode_buf = malloc(encode_len);
- assert(encode_buf);
+ switch_assert(encode_buf);
if (!caller_profile) {
caller_profile = switch_channel_get_caller_profile(channel);
}
- assert(caller_profile != NULL);
+ switch_assert(caller_profile != NULL);
prof[0] = caller_profile->context;
prof[1] = caller_profile->destination_number;
encode_len = new_len;
tmp = realloc(encode_buf, encode_len);
- assert(tmp);
+ switch_assert(tmp);
encode_buf = tmp;
}
switch_frame_t *read_frame;
int stream_id = *stream_id_p;
- assert(thread != NULL);
- assert(session != NULL);
+ switch_assert(thread != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_channel_set_flag(channel, CF_SERVICE);
while (data->running > 0) {
const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(type);
- assert(ext);
+ switch_assert(type);
+ switch_assert(ext);
if (!check) {
char *ptype = switch_core_permanent_strdup(type);
char *argv[20] = { 0 };
int x;
- assert(ext_list);
+ switch_assert(ext_list);
if ((argc = switch_separate_string(ext_list, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
char *mime_path = NULL;
mime_path = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.conf_dir, cf);
- assert(mime_path);
+ switch_assert(mime_path);
fd = open(mime_path, O_RDONLY);
if (fd <= 0) {
*err = "FATAL ERROR! Could noat allocate memory pool\n";
return SWITCH_STATUS_MEMERR;
}
- assert(runtime.memory_pool != NULL);
+ switch_assert(runtime.memory_pool != NULL);
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_core_set_globals();
switch_core_session_init(runtime.memory_pool);
runtime.console = stdout;
}
- assert(runtime.memory_pool != NULL);
+ switch_assert(runtime.memory_pool != NULL);
switch_log_init(runtime.memory_pool);
switch_event_init(runtime.memory_pool);
}
}
- assert(ah != NULL);
+ switch_assert(ah != NULL);
if ((ah->asr_interface = switch_loadable_module_get_asr_interface(module_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid asr module [%s]!\n", module_name);
char *epath = NULL;
switch_status_t status;
- assert(ah != NULL);
+ switch_assert(ah != NULL);
if (!switch_is_file_path(path)) {
epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path);
{
switch_status_t status;
- assert(ah != NULL);
+ switch_assert(ah != NULL);
status = ah->asr_interface->asr_unload_grammar(ah, grammar);
return status;
SWITCH_DECLARE(switch_status_t) switch_core_asr_pause(switch_asr_handle_t *ah)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_pause(ah);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_resume(ah);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_close(ah, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_feed(ah, data, len, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_check_results(ah, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
{
- assert(ah != NULL);
+ switch_assert(ah != NULL);
return ah->asr_interface->asr_get_results(ah, xmlstr, flags);
}
switch_channel_t *channel;
char tmp[30];
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel;
char tmp[30];
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
const switch_codec_implementation_t *iptr, *implementation = NULL;
char *mode = fmtp;
- assert(codec != NULL);
- assert(codec_name != NULL);
+ switch_assert(codec != NULL);
+ switch_assert(codec_name != NULL);
memset(codec, 0, sizeof(*codec));
uint32_t decoded_rate,
void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
{
- assert(codec != NULL);
- assert(encoded_data != NULL);
- assert(decoded_data != NULL);
+ switch_assert(codec != NULL);
+ switch_assert(encoded_data != NULL);
+ switch_assert(decoded_data != NULL);
if (!codec->implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initilized!\n");
void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
{
- assert(codec != NULL);
- assert(encoded_data != NULL);
- assert(decoded_data != NULL);
+ switch_assert(codec != NULL);
+ switch_assert(encoded_data != NULL);
+ switch_assert(decoded_data != NULL);
SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
{
- assert(codec != NULL);
+ switch_assert(codec != NULL);
if (!codec->implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initilized!\n");
SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_read(fh, data, len);
}
SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_write(fh, data, len);
}
{
switch_status_t status;
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
switch_set_flag(fh, SWITCH_FILE_SEEK);
status = fh->file_interface->file_seek(fh, cur_pos, samples, whence);
SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string)
{
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_set_string(fh, col, string);
}
SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col, const char **string)
{
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_get_string(fh, col, string);
SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
{
- assert(fh != NULL);
- assert(fh->file_interface != NULL);
+ switch_assert(fh != NULL);
+ switch_assert(fh->file_interface != NULL);
switch_clear_flag(fh, SWITCH_FILE_OPEN);
return fh->file_interface->file_close(fh);
switch_hash_t *newhash;
newhash = switch_core_alloc(pool, sizeof(*newhash));
- assert(newhash);
+ switch_assert(newhash);
sqlite3HashInit(&newhash->table, SQLITE_HASH_STRING, 1);
*hash = newhash;
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash)
{
- assert(hash != NULL && *hash != NULL);
+ switch_assert(hash != NULL && *hash != NULL);
sqlite3HashClear(&(*hash)->table);
*hash = NULL;
return SWITCH_STATUS_SUCCESS;
goto done;
}
- assert(session != NULL);
- assert(*frame != NULL);
+ switch_assert(session != NULL);
+ switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_CNG)) {
status = SWITCH_STATUS_SUCCESS;
status = SWITCH_STATUS_FALSE;
need_codec = perfect = 0;
- assert(session != NULL);
+ switch_assert(session != NULL);
*frame = NULL;
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
goto done;
}
- assert(session != NULL);
- assert(*frame != NULL);
+ switch_assert(session != NULL);
+ switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_CNG)) {
goto done;
}
- assert((*frame)->codec != NULL);
+ switch_assert((*frame)->codec != NULL);
if ((session->read_codec && (*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) {
need_codec = TRUE;
}
}
session->enc_read_frame.datalen = session->enc_read_frame.buflen;
- assert(session->read_codec != NULL);
- assert(enc_frame != NULL);
- assert(enc_frame->data != NULL);
+ switch_assert(session->read_codec != NULL);
+ switch_assert(enc_frame != NULL);
+ switch_assert(enc_frame->data != NULL);
status = switch_core_codec_encode(session->read_codec,
enc_frame->codec,
unsigned int flag = 0, need_codec = 0, perfect = 0, do_bugs = 0, do_write = 0, do_resample = 0;
switch_io_flag_t io_flag = SWITCH_IO_FLAG_NOOP;
- assert(session != NULL);
- assert(frame != NULL);
+ switch_assert(session != NULL);
+ switch_assert(frame != NULL);
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
return SWITCH_STATUS_SUCCESS;
}
- assert(frame->codec != NULL);
+ switch_assert(frame->codec != NULL);
if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
need_codec = TRUE;
SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session_t *session)
{
- assert(session != NULL);
- assert(session->pool != NULL);
+ switch_assert(session != NULL);
+ switch_assert(session->pool != NULL);
return session->pool;
}
SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session, switch_size_t memory)
{
void *ptr = NULL;
- assert(session != NULL);
- assert(session->pool != NULL);
+ switch_assert(session != NULL);
+ switch_assert(session->pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
#endif
ptr = apr_palloc(session->pool, memory);
- assert(ptr != NULL);
+ switch_assert(ptr != NULL);
memset(ptr, 0, memory);
SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory)
{
void *ptr = NULL;
- assert(memory_manager.memory_pool != NULL);
+ switch_assert(memory_manager.memory_pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
ptr = apr_palloc(memory_manager.memory_pool, memory);
- assert(ptr != NULL);
+ switch_assert(ptr != NULL);
memset(ptr, 0, memory);
#ifdef LOCK_MORE
{
char *duped = NULL;
switch_size_t len;
- assert(memory_manager.memory_pool != NULL);
+ switch_assert(memory_manager.memory_pool != NULL);
if (!todup)
return NULL;
len = strlen(todup) + 1;
duped = apr_pstrmemdup(memory_manager.memory_pool, todup, len);
- assert(duped != NULL);
+ switch_assert(duped != NULL);
#ifdef DEBUG_ALLOC
printf("Perm Allocate %d\n", (int)len);
switch_mutex_lock(memory_manager.mem_lock);
#endif
- assert(session != NULL);
- assert(session->pool != NULL);
+ switch_assert(session != NULL);
+ switch_assert(session->pool != NULL);
va_start(ap, fmt);
result = apr_pvsprintf(session->pool, fmt, ap);
- assert(result != NULL);
+ switch_assert(result != NULL);
va_end(ap);
va_list ap;
char *result = NULL;
- assert(pool != NULL);
+ switch_assert(pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
va_start(ap, fmt);
result = apr_pvsprintf(pool, fmt, ap);
- assert(result != NULL);
+ switch_assert(result != NULL);
va_end(ap);
#ifdef LOCK_MORE
{
char *duped = NULL;
switch_size_t len;
- assert(session != NULL);
- assert(session->pool != NULL);
+ switch_assert(session != NULL);
+ switch_assert(session->pool != NULL);
if (!todup) {
return NULL;
#endif
duped = apr_pstrmemdup(session->pool, todup, len);
- assert(duped != NULL);
+ switch_assert(duped != NULL);
#ifdef LOCK_MORE
{
char *duped = NULL;
switch_size_t len;
- assert(pool != NULL);
+ switch_assert(pool != NULL);
if (!todup) {
return NULL;
#endif
duped = apr_pstrmemdup(pool, todup, len);
- assert(duped != NULL);
+ switch_assert(duped != NULL);
#ifdef LOCK_MORE
switch_mutex_unlock(memory_manager.mem_lock);
void *pop;
switch_mutex_lock(memory_manager.mem_lock);
- assert(pool != NULL);
+ switch_assert(pool != NULL);
if (switch_queue_trypop(memory_manager.pool_recycle_queue, &pop) == SWITCH_STATUS_SUCCESS) {
*pool = (switch_memory_pool_t *) pop;
} else {
apr_pool_create(pool, NULL);
- assert(*pool != NULL);
+ switch_assert(*pool != NULL);
}
#ifdef DEBUG_ALLOC2
//char tmp[128] = "";
- assert(pool != NULL);
+ switch_assert(pool != NULL);
#ifdef DEBUG_ALLOC2
printf("Free Pool %s %s:%d\n", file, func, line);
{
void *ptr = NULL;
- assert(pool != NULL);
+ switch_assert(pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
#ifdef DEBUG_ALLOC
printf("Allocate %d\n", (int)memory);
- /*assert(memory < 20000);*/
+ /*switch_assert(memory < 20000);*/
#endif
ptr = apr_palloc(pool, memory);
- assert(ptr != NULL);
+ switch_assert(ptr != NULL);
memset(ptr, 0, memory);
memset(&memory_manager, 0, sizeof(memory_manager));
apr_pool_create(&memory_manager.memory_pool, NULL);
- assert(memory_manager.memory_pool != NULL);
+ switch_assert(memory_manager.memory_pool != NULL);
switch_mutex_init(&memory_manager.mem_lock, SWITCH_MUTEX_NESTED, memory_manager.memory_pool);
switch_queue_create(&memory_manager.pool_queue, 50000, memory_manager.memory_pool);
switch_queue_create(&memory_manager.pool_recycle_queue, 50000, memory_manager.memory_pool);
SWITCH_DECLARE(void *) switch_core_session_get_private(switch_core_session_t *session)
{
- assert(session != NULL);
+ switch_assert(session != NULL);
return session->private_info;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(switch_core_session_t *session, void *private_info)
{
- assert(session != NULL);
+ switch_assert(session != NULL);
session->private_info = private_info;
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED;
}
- assert(*new_session != NULL);
+ switch_assert(*new_session != NULL);
if (*new_session) {
switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
switch_io_event_hook_receive_message_t *ptr;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->endpoint_interface->io_routines->receive_message) {
status = session->endpoint_interface->io_routines->receive_message(session, message);
switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
msg.message_id = indication;
{
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->message_queue) {
if (switch_queue_trypush(session->message_queue, message) == SWITCH_STATUS_SUCCESS) {
switch_status_t status = SWITCH_STATUS_FALSE;
void *pop;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->message_queue) {
if ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
switch_io_event_hook_receive_event_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(session != NULL);
+ switch_assert(session != NULL);
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
{
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->event_queue) {
if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) {
switch_status_t status = SWITCH_STATUS_FALSE;
void *pop;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->event_queue) {
if ((status = (switch_status_t) switch_queue_trypop(session->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
{
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(session != NULL);
+ switch_assert(session != NULL);
if (session->private_event_queue) {
(*event)->event_id = SWITCH_EVENT_PRIVATE_COMMAND;
void *pop;
switch_channel_t *channel;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (switch_channel_test_flag(channel, CF_EVENT_LOCK)) {
SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b)
{
- assert(a != NULL);
- assert(b != NULL);
+ switch_assert(a != NULL);
+ switch_assert(b != NULL);
return (uint8_t) (a->endpoint_interface == b->endpoint_interface);
}
log = switch_core_session_alloc(session, sizeof(*log));
- assert(log != NULL);
+ switch_assert(log != NULL);
log->app = switch_core_session_strdup(session, application_interface->interface_name);
log->arg = switch_core_session_strdup(session, arg);
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
return sh->speech_interface->speech_feed_tts(sh, text, flags);
}
SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
if (sh->speech_interface->speech_flush_tts) {
sh->speech_interface->speech_flush_tts(sh);
SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
if (sh->speech_interface->speech_text_param_tts) {
sh->speech_interface->speech_text_param_tts(sh, param, val);
SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
if (sh->speech_interface->speech_numeric_param_tts) {
sh->speech_interface->speech_numeric_param_tts(sh, param, val);
SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
if (sh->speech_interface->speech_float_param_tts) {
sh->speech_interface->speech_float_param_tts(sh, param, val);
SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
{
- assert(sh != NULL);
+ switch_assert(sh != NULL);
return sh->speech_interface->speech_read_tts(sh, data, datalen, rate, flags);
}
static void switch_core_standard_on_transmit(switch_core_session_t *session)
{
- assert(session != NULL);
+ switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard TRANSMIT\n");
}
static void switch_core_standard_on_hold(switch_core_session_t *session)
{
- assert(session != NULL);
+ switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HOLD\n");
}
static void switch_core_standard_on_hibernate(switch_core_session_t *session)
{
- assert(session != NULL);
+ switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HIBERNATE\n");
}
*/
- assert(session != NULL);
+ switch_assert(session != NULL);
session->thread_running = 1;
endpoint_interface = session->endpoint_interface;
- assert(endpoint_interface != NULL);
+ switch_assert(endpoint_interface != NULL);
driver_state_handler = endpoint_interface->state_handler;
- assert(driver_state_handler != NULL);
+ switch_assert(driver_state_handler != NULL);
switch_mutex_lock(session->mutex);
{
size_t len = strlen (s) + 1;
void *new = malloc (len);
- assert(new);
+ switch_assert(new);
return (char *) memcpy (new, s, len);
}
void *pop;
int i, len[3] = { 0, 0, 0 };
- assert(thread != NULL);
- assert(obj == NULL);
- assert(POOL_LOCK != NULL);
- assert(RUNTIME_POOL != NULL);
- assert(EVENT_QUEUE_MUTEX != NULL);
- assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
- assert(EVENT_QUEUE_CONDITIONAL != NULL);
+ switch_assert(thread != NULL);
+ switch_assert(obj == NULL);
+ switch_assert(POOL_LOCK != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
+ switch_assert(EVENT_QUEUE_MUTEX != NULL);
+ switch_assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
+ switch_assert(EVENT_QUEUE_CONDITIONAL != NULL);
THREAD_RUNNING = 1;
queues[0] = EVENT_QUEUE[SWITCH_PRIORITY_HIGH];
SWITCH_DECLARE(char *) switch_event_name(switch_event_types_t event)
{
- assert(BLOCK != NULL);
- assert(RUNTIME_POOL != NULL);
+ switch_assert(BLOCK != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
return EVENT_NAMES[event];
}
SWITCH_DECLARE(switch_status_t) switch_name_event(char *name, switch_event_types_t *type)
{
switch_event_types_t x;
- assert(BLOCK != NULL);
- assert(RUNTIME_POOL != NULL);
+ switch_assert(BLOCK != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
for (x = 0; x <= SWITCH_EVENT_ALL; x++) {
if ((strlen(name) > 13 && !strcasecmp(name + 13, EVENT_NAMES[x])) || !strcasecmp(name, EVENT_NAMES[x])) {
switch_event_subclass_t *subclass;
- assert(RUNTIME_POOL != NULL);
- assert(CUSTOM_HASH != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
+ switch_assert(CUSTOM_HASH != NULL);
if (switch_core_hash_find(CUSTOM_HASH, subclass_name)) {
return SWITCH_STATUS_INUSE;
switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
- assert(pool != NULL);
+ switch_assert(pool != NULL);
THRUNTIME_POOL = RUNTIME_POOL = pool;
/*
*event = (switch_event_t *) pop;
} else {
*event = ALLOC(sizeof(switch_event_t));
- assert(*event);
+ switch_assert(*event);
}
memset(*event, 0, sizeof(switch_event_t));
header = (switch_event_header_t *) pop;
} else {
header = ALLOC(sizeof(*header));
- assert(header);
+ switch_assert(header);
}
memset(header, 0, sizeof(*header));
switch_size_t retsize;
switch_time_t ts = switch_timestamp_now();
- assert(BLOCK != NULL);
- assert(RUNTIME_POOL != NULL);
- assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
- assert(EVENT_QUEUE_MUTEX != NULL);
- assert(EVENT_QUEUE_CONDITIONAL != NULL);
- assert(RUNTIME_POOL != NULL);
+ switch_assert(BLOCK != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
+ switch_assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
+ switch_assert(EVENT_QUEUE_MUTEX != NULL);
+ switch_assert(EVENT_QUEUE_CONDITIONAL != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
if (THREAD_RUNNING <= 0) {
/* sorry we're closed */
switch_event_node_t *event_node;
switch_event_subclass_t *subclass = NULL;
- assert(BLOCK != NULL);
- assert(RUNTIME_POOL != NULL);
+ switch_assert(BLOCK != NULL);
+ switch_assert(RUNTIME_POOL != NULL);
if (subclass_name) {
if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name)) == 0) {
int32_t left, elapsed;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
start = switch_time_now();
int sanity = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!switch_channel_test_flag(channel, CF_UNICAST)) {
return SWITCH_STATUS_FALSE;
switch_codec_t *read_codec;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
- assert(conninfo != NULL);
+ switch_assert(conninfo != NULL);
conninfo->local_ip = switch_core_session_strdup(session, local_ip);
conninfo->local_port = local_port;
char *event_lock = switch_event_get_header(event, "event-lock");
switch_status_t status = SWITCH_STATUS_FALSE;
- assert(channel != NULL);
- assert(event != NULL);
+ switch_assert(channel != NULL);
+ switch_assert(event != NULL);
if (switch_strlen_zero(cmd)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Command!\n");
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
while (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_ivr_parse_event(session, event);
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unaswered. Pre-answering...\n");
uint32_t elapsed;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!args->input_callback) {
return SWITCH_STATUS_GENERR;
uint32_t elapsed;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (terminator != NULL)
*terminator = '\0';
msg.from = __FILE__;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_channel_set_flag(channel, CF_HOLD);
switch_channel_set_flag(channel, CF_SUSPEND);
msg.from = __FILE__;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_channel_clear_flag(channel, CF_HOLD);
switch_channel_clear_flag(channel, CF_SUSPEND);
if ((session = switch_core_session_locate(uuid))) {
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
swap = 1;
}
&& (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
&& (other_session = switch_core_session_locate(other_uuid))) {
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_core_session_receive_message(other_session, &msg);
switch_channel_clear_state_handler(other_channel, NULL);
switch_core_session_rwunlock(other_session);
if ((session = switch_core_session_locate(uuid))) {
status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
swap = 1;
if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
(other_session = switch_core_session_locate(other_uuid))) {
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_core_session_receive_message(other_session, &msg);
switch_channel_clear_state_handler(other_channel, NULL);
switch_channel_t *other_channel = NULL;
const char *uuid = NULL;
- assert(session != NULL);
+ switch_assert(session != NULL);
switch_core_session_reset(session);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
/* clear all state handlers */
switch_channel_clear_state_handler(channel, NULL);
if (uuid && (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
switch_core_session_rwunlock(other_session);
}
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
int cdr_off = 0, v_off = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!(cdr = switch_xml_new("cdr"))) {
return SWITCH_STATUS_SUCCESS;
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_channel_set_private(channel, file, NULL);
switch_core_media_bug_remove(session, &bug);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Only 1 of the same file per channel please!\n");
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
dh->fh.channels = read_codec->implementation->number_of_channels;
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
switch_channel_t *channel;
session = switch_core_media_bug_get_session(bug);
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
int doit = 1;
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_channel_set_private(channel, file, NULL);
switch_core_media_bug_remove(session, &bug);
switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM;
uint8_t channels;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Only 1 of the same file per channel please!\n");
}
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
channels = read_codec->implementation->number_of_channels;
char digit_str[80];
switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
frame.data = data;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, "dtmf"))) {
switch_channel_set_private(channel, "dtmf", NULL);
switch_core_media_bug_remove(session, &bug);
switch_inband_dtmf_t *pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
return SWITCH_STATUS_MEMERR;
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, "dtmf_generate"))) {
switch_channel_set_private(channel, "dtmf_generate", NULL);
switch_core_media_bug_remove(session, &bug);
switch_inband_dtmf_generate_t *pvt;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
return SWITCH_STATUS_MEMERR;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_tone_container_t *cont;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((cont = switch_channel_get_private(channel, "_tone_detect_"))) {
switch_channel_set_private(channel, "_tone_detect_", NULL);
switch_core_media_bug_remove(session, &cont->bug);
switch_media_bug_flag_t bflags = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
if (switch_strlen_zero(key)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_channel_set_private(channel, SWITCH_SPEECH_KEY, NULL);
switch_core_media_bug_remove(session, &sth->bug);
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_core_asr_pause(sth->ah);
return SWITCH_STATUS_SUCCESS;
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_core_asr_resume(sth->ah);
return SWITCH_STATUS_SUCCESS;
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth;
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
if (switch_core_asr_unload_grammar(sth->ah, grammar) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error unloading Grammar\n");
}
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
if ((val = switch_channel_get_variable(channel, "fire_asr_events"))) {
switch_core_session_t *session, *other_session;
const char *other_uuid;
- assert(task);
+ switch_assert(task);
helper = (struct hangup_helper *) task->cmd_arg;
struct transfer_helper *helper;
switch_core_session_t *session;
- assert(task);
+ switch_assert(task);
helper = (struct transfer_helper *) task->cmd_arg;
SWITCH_STANDARD_SCHED_FUNC(sch_broadcast_callback)
{
struct broadcast_helper *helper;
- assert(task);
+ switch_assert(task);
helper = (struct broadcast_helper *) task->cmd_arg;
switch_ivr_broadcast(helper->uuid_str, helper->path, helper->flags);
const char *other_uuid = NULL;
char *app = "playback";
- assert(path);
+ switch_assert(path);
if ((session = switch_core_session_locate(uuid))) {
char *cause = NULL;
master = session;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s] already broadcasting...broadcast aborted\n",
switch_ivr_bridge_data_t *bd;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((bd = (switch_ivr_bridge_data_t *) switch_channel_get_private(channel, "_bridge_"))) {
switch_channel_set_private(channel, "_bridge_", NULL);
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM RING\n", switch_channel_get_name(channel));
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM HOLD\n", switch_channel_get_name(channel));
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM RESET\n", switch_channel_get_name(channel));
const char *other_uuid = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM TRANSMIT\n", switch_channel_get_name(channel));
switch_channel_clear_state_handler(channel, NULL);
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_channel_clear_flag(channel, CF_TRANSFER);
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
switch_event_t *event;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
switch_channel_clear_flag(channel, CF_ORIGINATOR);
switch_channel_t *other_channel = NULL;
other_channel = switch_core_session_get_channel(other_session);
- assert(other_channel != NULL);
+ switch_assert(other_channel != NULL);
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_event_t *event;
caller_channel = switch_core_session_get_channel(session);
- assert(caller_channel != NULL);
+ switch_assert(caller_channel != NULL);
peer_channel = switch_core_session_get_channel(peer_session);
- assert(peer_channel != NULL);
+ switch_assert(peer_channel != NULL);
if (!switch_channel_ready(peer_channel)) {
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
int stream_id = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- assert(session != NULL);
- assert(peer_session != NULL);
+ switch_assert(session != NULL);
+ switch_assert(peer_session != NULL);
caller_channel = switch_core_session_get_channel(session);
- assert(caller_channel != NULL);
+ switch_assert(caller_channel != NULL);
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
peer_channel = switch_core_session_get_channel(peer_session);
- assert(peer_channel != NULL);
+ switch_assert(peer_channel != NULL);
a_leg = switch_core_session_alloc(session, sizeof(*a_leg));
b_leg = switch_core_session_alloc(peer_session, sizeof(*b_leg));
- assert(a_leg && b_leg);
+ switch_assert(a_leg && b_leg);
b_leg->session = peer_session;
switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
/* put the channel in a passive state so we can loop audio to it */
switch_event_header_t *hi;
caller_channel = switch_core_session_get_channel(session);
- assert(caller_channel != NULL);
+ switch_assert(caller_channel != NULL);
/* Copy all the applicable channel variables into the event */
if ((hi = switch_channel_variable_first(caller_channel))) {
for (try = 0; try < retries; try++) {
switch_safe_free(loop_data);
loop_data = strdup(data);
- assert(loop_data);
+ switch_assert(loop_data);
or_argc = switch_separate_string(loop_data, '|', pipe_names, (sizeof(pipe_names) / sizeof(pipe_names[0])));
if (caller_channel && or_argc > 1 && !ringback_data) {
caller_profiles[i] = new_profile;
peer_sessions[i] = new_session;
peer_channels[i] = switch_core_session_get_channel(new_session);
- assert(peer_channels[i] != NULL);
+ switch_assert(peer_channels[i] != NULL);
if (var_event) {
switch_channel_set_variable(peer_channels[i], header->name, header->value);
}
switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
- assert(event);
+ switch_assert(event);
switch_channel_event_set_data(peer_channels[i], event);
switch_event_fire(&event);
}
int matches = 0;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!macro_name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No phrase macro specified.\n");
}
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
fh->channels = read_codec->implementation->number_of_channels;
switch_byte_t data[1024];
switch_channel_t *channel;
- assert(session != NULL);
+ switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
switch_channel_pre_answer(channel);
read_codec = switch_core_session_get_read_codec(session);
const char *prebuf;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
prefix = switch_channel_get_variable(channel, "sound_prefix");
timer_name = switch_channel_get_variable(channel, "timer_name");
"ARTIST=%s\n" "COMMENT=%s\n" "DATE=%s\n", file, fh->samplerate, fh->channels, title, copyright, software, artist, comment, date);
#endif
- assert(read_codec != NULL);
+ switch_assert(read_codec != NULL);
interval = read_codec->implementation->microseconds_per_frame / 1000;
if (!fh->audio_buffer) {
channel = switch_core_session_get_channel(session);
//Make sure somebody is home
- assert(channel != NULL);
+ switch_assert(channel != NULL);
//Answer the channel if it hasn't already been answered
switch_channel_answer(channel);
switch_size_t starlen, poundlen;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if (!sh) {
return SWITCH_STATUS_FALSE;
write_frame.samples = len / 2;
write_frame.codec = codec;
- assert(codec->implementation != NULL);
+ switch_assert(codec->implementation != NULL);
for (x = 0; !done && x < lead_in_out; x++) {
switch_yield(codec->implementation->microseconds_per_frame);
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
if ((cache_obj = switch_channel_get_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME))) {
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
int need_create = 1, need_alloc = 1;
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ switch_assert(channel != NULL);
sh = ↰
codec = &lcodec;
switch_loadable_module_t *module = ts->objs[0];
int restarts;
- assert(thread != NULL);
- assert(module != NULL);
+ switch_assert(thread != NULL);
+ switch_assert(module != NULL);
for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) {
status = module->switch_module_runtime();
char derr[512] = "";
switch_memory_pool_t *pool;
- assert(path != NULL);
+ switch_assert(path != NULL);
switch_core_new_memory_pool(&pool);
*new_module = NULL;
static void do_shutdown(switch_loadable_module_t *module)
{
- assert(module != NULL);
+ switch_assert(module != NULL);
switch_loadable_module_unprocess(module);
if (module->switch_module_shutdown) {
switch_api_interface_t *api;
switch_status_t status;
- assert(stream != NULL);
- assert(stream->data != NULL);
- assert(stream->write_function != NULL);
+ switch_assert(stream != NULL);
+ switch_assert(stream->data != NULL);
+ switch_assert(stream->write_function != NULL);
if (!stream->event) {
switch_event_create(&stream->event, SWITCH_EVENT_API);
switch_loadable_module_interface_t *mod;
mod = switch_core_alloc(pool, sizeof(switch_loadable_module_interface_t));
- assert(mod != NULL);
+ switch_assert(mod != NULL);
mod->pool = pool;
#define ALLOC_INTERFACE(_TYPE_) { \
switch_##_TYPE_##_interface_t *i, *ptr; \
i = switch_core_alloc(mod->pool, sizeof(switch_##_TYPE_##_interface_t)); \
- assert(i != NULL); \
+ switch_assert(i != NULL); \
for (ptr = mod->_TYPE_##_interface; ptr && ptr->next; ptr = ptr->next); \
if (ptr) { \
ptr->next = i; \
char *p = strdup(str);
switch_log_level_t level;
- assert(p);
+ switch_assert(p);
if ((argc = switch_separate_string(p, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
for (x = 0; x < argc; x++) {
SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level)
{
switch_log_binding_t *binding = NULL, *ptr = NULL;
- assert(function != NULL);
+ switch_assert(function != NULL);
if (!(binding = switch_core_alloc(LOG_POOL, sizeof(*binding)))) {
return SWITCH_STATUS_MEMERR;
node = (switch_log_node_t *) pop;
} else {
node = malloc(sizeof(*node));
- assert(node);
+ switch_assert(node);
}
node->data = data;
switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
- assert(pool != NULL);
+ switch_assert(pool != NULL);
LOG_POOL = pool;
SQLLEN m = 0, t = 0;
int result;
- assert(callback != NULL);
+ switch_assert(callback != NULL);
if (!db_is_up(handle)) {
goto error;
names = calloc(c, sizeof(*names));
vals = calloc(c, sizeof(*vals));
- assert(names && vals);
+ switch_assert(names && vals);
for (x = 1; x <= c; x++) {
SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
unsigned int elapsed;
switch_size_t bytes;
- assert(rtp_session != NULL);
- assert(rtp_session->ice_user != NULL);
+ switch_assert(rtp_session != NULL);
+ switch_assert(rtp_session->ice_user != NULL);
if (rtp_session->stuncount != 0) {
rtp_session->stuncount--;
SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
{
- assert(rtp_session != NULL);
+ switch_assert(rtp_session != NULL);
switch_mutex_lock(rtp_session->flag_mutex);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
- assert(rtp_session->sock != NULL);
+ switch_assert(rtp_session->sock != NULL);
switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE);
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
}
return -1;
}
- assert(frame != NULL);
+ switch_assert(frame != NULL);
if (switch_test_flag(frame, SFF_CNG)) {
payload = rtp_session->cng_pt;
switch_mutex_lock(globals.task_mutex);
switch_zmalloc(container, sizeof(*container));
- assert(func);
+ switch_assert(func);
container->func = func;
container->task.created = time(NULL);
container->task.runtime = task_runtime;
{
char *p, *q;
switch_size_t x = 0;
- assert(s);
+ switch_assert(s);
q = buf;
if (dup) {
p = strdup(str);
- assert(p);
+ switch_assert(p);
} else {
p = str;
}
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in)
{
- assert(buf);
+ switch_assert(buf);
*buf = '\0';
if (in) {
switch_inet_ntop(AF_INET, in, buf, len);