From 591c9b87aad6c320a83e054e0d19c011fa79b8af Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Dec 2006 16:40:37 +0000 Subject: [PATCH] ruin everything, sorry jamesdotcom git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3815 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_ivr.h | 45 +- src/include/switch_types.h | 10 +- .../mod_conference/mod_conference.c | 4 +- .../applications/mod_dptools/mod_dptools.c | 4 +- .../applications/mod_ivrtest/mod_ivrtest.c | 17 +- .../applications/mod_playback/mod_playback.c | 21 +- src/mod/languages/mod_perl/switch_swig_wrap.c | 71 +- src/mod/languages/mod_php/switch_swig_wrap.c | 82 +- src/mod/languages/mod_python/freeswitch.py | 20 +- .../languages/mod_python/mod_python_wrap.cpp | 2868 ++++------------- src/mod/languages/mod_ruby/switch_swig_wrap.c | 50 +- .../mod_spidermonkey/mod_spidermonkey.c | 50 +- src/mod/say/mod_say_en/mod_say_en.c | 38 +- src/switch_ivr.c | 158 +- src/switch_swig.c | 18 +- 15 files changed, 852 insertions(+), 2604 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index fa74b85227..f75c42883c 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -43,8 +43,6 @@ SWITCH_BEGIN_EXTERN_C - - /** * @defgroup switch_ivr IVR Library * @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. */ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, - switch_input_callback_function_t dtmf_callback, - void *buf, - uint32_t buflen, + switch_input_args_t *args, 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 fh file handle to use (NULL for builtin one) \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 buf an object to maintain across calls \param buflen the size of buf @@ -183,13 +178,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback. */ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, - switch_file_handle_t *fh, - char *file, - char *timer_name, - switch_input_callback_function_t dtmf_callback, - void *buf, - uint32_t buflen); - + switch_file_handle_t *fh, + char *file, + switch_input_args_t *args); /*! @@ -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_file_handle_t *fh, char *file, - switch_input_callback_function_t dtmf_callback, - void *buf, - uint32_t buflen, + switch_input_args_t *args, 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_codec_t *codec, switch_timer_t *timer, - switch_input_callback_function_t dtmf_callback, char *text, - void *buf, - uint32_t buflen); + switch_input_args_t *args); /*! \brief Speak given text with given tts engine \param session the session to speak on \param tts_name the desired tts module \param voice_name the desired voice - \param timer_name optional timer to use for async behaviour \param rate the sample rate \param dtmf_callback code to execute if any dtmf is dialed during the audio \param text the text to speak @@ -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, char *tts_name, char *voice_name, - char *timer_name, uint32_t rate, - switch_input_callback_function_t dtmf_callback, char *text, - void *buf, - uint32_t buflen); + switch_input_args_t *args); /*! \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 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 timer_name A pointer to a timer name *\param pool memory pool (NULL to create one) *\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, int timeout, int max_failures, - char *timer_name, 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 xml_menus The xml Menus source *\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 */ 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_xml_t xml_menus, - switch_xml_t xml_menu, - char *timer_name); + switch_ivr_menu_t **menu_stack, + switch_xml_t xml_menus, + switch_xml_t xml_menu); /*! *\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 *data, char *lang, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen); + switch_input_args_t *args); /** @} */ SWITCH_END_EXTERN_C diff --git a/src/include/switch_types.h b/src/include/switch_types.h index ac528629e5..3a4330fd30 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -917,13 +917,16 @@ typedef switch_status_t (*switch_input_callback_function_t)(switch_core_session_ void *buf, unsigned int buflen); 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, char *tosay, switch_say_type_t type, switch_say_method_t method, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen); + switch_input_args_t *args); 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_reload_t) (void); @@ -940,7 +943,6 @@ typedef switch_xml_t (*switch_xml_search_function_t)(char *section, char *key_value, char *params); - /* things we don't deserve to know about */ /*! \brief A channel */ struct switch_channel; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 3fe97535d9..f0715eebfb 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -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 (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; @@ -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) { - 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); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index acd7e6e202..92e2badc67 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -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_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_ && switch_ivr_menu_stack_xml_add_custom(xml_ctx, "custom", &menu_handler) == SWITCH_STATUS_SUCCESS #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_ivr_menu_execute(session,menu_stack,params,NULL); diff --git a/src/mod/applications/mod_ivrtest/mod_ivrtest.c b/src/mod/applications/mod_ivrtest/mod_ivrtest.c index 893ef4dcb9..023e4f4818 100644 --- a/src/mod/applications/mod_ivrtest/mod_ivrtest.c +++ b/src/mod/applications/mod_ivrtest/mod_ivrtest.c @@ -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 *argv[3]; int argc; + switch_input_args_t args = {0}; if(!(mydata = switch_core_session_strdup(session, (char *) data))) { return; @@ -223,8 +224,10 @@ static void tts_function(switch_core_session_t *session, char *data) switch_channel_answer(channel); codec = switch_core_session_get_read_codec(session); - - switch_ivr_speak_text(session, tts_name, voice_name, NULL, codec->implementation->samples_per_second, show_dtmf, text, buf, sizeof(buf)); + args.input_callback = show_dtmf; + 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"); } @@ -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"); 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) 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) { 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); 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); } } diff --git a/src/mod/applications/mod_playback/mod_playback.c b/src/mod/applications/mod_playback/mod_playback.c index 2504091b6f..3746c67fd2 100644 --- a/src/mod/applications/mod_playback/mod_playback.c +++ b/src/mod/applications/mod_playback/mod_playback.c @@ -72,6 +72,7 @@ static void speak_function(switch_core_session_t *session, char *data) char *timer_name = NULL; char *mydata = NULL; switch_codec_t *codec; + switch_input_args_t args = {0}; codec = switch_core_session_get_read_codec(session); assert(codec != NULL); @@ -85,7 +86,6 @@ static void speak_function(switch_core_session_t *session, char *data) engine = argv[0]; voice = argv[1]; text = argv[2]; - timer_name = argv[3]; if (!(engine && voice && text)) { if (!engine) { @@ -102,28 +102,29 @@ static void speak_function(switch_core_session_t *session, char *data) } 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) { switch_channel_t *channel; - char *timer_name = NULL; char *file_name = NULL; + switch_input_args_t args = {0}; 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); assert(channel != NULL); 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; char *path; char *p; + switch_input_args_t args = {0}; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -145,7 +147,8 @@ static void record_function(switch_core_session_t *session, char *data) 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))) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); diff --git a/src/mod/languages/mod_perl/switch_swig_wrap.c b/src/mod/languages/mod_perl/switch_swig_wrap.c index dce95633c9..67d991989a 100644 --- a/src/mod/languages/mod_perl/switch_swig_wrap.c +++ b/src/mod/languages/mod_perl/switch_swig_wrap.c @@ -791,8 +791,6 @@ SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv); SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *); #endif -#include - extern void fs_core_set_globals(void); extern int fs_core_init(char *); 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_get_variable(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_sleep(switch_core_session_t *,uint32_t); 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_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_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 int fs_switch_channel_set_variable(switch_channel_t *,char *,char *); +#include "switch.h" #ifdef PERL_OBJECT #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 ; char *arg2 ; - char *arg3 ; - switch_input_callback_function_t arg4 ; - void *arg5 = (void *) 0 ; - unsigned int arg6 ; int result; int argvi = 0; dXSARGS; - if ((items < 6) || (items > 6)) { - SWIG_croak("Usage: fs_ivr_play_file(session,file,timer_name,dtmf_callback,buf,buflen);"); + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: fs_ivr_play_file(session,file);"); } { 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; else arg2 = (char *) SvPV(ST(1), PL_na); - if (!SvOK((SV*) ST(2))) arg3 = 0; - 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); + result = (int)fs_ivr_play_file(arg1,arg2); ST(argvi) = sv_newmortal(); 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 ; char *arg2 ; char *arg3 ; - char *arg4 ; - uint32_t arg5 ; - switch_input_callback_function_t arg6 ; - char *arg7 ; - void *arg8 = (void *) 0 ; - unsigned int arg9 ; + uint32_t arg4 ; + char *arg5 ; int result; int argvi = 0; dXSARGS; - if ((items < 9) || (items > 9)) { - SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);"); + if ((items < 5) || (items > 5)) { + 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) { @@ -1568,31 +1544,16 @@ XS(_wrap_fs_switch_ivr_speak_text) { else arg2 = (char *) SvPV(ST(1), PL_na); if (!SvOK((SV*) ST(2))) arg3 = 0; 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; - if (SWIG_ConvertPtr(ST(4),(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"); + if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) { + SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t"); } - arg5 = *argp; + arg4 = *argp; } - { - switch_input_callback_function_t * argp; - if (SWIG_ConvertPtr(ST(5),(void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,0) < 0) { - 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); + if (!SvOK((SV*) ST(4))) arg5 = 0; + else arg5 = (char *) SvPV(ST(4), PL_na); + result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5); ST(argvi) = sv_newmortal(); sv_setiv(ST(argvi++), (IV) result); diff --git a/src/mod/languages/mod_php/switch_swig_wrap.c b/src/mod/languages/mod_php/switch_swig_wrap.c index 4f058adb56..e549c0223e 100644 --- a/src/mod/languages/mod_php/switch_swig_wrap.c +++ b/src/mod/languages/mod_php/switch_swig_wrap.c @@ -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_get_variable(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_sleep(switch_core_session_t *,uint32_t); 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_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_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 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) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg2 ; - char *arg3 ; - switch_input_callback_function_t arg4 ; - void *arg5 = (void *) 0 ; - unsigned int arg6 ; int result; - zval **args[7]; + zval **args[3]; int argbase=0 ; if (this_ptr && this_ptr->type==IS_OBJECT) { /* fake this_ptr as first arg (till we can work out how to do it better */ 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; } @@ -1106,29 +1102,7 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) { convert_to_string_ex(args[1-argbase]); arg2 = (char *) Z_STRVAL_PP(args[1-argbase]); - - 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); + result = (int)fs_ivr_play_file(arg1,arg2); 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 ; char *arg2 ; char *arg3 ; - char *arg4 ; - uint32_t arg5 ; - switch_input_callback_function_t arg6 ; - char *arg7 ; - void *arg8 = (void *) 0 ; - unsigned int arg9 ; + uint32_t arg4 ; + char *arg5 ; int result; - zval **args[10]; + zval **args[6]; int argbase=0 ; if (this_ptr && this_ptr->type==IS_OBJECT) { /* fake this_ptr as first arg (till we can work out how to do it better */ 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; } @@ -1500,40 +1470,18 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) { convert_to_string_ex(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; - if(SWIG_ConvertPtr(*args[4-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); + 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", 4-argbase, SWIGTYPE_p_uint32_t->name); } - arg5 = *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; + arg4 = *argp; } - convert_to_string_ex(args[6-argbase]); - arg7 = (char *) Z_STRVAL_PP(args[6-argbase]); + convert_to_string_ex(args[4-argbase]); + arg5 = (char *) Z_STRVAL_PP(args[4-argbase]); - - 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); + result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5); ZVAL_LONG(return_value,result); diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index 5920de24a9..a3b40365b6 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -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. +# This file is compatible with both classic and new-style classes. import _freeswitch -# This file is compatible with both classic and new-style classes. -def _swig_setattr_nondynamic(self,class_type,name,value,static=1): +def _swig_setattr(self,class_type,name,value): if (name == "this"): if isinstance(value, class_type): self.__dict__[name] = value.this @@ -13,13 +13,7 @@ def _swig_setattr_nondynamic(self,class_type,name,value,static=1): return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) - if (not static) or hasattr(self,name) or (name == "thisown"): - 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) + self.__dict__[name] = value def _swig_getattr(self,class_type,name): method = class_type.__swig_getmethods__.get(name,None) @@ -44,7 +38,7 @@ class SessionContainer(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, SessionContainer, name) def __repr__(self): - return "<%s.%s; proxy of C++ SessionContainer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,) + return "" % (self.this,) def __init__(self, *args): _swig_setattr(self, SessionContainer, 'this', _freeswitch.new_SessionContainer(*args)) _swig_setattr(self, SessionContainer, 'thisown', 1) @@ -52,7 +46,6 @@ class SessionContainer(_object): try: if self.thisown: destroy(self) except: pass - def console_log(*args): return _freeswitch.SessionContainer_console_log(*args) def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args) def answer(*args): return _freeswitch.SessionContainer_answer(*args) @@ -73,9 +66,8 @@ class SessionContainerPtr(SessionContainer): def __init__(self, this): _swig_setattr(self, SessionContainer, 'this', this) 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) cvar = _freeswitch.cvar - diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index f844679de3..0d4b3dd5f8 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.27 + * Version 1.3.21 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -23,119 +23,77 @@ public: T *operator&() { return tt; } private: SwigValueWrapper& operator=(const SwigValueWrapper& rhs); -}; +}; #endif -/*********************************************************************** + +#include "Python.h" + +/*************************************************************** -*- c -*- + * python/precommon.swg * - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. + * Rename all exported symbols from common.swg, to avoid symbol + * clashes if multiple interpreters are included * ************************************************************************/ -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif +#define SWIG_TypeRegister SWIG_Python_TypeRegister +#define SWIG_TypeCheck SWIG_Python_TypeCheck +#define SWIG_TypeCast SWIG_Python_TypeCast +#define SWIG_TypeDynamicCast SWIG_Python_TypeDynamicCast +#define SWIG_TypeName SWIG_Python_TypeName +#define SWIG_TypeQuery SWIG_Python_TypeQuery +#define SWIG_TypeClientData SWIG_Python_TypeClientData +#define SWIG_PackData SWIG_Python_PackData +#define SWIG_UnpackData SWIG_Python_UnpackData -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) || defined(__ICC) -# define SWIGUNUSED __attribute__ ((unused)) -# else -# define SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods for Windows DLLs */ -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# define SWIGEXPORT -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - - - -#include /*********************************************************************** - * swigrun.swg + * common.swg * - * This file contains generic CAPI SWIG runtime support for pointer - * type checking. + * This file contains generic SWIG runtime support for pointer + * type checking as well as a few commonly used macros to control + * external linkage. * + * Author : David Beazley (beazley@cs.uchicago.edu) + * + * Copyright (c) 1999-2000, The University of Chicago + * + * This file may be freely redistributed without license or fee provided + * this copyright message remains intact. ************************************************************************/ -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "2" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the swig runtime code. - In 99.9% of the cases, swig just needs to declare them as 'static'. - - But only do this if is strictly necessary, ie, if you have problems - with your compiler or so. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - #include +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(_MSC_VER) || defined(__GNUC__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT(a) a +# define SWIGIMPORT(a) extern a +# else +# define SWIGEXPORT(a) __declspec(dllexport) a +# define SWIGIMPORT(a) extern a +# endif +# else +# if defined(__BORLANDC__) +# define SWIGEXPORT(a) a _export +# define SWIGIMPORT(a) a _export +# else +# define SWIGEXPORT(a) a +# define SWIGIMPORT(a) a +# endif +# endif +#else +# define SWIGEXPORT(a) a +# define SWIGIMPORT(a) a +#endif + +#ifdef SWIG_GLOBAL +# define SWIGRUNTIME(a) SWIGEXPORT(a) +#else +# define SWIGRUNTIME(a) static a +#endif + #ifdef __cplusplus extern "C" { #endif @@ -143,141 +101,106 @@ extern "C" { typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ + const char *name; + swig_converter_func converter; + const char *str; + void *clientdata; + swig_dycast_func dcast; + struct swig_type_info *next; + struct swig_type_info *prev; } swig_type_info; -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; +#ifdef SWIG_NOINCLUDE -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; +SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *); +SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *); +SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *); +SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **); +SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *); +SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *); +SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *); +SWIGIMPORT(char *) SWIG_PackData(char *, void *, int); +SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int); +#else -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class" == "Class", etc. +static swig_type_info *swig_type_list = 0; - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (int)(*f1 - *f2); - } - return (l1 - f1) - (l2 - f2); -} - -/* - Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; +/* Register a type mapping with the type-checking */ +SWIGRUNTIME(swig_type_info *) +SWIG_TypeRegister(swig_type_info *ti) { + swig_type_info *tc, *head, *ret, *next; + /* Check to see if this type has already been registered */ + tc = swig_type_list; + while (tc) { + if (strcmp(tc->name, ti->name) == 0) { + /* Already exists in the table. Just add additional types to the list */ + if (tc->clientdata) ti->clientdata = tc->clientdata; + head = tc; + next = tc->next; + goto l1; } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; + tc = tc->prev; } - return equiv; + head = ti; + next = 0; + + /* Place in list */ + ti->prev = swig_type_list; + swig_type_list = ti; + + /* Build linked lists */ + l1: + ret = head; + tc = ti + 1; + /* Patch up the rest of the links */ + while (tc->name) { + head->next = tc; + tc->prev = head; + head = tc; + tc++; + } + if (next) next->prev = head; + head->next = next; + return ret; } -/* - Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; +/* Check the typename */ +SWIGRUNTIME(swig_type_info *) +SWIG_TypeCheck(char *c, swig_type_info *ty) { + swig_type_info *s; + if (!ty) return 0; /* Void pointer */ + s = ty->next; /* First element always just a name */ + do { + if (strcmp(s->name,c) == 0) { + if (s == ty->next) return s; + /* Move s to the top of the linked list */ + s->prev->next = s->next; + if (s->next) { + s->next->prev = s->prev; + } + /* Insert s as second element in the list */ + s->next = ty->next; + if (ty->next) ty->next->prev = s; + ty->next = s; + s->prev = ty; + return s; } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; + s = s->next; + } while (s && (s != ty->next)); + return 0; } - -/* think of this as a c++ template<> or a scheme macro */ -#define SWIG_TypeCheck_Template(comparison, ty) \ - if (ty) { \ - swig_cast_info *iter = ty->cast; \ - while (iter) { \ - if (comparison) { \ - if (iter == ty->cast) return iter; \ - /* Move iter to the top of the linked list */ \ - iter->prev->next = iter->next; \ - if (iter->next) \ - iter->next->prev = iter->prev; \ - iter->next = ty->cast; \ - iter->prev = 0; \ - if (ty->cast) ty->cast->prev = iter; \ - ty->cast = iter; \ - return iter; \ - } \ - iter = iter->next; \ - } \ - } \ - return 0 - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); +/* Cast a pointer up an inheritance hierarchy */ +SWIGRUNTIME(void *) +SWIG_TypeCast(swig_type_info *ty, void *ptr) { + if ((!ty) || (!ty->converter)) return ptr; + return (*ty->converter)(ptr); } -/* Same as previous function, except strcmp is replaced with a pointer comparison */ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { - SWIG_TypeCheck_Template(iter->type == from, into); -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * +/* Dynamic pointer casting. Down an inheritance hierarchy */ +SWIGRUNTIME(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { swig_type_info *lastty = ty; if (!ty || !ty->dcast) return ty; @@ -288,285 +211,118 @@ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { return lastty; } -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * +/* Return the name associated with this type */ +SWIGRUNTIME(const char *) SWIG_TypeName(const swig_type_info *ty) { return ty->name; } -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; +/* Search for a swig_type_info structure */ +SWIGRUNTIME(swig_type_info *) +SWIG_TypeQuery(const char *name) { + swig_type_info *ty = swig_type_list; + while (ty) { + if (ty->str && (strcmp(name,ty->str) == 0)) return ty; + if (ty->name && (strcmp(name,ty->name) == 0)) return ty; + ty = ty->prev; } - else - return type->name; + return 0; } -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void +/* Set the clientdata field for a type */ +SWIGRUNTIME(void) SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ + swig_type_info *tc, *equiv; + if (ti->clientdata == clientdata) return; ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); + equiv = ti->next; + while (equiv) { + if (!equiv->converter) { + tc = swig_type_list; + while (tc) { + if ((strcmp(tc->name, equiv->name) == 0)) + SWIG_TypeClientData(tc,clientdata); + tc = tc->prev; } - } - cast = cast->next; - } -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - register int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - register size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); + equiv = equiv->next; } - - /* neither found a match */ - return 0; } - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register unsigned char uu = *u; +/* Pack binary data into a string */ +SWIGRUNTIME(char *) +SWIG_PackData(char *c, void *ptr, int sz) { + static char hex[17] = "0123456789abcdef"; + int i; + unsigned char *u = (unsigned char *) ptr; + register unsigned char uu; + for (i = 0; i < sz; i++,u++) { + uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu = 0; +/* Unpack binary data from a string */ +SWIGRUNTIME(char *) +SWIG_UnpackData(char *c, void *ptr, int sz) { + register unsigned char uu = 0; + register int d; + unsigned char *u = (unsigned char *) ptr; + int i; + for (i = 0; i < sz; i++, u++) { + d = *(c++); if ((d >= '0') && (d <= '9')) uu = ((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) uu = ((d - ('a'-10)) << 4); - else - return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) uu |= (d - '0'); else if ((d >= 'a') && (d <= 'f')) uu |= (d - ('a'-10)); - else - return (char *) 0; *u = uu; } return c; } -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} +#endif #ifdef __cplusplus } #endif -/* ----------------------------------------------------------------------------- - * SWIG API. Portion that goes into the runtime - * ----------------------------------------------------------------------------- */ +/*********************************************************************** + * python.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * Author : David Beazley (beazley@cs.uchicago.edu) + ************************************************************************/ + +#include "Python.h" #ifdef __cplusplus extern "C" { #endif -/* ----------------------------------------------------------------------------- - * for internal method declarations - * ----------------------------------------------------------------------------- */ - -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* - Exception handling in wrappers -*/ -#define SWIG_fail goto fail -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0) -#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1) -#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj) -#define SWIG_null_ref(type) SWIG_Python_NullRef(type) - -/* - Contract support -*/ -#define SWIG_contract_assert(expr, msg) \ - if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ #define SWIG_PY_INT 1 #define SWIG_PY_FLOAT 2 #define SWIG_PY_STRING 3 #define SWIG_PY_POINTER 4 #define SWIG_PY_BINARY 5 +/* Flags for pointer conversion */ + +#define SWIG_POINTER_EXCEPTION 0x1 +#define SWIG_POINTER_DISOWN 0x2 + +/* Exception handling in wrappers */ +#define SWIG_fail goto fail + /* Constant information structure */ typedef struct swig_const_info { int type; @@ -577,618 +333,175 @@ typedef struct swig_const_info { swig_type_info **ptype; } swig_const_info; - -/* ----------------------------------------------------------------------------- - * Alloc. memory flags - * ----------------------------------------------------------------------------- */ -#define SWIG_OLDOBJ 1 -#define SWIG_NEWOBJ SWIG_OLDOBJ + 1 -#define SWIG_PYSTR SWIG_NEWOBJ + 1 - -#ifdef __cplusplus -} -#endif - - -/*********************************************************************** - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * Author : David Beazley (beazley@cs.uchicago.edu) - ************************************************************************/ - /* Common SWIG API */ -#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags) -#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - +#define SWIG_ConvertPtr(obj, pp, type, flags) \ + SWIG_Python_ConvertPtr(obj, pp, type, flags) +#define SWIG_NewPointerObj(p, type, flags) \ + SWIG_Python_NewPointerObj(p, type, flags) +#define SWIG_MustGetPtr(p, type, argnum, flags) \ + SWIG_Python_MustGetPtr(p, type, argnum, flags) /* Python-specific SWIG API */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) +#define SWIG_newvarlink() \ + SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) \ + SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \ + SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags) +#define SWIG_NewPackedObj(ptr, sz, type) \ + SWIG_Python_NewPackedObj(ptr, sz, type) +#define SWIG_InstallConstants(d, constants) \ + SWIG_Python_InstallConstants(d, constants) -/* Runtime API */ -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#ifdef SWIG_NOINCLUDE -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ -/* - Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent - C/C++ pointers in the python side. Very useful for debugging, but - not always safe. -*/ -#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES) -# define SWIG_COBJECT_TYPES -#endif - -/* Flags for pointer conversion */ -#define SWIG_POINTER_EXCEPTION 0x1 -#define SWIG_POINTER_DISOWN 0x2 - - -/* Add PyOS_snprintf for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -#define PyOS_snprintf snprintf -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------------------------- - * Create a new pointer string - * ----------------------------------------------------------------------------- */ -#ifndef SWIG_BUFFER_SIZE -#define SWIG_BUFFER_SIZE 1024 -#endif - -/* A crude PyString_FromFormat implementation for old Pythons */ -#if PY_VERSION_HEX < 0x02020000 -static PyObject * -PyString_FromFormat(const char *fmt, ...) { - va_list ap; - char buf[SWIG_BUFFER_SIZE * 2]; - int res; - va_start(ap, fmt); - res = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return (res < 0 || res >= sizeof(buf)) ? 0 : PyString_FromString(buf); -} -#endif - -#if PY_VERSION_HEX < 0x01060000 -#define PyObject_Del(op) PyMem_DEL((op)) -#endif - -#if defined(SWIG_COBJECT_TYPES) -#if !defined(SWIG_COBJECT_PYTHON) -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Object type, and use it instead of PyCObject - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *ptr; - const char *desc; -} PySwigObject; - -/* Declarations for objects of type PySwigObject */ - -SWIGRUNTIME int -PySwigObject_print(PySwigObject *v, FILE *fp, int flags) -{ - char result[SWIG_BUFFER_SIZE]; - flags = flags; - if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) { - fputs("", fp); - return 0; - } else { - return 1; - } -} - -SWIGRUNTIME PyObject * -PySwigObject_repr(PySwigObject *v) -{ - char result[SWIG_BUFFER_SIZE]; - return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? - PyString_FromFormat("", result) : 0; -} - -SWIGRUNTIME PyObject * -PySwigObject_str(PySwigObject *v) -{ - char result[SWIG_BUFFER_SIZE]; - return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ? - PyString_FromString(result) : 0; -} - -SWIGRUNTIME PyObject * -PySwigObject_long(PySwigObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -PySwigObject_format(const char* fmt, PySwigObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args && (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0)) { - PyObject *ofmt = PyString_FromString(fmt); - if (ofmt) { - res = PyString_Format(ofmt,args); - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - return res; -} - -SWIGRUNTIME PyObject * -PySwigObject_oct(PySwigObject *v) -{ - return PySwigObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -PySwigObject_hex(PySwigObject *v) -{ - return PySwigObject_format("%x",v); -} - -SWIGRUNTIME int -PySwigObject_compare(PySwigObject *v, PySwigObject *w) -{ - int c = strcmp(v->desc, w->desc); - if (c) { - return (c > 0) ? 1 : -1; - } else { - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); - } -} - -SWIGRUNTIME void -PySwigObject_dealloc(PySwigObject *self) -{ - PyObject_Del(self); -} - -SWIGRUNTIME PyTypeObject* -PySwigObject_type(void) { - static char pyswigobject_type__doc__[] = - "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods PySwigObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - (binaryfunc)0, /*nb_divide*/ - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - (coercion)0, /*nb_coerce*/ - (unaryfunc)PySwigObject_long, /*nb_int*/ - (unaryfunc)PySwigObject_long, /*nb_long*/ - (unaryfunc)0, /*nb_float*/ - (unaryfunc)PySwigObject_oct, /*nb_oct*/ - (unaryfunc)PySwigObject_hex, /*nb_hex*/ -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ -#elif PY_VERSION_HEX >= 0x02000000 - 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ -#endif - }; - - static PyTypeObject pyswigobject_type -#if !defined(__cplusplus) - ; - static int type_init = 0; - if (!type_init) { - PyTypeObject tmp -#endif - = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - (char *)"PySwigObject", /*tp_name*/ - sizeof(PySwigObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PySwigObject_dealloc, /*tp_dealloc*/ - (printfunc)PySwigObject_print, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)PySwigObject_compare, /*tp_compare*/ - (reprfunc)PySwigObject_repr, /*tp_repr*/ - &PySwigObject_as_number, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)PySwigObject_str, /*tp_str*/ - /* Space for future expansion */ - 0,0,0,0, - pyswigobject_type__doc__, /* Documentation string */ -#if PY_VERSION_HEX >= 0x02000000 - 0, /* tp_traverse */ - 0, /* tp_clear */ -#endif -#if PY_VERSION_HEX >= 0x02010000 - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#endif -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; -#if !defined(__cplusplus) - pyswigobject_type = tmp; - type_init = 1; - } -#endif - return &pyswigobject_type; -} - -SWIGRUNTIME PyObject * -PySwigObject_FromVoidPtrAndDesc(void *ptr, const char *desc) -{ - PySwigObject *self = PyObject_NEW(PySwigObject, PySwigObject_type()); - if (self) { - self->ptr = ptr; - self->desc = desc; - } - return (PyObject *)self; -} - -SWIGRUNTIMEINLINE void * -PySwigObject_AsVoidPtr(PyObject *self) -{ - return ((PySwigObject *)self)->ptr; -} - -SWIGRUNTIMEINLINE const char * -PySwigObject_GetDesc(PyObject *self) -{ - return ((PySwigObject *)self)->desc; -} - -SWIGRUNTIMEINLINE int -PySwigObject_Check(PyObject *op) { - return ((op)->ob_type == PySwigObject_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - const char *desc; - size_t size; -} PySwigPacked; - -SWIGRUNTIME int -PySwigPacked_print(PySwigPacked *v, FILE *fp, int flags) -{ - char result[SWIG_BUFFER_SIZE]; - flags = flags; - fputs("pack, v->size, 0, sizeof(result))) { - fputs("at ", fp); - fputs(result, fp); - } - fputs(v->desc,fp); - fputs(">", fp); - return 0; -} - -SWIGRUNTIME PyObject * -PySwigPacked_repr(PySwigPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return PyString_FromFormat("", result, v->desc); - } else { - return PyString_FromFormat("", v->desc); - } -} - -SWIGRUNTIME PyObject * -PySwigPacked_str(PySwigPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return PyString_FromFormat("%s%s", result, v->desc); - } else { - return PyString_FromString(v->desc); - } -} - -SWIGRUNTIME int -PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w) -{ - int c = strcmp(v->desc, w->desc); - if (c) { - return (c > 0) ? 1 : -1; - } else { - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); - } -} - -SWIGRUNTIME void -PySwigPacked_dealloc(PySwigPacked *self) -{ - free(self->pack); - PyObject_Del(self); -} - -SWIGRUNTIME PyTypeObject* -PySwigPacked_type(void) { - static char pyswigpacked_type__doc__[] = - "Swig object carries a C/C++ instance pointer"; - static PyTypeObject pyswigpacked_type -#if !defined(__cplusplus) - ; - static int type_init = 0; - if (!type_init) { - PyTypeObject tmp -#endif - = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - (char *)"PySwigPacked", /*tp_name*/ - sizeof(PySwigPacked), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PySwigPacked_dealloc, /*tp_dealloc*/ - (printfunc)PySwigPacked_print, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)PySwigPacked_compare, /*tp_compare*/ - (reprfunc)PySwigPacked_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)PySwigPacked_str, /*tp_str*/ - /* Space for future expansion */ - 0,0,0,0, - pyswigpacked_type__doc__, /* Documentation string */ -#if PY_VERSION_HEX >= 0x02000000 - 0, /* tp_traverse */ - 0, /* tp_clear */ -#endif -#if PY_VERSION_HEX >= 0x02010000 - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#endif -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; -#if !defined(__cplusplus) - pyswigpacked_type = tmp; - type_init = 1; - } -#endif - return &pyswigpacked_type; -} - -SWIGRUNTIME PyObject * -PySwigPacked_FromDataAndDesc(void *ptr, size_t size, const char *desc) -{ - PySwigPacked *self = PyObject_NEW(PySwigPacked, PySwigPacked_type()); - if (self == NULL) { - return NULL; - } else { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - self->pack = pack; - self->desc = desc; - self->size = size; - return (PyObject *) self; - } - return NULL; - } -} - -SWIGRUNTIMEINLINE const char * -PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - PySwigPacked *self = (PySwigPacked *)obj; - if (self->size != size) return 0; - memcpy(ptr, self->pack, size); - return self->desc; -} - -SWIGRUNTIMEINLINE const char * -PySwigPacked_GetDesc(PyObject *self) -{ - return ((PySwigPacked *)self)->desc; -} - -SWIGRUNTIMEINLINE int -PySwigPacked_Check(PyObject *op) { - return ((op)->ob_type == PySwigPacked_type()) - || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0); -} +SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int); +SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own); +SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int); +SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void); +SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *)); +SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int); +SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *); +SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]); #else -/* ----------------------------------------------------------------------------- - * Use the old Python PyCObject instead of PySwigObject - * ----------------------------------------------------------------------------- */ - -#define PySwigObject_GetDesc(obj) PyCObject_GetDesc(obj) -#define PySwigObject_Check(obj) PyCObject_Check(obj) -#define PySwigObject_AsVoidPtr(obj) PyCObject_AsVoidPtr(obj) -#define PySwigObject_FromVoidPtrAndDesc(p, d) PyCObject_FromVoidPtrAndDesc(p, d, NULL) - -#endif - -#endif /* ----------------------------------------------------------------------------- - * errors manipulation + * global variable support code. * ----------------------------------------------------------------------------- */ -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && PySwigObject_Check(obj)) { - const char *otype = (const char *) PySwigObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? PyString_AsString(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } +typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; +} swig_globalvar; + +typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; +} swig_varlinkobject; + +static PyObject * +swig_varlink_repr(swig_varlinkobject *v) { + v = v; + return PyString_FromString(""); } -SWIGRUNTIMEINLINE void -SWIG_Python_NullRef(const char *type) -{ - if (type) { - PyErr_Format(PyExc_TypeError, "null reference of type '%s' was received",type); - } else { - PyErr_Format(PyExc_TypeError, "null reference was received"); +static int +swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { + swig_globalvar *var; + flags = flags; + fprintf(fp,"Global variables { "); + for (var = v->vars; var; var=var->next) { + fprintf(fp,"%s", var->name); + if (var->next) fprintf(fp,", "); } + fprintf(fp," }\n"); + return 0; } -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); - } else { - PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); - } - Py_DECREF(old_str); +static PyObject * +swig_varlink_getattr(swig_varlinkobject *v, char *n) { + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + return (*var->get_attr)(); } - return 1; - } else { - return 0; + var = var->next; } + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + return NULL; } -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; +static int +swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + return (*var->set_attr)(p); + } + var = var->next; } + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + return 1; } +statichere PyTypeObject varlinktype = { + PyObject_HEAD_INIT(0) + 0, + (char *)"swigvarlink", /* Type name */ + sizeof(swig_varlinkobject), /* Basic size */ + 0, /* Itemsize */ + 0, /* Deallocator */ + (printfunc) swig_varlink_print, /* Print */ + (getattrfunc) swig_varlink_getattr, /* get attr */ + (setattrfunc) swig_varlink_setattr, /* Set attr */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_mapping*/ + 0, /* tp_hash */ +}; -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ +/* Create a variable linking object for use later */ +SWIGRUNTIME(PyObject *) +SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = 0; + result = PyMem_NEW(swig_varlinkobject,1); + varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ + result->ob_type = &varlinktype; + result->vars = 0; + result->ob_refcnt = 0; + Py_XINCREF((PyObject *) result); + return ((PyObject*) result); +} + +SWIGRUNTIME(void) +SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v; + swig_globalvar *gv; + v= (swig_varlinkobject *) p; + gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + gv->name = (char *) malloc(strlen(name)+1); + strcpy(gv->name,name); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + v->vars = gv; +} /* Convert a pointer value */ -SWIGRUNTIME int +SWIGRUNTIME(int) SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) { - swig_cast_info *tc; - const char *c = 0; + swig_type_info *tc; + char *c = 0; static PyObject *SWIG_this = 0; int newref = 0; PyObject *pyobj = 0; - void *vptr; - + if (!obj) return 0; if (obj == Py_None) { *ptr = 0; return 0; } - #ifdef SWIG_COBJECT_TYPES - if (!(PySwigObject_Check(obj))) { + if (!(PyCObject_Check(obj))) { if (!SWIG_this) SWIG_this = PyString_FromString("this"); pyobj = obj; obj = PyObject_GetAttr(obj,SWIG_this); newref = 1; if (!obj) goto type_error; - if (!PySwigObject_Check(obj)) { + if (!PyCObject_Check(obj)) { Py_DECREF(obj); goto type_error; } } - vptr = PySwigObject_AsVoidPtr(obj); - c = (const char *) PySwigObject_GetDesc(obj); - if (newref) { Py_DECREF(obj); } - goto type_check; + *ptr = PyCObject_AsVoidPtr(obj); + c = (char *) PyCObject_GetDesc(obj); + if (newref) Py_DECREF(obj); + goto cobject; #else if (!(PyString_Check(obj))) { if (!SWIG_this) @@ -1204,78 +517,72 @@ SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) } c = PyString_AsString(obj); /* Pointer values must start with leading underscore */ - c = SWIG_UnpackVoidPtr(c, &vptr, ty->name); + if (*c != '_') { + *ptr = (void *) 0; + if (strcmp(c,"NULL") == 0) { + if (newref) { Py_DECREF(obj); } + return 0; + } else { + if (newref) { Py_DECREF(obj); } + goto type_error; + } + } + c++; + c = SWIG_UnpackData(c,ptr,sizeof(void *)); if (newref) { Py_DECREF(obj); } - if (!c) goto type_error; #endif -type_check: +#ifdef SWIG_COBJECT_TYPES +cobject: +#endif + if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) goto type_error; - *ptr = SWIG_TypeCast(tc,vptr); - } else { - *ptr = vptr; + *ptr = SWIG_TypeCast(tc,(void*) *ptr); } + if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) { - PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False); + PyObject *zero = PyInt_FromLong(0); + PyObject_SetAttrString(pyobj,(char*)"thisown",zero); + Py_DECREF(zero); } return 0; type_error: - PyErr_Clear(); - if (pyobj && !obj) { - obj = pyobj; - if (PyCFunction_Check(obj)) { - /* here we get the method pointer for callbacks */ - char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - c = doc ? strstr(doc, "swig_ptr: ") : 0; - if (c) { - c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0; - if (!c) goto type_error; - goto type_check; - } - } - } if (flags & SWIG_POINTER_EXCEPTION) { - if (ty) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + if (ty && c) { + char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c)); + sprintf(temp,"Type error. Got %s, expected %s", c, ty->name); + PyErr_SetString(PyExc_TypeError, temp); + free((char *) temp); } else { - SWIG_Python_TypeError("C/C++ pointer", obj); + PyErr_SetString(PyExc_TypeError,"Expected a pointer"); } } return -1; } /* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * +SWIGRUNTIME(void *) SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); - if (flags & SWIG_POINTER_EXCEPTION) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } - } + SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION); return result; } /* Convert a packed value value */ -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty, int flags) { - swig_cast_info *tc; - const char *c = 0; +SWIGRUNTIME(int) +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) { + swig_type_info *tc; + char *c = 0; -#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON) - c = PySwigPacked_UnpackData(obj, ptr, sz); -#else if ((!obj) || (!PyString_Check(obj))) goto type_error; c = PyString_AsString(obj); /* Pointer values must start with leading underscore */ - c = SWIG_UnpackDataName(c, ptr, sz, ty->name); -#endif - if (!c) goto type_error; + if (*c != '_') goto type_error; + c++; + c = SWIG_UnpackData(c,ptr,sz); if (ty) { tc = SWIG_TypeCheck(c,ty); if (!tc) goto type_error; @@ -1283,38 +590,38 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t return 0; type_error: - PyErr_Clear(); - if (flags & SWIG_POINTER_EXCEPTION) { - if (ty) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + + if (flags) { + if (ty && c) { + char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c)); + sprintf(temp,"Type error. Got %s, expected %s", c, ty->name); + PyErr_SetString(PyExc_TypeError, temp); + free((char *) temp); } else { - SWIG_Python_TypeError("C/C++ packed data", obj); + PyErr_SetString(PyExc_TypeError,"Expected a pointer"); } } return -1; -} +} -/* Create a new array object */ -SWIGRUNTIME PyObject * +/* Create a new pointer object */ +SWIGRUNTIME(PyObject *) SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) { - PyObject *robj = 0; - if (!type) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "Swig: null type passed to NewPointerObj"); - } - return robj; - } + PyObject *robj; if (!ptr) { Py_INCREF(Py_None); return Py_None; } #ifdef SWIG_COBJECT_TYPES - robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)type->name); + robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL); #else { - char result[SWIG_BUFFER_SIZE]; - robj = SWIG_PackVoidPtr(result, ptr, type->name, sizeof(result)) ? - PyString_FromString(result) : 0; + char result[1024]; + char *r = result; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + strcpy(r,type->name); + robj = PyString_FromString(result); } #endif if (!robj || (robj == Py_None)) return robj; @@ -1326,7 +633,9 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) { Py_DECREF(args); if (inst) { if (own) { - PyObject_SetAttrString(inst,(char*)"thisown",Py_True); + PyObject *n = PyInt_FromLong(1); + PyObject_SetAttrString(inst,(char*)"thisown",n); + Py_DECREF(n); } robj = inst; } @@ -1334,95 +643,55 @@ SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) { return robj; } -SWIGRUNTIME PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - PyObject *robj = 0; - if (!ptr) { - Py_INCREF(Py_None); - return Py_None; - } -#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON) - robj = PySwigPacked_FromDataAndDesc((void *) ptr, sz, (char *)type->name); -#else - { - char result[SWIG_BUFFER_SIZE]; - robj = SWIG_PackDataName(result, ptr, sz, type->name, sizeof(result)) ? - PyString_FromString(result) : 0; - } -#endif - return robj; +SWIGRUNTIME(PyObject *) +SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) { + char result[1024]; + char *r = result; + if ((2*sz + 1 + strlen(type->name)) > 1000) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + strcpy(r,type->name); + return PyString_FromString(result); } -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; +/* Install Constants */ +SWIGRUNTIME(void) +SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + int i; + PyObject *obj; + for (i = 0; constants[i].type; i++) { + switch(constants[i].type) { + case SWIG_PY_INT: + obj = PyInt_FromLong(constants[i].lvalue); + break; + case SWIG_PY_FLOAT: + obj = PyFloat_FromDouble(constants[i].dvalue); + break; + case SWIG_PY_STRING: + obj = PyString_FromString((char *) constants[i].pvalue); + break; + case SWIG_PY_POINTER: + obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d,constants[i].name,obj); + Py_DECREF(obj); } -#endif } - return (swig_module_info *) type_pointer; } -#if PY_MAJOR_VERSION < 2 -/* PyModule_AddObject function was introduced in Python 2.0. The following function -is copied out of Python/modsupport.c in python version 2.3.4 */ -SWIGINTERN int -PyModule_AddObject(PyObject *m, char *name, PyObject *o) -{ - PyObject *dict; - if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); - return -1; - } - if (!o) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); - return -1; - } - - dict = PyModule_GetDict(m); - if (dict == NULL) { - /* Internal error -- modules must have a dict! */ - PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", - PyModule_GetName(m)); - return -1; - } - if (PyDict_SetItemString(dict, name, o)) - return -1; - Py_DECREF(o); - return 0; -} #endif -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ +/* Contract support */ - PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, - swig_empty_runtime_method_table); - PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, NULL); - if (pointer && module) { - PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); - } -} +#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else #ifdef __cplusplus } @@ -1431,20 +700,12 @@ SWIG_Python_SetModule(swig_module_info *swig_module) { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_SessionContainer swig_types[0] -#define SWIGTYPE_p_char swig_types[1] -#define SWIGTYPE_p_switch_core_session swig_types[2] -#define SWIGTYPE_p_switch_input_type_t swig_types[3] -#define SWIGTYPE_p_switch_status_t swig_types[4] -#define SWIGTYPE_p_void swig_types[5] -#define SWIGTYPE_ptrdiff_t swig_types[6] -#define SWIGTYPE_size_t swig_types[7] -#define SWIGTYPE_std__ptrdiff_t swig_types[8] -#define SWIGTYPE_std__size_t swig_types[9] -static swig_type_info *swig_types[11]; -static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) +#define SWIGTYPE_p_switch_status_t swig_types[0] +#define SWIGTYPE_p_switch_input_type_t swig_types[1] +#define SWIGTYPE_p_void swig_types[2] +#define SWIGTYPE_p_switch_core_session swig_types[3] +#define SWIGTYPE_p_SessionContainer swig_types[4] +static swig_type_info *swig_types[6]; /* -------- TYPES TABLE (END) -------- */ @@ -1458,288 +719,33 @@ static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0}; #include "freeswitch_python.h" +extern void *globalDTMFCallbackFunction; +extern switch_status_t PythonDTMFCallback(switch_core_session *,void *,switch_input_type_t,void *,unsigned int); -#include +static PyObject* t_output_helper(PyObject* target, PyObject* o) { + PyObject* o2; + PyObject* o3; + if (!target) { + target = o; + } else if (target == Py_None) { + Py_DECREF(Py_None); + target = o; + } else { + if (!PyTuple_Check(target)) { + o2 = target; + target = PyTuple_New(1); + PyTuple_SetItem(target, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SetItem(o3, 0, o); -SWIGINTERNINLINE int - SWIG_CheckUnsignedLongInRange(unsigned long value, - unsigned long max_value, - const char *errmsg) -{ - if (value > max_value) { - if (errmsg) { - PyErr_Format(PyExc_OverflowError, - "value %lu is greater than '%s' minimum %lu", - value, errmsg, max_value); + o2 = target; + target = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); } - return 0; - } - return 1; - } - - -SWIGINTERN int - SWIG_AsVal_unsigned_SS_long(PyObject *obj, unsigned long *val) -{ - if (PyLong_Check(obj)) { - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return 1; - } else { - if (!val) PyErr_Clear(); - return 0; - } - } - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return 1; - } - } - if (val) { - SWIG_type_error("unsigned long", obj); - } - return 0; -} - - -#if UINT_MAX != ULONG_MAX -SWIGINTERN int - SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val) -{ - const char* errmsg = val ? "unsigned int" : (char*)0; - unsigned long v; - if (SWIG_AsVal_unsigned_SS_long(obj, &v)) { - if (SWIG_CheckUnsignedLongInRange(v, INT_MAX, errmsg)) { - if (val) *val = static_cast(v); - return 1; - } - } else { - PyErr_Clear(); - } - if (val) { - SWIG_type_error(errmsg, obj); - } - return 0; -} -#else -SWIGINTERNINLINE unsigned int - SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val) -{ - return SWIG_AsVal_unsigned_SS_long(obj,(unsigned long *)val); -} -#endif - - -SWIGINTERNINLINE unsigned int -SWIG_As_unsigned_SS_int(PyObject* obj) -{ - unsigned int v; - if (!SWIG_AsVal_unsigned_SS_int(obj, &v)) { - /* - this is needed to make valgrind/purify happier. - */ - memset((void*)&v, 0, sizeof(unsigned int)); - } - return v; -} - - -SWIGINTERNINLINE int -SWIG_Check_unsigned_SS_int(PyObject* obj) -{ - return SWIG_AsVal_unsigned_SS_int(obj, (unsigned int*)0); -} - - -/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */ -SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize) -{ - static swig_type_info* pchar_info = 0; - char* vptr = 0; - if (!pchar_info) pchar_info = SWIG_TypeQuery("char *"); - if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) { - if (cptr) *cptr = vptr; - if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0; - return SWIG_OLDOBJ; - } else { - PyErr_Clear(); - if (PyString_Check(obj)) { - if (cptr) { - *cptr = PyString_AS_STRING(obj); - if (psize) { - *psize = PyString_GET_SIZE(obj) + 1; - } - } - return SWIG_PYSTR; - } - } - if (cptr) { - SWIG_type_error("char *", obj); - } - return 0; -} - - -SWIGINTERNINLINE int -SWIG_AsCharPtr(PyObject *obj, char **val) -{ - if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) { - return 1; - } - if (val) { - PyErr_Clear(); - SWIG_type_error("char *", obj); - } - return 0; -} - - - /*@/usr/share/swig1.3/python/pymacros.swg,72,SWIG_define@*/ -#define SWIG_From_int PyInt_FromLong -/*@@*/ - - -SWIGINTERN int - SWIG_CheckLongInRange(long value, long min_value, long max_value, - const char *errmsg) -{ - if (value < min_value) { - if (errmsg) { - PyErr_Format(PyExc_OverflowError, - "value %ld is less than '%s' minimum %ld", - value, errmsg, min_value); - } - return 0; - } else if (value > max_value) { - if (errmsg) { - PyErr_Format(PyExc_OverflowError, - "value %ld is greater than '%s' maximum %ld", - value, errmsg, max_value); - } - return 0; - } - return 1; -} - - -SWIGINTERN int - SWIG_AsVal_long(PyObject * obj, long* val) -{ - if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return 1; - } else { - if (!val) PyErr_Clear(); - return 0; - } - } - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return 1; - } - if (val) { - SWIG_type_error("long", obj); - } - return 0; - } - - -#if INT_MAX != LONG_MAX -SWIGINTERN int - SWIG_AsVal_int(PyObject *obj, int *val) -{ - const char* errmsg = val ? "int" : (char*)0; - long v; - if (SWIG_AsVal_long(obj, &v)) { - if (SWIG_CheckLongInRange(v, INT_MIN,INT_MAX, errmsg)) { - if (val) *val = static_cast(v); - return 1; - } else { - return 0; - } - } else { - PyErr_Clear(); - } - if (val) { - SWIG_type_error(errmsg, obj); - } - return 0; -} -#else -SWIGINTERNINLINE int - SWIG_AsVal_int(PyObject *obj, int *val) -{ - return SWIG_AsVal_long(obj,(long*)val); -} -#endif - - -SWIGINTERNINLINE int -SWIG_As_int(PyObject* obj) -{ - int v; - if (!SWIG_AsVal_int(obj, &v)) { - /* - this is needed to make valgrind/purify happier. - */ - memset((void*)&v, 0, sizeof(int)); - } - return v; -} - - -SWIGINTERNINLINE int -SWIG_Check_int(PyObject* obj) -{ - return SWIG_AsVal_int(obj, (int*)0); -} - - -SWIGINTERN PyObject* -t_output_helper(PyObject* target, PyObject* o) { - if (!target) { - target = o; - } else if (target == Py_None) { - Py_DECREF(target); - target = o; - } else { - if (!PyList_Check(target)) { - PyObject *o2 = target; - target = PyList_New(1); - PyList_SetItem(target, 0, o2); - } - PyList_Append(target,o); - Py_DECREF(o); - } - return target; -} - - -SWIGINTERN PyObject * -SWIG_FromCharPtr(const char* cptr) -{ - if (cptr) { - size_t size = strlen(cptr); - if (size > INT_MAX) { - return SWIG_NewPointerObj(const_cast(cptr), - SWIG_TypeQuery("char *"), 0); - } else { - if (size != 0) { - return PyString_FromStringAndSize(cptr, size); - } else { - return PyString_FromString(cptr); - } - } - } - Py_INCREF(Py_None); - return Py_None; + return target; } @@ -1772,9 +778,8 @@ extern "C" { static int _wrap_globalDTMFCallbackFunction_set(PyObject *_val) { { void * temp; - if ((SWIG_ConvertPtr(_val, static_cast(&temp), 0, - SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN)) == -1) { - SWIG_append_errmsg("C/C++ variable 'globalDTMFCallbackFunction'"); + if ((SWIG_ConvertPtr(_val,(void **) &temp, 0, SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN)) == -1) { + PyErr_SetString(PyExc_TypeError, "C variable 'globalDTMFCallbackFunction (void *)'"); return 1; } globalDTMFCallbackFunction = (void *) temp; @@ -1783,22 +788,23 @@ static int _wrap_globalDTMFCallbackFunction_set(PyObject *_val) { } -static PyObject *_wrap_globalDTMFCallbackFunction_get(void) { - PyObject *pyobj = NULL; +static PyObject *_wrap_globalDTMFCallbackFunction_get() { + PyObject *pyobj; - pyobj = SWIG_NewPointerObj((void *)(globalDTMFCallbackFunction), SWIGTYPE_p_void, 0); + pyobj = SWIG_NewPointerObj((void *) globalDTMFCallbackFunction, SWIGTYPE_p_void, 0); return pyobj; } -static PyObject *_wrap_PythonDTMFCallback(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_PythonDTMFCallback(PyObject *self, PyObject *args) { + PyObject *resultobj; switch_core_session *arg1 = (switch_core_session *) 0 ; void *arg2 = (void *) 0 ; switch_input_type_t arg3 ; void *arg4 = (void *) 0 ; unsigned int arg5 ; switch_status_t result; + switch_input_type_t *argp3 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -1806,38 +812,19 @@ static PyObject *_wrap_PythonDTMFCallback(PyObject *, PyObject *args) { PyObject * obj4 = 0 ; if(!PyArg_ParseTuple(args,(char *)"OOOOO:PythonDTMFCallback",&obj0,&obj1,&obj2,&obj3,&obj4)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - { - if ((SWIG_ConvertPtr(obj1,reinterpret_cast(&arg2),0,SWIG_POINTER_EXCEPTION|0))== -1) { - SWIG_arg_fail(2);SWIG_fail; - } - } - { - switch_input_type_t * argp; - SWIG_Python_ConvertPtr(obj2, (void **)&argp, SWIGTYPE_p_switch_input_type_t, SWIG_POINTER_EXCEPTION); - if (SWIG_arg_fail(3)) SWIG_fail; - if (argp == NULL) { - SWIG_null_ref("switch_input_type_t"); - } - if (SWIG_arg_fail(3)) SWIG_fail; - arg3 = *argp; - } - { - if ((SWIG_ConvertPtr(obj3,reinterpret_cast(&arg4),0,SWIG_POINTER_EXCEPTION|0))== -1) { - SWIG_arg_fail(4);SWIG_fail; - } - } - { - arg5 = static_cast(SWIG_As_unsigned_SS_int(obj4)); - if (SWIG_arg_fail(5)) SWIG_fail; - } + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj2,(void **) &argp3, SWIGTYPE_p_switch_input_type_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail; + arg3 = *argp3; + if ((SWIG_ConvertPtr(obj3,(void **) &arg4, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg5 = (unsigned int) PyInt_AsLong(obj4); + if (PyErr_Occurred()) SWIG_fail; result = PythonDTMFCallback(arg1,arg2,arg3,arg4,arg5); { switch_status_t * resultptr; - resultptr = new switch_status_t(static_cast(result)); - resultobj = SWIG_NewPointerObj((void *)(resultptr), SWIGTYPE_p_switch_status_t, 1); + resultptr = new switch_status_t((switch_status_t &) result); + resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_switch_status_t, 1); } return resultobj; fail: @@ -1845,33 +832,28 @@ static PyObject *_wrap_PythonDTMFCallback(PyObject *, PyObject *args) { } -static PyObject *_wrap_new_SessionContainer(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; - char *arg1 = (char *) 0 ; +static PyObject *_wrap_new_SessionContainer(PyObject *self, PyObject *args) { + PyObject *resultobj; + char *arg1 ; SessionContainer *result; - PyObject * obj0 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"O:new_SessionContainer",&obj0)) goto fail; - if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) { - SWIG_arg_fail(1);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"s:new_SessionContainer",&arg1)) goto fail; result = (SessionContainer *)new SessionContainer(arg1); - resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_SessionContainer, 1); + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_SessionContainer, 1); return resultobj; fail: return NULL; } -static PyObject *_wrap_delete_SessionContainer(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_delete_SessionContainer(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; PyObject * obj0 = 0 ; if(!PyArg_ParseTuple(args,(char *)"O:delete_SessionContainer",&obj0)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; delete arg1; Py_INCREF(Py_None); resultobj = Py_None; @@ -1881,24 +863,15 @@ static PyObject *_wrap_delete_SessionContainer(PyObject *, PyObject *args) { } -static PyObject *_wrap_SessionContainer_console_log(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_console_log(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 ; + char *arg3 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:SessionContainer_console_log",&obj0,&obj1,&obj2)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_console_log",&obj0,&arg2,&arg3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->console_log(arg2,arg3); Py_INCREF(Py_None); resultobj = Py_None; @@ -1908,19 +881,14 @@ static PyObject *_wrap_SessionContainer_console_log(PyObject *, PyObject *args) } -static PyObject *_wrap_SessionContainer_console_clean_log(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_console_clean_log(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; + char *arg2 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OO:SessionContainer_console_clean_log",&obj0,&obj1)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Os:SessionContainer_console_clean_log",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->console_clean_log(arg2); Py_INCREF(Py_None); resultobj = Py_None; @@ -1930,59 +898,48 @@ static PyObject *_wrap_SessionContainer_console_clean_log(PyObject *, PyObject * } -static PyObject *_wrap_SessionContainer_answer(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_answer(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; int result; PyObject * obj0 = 0 ; if(!PyArg_ParseTuple(args,(char *)"O:SessionContainer_answer",&obj0)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)(arg1)->answer(); - { - resultobj = SWIG_From_int(static_cast(result)); - } + resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_pre_answer(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_pre_answer(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; int result; PyObject * obj0 = 0 ; if(!PyArg_ParseTuple(args,(char *)"O:SessionContainer_pre_answer",&obj0)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)(arg1)->pre_answer(); - { - resultobj = SWIG_From_int(static_cast(result)); - } + resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_hangup(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_hangup(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; + char *arg2 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OO:SessionContainer_hangup",&obj0,&obj1)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Os:SessionContainer_hangup",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->hangup(arg2); Py_INCREF(Py_None); resultobj = Py_None; @@ -1992,24 +949,15 @@ static PyObject *_wrap_SessionContainer_hangup(PyObject *, PyObject *args) { } -static PyObject *_wrap_SessionContainer_set_variable(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_set_variable(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 ; + char *arg3 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:SessionContainer_set_variable",&obj0,&obj1,&obj2)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_set_variable",&obj0,&arg2,&arg3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->set_variable(arg2,arg3); Py_INCREF(Py_None); resultobj = Py_None; @@ -2019,24 +967,15 @@ static PyObject *_wrap_SessionContainer_set_variable(PyObject *, PyObject *args) } -static PyObject *_wrap_SessionContainer_get_variable(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_get_variable(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 ; + char *arg3 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:SessionContainer_get_variable",&obj0,&obj1,&obj2)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_get_variable",&obj0,&arg2,&arg3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->get_variable(arg2,arg3); Py_INCREF(Py_None); resultobj = Py_None; @@ -2046,19 +985,14 @@ static PyObject *_wrap_SessionContainer_get_variable(PyObject *, PyObject *args) } -static PyObject *_wrap_SessionContainer_set_state(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_set_state(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; + char *arg2 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OO:SessionContainer_set_state",&obj0,&obj1)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Os:SessionContainer_set_state",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->set_state(arg2); Py_INCREF(Py_None); resultobj = Py_None; @@ -2068,46 +1002,34 @@ static PyObject *_wrap_SessionContainer_set_state(PyObject *, PyObject *args) { } -static PyObject *_wrap_SessionContainer_play_file(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_play_file(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 ; + char *arg3 ; int result; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:SessionContainer_play_file",&obj0,&obj1,&obj2)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_play_file",&obj0,&arg2,&arg3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)(arg1)->play_file(arg2,arg3); - { - resultobj = SWIG_From_int(static_cast(result)); - } + resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_set_dtmf_callback(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_set_dtmf_callback(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; PyObject *arg2 = (PyObject *) 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; if(!PyArg_ParseTuple(args,(char *)"OO:SessionContainer_set_dtmf_callback",&obj0,&obj1)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; arg2 = obj1; (arg1)->set_dtmf_callback(arg2); @@ -2118,49 +1040,33 @@ static PyObject *_wrap_SessionContainer_set_dtmf_callback(PyObject *, PyObject * } -static PyObject *_wrap_SessionContainer_speak_text(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_speak_text(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; + char *arg2 ; int result; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OO:SessionContainer_speak_text",&obj0,&obj1)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Os:SessionContainer_speak_text",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)(arg1)->speak_text(arg2); - { - resultobj = SWIG_From_int(static_cast(result)); - } + resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_set_tts_parms(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_set_tts_parms(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; + char *arg2 ; + char *arg3 ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOO:SessionContainer_set_tts_parms",&obj0,&obj1,&obj2)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Oss:SessionContainer_set_tts_parms",&obj0,&arg2,&arg3)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; (arg1)->set_tts_parms(arg2,arg3); Py_INCREF(Py_None); resultobj = Py_None; @@ -2170,182 +1076,117 @@ static PyObject *_wrap_SessionContainer_set_tts_parms(PyObject *, PyObject *args } -static PyObject *_wrap_SessionContainer_get_digits(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_get_digits(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; + char *arg2 ; int arg3 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; + char *arg4 ; + char *arg5 ; int arg6 ; int result; char temp2[128+1] ; char temp5[8+1] ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOOOOO:SessionContainer_get_digits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OOisOi:SessionContainer_get_digits",&obj0,&obj1,&arg3,&arg4,&obj4,&arg6)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { - char *t = 0; size_t n; - SWIG_AsCharPtrAndSize(obj1, &t, &n); - if (SWIG_arg_fail(2)) SWIG_fail; - if ( n > (size_t)128 ) n = (size_t)128; - memcpy(temp2, t, sizeof(char)*n); - temp2[n] = 0; - arg2 = (char *) temp2; + char *t = PyString_AsString(obj1); + if (PyErr_Occurred()) SWIG_fail; + strncpy(temp2,t,128); + arg2 = (char *) temp2; } { - arg3 = static_cast(SWIG_As_int(obj2)); - if (SWIG_arg_fail(3)) SWIG_fail; - } - if (!SWIG_AsCharPtr(obj3, (char**)&arg4)) { - SWIG_arg_fail(4);SWIG_fail; - } - { - char *t = 0; size_t n; - SWIG_AsCharPtrAndSize(obj4, &t, &n); - if (SWIG_arg_fail(5)) SWIG_fail; - if ( n > (size_t)8 ) n = (size_t)8; - memcpy(temp5, t, sizeof(char)*n); - temp5[n] = 0; - arg5 = (char *) temp5; - } - { - arg6 = static_cast(SWIG_As_int(obj5)); - if (SWIG_arg_fail(6)) SWIG_fail; + char *t = PyString_AsString(obj4); + if (PyErr_Occurred()) SWIG_fail; + strncpy(temp5,t,8); + arg5 = (char *) temp5; } result = (int)(arg1)->get_digits(arg2,arg3,arg4,arg5,arg6); + resultobj = PyInt_FromLong((long)result); { - resultobj = SWIG_From_int(static_cast(result)); + PyObject *o; + arg2[128] = 0; + o = PyString_FromString(arg2); + resultobj = t_output_helper(resultobj,o); + } + { + PyObject *o; + arg5[8] = 0; + o = PyString_FromString(arg5); + resultobj = t_output_helper(resultobj,o); } - arg2[128] = 0; resultobj = t_output_helper(resultobj, SWIG_FromCharPtr(arg2)); - arg5[8] = 0; resultobj = t_output_helper(resultobj, SWIG_FromCharPtr(arg5)); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_transfer(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_transfer(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; + char *arg2 ; + char *arg3 ; + char *arg4 ; int result; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOOO:SessionContainer_transfer",&obj0,&obj1,&obj2,&obj3)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; - if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) { - SWIG_arg_fail(2);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) { - SWIG_arg_fail(3);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj3, (char**)&arg4)) { - SWIG_arg_fail(4);SWIG_fail; - } + if(!PyArg_ParseTuple(args,(char *)"Osss:SessionContainer_transfer",&obj0,&arg2,&arg3,&arg4)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)(arg1)->transfer(arg2,arg3,arg4); - { - resultobj = SWIG_From_int(static_cast(result)); - } + resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } -static PyObject *_wrap_SessionContainer_play_and_get_digits(PyObject *, PyObject *args) { - PyObject *resultobj = NULL; +static PyObject *_wrap_SessionContainer_play_and_get_digits(PyObject *self, PyObject *args) { + PyObject *resultobj; SessionContainer *arg1 = (SessionContainer *) 0 ; int arg2 ; int arg3 ; int arg4 ; int arg5 ; - char *arg6 = (char *) 0 ; - char *arg7 = (char *) 0 ; - char *arg8 = (char *) 0 ; - char *arg9 = (char *) 0 ; - char *arg10 = (char *) 0 ; + char *arg6 ; + char *arg7 ; + char *arg8 ; + char *arg9 ; + char *arg10 ; int result; char temp9[128+1] ; PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - PyObject * obj3 = 0 ; - PyObject * obj4 = 0 ; - PyObject * obj5 = 0 ; - PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; - PyObject * obj9 = 0 ; - if(!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:SessionContainer_play_and_get_digits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) goto fail; - SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_SessionContainer, SWIG_POINTER_EXCEPTION | 0); - if (SWIG_arg_fail(1)) SWIG_fail; + if(!PyArg_ParseTuple(args,(char *)"OiiiisssOs:SessionContainer_play_and_get_digits",&obj0,&arg2,&arg3,&arg4,&arg5,&arg6,&arg7,&arg8,&obj8,&arg10)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_SessionContainer,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; { - arg2 = static_cast(SWIG_As_int(obj1)); - if (SWIG_arg_fail(2)) SWIG_fail; - } - { - arg3 = static_cast(SWIG_As_int(obj2)); - if (SWIG_arg_fail(3)) SWIG_fail; - } - { - arg4 = static_cast(SWIG_As_int(obj3)); - if (SWIG_arg_fail(4)) SWIG_fail; - } - { - arg5 = static_cast(SWIG_As_int(obj4)); - if (SWIG_arg_fail(5)) SWIG_fail; - } - if (!SWIG_AsCharPtr(obj5, (char**)&arg6)) { - SWIG_arg_fail(6);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj6, (char**)&arg7)) { - SWIG_arg_fail(7);SWIG_fail; - } - if (!SWIG_AsCharPtr(obj7, (char**)&arg8)) { - SWIG_arg_fail(8);SWIG_fail; - } - { - char *t = 0; size_t n; - SWIG_AsCharPtrAndSize(obj8, &t, &n); - if (SWIG_arg_fail(9)) SWIG_fail; - if ( n > (size_t)128 ) n = (size_t)128; - memcpy(temp9, t, sizeof(char)*n); - temp9[n] = 0; - arg9 = (char *) temp9; - } - if (!SWIG_AsCharPtr(obj9, (char**)&arg10)) { - SWIG_arg_fail(10);SWIG_fail; + char *t = PyString_AsString(obj8); + if (PyErr_Occurred()) SWIG_fail; + strncpy(temp9,t,128); + arg9 = (char *) temp9; } result = (int)(arg1)->play_and_get_digits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); + resultobj = PyInt_FromLong((long)result); { - resultobj = SWIG_From_int(static_cast(result)); + PyObject *o; + arg9[128] = 0; + o = PyString_FromString(arg9); + resultobj = t_output_helper(resultobj,o); } - arg9[128] = 0; resultobj = t_output_helper(resultobj, SWIG_FromCharPtr(arg9)); return resultobj; fail: return NULL; } -static PyObject * SessionContainer_swigregister(PyObject *, PyObject *args) { +static PyObject * SessionContainer_swigregister(PyObject *self, PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; SWIG_TypeClientData(SWIGTYPE_p_SessionContainer, obj); @@ -2353,511 +1194,74 @@ static PyObject * SessionContainer_swigregister(PyObject *, PyObject *args) { return Py_BuildValue((char *)""); } static PyMethodDef SwigMethods[] = { - { (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS, NULL}, - { (char *)"new_SessionContainer", _wrap_new_SessionContainer, METH_VARARGS, NULL}, - { (char *)"delete_SessionContainer", _wrap_delete_SessionContainer, METH_VARARGS, NULL}, - { (char *)"SessionContainer_console_log", _wrap_SessionContainer_console_log, METH_VARARGS, NULL}, - { (char *)"SessionContainer_console_clean_log", _wrap_SessionContainer_console_clean_log, METH_VARARGS, NULL}, - { (char *)"SessionContainer_answer", _wrap_SessionContainer_answer, METH_VARARGS, NULL}, - { (char *)"SessionContainer_pre_answer", _wrap_SessionContainer_pre_answer, METH_VARARGS, NULL}, - { (char *)"SessionContainer_hangup", _wrap_SessionContainer_hangup, METH_VARARGS, NULL}, - { (char *)"SessionContainer_set_variable", _wrap_SessionContainer_set_variable, METH_VARARGS, NULL}, - { (char *)"SessionContainer_get_variable", _wrap_SessionContainer_get_variable, METH_VARARGS, NULL}, - { (char *)"SessionContainer_set_state", _wrap_SessionContainer_set_state, METH_VARARGS, NULL}, - { (char *)"SessionContainer_play_file", _wrap_SessionContainer_play_file, METH_VARARGS, NULL}, - { (char *)"SessionContainer_set_dtmf_callback", _wrap_SessionContainer_set_dtmf_callback, METH_VARARGS, NULL}, - { (char *)"SessionContainer_speak_text", _wrap_SessionContainer_speak_text, METH_VARARGS, NULL}, - { (char *)"SessionContainer_set_tts_parms", _wrap_SessionContainer_set_tts_parms, METH_VARARGS, NULL}, - { (char *)"SessionContainer_get_digits", _wrap_SessionContainer_get_digits, METH_VARARGS, NULL}, - { (char *)"SessionContainer_transfer", _wrap_SessionContainer_transfer, METH_VARARGS, NULL}, - { (char *)"SessionContainer_play_and_get_digits", _wrap_SessionContainer_play_and_get_digits, METH_VARARGS, NULL}, - { (char *)"SessionContainer_swigregister", SessionContainer_swigregister, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } + { (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS }, + { (char *)"new_SessionContainer", _wrap_new_SessionContainer, METH_VARARGS }, + { (char *)"delete_SessionContainer", _wrap_delete_SessionContainer, METH_VARARGS }, + { (char *)"SessionContainer_console_log", _wrap_SessionContainer_console_log, METH_VARARGS }, + { (char *)"SessionContainer_console_clean_log", _wrap_SessionContainer_console_clean_log, METH_VARARGS }, + { (char *)"SessionContainer_answer", _wrap_SessionContainer_answer, METH_VARARGS }, + { (char *)"SessionContainer_pre_answer", _wrap_SessionContainer_pre_answer, METH_VARARGS }, + { (char *)"SessionContainer_hangup", _wrap_SessionContainer_hangup, METH_VARARGS }, + { (char *)"SessionContainer_set_variable", _wrap_SessionContainer_set_variable, METH_VARARGS }, + { (char *)"SessionContainer_get_variable", _wrap_SessionContainer_get_variable, METH_VARARGS }, + { (char *)"SessionContainer_set_state", _wrap_SessionContainer_set_state, METH_VARARGS }, + { (char *)"SessionContainer_play_file", _wrap_SessionContainer_play_file, METH_VARARGS }, + { (char *)"SessionContainer_set_dtmf_callback", _wrap_SessionContainer_set_dtmf_callback, METH_VARARGS }, + { (char *)"SessionContainer_speak_text", _wrap_SessionContainer_speak_text, METH_VARARGS }, + { (char *)"SessionContainer_set_tts_parms", _wrap_SessionContainer_set_tts_parms, METH_VARARGS }, + { (char *)"SessionContainer_get_digits", _wrap_SessionContainer_get_digits, METH_VARARGS }, + { (char *)"SessionContainer_transfer", _wrap_SessionContainer_transfer, METH_VARARGS }, + { (char *)"SessionContainer_play_and_get_digits", _wrap_SessionContainer_play_and_get_digits, METH_VARARGS }, + { (char *)"SessionContainer_swigregister", SessionContainer_swigregister, METH_VARARGS }, + { NULL, NULL } }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static swig_type_info _swigt__p_SessionContainer = {"_p_SessionContainer", "SessionContainer *", 0, 0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, 0}; -static swig_type_info _swigt__p_switch_core_session = {"_p_switch_core_session", "switch_core_session *", 0, 0, 0}; -static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, 0}; -static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, 0}; -static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, 0}; -static swig_type_info _swigt__ptrdiff_t = {"_ptrdiff_t", "ptrdiff_t", 0, 0, 0}; -static swig_type_info _swigt__size_t = {"_size_t", "size_t", 0, 0, 0}; -static swig_type_info _swigt__std__ptrdiff_t = {"_std__ptrdiff_t", "std::ptrdiff_t", 0, 0, 0}; -static swig_type_info _swigt__std__size_t = {"_std__size_t", "std::size_t", 0, 0, 0}; +static swig_type_info _swigt__p_switch_status_t[] = {{"_p_switch_status_t", 0, "switch_status_t *", 0},{"_p_switch_status_t"},{0}}; +static swig_type_info _swigt__p_switch_input_type_t[] = {{"_p_switch_input_type_t", 0, "switch_input_type_t *", 0},{"_p_switch_input_type_t"},{0}}; +static swig_type_info _swigt__p_void[] = {{"_p_void", 0, "void *", 0},{"_p_void"},{0}}; +static swig_type_info _swigt__p_switch_core_session[] = {{"_p_switch_core_session", 0, "switch_core_session *", 0},{"_p_switch_core_session"},{0}}; +static swig_type_info _swigt__p_SessionContainer[] = {{"_p_SessionContainer", 0, "SessionContainer *", 0},{"_p_SessionContainer"},{0}}; -static swig_type_info *swig_type_initial[] = { - &_swigt__p_SessionContainer, - &_swigt__p_char, - &_swigt__p_switch_core_session, - &_swigt__p_switch_input_type_t, - &_swigt__p_switch_status_t, - &_swigt__p_void, - &_swigt__ptrdiff_t, - &_swigt__size_t, - &_swigt__std__ptrdiff_t, - &_swigt__std__size_t, -}; - -static swig_cast_info _swigc__p_SessionContainer[] = { {&_swigt__p_SessionContainer, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_core_session[] = { {&_swigt__p_switch_core_session, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__ptrdiff_t[] = { {&_swigt__ptrdiff_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__size_t[] = { {&_swigt__size_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__std__ptrdiff_t[] = { {&_swigt__std__ptrdiff_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__std__size_t[] = { {&_swigt__std__size_t, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_SessionContainer, - _swigc__p_char, - _swigc__p_switch_core_session, - _swigc__p_switch_input_type_t, - _swigc__p_switch_status_t, - _swigc__p_void, - _swigc__ptrdiff_t, - _swigc__size_t, - _swigc__std__ptrdiff_t, - _swigc__std__size_t, +static swig_type_info *swig_types_initial[] = { +_swigt__p_switch_status_t, +_swigt__p_switch_input_type_t, +_swigt__p_void, +_swigt__p_switch_core_session, +_swigt__p_SessionContainer, +0 }; /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; +{0}}; #ifdef __cplusplus } #endif -/************************************************************************* - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - - * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop though that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. -**/ - -#ifdef __cplusplus -extern "C" { -#endif - - SWIGRUNTIME void - SWIG_InitializeModule(void *clientdata) { - swig_type_info *type, *ret; - swig_cast_info *cast; - size_t i; - swig_module_info *module_head; - static int init_run = 0; - - clientdata = clientdata; - - if (init_run) return; - init_run = 1; - - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (module_head) { - swig_module.next = module_head->next; - module_head->next = &swig_module; - } else { - /* This is the first module loaded */ - swig_module.next = &swig_module; - SWIG_SetModule(clientdata, &swig_module); - } - - /* Now work on filling in swig_module.types */ - for (i = 0; i < swig_module.size; ++i) { - type = 0; - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ - if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata; - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); - } - if (ret && type == swig_module.type_initial[i]) { - cast->type = ret; - ret = 0; - } - - if (!ret) { - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - - cast++; - } - - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - } - - /* This function will propagate the clientdata field of type to - * any new swig_type_info structures that have been added into the list - * of equivalent types. It is like calling - * SWIG_TypeClientData(type, clientdata) a second time. - */ - SWIGRUNTIME void - SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } - } - -#ifdef __cplusplus -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *v) { - v = v; - return PyString_FromString(""); - } - - SWIGINTERN int - swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) { - swig_globalvar *var; - flags = flags; - fprintf(fp,"Swig global variables { "); - for (var = v->vars; var; var=var->next) { - fprintf(fp,"%s", var->name); - if (var->next) fprintf(fp,", "); - } - fprintf(fp," }\n"); - return 0; - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - return (*var->get_attr)(); - } - var = var->next; - } - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - return NULL; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - return (*var->set_attr)(p); - } - var = var->next; - } - PyErr_SetString(PyExc_NameError,"Unknown C global variable"); - return 1; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type -#if !defined(__cplusplus) - ; - static int type_init = 0; - if (!type_init) { - PyTypeObject tmp -#endif - = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* Number of items in variable part (ob_size) */ - (char *)"swigvarlink", /* Type name (tp_name) */ - sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ - 0, /* Itemsize (tp_itemsize) */ - 0, /* Deallocator (tp_dealloc) */ - (printfunc) swig_varlink_print, /* Print (tp_print) */ - (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ - (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ -#if PY_VERSION_HEX >= 0x02000000 - 0, /* tp_traverse */ - 0, /* tp_clear */ -#endif -#if PY_VERSION_HEX >= 0x02010000 - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ -#endif -#if PY_VERSION_HEX >= 0x02020000 - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ -#endif -#if PY_VERSION_HEX >= 0x02030000 - 0, /* tp_del */ -#endif -#ifdef COUNT_ALLOCS - 0,0,0,0 /* tp_alloc -> tp_next */ -#endif - }; -#if !defined(__cplusplus) - varlink_type = tmp; - type_init = 1; - } -#endif - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - strncpy(gv->name,name,size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_INT: - obj = PyInt_FromLong(constants[i].lvalue); - break; - case SWIG_PY_FLOAT: - obj = PyFloat_FromDouble(constants[i].dvalue); - break; - case SWIG_PY_STRING: - if (constants[i].pvalue) { - obj = PyString_FromString((char *) constants[i].pvalue); - } else { - Py_INCREF(Py_None); - obj = Py_None; - } - break; - case SWIG_PY_POINTER: - obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d,constants[i].name,obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - char *c = methods[i].ml_doc; - if (c && (c = strstr(c, "swig_ptr: "))) { - int j; - swig_const_info *ci = 0; - char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - strncpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - strncpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - - /* -----------------------------------------------------------------------------* - * Initialize type list - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" #endif -SWIGEXPORT void SWIG_init(void) { +SWIGEXPORT(void) SWIG_init(void) { static PyObject *SWIG_globals = 0; + static int typeinit = 0; PyObject *m, *d; + int i; if (!SWIG_globals) SWIG_globals = SWIG_newvarlink(); - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - m = Py_InitModule((char *) SWIG_name, SwigMethods); d = PyModule_GetDict(m); - SWIG_InitializeModule(0); + if (!typeinit) { + for (i = 0; swig_types_initial[i]; i++) { + swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); + } + typeinit = 1; + } SWIG_InstallConstants(d,swig_const_table); PyDict_SetItemString(d,(char*)"cvar", SWIG_globals); diff --git a/src/mod/languages/mod_ruby/switch_swig_wrap.c b/src/mod/languages/mod_ruby/switch_swig_wrap.c index 74f9c89ddd..dcc9a96bdf 100644 --- a/src/mod/languages/mod_ruby/switch_swig_wrap.c +++ b/src/mod/languages/mod_ruby/switch_swig_wrap.c @@ -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_get_variable(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_sleep(switch_core_session_t *,uint32_t); 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_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_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 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) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; char *arg2 ; - char *arg3 ; - switch_input_callback_function_t arg4 ; - void *arg5 = (void *) 0 ; - unsigned int arg6 ; int result; VALUE vresult = Qnil; - if ((argc < 6) || (argc > 6)) - rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc); + if ((argc < 2) || (argc > 2)) + rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1); arg2 = StringValuePtr(argv[1]); - arg3 = StringValuePtr(argv[2]); - { - 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); + result = (int)fs_ivr_play_file(arg1,arg2); vresult = INT2NUM(result); 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 ; char *arg2 ; char *arg3 ; - char *arg4 ; - uint32_t arg5 ; - switch_input_callback_function_t arg6 ; - char *arg7 ; - void *arg8 = (void *) 0 ; - unsigned int arg9 ; + uint32_t arg4 ; + char *arg5 ; int result; VALUE vresult = Qnil; - if ((argc < 9) || (argc > 9)) - rb_raise(rb_eArgError, "wrong # of arguments(%d for 9)",argc); + if ((argc < 5) || (argc > 5)) + rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1); arg2 = StringValuePtr(argv[1]); arg3 = StringValuePtr(argv[2]); - arg4 = StringValuePtr(argv[3]); { uint32_t * ptr; - SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_uint32_t, 1); - if (ptr) arg5 = *ptr; + SWIG_ConvertPtr(argv[3], (void **) &ptr, SWIGTYPE_p_uint32_t, 1); + if (ptr) arg4 = *ptr; } - { - switch_input_callback_function_t * ptr; - 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); + arg5 = StringValuePtr(argv[4]); + result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5); vresult = INT2NUM(result); return vresult; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 8d612103a6..c5ad6e51e5 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -850,6 +850,7 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval switch_file_handle_t fh = {0}; JSFunction *function; int32 limit = 0; + switch_input_args_t args = {0}; channel = switch_core_session_get_channel(jss->session); assert(channel != NULL); @@ -904,7 +905,10 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval cb_state.extra = &fh; cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE ); 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); *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; struct input_callback_state cb_state = {0}; JSFunction *function; + switch_input_args_t args = {0}; channel = switch_core_session_get_channel(jss->session); 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); - 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); *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); switch_channel_t *channel; char *file_name = NULL; - char *timer_name = NULL; //char *input_callback = NULL; void *bp = NULL; 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}; switch_file_handle_t fh = {0}; JSFunction *function; + switch_input_args_t args = {0}; channel = switch_core_session_get_channel(jss->session); assert(channel != NULL); @@ -994,19 +1002,14 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval return JS_FALSE; } } + if (argc > 1) { - timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1])); - if (switch_strlen_zero(timer_name)) { - timer_name = NULL; - } - } - if (argc > 2) { - if ((function = JS_ValueToFunction(cx, argv[2]))) { + if ((function = JS_ValueToFunction(cx, argv[1]))) { memset(&cb_state, 0, sizeof(cb_state)); cb_state.function = function; - if (argc > 3) { - cb_state.arg = argv[3]; + if (argc > 2) { + cb_state.arg = argv[2]; } 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; - JS_ValueToInt32(cx, argv[4], &samps); + JS_ValueToInt32(cx, argv[3], &samps); fh.samples = samps; } cb_state.extra = &fh; cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE ); 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); *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 *voice_name = NULL; char *text = NULL; - char *timer_name = NULL; switch_codec_t *codec; void *bp = NULL; int len = 0; struct input_callback_state cb_state = {0}; switch_input_callback_function_t dtmf_func = NULL; JSFunction *function; + switch_input_args_t args = {0}; channel = switch_core_session_get_channel(jss->session); 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) { 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); cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE ); cb_state.saveDepth = JS_SuspendRequest(cx); + args.input_callback = dtmf_func; + args.buf = bp; + args.buflen = len; switch_ivr_speak_text(jss->session, tts_name, voice_name && strlen(voice_name) ? voice_name : NULL, - timer_name, codec->implementation->samples_per_second, - dtmf_func, text, - bp, - len); + &args); JS_ResumeRequest(cx, cb_state.saveDepth); *rval = cb_state.ret; diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 712a8b4d13..756ebe232e 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -39,14 +39,14 @@ static const char modname[] = "mod_say_en"; char tmp[80];\ switch_status_t status;\ 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;\ }}\ #define say_file(...) {\ char tmp[80];\ 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))) {\ return SWITCH_STATUS_FALSE;\ }}\ @@ -54,12 +54,10 @@ static const char modname[] = "mod_say_en"; static switch_status_t en_spell(switch_core_session_t *session, - char *tosay, - switch_say_type_t type, - switch_say_method_t method, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + char *tosay, + switch_say_type_t type, + switch_say_method_t method, + switch_input_args_t *args) { char *p; @@ -80,9 +78,7 @@ static switch_status_t play_group(int a, int c, char *what, switch_core_session_t *session, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { if (a) { @@ -137,9 +133,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { switch_channel_t *channel; int in; @@ -167,13 +161,13 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, switch (method) { 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; } - 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; } - 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; } break; @@ -195,9 +189,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { int32_t t; switch_time_t target = 0; @@ -326,9 +318,7 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { 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) { - say_cb(session, tosay, type, method, input_callback, buf, buflen); + say_cb(session, tosay, type, method, args); } return SWITCH_STATUS_SUCCESS; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 9c9e00083f..b8e09c85f6 100644 --- a/src/switch_ivr.c +++ b/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_input_callback_function_t input_callback, - void *buf, - uint32_t buflen, + switch_input_args_t *args, uint32_t timeout) { 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); assert(channel != NULL); - if (!input_callback) { + if (!args->input_callback) { 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)) { 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) { - 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); } @@ -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_file_handle_t *fh, char *file, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen, + switch_input_args_t *args, uint32_t limit) { switch_channel_t *channel; @@ -454,28 +450,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se 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 if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!input_callback && !buf) { + if (!args->input_callback && !args->buf) { status = SWITCH_STATUS_BREAK; break; } switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); - if (input_callback) { - status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen); + if (args->input_callback) { + status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { - switch_copy_string((char *)buf, dtmf, buflen); + switch_copy_string((char *)args->buf, dtmf, args->buflen); status = SWITCH_STATUS_BREAK; } } - if (input_callback) { + if (args->input_callback) { 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); } } @@ -955,12 +951,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * #define FILE_BUFSIZE 1024 * 64 SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, - switch_file_handle_t *fh, - char *file, - char *timer_name, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_file_handle_t *fh, + char *file, + switch_input_args_t *args) { switch_channel_t *channel; 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; char *ext; char *prefix; + char *timer_name; channel = switch_core_session_get_channel(session); assert(channel != NULL); prefix = switch_channel_get_variable(channel, "sound_prefix"); + timer_name = switch_channel_get_variable(channel, "timer_name"); if (file) { 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); } - 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 if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!input_callback && !buf) { + if (!args->input_callback && !args->buf) { status = SWITCH_STATUS_BREAK; done = 1; break; } switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); - if (input_callback) { - status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen); + if (args->input_callback) { + status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { - switch_copy_string((char *)buf, dtmf, buflen); + switch_copy_string((char *)args->buf, dtmf, args->buflen); status = SWITCH_STATUS_BREAK; } } - if (input_callback) { + if (args->input_callback) { 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); } } @@ -1406,11 +1401,14 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t //Start pestering the user for input 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 memset(digit_buffer, 0, digit_buffer_length); - + + args.buf = digit_buffer; + args.buflen = digit_buffer_length; //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); //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 { //See if a bad input prompt was specified, if so, play it 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 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 { //See if a bad input prompt was specified, if so, play it 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 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_codec_t *codec, switch_timer_t *timer, - switch_input_callback_function_t input_callback, char *text, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { switch_channel_t *channel; short abuf[960]; @@ -1562,33 +1558,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session 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 if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!input_callback && !buf) { + if (!args->input_callback && !args->buf) { status = SWITCH_STATUS_BREAK; done = 1; break; } - if (buf && !strcasecmp(buf, "_break_")) { + if (args->buf && !strcasecmp(args->buf, "_break_")) { status = SWITCH_STATUS_BREAK; } else { switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf)); - if (input_callback) { - status = input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, buf, buflen); + if (args->input_callback) { + status = args->input_callback(session, dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { - switch_copy_string((char *)buf, dtmf, buflen); + switch_copy_string((char *)args->buf, dtmf, args->buflen); status = SWITCH_STATUS_BREAK; } } } - if (input_callback) { + if (args->input_callback) { 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); } } @@ -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, char *tts_name, char *voice_name, - char *timer_name, uint32_t rate, - switch_input_callback_function_t input_callback, char *text, - void *buf, - uint32_t buflen) + switch_input_args_t *args) { switch_channel_t *channel; 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_flag_t flags = SWITCH_SPEECH_FLAG_NONE; switch_codec_t *read_codec; + char *timer_name; channel = switch_core_session_get_channel(session); assert(channel != NULL); + timer_name = switch_channel_get_variable(channel, "timer_name"); + if (rate == 0) { read_codec = switch_core_session_get_read_codec(session); 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; switch_core_speech_close(&sh, &flags); 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)); if (collect->file) { - - switch_ivr_play_file(collect->session, NULL, collect->file, NULL, NULL, buf, sizeof(buf)); + switch_input_args_t args = {0}; + args.buf = buf; + args.buflen = sizeof(buf); + switch_ivr_play_file(collect->session, NULL, collect->file, &args); } else { 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 *buf; char *ptr; - char *timer_name; int max_failures; int timeout; 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, int timeout, int max_failures, - char *timer_name, switch_memory_pool_t *pool) { 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); } - if (!switch_strlen_zero(timer_name)) { - menu->timer_name = switch_core_strdup(menu->pool, timer_name); - } - menu->max_failures = max_failures; menu->timeout = timeout; @@ -3944,7 +3936,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *st 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; 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 == '\\') { - 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 { 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,13 +4030,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s memset(arg, 0, sizeof(arg)); 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)) { for(ap = menu->actions; ap ; ap = ap->next) { if (!strcmp(menu->buf, ap->bind)) { char *membuf; - + match++; errs = 0; if (ap->function) { @@ -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(todo) { case SWITCH_IVR_ACTION_DIE: status = SWITCH_STATUS_FALSE; break; 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; 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; case SWITCH_IVR_ACTION_TRANSFER: 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); 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++; @@ -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); 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); @@ -4258,10 +4257,10 @@ 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_ivr_menu_t **menu_stack, - switch_xml_t xml_menus, - switch_xml_t xml_menu, - char *timer_name) + switch_ivr_menu_t **menu_stack, + switch_xml_t xml_menus, + switch_xml_t xml_menu) + { 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_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, *menu_stack, menu_name, @@ -4290,7 +4288,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_ tts_voice, atoi(timeout)*1000, atoi(max_failures), - timer_name, xml_menu_ctx->pool ); // 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 ? 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) { - 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 *data, char *lang, - switch_input_callback_function_t input_callback, - void *buf, - uint32_t buflen) + switch_input_args_t *args) + { switch_xml_t cfg, xml = NULL, language, macros, macro, input, action; 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); 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")) { const switch_application_interface_t *application_interface; 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_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 { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid SAY Interface [%s]!\n", lang); } } else if (!strcasecmp(func, "speak-text")) { switch_codec_t *read_codec; if ((read_codec = switch_core_session_get_read_codec(session))) { + switch_ivr_speak_text(session, tts_engine, tts_voice, - NULL, read_codec->implementation->samples_per_second, - input_callback, odata, - buf, - buflen); + args); } } } diff --git a/src/switch_swig.c b/src/switch_swig.c index e9c915abae..5bfaf9d9f7 100644 --- a/src/switch_swig.c +++ b/src/switch_swig.c @@ -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, - char *file, - char *timer_name, - switch_input_callback_function_t dtmf_callback, - void *buf, - unsigned int buflen) + char *file) { switch_status_t status; if (switch_strlen_zero(timer_name)) { 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; } @@ -202,7 +198,7 @@ int fs_ivr_play_file2(switch_core_session_t *session, { 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; } @@ -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, char *tts_name, char *voice_name, - char *timer_name, uint32_t rate, - switch_input_callback_function_t dtmf_callback, - char *text, - void *buf, - unsigned int buflen) + char *text) { 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; }