2006-01-26 18:00:27 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* switch_ivr.h -- IVR Library
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file switch_ivr.h
|
|
|
|
* @brief IVR Library
|
|
|
|
* @see switch_ivr
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SWITCH_IVR_H
|
|
|
|
#define SWITCH_IVR_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <switch.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup switch_ivr IVR Library
|
|
|
|
* @ingroup FREESWITCH
|
|
|
|
* A group of core functions to do IVR related functions designed to be
|
|
|
|
* building blocks for a higher level IVR interface.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2006-01-27 21:33:45 +00:00
|
|
|
/*!
|
|
|
|
\brief Wait for DTMF digits calling a pluggable callback function when digits are collected.
|
|
|
|
\param session the session to read.
|
2006-01-27 22:21:02 +00:00
|
|
|
\param dtmf_callback code to execute if any dtmf is dialed during the recording
|
|
|
|
\param buf an object to maintain across calls
|
|
|
|
\param buflen the size of buf
|
2006-01-27 21:33:45 +00:00
|
|
|
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_collect_digits_callback(switch_core_session *session,
|
|
|
|
switch_dtmf_callback_function dtmf_callback,
|
|
|
|
void *buf,
|
|
|
|
unsigned int buflen);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up.
|
|
|
|
\param session the session to read.
|
|
|
|
\param buf strig to write to
|
|
|
|
\param buflen max size of buf
|
|
|
|
\param maxdigits max number of digits to read
|
|
|
|
\param terminators digits to end the collection
|
|
|
|
\param terminator actual digit that caused the collection to end (if any)
|
2006-03-07 20:31:48 +00:00
|
|
|
\param timeout timeout in ms
|
|
|
|
\param poll_channel flag to specify if you want the function to poll the channel while running
|
2006-01-27 21:33:45 +00:00
|
|
|
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_collect_digits_count(switch_core_session *session,
|
|
|
|
char *buf,
|
|
|
|
unsigned int buflen,
|
2006-01-27 23:47:45 +00:00
|
|
|
unsigned int maxdigits,
|
2006-01-27 21:33:45 +00:00
|
|
|
const char *terminators,
|
2006-03-01 00:58:32 +00:00
|
|
|
char *terminator,
|
|
|
|
unsigned int timeout,
|
|
|
|
unsigned int poll_channel);
|
2006-01-27 21:33:45 +00:00
|
|
|
|
2006-01-26 18:00:27 +00:00
|
|
|
/*!
|
|
|
|
\brief play a file from the disk to the session
|
|
|
|
\param session the session to play the file too
|
2006-03-07 20:31:48 +00:00
|
|
|
\param fh file handle to use (NULL for builtin one)
|
2006-01-26 18:00:27 +00:00
|
|
|
\param file the path to the file
|
|
|
|
\param timer_name the name of a timer to use input will be absorbed (NULL to time off the session input).
|
|
|
|
\param dtmf_callback code to execute if any dtmf is dialed during the playback
|
2006-01-27 22:21:02 +00:00
|
|
|
\param buf an object to maintain across calls
|
|
|
|
\param buflen the size of buf
|
2006-01-26 18:00:27 +00:00
|
|
|
\return SWITCH_STATUS_SUCCESS if all is well
|
2006-01-27 21:33:45 +00:00
|
|
|
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback.
|
2006-01-26 18:00:27 +00:00
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
|
2006-02-28 02:08:42 +00:00
|
|
|
switch_file_handle *fh,
|
2006-01-26 18:00:27 +00:00
|
|
|
char *file,
|
|
|
|
char *timer_name,
|
2006-01-27 21:33:45 +00:00
|
|
|
switch_dtmf_callback_function dtmf_callback,
|
|
|
|
void *buf,
|
|
|
|
unsigned int buflen);
|
2006-01-27 01:46:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief record a file from the session to a file
|
|
|
|
\param session the session to record from
|
2006-03-07 20:31:48 +00:00
|
|
|
\param fh file handle to use
|
2006-01-27 01:46:14 +00:00
|
|
|
\param file the path to the file
|
|
|
|
\param dtmf_callback code to execute if any dtmf is dialed during the recording
|
2006-01-27 22:21:02 +00:00
|
|
|
\param buf an object to maintain across calls
|
|
|
|
\param buflen the size of buf
|
2006-01-27 01:46:14 +00:00
|
|
|
\return SWITCH_STATUS_SUCCESS if all is well
|
2006-01-27 21:33:45 +00:00
|
|
|
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
|
2006-01-27 01:46:14 +00:00
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_record_file(switch_core_session *session,
|
2006-03-01 04:47:34 +00:00
|
|
|
switch_file_handle *fh,
|
2006-01-27 01:46:14 +00:00
|
|
|
char *file,
|
2006-01-27 21:33:45 +00:00
|
|
|
switch_dtmf_callback_function dtmf_callback,
|
|
|
|
void *buf,
|
|
|
|
unsigned int buflen);
|
|
|
|
|
|
|
|
|
2006-03-01 00:58:32 +00:00
|
|
|
/*!
|
|
|
|
\brief Speak given text with given tts engine
|
|
|
|
\param session the session to speak on
|
2006-03-07 20:31:48 +00:00
|
|
|
\param tts_name the desired tts module
|
2006-03-01 00:58:32 +00:00
|
|
|
\param voice_name the desired voice
|
|
|
|
\param timer_name optional timer to use for async behaviour
|
|
|
|
\param rate the sample rate
|
|
|
|
\param dtmf_callback code to execute if any dtmf is dialed during the audio
|
|
|
|
\param text the text to speak
|
|
|
|
\param buf an option data pointer to pass to the callback or a string to put encountered digits in
|
|
|
|
\param buflen the len of buf
|
|
|
|
\return SWITCH_STATUS_SUCCESS if all is well
|
|
|
|
*/
|
2006-02-26 20:23:23 +00:00
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session,
|
|
|
|
char *tts_name,
|
|
|
|
char *voice_name,
|
|
|
|
char *timer_name,
|
2006-04-09 00:10:13 +00:00
|
|
|
uint32_t rate,
|
2006-02-26 20:23:23 +00:00
|
|
|
switch_dtmf_callback_function dtmf_callback,
|
|
|
|
char *text,
|
|
|
|
void *buf,
|
|
|
|
unsigned int buflen);
|
|
|
|
|
2006-03-01 00:58:32 +00:00
|
|
|
/*!
|
|
|
|
\brief Bridge Audio from one session to another
|
|
|
|
\param session one session
|
|
|
|
\param peer_session the other session
|
|
|
|
\param timelimit maximum number of seconds to wait for both channels to be answered
|
2006-03-01 05:52:42 +00:00
|
|
|
\param dtmf_callback code to execute if any dtmf is dialed during the bridge
|
|
|
|
\param session_data data to pass to the DTMF callback for session
|
|
|
|
\param peer_session_data data to pass to the DTMF callback for peer_session
|
2006-03-01 00:58:32 +00:00
|
|
|
\return SWITCH_STATUS_SUCCESS if all is well
|
|
|
|
*/
|
|
|
|
SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_session *session,
|
|
|
|
switch_core_session *peer_session,
|
2006-03-01 05:52:42 +00:00
|
|
|
unsigned int timelimit,
|
|
|
|
switch_dtmf_callback_function dtmf_callback,
|
|
|
|
void *session_data,
|
|
|
|
void *peer_session_data);
|
2006-03-01 00:58:32 +00:00
|
|
|
|
2006-01-26 18:00:27 +00:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|