[Freeswitch-svn] [commit] r8342 - in freeswitch/trunk/src: . mod/applications/mod_dptools mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Fri May 9 15:59:42 EDT 2008
Author: anthm
Date: Fri May 9 15:59:42 2008
New Revision: 8342
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_originate.c
Log:
allow blind xfers on no-media calls
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri May 9 15:59:42 2008
@@ -1671,8 +1671,13 @@
&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying proxy mode 'till both legs are up.\n");
- no_media_bridge = 1;
+ if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
+ switch_ivr_media(switch_core_session_get_uuid(session), SMF_REBRIDGE);
+ switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already up, delaying proxy mode 'till both legs are up.\n");
+ no_media_bridge = 1;
+ }
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Fri May 9 15:59:42 2008
@@ -1520,7 +1520,7 @@
if (gateway) {
if (status == 200 || status == 404) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ping success %s\n", gateway->name);
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ping success %s\n", gateway->name);
gateway->status = SOFIA_GATEWAY_UP;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ping failed %s\n", gateway->name);
@@ -2159,11 +2159,6 @@
goto done;
}
- if (switch_channel_test_flag(channel_a, CF_PROXY_MODE)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Re-establishing media.\n");
- switch_ivr_media(switch_core_session_get_uuid(session), SMF_REBRIDGE);
- }
-
from = sip->sip_from;
to = sip->sip_to;
@@ -2189,6 +2184,15 @@
sip_replaces_t *replaces;
nua_handle_t *bnh;
char *rep;
+
+ if (switch_channel_test_flag(channel_a, CF_PROXY_MODE)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Attended Transfer BYPASS MEDIA CALLS!\n");
+ switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
+ nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+ NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
+ TAG_END());
+ goto done;
+ }
if ((rep = strchr(refer_to->r_url->url_headers, '='))) {
const char *br_a = NULL, *br_b = NULL;
@@ -2209,6 +2213,7 @@
sofia_private_t *b_private = NULL;
private_object_t *b_tech_pvt = NULL;
switch_core_session_t *b_session = NULL;
+
switch_channel_set_variable(channel_a, SOFIA_REPLACES_HEADER, rep);
if ((b_private = nua_handle_magic(bnh))) {
@@ -2347,7 +2352,7 @@
&tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL, SOF_NONE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", exten);
- nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+ nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
@@ -2404,6 +2409,9 @@
if (!switch_strlen_zero(full_ref_to)) {
switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
+
+
+
switch_ivr_session_transfer(b_session, exten, NULL, NULL);
switch_core_session_rwunlock(b_session);
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Fri May 9 15:59:42 2008
@@ -221,9 +221,7 @@
if ((pname = switch_event_get_header(event, "sofia-profile"))) {
- if ((profile = sofia_glue_find_profile(pname))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using profile %s\n", pname);
- } else {
+ if (!(profile = sofia_glue_find_profile(pname))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no profile %s\n", pname);
}
}
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri May 9 15:59:42 2008
@@ -112,8 +112,8 @@
switch_core_session_t *session;
switch_channel_state_t state;
switch_channel_state_t running_state;
- uint32_t flags;
- uint32_t state_flags;
+ switch_channel_flag_t flags;
+ switch_channel_flag_t state_flags;
switch_caller_profile_t *caller_profile;
const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
int state_handler_index;
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Fri May 9 15:59:42 2008
@@ -106,11 +106,6 @@
top:
- if (!(session->read_codec && session->read_codec->implementation)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
- return SWITCH_STATUS_FALSE;
- }
-
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
*frame = NULL;
return SWITCH_STATUS_FALSE;
@@ -165,7 +160,14 @@
}
switch_assert((*frame)->codec != NULL);
- if ((session->read_codec && (*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) {
+
+ if (!(session->read_codec && session->read_codec->implementation)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
+ abort();
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (((*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) {
need_codec = TRUE;
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri May 9 15:59:42 2008
@@ -60,6 +60,11 @@
break;
}
+ if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+ switch_yield(1000);
+ continue;
+ }
+
if (switch_channel_test_flag(channel, CF_SERVICE) ||
(!switch_channel_test_flag(channel, CF_ANSWERED) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
switch_yield(1000);
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Fri May 9 15:59:42 2008
@@ -38,8 +38,10 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA) {
- switch_ivr_sleep(session, 10);
+ if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+ while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA) {
+ switch_ivr_sleep(session, 10);
+ }
}
switch_channel_clear_state_handler(channel, &originate_state_handlers);
@@ -1057,10 +1059,12 @@
}
}
- /* read from the channel while we wait if the audio is up on it */
- if (session && (ringback_data ||
- !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MODE))) &&
- (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA))) {
+ /* read from the channel while we wait if the audio is up on it */
+ if (session &&
+ !switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
+ !switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
+ (ringback_data || (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
+
switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
More information about the Freeswitch-svn
mailing list