if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
- if(zstr(newvalue)) {
+ if (zstr(newvalue)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
} else {
switch_safe_free(globals.odbc_dsn);
member->score_iir = (int)(((1.0 - SCORE_DECAY) * (float)member->score) + (SCORE_DECAY * (float)member->score_iir));
- if(member->score_iir > SCORE_MAX_IIR) {
+ if (member->score_iir > SCORE_MAX_IIR) {
member->score_iir = SCORE_MAX_IIR;
}
switch_channel_set_variable(channel, "conference_name", conference->name);
/* Set MOH from variable if not set */
- if(zstr(conference->moh_sound)) {
+ if (zstr(conference->moh_sound)) {
conference->moh_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_moh_sound"));
}
/* Set perpetual-sound from variable if not set */
- if(zstr(conference->perpetual_sound)) {
+ if (zstr(conference->perpetual_sound)) {
conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound"));
}
}
if (!strcasecmp(method, "head")) {
curl_easy_setopt(curl_handle, CURLOPT_NOBODY, SWITCH_TRUE);
- } else if(!strcasecmp(method, "post")) {
+ } else if (!strcasecmp(method, "post")) {
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data));
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data);
switch_channel_set_variable(channel, "curl_response_data", print_json(pool, http_data));
} else {
SWITCH_STANDARD_STREAM(stream);
- if(do_headers) {
+ if (do_headers) {
slist = http_data->headers;
while(slist) {
stream.write_function(&stream, "%s\n", slist->data);
if (do_json) {
stream->write_function(stream, "%s", print_json(pool, http_data));
} else {
- if(do_headers) {
+ if (do_headers) {
slist = http_data->headers;
while(slist) {
stream->write_function(stream, "%s\n", slist->data);
/* Defines for error checking */
#include <errno.h>
-#if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
+#if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
#define EXPR_RESET_ERR() errno = 0
-#define EXPR_CHECK_ERR() if(errno) return EXPR_ERROR_OUTOFRANGE
+#define EXPR_CHECK_ERR() if (errno) return EXPR_ERROR_OUTOFRANGE
#else
#define EXPR_RESET_ERR()
#define EXPR_CHECK_ERR()
if (d2 != 0.0)
*val = d1 / d2;
else {
-#if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
+#if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
return EXPR_ERROR_DIVBYZERO;
#else
*val = 0.0;
/* Macro for adding a function node type */
#define EXPR_ADDFUNC_TYPE(name, type, argmin, argmax, refmin, refmax) \
err = exprFuncListAddType(flist, name, type, argmin, argmax, refmin, refmax); \
-if(err != EXPR_ERROR_NOERROR) \
+if (err != EXPR_ERROR_NOERROR) \
return err;
/* Macro for adding a constant */
#define EXPR_ADDCONST(name, val) \
err = exprValListAdd(vlist, name, val); \
-if(err != EXPR_ERROR_NOERROR) \
+if (err != EXPR_ERROR_NOERROR) \
return err;
/* Call this function to initialize these functions into a function list */
node_list[node_count++] = node;
}
- if(switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) {
+ if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) {
node->ready = FIFO_DELAY_DESTROY;
}
}
/* if a session is provided, check if the source part of the regex has any channel variables, then expand them */
- if(session) {
+ if (session) {
channel = switch_core_session_get_channel(session);
switch_assert(channel);
- if(switch_string_var_check_const(src) || switch_string_has_escaped_data(src)) {
+ if (switch_string_var_check_const(src) || switch_string_has_escaped_data(src)) {
tmp_regex = switch_channel_expand_variables(channel, src);
src_regex = switch_core_strdup(pool, tmp_regex);
switch_safe_free(tmp_regex);
src = src_regex;
}
- if(switch_string_var_check_const(dst) || switch_string_has_escaped_data(dst)) {
+ if (switch_string_var_check_const(dst) || switch_string_has_escaped_data(dst)) {
tmp_regex = switch_channel_expand_variables(channel, dst);
dst_regex = switch_core_strdup(pool, tmp_regex);
switch_safe_free(tmp_regex);
db_random = "rand()";
return SWITCH_TRUE;
}
- if(db_check("SELECT random();") == SWITCH_TRUE) {
+ if (db_check("SELECT random();") == SWITCH_TRUE) {
db_random = "random()";
return SWITCH_TRUE;
}
if (!strcasecmp(argv[i], "intrastate")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
cb_struct.intrastate = SWITCH_TRUE;
- } else if(!strcasecmp(argv[i], "as")) {
+ } else if (!strcasecmp(argv[i], "as")) {
i++;
- if(argv[i] && !strcasecmp(argv[i], "xml")) {
+ if (argv[i] && !strcasecmp(argv[i], "xml")) {
as_xml = SWITCH_TRUE;
} else {
goto usage;
key = argv[1];
val = argv[2];
- if(argc > 3) {
+ if (argc > 3) {
expires_str = argv[3];
expires = (time_t)strtol(expires_str, NULL, 10);
}
- if(argc > 4) {
+ if (argc > 4) {
flags_str = argv[4];
flags = (uint32_t)strtol(flags_str, NULL, 16);
}
} else {
svalue = "1";
}
- if(argc > 3) {
+ if (argc > 3) {
expires_str = argv[3];
expires = (time_t)strtol(expires_str, NULL, 10);
}
- if(argc > 4) {
+ if (argc > 4) {
flags_str = argv[4];
flags = (uint32_t)strtol(flags_str, NULL, 16);
}
}
} else if (!strcasecmp(subcmd, "delete") && argc > 1) {
key = argv[1];
- if(argc > 2) {
+ if (argc > 2) {
expires_str = argv[3];
expires = (time_t)strtol(expires_str, NULL, 10);
}
switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
}
} else if (!strcasecmp(subcmd, "flush")) {
- if(argc > 1) {
+ if (argc > 1) {
expires_str = argv[3];
expires = (time_t)strtol(expires_str, NULL, 10);
}
return SWITCH_STATUS_FALSE;
}
*datalen = my_datalen * 2;
- if(datalen == 0) {
+ if (datalen == 0) {
return SWITCH_STATUS_BREAK;
} else {
return SWITCH_STATUS_SUCCESS;
done:
- if(status != SWITCH_STATUS_SUCCESS) {
+ if (status != SWITCH_STATUS_SUCCESS) {
audio_queue_destroy(laudio_queue);
}
return status;
#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
switch_size_t len = *data_len;
- if(queue->file_write) {
+ if (queue->file_write) {
switch_file_write(queue->file_write, data, &len);
}
#endif
*/
static char *ip_addr_get(const char *value, apr_pool_t *pool)
{
- if(!value || strcasecmp(value,"auto") == 0) {
+ if (!value || strcasecmp(value,"auto") == 0) {
char *addr = DEFAULT_LOCAL_IP_ADDRESS;
apt_ip_get(&addr,pool);
return addr;
rtp_config->jb_config.max_playout_delay = atol(val);
} else if (strcasecmp(param, "codecs") == 0) {
const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client);
- if(codec_manager) {
+ if (codec_manager) {
mpf_codec_manager_codec_list_load(codec_manager, &rtp_config->codec_list, val, pool);
}
} else if (strcasecmp(param, "ptime") == 0) {
rtp_config->ptime = (apr_uint16_t)atol(val);
#if UNI_VERSION_AT_LEAST(0,8,0)
- } else if(strcasecmp(param, "rtcp") == 0) {
+ } else if (strcasecmp(param, "rtcp") == 0) {
rtp_config->rtcp = atoi(val);
- } else if(strcasecmp(param, "rtcp-bye") == 0) {
+ } else if (strcasecmp(param, "rtcp-bye") == 0) {
rtp_config->rtcp_bye_policy = atoi(val);
- } else if(strcasecmp(param, "rtcp-tx-interval") == 0) {
+ } else if (strcasecmp(param, "rtcp-tx-interval") == 0) {
rtp_config->rtcp_tx_interval = (apr_uint16_t)atoi(val);
- } else if(strcasecmp(param, "rtcp-rx-resolution") == 0) {
+ } else if (strcasecmp(param, "rtcp-rx-resolution") == 0) {
rtp_config->rtcp_rx_resolution = (apr_uint16_t)atol(val);
#endif
} else {
#if UNI_VERSION_AT_LEAST(0,8,0)
/* load the synthesizer and recognizer resources */
resource_loader = mrcp_resource_loader_create(FALSE, pool);
- if(resource_loader) {
+ if (resource_loader) {
apt_str_t synth_resource;
apt_str_t recog_resource;
apt_string_set(&synth_resource, "speechsynth");
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
- if(globals.auto_nat && tech_pvt->profile->local_network &&
+ if (globals.auto_nat && tech_pvt->profile->local_network &&
!switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
switch_port_t external_port = 0;
switch_nat_add_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
tech_pvt->rtp_session = NULL;
}
- if(globals.auto_nat && tech_pvt->profile->local_network &&
+ if (globals.auto_nat && tech_pvt->profile->local_network &&
!switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
switch_nat_del_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP);
}
switch_thread_rwlock_unlock(tech_pvt->profile->rwlock);
- if(tech_pvt->profile->purge) {
+ if (tech_pvt->profile->purge) {
mdl_profile_t *profile = tech_pvt->profile;
- if(switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name);
}
}
}
}
- if(mdl_profile->purge) {
+ if (mdl_profile->purge) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing outgoing call\n", mdl_profile->name);
terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED);
return SWITCH_CAUSE_NORMAL_UNSPECIFIED;
}
- if(switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+ if (switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", mdl_profile->name);
terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED);
return SWITCH_CAUSE_NORMAL_UNSPECIFIED;
static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_profile)
{
- if(profile == new_profile) {
+ if (profile == new_profile) {
return SWITCH_TRUE;
}
- if(
+ if (
((!new_profile->name && !profile->name) ||
(new_profile->name && profile->name && !strcasecmp(new_profile->name, profile->name))) &&
((!new_profile->login && !profile->login) ||
) {
int i;
if (switch_odbc_available()) {
- if(!(
+ if (!(
((!new_profile->odbc_dsn && !profile->odbc_dsn) ||
(new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) &&
((!new_profile->odbc_user && !profile->odbc_user) ||
}
for(i=0; i<new_profile->acl_count; i++) {
- if(strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) {
+ if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) {
return SWITCH_FALSE;
}
}
{
mdl_profile_t *profile = NULL;
- if((profile = switch_core_hash_find(globals.profile_hash, name))) {
+ if ((profile = switch_core_hash_find(globals.profile_hash, name))) {
if (profile->user_flags & LDL_FLAG_COMPONENT) {
if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
switch_odbc_handle_disconnect(profile->master_odbc);
switch_mutex_destroy(profile->mutex);
}
- if(switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+ if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s is busy\n", profile->name);
profile->purge = SWITCH_TRUE;
- if(profile->handle) {
+ if (profile->handle) {
ldl_handle_stop(profile->handle);
}
} else {
switch_thread_rwlock_unlock(profile->rwlock);
profile->purge = SWITCH_TRUE;
- if(profile->handle) {
+ if (profile->handle) {
ldl_handle_stop(profile->handle);
}
- if(switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
+ if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name);
}
}
if (profile) {
switch_core_hash_insert(name_hash, profile->name, profile->login);
- if((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) {
- if(match_profile(old_profile, profile)) {
+ if ((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) {
+ if (match_profile(old_profile, profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found pre-existing profile %s [%s]\n", profile->name, profile->login);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overwriting pre-existing profile %s [%s]\n", profile->name, profile->login);
switch_hash_this(hi, NULL, NULL, &data);
profile = (mdl_profile_t *) data;
- if(switch_core_hash_find(name_hash, profile->name)) {
+ if (switch_core_hash_find(name_hash, profile->name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New profile %s [%s] activated\n", profile->name, profile->login);
} else {
switch_core_hash_insert(name_hash, profile->name, profile->name);
for (hi = switch_hash_first(NULL, name_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &data);
- if((profile = switch_core_hash_find(globals.profile_hash, (char*)data))) {
+ if ((profile = switch_core_hash_find(globals.profile_hash, (char*)data))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleting unused profile %s [%s]\n", profile->name, profile->login);
destroy_profile(profile->name);
}
goto done;
}
- if(profile->purge) {
+ if (profile->purge) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing incoming call\n", profile->name);
status = LDL_STATUS_FALSE;
goto done;
}
- if(switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+ if (switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", profile->name);
status = LDL_STATUS_FALSE;
goto done;
ret = jb_get(cur->jb, &frame, now, get_interp_len(cur->voiceformat));
switch (ret) {
case JB_OK:
- // if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+ // if (frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
event = frame.data;
event = handle_event(event);
if (event) {
}
break;
case JB_INTERP:
- // if(next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+ // if (next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
/* create an interpolation frame */
//fprintf(stderr, "Making Interpolation frame\n");
event = (struct iax_event *) malloc(sizeof(struct iax_event));
}
break;
case JB_DROP:
- // if(next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
+ // if (next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
iax_event_free(frame.data);
break;
case JB_NOFRAME:
const char* val = NULL;
val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
- if(!val || switch_true(val)) {
+ if (!val || switch_true(val)) {
if (cause > 0 && cause < 128) {
switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
} else if (cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
}
- if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+ if (sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
}
}
if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
}
- if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+ if (sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
}
}
const char* val = NULL;
sofia_set_flag_locked(b_tech_pvt, TFLAG_BYE);
val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
- if(!val || switch_true(val)) {
+ if (!val || switch_true(val)) {
q850 = switch_core_session_sprintf(a_session, "Q.850;cause=16;text=\"normal_clearing\"");
}
nua_bye(b_tech_pvt->nh,
if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
- if(map->rm_encoding) {
+ if (map->rm_encoding) {
match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1;
} else {
match = 0;
}
if (match) {
- if(ptime > 0) {
+ if (ptime > 0) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime);
} else {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate);
goto mem_fail;
}
- if((eoc = strstr(contact, ";fs_path="))) {
+ if ((eoc = strstr(contact, ";fs_path="))) {
*eoc = '\0';
- if(!(route = strdup(eoc + 9))) {
+ if (!(route = strdup(eoc + 9))) {
goto mem_fail;
}
goto mem_fail;
}
- if((eoc = strstr(to, ";fs_path="))) {
+ if ((eoc = strstr(to, ";fs_path="))) {
*eoc++ = '>';
*eoc = '\0';
}
dst = sofia_glue_get_destination((char*) o_contact);
switch_assert(dst);
- if(dst->route_uri) {
+ if (dst->route_uri) {
route_uri = sofia_glue_strip_uri(dst->route_uri);
}
dst = sofia_glue_get_destination((char*) full_contact);
- if(dst->route_uri) {
+ if (dst->route_uri) {
route_uri = sofia_glue_strip_uri(dst->route_uri);
}
} else {
/* no data, so insert 1 second of silence */
newbytes = 2 * handle->samplerate;
- if(newbytes < bytes) {
+ if (newbytes < bytes) {
bytes = newbytes;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with 1s of empty audio. (%s)\n", context->stream_url);
NSObjectFileImage img;
NSObjectFileImageReturnCode ret;
/* this would be a rare case, but prevents crashing if it happens */
- if(!_dyld_present()) {
+ if (!_dyld_present()) {
lua_pushliteral(L, "dyld not present");
return NULL;
}
//SocketClose(&(r->conn->socket));
HTTPWriteEnd(r);
- //if(r->conn->channelP)
+ //if (r->conn->channelP)
//ConnKill(r->conn);
//ChannelInterrupt(r->conn->channelP);
//ConnClose(r->conn);
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
for (i = 0; i < argc && param[i]; ++i) {
char *param_pair[2] = { 0 };
- if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+ if (switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
switch_core_asr_text_param(ah, param_pair[0], param_pair[1]);
}
}
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
for (i = 0; i < argc && param[i]; ++i) {
char *param_pair[2] = { 0 };
- if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+ if (switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
switch_core_speech_text_param_tts(sh, param_pair[0], param_pair[1]);
}
}
static int et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
int digit;
LONGDOUBLE_TYPE d;
- if( (*cnt)++ >= 16 ) return '0';
+ if ( (*cnt)++ >= 16 ) return '0';
digit = (int)*val;
d = digit;
digit += '0';
count = length = 0;
bufpt = 0;
for(; (c=(*fmt))!=0; ++fmt){
- if( c!='%' ){
+ if ( c!='%' ){
int amt;
bufpt = (char *)fmt;
amt = 1;
while( (c=(*++fmt))!='%' && c!=0 ) amt++;
(*func)(arg,bufpt,amt);
count += amt;
- if( c==0 ) break;
+ if ( c==0 ) break;
}
- if( (c=(*++fmt))==0 ){
+ if ( (c=(*++fmt))==0 ){
errorflag = 1;
(*func)(arg,"%",1);
count++;
}while( !done && (c=(*++fmt))!=0 );
/* Get the field width */
width = 0;
- if( c=='*' ){
+ if ( c=='*' ){
width = va_arg(ap,int);
- if( width<0 ){
+ if ( width<0 ){
flag_leftjustify = 1;
width = -width;
}
c = *++fmt;
}
}
- if( width > etBUFSIZE-10 ){
+ if ( width > etBUFSIZE-10 ){
width = etBUFSIZE-10;
}
/* Get the precision */
- if( c=='.' ){
+ if ( c=='.' ){
precision = 0;
c = *++fmt;
- if( c=='*' ){
+ if ( c=='*' ){
precision = va_arg(ap,int);
- if( precision<0 ) precision = -precision;
+ if ( precision<0 ) precision = -precision;
c = *++fmt;
}else{
while( c>='0' && c<='9' ){
precision = -1;
}
/* Get the conversion type modifier */
- if( c=='l' ){
+ if ( c=='l' ){
flag_long = 1;
c = *++fmt;
- if( c=='l' ){
+ if ( c=='l' ){
flag_longlong = 1;
c = *++fmt;
}else{
/* Fetch the info entry for the field */
infop = 0;
for(idx=0; idx<etNINFO; idx++){
- if( c==fmtinfo[idx].fmttype ){
+ if ( c==fmtinfo[idx].fmttype ){
infop = &fmtinfo[idx];
- if( useExtended || (infop->flags & FLAG_INTERN)==0 ){
+ if ( useExtended || (infop->flags & FLAG_INTERN)==0 ){
xtype = infop->type;
}else{
return -1;
}
}
zExtra = 0;
- if( infop==0 ){
+ if ( infop==0 ){
return -1;
}
/* Limit the precision to prevent overflowing buf[] during conversion */
- if( precision>etBUFSIZE-40 && (infop->flags & FLAG_STRING)==0 ){
+ if ( precision>etBUFSIZE-40 && (infop->flags & FLAG_STRING)==0 ){
precision = etBUFSIZE-40;
}
flag_long = sizeof(char*)==sizeof(long int);
/* Fall through into the next case */
case etRADIX:
- if( infop->flags & FLAG_SIGNED ){
+ if ( infop->flags & FLAG_SIGNED ){
int64_t v;
- if( flag_longlong ) v = va_arg(ap,int64_t);
- else if( flag_long ) v = va_arg(ap,long int);
+ if ( flag_longlong ) v = va_arg(ap,int64_t);
+ else if ( flag_long ) v = va_arg(ap,long int);
else v = va_arg(ap,int);
- if( v<0 ){
+ if ( v<0 ){
longvalue = -v;
prefix = '-';
}else{
longvalue = v;
- if( flag_plussign ) prefix = '+';
- else if( flag_blanksign ) prefix = ' ';
+ if ( flag_plussign ) prefix = '+';
+ else if ( flag_blanksign ) prefix = ' ';
else prefix = 0;
}
}else{
- if( flag_longlong ) longvalue = va_arg(ap,uint64_t);
- else if( flag_long ) longvalue = va_arg(ap,unsigned long int);
+ if ( flag_longlong ) longvalue = va_arg(ap,uint64_t);
+ else if ( flag_long ) longvalue = va_arg(ap,unsigned long int);
else longvalue = va_arg(ap,unsigned int);
prefix = 0;
}
- if( longvalue==0 ) flag_alternateform = 0;
- if( flag_zeropad && precision<width-(prefix!=0) ){
+ if ( longvalue==0 ) flag_alternateform = 0;
+ if ( flag_zeropad && precision<width-(prefix!=0) ){
precision = width-(prefix!=0);
}
bufpt = &buf[etBUFSIZE-1];
for(idx=precision-length; idx>0; idx--){
*(--bufpt) = '0'; /* Zero pad */
}
- if( prefix ) *(--bufpt) = prefix; /* Add sign */
- if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
+ if ( prefix ) *(--bufpt) = prefix; /* Add sign */
+ if ( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
const char *pre;
char x;
pre = &aPrefix[infop->prefix];
- if( *bufpt!=pre[0] ){
+ if ( *bufpt!=pre[0] ){
for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;
}
}
case etGENERIC:
realvalue = va_arg(ap,double);
#ifndef SWITCH_OMIT_FLOATING_POINT
- if( precision<0 ) precision = 6; /* Set default precision */
- if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
- if( realvalue<0.0 ){
+ if ( precision<0 ) precision = 6; /* Set default precision */
+ if ( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
+ if ( realvalue<0.0 ){
realvalue = -realvalue;
prefix = '-';
}else{
- if( flag_plussign ) prefix = '+';
- else if( flag_blanksign ) prefix = ' ';
+ if ( flag_plussign ) prefix = '+';
+ else if ( flag_blanksign ) prefix = ' ';
else prefix = 0;
}
- if( xtype==etGENERIC && precision>0 ) precision--;
+ if ( xtype==etGENERIC && precision>0 ) precision--;
#if 0
/* Rounding works like BSD when the constant 0.4999 is used. Wierd! */
for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
/* It makes more sense to use 0.5 */
for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){}
#endif
- if( xtype==etFLOAT ) realvalue += rounder;
+ if ( xtype==etFLOAT ) realvalue += rounder;
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
exp = 0;
- if( realvalue>0.0 ){
+ if ( realvalue>0.0 ){
while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; }
while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; }
- if( exp>350 || exp<-350 ){
+ if ( exp>350 || exp<-350 ){
bufpt = "NaN";
length = 3;
break;
** or etFLOAT, as appropriate.
*/
flag_exp = xtype==etEXP;
- if( xtype!=etFLOAT ){
+ if ( xtype!=etFLOAT ){
realvalue += rounder;
- if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
+ if ( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
}
- if( xtype==etGENERIC ){
+ if ( xtype==etGENERIC ){
flag_rtz = !flag_alternateform;
- if( exp<-4 || exp>precision ){
+ if ( exp<-4 || exp>precision ){
xtype = etEXP;
}else{
precision = precision - exp;
}else{
flag_rtz = 0;
}
- if( xtype==etEXP ){
+ if ( xtype==etEXP ){
e2 = 0;
}else{
e2 = exp;
nsd = 0;
flag_dp = (precision>0) | flag_alternateform | flag_altform2;
/* The sign in front of the number */
- if( prefix ){
+ if ( prefix ){
*(bufpt++) = prefix;
}
/* Digits prior to the decimal point */
- if( e2<0 ){
+ if ( e2<0 ){
*(bufpt++) = '0';
}else{
for(; e2>=0; e2--){
}
}
/* The decimal point */
- if( flag_dp ){
+ if ( flag_dp ){
*(bufpt++) = '.';
}
/* "0" digits after the decimal point but before the first
*(bufpt++) = (char)et_getdigit(&realvalue,&nsd);
}
/* Remove trailing zeros and the "." if no digits follow the "." */
- if( flag_rtz && flag_dp ){
+ if ( flag_rtz && flag_dp ){
while( bufpt[-1]=='0' ) *(--bufpt) = 0;
assert( bufpt>buf );
- if( bufpt[-1]=='.' ){
- if( flag_altform2 ){
+ if ( bufpt[-1]=='.' ){
+ if ( flag_altform2 ){
*(bufpt++) = '0';
}else{
*(--bufpt) = 0;
}
}
/* Add the "eNNN" suffix */
- if( flag_exp || (xtype==etEXP && exp) ){
+ if ( flag_exp || (xtype==etEXP && exp) ){
*(bufpt++) = aDigits[infop->charset];
- if( exp<0 ){
+ if ( exp<0 ){
*(bufpt++) = '-'; exp = -exp;
}else{
*(bufpt++) = '+';
}
- if( exp>=100 ){
+ if ( exp>=100 ){
*(bufpt++) = (char)(exp/100)+'0'; /* 100's digit */
exp %= 100;
}
/* Special case: Add leading zeros if the flag_zeropad flag is
** set and we are not left justified */
- if( flag_zeropad && !flag_leftjustify && length < width){
+ if ( flag_zeropad && !flag_leftjustify && length < width){
int i;
int nPad = width - length;
for(i=width; i>=nPad; i--){
case etCHARLIT:
case etCHARX:
c = buf[0] = (char)(xtype==etCHARX ? va_arg(ap,int) : *++fmt);
- if( precision>=0 ){
+ if ( precision>=0 ){
for(idx=1; idx<precision; idx++) buf[idx] = (char)c;
length = precision;
}else{
case etSTRING:
case etDYNSTRING:
bufpt = va_arg(ap,char*);
- if( bufpt==0 ){
+ if ( bufpt==0 ){
bufpt = "";
- }else if( xtype==etDYNSTRING ){
+ }else if ( xtype==etDYNSTRING ){
zExtra = bufpt;
}
length = strlen(bufpt);
- if( precision>=0 && precision<length ) length = precision;
+ if ( precision>=0 && precision<length ) length = precision;
break;
case etSQLESCAPE:
case etSQLESCAPE2:
int needQuote;
char *escarg = va_arg(ap,char*);
isnull = escarg==0;
- if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
+ if ( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
for(i=n=0; (ch=escarg[i])!=0; i++){
- if( ch=='\'' || (xtype==etSQLESCAPE3 && ch=='\\')) n++;
+ if ( ch=='\'' || (xtype==etSQLESCAPE3 && ch=='\\')) n++;
}
needQuote = !isnull && xtype==etSQLESCAPE2;
n += i + 1 + needQuote*2;
- if( n>etBUFSIZE ){
+ if ( n>etBUFSIZE ){
bufpt = zExtra = malloc( n );
- if( bufpt==0 ) return -1;
+ if ( bufpt==0 ) return -1;
}else{
bufpt = buf;
}
j = 0;
- if( needQuote ) bufpt[j++] = '\'';
+ if ( needQuote ) bufpt[j++] = '\'';
for(i=0; (ch=escarg[i])!=0; i++){
bufpt[j++] = (char)ch;
- if( ch=='\'' || ( xtype==etSQLESCAPE3 && ch=='\\')) bufpt[j++] = (char)ch;
+ if ( ch=='\'' || ( xtype==etSQLESCAPE3 && ch=='\\')) bufpt[j++] = (char)ch;
}
- if( needQuote ) bufpt[j++] = '\'';
+ if ( needQuote ) bufpt[j++] = '\'';
bufpt[j] = 0;
length = j;
/* The precision is ignored on %q and %Q */
- /* if( precision>=0 && precision<length ) length = precision; */
+ /* if ( precision>=0 && precision<length ) length = precision; */
break;
}
#ifdef __UNSUPPORTED__
case etTOKEN: {
Token *pToken = va_arg(ap, Token*);
- if( pToken && pToken->z ){
+ if ( pToken && pToken->z ){
(*func)(arg, (char*)pToken->z, pToken->n);
}
length = width = 0;
int k = va_arg(ap, int);
struct SrcList_item *pItem = &pSrc->a[k];
assert( k>=0 && k<pSrc->nSrc );
- if( pItem->zDatabase && pItem->zDatabase[0] ){
+ if ( pItem->zDatabase && pItem->zDatabase[0] ){
(*func)(arg, pItem->zDatabase, strlen(pItem->zDatabase));
(*func)(arg, ".", 1);
}
** "length" characters long. The field width is "width". Do
** the output.
*/
- if( !flag_leftjustify ){
+ if ( !flag_leftjustify ){
register int nspace;
nspace = width-length;
- if( nspace>0 ){
+ if ( nspace>0 ){
count += nspace;
while( nspace>=etSPACESIZE ){
(*func)(arg,spaces,etSPACESIZE);
nspace -= etSPACESIZE;
}
- if( nspace>0 ) (*func)(arg,spaces,nspace);
+ if ( nspace>0 ) (*func)(arg,spaces,nspace);
}
}
- if( length>0 ){
+ if ( length>0 ){
(*func)(arg,bufpt,length);
count += length;
}
- if( flag_leftjustify ){
+ if ( flag_leftjustify ){
register int nspace;
nspace = width-length;
- if( nspace>0 ){
+ if ( nspace>0 ){
count += nspace;
while( nspace>=etSPACESIZE ){
(*func)(arg,spaces,etSPACESIZE);
nspace -= etSPACESIZE;
}
- if( nspace>0 ) (*func)(arg,spaces,nspace);
+ if ( nspace>0 ) (*func)(arg,spaces,nspace);
}
}
- if( zExtra ){
+ if ( zExtra ){
free(zExtra);
}
}/* End for loop over the format string */
static void mout(void *arg, const char *zNewText, int nNewChar){
struct sgMprintf *pM = (struct sgMprintf*)arg;
pM->nTotal += nNewChar;
- if( pM->nChar + nNewChar + 1 > pM->nAlloc ){
- if( pM->xRealloc==0 ){
+ if ( pM->nChar + nNewChar + 1 > pM->nAlloc ){
+ if ( pM->xRealloc==0 ){
nNewChar = pM->nAlloc - pM->nChar - 1;
}else{
pM->nAlloc = pM->nChar + nNewChar*2 + 1;
- if( pM->zText==pM->zBase ){
+ if ( pM->zText==pM->zBase ){
pM->zText = pM->xRealloc(0, pM->nAlloc);
- if( pM->zText && pM->nChar ){
+ if ( pM->zText && pM->nChar ){
memcpy(pM->zText, pM->zBase, pM->nChar);
}
}else{
char *zNew;
zNew = pM->xRealloc(pM->zText, pM->nAlloc);
- if( zNew ){
+ if ( zNew ){
pM->zText = zNew;
}
}
}
}
- if( pM->zText ){
- if( nNewChar>0 ){
+ if ( pM->zText ){
+ if ( nNewChar>0 ){
memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
pM->nChar += nNewChar;
}
sM.nAlloc = nInitBuf;
sM.xRealloc = xRealloc;
vxprintf(mout, &sM, useInternal, zFormat, ap);
- if( xRealloc ){
- if( sM.zText==sM.zBase ){
+ if ( xRealloc ){
+ if ( sM.zText==sM.zBase ){
sM.zText = xRealloc(0, sM.nChar+1);
- if( sM.zText ){
+ if ( sM.zText ){
memcpy(sM.zText, sM.zBase, sM.nChar+1);
}
- }else if( sM.nAlloc>sM.nChar+10 ){
+ }else if ( sM.nAlloc>sM.nChar+10 ){
char *zNew = xRealloc(sM.zText, sM.nChar+1);
- if( zNew ){
+ if ( zNew ){
sM.zText = zNew;
}
}
if (proto == SWITCH_NAT_TCP) {
sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 31104000);
- } else if(proto == SWITCH_NAT_UDP) {
+ } else if (proto == SWITCH_NAT_UDP) {
sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 31104000);
}
if (proto == SWITCH_NAT_TCP) {
r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
nat_globals.pvt_addr, "FreeSWITCH", "TCP", 0);
- } else if(proto == SWITCH_NAT_UDP) {
+ } else if (proto == SWITCH_NAT_UDP) {
r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
nat_globals.pvt_addr, "FreeSWITCH", "UDP", 0);
}
if (proto == SWITCH_NAT_TCP) {
sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 0);
- } else if(proto == SWITCH_NAT_UDP) {
+ } else if (proto == SWITCH_NAT_UDP) {
sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 0);
}
if (proto == SWITCH_NAT_TCP) {
r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "TCP", 0);
- } else if(proto == SWITCH_NAT_UDP) {
+ } else if (proto == SWITCH_NAT_UDP) {
r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "UDP", 0);
}
if (zrtp_session_info.sas_is_ready) {
if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
- } else if(zrtp_status_ok == zrtp_resolve_mitm_call(frame->extra_data, rtp_session->zrtp_ctx)) {
+ } else if (zrtp_status_ok == zrtp_resolve_mitm_call(frame->extra_data, rtp_session->zrtp_ctx)) {
switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid,
&rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);