SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session,
switch_input_callback_function_t dtmf_callback,
void *buf,
- unsigned int buflen,
- unsigned int timeout);
+ uint32_t buflen,
+ uint32_t timeout);
/*!
\brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up.
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf,
- unsigned int buflen,
- unsigned int maxdigits,
+ uint32_t buflen,
+ uint32_t maxdigits,
const char *terminators,
char *terminator,
- unsigned int timeout);
+ uint32_t timeout);
/*!
\brief Engage background Speech detection on a session
char *timer_name,
switch_input_callback_function_t dtmf_callback,
void *buf,
- unsigned int buflen);
+ uint32_t buflen);
char *file,
switch_input_callback_function_t dtmf_callback,
void *buf,
- unsigned int buflen);
+ uint32_t buflen);
/*!
\brief Function to evaluate an expression against a string
\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,
- unsigned int min_digits,
- unsigned int max_digits,
- unsigned int max_tries,
- unsigned int timeout,
+ uint32_t min_digits,
+ uint32_t max_digits,
+ uint32_t max_tries,
+ uint32_t timeout,
char* valid_terminators,
char* audio_file,
char* bad_input_audio_file,
void* digit_buffer,
- unsigned int digit_buffer_length,
+ uint32_t digit_buffer_length,
char* digits_regex);
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
switch_input_callback_function_t dtmf_callback,
char *text,
void *buf,
- unsigned int buflen);
+ uint32_t buflen);
/*!
\brief Speak given text with given tts engine
switch_input_callback_function_t dtmf_callback,
char *text,
void *buf,
- unsigned int buflen);
+ uint32_t buflen);
/*!
\brief Make an outgoing call
int timeout,
int max_failures,
int inlen,
- unsigned int flags,
switch_memory_pool_t *pool);
/*!
*/
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_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session,
switch_input_callback_function_t input_callback,
void *buf,
- unsigned int buflen,
- unsigned int timeout)
+ uint32_t buflen,
+ uint32_t timeout)
{
switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_time_t started = 0;
- unsigned int elapsed;
+ uint32_t elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
char dtmf[128];
if (timeout) {
- elapsed = (unsigned int)((switch_time_now() - started) / 1000);
+ elapsed = (uint32_t)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) {
break;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf,
- unsigned int buflen,
- unsigned int maxdigits,
+ uint32_t buflen,
+ uint32_t maxdigits,
const char *terminators,
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_status_t status = SWITCH_STATUS_SUCCESS;
switch_time_t started = 0;
- unsigned int elapsed;
+ uint32_t elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_event_t *event;
if (timeout) {
- elapsed = (unsigned int)((switch_time_now() - started) / 1000);
+ elapsed = (uint32_t)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) {
break;
}
if (switch_channel_has_dtmf(channel)) {
char dtmf[128];
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])) {
*terminator = dtmf[i];
char *file,
switch_input_callback_function_t input_callback,
void *buf,
- unsigned int buflen)
+ uint32_t buflen)
{
switch_channel_t *channel;
char dtmf[128];
char *timer_name,
switch_input_callback_function_t input_callback,
void *buf,
- unsigned int buflen)
+ uint32_t buflen)
{
switch_channel_t *channel;
int16_t abuf[FILE_STARTSAMPLES];
}
SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t *session,
- unsigned int min_digits,
- unsigned int max_digits,
- unsigned int max_tries,
- unsigned int timeout,
+ uint32_t min_digits,
+ uint32_t max_digits,
+ uint32_t max_tries,
+ uint32_t timeout,
char* valid_terminators,
char* prompt_audio_file,
char* bad_input_audio_file,
void* digit_buffer,
- unsigned int digit_buffer_length,
+ uint32_t digit_buffer_length,
char* digits_regex)
{
switch_input_callback_function_t input_callback,
char *text,
void *buf,
- unsigned int buflen)
+ uint32_t buflen)
{
switch_channel_t *channel;
short abuf[960];
switch_input_callback_function_t input_callback,
char *text,
void *buf,
- unsigned int buflen)
+ uint32_t buflen)
{
switch_channel_t *channel;
int interval = 0;
if (switch_core_speech_open(&sh,
tts_name,
voice_name,
- (unsigned int)rate,
+ (uint32_t)rate,
&flags,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
int max_failures;
int timeout;
int inlen;
- unsigned int flags;
+ uint32_t flags;
struct switch_ivr_menu_action *actions;
struct switch_ivr_menu *next;
switch_memory_pool_t *pool;
}
-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_ivr_menu_t *main,
char *name,
int timeout,
int max_failures,
int inlen,
- unsigned int flags,
switch_memory_pool_t *pool)
{
switch_ivr_menu_t *menu;
menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound);
menu->max_failures = max_failures;
menu->timeout = timeout;
- menu->flags |= flags;
menu->actions = NULL;
menu->inlen = inlen;
if (newpool) {
status = SWITCH_STATUS_SUCCESS;
break;
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;
break;
default:
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 */
- switch_ivr_menu_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
+ if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) { /* catch the fallback and recover */
+ switch_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
status = SWITCH_STATUS_SUCCESS;
running = 1;
continue;