completely untested redirect support, need to try this from a machine that can take sip calls.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3942 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ff04adf449
commit
d83b399d96
|
@ -302,6 +302,7 @@ typedef enum {
|
||||||
SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required
|
SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required
|
||||||
SWITCH_MESSAGE_INDICATE_HOLD - indicate hold
|
SWITCH_MESSAGE_INDICATE_HOLD - indicate hold
|
||||||
SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold
|
SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold
|
||||||
|
SWITCH_MESSAGE_INDICATE_REDIRECT - indicate redirect
|
||||||
</pre>
|
</pre>
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -316,6 +317,7 @@ typedef enum {
|
||||||
SWITCH_MESSAGE_INDICATE_NOMEDIA,
|
SWITCH_MESSAGE_INDICATE_NOMEDIA,
|
||||||
SWITCH_MESSAGE_INDICATE_HOLD,
|
SWITCH_MESSAGE_INDICATE_HOLD,
|
||||||
SWITCH_MESSAGE_INDICATE_UNHOLD,
|
SWITCH_MESSAGE_INDICATE_UNHOLD,
|
||||||
|
SWITCH_MESSAGE_INDICATE_REDIRECT
|
||||||
} switch_core_session_message_types_t;
|
} switch_core_session_message_types_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,20 @@ static void answer_function(switch_core_session_t *session, char *data)
|
||||||
switch_channel_answer(channel);
|
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)
|
static void set_function(switch_core_session_t *session, char *data)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
|
@ -455,13 +469,22 @@ static switch_api_interface_t presence_api_interface = {
|
||||||
/*.next */ &dptools_api_interface
|
/*.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 = {
|
static const switch_application_interface_t ivr_application_interface = {
|
||||||
/*.interface_name */ "ivr",
|
/*.interface_name */ "ivr",
|
||||||
/*.application_function */ ivr_application_function,
|
/*.application_function */ ivr_application_function,
|
||||||
/* long_desc */ "Run an ivr menu.",
|
/* long_desc */ "Run an ivr menu.",
|
||||||
/* short_desc */ "Run an ivr menu",
|
/* short_desc */ "Run an ivr menu",
|
||||||
/* syntax */ "<menu_name>",
|
/* syntax */ "<menu_name>",
|
||||||
/*.next */ NULL
|
/*.next */ &redirect_application_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
static const switch_application_interface_t detect_speech_application_interface = {
|
static const switch_application_interface_t detect_speech_application_interface = {
|
||||||
|
|
|
@ -1885,6 +1885,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case SWITCH_MESSAGE_INDICATE_RINGING:
|
||||||
nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
|
nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue