[Freeswitch-svn] [commit] r3942 - in freeswitch/trunk/src: include mod/applications/mod_dptools mod/endpoints/mod_sofia
Freeswitch SVN
mikej at freeswitch.org
Wed Jan 10 16:26:10 EST 2007
Author: mikej
Date: Wed Jan 10 16:26:10 2007
New Revision: 3942
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Log:
completely untested redirect support, need to try this from a machine that can take sip calls.
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Jan 10 16:26:10 2007
@@ -302,6 +302,7 @@
SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required
SWITCH_MESSAGE_INDICATE_HOLD - indicate hold
SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold
+ SWITCH_MESSAGE_INDICATE_REDIRECT - indicate redirect
</pre>
*/
typedef enum {
@@ -316,6 +317,7 @@
SWITCH_MESSAGE_INDICATE_NOMEDIA,
SWITCH_MESSAGE_INDICATE_HOLD,
SWITCH_MESSAGE_INDICATE_UNHOLD,
+ SWITCH_MESSAGE_INDICATE_REDIRECT
} switch_core_session_message_types_t;
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 Wed Jan 10 16:26:10 2007
@@ -153,6 +153,20 @@
switch_channel_answer(channel);
}
+static void redirect_function(switch_core_session_t *session, char *data)
+{
+ switch_core_session_message_t msg = {0};
+
+ /* Tell the channel to redirect */
+ msg.from = __FILE__;
+ msg.string_arg = data;
+ msg.message_id = SWITCH_MESSAGE_INDICATE_REDIRECT;
+ switch_core_session_receive_message(session, &msg);
+
+}
+
+
+
static void set_function(switch_core_session_t *session, char *data)
{
switch_channel_t *channel;
@@ -455,13 +469,22 @@
/*.next */ &dptools_api_interface
};
+static const switch_application_interface_t redirect_application_interface = {
+ /*.interface_name */ "redirect",
+ /*.application_function */ redirect_function,
+ /* long_desc */ "Send a redirect message to a session.",
+ /* short_desc */ "Send session redirect",
+ /* syntax */ "<redirect_data>",
+ /*.next */ NULL
+};
+
static const switch_application_interface_t ivr_application_interface = {
/*.interface_name */ "ivr",
/*.application_function */ ivr_application_function,
/* long_desc */ "Run an ivr menu.",
/* short_desc */ "Run an ivr menu",
/* syntax */ "<menu_name>",
- /*.next */ NULL
+ /*.next */ &redirect_application_interface
};
static const switch_application_interface_t detect_speech_application_interface = {
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 Jan 10 16:26:10 2007
@@ -1885,6 +1885,12 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
}
break;
+ case SWITCH_MESSAGE_INDICATE_REDIRECT:
+ if(msg->string_arg) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-directing to %s\n", msg->string_arg);
+ nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
+ }
+ break;
case SWITCH_MESSAGE_INDICATE_RINGING:
nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
break;
More information about the Freeswitch-svn
mailing list