git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9649 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-09-25 19:53:43 +00:00
parent d7acc6dbaa
commit 93ff90696b
5 changed files with 58 additions and 15 deletions

View File

@ -275,9 +275,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_generate_session(swi
/*!
\brief - NEEDDESC -
\param session the session to act on
\return SWITCH_STATUS_SUCCESS if all is well - maybe more XXX FIXME
*/
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args);
/*!
\brief Stop looking for TONES

View File

@ -1238,7 +1238,7 @@ SWITCH_STANDARD_APP(stop_fax_detect_session_function)
SWITCH_STANDARD_APP(echo_function)
{
switch_ivr_session_echo(session);
switch_ivr_session_echo(session, NULL);
}
SWITCH_STANDARD_APP(park_function)

View File

@ -37,20 +37,20 @@
static void switch_core_standard_on_init(switch_core_session_t *session)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard INIT %s\n", switch_channel_get_name(session->channel));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard INIT\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_hangup(switch_core_session_t *session)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HANGUP %s, cause: %s\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
}
static void switch_core_standard_on_reset(switch_core_session_t *session)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n", switch_channel_get_name(session->channel));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard RESET\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_routing(switch_core_session_t *session)
@ -61,7 +61,7 @@ static void switch_core_standard_on_routing(switch_core_session_t *session)
char *expanded = NULL;
char *dpstr = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard ROUTING %s\n", switch_channel_get_name(session->channel));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't get profile!\n");
@ -126,7 +126,7 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
{
switch_caller_extension_t *extension;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard EXECUTE\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel));
top:
switch_channel_clear_flag(session->channel, CF_RESET);
@ -164,20 +164,19 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
static void switch_core_standard_on_exchange_media(switch_core_session_t *session)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard LOOPBACK\n");
switch_ivr_session_echo(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard EXCHANGE_MEDIA\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_soft_execute(switch_core_session_t *session)
{
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard TRANSMIT\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard SOFT_EXECUTE\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_park(switch_core_session_t *session)
{
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard PARK\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard PARK\n", switch_channel_get_name(session->channel));
switch_channel_clear_flag(session->channel, CF_TRANSFER);
switch_core_session_reset(session, SWITCH_TRUE);
switch_ivr_park(session, NULL);
@ -186,13 +185,13 @@ static void switch_core_standard_on_park(switch_core_session_t *session)
static void switch_core_standard_on_consume_media(switch_core_session_t *session)
{
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HOLD\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard CONSUME_MEDIA\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_hibernate(switch_core_session_t *session)
{
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HIBERNATE\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard HIBERNATE\n", switch_channel_get_name(session->channel));
}
#include <sqlite3.h>

View File

@ -67,7 +67,7 @@ static void *SWITCH_THREAD_FUNC echo_video_thread(switch_thread_t *thread, void
}
#endif
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args)
{
switch_status_t status;
switch_frame_t *read_frame;
@ -95,6 +95,47 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
if (switch_core_session_private_event_count(session)) {
switch_ivr_parse_all_events(session);
}
if (args && (args->input_callback || args->buf || args->buflen)) {
switch_dtmf_t dtmf;
/*
dtmf handler function you can hook up to be executed when a digit is dialed during playback
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/
if (switch_channel_has_dtmf(channel)) {
if (!args->input_callback && !args->buf) {
status = SWITCH_STATUS_BREAK;
break;
}
switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
status = SWITCH_STATUS_BREAK;
}
}
if (args->input_callback) {
switch_event_t *event = NULL;
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
switch_event_destroy(&event);
}
}
if (status != SWITCH_STATUS_SUCCESS) {
break;
}
}
switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
#ifndef SWITCH_VIDEO_IN_THREADS

View File

@ -657,6 +657,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
break;
}
if (switch_core_session_private_event_count(session)) {
switch_ivr_parse_all_events(session);
}
if (args && (args->input_callback || args->buf || args->buflen)) {
/*
dtmf handler function you can hook up to be executed when a digit is dialed during gentones