mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-28 06:04:20 +00:00
if space
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15893 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
376861fd8c
commit
21e3bb970a
24 files changed
+167
-167
No files matched your search
@@ -874,7 +874,7 @@ static int activate_rtp(struct private_object *tech_pvt)
|
||||
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);
|
||||
@@ -1232,7 +1232,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
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);
|
||||
}
|
||||
@@ -1247,9 +1247,9 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1685,13 +1685,13 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -2270,11 +2270,11 @@ SWITCH_STANDARD_API(dl_login)
|
||||
|
||||
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) ||
|
||||
@@ -2311,7 +2311,7 @@ static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_pr
|
||||
) {
|
||||
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) ||
|
||||
@@ -2324,7 +2324,7 @@ static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_pr
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -2337,7 +2337,7 @@ static switch_status_t destroy_profile(char *name)
|
||||
{
|
||||
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);
|
||||
@@ -2347,21 +2347,21 @@ static switch_status_t destroy_profile(char *name)
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -2448,8 +2448,8 @@ static switch_status_t soft_reload(void)
|
||||
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);
|
||||
@@ -2471,7 +2471,7 @@ static switch_status_t soft_reload(void)
|
||||
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);
|
||||
@@ -2481,7 +2481,7 @@ static switch_status_t soft_reload(void)
|
||||
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);
|
||||
}
|
||||
@@ -2928,13 +2928,13 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
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;
|
||||
|
||||
@@ -3098,7 +3098,7 @@ struct iax_event *iax_get_event(int blocking) {
|
||||
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) {
|
||||
@@ -3107,7 +3107,7 @@ struct iax_event *iax_get_event(int blocking) {
|
||||
}
|
||||
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));
|
||||
@@ -3125,7 +3125,7 @@ struct iax_event *iax_get_event(int blocking) {
|
||||
}
|
||||
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:
|
||||
|
||||
@@ -380,7 +380,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
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) {
|
||||
|
||||
@@ -1090,7 +1090,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1302,7 +1302,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -4671,7 +4671,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
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,
|
||||
|
||||
@@ -2848,7 +2848,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha
|
||||
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;
|
||||
@@ -2856,7 +2856,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -4385,10 +4385,10 @@ sofia_destination_t* sofia_glue_get_destination(char *data)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -4415,7 +4415,7 @@ sofia_destination_t* sofia_glue_get_destination(char *data)
|
||||
goto mem_fail;
|
||||
}
|
||||
|
||||
if((eoc = strstr(to, ";fs_path="))) {
|
||||
if ((eoc = strstr(to, ";fs_path="))) {
|
||||
*eoc++ = '>';
|
||||
*eoc = '\0';
|
||||
}
|
||||
@@ -4495,7 +4495,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ void sofia_sla_handle_register(nua_t *nua, sofia_profile_t *profile, sip_t const
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user