[Freeswitch-trunk] [commit] r6625 - freeswitch/trunk/src
Freeswitch SVN
mikej at freeswitch.org
Mon Dec 10 23:21:55 EST 2007
Author: mikej
Date: Mon Dec 10 23:21:54 2007
New Revision: 6625
Modified:
freeswitch/trunk/src/switch_ivr.c
Log:
reduce indentation / cleanup
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Mon Dec 10 23:21:54 2007
@@ -74,7 +74,6 @@
}
}
-
return status;
}
@@ -128,28 +127,27 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- if (switch_channel_test_flag(channel, CF_UNICAST)) {
- if ((conninfo = switch_channel_get_private(channel, "unicast"))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down unicast connection\n");
- switch_clear_flag_locked(conninfo, SUF_READY);
- switch_socket_shutdown(conninfo->socket, SWITCH_SHUTDOWN_READWRITE);
- while(switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
- switch_yield(10000);
- if (++sanity >= 10000) {
- break;
- }
- }
- if (conninfo->read_codec.implementation) {
- switch_core_codec_destroy(&conninfo->read_codec);
+ if (!switch_channel_test_flag(channel, CF_UNICAST)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if ((conninfo = switch_channel_get_private(channel, "unicast"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down unicast connection\n");
+ switch_clear_flag_locked(conninfo, SUF_READY);
+ switch_socket_shutdown(conninfo->socket, SWITCH_SHUTDOWN_READWRITE);
+ while(switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
+ switch_yield(10000);
+ if (++sanity >= 10000) {
+ break;
}
- switch_socket_close(conninfo->socket);
}
- switch_channel_clear_flag(channel, CF_UNICAST);
- return SWITCH_STATUS_SUCCESS;
+ if (conninfo->read_codec.implementation) {
+ switch_core_codec_destroy(&conninfo->read_codec);
+ }
+ switch_socket_close(conninfo->socket);
}
-
- return SWITCH_STATUS_FALSE;
-
+ switch_channel_clear_flag(channel, CF_UNICAST);
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
@@ -219,7 +217,6 @@
conninfo->write_frame.data = conninfo->write_frame_data;
conninfo->write_frame.buflen = sizeof(conninfo->write_frame_data);
conninfo->write_frame.codec = switch_test_flag(conninfo, SUF_NATIVE) ? read_codec : &conninfo->read_codec;
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n",
conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
@@ -256,8 +253,6 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure creating unicast connection %s:%d->%s:%d\n",
conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
return SWITCH_STATUS_FALSE;
-
-
}
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *session, switch_event_t *event)
@@ -290,7 +285,6 @@
switch_channel_set_flag(channel, CF_EVENT_LOCK);
}
-
if (lead_frames) {
switch_frame_t *read_frame;
int frame_count = atoi(lead_frames);
@@ -380,7 +374,6 @@
switch_channel_clear_flag(channel, CF_EVENT_LOCK);
return status;
-
}
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_t *session)
@@ -814,22 +807,17 @@
}
if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
- //switch_ivr_parse_all_events(session);
switch_core_session_receive_message(session, &msg);
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_ivr_parse_all_events(other_session);
switch_core_session_receive_message(other_session, &msg);
switch_channel_clear_state_handler(other_channel, NULL);
-
}
-
-
if (other_channel) {
switch_channel_clear_state_handler(channel, NULL);
if (swap) {
@@ -959,7 +947,6 @@
prefix = 1;
}
-
if (var && !prefix) {
if ((val = switch_channel_get_variable(chana, var))) {
switch_channel_set_variable(chanb, var, val);
@@ -1112,7 +1099,6 @@
parser->minlen = 0;
parser->maxlen = 0;
}
-
}
}
if (status != SWITCH_STATUS_SUCCESS) {
@@ -1289,30 +1275,25 @@
SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channel_t *channel, int off)
{
- switch_event_header_t *hi;
switch_xml_t variable;
+ switch_event_header_t *hi = switch_channel_variable_first(channel);
- if ((hi = switch_channel_variable_first(channel))) {
- for (; hi; hi = hi->next) {
- char *vvar = hi->name;
- char *vval = hi->value;
- if (vvar && vval) {
- if ((variable = switch_xml_add_child_d(xml, (char *) vvar, off++))) {
- char *data;
- char *value = (char *) vval;
- switch_size_t dlen = strlen(value) * 3;
-
- if ((data = malloc(dlen))) {
- memset(data, 0, dlen);
- switch_url_encode(value, data, dlen);
- switch_xml_set_txt_d(variable, data);
- free(data);
- }
- }
+ if (!hi) return off;
+
+ for (; hi; hi = hi->next) {
+ if (hi->name && hi->value && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
+ char *data;
+ switch_size_t dlen = strlen(hi->value) * 3;
+
+ if ((data = malloc(dlen))) {
+ memset(data, 0, dlen);
+ switch_url_encode(hi->value, data, dlen);
+ switch_xml_set_txt_d(variable, data);
+ free(data);
}
}
- switch_channel_variable_last(channel);
}
+ switch_channel_variable_last(channel);
return off;
}
@@ -1430,10 +1411,8 @@
}
}
}
-
}
-
if (!(x_main_cp = switch_xml_add_child_d(x_callflow, "caller_profile", cf_off++))) {
goto error;
}
@@ -1469,7 +1448,6 @@
}
}
-
if (caller_profile->times) {
int t_off = 0;
if (!(x_times = switch_xml_add_child_d(x_callflow, "times", cf_off++))) {
@@ -1503,9 +1481,6 @@
caller_profile = caller_profile->next;
}
-
-
-
*xml_cdr = cdr;
return SWITCH_STATUS_SUCCESS;
More information about the Freeswitch-trunk
mailing list