Add more IVR stuff and a test app (mod_ivrtest)

in dialplan (ivrtest <path to file>)
if the file is valid it will play the file and you will be expected to dial digits
until you dial 10 digits or press # or * (* will end the call) (# will repeat the test endlessly)



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@462 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-01-27 21:33:45 +00:00
parent 4a98cfbb88
commit 534db1947e
10 changed files with 504 additions and 29 deletions
+38 -3
View File
@@ -52,6 +52,34 @@ extern "C" {
* @{
*/
/*!
\brief Wait for DTMF digits calling a pluggable callback function when digits are collected.
\param session the session to read.
\param dtmf_collection_callback code to execute if any dtmf is dialed during the recording
\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)
\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,
int maxdigits,
const char *terminators,
char *terminator);
/*!
\brief play a file from the disk to the session
\param session the session to play the file too
@@ -59,11 +87,14 @@ extern "C" {
\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
\return SWITCH_STATUS_SUCCESS if all is well
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback.
*/
SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
char *file,
char *timer_name,
switch_dtmf_callback_function dtmf_callback);
switch_dtmf_callback_function dtmf_callback,
void *buf,
unsigned int buflen);
@@ -73,11 +104,15 @@ SWITCH_DECLARE(switch_status) switch_ivr_play_file(switch_core_session *session,
\param file the path to the file
\param dtmf_callback code to execute if any dtmf is dialed during the recording
\return SWITCH_STATUS_SUCCESS if all is well
\note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
*/
SWITCH_DECLARE(switch_status) switch_ivr_record_file(switch_core_session *session,
char *file,
switch_dtmf_callback_function dtmf_callback);
switch_dtmf_callback_function dtmf_callback,
void *buf,
unsigned int buflen);
/** @} */
#ifdef __cplusplus
+4 -2
View File
@@ -102,6 +102,7 @@ typedef enum {
SWITCH_STATUS_RESAMPLE - An indication that a resample has occured
SWITCH_STATUS_GENERR - A general Error
SWITCH_STATUS_INUSE - An indication that requested resource is in use
SWITCH_STATUS_BREAK - A non-fatal break of an operation
</pre>
*/
typedef enum {
@@ -115,7 +116,8 @@ typedef enum {
SWITCH_STATUS_NOOP,
SWITCH_STATUS_RESAMPLE,
SWITCH_STATUS_GENERR,
SWITCH_STATUS_INUSE
SWITCH_STATUS_INUSE,
SWITCH_STATUS_BREAK,
} switch_status;
/*!
@@ -392,7 +394,7 @@ typedef switch_status (*switch_waitfor_read_hook)(switch_core_session *, int, in
typedef switch_status (*switch_waitfor_write_hook)(switch_core_session *, int, int);
typedef switch_status (*switch_send_dtmf_hook)(switch_core_session *, char *);
typedef switch_status (*switch_api_function)(char *in, char *out, size_t outlen);
typedef switch_status (*switch_dtmf_callback_function)(switch_core_session *session, char *dtmf);
typedef switch_status (*switch_dtmf_callback_function)(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen);
/* things we don't deserve to know about */