[Freeswitch-svn] [commit] r5718 - in freeswitch/trunk/src: include mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Wed Sep 19 14:24:47 EDT 2007
Author: anthm
Date: Wed Sep 19 14:24:47 2007
New Revision: 5718
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Log:
initial blind crack at passing reinvites across no-media bridges
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Sep 19 14:24:47 2007
@@ -387,6 +387,7 @@
SWITCH_MESSAGE_INDICATE_REDIRECT - indicate redirect
SWITCH_MESSAGE_INDICATE_REJECT - indicate reject
SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast
+ SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast
</pre>
*/
typedef enum {
@@ -404,7 +405,8 @@
SWITCH_MESSAGE_INDICATE_UNHOLD,
SWITCH_MESSAGE_INDICATE_REDIRECT,
SWITCH_MESSAGE_INDICATE_REJECT,
- SWITCH_MESSAGE_INDICATE_BROADCAST
+ SWITCH_MESSAGE_INDICATE_BROADCAST,
+ SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT
} switch_core_session_message_types_t;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Sep 19 14:24:47 2007
@@ -689,7 +689,8 @@
switch_channel_mark_answered(channel);
}
break;
- case SWITCH_MESSAGE_INDICATE_NOMEDIA: {
+ case SWITCH_MESSAGE_INDICATE_NOMEDIA:
+ {
char *uuid;
switch_core_session_t *other_session;
switch_channel_t *other_channel;
@@ -715,16 +716,26 @@
sofia_glue_tech_absorb_sdp(tech_pvt);
}
sofia_glue_do_invite(session);
- }
+ }
break;
- case SWITCH_MESSAGE_INDICATE_MEDIA:{
- uint32_t count = 0;
- if (switch_channel_get_state(channel) >= CS_HANGUP) {
- return SWITCH_STATUS_FALSE;
+ case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending media re-direct:\n%s\n", msg->string_arg);
+ tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
+ sofia_glue_do_invite(session);
}
+ break;
+
+ case SWITCH_MESSAGE_INDICATE_MEDIA:
+ {
+ uint32_t count = 0;
- switch_channel_clear_flag(channel, CF_BYPASS_MEDIA);
+ if (switch_channel_get_state(channel) >= CS_HANGUP) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_channel_clear_flag(channel, CF_BYPASS_MEDIA);
tech_pvt->local_sdp_str = NULL;
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
sofia_glue_tech_prepare_codecs(tech_pvt);
@@ -751,13 +762,15 @@
}
break;
- case SWITCH_MESSAGE_INDICATE_HOLD:{
+ case SWITCH_MESSAGE_INDICATE_HOLD:
+ {
switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
}
break;
-
- case SWITCH_MESSAGE_INDICATE_UNHOLD:{
+
+ case SWITCH_MESSAGE_INDICATE_UNHOLD:
+ {
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
}
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 Wed Sep 19 14:24:47 2007
@@ -1210,6 +1210,19 @@
if (r_sdp) {
if (switch_channel_test_flag(channel, CF_BYPASS_MEDIA)) {
+ if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
+ && (other_session = switch_core_session_locate(uuid))) {
+ switch_core_session_message_t msg = { 0 };
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT;
+ msg.from = __FILE__;
+ msg.string_arg = (char *) r_sdp;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
+ switch_core_session_receive_message(other_session, &msg);
+ switch_core_session_rwunlock(other_session);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Re-INVITE to a no-media channel that is not in a bridge.\n");
+ }
goto done;
} else {
if (tech_pvt->num_codecs) {
More information about the Freeswitch-svn
mailing list