git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3320 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-11-12 00:38:31 +00:00
parent 8f8396d741
commit c8733f2b8a
2 changed files with 39 additions and 69 deletions

View File

@ -75,8 +75,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen, uint32_t buflen,
unsigned int timeout); uint32_t timeout);
/*! /*!
\brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up. \brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up.
@ -91,11 +91,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
*/ */
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf, char *buf,
unsigned int buflen, uint32_t buflen,
unsigned int maxdigits, uint32_t maxdigits,
const char *terminators, const char *terminators,
char *terminator, char *terminator,
unsigned int timeout); uint32_t timeout);
/*! /*!
\brief Engage background Speech detection on a session \brief Engage background Speech detection on a session
@ -187,7 +187,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
char *timer_name, char *timer_name,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen); uint32_t buflen);
@ -207,7 +207,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
char *file, char *file,
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
void *buf, void *buf,
unsigned int buflen); uint32_t buflen);
/*! /*!
\brief Function to evaluate an expression against a string \brief Function to evaluate an expression against a string
@ -234,15 +234,15 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expressio
\note to test for digit capture failure look for \\0 in the first position of the buffer \note to test for digit capture failure look for \\0 in the first position of the buffer
*/ */
SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session,
unsigned int min_digits, uint32_t min_digits,
unsigned int max_digits, uint32_t max_digits,
unsigned int max_tries, uint32_t max_tries,
unsigned int timeout, uint32_t timeout,
char* valid_terminators, char* valid_terminators,
char* audio_file, char* audio_file,
char* bad_input_audio_file, char* bad_input_audio_file,
void* digit_buffer, void* digit_buffer,
unsigned int digit_buffer_length, uint32_t digit_buffer_length,
char* digits_regex); char* digits_regex);
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
@ -252,7 +252,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
char *text, char *text,
void *buf, void *buf,
unsigned int buflen); uint32_t buflen);
/*! /*!
\brief Speak given text with given tts engine \brief Speak given text with given tts engine
@ -275,7 +275,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_input_callback_function_t dtmf_callback, switch_input_callback_function_t dtmf_callback,
char *text, char *text,
void *buf, void *buf,
unsigned int buflen); uint32_t buflen);
/*! /*!
\brief Make an outgoing call \brief Make an outgoing call
@ -457,7 +457,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new,
int timeout, int timeout,
int max_failures, int max_failures,
int inlen, int inlen,
unsigned int flags,
switch_memory_pool_t *pool); switch_memory_pool_t *pool);
/*! /*!
@ -501,10 +500,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
*/ */
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_free_stack(switch_ivr_menu_t *stack); SWITCH_DECLARE(switch_status_t) switch_ivr_menu_free_stack(switch_ivr_menu_t *stack);
SWITCH_DECLARE(int) switch_ivr_menu_set_flag(switch_ivr_menu_t *menu, unsigned int flags);
SWITCH_DECLARE(int) switch_ivr_menu_clear_flag(switch_ivr_menu_t *menu, unsigned int flags);
SWITCH_DECLARE(int) switch_ivr_menu_test_flag(switch_ivr_menu_t *menu, unsigned int flags);
/** @} */ /** @} */
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C

View File

@ -176,13 +176,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session)
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session,
switch_input_callback_function_t input_callback, switch_input_callback_function_t input_callback,
void *buf, void *buf,
unsigned int buflen, uint32_t buflen,
unsigned int timeout) uint32_t timeout)
{ {
switch_channel_t *channel; switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_time_t started = 0; switch_time_t started = 0;
unsigned int elapsed; uint32_t elapsed;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
assert(channel != NULL); assert(channel != NULL);
@ -201,7 +201,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
char dtmf[128]; char dtmf[128];
if (timeout) { if (timeout) {
elapsed = (unsigned int)((switch_time_now() - started) / 1000); elapsed = (uint32_t)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) { if (elapsed >= timeout) {
break; break;
} }
@ -243,17 +243,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf, char *buf,
unsigned int buflen, uint32_t buflen,
unsigned int maxdigits, uint32_t maxdigits,
const char *terminators, const char *terminators,
char *terminator, char *terminator,
unsigned int timeout) uint32_t timeout)
{ {
unsigned int i = 0, x = (unsigned int) strlen(buf); uint32_t i = 0, x = (uint32_t) strlen(buf);
switch_channel_t *channel; switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_time_t started = 0; switch_time_t started = 0;
unsigned int elapsed; uint32_t elapsed;
channel = switch_core_session_get_channel(session); channel = switch_core_session_get_channel(session);
assert(channel != NULL); assert(channel != NULL);
@ -278,7 +278,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
switch_event_t *event; switch_event_t *event;
if (timeout) { if (timeout) {
elapsed = (unsigned int)((switch_time_now() - started) / 1000); elapsed = (uint32_t)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) { if (elapsed >= timeout) {
break; break;
} }
@ -292,7 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
if (switch_channel_has_dtmf(channel)) { if (switch_channel_has_dtmf(channel)) {
char dtmf[128]; char dtmf[128];
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
for(i =0 ; i < (unsigned int) strlen(dtmf); i++) { for(i =0 ; i < (uint32_t) strlen(dtmf); i++) {
if (strchr(terminators, dtmf[i])) { if (strchr(terminators, dtmf[i])) {
*terminator = dtmf[i]; *terminator = dtmf[i];
@ -327,7 +327,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
char *file, char *file,
switch_input_callback_function_t input_callback, switch_input_callback_function_t input_callback,
void *buf, void *buf,
unsigned int buflen) uint32_t buflen)
{ {
switch_channel_t *channel; switch_channel_t *channel;
char dtmf[128]; char dtmf[128];
@ -911,7 +911,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
char *timer_name, char *timer_name,
switch_input_callback_function_t input_callback, switch_input_callback_function_t input_callback,
void *buf, void *buf,
unsigned int buflen) uint32_t buflen)
{ {
switch_channel_t *channel; switch_channel_t *channel;
int16_t abuf[FILE_STARTSAMPLES]; int16_t abuf[FILE_STARTSAMPLES];
@ -1298,15 +1298,15 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(char *target, char *expressio
} }
SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session,
unsigned int min_digits, uint32_t min_digits,
unsigned int max_digits, uint32_t max_digits,
unsigned int max_tries, uint32_t max_tries,
unsigned int timeout, uint32_t timeout,
char* valid_terminators, char* valid_terminators,
char* prompt_audio_file, char* prompt_audio_file,
char* bad_input_audio_file, char* bad_input_audio_file,
void* digit_buffer, void* digit_buffer,
unsigned int digit_buffer_length, uint32_t digit_buffer_length,
char* digits_regex) char* digits_regex)
{ {
@ -1423,7 +1423,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
switch_input_callback_function_t input_callback, switch_input_callback_function_t input_callback,
char *text, char *text,
void *buf, void *buf,
unsigned int buflen) uint32_t buflen)
{ {
switch_channel_t *channel; switch_channel_t *channel;
short abuf[960]; short abuf[960];
@ -1614,7 +1614,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_input_callback_function_t input_callback, switch_input_callback_function_t input_callback,
char *text, char *text,
void *buf, void *buf,
unsigned int buflen) uint32_t buflen)
{ {
switch_channel_t *channel; switch_channel_t *channel;
int interval = 0; int interval = 0;
@ -1640,7 +1640,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
if (switch_core_speech_open(&sh, if (switch_core_speech_open(&sh,
tts_name, tts_name,
voice_name, voice_name,
(unsigned int)rate, (uint32_t)rate,
&flags, &flags,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
@ -3247,7 +3247,7 @@ struct switch_ivr_menu {
int max_failures; int max_failures;
int timeout; int timeout;
int inlen; int inlen;
unsigned int flags; uint32_t flags;
struct switch_ivr_menu_action *actions; struct switch_ivr_menu_action *actions;
struct switch_ivr_menu *next; struct switch_ivr_menu *next;
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
@ -3286,29 +3286,6 @@ static void switch_ivr_menu_stack(switch_ivr_menu_t **top, switch_ivr_menu_t *bo
} }
SWITCH_DECLARE(int) switch_ivr_menu_set_flag(switch_ivr_menu_t *menu, unsigned int flags)
{
if (flags) {
menu->flags |= flags;
}
return menu->flags;
}
SWITCH_DECLARE(int) switch_ivr_menu_clear_flag(switch_ivr_menu_t *menu, unsigned int flags)
{
if (flags) {
menu->flags &= ~flags;
}
return menu->flags;
}
SWITCH_DECLARE(int) switch_ivr_menu_test_flag(switch_ivr_menu_t *menu, unsigned int flags)
{
return (menu->flags & flags);
}
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new, SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new,
switch_ivr_menu_t *main, switch_ivr_menu_t *main,
char *name, char *name,
@ -3318,7 +3295,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new,
int timeout, int timeout,
int max_failures, int max_failures,
int inlen, int inlen,
unsigned int flags,
switch_memory_pool_t *pool) switch_memory_pool_t *pool)
{ {
switch_ivr_menu_t *menu; switch_ivr_menu_t *menu;
@ -3347,7 +3323,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new,
menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound); menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound);
menu->max_failures = max_failures; menu->max_failures = max_failures;
menu->timeout = timeout; menu->timeout = timeout;
menu->flags |= flags;
menu->actions = NULL; menu->actions = NULL;
menu->inlen = inlen; menu->inlen = inlen;
if (newpool) { if (newpool) {
@ -3535,7 +3510,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
break; break;
case SWITCH_IVR_ACTION_TOMAIN: case SWITCH_IVR_ACTION_TOMAIN:
switch_ivr_menu_set_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN); switch_set_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
status = SWITCH_STATUS_BREAK; status = SWITCH_STATUS_BREAK;
break; break;
default: default:
@ -3547,8 +3522,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) { /* top level */ if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) { /* top level */
if (switch_ivr_menu_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) { /* catch the fallback and recover */ if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) { /* catch the fallback and recover */
switch_ivr_menu_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN); switch_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
running = 1; running = 1;
continue; continue;