mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-16 03:42:09 +00:00
ruin everything, sorry jamesdotcom
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3815 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ca18721695
commit
591c9b87aa
@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup switch_ivr IVR Library
|
* @defgroup switch_ivr IVR Library
|
||||||
* @ingroup core1
|
* @ingroup core1
|
||||||
@ -74,9 +72,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session);
|
|||||||
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
|
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
|
||||||
*/
|
*/
|
||||||
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_args_t *args,
|
||||||
void *buf,
|
|
||||||
uint32_t buflen,
|
|
||||||
uint32_t timeout);
|
uint32_t timeout);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -175,7 +171,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi
|
|||||||
\param session the session to play the file too
|
\param session the session to play the file too
|
||||||
\param fh file handle to use (NULL for builtin one)
|
\param fh file handle to use (NULL for builtin one)
|
||||||
\param file the path to the file
|
\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
|
\param dtmf_callback code to execute if any dtmf is dialed during the playback
|
||||||
\param buf an object to maintain across calls
|
\param buf an object to maintain across calls
|
||||||
\param buflen the size of buf
|
\param buflen the size of buf
|
||||||
@ -185,11 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session,
|
||||||
switch_file_handle_t *fh,
|
switch_file_handle_t *fh,
|
||||||
char *file,
|
char *file,
|
||||||
char *timer_name,
|
switch_input_args_t *args);
|
||||||
switch_input_callback_function_t dtmf_callback,
|
|
||||||
void *buf,
|
|
||||||
uint32_t buflen);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -207,9 +198,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
|
||||||
switch_file_handle_t *fh,
|
switch_file_handle_t *fh,
|
||||||
char *file,
|
char *file,
|
||||||
switch_input_callback_function_t dtmf_callback,
|
switch_input_args_t *args,
|
||||||
void *buf,
|
|
||||||
uint32_t buflen,
|
|
||||||
uint32_t limit);
|
uint32_t limit);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -252,17 +241,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||||||
switch_speech_handle_t *sh,
|
switch_speech_handle_t *sh,
|
||||||
switch_codec_t *codec,
|
switch_codec_t *codec,
|
||||||
switch_timer_t *timer,
|
switch_timer_t *timer,
|
||||||
switch_input_callback_function_t dtmf_callback,
|
|
||||||
char *text,
|
char *text,
|
||||||
void *buf,
|
switch_input_args_t *args);
|
||||||
uint32_t buflen);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Speak given text with given tts engine
|
\brief Speak given text with given tts engine
|
||||||
\param session the session to speak on
|
\param session the session to speak on
|
||||||
\param tts_name the desired tts module
|
\param tts_name the desired tts module
|
||||||
\param voice_name the desired voice
|
\param voice_name the desired voice
|
||||||
\param timer_name optional timer to use for async behaviour
|
|
||||||
\param rate the sample rate
|
\param rate the sample rate
|
||||||
\param dtmf_callback code to execute if any dtmf is dialed during the audio
|
\param dtmf_callback code to execute if any dtmf is dialed during the audio
|
||||||
\param text the text to speak
|
\param text the text to speak
|
||||||
@ -273,12 +259,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
||||||
char *tts_name,
|
char *tts_name,
|
||||||
char *voice_name,
|
char *voice_name,
|
||||||
char *timer_name,
|
|
||||||
uint32_t rate,
|
uint32_t rate,
|
||||||
switch_input_callback_function_t dtmf_callback,
|
|
||||||
char *text,
|
char *text,
|
||||||
void *buf,
|
switch_input_args_t *args);
|
||||||
uint32_t buflen);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Make an outgoing call
|
\brief Make an outgoing call
|
||||||
@ -532,7 +515,6 @@ typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
|
|||||||
*\param tts_voice Text To Speech engine voice name
|
*\param tts_voice Text To Speech engine voice name
|
||||||
*\param timeout A number of milliseconds to pause before looping.
|
*\param timeout A number of milliseconds to pause before looping.
|
||||||
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
|
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
|
||||||
*\param timer_name A pointer to a timer name
|
|
||||||
*\param pool memory pool (NULL to create one)
|
*\param pool memory pool (NULL to create one)
|
||||||
*\return SWITCH_STATUS_SUCCESS if the menu was created
|
*\return SWITCH_STATUS_SUCCESS if the menu was created
|
||||||
*/
|
*/
|
||||||
@ -547,7 +529,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_men
|
|||||||
char *tts_voice,
|
char *tts_voice,
|
||||||
int timeout,
|
int timeout,
|
||||||
int max_failures,
|
int max_failures,
|
||||||
char *timer_name,
|
|
||||||
switch_memory_pool_t *pool);
|
switch_memory_pool_t *pool);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -600,14 +581,12 @@ typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
|
|||||||
*\param menu_stack The menu stack object that will be created for you
|
*\param menu_stack The menu stack object that will be created for you
|
||||||
*\param xml_menus The xml Menus source
|
*\param xml_menus The xml Menus source
|
||||||
*\param xml_menu The xml Menu source of the menu to be created
|
*\param xml_menu The xml Menu source of the menu to be created
|
||||||
*\param timer_name The name of a timer that should be used - in almost all cases this should be NULL
|
|
||||||
*\return SWITCH_STATUS_SUCCESS if all is well
|
*\return SWITCH_STATUS_SUCCESS if all is well
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
||||||
switch_ivr_menu_t **menu_stack,
|
switch_ivr_menu_t **menu_stack,
|
||||||
switch_xml_t xml_menus,
|
switch_xml_t xml_menus,
|
||||||
switch_xml_t xml_menu,
|
switch_xml_t xml_menu);
|
||||||
char *timer_name);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
|
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
|
||||||
@ -630,9 +609,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||||||
char *macro_name,
|
char *macro_name,
|
||||||
char *data,
|
char *data,
|
||||||
char *lang,
|
char *lang,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args);
|
||||||
void *buf,
|
|
||||||
uint32_t buflen);
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
|
@ -917,13 +917,16 @@ typedef switch_status_t (*switch_input_callback_function_t)(switch_core_session_
|
|||||||
void *buf,
|
void *buf,
|
||||||
unsigned int buflen);
|
unsigned int buflen);
|
||||||
typedef struct switch_say_interface switch_say_interface_t;
|
typedef struct switch_say_interface switch_say_interface_t;
|
||||||
|
typedef struct {
|
||||||
|
switch_input_callback_function_t input_callback;
|
||||||
|
void *buf;
|
||||||
|
uint32_t buflen;
|
||||||
|
} switch_input_args_t;
|
||||||
typedef switch_status_t (*switch_say_callback_t)(switch_core_session_t *session,
|
typedef switch_status_t (*switch_say_callback_t)(switch_core_session_t *session,
|
||||||
char *tosay,
|
char *tosay,
|
||||||
switch_say_type_t type,
|
switch_say_type_t type,
|
||||||
switch_say_method_t method,
|
switch_say_method_t method,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args);
|
||||||
void *buf,
|
|
||||||
uint32_t buflen);
|
|
||||||
typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames);
|
typedef int (*switch_core_db_callback_func_t)(void *pArg, int argc, char **argv, char **columnNames);
|
||||||
typedef switch_status_t (*switch_module_load_t) (switch_loadable_module_interface_t **, char *);
|
typedef switch_status_t (*switch_module_load_t) (switch_loadable_module_interface_t **, char *);
|
||||||
typedef switch_status_t (*switch_module_reload_t) (void);
|
typedef switch_status_t (*switch_module_reload_t) (void);
|
||||||
@ -940,7 +943,6 @@ typedef switch_xml_t (*switch_xml_search_function_t)(char *section,
|
|||||||
char *key_value,
|
char *key_value,
|
||||||
char *params);
|
char *params);
|
||||||
|
|
||||||
|
|
||||||
/* things we don't deserve to know about */
|
/* things we don't deserve to know about */
|
||||||
/*! \brief A channel */
|
/*! \brief A channel */
|
||||||
struct switch_channel;
|
struct switch_channel;
|
||||||
|
@ -3328,7 +3328,7 @@ static switch_status_t conference_local_play_file(switch_core_session_t *session
|
|||||||
|
|
||||||
/* if all is well, really play the file */
|
/* if all is well, really play the file */
|
||||||
if (status == SWITCH_STATUS_SUCCESS) {
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, path, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@ -3702,7 +3702,7 @@ static void conference_function(switch_core_session_t *session, char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
|
if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
|
||||||
switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
|
switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_core_session_reset(session);
|
switch_core_session_reset(session);
|
||||||
|
@ -123,7 +123,7 @@ static void phrase_function(switch_core_session_t *session, char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, mdata, lang);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, mdata, lang);
|
||||||
switch_ivr_phrase_macro(session, macro, mdata, lang, NULL, NULL, 0);
|
switch_ivr_phrase_macro(session, macro, mdata, lang, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ static void ivr_application_function(switch_core_session_t *session, char *data)
|
|||||||
#ifdef _TEST_CALLBACK_
|
#ifdef _TEST_CALLBACK_
|
||||||
&& switch_ivr_menu_stack_xml_add_custom(xml_ctx, "custom", &menu_handler) == SWITCH_STATUS_SUCCESS
|
&& switch_ivr_menu_stack_xml_add_custom(xml_ctx, "custom", &menu_handler) == SWITCH_STATUS_SUCCESS
|
||||||
#endif
|
#endif
|
||||||
&& switch_ivr_menu_stack_xml_build(xml_ctx,&menu_stack,xml_menus,xml_menu,NULL) == SWITCH_STATUS_SUCCESS)
|
&& switch_ivr_menu_stack_xml_build(xml_ctx,&menu_stack,xml_menus,xml_menu) == SWITCH_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
switch_channel_answer(channel);
|
switch_channel_answer(channel);
|
||||||
switch_ivr_menu_execute(session,menu_stack,params,NULL);
|
switch_ivr_menu_execute(session,menu_stack,params,NULL);
|
||||||
|
@ -138,7 +138,7 @@ static void ivr_application_function(switch_core_session_t *session, char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_ivr_play_file(session, NULL,"/ram/goodbye.wav",NULL,NULL,NULL,0);
|
switch_ivr_play_file(session, NULL,"/ram/goodbye.wav",NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +201,7 @@ static void tts_function(switch_core_session_t *session, char *data)
|
|||||||
char buf[10] = "";
|
char buf[10] = "";
|
||||||
char *argv[3];
|
char *argv[3];
|
||||||
int argc;
|
int argc;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
if(!(mydata = switch_core_session_strdup(session, (char *) data))) {
|
if(!(mydata = switch_core_session_strdup(session, (char *) data))) {
|
||||||
return;
|
return;
|
||||||
@ -223,8 +224,10 @@ static void tts_function(switch_core_session_t *session, char *data)
|
|||||||
switch_channel_answer(channel);
|
switch_channel_answer(channel);
|
||||||
|
|
||||||
codec = switch_core_session_get_read_codec(session);
|
codec = switch_core_session_get_read_codec(session);
|
||||||
|
args.input_callback = show_dtmf;
|
||||||
switch_ivr_speak_text(session, tts_name, voice_name, NULL, codec->implementation->samples_per_second, show_dtmf, text, buf, sizeof(buf));
|
args.buf = buf;
|
||||||
|
args.buflen = sizeof(buf);
|
||||||
|
switch_ivr_speak_text(session, tts_name, voice_name, codec->implementation->samples_per_second, text, &args);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Done\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,10 +369,14 @@ static void ivrtest_function(switch_core_session_t *session, char *data)
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enter up to 10 digits, press # to terminate, * to hangup\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enter up to 10 digits, press # to terminate, * to hangup\n");
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
switch_input_args_t args = {0};
|
||||||
/* you could have passed NULL instead of on_dtmf to get this exact behaviour (copy the digits to buf and stop playing)
|
/* you could have passed NULL instead of on_dtmf to get this exact behaviour (copy the digits to buf and stop playing)
|
||||||
but you may want to pass the function if you have something cooler to do...
|
but you may want to pass the function if you have something cooler to do...
|
||||||
*/
|
*/
|
||||||
status = switch_ivr_play_file(session, NULL, data, NULL, on_dtmf, buf, sizeof(buf));
|
args.input_callback = on_dtmf;
|
||||||
|
args.buf = buf;
|
||||||
|
args.buflen = sizeof(buf);
|
||||||
|
status = switch_ivr_play_file(session, NULL, data, &args);
|
||||||
|
|
||||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
@ -387,7 +394,7 @@ static void ivrtest_function(switch_core_session_t *session, char *data)
|
|||||||
}
|
}
|
||||||
snprintf(say, sizeof(say), "You Dialed [%s]\n", buf);
|
snprintf(say, sizeof(say), "You Dialed [%s]\n", buf);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, say);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, say);
|
||||||
switch_ivr_speak_text(session, "cepstral", "david", NULL, codec->implementation->samples_per_second, NULL, say, NULL, 0);
|
switch_ivr_speak_text(session, "cepstral", "david", codec->implementation->samples_per_second, say, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ static void speak_function(switch_core_session_t *session, char *data)
|
|||||||
char *timer_name = NULL;
|
char *timer_name = NULL;
|
||||||
char *mydata = NULL;
|
char *mydata = NULL;
|
||||||
switch_codec_t *codec;
|
switch_codec_t *codec;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
codec = switch_core_session_get_read_codec(session);
|
codec = switch_core_session_get_read_codec(session);
|
||||||
assert(codec != NULL);
|
assert(codec != NULL);
|
||||||
@ -85,7 +86,6 @@ static void speak_function(switch_core_session_t *session, char *data)
|
|||||||
engine = argv[0];
|
engine = argv[0];
|
||||||
voice = argv[1];
|
voice = argv[1];
|
||||||
text = argv[2];
|
text = argv[2];
|
||||||
timer_name = argv[3];
|
|
||||||
|
|
||||||
if (!(engine && voice && text)) {
|
if (!(engine && voice && text)) {
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
@ -102,28 +102,29 @@ static void speak_function(switch_core_session_t *session, char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_channel_pre_answer(channel);
|
switch_channel_pre_answer(channel);
|
||||||
switch_ivr_speak_text(session, engine, voice, timer_name, codec->implementation->samples_per_second, on_dtmf, text, buf, sizeof(buf));
|
|
||||||
|
args.input_callback = on_dtmf;
|
||||||
|
args.buf = buf;
|
||||||
|
args.buflen = sizeof(buf);
|
||||||
|
switch_ivr_speak_text(session, engine, voice, codec->implementation->samples_per_second, text, &args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void playback_function(switch_core_session_t *session, char *data)
|
static void playback_function(switch_core_session_t *session, char *data)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
char *timer_name = NULL;
|
|
||||||
char *file_name = NULL;
|
char *file_name = NULL;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
file_name = switch_core_session_strdup(session, data);
|
file_name = switch_core_session_strdup(session, data);
|
||||||
|
|
||||||
if ((timer_name = strchr(file_name, ' ')) != 0) {
|
|
||||||
*timer_name++ = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
switch_channel_pre_answer(channel);
|
switch_channel_pre_answer(channel);
|
||||||
|
|
||||||
switch_ivr_play_file(session, NULL, file_name, timer_name, on_dtmf, NULL, 0);
|
args.input_callback = on_dtmf;
|
||||||
|
switch_ivr_play_file(session, NULL, file_name, &args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ static void record_function(switch_core_session_t *session, char *data)
|
|||||||
uint32_t limit = 0;
|
uint32_t limit = 0;
|
||||||
char *path;
|
char *path;
|
||||||
char *p;
|
char *p;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
@ -145,7 +147,8 @@ static void record_function(switch_core_session_t *session, char *data)
|
|||||||
limit = atoi(p);
|
limit = atoi(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = switch_ivr_record_file(session, NULL, path, on_dtmf, NULL, 0, limit);
|
args.input_callback = on_dtmf;
|
||||||
|
status = switch_ivr_record_file(session, NULL, path, &args, limit);
|
||||||
|
|
||||||
if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
|
if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
@ -791,8 +791,6 @@ SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv);
|
|||||||
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
|
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
|
|
||||||
extern void fs_core_set_globals(void);
|
extern void fs_core_set_globals(void);
|
||||||
extern int fs_core_init(char *);
|
extern int fs_core_init(char *);
|
||||||
extern int fs_core_destroy(void);
|
extern int fs_core_destroy(void);
|
||||||
@ -808,7 +806,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
|
|||||||
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
||||||
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
||||||
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
||||||
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
|
extern int fs_ivr_play_file(switch_core_session_t *,char *);
|
||||||
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
||||||
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
||||||
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
||||||
@ -816,10 +814,11 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
|
|||||||
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
||||||
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
||||||
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
||||||
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
|
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
|
||||||
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
||||||
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
||||||
|
|
||||||
|
#include "switch.h"
|
||||||
|
|
||||||
#ifdef PERL_OBJECT
|
#ifdef PERL_OBJECT
|
||||||
#define MAGIC_CLASS _wrap_fs_perl_var::
|
#define MAGIC_CLASS _wrap_fs_perl_var::
|
||||||
@ -1210,16 +1209,12 @@ XS(_wrap_fs_ivr_play_file) {
|
|||||||
{
|
{
|
||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
|
||||||
switch_input_callback_function_t arg4 ;
|
|
||||||
void *arg5 = (void *) 0 ;
|
|
||||||
unsigned int arg6 ;
|
|
||||||
int result;
|
int result;
|
||||||
int argvi = 0;
|
int argvi = 0;
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
|
|
||||||
if ((items < 6) || (items > 6)) {
|
if ((items < 2) || (items > 2)) {
|
||||||
SWIG_croak("Usage: fs_ivr_play_file(session,file,timer_name,dtmf_callback,buf,buflen);");
|
SWIG_croak("Usage: fs_ivr_play_file(session,file);");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
|
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
|
||||||
@ -1228,22 +1223,7 @@ XS(_wrap_fs_ivr_play_file) {
|
|||||||
}
|
}
|
||||||
if (!SvOK((SV*) ST(1))) arg2 = 0;
|
if (!SvOK((SV*) ST(1))) arg2 = 0;
|
||||||
else arg2 = (char *) SvPV(ST(1), PL_na);
|
else arg2 = (char *) SvPV(ST(1), PL_na);
|
||||||
if (!SvOK((SV*) ST(2))) arg3 = 0;
|
result = (int)fs_ivr_play_file(arg1,arg2);
|
||||||
else arg3 = (char *) SvPV(ST(2), PL_na);
|
|
||||||
{
|
|
||||||
switch_input_callback_function_t * argp;
|
|
||||||
if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,0) < 0) {
|
|
||||||
SWIG_croak("Type error in argument 4 of fs_ivr_play_file. Expected _p_switch_input_callback_function_t");
|
|
||||||
}
|
|
||||||
arg4 = *argp;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
if (SWIG_ConvertPtr(ST(4), (void **) &arg5, 0,0) < 0) {
|
|
||||||
SWIG_croak("Type error in argument 5 of fs_ivr_play_file. Expected _p_void");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
arg6 = (unsigned int) SvUV(ST(5));
|
|
||||||
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
|
|
||||||
|
|
||||||
ST(argvi) = sv_newmortal();
|
ST(argvi) = sv_newmortal();
|
||||||
sv_setiv(ST(argvi++), (IV) result);
|
sv_setiv(ST(argvi++), (IV) result);
|
||||||
@ -1546,18 +1526,14 @@ XS(_wrap_fs_switch_ivr_speak_text) {
|
|||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
char *arg3 ;
|
||||||
char *arg4 ;
|
uint32_t arg4 ;
|
||||||
uint32_t arg5 ;
|
char *arg5 ;
|
||||||
switch_input_callback_function_t arg6 ;
|
|
||||||
char *arg7 ;
|
|
||||||
void *arg8 = (void *) 0 ;
|
|
||||||
unsigned int arg9 ;
|
|
||||||
int result;
|
int result;
|
||||||
int argvi = 0;
|
int argvi = 0;
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
|
|
||||||
if ((items < 9) || (items > 9)) {
|
if ((items < 5) || (items > 5)) {
|
||||||
SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);");
|
SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
|
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
|
||||||
@ -1568,31 +1544,16 @@ XS(_wrap_fs_switch_ivr_speak_text) {
|
|||||||
else arg2 = (char *) SvPV(ST(1), PL_na);
|
else arg2 = (char *) SvPV(ST(1), PL_na);
|
||||||
if (!SvOK((SV*) ST(2))) arg3 = 0;
|
if (!SvOK((SV*) ST(2))) arg3 = 0;
|
||||||
else arg3 = (char *) SvPV(ST(2), PL_na);
|
else arg3 = (char *) SvPV(ST(2), PL_na);
|
||||||
if (!SvOK((SV*) ST(3))) arg4 = 0;
|
|
||||||
else arg4 = (char *) SvPV(ST(3), PL_na);
|
|
||||||
{
|
{
|
||||||
uint32_t * argp;
|
uint32_t * argp;
|
||||||
if (SWIG_ConvertPtr(ST(4),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
|
if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
|
||||||
SWIG_croak("Type error in argument 5 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
|
SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
|
||||||
}
|
}
|
||||||
arg5 = *argp;
|
arg4 = *argp;
|
||||||
}
|
}
|
||||||
{
|
if (!SvOK((SV*) ST(4))) arg5 = 0;
|
||||||
switch_input_callback_function_t * argp;
|
else arg5 = (char *) SvPV(ST(4), PL_na);
|
||||||
if (SWIG_ConvertPtr(ST(5),(void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,0) < 0) {
|
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
|
||||||
SWIG_croak("Type error in argument 6 of fs_switch_ivr_speak_text. Expected _p_switch_input_callback_function_t");
|
|
||||||
}
|
|
||||||
arg6 = *argp;
|
|
||||||
}
|
|
||||||
if (!SvOK((SV*) ST(6))) arg7 = 0;
|
|
||||||
else arg7 = (char *) SvPV(ST(6), PL_na);
|
|
||||||
{
|
|
||||||
if (SWIG_ConvertPtr(ST(7), (void **) &arg8, 0,0) < 0) {
|
|
||||||
SWIG_croak("Type error in argument 8 of fs_switch_ivr_speak_text. Expected _p_void");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
arg9 = (unsigned int) SvUV(ST(8));
|
|
||||||
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
|
|
||||||
|
|
||||||
ST(argvi) = sv_newmortal();
|
ST(argvi) = sv_newmortal();
|
||||||
sv_setiv(ST(argvi++), (IV) result);
|
sv_setiv(ST(argvi++), (IV) result);
|
||||||
|
@ -576,7 +576,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
|
|||||||
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
||||||
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
||||||
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
||||||
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
|
extern int fs_ivr_play_file(switch_core_session_t *,char *);
|
||||||
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
||||||
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
||||||
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
||||||
@ -584,7 +584,7 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
|
|||||||
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
||||||
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
||||||
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
||||||
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
|
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
|
||||||
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
||||||
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
||||||
|
|
||||||
@ -1081,19 +1081,15 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) {
|
|||||||
ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
|
ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
|
||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
|
||||||
switch_input_callback_function_t arg4 ;
|
|
||||||
void *arg5 = (void *) 0 ;
|
|
||||||
unsigned int arg6 ;
|
|
||||||
int result;
|
int result;
|
||||||
zval **args[7];
|
zval **args[3];
|
||||||
int argbase=0 ;
|
int argbase=0 ;
|
||||||
|
|
||||||
if (this_ptr && this_ptr->type==IS_OBJECT) {
|
if (this_ptr && this_ptr->type==IS_OBJECT) {
|
||||||
/* fake this_ptr as first arg (till we can work out how to do it better */
|
/* fake this_ptr as first arg (till we can work out how to do it better */
|
||||||
argbase++;
|
argbase++;
|
||||||
}
|
}
|
||||||
if(((ZEND_NUM_ARGS() + argbase )!= 6) || (zend_get_parameters_array_ex(6-argbase, args)!= SUCCESS)) {
|
if(((ZEND_NUM_ARGS() + argbase )!= 2) || (zend_get_parameters_array_ex(2-argbase, args)!= SUCCESS)) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,29 +1102,7 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
|
|||||||
convert_to_string_ex(args[1-argbase]);
|
convert_to_string_ex(args[1-argbase]);
|
||||||
arg2 = (char *) Z_STRVAL_PP(args[1-argbase]);
|
arg2 = (char *) Z_STRVAL_PP(args[1-argbase]);
|
||||||
|
|
||||||
|
result = (int)fs_ivr_play_file(arg1,arg2);
|
||||||
convert_to_string_ex(args[2-argbase]);
|
|
||||||
arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
|
|
||||||
|
|
||||||
{
|
|
||||||
switch_input_callback_function_t * argp;
|
|
||||||
if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
|
|
||||||
zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 4-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
|
|
||||||
}
|
|
||||||
arg4 = *argp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SWIG_ConvertPtr(*args[4-argbase], (void **) &arg5, 0) < 0) {
|
|
||||||
/* Allow NULL from php for void* */
|
|
||||||
if ((*args[4-argbase])->type==IS_NULL) arg5=0;
|
|
||||||
else zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 5-argbase, SWIGTYPE_p_void->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
convert_to_long_ex(args[5-argbase]);
|
|
||||||
arg6 = (unsigned int) Z_LVAL_PP(args[5-argbase]);
|
|
||||||
|
|
||||||
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
|
|
||||||
|
|
||||||
|
|
||||||
ZVAL_LONG(return_value,result);
|
ZVAL_LONG(return_value,result);
|
||||||
@ -1469,21 +1443,17 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
|
|||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
char *arg3 ;
|
||||||
char *arg4 ;
|
uint32_t arg4 ;
|
||||||
uint32_t arg5 ;
|
char *arg5 ;
|
||||||
switch_input_callback_function_t arg6 ;
|
|
||||||
char *arg7 ;
|
|
||||||
void *arg8 = (void *) 0 ;
|
|
||||||
unsigned int arg9 ;
|
|
||||||
int result;
|
int result;
|
||||||
zval **args[10];
|
zval **args[6];
|
||||||
int argbase=0 ;
|
int argbase=0 ;
|
||||||
|
|
||||||
if (this_ptr && this_ptr->type==IS_OBJECT) {
|
if (this_ptr && this_ptr->type==IS_OBJECT) {
|
||||||
/* fake this_ptr as first arg (till we can work out how to do it better */
|
/* fake this_ptr as first arg (till we can work out how to do it better */
|
||||||
argbase++;
|
argbase++;
|
||||||
}
|
}
|
||||||
if(((ZEND_NUM_ARGS() + argbase )!= 9) || (zend_get_parameters_array_ex(9-argbase, args)!= SUCCESS)) {
|
if(((ZEND_NUM_ARGS() + argbase )!= 5) || (zend_get_parameters_array_ex(5-argbase, args)!= SUCCESS)) {
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1500,40 +1470,18 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
|
|||||||
convert_to_string_ex(args[2-argbase]);
|
convert_to_string_ex(args[2-argbase]);
|
||||||
arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
|
arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
|
||||||
|
|
||||||
|
|
||||||
convert_to_string_ex(args[3-argbase]);
|
|
||||||
arg4 = (char *) Z_STRVAL_PP(args[3-argbase]);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
uint32_t * argp;
|
uint32_t * argp;
|
||||||
if(SWIG_ConvertPtr(*args[4-argbase], (void **) &argp, SWIGTYPE_p_uint32_t) < 0) {
|
if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_uint32_t) < 0) {
|
||||||
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 5-argbase, SWIGTYPE_p_uint32_t->name);
|
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 4-argbase, SWIGTYPE_p_uint32_t->name);
|
||||||
}
|
}
|
||||||
arg5 = *argp;
|
arg4 = *argp;
|
||||||
}
|
|
||||||
{
|
|
||||||
switch_input_callback_function_t * argp;
|
|
||||||
if(SWIG_ConvertPtr(*args[5-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
|
|
||||||
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 6-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
|
|
||||||
}
|
|
||||||
arg6 = *argp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_to_string_ex(args[6-argbase]);
|
convert_to_string_ex(args[4-argbase]);
|
||||||
arg7 = (char *) Z_STRVAL_PP(args[6-argbase]);
|
arg5 = (char *) Z_STRVAL_PP(args[4-argbase]);
|
||||||
|
|
||||||
|
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
|
||||||
if(SWIG_ConvertPtr(*args[7-argbase], (void **) &arg8, 0) < 0) {
|
|
||||||
/* Allow NULL from php for void* */
|
|
||||||
if ((*args[7-argbase])->type==IS_NULL) arg8=0;
|
|
||||||
else zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 8-argbase, SWIGTYPE_p_void->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
convert_to_long_ex(args[8-argbase]);
|
|
||||||
arg9 = (unsigned int) Z_LVAL_PP(args[8-argbase]);
|
|
||||||
|
|
||||||
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
|
|
||||||
|
|
||||||
|
|
||||||
ZVAL_LONG(return_value,result);
|
ZVAL_LONG(return_value,result);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# This file was created automatically by SWIG 1.3.27.
|
# This file was created automatically by SWIG.
|
||||||
# Don't modify this file, modify the SWIG interface instead.
|
# Don't modify this file, modify the SWIG interface instead.
|
||||||
|
# This file is compatible with both classic and new-style classes.
|
||||||
|
|
||||||
import _freeswitch
|
import _freeswitch
|
||||||
|
|
||||||
# This file is compatible with both classic and new-style classes.
|
def _swig_setattr(self,class_type,name,value):
|
||||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
|
||||||
if (name == "this"):
|
if (name == "this"):
|
||||||
if isinstance(value, class_type):
|
if isinstance(value, class_type):
|
||||||
self.__dict__[name] = value.this
|
self.__dict__[name] = value.this
|
||||||
@ -13,13 +13,7 @@ def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
|||||||
return
|
return
|
||||||
method = class_type.__swig_setmethods__.get(name,None)
|
method = class_type.__swig_setmethods__.get(name,None)
|
||||||
if method: return method(self,value)
|
if method: return method(self,value)
|
||||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
|
||||||
self.__dict__[name] = value
|
self.__dict__[name] = value
|
||||||
else:
|
|
||||||
raise AttributeError("You cannot add attributes to %s" % self)
|
|
||||||
|
|
||||||
def _swig_setattr(self,class_type,name,value):
|
|
||||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
|
||||||
|
|
||||||
def _swig_getattr(self,class_type,name):
|
def _swig_getattr(self,class_type,name):
|
||||||
method = class_type.__swig_getmethods__.get(name,None)
|
method = class_type.__swig_getmethods__.get(name,None)
|
||||||
@ -44,7 +38,7 @@ class SessionContainer(_object):
|
|||||||
__swig_getmethods__ = {}
|
__swig_getmethods__ = {}
|
||||||
__getattr__ = lambda self, name: _swig_getattr(self, SessionContainer, name)
|
__getattr__ = lambda self, name: _swig_getattr(self, SessionContainer, name)
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s.%s; proxy of C++ SessionContainer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
return "<C SessionContainer instance at %s>" % (self.this,)
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
_swig_setattr(self, SessionContainer, 'this', _freeswitch.new_SessionContainer(*args))
|
_swig_setattr(self, SessionContainer, 'this', _freeswitch.new_SessionContainer(*args))
|
||||||
_swig_setattr(self, SessionContainer, 'thisown', 1)
|
_swig_setattr(self, SessionContainer, 'thisown', 1)
|
||||||
@ -52,7 +46,6 @@ class SessionContainer(_object):
|
|||||||
try:
|
try:
|
||||||
if self.thisown: destroy(self)
|
if self.thisown: destroy(self)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
def console_log(*args): return _freeswitch.SessionContainer_console_log(*args)
|
def console_log(*args): return _freeswitch.SessionContainer_console_log(*args)
|
||||||
def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args)
|
def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args)
|
||||||
def answer(*args): return _freeswitch.SessionContainer_answer(*args)
|
def answer(*args): return _freeswitch.SessionContainer_answer(*args)
|
||||||
@ -73,9 +66,8 @@ class SessionContainerPtr(SessionContainer):
|
|||||||
def __init__(self, this):
|
def __init__(self, this):
|
||||||
_swig_setattr(self, SessionContainer, 'this', this)
|
_swig_setattr(self, SessionContainer, 'this', this)
|
||||||
if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
|
if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
|
||||||
self.__class__ = SessionContainer
|
_swig_setattr(self, SessionContainer,self.__class__,SessionContainer)
|
||||||
_freeswitch.SessionContainer_swigregister(SessionContainerPtr)
|
_freeswitch.SessionContainer_swigregister(SessionContainerPtr)
|
||||||
cvar = _freeswitch.cvar
|
cvar = _freeswitch.cvar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -627,7 +627,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
|
|||||||
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
|
||||||
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
extern void fs_channel_get_variable(switch_core_session_t *,char *);
|
||||||
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
extern void fs_channel_set_state(switch_core_session_t *,char *);
|
||||||
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
|
extern int fs_ivr_play_file(switch_core_session_t *,char *);
|
||||||
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
|
||||||
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
|
||||||
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
|
||||||
@ -635,7 +635,7 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
|
|||||||
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
|
||||||
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
|
||||||
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
|
||||||
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
|
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
|
||||||
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
|
||||||
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
|
||||||
|
|
||||||
@ -859,26 +859,14 @@ static VALUE
|
|||||||
_wrap_fs_ivr_play_file(int argc, VALUE *argv, VALUE self) {
|
_wrap_fs_ivr_play_file(int argc, VALUE *argv, VALUE self) {
|
||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
|
||||||
switch_input_callback_function_t arg4 ;
|
|
||||||
void *arg5 = (void *) 0 ;
|
|
||||||
unsigned int arg6 ;
|
|
||||||
int result;
|
int result;
|
||||||
VALUE vresult = Qnil;
|
VALUE vresult = Qnil;
|
||||||
|
|
||||||
if ((argc < 6) || (argc > 6))
|
if ((argc < 2) || (argc > 2))
|
||||||
rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc);
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
|
||||||
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
|
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
|
||||||
arg2 = StringValuePtr(argv[1]);
|
arg2 = StringValuePtr(argv[1]);
|
||||||
arg3 = StringValuePtr(argv[2]);
|
result = (int)fs_ivr_play_file(arg1,arg2);
|
||||||
{
|
|
||||||
switch_input_callback_function_t * ptr;
|
|
||||||
SWIG_ConvertPtr(argv[3], (void **) &ptr, SWIGTYPE_p_switch_input_callback_function_t, 1);
|
|
||||||
if (ptr) arg4 = *ptr;
|
|
||||||
}
|
|
||||||
SWIG_ConvertPtr(argv[4], (void **) &arg5, 0, 1);
|
|
||||||
arg6 = NUM2UINT(argv[5]);
|
|
||||||
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
|
|
||||||
|
|
||||||
vresult = INT2NUM(result);
|
vresult = INT2NUM(result);
|
||||||
return vresult;
|
return vresult;
|
||||||
@ -1066,35 +1054,23 @@ _wrap_fs_switch_ivr_speak_text(int argc, VALUE *argv, VALUE self) {
|
|||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 ;
|
char *arg2 ;
|
||||||
char *arg3 ;
|
char *arg3 ;
|
||||||
char *arg4 ;
|
uint32_t arg4 ;
|
||||||
uint32_t arg5 ;
|
char *arg5 ;
|
||||||
switch_input_callback_function_t arg6 ;
|
|
||||||
char *arg7 ;
|
|
||||||
void *arg8 = (void *) 0 ;
|
|
||||||
unsigned int arg9 ;
|
|
||||||
int result;
|
int result;
|
||||||
VALUE vresult = Qnil;
|
VALUE vresult = Qnil;
|
||||||
|
|
||||||
if ((argc < 9) || (argc > 9))
|
if ((argc < 5) || (argc > 5))
|
||||||
rb_raise(rb_eArgError, "wrong # of arguments(%d for 9)",argc);
|
rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc);
|
||||||
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
|
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
|
||||||
arg2 = StringValuePtr(argv[1]);
|
arg2 = StringValuePtr(argv[1]);
|
||||||
arg3 = StringValuePtr(argv[2]);
|
arg3 = StringValuePtr(argv[2]);
|
||||||
arg4 = StringValuePtr(argv[3]);
|
|
||||||
{
|
{
|
||||||
uint32_t * ptr;
|
uint32_t * ptr;
|
||||||
SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_uint32_t, 1);
|
SWIG_ConvertPtr(argv[3], (void **) &ptr, SWIGTYPE_p_uint32_t, 1);
|
||||||
if (ptr) arg5 = *ptr;
|
if (ptr) arg4 = *ptr;
|
||||||
}
|
}
|
||||||
{
|
arg5 = StringValuePtr(argv[4]);
|
||||||
switch_input_callback_function_t * ptr;
|
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
|
||||||
SWIG_ConvertPtr(argv[5], (void **) &ptr, SWIGTYPE_p_switch_input_callback_function_t, 1);
|
|
||||||
if (ptr) arg6 = *ptr;
|
|
||||||
}
|
|
||||||
arg7 = StringValuePtr(argv[6]);
|
|
||||||
SWIG_ConvertPtr(argv[7], (void **) &arg8, 0, 1);
|
|
||||||
arg9 = NUM2UINT(argv[8]);
|
|
||||||
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
|
|
||||||
|
|
||||||
vresult = INT2NUM(result);
|
vresult = INT2NUM(result);
|
||||||
return vresult;
|
return vresult;
|
||||||
|
@ -850,6 +850,7 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
switch_file_handle_t fh = {0};
|
switch_file_handle_t fh = {0};
|
||||||
JSFunction *function;
|
JSFunction *function;
|
||||||
int32 limit = 0;
|
int32 limit = 0;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(jss->session);
|
channel = switch_core_session_get_channel(jss->session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
@ -904,7 +905,10 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
cb_state.extra = &fh;
|
cb_state.extra = &fh;
|
||||||
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
||||||
cb_state.saveDepth = JS_SuspendRequest(cx);
|
cb_state.saveDepth = JS_SuspendRequest(cx);
|
||||||
switch_ivr_record_file(jss->session, &fh, file_name, dtmf_func, bp, len, limit);
|
args.input_callback = dtmf_func;
|
||||||
|
args.buf = bp;
|
||||||
|
args.buflen = len;
|
||||||
|
switch_ivr_record_file(jss->session, &fh, file_name, &args, limit);
|
||||||
JS_ResumeRequest(cx, cb_state.saveDepth);
|
JS_ResumeRequest(cx, cb_state.saveDepth);
|
||||||
*rval = cb_state.ret;
|
*rval = cb_state.ret;
|
||||||
|
|
||||||
@ -922,6 +926,7 @@ static JSBool session_collect_input(JSContext *cx, JSObject *obj, uintN argc, js
|
|||||||
switch_input_callback_function_t dtmf_func = NULL;
|
switch_input_callback_function_t dtmf_func = NULL;
|
||||||
struct input_callback_state cb_state = {0};
|
struct input_callback_state cb_state = {0};
|
||||||
JSFunction *function;
|
JSFunction *function;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(jss->session);
|
channel = switch_core_session_get_channel(jss->session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
@ -956,7 +961,10 @@ static JSBool session_collect_input(JSContext *cx, JSObject *obj, uintN argc, js
|
|||||||
}
|
}
|
||||||
|
|
||||||
cb_state.saveDepth = JS_SuspendRequest(cx);
|
cb_state.saveDepth = JS_SuspendRequest(cx);
|
||||||
switch_ivr_collect_digits_callback(jss->session, dtmf_func, bp, len, to);
|
args.input_callback = dtmf_func;
|
||||||
|
args.buf = bp;
|
||||||
|
args.buflen = len;
|
||||||
|
switch_ivr_collect_digits_callback(jss->session, &args, to);
|
||||||
JS_ResumeRequest(cx, cb_state.saveDepth);
|
JS_ResumeRequest(cx, cb_state.saveDepth);
|
||||||
|
|
||||||
*rval = cb_state.ret;
|
*rval = cb_state.ret;
|
||||||
@ -969,7 +977,6 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
struct js_session *jss = JS_GetPrivate(cx, obj);
|
struct js_session *jss = JS_GetPrivate(cx, obj);
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
char *file_name = NULL;
|
char *file_name = NULL;
|
||||||
char *timer_name = NULL;
|
|
||||||
//char *input_callback = NULL;
|
//char *input_callback = NULL;
|
||||||
void *bp = NULL;
|
void *bp = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -977,6 +984,7 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
struct input_callback_state cb_state = {0};
|
struct input_callback_state cb_state = {0};
|
||||||
switch_file_handle_t fh = {0};
|
switch_file_handle_t fh = {0};
|
||||||
JSFunction *function;
|
JSFunction *function;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(jss->session);
|
channel = switch_core_session_get_channel(jss->session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
@ -994,19 +1002,14 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
|
if ((function = JS_ValueToFunction(cx, argv[1]))) {
|
||||||
if (switch_strlen_zero(timer_name)) {
|
|
||||||
timer_name = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (argc > 2) {
|
|
||||||
if ((function = JS_ValueToFunction(cx, argv[2]))) {
|
|
||||||
memset(&cb_state, 0, sizeof(cb_state));
|
memset(&cb_state, 0, sizeof(cb_state));
|
||||||
cb_state.function = function;
|
cb_state.function = function;
|
||||||
|
|
||||||
if (argc > 3) {
|
if (argc > 2) {
|
||||||
cb_state.arg = argv[3];
|
cb_state.arg = argv[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
cb_state.session_state = jss;
|
cb_state.session_state = jss;
|
||||||
@ -1018,16 +1021,19 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 4) {
|
if (argc > 3) {
|
||||||
int32 samps;
|
int32 samps;
|
||||||
JS_ValueToInt32(cx, argv[4], &samps);
|
JS_ValueToInt32(cx, argv[3], &samps);
|
||||||
fh.samples = samps;
|
fh.samples = samps;
|
||||||
}
|
}
|
||||||
|
|
||||||
cb_state.extra = &fh;
|
cb_state.extra = &fh;
|
||||||
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
||||||
cb_state.saveDepth = JS_SuspendRequest(cx);
|
cb_state.saveDepth = JS_SuspendRequest(cx);
|
||||||
switch_ivr_play_file(jss->session, &fh, file_name, timer_name, dtmf_func, bp, len);
|
args.input_callback = dtmf_func;
|
||||||
|
args.buf = bp;
|
||||||
|
args.buflen = len;
|
||||||
|
switch_ivr_play_file(jss->session, &fh, file_name, &args);
|
||||||
JS_ResumeRequest(cx, cb_state.saveDepth);
|
JS_ResumeRequest(cx, cb_state.saveDepth);
|
||||||
*rval = cb_state.ret;
|
*rval = cb_state.ret;
|
||||||
|
|
||||||
@ -1104,13 +1110,13 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||||||
char *tts_name = NULL;
|
char *tts_name = NULL;
|
||||||
char *voice_name = NULL;
|
char *voice_name = NULL;
|
||||||
char *text = NULL;
|
char *text = NULL;
|
||||||
char *timer_name = NULL;
|
|
||||||
switch_codec_t *codec;
|
switch_codec_t *codec;
|
||||||
void *bp = NULL;
|
void *bp = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
struct input_callback_state cb_state = {0};
|
struct input_callback_state cb_state = {0};
|
||||||
switch_input_callback_function_t dtmf_func = NULL;
|
switch_input_callback_function_t dtmf_func = NULL;
|
||||||
JSFunction *function;
|
JSFunction *function;
|
||||||
|
switch_input_args_t args = {0};
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(jss->session);
|
channel = switch_core_session_get_channel(jss->session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
@ -1148,10 +1154,6 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 5) {
|
|
||||||
timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tts_name && text) {
|
if (!tts_name && text) {
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
@ -1159,15 +1161,15 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||||||
codec = switch_core_session_get_read_codec(jss->session);
|
codec = switch_core_session_get_read_codec(jss->session);
|
||||||
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
|
||||||
cb_state.saveDepth = JS_SuspendRequest(cx);
|
cb_state.saveDepth = JS_SuspendRequest(cx);
|
||||||
|
args.input_callback = dtmf_func;
|
||||||
|
args.buf = bp;
|
||||||
|
args.buflen = len;
|
||||||
switch_ivr_speak_text(jss->session,
|
switch_ivr_speak_text(jss->session,
|
||||||
tts_name,
|
tts_name,
|
||||||
voice_name && strlen(voice_name) ? voice_name : NULL,
|
voice_name && strlen(voice_name) ? voice_name : NULL,
|
||||||
timer_name,
|
|
||||||
codec->implementation->samples_per_second,
|
codec->implementation->samples_per_second,
|
||||||
dtmf_func,
|
|
||||||
text,
|
text,
|
||||||
bp,
|
&args);
|
||||||
len);
|
|
||||||
JS_ResumeRequest(cx, cb_state.saveDepth);
|
JS_ResumeRequest(cx, cb_state.saveDepth);
|
||||||
*rval = cb_state.ret;
|
*rval = cb_state.ret;
|
||||||
|
|
||||||
|
@ -39,14 +39,14 @@ static const char modname[] = "mod_say_en";
|
|||||||
char tmp[80];\
|
char tmp[80];\
|
||||||
switch_status_t status;\
|
switch_status_t status;\
|
||||||
snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
|
snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
|
||||||
if ((status = en_say_general_count(session, tmp, SST_ITEMS, SSM_PRONOUNCED, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {\
|
if ((status = en_say_general_count(session, tmp, SST_ITEMS, SSM_PRONOUNCED, args)) != SWITCH_STATUS_SUCCESS) {\
|
||||||
return status;\
|
return status;\
|
||||||
}}\
|
}}\
|
||||||
|
|
||||||
#define say_file(...) {\
|
#define say_file(...) {\
|
||||||
char tmp[80];\
|
char tmp[80];\
|
||||||
snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
|
snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
|
||||||
switch_ivr_play_file(session, NULL, tmp, NULL, input_callback, buf, buflen); \
|
switch_ivr_play_file(session, NULL, tmp, args); \
|
||||||
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
|
if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
|
||||||
return SWITCH_STATUS_FALSE;\
|
return SWITCH_STATUS_FALSE;\
|
||||||
}}\
|
}}\
|
||||||
@ -57,9 +57,7 @@ static switch_status_t en_spell(switch_core_session_t *session,
|
|||||||
char *tosay,
|
char *tosay,
|
||||||
switch_say_type_t type,
|
switch_say_type_t type,
|
||||||
switch_say_method_t method,
|
switch_say_method_t method,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -80,9 +78,7 @@ static switch_status_t play_group(int a,
|
|||||||
int c,
|
int c,
|
||||||
char *what,
|
char *what,
|
||||||
switch_core_session_t *session,
|
switch_core_session_t *session,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (a) {
|
if (a) {
|
||||||
@ -137,9 +133,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
|
|||||||
char *tosay,
|
char *tosay,
|
||||||
switch_say_type_t type,
|
switch_say_type_t type,
|
||||||
switch_say_method_t method,
|
switch_say_method_t method,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
int in;
|
int in;
|
||||||
@ -167,13 +161,13 @@ static switch_status_t en_say_general_count(switch_core_session_t *session,
|
|||||||
|
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case SSM_PRONOUNCED:
|
case SSM_PRONOUNCED:
|
||||||
if ((status = play_group(places[8], places[7], places[6], "digits/million.wav", session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = play_group(places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
if ((status = play_group(places[5], places[4], places[3], "digits/thousand.wav", session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = play_group(places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
if ((status = play_group(places[2], places[1], places[0], NULL, session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = play_group(places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -195,9 +189,7 @@ static switch_status_t en_say_time(switch_core_session_t *session,
|
|||||||
char *tosay,
|
char *tosay,
|
||||||
switch_say_type_t type,
|
switch_say_type_t type,
|
||||||
switch_say_method_t method,
|
switch_say_method_t method,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
int32_t t;
|
int32_t t;
|
||||||
switch_time_t target = 0;
|
switch_time_t target = 0;
|
||||||
@ -326,9 +318,7 @@ static switch_status_t en_say(switch_core_session_t *session,
|
|||||||
char *tosay,
|
char *tosay,
|
||||||
switch_say_type_t type,
|
switch_say_type_t type,
|
||||||
switch_say_method_t method,
|
switch_say_method_t method,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_say_callback_t say_cb = NULL;
|
switch_say_callback_t say_cb = NULL;
|
||||||
@ -356,7 +346,7 @@ static switch_status_t en_say(switch_core_session_t *session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (say_cb) {
|
if (say_cb) {
|
||||||
say_cb(session, tosay, type, method, input_callback, buf, buflen);
|
say_cb(session, tosay, type, method, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
146
src/switch_ivr.c
146
src/switch_ivr.c
@ -178,9 +178,7 @@ 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_args_t *args,
|
||||||
void *buf,
|
|
||||||
uint32_t buflen,
|
|
||||||
uint32_t timeout)
|
uint32_t timeout)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
@ -191,7 +189,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
|
|||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
if (!input_callback) {
|
if (!args->input_callback) {
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,11 +216,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
|
|||||||
|
|
||||||
if (switch_channel_has_dtmf(channel)) {
|
if (switch_channel_has_dtmf(channel)) {
|
||||||
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
||||||
status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen);
|
status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
||||||
status = input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, buf, buflen);
|
status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,9 +329,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
|
||||||
switch_file_handle_t *fh,
|
switch_file_handle_t *fh,
|
||||||
char *file,
|
char *file,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args,
|
||||||
void *buf,
|
|
||||||
uint32_t buflen,
|
|
||||||
uint32_t limit)
|
uint32_t limit)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
@ -454,28 +450,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback || buf || buflen) {
|
if (args->input_callback || args->buf || args->buflen) {
|
||||||
/*
|
/*
|
||||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
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 you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||||
*/
|
*/
|
||||||
if (switch_channel_has_dtmf(channel)) {
|
if (switch_channel_has_dtmf(channel)) {
|
||||||
if (!input_callback && !buf) {
|
if (!args->input_callback && !args->buf) {
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen);
|
status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string((char *)buf, dtmf, buflen);
|
switch_copy_string((char *)args->buf, dtmf, args->buflen);
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
||||||
status = input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, buf, buflen);
|
status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -957,10 +953,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session,
|
||||||
switch_file_handle_t *fh,
|
switch_file_handle_t *fh,
|
||||||
char *file,
|
char *file,
|
||||||
char *timer_name,
|
switch_input_args_t *args)
|
||||||
switch_input_callback_function_t input_callback,
|
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
int16_t abuf[FILE_STARTSAMPLES];
|
int16_t abuf[FILE_STARTSAMPLES];
|
||||||
@ -983,11 +976,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||||||
uint8_t asis = 0;
|
uint8_t asis = 0;
|
||||||
char *ext;
|
char *ext;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
char *timer_name;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
prefix = switch_channel_get_variable(channel, "sound_prefix");
|
prefix = switch_channel_get_variable(channel, "sound_prefix");
|
||||||
|
timer_name = switch_channel_get_variable(channel, "timer_name");
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
if (prefix && *file != '/' && *file != '\\' && *(file+1) != ':') {
|
if (prefix && *file != '/' && *file != '\\' && *(file+1) != ':') {
|
||||||
@ -1166,29 +1161,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback || buf || buflen) {
|
if (args->input_callback || args->buf || args->buflen) {
|
||||||
/*
|
/*
|
||||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
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 you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||||
*/
|
*/
|
||||||
if (switch_channel_has_dtmf(channel)) {
|
if (switch_channel_has_dtmf(channel)) {
|
||||||
if (!input_callback && !buf) {
|
if (!args->input_callback && !args->buf) {
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen);
|
status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string((char *)buf, dtmf, buflen);
|
switch_copy_string((char *)args->buf, dtmf, args->buflen);
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
||||||
status = input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, buf, buflen);
|
status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1406,11 +1401,14 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
|||||||
|
|
||||||
//Start pestering the user for input
|
//Start pestering the user for input
|
||||||
for(;(switch_channel_get_state(channel) == CS_EXECUTE) && max_tries > 0; max_tries--) {
|
for(;(switch_channel_get_state(channel) == CS_EXECUTE) && max_tries > 0; max_tries--) {
|
||||||
|
switch_input_args_t args = {0};
|
||||||
//make the buffer so fresh and so clean clean
|
//make the buffer so fresh and so clean clean
|
||||||
memset(digit_buffer, 0, digit_buffer_length);
|
memset(digit_buffer, 0, digit_buffer_length);
|
||||||
|
|
||||||
|
args.buf = digit_buffer;
|
||||||
|
args.buflen = digit_buffer_length;
|
||||||
//Play the file
|
//Play the file
|
||||||
status = switch_ivr_play_file(session, NULL, prompt_audio_file, NULL, NULL, digit_buffer, digit_buffer_length);
|
status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "play gave up %s", digit_buffer);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "play gave up %s", digit_buffer);
|
||||||
|
|
||||||
//Make sure we made it out alive
|
//Make sure we made it out alive
|
||||||
@ -1433,7 +1431,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
|||||||
} else {
|
} else {
|
||||||
//See if a bad input prompt was specified, if so, play it
|
//See if a bad input prompt was specified, if so, play it
|
||||||
if (strlen(bad_input_audio_file) > 0) {
|
if (strlen(bad_input_audio_file) > 0) {
|
||||||
status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL);
|
||||||
|
|
||||||
//Make sure we made it out alive
|
//Make sure we made it out alive
|
||||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||||
@ -1473,7 +1471,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
|||||||
} else {
|
} else {
|
||||||
//See if a bad input prompt was specified, if so, play it
|
//See if a bad input prompt was specified, if so, play it
|
||||||
if (strlen(bad_input_audio_file) > 0) {
|
if (strlen(bad_input_audio_file) > 0) {
|
||||||
status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL);
|
||||||
|
|
||||||
//Make sure we made it out alive
|
//Make sure we made it out alive
|
||||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||||
@ -1499,10 +1497,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||||||
switch_speech_handle_t *sh,
|
switch_speech_handle_t *sh,
|
||||||
switch_codec_t *codec,
|
switch_codec_t *codec,
|
||||||
switch_timer_t *timer,
|
switch_timer_t *timer,
|
||||||
switch_input_callback_function_t input_callback,
|
|
||||||
char *text,
|
char *text,
|
||||||
void *buf,
|
switch_input_args_t *args)
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
short abuf[960];
|
short abuf[960];
|
||||||
@ -1562,33 +1558,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback || buf || buflen) {
|
if (args->input_callback || args->buf || args->buflen) {
|
||||||
/*
|
/*
|
||||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
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 you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||||
*/
|
*/
|
||||||
if (switch_channel_has_dtmf(channel)) {
|
if (switch_channel_has_dtmf(channel)) {
|
||||||
if (!input_callback && !buf) {
|
if (!args->input_callback && !args->buf) {
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (buf && !strcasecmp(buf, "_break_")) {
|
if (args->buf && !strcasecmp(args->buf, "_break_")) {
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
} else {
|
} else {
|
||||||
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen);
|
status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string((char *)buf, dtmf, buflen);
|
switch_copy_string((char *)args->buf, dtmf, args->buflen);
|
||||||
status = SWITCH_STATUS_BREAK;
|
status = SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_callback) {
|
if (args->input_callback) {
|
||||||
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
|
||||||
status = input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, buf, buflen);
|
status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1687,12 +1683,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
||||||
char *tts_name,
|
char *tts_name,
|
||||||
char *voice_name,
|
char *voice_name,
|
||||||
char *timer_name,
|
|
||||||
uint32_t rate,
|
uint32_t rate,
|
||||||
switch_input_callback_function_t input_callback,
|
|
||||||
char *text,
|
char *text,
|
||||||
void *buf,
|
switch_input_args_t *args)
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
@ -1709,10 +1702,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
|
|||||||
switch_speech_handle_t sh;
|
switch_speech_handle_t sh;
|
||||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
|
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
|
||||||
switch_codec_t *read_codec;
|
switch_codec_t *read_codec;
|
||||||
|
char *timer_name;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
|
timer_name = switch_channel_get_variable(channel, "timer_name");
|
||||||
|
|
||||||
if (rate == 0) {
|
if (rate == 0) {
|
||||||
read_codec = switch_core_session_get_read_codec(session);
|
read_codec = switch_core_session_get_read_codec(session);
|
||||||
rate = read_codec->implementation->samples_per_second;
|
rate = read_codec->implementation->samples_per_second;
|
||||||
@ -1776,7 +1772,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_ivr_speak_text_handle(session, &sh, &codec, timer_name ? &timer : NULL, input_callback, text, buf, buflen);
|
switch_ivr_speak_text_handle(session, &sh, &codec, timer_name ? &timer : NULL, text, args);
|
||||||
flags = 0;
|
flags = 0;
|
||||||
switch_core_speech_close(&sh, &flags);
|
switch_core_speech_close(&sh, &flags);
|
||||||
switch_core_codec_destroy(&codec);
|
switch_core_codec_destroy(&codec);
|
||||||
@ -2181,8 +2177,10 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
if (collect->file) {
|
if (collect->file) {
|
||||||
|
switch_input_args_t args = {0};
|
||||||
switch_ivr_play_file(collect->session, NULL, collect->file, NULL, NULL, buf, sizeof(buf));
|
args.buf = buf;
|
||||||
|
args.buflen = sizeof(buf);
|
||||||
|
switch_ivr_play_file(collect->session, NULL, collect->file, &args);
|
||||||
} else {
|
} else {
|
||||||
switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, "", &term, 0);
|
switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, "", &term, 0);
|
||||||
}
|
}
|
||||||
@ -3753,7 +3751,6 @@ struct switch_ivr_menu {
|
|||||||
char *tts_voice;
|
char *tts_voice;
|
||||||
char *buf;
|
char *buf;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char *timer_name;
|
|
||||||
int max_failures;
|
int max_failures;
|
||||||
int timeout;
|
int timeout;
|
||||||
uint32_t inlen;
|
uint32_t inlen;
|
||||||
@ -3805,7 +3802,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_men
|
|||||||
char *tts_voice,
|
char *tts_voice,
|
||||||
int timeout,
|
int timeout,
|
||||||
int max_failures,
|
int max_failures,
|
||||||
char *timer_name,
|
|
||||||
switch_memory_pool_t *pool)
|
switch_memory_pool_t *pool)
|
||||||
{
|
{
|
||||||
switch_ivr_menu_t *menu;
|
switch_ivr_menu_t *menu;
|
||||||
@ -3857,10 +3853,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_men
|
|||||||
menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
|
menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_strlen_zero(timer_name)) {
|
|
||||||
menu->timer_name = switch_core_strdup(menu->pool, timer_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
menu->max_failures = max_failures;
|
menu->max_failures = max_failures;
|
||||||
|
|
||||||
menu->timeout = timeout;
|
menu->timeout = timeout;
|
||||||
@ -3944,7 +3936,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *st
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_menu_t *menu, char *sound, uint32_t need, char *timer_name)
|
static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_menu_t *menu, char *sound, uint32_t need)
|
||||||
{
|
{
|
||||||
char terminator;
|
char terminator;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
@ -3964,10 +3956,16 @@ static switch_status_t play_or_say(switch_core_session_t *session, switch_ivr_me
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*sound == '/' || *sound == '\\') {
|
if (*sound == '/' || *sound == '\\') {
|
||||||
status = switch_ivr_play_file(session, NULL, sound, timer_name, NULL, ptr, need ? 1 : 0);
|
switch_input_args_t args = {0};
|
||||||
|
args.buf = ptr;
|
||||||
|
args.buflen = need ? 1 : 0;
|
||||||
|
status = switch_ivr_play_file(session, NULL, sound, &args);
|
||||||
} else {
|
} else {
|
||||||
if (menu->tts_engine && menu->tts_voice) {
|
if (menu->tts_engine && menu->tts_voice) {
|
||||||
status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, NULL, 0, NULL, sound, ptr, len);
|
switch_input_args_t args = {0};
|
||||||
|
args.buf = ptr;
|
||||||
|
args.buflen = len;
|
||||||
|
status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, 0, sound, &args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4032,7 +4030,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
|
|||||||
memset(arg, 0, sizeof(arg));
|
memset(arg, 0, sizeof(arg));
|
||||||
|
|
||||||
memset(menu->buf, 0, menu->inlen);
|
memset(menu->buf, 0, menu->inlen);
|
||||||
status = play_or_say(session, menu, greeting_sound, menu->inlen, stack->timer_name);
|
status = play_or_say(session, menu, greeting_sound, menu->inlen);
|
||||||
|
|
||||||
if (!switch_strlen_zero(menu->buf)) {
|
if (!switch_strlen_zero(menu->buf)) {
|
||||||
for(ap = menu->actions; ap ; ap = ap->next) {
|
for(ap = menu->actions; ap ; ap = ap->next) {
|
||||||
@ -4051,15 +4049,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR action on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf,aptr);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR action on menu '%s' matched '%s' param '%s'\n", menu->name, menu->buf,aptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch(todo) {
|
switch(todo) {
|
||||||
case SWITCH_IVR_ACTION_DIE:
|
case SWITCH_IVR_ACTION_DIE:
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
break;
|
break;
|
||||||
case SWITCH_IVR_ACTION_PLAYSOUND:
|
case SWITCH_IVR_ACTION_PLAYSOUND:
|
||||||
status = switch_ivr_play_file(session, NULL, aptr, stack->timer_name, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, aptr, NULL);
|
||||||
break;
|
break;
|
||||||
case SWITCH_IVR_ACTION_SAYTEXT:
|
case SWITCH_IVR_ACTION_SAYTEXT:
|
||||||
status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, NULL, 0, NULL, aptr, NULL, 0);
|
status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, 0, aptr, NULL);
|
||||||
break;
|
break;
|
||||||
case SWITCH_IVR_ACTION_TRANSFER:
|
case SWITCH_IVR_ACTION_TRANSFER:
|
||||||
switch_ivr_session_transfer(session, aptr, NULL, NULL);
|
switch_ivr_session_transfer(session, aptr, NULL, NULL);
|
||||||
@ -4123,7 +4122,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name, menu->buf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name, menu->buf);
|
||||||
|
|
||||||
if (menu->invalid_sound) {
|
if (menu->invalid_sound) {
|
||||||
play_or_say(session, menu, menu->invalid_sound, 0, stack->timer_name);
|
play_or_say(session, menu, menu->invalid_sound, 0);
|
||||||
}
|
}
|
||||||
errs++;
|
errs++;
|
||||||
|
|
||||||
@ -4135,7 +4134,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
|
|||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "exit-sound '%s'\n",menu->exit_sound);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "exit-sound '%s'\n",menu->exit_sound);
|
||||||
if (!switch_strlen_zero(menu->exit_sound)) {
|
if (!switch_strlen_zero(menu->exit_sound)) {
|
||||||
status = switch_ivr_play_file(session, NULL, menu->exit_sound, stack->timer_name, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, menu->exit_sound, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(menu->buf);
|
switch_safe_free(menu->buf);
|
||||||
@ -4260,8 +4259,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
|
||||||
switch_ivr_menu_t **menu_stack,
|
switch_ivr_menu_t **menu_stack,
|
||||||
switch_xml_t xml_menus,
|
switch_xml_t xml_menus,
|
||||||
switch_xml_t xml_menu,
|
switch_xml_t xml_menu)
|
||||||
char *timer_name)
|
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
@ -4278,7 +4277,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
|
|||||||
switch_ivr_menu_t *menu = NULL;
|
switch_ivr_menu_t *menu = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "building menu '%s'\n",menu_name);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "building menu '%s'\n",menu_name);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "timer_name '%s'\n",timer_name);
|
|
||||||
status = switch_ivr_menu_init(&menu,
|
status = switch_ivr_menu_init(&menu,
|
||||||
*menu_stack,
|
*menu_stack,
|
||||||
menu_name,
|
menu_name,
|
||||||
@ -4290,7 +4288,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
|
|||||||
tts_voice,
|
tts_voice,
|
||||||
atoi(timeout)*1000,
|
atoi(timeout)*1000,
|
||||||
atoi(max_failures),
|
atoi(max_failures),
|
||||||
timer_name,
|
|
||||||
xml_menu_ctx->pool
|
xml_menu_ctx->pool
|
||||||
);
|
);
|
||||||
// set the menu_stack for the caller
|
// set the menu_stack for the caller
|
||||||
@ -4322,7 +4319,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
|
|||||||
// do we need to build a new sub-menu ?
|
// do we need to build a new sub-menu ?
|
||||||
if (xml_map->action == SWITCH_IVR_ACTION_EXECMENU && switch_ivr_menu_find(*menu_stack, param) == NULL) {
|
if (xml_map->action == SWITCH_IVR_ACTION_EXECMENU && switch_ivr_menu_find(*menu_stack, param) == NULL) {
|
||||||
if ((xml_menu = switch_xml_find_child(xml_menus, "menu", "name", param)) != NULL) {
|
if ((xml_menu = switch_xml_find_child(xml_menus, "menu", "name", param)) != NULL) {
|
||||||
status = switch_ivr_menu_stack_xml_build(xml_menu_ctx, menu_stack, xml_menus, xml_menu, timer_name);
|
status = switch_ivr_menu_stack_xml_build(xml_menu_ctx, menu_stack, xml_menus, xml_menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4412,9 +4409,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||||||
char *macro_name,
|
char *macro_name,
|
||||||
char *data,
|
char *data,
|
||||||
char *lang,
|
char *lang,
|
||||||
switch_input_callback_function_t input_callback,
|
switch_input_args_t *args)
|
||||||
void *buf,
|
|
||||||
uint32_t buflen)
|
|
||||||
{
|
{
|
||||||
switch_xml_t cfg, xml = NULL, language, macros, macro, input, action;
|
switch_xml_t cfg, xml = NULL, language, macros, macro, input, action;
|
||||||
char *lname = NULL, *mname = NULL, hint_data[1024] = "", enc_hint[1024] = "";
|
char *lname = NULL, *mname = NULL, hint_data[1024] = "", enc_hint[1024] = "";
|
||||||
@ -4528,7 +4524,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, lang);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, lang);
|
||||||
|
|
||||||
if (!strcasecmp(func, "play-file")) {
|
if (!strcasecmp(func, "play-file")) {
|
||||||
switch_ivr_play_file(session, NULL, odata, NULL, input_callback, buf, buflen);
|
switch_ivr_play_file(session, NULL, odata, args);
|
||||||
} else if (!strcasecmp(func, "execute")) {
|
} else if (!strcasecmp(func, "execute")) {
|
||||||
const switch_application_interface_t *application_interface;
|
const switch_application_interface_t *application_interface;
|
||||||
char *app_name = NULL;
|
char *app_name = NULL;
|
||||||
@ -4557,22 +4553,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||||||
char *say_type = (char *) switch_xml_attr_soft(action, "type");
|
char *say_type = (char *) switch_xml_attr_soft(action, "type");
|
||||||
char *say_method = (char *) switch_xml_attr_soft(action, "method");
|
char *say_method = (char *) switch_xml_attr_soft(action, "method");
|
||||||
|
|
||||||
si->say_function(session, odata, get_say_type_by_name(say_type), get_say_method_by_name(say_method), input_callback, buf, buflen);
|
si->say_function(session, odata, get_say_type_by_name(say_type), get_say_method_by_name(say_method), args);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid SAY Interface [%s]!\n", lang);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid SAY Interface [%s]!\n", lang);
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(func, "speak-text")) {
|
} else if (!strcasecmp(func, "speak-text")) {
|
||||||
switch_codec_t *read_codec;
|
switch_codec_t *read_codec;
|
||||||
if ((read_codec = switch_core_session_get_read_codec(session))) {
|
if ((read_codec = switch_core_session_get_read_codec(session))) {
|
||||||
|
|
||||||
switch_ivr_speak_text(session,
|
switch_ivr_speak_text(session,
|
||||||
tts_engine,
|
tts_engine,
|
||||||
tts_voice,
|
tts_voice,
|
||||||
NULL,
|
|
||||||
read_codec->implementation->samples_per_second,
|
read_codec->implementation->samples_per_second,
|
||||||
input_callback,
|
|
||||||
odata,
|
odata,
|
||||||
buf,
|
args);
|
||||||
buflen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,18 +158,14 @@ void fs_channel_set_state(switch_core_session_t *session, char *state)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int fs_ivr_play_file(switch_core_session_t *session,
|
int fs_ivr_play_file(switch_core_session_t *session,
|
||||||
char *file,
|
char *file)
|
||||||
char *timer_name,
|
|
||||||
switch_input_callback_function_t dtmf_callback,
|
|
||||||
void *buf,
|
|
||||||
unsigned int buflen)
|
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
if (switch_strlen_zero(timer_name)) {
|
if (switch_strlen_zero(timer_name)) {
|
||||||
timer_name = NULL;
|
timer_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = switch_ivr_play_file(session, NULL, file, timer_name, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, file, NULL);
|
||||||
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +198,7 @@ int fs_ivr_play_file2(switch_core_session_t *session,
|
|||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
|
||||||
status = switch_ivr_play_file(session, NULL, file, NULL, NULL, NULL, 0);
|
status = switch_ivr_play_file(session, NULL, file, NULL, NULL);
|
||||||
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,16 +290,12 @@ int fs_switch_ivr_session_transfer(switch_core_session_t *session,
|
|||||||
int fs_switch_ivr_speak_text (switch_core_session_t *session,
|
int fs_switch_ivr_speak_text (switch_core_session_t *session,
|
||||||
char *tts_name,
|
char *tts_name,
|
||||||
char *voice_name,
|
char *voice_name,
|
||||||
char *timer_name,
|
|
||||||
uint32_t rate,
|
uint32_t rate,
|
||||||
switch_input_callback_function_t dtmf_callback,
|
char *text)
|
||||||
char *text,
|
|
||||||
void *buf,
|
|
||||||
unsigned int buflen)
|
|
||||||
{
|
{
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
|
||||||
status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);
|
status = switch_ivr_speak_text(session,tts_name,voice_name,rate,text,NULL);
|
||||||
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user