Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
December 2006
- 10 participants
- 350 discussions
Author: xachen
Date: Sat Dec 23 18:58:13 2006
New Revision: 3817
Removed:
freeswitch/trunk/build/thisbuild-init.sh
Log:
Removing deprecated feature.. Also to test new SVN setup.
1
0
Author: knhor
Date: Sat Dec 23 13:26:46 2006
New Revision: 3816
Modified:
freeswitch/branches/knhor/trunk/ (props changed)
freeswitch/branches/knhor/trunk/src/include/switch_ivr.h
freeswitch/branches/knhor/trunk/src/include/switch_types.h
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/knhor/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/knhor/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c
freeswitch/branches/knhor/trunk/src/mod/applications/mod_playback/mod_playback.c
freeswitch/branches/knhor/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
freeswitch/branches/knhor/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/branches/knhor/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/branches/knhor/trunk/src/switch_ivr.c
freeswitch/branches/knhor/trunk/src/switch_swig.c
Log:
Merged revisions 3814-3815 via svnmerge from trunk
Modified: freeswitch/branches/knhor/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/knhor/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/branches/knhor/trunk/src/include/switch_ivr.h Sat Dec 23 13:26:46 2006
@@ -43,8 +43,6 @@
SWITCH_BEGIN_EXTERN_C
-
-
/**
* @defgroup switch_ivr IVR Library
* @ingroup core1
@@ -74,9 +72,7 @@
\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 @@
\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,15 +178,11 @@
\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);
-
/*!
\brief record a file from the session to a file
\param session the session to record from
@@ -207,9 +198,7 @@
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_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(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 @@
*\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 @@
char *tts_voice,
int timeout,
int max_failures,
- char *timer_name,
switch_memory_pool_t *pool);
/*!
@@ -600,14 +581,12 @@
*\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 @@
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
Modified: freeswitch/branches/knhor/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/knhor/trunk/src/include/switch_types.h (original)
+++ freeswitch/branches/knhor/trunk/src/include/switch_types.h Sat Dec 23 13:26:46 2006
@@ -917,13 +917,16 @@
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);
@@ -939,7 +942,6 @@
char *key_name,
char *key_value,
char *params);
-
/* things we don't deserve to know about */
/*! \brief A channel */
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sat Dec 23 13:26:46 2006
@@ -3328,7 +3328,7 @@
/* 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 @@
}
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);
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sat Dec 23 13:26:46 2006
@@ -123,7 +123,7 @@
}
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 @@
#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);
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c Sat Dec 23 13:26:46 2006
@@ -138,7 +138,7 @@
}
- 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 @@
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 @@
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 @@
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 @@
}
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);
}
}
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_playback/mod_playback.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_playback/mod_playback.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_playback/mod_playback.c Sat Dec 23 13:26:46 2006
@@ -72,6 +72,7 @@
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 @@
engine = argv[0];
voice = argv[1];
text = argv[2];
- timer_name = argv[3];
if (!(engine && voice && text)) {
if (!engine) {
@@ -102,28 +102,29 @@
}
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 @@
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 @@
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);
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c Sat Dec 23 13:26:46 2006
@@ -791,8 +791,6 @@
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif
-#include <switch.h>
-
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_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_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 @@
{
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 @@
}
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 @@
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 @@
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);
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_php/switch_swig_wrap.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_php/switch_swig_wrap.c Sat Dec 23 13:26:46 2006
@@ -576,7 +576,7 @@
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_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_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,31 +1102,9 @@
convert_to_string_ex(args[1-argbase]);
arg2 = (char *) Z_STRVAL_PP(args[1-argbase]);
+ result = (int)fs_ivr_play_file(arg1,arg2);
- convert_to_string_ex(args[2-argbase]);
- arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
- {
- switch_input_callback_function_t * argp;
- if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
- zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 4-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
- }
- arg4 = *argp;
- }
-
- if(SWIG_ConvertPtr(*args[4-argbase], (void **) &arg5, 0) < 0) {
- /* Allow NULL from php for void* */
- if ((*args[4-argbase])->type==IS_NULL) arg5=0;
- else zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 5-argbase, SWIGTYPE_p_void->name);
- }
-
-
- convert_to_long_ex(args[5-argbase]);
- arg6 = (unsigned int) Z_LVAL_PP(args[5-argbase]);
-
- result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
-
-
ZVAL_LONG(return_value,result);
}
@@ -1469,21 +1443,17 @@
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 @@
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;
+ arg4 = *argp;
}
- {
- switch_input_callback_function_t * argp;
- if(SWIG_ConvertPtr(*args[5-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
- zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 6-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
- }
- arg6 = *argp;
- }
- convert_to_string_ex(args[6-argbase]);
- 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);
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/freeswitch.py Sat Dec 23 13:26:46 2006
@@ -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,14 +13,8 @@
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)
+ self.__dict__[name] = value
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
def _swig_getattr(self,class_type,name):
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
@@ -44,7 +38,7 @@
__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 "<C SessionContainer instance at %s>" % (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 @@
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 @@
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
-
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Sat Dec 23 13:26:46 2006
@@ -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 @@
T *operator&() { return tt; }
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& 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 <Python.h>
-
/***********************************************************************
- * 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(a)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"
+#include <string.h>
-/* 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)
+#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 SWIG_TYPE_TABLE_NAME
+# define SWIGEXPORT(a) a
+# define SWIGIMPORT(a) a
#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
+#ifdef SWIG_GLOBAL
+# define SWIGRUNTIME(a) SWIGEXPORT(a)
+#else
+# define SWIGRUNTIME(a) static a
#endif
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-#include <string.h>
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -143,141 +101,106 @@
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<int>" == "Class<int >", 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);
+/* 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;
+ }
+ tc = tc->prev;
}
- return (l1 - f1) - (l2 - f2);
-}
+ head = ti;
+ next = 0;
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- 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;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
+ /* 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++;
}
- return equiv;
+ if (next) next->prev = head;
+ head->next = next;
+ return ret;
}
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- 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 @@
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;
-}
+#endif
-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);
-}
-
#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(a)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 @@
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(a)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
+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[]);
-/* Flags for pointer conversion */
-#define SWIG_POINTER_EXCEPTION 0x1
-#define SWIG_POINTER_DISOWN 0x2
+#else
-
-/* 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
+ * global variable support code.
* ----------------------------------------------------------------------------- */
-#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
+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;
-#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 {
+typedef struct swig_varlinkobject {
PyObject_HEAD
- void *ptr;
- const char *desc;
-} PySwigObject;
+ swig_globalvar *vars;
+} swig_varlinkobject;
-/* Declarations for objects of type PySwigObject */
+static PyObject *
+swig_varlink_repr(swig_varlinkobject *v) {
+ v = v;
+ return PyString_FromString("<Global variables>");
+}
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int flags)
-{
- char result[SWIG_BUFFER_SIZE];
+static int
+swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
+ swig_globalvar *var;
flags = flags;
- if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) {
- fputs("<Swig Object at ", fp); fputs(result, fp); fputs(">", fp);
- return 0;
- } else {
- return 1;
+ 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 PyObject *
-PySwigObject_repr(PySwigObject *v)
-{
- char result[SWIG_BUFFER_SIZE];
- return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
- PyString_FromFormat("<Swig Object at %s>", 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);
+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)();
}
- 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);
+ var = var->next;
}
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return NULL;
}
-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("<Swig Packed ", fp);
- if (SWIG_PackDataName(result, v->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("<Swig Packed at %s%s>", result, v->desc);
- } else {
- return PyString_FromFormat("<Swig Packed %s>", 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;
+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);
}
- return NULL;
+ var = var->next;
}
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return 1;
}
-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;
-}
+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 */
+};
-SWIGRUNTIMEINLINE const char *
-PySwigPacked_GetDesc(PyObject *self)
-{
- return ((PySwigPacked *)self)->desc;
+/* 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);
}
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
- return ((op)->ob_type == PySwigPacked_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
+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;
}
-#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
- * ----------------------------------------------------------------------------- */
-
-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");
- }
-}
-
-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");
- }
-}
-
-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);
- }
- return 1;
- } else {
- return 0;
- }
-}
-
-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;
- }
-}
-
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
/* 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 @@
}
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 @@
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 @@
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 @@
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;
}
-#endif
+ if (obj) {
+ PyDict_SetItemString(d,constants[i].name,obj);
+ Py_DECREF(obj);
+ }
}
- 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 @@
/* -------- 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,292 +719,37 @@
#include "freeswitch_python.h"
+extern void *globalDTMFCallbackFunction;
+extern switch_status_t PythonDTMFCallback(switch_core_session *,void *,switch_input_type_t,void *,unsigned int);
-#include <limits.h>
+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;
+ return target;
}
-#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<unsigned int >(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<int >(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<char* >(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;
-}
-
-
-
switch_status_t PythonDTMFCallback(switch_core_session_t *session,
void *input,
switch_input_type_t itype,
@@ -1772,9 +778,8 @@
static int _wrap_globalDTMFCallbackFunction_set(PyObject *_val) {
{
void * temp;
- if ((SWIG_ConvertPtr(_val, static_cast<void ** >(&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 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 @@
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<void ** >(&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<void ** >(&arg4),0,SWIG_POINTER_EXCEPTION|0))== -1) {
- SWIG_arg_fail(4);SWIG_fail;
- }
- }
- {
- arg5 = static_cast<unsigned int >(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<switch_status_t & >(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_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_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_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_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<int >(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<int >(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_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_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_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_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<int >(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_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<int >(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_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<int >(SWIG_As_int(obj2));
- if (SWIG_arg_fail(3)) SWIG_fail;
+ char *t = PyString_AsString(obj4);
+ if (PyErr_Occurred()) SWIG_fail;
+ strncpy(temp5,t,8);
+ arg5 = (char *) temp5;
}
- 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<int >(SWIG_As_int(obj5));
- if (SWIG_arg_fail(6)) SWIG_fail;
- }
result = (int)(arg1)->get_digits(arg2,arg3,arg4,arg5,arg6);
+ resultobj = PyInt_FromLong((long)result);
{
- resultobj = SWIG_From_int(static_cast<int >(result));
+ PyObject *o;
+ arg2[128] = 0;
+ o = PyString_FromString(arg2);
+ 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));
+ {
+ PyObject *o;
+ arg5[8] = 0;
+ o = PyString_FromString(arg5);
+ resultobj = t_output_helper(resultobj,o);
+ }
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<int >(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<int >(SWIG_As_int(obj1));
- if (SWIG_arg_fail(2)) SWIG_fail;
+ char *t = PyString_AsString(obj8);
+ if (PyErr_Occurred()) SWIG_fail;
+ strncpy(temp9,t,128);
+ arg9 = (char *) temp9;
}
- {
- arg3 = static_cast<int >(SWIG_As_int(obj2));
- if (SWIG_arg_fail(3)) SWIG_fail;
- }
- {
- arg4 = static_cast<int >(SWIG_As_int(obj3));
- if (SWIG_arg_fail(4)) SWIG_fail;
- }
- {
- arg5 = static_cast<int >(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;
- }
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<int >(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 @@
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_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
};
-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,
-};
-
-
/* -------- 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("<Swig global variables>");
- }
-
- 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);
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c Sat Dec 23 13:26:46 2006
@@ -627,7 +627,7 @@
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_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 @@
_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 @@
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;
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sat Dec 23 13:26:46 2006
@@ -850,6 +850,7 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
}
}
- if (argc > 5) {
- timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
- }
-
if (!tts_name && text) {
return JS_FALSE;
}
@@ -1159,15 +1161,15 @@
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;
Modified: freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c Sat Dec 23 13:26:46 2006
@@ -39,14 +39,14 @@
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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
if (say_cb) {
- say_cb(session, tosay, type, method, input_callback, buf, buflen);
+ say_cb(session, tosay, type, method, args);
}
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/knhor/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_ivr.c (original)
+++ freeswitch/branches/knhor/trunk/src/switch_ivr.c Sat Dec 23 13:26:46 2006
@@ -178,9 +178,7 @@
}
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 @@
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 @@
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_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 @@
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 @@
#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 @@
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) != ':') {
@@ -1167,29 +1162,29 @@
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);
}
}
@@ -1407,11 +1402,14 @@
//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
@@ -1434,7 +1432,7 @@
} 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) {
@@ -1474,7 +1472,7 @@
} 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) {
@@ -1500,10 +1498,8 @@
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];
@@ -1563,33 +1559,33 @@
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);
}
}
@@ -1688,12 +1684,9 @@
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;
@@ -1710,10 +1703,13 @@
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;
@@ -1777,7 +1773,7 @@
}
}
- 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);
@@ -2182,8 +2178,10 @@
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);
}
@@ -3754,7 +3752,6 @@
char *tts_voice;
char *buf;
char *ptr;
- char *timer_name;
int max_failures;
int timeout;
uint32_t inlen;
@@ -3806,7 +3803,6 @@
char *tts_voice,
int timeout,
int max_failures,
- char *timer_name,
switch_memory_pool_t *pool)
{
switch_ivr_menu_t *menu;
@@ -3858,10 +3854,6 @@
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;
@@ -3945,7 +3937,7 @@
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;
@@ -3965,10 +3957,16 @@
}
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);
}
}
@@ -4033,13 +4031,13 @@
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) {
@@ -4052,15 +4050,16 @@
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);
@@ -4124,7 +4123,7 @@
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++;
@@ -4136,7 +4135,7 @@
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);
@@ -4259,10 +4258,10 @@
}
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;
@@ -4279,7 +4278,6 @@
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,
@@ -4291,7 +4289,6 @@
tts_voice,
atoi(timeout)*1000,
atoi(max_failures),
- timer_name,
xml_menu_ctx->pool
);
// set the menu_stack for the caller
@@ -4323,7 +4320,7 @@
// 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);
}
}
@@ -4413,9 +4410,8 @@
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] = "";
@@ -4529,7 +4525,7 @@
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;
@@ -4558,22 +4554,20 @@
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);
}
}
}
Modified: freeswitch/branches/knhor/trunk/src/switch_swig.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_swig.c (original)
+++ freeswitch/branches/knhor/trunk/src/switch_swig.c Sat Dec 23 13:26:46 2006
@@ -158,18 +158,14 @@
*/
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 @@
{
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_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;
}
1
0
23 Dec '06
Author: anthm
Date: Sat Dec 23 11:40:37 2006
New Revision: 3815
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c
freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_swig.c
Log:
ruin everything, sorry jamesdotcom
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Sat Dec 23 11:40:37 2006
@@ -43,8 +43,6 @@
SWITCH_BEGIN_EXTERN_C
-
-
/**
* @defgroup switch_ivr IVR Library
* @ingroup core1
@@ -74,9 +72,7 @@
\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 @@
\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,15 +178,11 @@
\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);
-
/*!
\brief record a file from the session to a file
\param session the session to record from
@@ -207,9 +198,7 @@
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_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(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 @@
*\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 @@
char *tts_voice,
int timeout,
int max_failures,
- char *timer_name,
switch_memory_pool_t *pool);
/*!
@@ -600,14 +581,12 @@
*\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 @@
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
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Sat Dec 23 11:40:37 2006
@@ -917,13 +917,16 @@
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);
@@ -939,7 +942,6 @@
char *key_name,
char *key_value,
char *params);
-
/* things we don't deserve to know about */
/*! \brief A channel */
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Sat Dec 23 11:40:37 2006
@@ -3328,7 +3328,7 @@
/* 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 @@
}
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);
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sat Dec 23 11:40:37 2006
@@ -123,7 +123,7 @@
}
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 @@
#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);
Modified: freeswitch/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_ivrtest/mod_ivrtest.c Sat Dec 23 11:40:37 2006
@@ -138,7 +138,7 @@
}
- 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 @@
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 @@
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 @@
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 @@
}
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);
}
}
Modified: freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c Sat Dec 23 11:40:37 2006
@@ -72,6 +72,7 @@
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 @@
engine = argv[0];
voice = argv[1];
text = argv[2];
- timer_name = argv[3];
if (!(engine && voice && text)) {
if (!engine) {
@@ -102,28 +102,29 @@
}
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 @@
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 @@
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);
Modified: freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c Sat Dec 23 11:40:37 2006
@@ -791,8 +791,6 @@
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif
-#include <switch.h>
-
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_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_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 @@
{
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 @@
}
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 @@
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 @@
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);
Modified: freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c Sat Dec 23 11:40:37 2006
@@ -576,7 +576,7 @@
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_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_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,31 +1102,9 @@
convert_to_string_ex(args[1-argbase]);
arg2 = (char *) Z_STRVAL_PP(args[1-argbase]);
+ result = (int)fs_ivr_play_file(arg1,arg2);
- convert_to_string_ex(args[2-argbase]);
- arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
- {
- switch_input_callback_function_t * argp;
- if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
- zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 4-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
- }
- arg4 = *argp;
- }
-
- if(SWIG_ConvertPtr(*args[4-argbase], (void **) &arg5, 0) < 0) {
- /* Allow NULL from php for void* */
- if ((*args[4-argbase])->type==IS_NULL) arg5=0;
- else zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 5-argbase, SWIGTYPE_p_void->name);
- }
-
-
- convert_to_long_ex(args[5-argbase]);
- arg6 = (unsigned int) Z_LVAL_PP(args[5-argbase]);
-
- result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
-
-
ZVAL_LONG(return_value,result);
}
@@ -1469,21 +1443,17 @@
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 @@
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;
+ arg4 = *argp;
}
- {
- switch_input_callback_function_t * argp;
- if(SWIG_ConvertPtr(*args[5-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
- zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 6-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
- }
- arg6 = *argp;
- }
- convert_to_string_ex(args[6-argbase]);
- 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);
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Sat Dec 23 11:40:37 2006
@@ -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,14 +13,8 @@
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)
+ self.__dict__[name] = value
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
def _swig_getattr(self,class_type,name):
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
@@ -44,7 +38,7 @@
__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 "<C SessionContainer instance at %s>" % (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 @@
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 @@
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
-
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Sat Dec 23 11:40:37 2006
@@ -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 @@
T *operator&() { return tt; }
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& 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 <Python.h>
-
/***********************************************************************
- * 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(a)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"
+#include <string.h>
-/* 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)
+#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 SWIG_TYPE_TABLE_NAME
+# define SWIGEXPORT(a) a
+# define SWIGIMPORT(a) a
#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
+#ifdef SWIG_GLOBAL
+# define SWIGRUNTIME(a) SWIGEXPORT(a)
+#else
+# define SWIGRUNTIME(a) static a
#endif
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-#include <string.h>
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -143,141 +101,106 @@
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<int>" == "Class<int >", 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);
+/* 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;
+ }
+ tc = tc->prev;
}
- return (l1 - f1) - (l2 - f2);
-}
+ head = ti;
+ next = 0;
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- 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;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
+ /* 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++;
}
- return equiv;
+ if (next) next->prev = head;
+ head->next = next;
+ return ret;
}
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- 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 @@
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;
-}
+#endif
-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);
-}
-
#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(a)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 @@
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(a)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
+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[]);
-/* Flags for pointer conversion */
-#define SWIG_POINTER_EXCEPTION 0x1
-#define SWIG_POINTER_DISOWN 0x2
+#else
-
-/* 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
+ * global variable support code.
* ----------------------------------------------------------------------------- */
-#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
+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;
-#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 {
+typedef struct swig_varlinkobject {
PyObject_HEAD
- void *ptr;
- const char *desc;
-} PySwigObject;
+ swig_globalvar *vars;
+} swig_varlinkobject;
-/* Declarations for objects of type PySwigObject */
+static PyObject *
+swig_varlink_repr(swig_varlinkobject *v) {
+ v = v;
+ return PyString_FromString("<Global variables>");
+}
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int flags)
-{
- char result[SWIG_BUFFER_SIZE];
+static int
+swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
+ swig_globalvar *var;
flags = flags;
- if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) {
- fputs("<Swig Object at ", fp); fputs(result, fp); fputs(">", fp);
- return 0;
- } else {
- return 1;
+ 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 PyObject *
-PySwigObject_repr(PySwigObject *v)
-{
- char result[SWIG_BUFFER_SIZE];
- return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
- PyString_FromFormat("<Swig Object at %s>", 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);
+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)();
}
- 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);
+ var = var->next;
}
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return NULL;
}
-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("<Swig Packed ", fp);
- if (SWIG_PackDataName(result, v->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("<Swig Packed at %s%s>", result, v->desc);
- } else {
- return PyString_FromFormat("<Swig Packed %s>", 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;
+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);
}
- return NULL;
+ var = var->next;
}
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return 1;
}
-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;
-}
+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 */
+};
-SWIGRUNTIMEINLINE const char *
-PySwigPacked_GetDesc(PyObject *self)
-{
- return ((PySwigPacked *)self)->desc;
+/* 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);
}
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
- return ((op)->ob_type == PySwigPacked_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
+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;
}
-#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
- * ----------------------------------------------------------------------------- */
-
-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");
- }
-}
-
-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");
- }
-}
-
-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);
- }
- return 1;
- } else {
- return 0;
- }
-}
-
-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;
- }
-}
-
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
/* 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 @@
}
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 @@
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 @@
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 @@
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;
}
-#endif
+ if (obj) {
+ PyDict_SetItemString(d,constants[i].name,obj);
+ Py_DECREF(obj);
+ }
}
- 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 @@
/* -------- 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,292 +719,37 @@
#include "freeswitch_python.h"
+extern void *globalDTMFCallbackFunction;
+extern switch_status_t PythonDTMFCallback(switch_core_session *,void *,switch_input_type_t,void *,unsigned int);
-#include <limits.h>
+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;
+ return target;
}
-#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<unsigned int >(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<int >(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<char* >(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;
-}
-
-
-
switch_status_t PythonDTMFCallback(switch_core_session_t *session,
void *input,
switch_input_type_t itype,
@@ -1772,9 +778,8 @@
static int _wrap_globalDTMFCallbackFunction_set(PyObject *_val) {
{
void * temp;
- if ((SWIG_ConvertPtr(_val, static_cast<void ** >(&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 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 @@
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<void ** >(&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<void ** >(&arg4),0,SWIG_POINTER_EXCEPTION|0))== -1) {
- SWIG_arg_fail(4);SWIG_fail;
- }
- }
- {
- arg5 = static_cast<unsigned int >(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<switch_status_t & >(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_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_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_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_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<int >(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<int >(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_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_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_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_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<int >(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_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<int >(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_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<int >(SWIG_As_int(obj2));
- if (SWIG_arg_fail(3)) SWIG_fail;
+ char *t = PyString_AsString(obj4);
+ if (PyErr_Occurred()) SWIG_fail;
+ strncpy(temp5,t,8);
+ arg5 = (char *) temp5;
}
- 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<int >(SWIG_As_int(obj5));
- if (SWIG_arg_fail(6)) SWIG_fail;
- }
result = (int)(arg1)->get_digits(arg2,arg3,arg4,arg5,arg6);
+ resultobj = PyInt_FromLong((long)result);
{
- resultobj = SWIG_From_int(static_cast<int >(result));
+ PyObject *o;
+ arg2[128] = 0;
+ o = PyString_FromString(arg2);
+ 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));
+ {
+ PyObject *o;
+ arg5[8] = 0;
+ o = PyString_FromString(arg5);
+ resultobj = t_output_helper(resultobj,o);
+ }
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<int >(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<int >(SWIG_As_int(obj1));
- if (SWIG_arg_fail(2)) SWIG_fail;
+ char *t = PyString_AsString(obj8);
+ if (PyErr_Occurred()) SWIG_fail;
+ strncpy(temp9,t,128);
+ arg9 = (char *) temp9;
}
- {
- arg3 = static_cast<int >(SWIG_As_int(obj2));
- if (SWIG_arg_fail(3)) SWIG_fail;
- }
- {
- arg4 = static_cast<int >(SWIG_As_int(obj3));
- if (SWIG_arg_fail(4)) SWIG_fail;
- }
- {
- arg5 = static_cast<int >(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;
- }
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<int >(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 @@
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_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
};
-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,
-};
-
-
/* -------- 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("<Swig global variables>");
- }
-
- 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);
Modified: freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c Sat Dec 23 11:40:37 2006
@@ -627,7 +627,7 @@
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_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 @@
_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 @@
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;
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sat Dec 23 11:40:37 2006
@@ -850,6 +850,7 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
}
}
- if (argc > 5) {
- timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
- }
-
if (!tts_name && text) {
return JS_FALSE;
}
@@ -1159,15 +1161,15 @@
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;
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Sat Dec 23 11:40:37 2006
@@ -39,14 +39,14 @@
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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
if (say_cb) {
- say_cb(session, tosay, type, method, input_callback, buf, buflen);
+ say_cb(session, tosay, type, method, args);
}
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Sat Dec 23 11:40:37 2006
@@ -178,9 +178,7 @@
}
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 @@
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 @@
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_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 @@
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 @@
#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 @@
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_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 @@
//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 @@
} 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 @@
} 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_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_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(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_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_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 @@
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 @@
char *tts_voice;
char *buf;
char *ptr;
- char *timer_name;
int max_failures;
int timeout;
uint32_t inlen;
@@ -3805,7 +3802,6 @@
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 @@
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 @@
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 @@
}
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 @@
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_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_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_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_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_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 @@
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 @@
// 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 @@
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_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 @@
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);
}
}
}
Modified: freeswitch/trunk/src/switch_swig.c
==============================================================================
--- freeswitch/trunk/src/switch_swig.c (original)
+++ freeswitch/trunk/src/switch_swig.c Sat Dec 23 11:40:37 2006
@@ -158,18 +158,14 @@
*/
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 @@
{
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_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;
}
1
0
Author: knhor
Date: Sat Dec 23 00:27:43 2006
New Revision: 3814
Modified:
freeswitch/branches/knhor/trunk/ (props changed)
freeswitch/branches/knhor/trunk/conf/freeswitch.xml
freeswitch/branches/knhor/trunk/libs/libsndfile/configure (props changed)
freeswitch/branches/knhor/trunk/libs/libsndfile/install-sh (props changed)
freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h
freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c
freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj
freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj
freeswitch/branches/knhor/trunk/modules.conf.in
freeswitch/branches/knhor/trunk/src/include/switch_apr.h
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
freeswitch/branches/knhor/trunk/src/switch_ivr.c
freeswitch/branches/knhor/trunk/src/switch_rtp.c
Log:
Merged revisions 3793-3813 via svnmerge from trunk. copy mod_conference.c from trunk since it was really out of wack.
Modified: freeswitch/branches/knhor/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/knhor/trunk/conf/freeswitch.xml (original)
+++ freeswitch/branches/knhor/trunk/conf/freeswitch.xml Sat Dec 23 00:27:43 2006
@@ -485,6 +485,19 @@
<!-- *NOTE* The special context name 'any' will match any context -->
<context name="default">
+ <extension name="556"> <!-- demo phrases -->
+ <condition field="destination_number" expression="^556$">
+ <action application="answer"/>
+ <action application="sleep" data="1000"/>
+ <action application="phrase" data="spell,${caller_id_name}"/>
+ <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
+ <action application="phrase" data="timespec,12:45:15"/>
+ <action application="phrase" data="saydate,0"/>
+ <action application="phrase" data="msgcount,130"/>
+ <!--<action application="phrase" data="timeleft,3:30"/>-->
+ </condition>
+ </extension>
+
<extension name="tollfree">
<condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
<action application="enum" data="$1"/>
@@ -647,9 +660,29 @@
<!--<action function="speak-text" data="you have $1 messages"/>-->
</input>
</macro>
- <macro name="timeleft">
+ <macro name="saydate">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+ </input>
+ </macro>
+ <macro name="timespec">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+ </input>
+ </macro>
+ <macro name="spell">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </input>
+ </macro>
+ <macro name="spell-phonetic">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+ </input>
+ </macro>
+ <macro name="tts-timeleft">
<input pattern="(\d+):(\d+)">
- <action function="speak-text" data="You have $1 minutes, $2 seconds remaining"/>
+ <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
</input>
</macro>
</language>
Modified: freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h (original)
+++ freeswitch/branches/knhor/trunk/libs/srtp/include/srtp.h Sat Dec 23 00:27:43 2006
@@ -51,7 +51,6 @@
#endif
#ifdef _MSC_VER
-#pragma pack(4)
#pragma warning(disable:4214)
#endif
@@ -895,6 +894,10 @@
* is not identical)
*/
+#ifdef _MSC_VER
+#pragma pack(push, r1, 1)
+#endif
+
#ifndef WORDS_BIGENDIAN
typedef struct {
@@ -904,9 +907,9 @@
unsigned version:2; /* protocol version */
unsigned pt:7; /* payload type */
unsigned m:1; /* marker bit */
- uint16_t seq; /* sequence number */
- uint32_t ts; /* timestamp */
- uint32_t ssrc; /* synchronization source */
+ unsigned seq:16; /* sequence number */
+ unsigned ts:32; /* timestamp */
+ unsigned ssrc:32; /* synchronization source */
} srtp_hdr_t;
#else /* BIG_ENDIAN */
@@ -918,9 +921,9 @@
unsigned cc:4; /* CSRC count */
unsigned m:1; /* marker bit */
unsigned pt:7; /* payload type */
- uint16_t seq; /* sequence number */
- uint32_t ts; /* timestamp */
- uint32_t ssrc; /* synchronization source */
+ unsigned seq:16; /* sequence number */
+ unsigned ts:32; /* timestamp */
+ unsigned ssrc:32; /* synchronization source */
} srtp_hdr_t;
#endif
@@ -945,8 +948,8 @@
unsigned p:1; /* padding flag */
unsigned version:2; /* protocol version */
unsigned pt:8; /* payload type */
- uint16_t len; /* length */
- uint32_t ssrc; /* synchronization source */
+ unsigned len:16; /* length */
+ unsigned ssrc:32; /* synchronization source */
} srtcp_hdr_t;
typedef struct {
@@ -964,8 +967,8 @@
unsigned p:1; /* padding flag */
unsigned rc:5; /* reception report count */
unsigned pt:8; /* payload type */
- uint16_t len; /* length */
- uint32_t ssrc; /* synchronization source */
+ unsigned len:16; /* length */
+ unsigned ssrc:32; /* synchronization source */
} srtcp_hdr_t;
typedef struct {
@@ -973,7 +976,7 @@
unsigned int p:1; /* padding flag */
unsigned int count:5; /* varies by packet type */
unsigned int pt:8; /* payload type */
- uint16_t length; /* len of uint32s of packet less header */
+ unsigned length:16; /* len of uint32s of packet less header */
} rtcp_common_t;
typedef struct {
@@ -992,7 +995,7 @@
#define SRTCP_INDEX_MASK 0x7fffffff
#ifdef _MSC_VER
-#pragma pack()
+#pragma pack(pop, r1)
#endif
#ifdef __cplusplus
Modified: freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c (original)
+++ freeswitch/branches/knhor/trunk/libs/srtp/srtp/srtp.c Sat Dec 23 00:27:43 2006
@@ -684,7 +684,7 @@
* estimate the packet index using the start of the replay window
* and the sequence number from the header
*/
- delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+ delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq));
status = rdbx_check(&stream->rtp_rdbx, delta);
if (status)
return status; /* we've been asked to reuse an index */
@@ -842,7 +842,7 @@
est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq));
delta = low32(est);
#else
- est = (xtd_seq_num_t) ntohs(hdr->seq);
+ est = (xtd_seq_num_t) ntohs((uint16_t)hdr->seq);
delta = (int)est;
#endif
} else {
@@ -856,7 +856,7 @@
} else {
/* estimate packet index from seq. num. in header */
- delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq));
+ delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq));
/* check replay database */
status = rdbx_check(&stream->rtp_rdbx, delta);
Modified: freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj (original)
+++ freeswitch/branches/knhor/trunk/libs/win32/apr-iconv/libapriconv.vcproj Sat Dec 23 00:27:43 2006
@@ -48,7 +48,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+ AdditionalIncludeDirectories=""..\..\apr-iconv-1.1.1\include";..\..\apr\include"
PreprocessorDefinitions="_DEBUG;API_DECLARE_EXPORT;WIN32;_WINDOWS"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/libapriconv.pch"
@@ -147,7 +147,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+ AdditionalIncludeDirectories=""..\..\apr-iconv-1.1.1\include";..\..\apr\include"
PreprocessorDefinitions="NDEBUG;API_DECLARE_EXPORT;WIN32;_WINDOWS"
StringPooling="true"
RuntimeLibrary="2"
Modified: freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj (original)
+++ freeswitch/branches/knhor/trunk/libs/win32/apr-util/libaprutil.vcproj Sat Dec 23 00:27:43 2006
@@ -49,7 +49,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/EHsc "
Optimization="0"
- AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+ AdditionalIncludeDirectories=""..\..\apr-util\include";"..\..\apr-util\include/private";"..\..\apr-util\dbm/sdbm";"..\..\apr-iconv-1.1.1\include";..\..\apr\include"
PreprocessorDefinitions="_DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\Debug/libaprutil.pch"
@@ -149,7 +149,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..\apr-util\include,..\..\apr-util\include/private,..\..\apr-util\dbm/sdbm,..\..\apr-iconv-1.1.1\include,..\..\apr-1.2.7\include"
+ AdditionalIncludeDirectories=""..\..\apr-util\include";"..\..\apr-util\include/private";"..\..\apr-util\dbm/sdbm";"..\..\apr-iconv-1.1.1\include";..\..\apr\include"
PreprocessorDefinitions="NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS"
StringPooling="true"
RuntimeLibrary="2"
Modified: freeswitch/branches/knhor/trunk/modules.conf.in
==============================================================================
--- freeswitch/branches/knhor/trunk/modules.conf.in (original)
+++ freeswitch/branches/knhor/trunk/modules.conf.in Sat Dec 23 00:27:43 2006
@@ -44,5 +44,6 @@
#languages/mod_spidermonkey_teletone
#languages/mod_spidermonkey_core_db
#languages/mod_spidermonkey_odbc
+#languages/mod_spidermonkey_etpan
timers/mod_softtimer
#xml_int/mod_xml_rpc
Modified: freeswitch/branches/knhor/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/knhor/trunk/src/include/switch_apr.h (original)
+++ freeswitch/branches/knhor/trunk/src/include/switch_apr.h Sat Dec 23 00:27:43 2006
@@ -262,6 +262,9 @@
#define switch_thread_data_set apr_thread_data_set
#define switch_thread_data_get apr_thread_data_get
#define switch_thread_self apr_os_thread_current
+#define switch_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
+ + (apr_time_t)(usec))
+
/**
* Put the active calling thread to sleep until signaled to wake up. Each
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sat Dec 23 00:27:43 2006
@@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
- * Software distributed under the License is distributed on an "AS IS" basis,
+ * Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@@ -48,14 +48,14 @@
#define CONF_CHAT_PROTO "conf"
#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
+#define MIN(a, b) ((a)<(b)?(a):(b))
#endif
/* this doesn't work correctly yet, don't bother trying! */
//#define OPTION_IVR_MENU_SUPPORT */
typedef enum {
- FILE_STOP_CURRENT,
+ FILE_STOP_CURRENT,
FILE_STOP_ALL
} file_stop_t;
@@ -72,20 +72,20 @@
} globals;
typedef enum {
- CALLER_CONTROL_MUTE,
- CALLER_CONTROL_DEAF_MUTE,
- CALLER_CONTROL_ENERGY_UP,
- CALLER_CONTROL_ENERGY_EQU_CONF,
- CALLER_CONTROL_ENERGEY_DN,
- CALLER_CONTROL_VOL_TALK_UP,
- CALLER_CONTROL_VOL_TALK_ZERO,
- CALLER_CONTROL_VOL_TALK_DN,
- CALLER_CONTROL_VOL_LISTEN_UP,
- CALLER_CONTROL_VOL_LISTEN_ZERO,
- CALLER_CONTROL_VOL_LISTEN_DN,
- CALLER_CONTROL_HANGUP,
- CALLER_CONTROL_MENU,
- CALLER_CONTROL_DIAL,
+ CALLER_CONTROL_MUTE,
+ CALLER_CONTROL_DEAF_MUTE,
+ CALLER_CONTROL_ENERGY_UP,
+ CALLER_CONTROL_ENERGY_EQU_CONF,
+ CALLER_CONTROL_ENERGEY_DN,
+ CALLER_CONTROL_VOL_TALK_UP,
+ CALLER_CONTROL_VOL_TALK_ZERO,
+ CALLER_CONTROL_VOL_TALK_DN,
+ CALLER_CONTROL_VOL_LISTEN_UP,
+ CALLER_CONTROL_VOL_LISTEN_ZERO,
+ CALLER_CONTROL_VOL_LISTEN_DN,
+ CALLER_CONTROL_HANGUP,
+ CALLER_CONTROL_MENU,
+ CALLER_CONTROL_DIAL,
} caller_control_t;
/* forward declaration for conference_obj and caller_control */
@@ -110,30 +110,30 @@
} caller_control_menu_info_t;
typedef enum {
- MFLAG_RUNNING = (1 << 0),
- MFLAG_CAN_SPEAK = (1 << 1),
- MFLAG_CAN_HEAR = (1 << 2),
- MFLAG_KICKED = (1 << 3),
- MFLAG_ITHREAD = (1 << 4),
+ MFLAG_RUNNING = (1 << 0),
+ MFLAG_CAN_SPEAK = (1 << 1),
+ MFLAG_CAN_HEAR = (1 << 2),
+ MFLAG_KICKED = (1 << 3),
+ MFLAG_ITHREAD = (1 << 4),
MFLAG_NOCHANNEL = (1 << 5)
} member_flag_t;
typedef enum {
- CFLAG_RUNNING = (1 << 0),
- CFLAG_DYNAMIC = (1 << 1),
- CFLAG_ENFORCE_MIN = (1 << 2),
- CFLAG_DESTRUCT = (1 << 3),
- CFLAG_LOCKED = (1 << 4),
+ CFLAG_RUNNING = (1 << 0),
+ CFLAG_DYNAMIC = (1 << 1),
+ CFLAG_ENFORCE_MIN = (1 << 2),
+ CFLAG_DESTRUCT = (1 << 3),
+ CFLAG_LOCKED = (1 << 4),
CFLAG_ANSWERED = (1 << 5)
} conf_flag_t;
typedef enum {
- RFLAG_CAN_SPEAK = (1 << 0),
+ RFLAG_CAN_SPEAK = (1 << 0),
RFLAG_CAN_HEAR = (1 << 1)
} relation_flag_t;
typedef enum {
- NODE_TYPE_FILE,
+ NODE_TYPE_FILE,
NODE_TYPE_SPEECH
} node_type_t;
@@ -243,14 +243,21 @@
switch_memory_pool_t *pool;
} conference_record_t;
+typedef enum {
+ CONF_API_SUB_ARGS_SPLIT,
+ CONF_API_SUB_MEMBER_TARGET,
+ CONF_API_SUB_ARGS_AS_ONE
+} conference_fntype_t;
+
/* API command parser */
typedef struct api_command {
char *pname;
void *pfnapicmd;
- int fntype;
+ conference_fntype_t fntype;
char *psyntax;
} api_command_t;
+
/* Function Prototypes */
static uint32_t next_member_id(void);
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
@@ -263,16 +270,16 @@
static void conference_loop_output(conference_member_t *member);
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel);
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin);
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin);
static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
-static switch_status_t conference_outcall(conference_obj_t *conference,
- switch_core_session_t *session,
- char *bridgeto,
- uint32_t timeout,
- char *flags,
- char *cid_name,
+static switch_status_t conference_outcall(conference_obj_t *conference,
+ switch_core_session_t *session,
+ char *bridgeto,
+ uint32_t timeout,
+ char *flags,
+ char *cid_name,
char *cid_num);
static void conference_function(switch_core_session_t *session, char *data);
static void launch_conference_thread(conference_obj_t *conference);
@@ -285,26 +292,26 @@
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
static void launch_conference_record_thread(conference_obj_t *conference, char *path);
-typedef int (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
-typedef int (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
-typedef int (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, char*);
+typedef switch_status_t (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
+typedef switch_status_t (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
+typedef switch_status_t (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, const char*);
-static void conference_member_itterator(conference_obj_t *conference,
- switch_stream_handle_t *stream,
- conf_api_member_cmd_t pfncallback,
+static void conference_member_itterator(conference_obj_t *conference,
+ switch_stream_handle_t *stream,
+ conf_api_member_cmd_t pfncallback,
void *data);
-static int conf_api_sub_mute(conference_member_t *member,
- switch_stream_handle_t *stream,
- void *data);
-static int conf_api_sub_unmute(conference_member_t *member,
- switch_stream_handle_t *stream,
- void *data);
-static int conf_api_sub_deaf(conference_member_t *member,
- switch_stream_handle_t *stream,
- void *data);
-static int conf_api_sub_undeaf(conference_member_t *member,
- switch_stream_handle_t *stream,
- void *data);
+static switch_status_t conf_api_sub_mute(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_unmute(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_deaf(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
/* Return a Distinct ID # */
static uint32_t next_member_id(void)
@@ -323,7 +330,7 @@
{
conference_relationship_t *rel = NULL;
- if(member != NULL && other_member != NULL) {
+ if (member != NULL && other_member != NULL) {
conference_relationship_t *global = NULL;
switch_mutex_lock(member->flag_mutex);
@@ -360,37 +367,39 @@
{
conference_member_t *member = NULL;
- if (conference != NULL && id != 0) {
- for(member = conference->members; member; member = member->next) {
+ assert(conference != NULL);
+ assert(id != 0);
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- continue;
- }
+ for(member = conference->members; member; member = member->next) {
+
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ continue;
+ }
+
+ if (member->id == id) {
+ break;
+ }
+ }
+
- if (member->id == id) {
- break;
- }
- }
- }
-
return member;
}
/* stop the specified recording */
-static int conference_record_stop(conference_obj_t *conference, char *path)
+static switch_status_t conference_record_stop(conference_obj_t *conference, char *path)
{
conference_member_t *member = NULL;
int count = 0;
- if (conference != NULL) {
- for(member = conference->members; member; member = member->next) {
- if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
- switch_clear_flag_locked(member, MFLAG_RUNNING);
- count++;
- }
- }
- }
+ assert (conference != NULL);
+ for(member = conference->members; member; member = member->next) {
+ if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
+ switch_clear_flag_locked(member, MFLAG_RUNNING);
+ count++;
+ }
+ }
+
return count;
}
@@ -442,64 +451,64 @@
static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member)
{
switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_event_t *event;
- if(conference != NULL && member != NULL) {
- switch_event_t *event;
+ assert(conference != NULL);
+ assert(member != NULL);
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- switch_mutex_lock(member->audio_in_mutex);
- switch_mutex_lock(member->audio_out_mutex);
- switch_mutex_lock(member->flag_mutex);
- member->conference = member->last_conference = conference;
- member->next = conference->members;
- member->energy_level = conference->energy_level;
- conference->members = member;
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ switch_mutex_lock(member->audio_in_mutex);
+ switch_mutex_lock(member->audio_out_mutex);
+ switch_mutex_lock(member->flag_mutex);
+ member->conference = member->last_conference = conference;
+ member->next = conference->members;
+ member->energy_level = conference->energy_level;
+ conference->members = member;
- if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
- conference->count++;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
+ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ conference->count++;
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
- if (conference->enter_sound) {
- conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
- }
+ if (conference->enter_sound) {
+ conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
+ }
- if (conference->count == 1 && conference->alone_sound) {
- conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
- }
+ if (conference->count == 1 && conference->alone_sound) {
+ conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+ }
- if (conference->min && conference->count >= conference->min) {
- switch_set_flag(conference, CFLAG_ENFORCE_MIN);
- }
+ if (conference->min && conference->count >= conference->min) {
+ switch_set_flag(conference, CFLAG_ENFORCE_MIN);
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
- switch_event_fire(&event);
- }
- }
- switch_mutex_unlock(member->flag_mutex);
- switch_mutex_unlock(member->audio_out_mutex);
- switch_mutex_unlock(member->audio_in_mutex);
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
+ switch_event_fire(&event);
+ }
+ }
+ switch_mutex_unlock(member->flag_mutex);
+ switch_mutex_unlock(member->audio_out_mutex);
+ switch_mutex_unlock(member->audio_in_mutex);
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ status = SWITCH_STATUS_SUCCESS;
+
- status = SWITCH_STATUS_SUCCESS;
- }
-
return status;
}
@@ -507,95 +516,99 @@
static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member)
{
switch_status_t status = SWITCH_STATUS_FALSE;
+ conference_member_t *imember, *last = NULL;
+ switch_event_t *event;
- if(conference != NULL && member != NULL ) {
- conference_member_t *imember, *last = NULL;
- switch_event_t *event;
+ assert(conference != NULL);
+ assert(member != NULL);
+
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- switch_mutex_lock(member->audio_in_mutex);
- switch_mutex_lock(member->audio_out_mutex);
- switch_mutex_lock(member->flag_mutex);
- for (imember = conference->members; imember; imember = imember->next) {
- if (imember == member ) {
- if (last) {
- last->next = imember->next;
- } else {
- conference->members = imember->next;
- }
- break;
- }
- last = imember;
- }
- /* Close Unused Handles */
- if (member->fnode) {
- conference_file_node_t *fnode, *cur;
- switch_memory_pool_t *pool;
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ switch_mutex_lock(member->audio_in_mutex);
+ switch_mutex_lock(member->audio_out_mutex);
+ switch_mutex_lock(member->flag_mutex);
- fnode = member->fnode;
- while(fnode) {
- cur = fnode;
- fnode = fnode->next;
+ for (imember = conference->members; imember; imember = imember->next) {
+ if (imember == member ) {
+ if (last) {
+ last->next = imember->next;
+ } else {
+ conference->members = imember->next;
+ }
+ break;
+ }
+ last = imember;
+ }
- if (cur->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&cur->sh, &flags);
- } else {
- switch_core_file_close(&cur->fh);
- }
+ /* Close Unused Handles */
+ if (member->fnode) {
+ conference_file_node_t *fnode, *cur;
+ switch_memory_pool_t *pool;
- pool = cur->pool;
- switch_core_destroy_memory_pool(&pool);
- }
- }
+ fnode = member->fnode;
+ while(fnode) {
+ cur = fnode;
+ fnode = fnode->next;
- member->conference = NULL;
+ if (cur->type == NODE_TYPE_SPEECH) {
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_core_speech_close(&cur->sh, &flags);
+ } else {
+ switch_core_file_close(&cur->fh);
+ }
- if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
- conference->count--;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
+ pool = cur->pool;
+ switch_core_destroy_memory_pool(&pool);
+ }
+ }
- if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
- || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
- switch_set_flag(conference, CFLAG_DESTRUCT);
- } else {
- if (conference->exit_sound) {
- conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
- }
- if (conference->count == 1 && conference->alone_sound) {
- conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
- }
- }
+ member->conference = NULL;
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ conference->count--;
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
- switch_event_fire(&event);
- }
- }
- switch_mutex_unlock(member->flag_mutex);
- switch_mutex_unlock(member->audio_out_mutex);
- switch_mutex_unlock(member->audio_in_mutex);
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
+ || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
+ switch_set_flag(conference, CFLAG_DESTRUCT);
+ } else {
+ if (conference->exit_sound) {
+ conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
+ }
+ if (conference->count == 1 && conference->alone_sound) {
+ conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+ }
+ }
- status = SWITCH_STATUS_SUCCESS;
- }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
+ switch_event_fire(&event);
+ }
+ }
+
+ switch_mutex_unlock(member->flag_mutex);
+ switch_mutex_unlock(member->audio_out_mutex);
+ switch_mutex_unlock(member->audio_in_mutex);
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ status = SWITCH_STATUS_SUCCESS;
+
+
return status;
}
@@ -655,9 +668,9 @@
int len = (int) imember->read;
imember->mux_resampler->from_len = switch_short_to_float(bptr, imember->mux_resampler->from, (int) len / 2);
- imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
- imember->mux_resampler->from_len, imember->mux_resampler->to,
- imember->mux_resampler->to_size, 0);
+ imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
+ imember->mux_resampler->from_len, imember->mux_resampler->to,
+ imember->mux_resampler->to_size, 0);
switch_float_to_short(imember->mux_resampler->to, out, len);
len = imember->mux_resampler->to_len * 2;
switch_buffer_write(imember->resample_buffer, out, len);
@@ -683,10 +696,10 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = conference->rate;
- if (switch_core_speech_read_tts(&conference->fnode->sh,
- file_frame,
- &file_data_len,
- &rate,
+ if (switch_core_speech_read_tts(&conference->fnode->sh,
+ file_frame,
+ &file_data_len,
+ &rate,
&flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
@@ -1166,13 +1179,13 @@
if (member != NULL && data != NULL) {
caller_control_menu_ctx_t *menu_ctx = (caller_control_menu_ctx_t *)data;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference_loop_fn_menu handler '%s'\n",menu_ctx->name);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference_loop_fn_menu handler '%s'\n", menu_ctx->name);
if (menu_ctx->menu_stack != NULL && menu_ctx->xml_ctx != NULL) {
- switch_ivr_menu_execute(member->session,menu_ctx->menu_stack,menu_ctx->name,member);
+ switch_ivr_menu_execute(member->session, menu_ctx->menu_stack, menu_ctx->name, member);
} else {
- if(menu_ctx->menu_stack == NULL)
+ if (menu_ctx->menu_stack == NULL)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL menu_stack\n");
- if(menu_ctx->xml_ctx == NULL)
+ if (menu_ctx->xml_ctx == NULL)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL xml_ctx\n");
}
}
@@ -1187,10 +1200,10 @@
int argc = 0;
if (lbuf != NULL) {
- memset(argv,0,sizeof(argv));
+ memset(argv, 0, sizeof(argv));
argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dial argc %u 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
- argc,argv[0],argv[1],argv[2],argv[3]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dial argc %u 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
+ argc, argv[0], argv[1], argv[2], argv[3]);
if (argc >= 4) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "executing conference outcall\n");
conference_outcall(member->conference, NULL, argv[0], atoi(argv[1]), NULL, argv[3], argv[2]);
@@ -1203,6 +1216,7 @@
}
}
+
/* marshall frames from the call leg to the conference thread for muxing to other call legs */
static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
{
@@ -1211,11 +1225,11 @@
switch_status_t status;
switch_frame_t *read_frame = NULL;
switch_codec_t *read_codec;
- uint32_t hangover = 40,
- hangunder = 15,
- hangover_hits = 0,
- hangunder_hits = 0,
- energy_level = 0,
+ uint32_t hangover = 40,
+ hangunder = 15,
+ hangover_hits = 0,
+ hangunder_hits = 0,
+ energy_level = 0,
diff_level = 400;
uint8_t talking = 0;
@@ -1311,8 +1325,8 @@
int len = (int) read_frame->datalen;;
member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
- member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
- member->read_resampler->from_len, member->read_resampler->to,
+ member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
+ member->read_resampler->from_len, member->read_resampler->to,
member->read_resampler->to_size, 0);
switch_float_to_short(member->read_resampler->to, read_frame->data, len);
len = member->read_resampler->to_len * 2;
@@ -1352,22 +1366,22 @@
}
static caller_control_fn_table_t ccfntbl[] = {
- {"mute", "0", CALLER_CONTROL_MUTE, conference_loop_fn_mute_toggle},
- {"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle},
- {"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up},
- {"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf},
- {"energy dn", "7", CALLER_CONTROL_ENERGEY_DN, conference_loop_fn_energy_dn},
- {"vol talk up", "3", CALLER_CONTROL_VOL_TALK_UP, conference_loop_fn_volume_talk_up},
- {"vol talk zero", "2", CALLER_CONTROL_VOL_TALK_ZERO, conference_loop_fn_volume_talk_zero},
- {"vol talk dn", "1", CALLER_CONTROL_VOL_TALK_DN, conference_loop_fn_volume_talk_dn},
- {"vol listen up", "6", CALLER_CONTROL_VOL_LISTEN_UP, conference_loop_fn_volume_listen_up},
- {"vol listen zero", "5", CALLER_CONTROL_VOL_LISTEN_ZERO, conference_loop_fn_volume_listen_zero},
- {"vol listen dn", "4", CALLER_CONTROL_VOL_LISTEN_DN, conference_loop_fn_volume_listen_dn},
- {"hangup", "#", CALLER_CONTROL_HANGUP, conference_loop_fn_hangup},
+ {"mute", "0", CALLER_CONTROL_MUTE, conference_loop_fn_mute_toggle},
+ {"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle},
+ {"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up},
+ {"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf},
+ {"energy dn", "7", CALLER_CONTROL_ENERGEY_DN, conference_loop_fn_energy_dn},
+ {"vol talk up", "3", CALLER_CONTROL_VOL_TALK_UP, conference_loop_fn_volume_talk_up},
+ {"vol talk zero", "2", CALLER_CONTROL_VOL_TALK_ZERO, conference_loop_fn_volume_talk_zero},
+ {"vol talk dn", "1", CALLER_CONTROL_VOL_TALK_DN, conference_loop_fn_volume_talk_dn},
+ {"vol listen up", "6", CALLER_CONTROL_VOL_LISTEN_UP, conference_loop_fn_volume_listen_up},
+ {"vol listen zero", "5", CALLER_CONTROL_VOL_LISTEN_ZERO, conference_loop_fn_volume_listen_zero},
+ {"vol listen dn", "4", CALLER_CONTROL_VOL_LISTEN_DN, conference_loop_fn_volume_listen_dn},
+ {"hangup", "#", CALLER_CONTROL_HANGUP, conference_loop_fn_hangup},
#ifdef OPTION_IVR_MENU_SUPPORT
- {"menu", NULL, CALLER_CONTROL_MENU, conference_loop_fn_menu},
+ {"menu", NULL, CALLER_CONTROL_MENU, conference_loop_fn_menu},
#endif
- {"dial", NULL, CALLER_CONTROL_DIAL, conference_loop_fn_dial},
+ {"dial", NULL, CALLER_CONTROL_DIAL, conference_loop_fn_dial},
};
#define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
@@ -1388,10 +1402,10 @@
assert(channel != NULL);
assert(member->conference != NULL);
- if (switch_core_timer_init(&timer,
- member->conference->timer_name,
- member->conference->interval,
- samples,
+ if (switch_core_timer_init(&timer,
+ member->conference->timer_name,
+ member->conference->interval,
+ samples,
NULL) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer %s success interval: %u samples: %u\n",
member->conference->timer_name, member->conference->interval, samples);
@@ -1412,11 +1426,11 @@
launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
/* build a digit stream object */
- if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser,&member->digit_stream) != SWITCH_STATUS_SUCCESS) {
+ if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n");
}
- /* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
+ /* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
/* you better not block this thread loop for more than the duration of member->conference->timer_name! */
while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) {
char dtmf[128] = "";
@@ -1464,34 +1478,39 @@
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
- if(member->conference->dtmf_parser != NULL) {
+ if (member->conference->dtmf_parser != NULL) {
for (digit = dtmf; *digit && caller_action == NULL; digit++) {
caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
}
}
- /* otherwise, clock the parser so that it can handle digit timeout detection */
- } else if(member->conference->dtmf_parser != NULL) {
+ /* otherwise, clock the parser so that it can handle digit timeout detection */
+ } else if (member->conference->dtmf_parser != NULL) {
caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0');
}
/* if a caller action has been detected, handle it */
if (caller_action != NULL && caller_action->fndesc != NULL && caller_action->fndesc->handler != NULL) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+ char *param = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG,
- SWITCH_LOG_INFO,
- "executing caller control '%s' param '%s' on call '%u,%s,%s,%s'\n",
- caller_action->fndesc->key,
- (caller_action->fndesc->action != CALLER_CONTROL_MENU ? caller_action->data : ""),
- member->id,
- switch_channel_get_name(channel),
- profile->caller_id_name,
- profile->caller_id_number
- );
- caller_action->fndesc->handler(member,caller_action->data);
+ if (caller_action->fndesc->action != CALLER_CONTROL_MENU) {
+ param = caller_action->data;
+ }
+ switch_log_printf(SWITCH_CHANNEL_LOG,
+ SWITCH_LOG_INFO,
+ "executing caller control '%s' param '%s' on call '%u, %s, %s, %s'\n",
+ caller_action->fndesc->key,
+ param ? param : "none",
+ member->id,
+ switch_channel_get_name(channel),
+ profile->caller_id_name,
+ profile->caller_id_number
+ );
+ caller_action->fndesc->handler(member, caller_action->data);
+
/* set up for next pass */
caller_action = NULL;
}
@@ -1528,10 +1547,10 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = member->conference->rate;
- if (switch_core_speech_read_tts(&member->fnode->sh,
- file_frame,
- &file_data_len,
- &rate,
+ if (switch_core_speech_read_tts(&member->fnode->sh,
+ file_frame,
+ &file_data_len,
+ &rate,
&flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
@@ -1598,8 +1617,8 @@
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
- switch_channel_cause2str(switch_channel_get_cause(channel)));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
+ switch_channel_cause2str(switch_channel_get_cause(channel)));
/* if it's an outbound channel, store the release cause in the conference struct, we might need it */
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -1672,9 +1691,9 @@
goto end;
}
- if (switch_core_file_open(&fh,
- rec->path,
- SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
+ if (switch_core_file_open(&fh,
+ rec->path,
+ SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
goto end;
@@ -1709,7 +1728,7 @@
switch_core_file_close(&fh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
-end:
+ end:
if (rec->pool) {
switch_memory_pool_t *pool = rec->pool;
@@ -1729,27 +1748,26 @@
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
{
uint32_t count = 0;
+ conference_file_node_t *nptr;
- if (conference != NULL) {
- conference_file_node_t *nptr;
+ assert(conference != NULL);
- switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->mutex);
- if (stop == FILE_STOP_ALL) {
- for (nptr = conference->fnode; nptr; nptr = nptr->next) {
- nptr->done++;
- count++;
- }
- } else {
- if (conference->fnode) {
- conference->fnode->done++;
- count++;
- }
- }
+ if (stop == FILE_STOP_ALL) {
+ for (nptr = conference->fnode; nptr; nptr = nptr->next) {
+ nptr->done++;
+ count++;
+ }
+ } else {
+ if (conference->fnode) {
+ conference->fnode->done++;
+ count++;
+ }
+ }
+
+ switch_mutex_unlock(conference->mutex);
- switch_mutex_unlock(conference->mutex);
- }
-
return count;
}
@@ -1784,1638 +1802,1694 @@
/* Play a file in the conference room */
static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ uint32_t count;
+ char *expanded = NULL;
- if (conference != NULL && channel != NULL) {
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- uint32_t count;
- char *expanded = NULL;
- uint8_t frexp = 0;
+ assert(conference != NULL);
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- count = conference->count;
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ count = conference->count;
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
- if (!count) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
+ if (!count) {
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
- if (channel) {
- if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
- file = expanded;
- frexp = 1;
- }
- }
+ if (channel) {
+ if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
+ file = expanded;
+ } else {
+ expanded = NULL;
+ }
+ }
-
+ if
#ifdef WIN32
- if (*(file +1) != ':' && *file != '/') {
+ (*(file +1) != ':' && *file != '/')
#else
- if (*file != '/') {
+ (*file != '/')
#endif
- status = conference_say(conference, file, leadin);
- goto done;
- }
+ {
+ status = conference_say(conference, file, leadin);
+ goto done;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
- fnode->type = NODE_TYPE_FILE;
- fnode->leadin = leadin;
+ fnode->type = NODE_TYPE_FILE;
+ fnode->leadin = leadin;
- /* Open the file */
- if (switch_core_file_open(&fnode->fh,
- file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- pool) != SWITCH_STATUS_SUCCESS) {
- switch_core_destroy_memory_pool(&pool);
- status = SWITCH_STATUS_NOTFOUND;
- goto done;
- }
+ /* Open the file */
+ if (switch_core_file_open(&fnode->fh,
+ file,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
+ pool) != SWITCH_STATUS_SUCCESS) {
+ switch_core_destroy_memory_pool(&pool);
+ status = SWITCH_STATUS_NOTFOUND;
+ goto done;
+ }
- fnode->pool = pool;
+ fnode->pool = pool;
- /* Queue the node */
- switch_mutex_lock(conference->mutex);
- for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+ /* Queue the node */
+ switch_mutex_lock(conference->mutex);
+ for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
- if (nptr) {
- nptr->next = fnode;
- } else {
- conference->fnode = fnode;
- }
- switch_mutex_unlock(conference->mutex);
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ conference->fnode = fnode;
+ }
+ switch_mutex_unlock(conference->mutex);
- done:
+ done:
- if (frexp) {
- switch_safe_free(expanded);
- }
- }
- return status;
+ switch_safe_free(expanded);
+
+
+
+ return status;
}
/* Play a file in the conference room to a member */
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
- if (member != NULL && file != NULL) {
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
+ if (member != NULL && file != NULL) {
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
- if (*file != '/') {
- return conference_member_say(member, file, leadin);
- }
+ if (*file != '/') {
+ return conference_member_say(member, file, leadin);
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- fnode->type = NODE_TYPE_FILE;
- fnode->leadin = leadin;
+ fnode->type = NODE_TYPE_FILE;
+ fnode->leadin = leadin;
- /* Open the file */
- if (switch_core_file_open(&fnode->fh,
- file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- pool) != SWITCH_STATUS_SUCCESS) {
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_NOTFOUND;
- }
+ /* Open the file */
+ if (switch_core_file_open(&fnode->fh,
+ file,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
+ pool) != SWITCH_STATUS_SUCCESS) {
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_NOTFOUND;
+ }
- fnode->pool = pool;
+ fnode->pool = pool;
- /* Queue the node */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n",file);
- switch_mutex_lock(member->flag_mutex);
- for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+ /* Queue the node */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n", file);
+ switch_mutex_lock(member->flag_mutex);
+ for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
- if (nptr) {
- nptr->next = fnode;
- } else {
- member->fnode = fnode;
- }
- switch_mutex_unlock(member->flag_mutex);
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ member->fnode = fnode;
+ }
+ switch_mutex_unlock(member->flag_mutex);
- status = SWITCH_STATUS_SUCCESS;
- }
+ status = SWITCH_STATUS_SUCCESS;
+ }
- return status;
+ return status;
}
/* Say some thing with TTS in the conference room */
static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
- if (member != NULL && !switch_strlen_zero(text)) {
- conference_obj_t *conference = (member != NULL ? member->conference : NULL);
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ if (member != NULL && !switch_strlen_zero(text)) {
+ conference_obj_t *conference = (member != NULL ? member->conference : NULL);
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- if (conference == NULL) {
- return SWITCH_STATUS_FALSE;
- }
+ assert(conference != NULL);
+
+ if (!(conference->tts_engine && conference->tts_voice)) {
+ return SWITCH_STATUS_SUCCESS;
+ }
- if (!(conference->tts_engine && conference->tts_voice)) {
- return SWITCH_STATUS_SUCCESS;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
+ fnode->type = NODE_TYPE_SPEECH;
+ fnode->leadin = leadin;
- fnode->type = NODE_TYPE_SPEECH;
- fnode->leadin = leadin;
+ memset(&fnode->sh, 0, sizeof(fnode->sh));
+ if (switch_core_speech_open(&fnode->sh,
+ conference->tts_engine,
+ conference->tts_voice,
+ conference->rate,
+ &flags,
+ conference->pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh,
- conference->tts_engine,
- conference->tts_voice,
- conference->rate,
- &flags,
- conference->pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
- }
+ fnode->pool = pool;
- fnode->pool = pool;
+ /* Queue the node */
+ switch_mutex_lock(member->flag_mutex);
+ for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
- /* Queue the node */
- switch_mutex_lock(member->flag_mutex);
- for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ member->fnode = fnode;
+ }
- if (nptr) {
- nptr->next = fnode;
- } else {
- member->fnode = fnode;
- }
+ /* Begin Generation */
+ switch_sleep(200000);
+ switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+ switch_mutex_unlock(member->flag_mutex);
- /* Begin Generation */
- switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, text, &flags);
- switch_mutex_unlock(member->flag_mutex);
+ status = SWITCH_STATUS_SUCCESS;
+ }
- status = SWITCH_STATUS_SUCCESS;
- }
-
- return status;
+ return status;
}
/* Say some thing with TTS in the conference room */
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin)
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ uint32_t count;
- if (conference != NULL && !switch_strlen_zero(text)) {
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- uint32_t count;
+ assert(conference != NULL);
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- count = conference->count;
- if (!(conference->tts_engine && conference->tts_voice)) {
- count = 0;
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ if (switch_strlen_zero(text)) {
+ return SWITCH_STATUS_GENERR;
+ }
- if (!count) {
- return SWITCH_STATUS_FALSE;
- }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ count = conference->count;
+ if (!(conference->tts_engine && conference->tts_voice)) {
+ count = 0;
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
- fnode->type = NODE_TYPE_SPEECH;
- fnode->leadin = leadin;
+ if (!count) {
+ return SWITCH_STATUS_FALSE;
+ }
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh,
- conference->tts_engine,
- conference->tts_voice,
- conference->rate,
- &flags,
- conference->pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- fnode->pool = pool;
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Queue the node */
- switch_mutex_lock(conference->mutex);
- for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+ fnode->type = NODE_TYPE_SPEECH;
+ fnode->leadin = leadin;
- if (nptr) {
- nptr->next = fnode;
- } else {
- conference->fnode = fnode;
- }
+ memset(&fnode->sh, 0, sizeof(fnode->sh));
+ if (switch_core_speech_open(&fnode->sh,
+ conference->tts_engine,
+ conference->tts_voice,
+ conference->rate,
+ &flags,
+ conference->pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
- /* Begin Generation */
- switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, text, &flags);
- switch_mutex_unlock(conference->mutex);
+ fnode->pool = pool;
- status = SWITCH_STATUS_SUCCESS;
- }
+ /* Queue the node */
+ switch_mutex_lock(conference->mutex);
+ for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
- return status;
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ conference->fnode = fnode;
+ }
+
+ /* Begin Generation */
+ switch_sleep(200000);
+ switch_core_speech_feed_tts(&fnode->sh, (char *)text, &flags);
+ switch_mutex_unlock(conference->mutex);
+
+ status = SWITCH_STATUS_SUCCESS;
+
+ return status;
}
/* execute a callback for every member of the conference */
static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
{
- conference_member_t *member = NULL;
+ conference_member_t *member = NULL;
- if(conference != NULL && stream != NULL && pfncallback != NULL) {
- switch_mutex_lock(conference->member_mutex);
+ assert(conference != NULL);
+ assert(stream != NULL);
+ assert(pfncallback != NULL);
- for (member = conference->members; member; member = member->next) {
- pfncallback(member,stream,data);
- }
- switch_mutex_unlock(conference->member_mutex);
- }
+ switch_mutex_lock(conference->member_mutex);
+
+ for (member = conference->members; member; member = member->next) {
+ pfncallback(member, stream, data);
+ }
+
+ switch_mutex_unlock(conference->member_mutex);
+
}
static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
{
- if (conference != NULL && stream != NULL) {
- conference_member_t *member = NULL;
+ conference_member_t *member = NULL;
- switch_mutex_lock(conference->member_mutex);
-// stream->write_function(stream, "<pre>Current Callers:\n");
+ assert(conference != NULL);
+ assert(stream != NULL);
- for (member = conference->members; member; member = member->next) {
- switch_channel_t *channel;
- switch_caller_profile_t *profile;
+ switch_mutex_lock(conference->member_mutex);
+ // stream->write_function(stream, "<pre>Current Callers:\n");
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- continue;
- }
- channel = switch_core_session_get_channel(member->session);
- profile = switch_channel_get_caller_profile(channel);
+ for (member = conference->members; member; member = member->next) {
+ switch_channel_t *channel;
+ switch_caller_profile_t *profile;
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ continue;
+ }
+ channel = switch_core_session_get_channel(member->session);
+ profile = switch_channel_get_caller_profile(channel);
- stream->write_function(stream, "%u) %s (%s)\n",
- member->id,
- profile->caller_id_name,
- profile->caller_id_number
- );
- }
- switch_mutex_unlock(conference->member_mutex);
- }
+ stream->write_function(stream, "%u) %s (%s)\n",
+ member->id,
+ profile->caller_id_name,
+ profile->caller_id_number
+ );
+
+ }
+
+ switch_mutex_unlock(conference->member_mutex);
+
}
static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
{
- if (conference != NULL && stream != NULL && delim != NULL) {
- conference_member_t *member = NULL;
+ conference_member_t *member = NULL;
- switch_mutex_lock(conference->member_mutex);
+ assert(conference != NULL);
+ assert(stream != NULL);
+ assert(delim != NULL);
- for (member = conference->members; member; member = member->next) {
- switch_channel_t *channel;
- switch_caller_profile_t *profile;
- char *uuid;
- char *name;
- uint32_t count = 0;
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "continue\n");
- continue;
- }
+ switch_mutex_lock(conference->member_mutex);
- uuid = switch_core_session_get_uuid(member->session);
- channel = switch_core_session_get_channel(member->session);
- profile = switch_channel_get_caller_profile(channel);
- name = switch_channel_get_name(channel);
+ for (member = conference->members; member; member = member->next) {
+ switch_channel_t *channel;
+ switch_caller_profile_t *profile;
+ char *uuid;
+ char *name;
+ uint32_t count = 0;
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "continue\n");
+ continue;
+ }
- stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
- member->id,delim,
- name,delim,
- uuid,delim,
- profile->caller_id_name,delim,
- profile->caller_id_number, delim);
+ uuid = switch_core_session_get_uuid(member->session);
+ channel = switch_core_session_get_channel(member->session);
+ profile = switch_channel_get_caller_profile(channel);
+ name = switch_channel_get_name(channel);
- if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
- stream->write_function(stream, "hear");
- count++;
- }
- if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
- count++;
- }
+ stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
+ member->id, delim,
+ name, delim,
+ uuid, delim,
+ profile->caller_id_name, delim,
+ profile->caller_id_number, delim);
- stream->write_function(stream, "%s%d%s%d%s%d\n",
- delim,
- member->volume_in_level, delim,
- member->volume_out_level, delim,
- member->energy_level);
- }
- switch_mutex_unlock(conference->member_mutex);
- }
+ if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
+ stream->write_function(stream, "hear");
+ count++;
+ }
+
+ if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+ stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
+ count++;
+ }
+
+ stream->write_function(stream, "%s%d%s%d%s%d\n",
+ delim,
+ member->volume_in_level, delim,
+ member->volume_out_level, delim,
+ member->energy_level);
+ }
+
+ switch_mutex_unlock(conference->member_mutex);
+
}
-static int conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
- if (member->conference->muted_sound) {
- conference_member_play_file(member, member->conference->muted_sound, 0);
- } else {
- char msg[512];
+ switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
+ if (member->conference->muted_sound) {
+ conference_member_play_file(member, member->conference->muted_sound, 0);
+ } else {
+ char msg[512];
- snprintf(msg, sizeof(msg), "Muted");
- conference_member_say(member, msg, 0);
- }
- if(stream != NULL) {
- stream->write_function(stream, "OK mute %u\n", member->id);
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ snprintf(msg, sizeof(msg), "Muted");
+ conference_member_say(member, msg, 0);
+ }
+ if (stream != NULL) {
+ stream->write_function(stream, "OK mute %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
- switch_event_fire(&event);
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
- if(stream != NULL) {
- stream->write_function(stream, "OK unmute %u\n", member->id);
- }
- if (member->conference->unmuted_sound) {
- conference_member_play_file(member, member->conference->unmuted_sound, 0);
- } else {
- char msg[512];
+ switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK unmute %u\n", member->id);
+ }
+ if (member->conference->unmuted_sound) {
+ conference_member_play_file(member, member->conference->unmuted_sound, 0);
+ } else {
+ char msg[512];
- snprintf(msg, sizeof(msg), "Un-Muted");
- conference_member_say(member, msg, 0);
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ snprintf(msg, sizeof(msg), "Un-Muted");
+ conference_member_say(member, msg, 0);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
- switch_event_fire(&event);
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
- if(stream != NULL) {
- stream->write_function(stream, "OK deaf %u\n", member->id);
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK deaf %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
- switch_event_fire(&event);
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_set_flag_locked(member, MFLAG_CAN_HEAR);
- if(stream != NULL) {
- stream->write_function(stream, "OK undeaf %u\n", member->id);
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ switch_set_flag_locked(member, MFLAG_CAN_HEAR);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK undeaf %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
- switch_event_fire(&event);
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_mutex_lock(member->flag_mutex);
- switch_clear_flag(member, MFLAG_RUNNING);
- switch_set_flag(member, MFLAG_KICKED);
- switch_mutex_unlock(member->flag_mutex);
- switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
+ switch_mutex_lock(member->flag_mutex);
+ switch_clear_flag(member, MFLAG_RUNNING);
+ switch_set_flag(member, MFLAG_KICKED);
+ switch_mutex_unlock(member->flag_mutex);
+ switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
- if(stream != NULL) {
- stream->write_function(stream, "OK kicked %u\n", member->id);
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "OK kicked %u\n", member->id);
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
- switch_event_fire(&event);
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = atoi((char *)data);
- switch_mutex_unlock(member->flag_mutex);
- }
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = atoi((char *)data);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- if(stream != NULL) {
- stream->write_function(stream, "Energy %u=%d\n", member->id, member->energy_level);
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
+ }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
- switch_event_fire(&event);
- }
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level = atoi((char *)data);
- switch_normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- }
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level = atoi((char *)data);
+ switch_normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- if(stream != NULL) {
- stream->write_function(stream, "Volume IN %u=%d\n", member->id, member->volume_in_level);
- }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (stream != NULL) {
+ stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
+ }
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
- switch_event_fire(&event);
- }
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level = atoi((char *)data);
- switch_normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- }
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level = atoi((char *)data);
+ switch_normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- if(stream != NULL) {
- stream->write_function(stream, "Volume OUT %u=%d\n", member->id, member->volume_out_level);
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
+ }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
- switch_event_fire(&event);
- }
- }
- } else {
- syntax_err = 1;
- }
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
- switch_hash_index_t *hi;
- void *val;
- char *d = ";";
- int pretty = 0;
- int argofs = (argc >= 2 && strcasecmp(argv[1],"list") == 0); // detect being called from chat vs. api
+ switch_hash_index_t *hi;
+ void *val;
+ char *d = ";";
+ int pretty = 0;
+ int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0); // detect being called from chat vs. api
- if (argv[1+argofs]) {
- if (argv[2+argofs] && !strcasecmp(argv[1+argofs], "delim")) {
- d = argv[2+argofs];
+ if (argv[1+argofs]) {
+ if (argv[2+argofs] && !strcasecmp(argv[1+argofs], "delim")) {
+ d = argv[2+argofs];
- if (*d == '"') {
- if (++d) {
- char *p;
- if ((p = strchr(d, '"'))) {
- *p = '\0';
- }
- } else {
- d = ";";
- }
- }
- } else if (strcasecmp(argv[1+argofs], "pretty") == 0) {
- pretty = 1;
- }
- }
+ if (*d == '"') {
+ if (++d) {
+ char *p;
+ if ((p = strchr(d, '"'))) {
+ *p = '\0';
+ }
+ } else {
+ d = ";";
+ }
+ }
+ } else if (strcasecmp(argv[1+argofs], "pretty") == 0) {
+ pretty = 1;
+ }
+ }
- if (conference == NULL) {
- for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, NULL, NULL, &val);
- conference = (conference_obj_t *) val;
+ if (conference == NULL) {
+ for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, NULL, NULL, &val);
+ conference = (conference_obj_t *) val;
- stream->write_function(stream, "Conference %s (%u member%s)\n",
- conference->name,
- conference->count,
- conference->count == 1 ? "" : "");
- if (pretty) {
- conference_list_pretty(conference, stream);
- } else {
- conference_list(conference, stream, d);
- }
- }
- } else {
- if (pretty) {
- conference_list_pretty(conference, stream);
- } else {
- conference_list(conference, stream, d);
- }
- }
+ stream->write_function(stream, "Conference %s (%u member%s)\n",
+ conference->name,
+ conference->count,
+ conference->count == 1 ? "" : "s");
+ if (pretty) {
+ conference_list_pretty(conference, stream);
+ } else {
+ conference_list(conference, stream, d);
+ }
+ }
+ } else {
+ if (pretty) {
+ conference_list_pretty(conference, stream);
+ } else {
+ conference_list(conference, stream, d);
+ }
+ }
- syntax_err = 0;
+ ret_status = SWITCH_STATUS_SUCCESS;
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
+ switch_event_t *event;
- if (conference != NULL && stream != NULL) {
- switch_event_t *event;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (argc == 3) {
- if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
- }
- syntax_err = 0;
- } else if (argc == 4) {
- uint32_t id = atoi(argv[3]);
- conference_member_t *member;
+
+ if (argc == 3) {
+ if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+ switch_event_fire(&event);
+ }
+ } else {
+ stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else if (argc == 4) {
+ uint32_t id = atoi(argv[3]);
+ conference_member_t *member;
- if ((member = conference_member_get(conference, id))) {
- if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
- }
- syntax_err = 0;
- } else {
- stream->write_function(stream, "Member: %u not found.\n", id);
- }
- }
- }
+ if ((member = conference_member_get(conference, id))) {
+ if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+ switch_event_fire(&event);
+ }
+ } else {
+ stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "Member: %u not found.\n", id);
+ }
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, char *text)
+static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
- if (conference != NULL && stream != NULL) {
- if (!switch_strlen_zero(text)) {
- if (conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
- switch_event_t *event;
+ if (switch_strlen_zero(text)) {
+ stream->write_function(stream, "(say) Error! No text.");
+ return ret_status;
+ }
- stream->write_function(stream, "(say) OK\n");
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "(say) Error!");
- }
- syntax_err = 0;
- } else {
- stream->write_function(stream, "(say) Error! No text.");
- }
- }
+ if (conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
+ switch_event_t *event;
- return syntax_err;
+ stream->write_function(stream, "(say) OK\n");
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+ switch_event_fire(&event);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "(say) Error!");
+ }
+
+ return ret_status;
}
-static int conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, char *text)
+static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
+ char *expanded = NULL;
+ char *start_text = NULL;
+ char *workspace = NULL;
+ uint32_t id = 0;
+ conference_member_t *member;
- if (conference != NULL) {
- if (!switch_strlen_zero(text)) {
- char *name = strdup(text);
- uint32_t id = 0;
- conference_member_t *member;
+ if (switch_strlen_zero(text)) {
+ stream->write_function(stream, "(saymember) No Text!\n");
+ goto done;
+ }
- if (!switch_strlen_zero(name)) {
- text = strchr(name, ' ');
- *name = '\0';
- id = atoi(name);
- free(name);
- }
+ if (!(workspace = strdup(text))) {
+ stream->write_function(stream, "(saymember) Memory Error!\n");
+ goto done;
+ }
- if (id != 0 && (member = conference_member_get(conference, id))) {
- if (text && conference_member_say(member, text, 0) == SWITCH_STATUS_SUCCESS) {
- switch_event_t *event;
+ if ((start_text = strchr(workspace, ' '))) {
+ *start_text++ = '\0';
+ text = start_text;
+ }
- stream->write_function(stream, "(saymember) OK\n");
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "(saymember) Error!");
- }
- syntax_err = 0;
- } else {
- stream->write_function(stream, "(saymember) Unknown Member %u!", id);
- }
- }
- }
+ id = atoi(workspace);
- return syntax_err;
+ if (!id || switch_strlen_zero(text)) {
+ stream->write_function(stream, "(saymember) No Text!\n");
+ goto done;
+ }
+
+ if (!(member = conference_member_get(conference, id))) {
+ stream->write_function(stream, "(saymember) Unknown Member %u!", id);
+ goto done;
+ }
+
+ if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), (char *)text)) != text) {
+ text = expanded;
+ } else {
+ expanded = NULL;
+ }
+
+ if (text && conference_member_say(member, (char *)text, 0) == SWITCH_STATUS_SUCCESS) {
+ switch_event_t *event;
+
+ stream->write_function(stream, "(saymember) OK\n");
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+ switch_event_fire(&event);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "(saymember) Error!");
+ }
+
+ done:
+ switch_safe_free(workspace);
+ switch_safe_free(expanded);
+ return ret_status;
}
-static int conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
+ uint8_t current = 0, all = 0;
- if (conference != NULL) {
- uint8_t current = 0, all = 0;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (argc > 2) {
- current = strcasecmp(argv[2], "current") ? 0 : 1;
- all = strcasecmp(argv[2], "all") ? 0 : 1;
- }
+ if (argc > 2) {
+ current = strcasecmp(argv[2], "current") ? 0 : 1;
+ all = strcasecmp(argv[2], "all") ? 0 : 1;
+ }
- if (current || all) {
- if (argc == 4) {
- uint32_t id = atoi(argv[3]);
- conference_member_t *member;
+ if (current || all) {
+ if (argc == 4) {
+ uint32_t id = atoi(argv[3]);
+ conference_member_t *member;
- if ((member = conference_member_get(conference, id))) {
- uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
- stream->write_function(stream, "Stopped %u files.\n", stopped);
- } else {
- stream->write_function(stream, "Member: %u not found.\n", id);
- }
- syntax_err = 0;
- } else {
- uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
- stream->write_function(stream, "Stopped %u files.\n", stopped);
- syntax_err = 0;
- }
- }
- }
+ if ((member = conference_member_get(conference, id))) {
+ uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+ stream->write_function(stream, "Stopped %u files.\n", stopped);
+ } else {
+ stream->write_function(stream, "Member: %u not found.\n", id);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+ stream->write_function(stream, "Stopped %u files.\n", stopped);
+ ret_status = SWITCH_STATUS_SUCCESS;
+ }
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 1;
+ int ret_status = SWITCH_STATUS_GENERR;
- if (conference != NULL && stream != NULL) {
- if (argc > 4) {
- uint8_t nospeak = 0, nohear = 0, clear = 0;
- nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
- nohear = strstr(argv[4], "nohear") ? 1 : 0;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (!strcasecmp(argv[4], "clear")) {
- clear = 1;
- }
+ if (argc > 4) {
+ uint8_t nospeak = 0, nohear = 0, clear = 0;
+ nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
+ nohear = strstr(argv[4], "nohear") ? 1 : 0;
- if (!(clear || nospeak || nohear)) {
- syntax_err = 1;
- goto done;
- }
- syntax_err = 0;
+ if (!strcasecmp(argv[4], "clear")) {
+ clear = 1;
+ }
- if (clear) {
- conference_member_t *member = NULL;
- uint32_t id = atoi(argv[2]);
- uint32_t oid = atoi(argv[3]);
+ if (!(clear || nospeak || nohear)) {
+ ret_status = SWITCH_STATUS_GENERR;
+ goto done;
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- if ((member = conference_member_get(conference, id))) {
- member_del_relationship(member, oid);
- stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
- } else {
- stream->write_function(stream, "relationship %u->%u not found", id, oid);
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
- } else if (nospeak || nohear) {
- conference_member_t *member = NULL, *other_member = NULL;
- uint32_t id = atoi(argv[2]);
- uint32_t oid = atoi(argv[3]);
+ if (clear) {
+ conference_member_t *member = NULL;
+ uint32_t id = atoi(argv[2]);
+ uint32_t oid = atoi(argv[3]);
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
- conference_relationship_t *rel = NULL;
- if ((rel = member_get_relationship(member, other_member))) {
- rel->flags = 0;
- } else {
- rel = member_add_relationship(member, oid);
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ if ((member = conference_member_get(conference, id))) {
+ member_del_relationship(member, oid);
+ stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
+ } else {
+ stream->write_function(stream, "relationship %u->%u not found", id, oid);
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ } else if (nospeak || nohear) {
+ conference_member_t *member = NULL, *other_member = NULL;
+ uint32_t id = atoi(argv[2]);
+ uint32_t oid = atoi(argv[3]);
- if (rel) {
- switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
- if (nospeak) {
- switch_clear_flag(rel, RFLAG_CAN_SPEAK);
- }
- if (nohear) {
- switch_clear_flag(rel, RFLAG_CAN_HEAR);
- }
- stream->write_function(stream, "ok %u->%u set\n", id, oid);
- } else {
- stream->write_function(stream, "error!\n");
- }
- } else {
- stream->write_function(stream, "relationship %u->%u not found", id, oid);
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
- }
- }
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
+ conference_relationship_t *rel = NULL;
+ if ((rel = member_get_relationship(member, other_member))) {
+ rel->flags = 0;
+ } else {
+ rel = member_add_relationship(member, oid);
+ }
-done:
- return syntax_err;
+ if (rel) {
+ switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
+ if (nospeak) {
+ switch_clear_flag(rel, RFLAG_CAN_SPEAK);
+ }
+ if (nohear) {
+ switch_clear_flag(rel, RFLAG_CAN_HEAR);
+ }
+ stream->write_function(stream, "ok %u->%u set\n", id, oid);
+ } else {
+ stream->write_function(stream, "error!\n");
+ }
+ } else {
+ stream->write_function(stream, "relationship %u->%u not found", id, oid);
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ }
+ }
+
+ done:
+ return ret_status;
}
-static int conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- if (conference != NULL && stream != NULL) {
- switch_event_t *event;
+ switch_event_t *event;
- switch_set_flag_locked(conference, CFLAG_LOCKED);
- stream->write_function(stream, "OK %s locked\n", argv[0]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
- switch_event_fire(&event);
- }
- }
+ assert(conference != NULL);
+ assert(stream != NULL);
- return 0;
+ switch_set_flag_locked(conference, CFLAG_LOCKED);
+ stream->write_function(stream, "OK %s locked\n", argv[0]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
+ switch_event_fire(&event);
+ }
+
+ return 0;
}
-static int conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- if (conference != NULL && stream != NULL) {
- switch_event_t *event;
+ switch_event_t *event;
- switch_clear_flag_locked(conference, CFLAG_LOCKED);
- stream->write_function(stream, "OK %s unlocked\n", argv[0]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
- switch_event_fire(&event);
- }
- }
+ assert(conference != NULL);
+ assert(stream != NULL);
- return 0;
+ switch_clear_flag_locked(conference, CFLAG_LOCKED);
+ stream->write_function(stream, "OK %s unlocked\n", argv[0]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
+ switch_event_fire(&event);
+ }
+
+
+ return 0;
}
-static int conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (conference != NULL && stream != NULL) {
- if (argc > 2) {
- conference_outcall(conference, NULL, argv[2], 60, NULL, argv[4], argv[3]);
- stream->write_function(stream, "OK\n");
- } else {
- syntax_err = 1;
- }
- }
+ assert(conference != NULL);
+ assert(stream != NULL);
- return syntax_err;
+ if (argc > 2) {
+ conference_outcall(conference, NULL, argv[2], 60, NULL, argv[4], argv[3]);
+ stream->write_function(stream, "OK\n");
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-static int conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (conference != NULL && stream != NULL) {
- if (argc > 3 && !switch_strlen_zero(argv[2])) {
- int x;
+ assert(conference != NULL);
+ assert(stream != NULL);
- for (x=3; x<argc; x++) {
- conference_member_t *member = NULL;
- uint32_t id = atoi(argv[x]);
- conference_obj_t *new_conference = NULL;
- switch_channel_t *channel;
- switch_event_t *event;
- char *profile_name;
- switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+ if (argc > 3 && !switch_strlen_zero(argv[2])) {
+ int x;
- if (!(member = conference_member_get(conference, id))) {
- stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
- continue;
- }
+ for (x = 3; x<argc; x++) {
+ conference_member_t *member = NULL;
+ uint32_t id = atoi(argv[x]);
+ conference_obj_t *new_conference = NULL;
+ switch_channel_t *channel;
+ switch_event_t *event;
+ char *profile_name;
+ switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
- channel = switch_core_session_get_channel(member->session);
+ if (!(member = conference_member_get(conference, id))) {
+ stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
+ continue;
+ }
- /* build a new conference if it doesn't exist */
- if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
- switch_memory_pool_t *pool = NULL;
- char *conf_name;
- conf_xml_cfg_t xml_cfg;
+ channel = switch_core_session_get_channel(member->session);
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- goto done;
- }
+ /* build a new conference if it doesn't exist */
+ if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
+ switch_memory_pool_t *pool = NULL;
+ char *conf_name;
+ conf_xml_cfg_t xml_cfg = {0};
- conf_name = switch_core_strdup(pool, argv[2]);
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ goto done;
+ }
- if ((profile_name = strchr(conf_name, '@'))) {
- *profile_name++ = '\0';
+ conf_name = switch_core_strdup(pool, argv[2]);
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
+ if ((profile_name = strchr(conf_name, '@'))) {
+ *profile_name++ = '\0';
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
- }
- xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
+
+ if ((profiles = switch_xml_child(cfg, "profiles"))) {
+ xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+ }
+ xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
#ifdef OPTION_IVR_MENU_SUPPORT
- xml_cfg.menus = switch_xml_child(cfg, "menus");
+ xml_cfg.menus = switch_xml_child(cfg, "menus");
#endif
- }
+ }
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
- /* Create the conference object. */
- new_conference = conference_new(conf_name, xml_cfg, pool);
+ /* Create the conference object. */
+ new_conference = conference_new(conf_name, xml_cfg, pool);
- if (!new_conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- if (pool != NULL) {
- switch_core_destroy_memory_pool(&pool);
- }
- goto done;
- }
+ if (!new_conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ if (pool != NULL) {
+ switch_core_destroy_memory_pool(&pool);
+ }
+ goto done;
+ }
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- new_conference->min = 1;
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ new_conference->min = 1;
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
- /* Start the conference thread for this conference */
- launch_conference_thread(new_conference);
- }
+ /* Start the conference thread for this conference */
+ launch_conference_thread(new_conference);
+ }
- /* move the member from the old conference to the new one */
- conference_del_member(member->last_conference, member);
- conference_add_member(new_conference, member);
+ /* move the member from the old conference to the new one */
+ conference_del_member(member->last_conference, member);
+ conference_add_member(new_conference, member);
- stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
+ stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
- /* tell them what happened */
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
- switch_event_fire(&event);
- }
- }
- } else {
- syntax_err = 1;
- }
- }
-done:
- return syntax_err;
+ /* tell them what happened */
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ done:
+ return ret_status;
}
-static int conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (conference != NULL && stream != NULL) {
- if (argc > 2) {
- launch_conference_record_thread(conference, argv[2]);
- } else {
- syntax_err = 1;
- }
- }
+ if (argc > 2) {
+ launch_conference_record_thread(conference, argv[2]);
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return syntax_err;
+ return ret_status;
}
-static int conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int syntax_err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (conference != NULL && stream != NULL) {
- if (argc > 2) {
- int all = (strcasecmp(argv[2], "all") == 0 );
+ assert(conference != NULL);
+ assert(stream != NULL);
- if(!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
- stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
- }
- } else {
- syntax_err = 1;
- }
- }
+ if (argc > 2) {
+ int all = (strcasecmp(argv[2], "all") == 0 );
- return syntax_err;
+ if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
+ stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-enum {
- CONF_API_SUB_ARGS_SPLIT,
- CONF_API_SUB_MEMBER_TARGET,
- CONF_API_SUB_ARGS_AS_ONE,
-};
-
/* API Interface Function sub-commands */
static api_command_t conf_api_sub_commands[] = {
- {"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
- {"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
- {"volume in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
- {"volume out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
- {"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
- {"say", &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
- {"saymember", &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
- {"stop", &conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
- {"kick", &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
- {"mute", &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
- {"unmute", &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
- {"deaf", &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
- {"undeaf", &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
- {"relate", &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
- {"lock", &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
- {"unlock", &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
- {"dial", &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
- {"transfer", &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
- {"record", &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
- {"norecord", &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+ {"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+ {"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
+ {"volume_in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
+ {"volume_out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
+ {"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+ {"say", &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+ {"saymember", &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
+ {"stop", &conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
+ {"kick", &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+ {"mute", &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+ {"unmute", &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
+ {"deaf", &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+ {"undeaf", &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
+ {"relate", &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
+ {"lock", &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+ {"unlock", &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+ {"dial", &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
+ {"transfer", &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
+ {"record", &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+ {"norecord", &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
};
#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
-switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, char *cmdline, int argn)
-{ switch_status_t status = SWITCH_STATUS_FALSE;
+switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ uint32_t i, found = 0;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (conference != NULL) {
- int i,found=0;
+ /* loop through the command table to find a match */
+ for (i = 0; i<CONFFUNCAPISIZE && !found; i++) {
+ if (strcasecmp(argv[argn], conf_api_sub_commands[i].pname) == 0) {
+ found = 1;
+ switch(conf_api_sub_commands[i].fntype) {
- /* loop through the command table to find a match */
- for (i=0; i<CONFFUNCAPISIZE && !found; i++) {
- if (strcasecmp(argv[argn],conf_api_sub_commands[i].pname) == 0) {
- found = 1;
- switch(conf_api_sub_commands[i].fntype) {
+ /* commands that we've broken the command line into arguments for */
+ case CONF_API_SUB_ARGS_SPLIT:
+ { conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
- /* commands that we've broken the command line into arguments for */
- case CONF_API_SUB_ARGS_SPLIT:
- { conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+ if (pfn(conference, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
+ /* command returned error, so show syntax usage */
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ }
+ }
+ break;
- if (pfn(conference, stream, argc, argv) != 0) {
- /* command returned error, so show syntax usage */
- stream->write_function(stream,conf_api_sub_commands[i].psyntax);
- }
- }
- break;
+ /* member specific command that can be itteratted */
+ case CONF_API_SUB_MEMBER_TARGET:
+ {
+ uint32_t id = atoi(argv[argn+1]);
+ int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
+ int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
- /* member specific command that can be itteratted */
- case CONF_API_SUB_MEMBER_TARGET:
- {
- uint32_t id = atoi(argv[argn+1]);
- int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
- int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
+ if (all) {
+ conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
+ } else if (last) {
+ conference_member_t *member = NULL;
+ conference_member_t *last_member = NULL;
- if(all) {
- conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
- } else if (last) {
- conference_member_t *member = NULL;
- conference_member_t *last_member = NULL;
+ switch_mutex_lock(conference->member_mutex);
- switch_mutex_lock(conference->member_mutex);
+ /* find last (oldest) member */
+ member = conference->members;
+ while (member != NULL) {
+ if (last_member == NULL || member->id > last_member->id) {
+ last_member = member;
+ }
+ member = member->next;
+ }
- /* find last (oldest) member */
- member = conference->members;
- while (member != NULL) {
- if (last_member == NULL || member->id > last_member->id) {
- last_member = member;
- }
- member = member->next;
- }
+ /* exec functio on last (oldest) member */
+ if (last_member != NULL) {
+ conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+ pfn(last_member, stream, argv[argn+2]);
+ }
- /* exec functio on last (oldest) member */
- if (last_member != NULL) {
- conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
- pfn(last_member, stream, argv[argn+2]);
- }
+ switch_mutex_unlock(conference->member_mutex);
+ } else {
+ conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+ conference_member_t *member = conference_member_get(conference, id);
- switch_mutex_unlock(conference->member_mutex);
- } else {
- conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
- conference_member_t *member = conference_member_get(conference, id);
+ if (member != NULL) {
+ pfn(conference_member_get(conference, id), stream, argv[argn+2]);
+ } else {
+ if (id == 0) {
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ }
+ }
+ }
+ }
+ break;
- if (member != NULL) {
- pfn(conference_member_get(conference, id), stream, argv[argn+2]);
- } else {
- if (id == 0) {
- stream->write_function(stream,conf_api_sub_commands[i].psyntax);
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- }
- }
- }
- }
- break;
+ /* commands that deals with all text after command */
+ case CONF_API_SUB_ARGS_AS_ONE:
+ {
+ conf_api_text_cmd_t pfn = (conf_api_text_cmd_t) conf_api_sub_commands[i].pfnapicmd;
+ char *start_text;
+ const char *modified_cmdline = cmdline;
+ const char *cmd = conf_api_sub_commands[i].pname;
- /* commands that deals with all text after command */
- case CONF_API_SUB_ARGS_AS_ONE:
- { conf_api_text_cmd_t pfn = (conf_api_text_cmd_t)conf_api_sub_commands[i].pfnapicmd;
- char *pstr = cmdline+strlen(conf_api_sub_commands[i].pname)+1;
+ if ((start_text = strstr(modified_cmdline, cmd))) {
+ modified_cmdline = start_text + strlen(cmd);
+ while(modified_cmdline && *modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
+ modified_cmdline++;
+ }
+ }
+
+ /* call the command handler */
+ if (pfn(conference, stream, modified_cmdline) != SWITCH_STATUS_SUCCESS) {
+ /* command returned error, so show syntax usage */
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ }
+ }
+ break;
+ }
+ }
+ }
- /* advance past all leading white space after command */
- while(*pstr == ' ' || *pstr == '\t') {
- pstr++;
- }
+ if (!found) {
+ stream->write_function(stream, "Confernece command '%s' not found.\n", argv[argn]);
+ } else {
+ status = SWITCH_STATUS_SUCCESS;
+ }
- /* call the command handler */
- if (pfn(conference, stream, pstr) != 0) {
- /* command returned error, so show syntax usage */
- stream->write_function(stream,conf_api_sub_commands[i].psyntax);
- }
- }
- break;
- }
- }
- }
-
- if(!found) {
- stream->write_function(stream, "Confernece command '%s' not found.\n", argv[argn]);
- } else {
- status = SWITCH_STATUS_SUCCESS;
- }
- }
-
- return status;
+ return status;
}
/* API Interface Function */
static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
{
- char *lbuf = NULL;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- char *http = NULL;
+ char *lbuf = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ char *http = NULL;
+ int argc;
+ char *argv[25] = {0};
- if (session) {
- return SWITCH_STATUS_FALSE;
- }
+ if (!buf) {
+ buf = "help";
+ }
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
- }
+ if (session) {
+ return SWITCH_STATUS_FALSE;
+ }
- if (http) {
- /* Output must be to a web browser */
- stream->write_function(stream, "<pre>\n");
- }
+ if (stream->event) {
+ http = switch_event_get_header(stream->event, "http-host");
+ }
- if (buf != NULL && (lbuf = strdup(buf))) {
- int argc;
- char *argv[25];
+ if (http) {
+ /* Output must be to a web browser */
+ stream->write_function(stream, "<pre>\n");
+ }
- memset(argv,0,sizeof(argv));
- argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if (!(lbuf = strdup(buf))) {
+ return status;
+ }
- /* try to find a command to execute */
- if (argc) {
- conference_obj_t *conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]);
+ argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- if(conference != NULL) {
- if (argc >= 2) {
- status = conf_api_dispatch(conference, stream, argc, argv, lbuf, 1);
- } else {
- stream->write_function(stream,"Conference command, not specified.\nTry 'help'\n");
- }
- } else {
- /* special case the list command, because it doesn't require a conference argument */
- if (strcasecmp(argv[0],"list") == 0) {
- conf_api_sub_list(NULL, stream, argc, argv);
- } else if (strcasecmp(argv[0],"help") == 0 || strcasecmp(argv[0],"commands") == 0) {
- stream->write_function(stream, "%s\n", conf_api_interface.syntax);
- } else {
- stream->write_function(stream, "Conference %s not found\n", argv[0]);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s not found\n", argv[0]);
- }
- }
+ /* try to find a command to execute */
+ if (argc) {
+ conference_obj_t *conference = NULL;
- } else {
- stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
- }
- }
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
+ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+ }
- switch_safe_free(lbuf);
+ if (argc >= 2) {
+ conf_api_dispatch(conference, stream, argc, argv, (const char *)buf, 1);
+ } else {
+ stream->write_function(stream, "Conference command, not specified.\nTry 'help'\n");
+ }
- return status;
+ switch_thread_rwlock_unlock(conference->rwlock);
+ } else {
+ /* special case the list command, because it doesn't require a conference argument */
+ if (strcasecmp(argv[0], "list") == 0) {
+ conf_api_sub_list(NULL, stream, argc, argv);
+ } else if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+ stream->write_function(stream, "%s\n", conf_api_interface.syntax);
+ } else {
+ stream->write_function(stream, "Conference %s not found\n", argv[0]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s not found\n", argv[0]);
+ }
+ }
+
+ } else {
+ stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
+ }
+
+ switch_safe_free(lbuf);
+
+ return status;
+
}
/* outbound call bridge progress call state callback handler */
static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
{
- switch_channel_t *channel = NULL;
+ switch_channel_t *channel = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
- /* put the channel in a passive state so we can loop audio to it */
- switch_channel_set_state(channel, CS_TRANSMIT);
- return SWITCH_STATUS_FALSE;
+ /* put the channel in a passive state so we can loop audio to it */
+ switch_channel_set_state(channel, CS_TRANSMIT);
+ return SWITCH_STATUS_FALSE;
}
static const switch_state_handler_table_t audio_bridge_peer_state_handlers = {
- /*.on_init */ NULL,
- /*.on_ring */ audio_bridge_on_ring,
- /*.on_execute */ NULL,
- /*.on_hangup */ NULL,
- /*.on_loopback */ NULL,
- /*.on_transmit */ NULL,
- /*.on_hold */ NULL,
+ /*.on_init */ NULL,
+ /*.on_ring */ audio_bridge_on_ring,
+ /*.on_execute */ NULL,
+ /*.on_hangup */ NULL,
+ /*.on_loopback */ NULL,
+ /*.on_transmit */ NULL,
+ /*.on_hold */ NULL,
};
/* generate an outbound call from the conference */
-static switch_status_t conference_outcall(conference_obj_t *conference,
- switch_core_session_t *session,
- char *bridgeto,
- uint32_t timeout,
- char *flags,
- char *cid_name,
- char *cid_num)
+static switch_status_t conference_outcall(conference_obj_t *conference,
+ switch_core_session_t *session,
+ char *bridgeto,
+ uint32_t timeout,
+ char *flags,
+ char *cid_name,
+ char *cid_num)
{
- switch_core_session_t *peer_session;
- switch_channel_t *peer_channel;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_channel_t *caller_channel = NULL;
- char appdata[512];
- switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
+ switch_core_session_t *peer_session;
+ switch_channel_t *peer_channel;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_channel_t *caller_channel = NULL;
+ char appdata[512];
+ switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
- if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
- return SWITCH_STATUS_FALSE;
- }
+ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+ return SWITCH_STATUS_FALSE;
+ }
- if (session != NULL) {
- caller_channel = switch_core_session_get_channel(session);
+ if (session != NULL) {
+ caller_channel = switch_core_session_get_channel(session);
- }
+ }
- if (switch_strlen_zero(cid_name)) {
- cid_name = conference->caller_id_name;
- }
+ if (switch_strlen_zero(cid_name)) {
+ cid_name = conference->caller_id_name;
+ }
- if (switch_strlen_zero(cid_num)) {
- cid_num = conference->caller_id_number;
- }
+ if (switch_strlen_zero(cid_num)) {
+ cid_num = conference->caller_id_number;
+ }
- /* establish an outbound call leg */
- if (switch_ivr_originate(session,
- &peer_session,
- &cause,
- bridgeto,
- timeout,
- &audio_bridge_peer_state_handlers,
- cid_name,
- cid_num,
- NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
- switch_channel_cause2str(cause));
- if (caller_channel) {
- switch_channel_hangup(caller_channel, cause);
- }
- goto done;
- }
+ /* establish an outbound call leg */
+ if (switch_ivr_originate(session,
+ &peer_session,
+ &cause,
+ bridgeto,
+ timeout,
+ &audio_bridge_peer_state_handlers,
+ cid_name,
+ cid_num,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
+ switch_channel_cause2str(cause));
+ if (caller_channel) {
+ switch_channel_hangup(caller_channel, cause);
+ }
+ goto done;
+ }
- peer_channel = switch_core_session_get_channel(peer_session);
- assert(peer_channel != NULL);
+ peer_channel = switch_core_session_get_channel(peer_session);
+ assert(peer_channel != NULL);
- /* make sure the conference still exists */
- if (!switch_test_flag(conference, CFLAG_RUNNING)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
- if (caller_channel) {
- switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
- }
- switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
- goto done;
- }
+ /* make sure the conference still exists */
+ if (!switch_test_flag(conference, CFLAG_RUNNING)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
+ if (caller_channel) {
+ switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+ }
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+ goto done;
+ }
- if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
- switch_channel_answer(caller_channel);
- }
+ if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
+ switch_channel_answer(caller_channel);
+ }
- /* if the outbound call leg is ready */
- if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
- switch_caller_extension_t *extension = NULL;
+ /* if the outbound call leg is ready */
+ if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
+ switch_caller_extension_t *extension = NULL;
- /* build an extension name object */
- if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
- /* add them to the conference */
- if (flags && strcasecmp(flags, "none")) {
- snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
- switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
- } else {
- switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
- }
+ /* build an extension name object */
+ if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
+ /* add them to the conference */
+ if (flags && strcasecmp(flags, "none")) {
+ snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
+ switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
+ } else {
+ switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
+ }
- switch_channel_set_caller_extension(peer_channel, extension);
- switch_channel_set_state(peer_channel, CS_EXECUTE);
+ switch_channel_set_caller_extension(peer_channel, extension);
+ switch_channel_set_state(peer_channel, CS_EXECUTE);
- } else {
- switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
+ } else {
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
-done:
- switch_thread_rwlock_unlock(conference->rwlock);
- return status;
+ done:
+ switch_thread_rwlock_unlock(conference->rwlock);
+ return status;
}
/* Play a file */
static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
{
- uint32_t x = 0;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ uint32_t x = 0;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- /* generate some space infront of the file to be played */
- for (x = 0; x < leadin; x++) {
- switch_frame_t *read_frame;
- switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
+ /* generate some space infront of the file to be played */
+ for (x = 0; x < leadin; x++) {
+ switch_frame_t *read_frame;
+ switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
- break;
- }
- }
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
+ }
- /* 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);
- }
+ /* 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);
+ }
- return status;
+ return status;
}
/* Application interface function that is called from the dialplan to join the channel to a conference */
static void conference_function(switch_core_session_t *session, char *data)
{
- switch_codec_t *read_codec = NULL;
- switch_memory_pool_t *pool = NULL, *freepool = NULL;
- uint32_t flags = 0;
- conference_member_t member = {0};
- conference_obj_t *conference = NULL;
- switch_channel_t *channel = NULL;
- char *mydata = switch_core_session_strdup(session, data);
- char *conf_name = NULL;
- char *bridge_prefix = "bridge:";
- char *flags_prefix = "+flags{";
- char *bridgeto = NULL;
- char *profile_name = NULL;
- switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
- char *flags_str;
- member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
- switch_core_session_message_t msg = {0};
- uint8_t rl = 0, isbr = 0;
- char *dpin = NULL;
- conf_xml_cfg_t xml_cfg;
+ switch_codec_t *read_codec = NULL;
+ switch_memory_pool_t *pool = NULL, *freepool = NULL;
+ uint32_t flags = 0;
+ conference_member_t member = {0};
+ conference_obj_t *conference = NULL;
+ switch_channel_t *channel = NULL;
+ char *mydata = switch_core_session_strdup(session, data);
+ char *conf_name = NULL;
+ char *bridge_prefix = "bridge:";
+ char *flags_prefix = "+flags{";
+ char *bridgeto = NULL;
+ char *profile_name = NULL;
+ switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+ char *flags_str;
+ member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+ switch_core_session_message_t msg = {0};
+ uint8_t rl = 0, isbr = 0;
+ char *dpin = NULL;
+ conf_xml_cfg_t xml_cfg = {0};
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- if (!mydata) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return;
- }
+ if (!mydata) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return;
+ }
- /* Start the conference muted or deaf ? */
- if ((flags_str=strstr(mydata, flags_prefix))) {
- char *p;
+ /* Start the conference muted or deaf ? */
+ if ((flags_str = strstr(mydata, flags_prefix))) {
+ char *p;
- *flags_str = '\0';
- flags_str += strlen(flags_prefix);
- if ((p = strchr(flags_str, '}'))) {
- *p = '\0';
- }
+ *flags_str = '\0';
+ flags_str += strlen(flags_prefix);
+ if ((p = strchr(flags_str, '}'))) {
+ *p = '\0';
+ }
- if (strstr(flags_str, "mute")) {
- uflags &= ~MFLAG_CAN_SPEAK;
- } else if (strstr(flags_str, "deaf")) {
- uflags &= ~MFLAG_CAN_HEAR;
- }
- }
+ if (strstr(flags_str, "mute")) {
+ uflags &= ~MFLAG_CAN_SPEAK;
+ } else if (strstr(flags_str, "deaf")) {
+ uflags &= ~MFLAG_CAN_HEAR;
+ }
+ }
- /* is this a bridging conference ? */
- if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
- isbr = 1;
- mydata += strlen(bridge_prefix);
- if ((bridgeto = strchr(mydata, ':'))) {
- *bridgeto++ = '\0';
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
- goto done;
- }
- }
+ /* is this a bridging conference ? */
+ if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
+ isbr = 1;
+ mydata += strlen(bridge_prefix);
+ if ((bridgeto = strchr(mydata, ':'))) {
+ *bridgeto++ = '\0';
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
+ goto done;
+ }
+ }
- conf_name = mydata;
+ conf_name = mydata;
- /* is there a conference pin ? */
- if ((dpin = strchr(conf_name, '+'))) {
- *dpin++ = '\0';
- }
+ /* is there a conference pin ? */
+ if ((dpin = strchr(conf_name, '+'))) {
+ *dpin++ = '\0';
+ }
- /* is there profile specification ? */
- if ((profile_name = strchr(conf_name, '@'))) {
- *profile_name++ = '\0';
+ /* is there profile specification ? */
+ if ((profile_name = strchr(conf_name, '@'))) {
+ *profile_name++ = '\0';
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
- }
+ if ((profiles = switch_xml_child(cfg, "profiles"))) {
+ xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+ }
- xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+ xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
#ifdef OPTION_IVR_MENU_SUPPORT
- xml_cfg.menus = switch_xml_child(cfg, "menus");
+ xml_cfg.menus = switch_xml_child(cfg, "menus");
#endif
- }
+ }
- /* if this is a bridging call, and it's not a duplicate, build a */
- /* conference object, and skip pin handling, and locked checking */
- if (isbr) {
- char *uuid = switch_core_session_get_uuid(session);
+ /* if this is a bridging call, and it's not a duplicate, build a */
+ /* conference object, and skip pin handling, and locked checking */
+ if (isbr) {
+ char *uuid = switch_core_session_get_uuid(session);
- if (!strcmp(conf_name, "_uuid_")) {
- conf_name = uuid;
- }
+ if (!strcmp(conf_name, "_uuid_")) {
+ conf_name = uuid;
+ }
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
- goto done;
- }
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
+ goto done;
+ }
- /* Create the conference object. */
- conference = conference_new(conf_name, xml_cfg, pool);
+ /* Create the conference object. */
+ conference = conference_new(conf_name, xml_cfg, pool);
- if (!conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto done;
- }
+ if (!conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto done;
+ }
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- conference->min = 2;
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ conference->min = 2;
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
+ /* if the dialplan specified a pin, override the profile's value */
+ if (dpin) {
+ conference->pin = switch_core_strdup(conference->pool, dpin);
+ }
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(conference, CFLAG_DYNAMIC);
- /* Start the conference thread for this conference */
- launch_conference_thread(conference);
+ /* Start the conference thread for this conference */
+ launch_conference_thread(conference);
- } else {
- /* if the conference exists, get the pointer to it */
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- freepool = pool;
- /* couldn't find the conference, create one */
- } else {
- conference = conference_new(conf_name, xml_cfg, pool);
+ } else {
+ /* if the conference exists, get the pointer to it */
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ freepool = pool;
+ /* couldn't find the conference, create one */
+ } else {
+ conference = conference_new(conf_name, xml_cfg, pool);
- if (!conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto done;
- }
+ if (!conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto done;
+ }
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
+ /* if the dialplan specified a pin, override the profile's value */
+ if (dpin) {
+ conference->pin = switch_core_strdup(conference->pool, dpin);
+ }
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- conference->min = 1;
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ conference->min = 1;
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(conference, CFLAG_DYNAMIC);
- /* Start the conference thread for this conference */
- launch_conference_thread(conference);
- }
+ /* Start the conference thread for this conference */
+ launch_conference_thread(conference);
+ }
/* acquire a read lock on the thread so it can't leave without us */
if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -3424,214 +3498,214 @@
}
rl++;
- /* if this is not an outbound call, deal with conference pins */
- if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
- char pin_buf[80] = "";
- int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
- int pin_valid = 0;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ /* if this is not an outbound call, deal with conference pins */
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
+ char pin_buf[80] = "";
+ int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
+ int pin_valid = 0;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- /* Answer the channel */
- switch_channel_answer(channel);
+ /* Answer the channel */
+ switch_channel_answer(channel);
- while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
+ while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
- /* be friendly */
- if (conference->pin_sound) {
- conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
- }
- /* wait for them if neccessary */
- if (strlen(pin_buf) < strlen(conference->pin)) {
- char *buf = pin_buf + strlen(pin_buf);
- char term = '\0';
+ /* be friendly */
+ if (conference->pin_sound) {
+ conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+ }
+ /* wait for them if neccessary */
+ if (strlen(pin_buf) < strlen(conference->pin)) {
+ char *buf = pin_buf + strlen(pin_buf);
+ char term = '\0';
- status = switch_ivr_collect_digits_count(session,
- buf,
- sizeof(pin_buf) - (unsigned int)strlen(pin_buf),
- (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf),
- "#", &term, 10000);
- }
+ status = switch_ivr_collect_digits_count(session,
+ buf,
+ sizeof(pin_buf) - (unsigned int)strlen(pin_buf),
+ (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf),
+ "#", &term, 10000);
+ }
- pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
- if (!pin_valid) {
- /* zero the collected pin */
- memset(pin_buf,0,sizeof(pin_buf));
+ pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
+ if (!pin_valid) {
+ /* zero the collected pin */
+ memset(pin_buf, 0, sizeof(pin_buf));
- /* more friendliness */
- if (conference->bad_pin_sound) {
- conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
- }
- }
- pin_retries --;
- }
+ /* more friendliness */
+ if (conference->bad_pin_sound) {
+ conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
+ }
+ }
+ pin_retries --;
+ }
- if (!pin_valid) {
- goto done;
- }
- }
+ if (!pin_valid) {
+ goto done;
+ }
+ }
- /* don't allow more callers if the conference is locked, unless we invited them */
- if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
- if (conference->locked_sound) {
- /* Answer the channel */
- switch_channel_answer(channel);
- conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
- }
- goto done;
- }
- }
+ /* don't allow more callers if the conference is locked, unless we invited them */
+ if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
+ if (conference->locked_sound) {
+ /* Answer the channel */
+ switch_channel_answer(channel);
+ conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
+ }
+ goto done;
+ }
+ }
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
- /* if we're using "bridge:" make an outbound call and bridge it in */
- if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
- if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
- goto done;
- }
- } else {
- /* if we're not using "bridge:" set the conference answered flag */
- /* and this isn't an outbound channel, answer the call */
- if (!switch_channel_test_flag(channel, CF_OUTBOUND))
- switch_set_flag(conference, CFLAG_ANSWERED);
- }
+ /* if we're using "bridge:" make an outbound call and bridge it in */
+ if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
+ if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+ goto done;
+ }
+ } else {
+ /* if we're not using "bridge:" set the conference answered flag */
+ /* and this isn't an outbound channel, answer the call */
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND))
+ switch_set_flag(conference, CFLAG_ANSWERED);
+ }
- /* Save the original read codec. */
- read_codec = switch_core_session_get_read_codec(session);
- member.native_rate = read_codec->implementation->samples_per_second;
+ /* Save the original read codec. */
+ read_codec = switch_core_session_get_read_codec(session);
+ member.native_rate = read_codec->implementation->samples_per_second;
- /* Setup a Signed Linear codec for reading audio. */
- if (switch_core_codec_init(&member.read_codec,
- "L16",
- NULL,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- pool) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- flags = 0;
- goto done;
- }
+ /* Setup a Signed Linear codec for reading audio. */
+ if (switch_core_codec_init(&member.read_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL,
+ pool) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ flags = 0;
+ goto done;
+ }
- if (read_codec->implementation->samples_per_second != conference->rate) {
- switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
- &member.read_resampler : &member.mux_resampler;
+ if (read_codec->implementation->samples_per_second != conference->rate) {
+ switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
+ &member.read_resampler : &member.mux_resampler;
- switch_resample_create(resampler,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->samples_per_second * 20,
- conference->rate,
- conference->rate * 20,
- switch_core_session_get_pool(session));
+ switch_resample_create(resampler,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->samples_per_second * 20,
+ conference->rate,
+ conference->rate * 20,
+ switch_core_session_get_pool(session));
- /* Setup an audio buffer for the resampled audio */
- if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto done;
- }
- }
- /* Setup a Signed Linear codec for writing audio. */
- if (switch_core_codec_init(&member.write_codec,
- "L16",
- NULL,
- conference->rate,
- conference->interval,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- pool) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- flags = 0;
- goto codec_done2;
- }
+ /* Setup an audio buffer for the resampled audio */
+ if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto done;
+ }
+ }
+ /* Setup a Signed Linear codec for writing audio. */
+ if (switch_core_codec_init(&member.write_codec,
+ "L16",
+ NULL,
+ conference->rate,
+ conference->interval,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL,
+ pool) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ flags = 0;
+ goto codec_done2;
+ }
- /* Setup an audio buffer for the incoming audio */
- if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto codec_done1;
- }
+ /* Setup an audio buffer for the incoming audio */
+ if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto codec_done1;
+ }
- /* Setup an audio buffer for the outgoing audio */
- if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto codec_done1;
- }
+ /* Setup an audio buffer for the outgoing audio */
+ if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto codec_done1;
+ }
- /* Prepare MUTEXS */
- member.id = next_member_id();
- member.pool = pool;
- member.session = session;
- switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
- switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
- switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
+ /* Prepare MUTEXS */
+ member.id = next_member_id();
+ member.pool = pool;
+ member.session = session;
+ switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
+ switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
+ switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
- /* Install our Signed Linear codec so we get the audio in that format */
- switch_core_session_set_read_codec(member.session, &member.read_codec);
+ /* Install our Signed Linear codec so we get the audio in that format */
+ switch_core_session_set_read_codec(member.session, &member.read_codec);
- /* Add the caller to the conference */
- if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
- goto codec_done1;
- }
- switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
+ /* Add the caller to the conference */
+ if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
+ goto codec_done1;
+ }
+ switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
- msg.from = __FILE__;
+ msg.from = __FILE__;
- /* Tell the channel we are going to be in a bridge */
- msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
- switch_core_session_receive_message(session, &msg);
+ /* Tell the channel we are going to be in a bridge */
+ msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
+ switch_core_session_receive_message(session, &msg);
- /* Run the confernece loop */
- conference_loop_output(&member);
+ /* Run the confernece loop */
+ conference_loop_output(&member);
- /* Tell the channel we are no longer going to be in a bridge */
- msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
- switch_core_session_receive_message(session, &msg);
+ /* Tell the channel we are no longer going to be in a bridge */
+ msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
+ switch_core_session_receive_message(session, &msg);
- /* Remove the caller from the conference */
- conference_del_member(member.last_conference, &member);
+ /* Remove the caller from the conference */
+ conference_del_member(member.last_conference, &member);
- /* Put the original codec back */
- switch_core_session_set_read_codec(member.session, read_codec);
+ /* Put the original codec back */
+ switch_core_session_set_read_codec(member.session, read_codec);
- /* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
-codec_done1:
- switch_core_codec_destroy(&member.read_codec);
-codec_done2:
- switch_core_codec_destroy(&member.write_codec);
-done:
+ /* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
+ codec_done1:
+ switch_core_codec_destroy(&member.read_codec);
+ codec_done2:
+ switch_core_codec_destroy(&member.write_codec);
+ done:
- switch_buffer_destroy(&member.resample_buffer);
- switch_buffer_destroy(&member.audio_buffer);
- switch_buffer_destroy(&member.mux_buffer);
+ switch_buffer_destroy(&member.resample_buffer);
+ switch_buffer_destroy(&member.audio_buffer);
+ switch_buffer_destroy(&member.mux_buffer);
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- }
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ }
- if (freepool) {
- switch_core_destroy_memory_pool(&freepool);
- }
+ if (freepool) {
+ switch_core_destroy_memory_pool(&freepool);
+ }
- if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
- switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
- }
+ if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
+ switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
+ }
- switch_core_session_reset(session);
+ switch_core_session_reset(session);
/* release the readlock */
if (rl) {
@@ -3642,801 +3716,818 @@
/* Create a thread for the conference and launch it */
static void launch_conference_thread(conference_obj_t *conference)
{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
- switch_set_flag_locked(conference, CFLAG_RUNNING);
- switch_threadattr_create(&thd_attr, conference->pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_mutex_lock(globals.hash_mutex);
- switch_core_hash_insert(globals.conference_hash, conference->name, conference);
- switch_mutex_unlock(globals.hash_mutex);
- switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
+ switch_set_flag_locked(conference, CFLAG_RUNNING);
+ switch_threadattr_create(&thd_attr, conference->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_mutex_lock(globals.hash_mutex);
+ switch_core_hash_insert(globals.conference_hash, conference->name, conference);
+ switch_mutex_unlock(globals.hash_mutex);
+ switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
}
static void launch_conference_record_thread(conference_obj_t *conference, char *path)
{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
- switch_memory_pool_t *pool;
- conference_record_t *rec;
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+ switch_memory_pool_t *pool;
+ conference_record_t *rec;
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ }
- /* Create a node object*/
- if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- }
+ /* Create a node object*/
+ if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ }
- rec->conference = conference;
- rec->path = switch_core_strdup(pool, path);
- rec->pool = pool;
+ rec->conference = conference;
+ rec->path = switch_core_strdup(pool, path);
+ rec->pool = pool;
- switch_threadattr_create(&thd_attr, rec->pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
+ switch_threadattr_create(&thd_attr, rec->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
}
static const switch_application_interface_t conference_application_interface = {
- /*.interface_name */ global_app_name,
- /*.application_function */ conference_function,
- NULL, NULL, NULL,
- /*.next*/ NULL
+ /*.interface_name */ global_app_name,
+ /*.application_function */ conference_function,
+ NULL, NULL, NULL,
+ /*.next*/ NULL
};
static switch_api_interface_t conf_api_interface = {
- /*.interface_name */ "conference",
- /*.desc */ "Conference module commands",
- /*.function */ conf_api_main,
- /*.syntax */ /* see switch_module_load, this is built on the fly */
- /*.next */
+ /*.interface_name */ "conference",
+ /*.desc */ "Conference module commands",
+ /*.function */ conf_api_main,
+ /*.syntax */ /* see switch_module_load, this is built on the fly */
+ /*.next */
};
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
{
- char name[512] = "", *p, *lbuf;
- switch_chat_interface_t *ci;
- conference_obj_t *conference = NULL;
- switch_stream_handle_t stream = {0};
+ char name[512] = "", *p, *lbuf;
+ switch_chat_interface_t *ci;
+ conference_obj_t *conference = NULL;
+ switch_stream_handle_t stream = {0};
- if ((p = strchr(to, '+'))) {
- to = ++p;
- }
+ if ((p = strchr(to, '+'))) {
+ to = ++p;
+ }
- if (!body) {
- return SWITCH_STATUS_SUCCESS;
- }
+ if (!body) {
+ return SWITCH_STATUS_SUCCESS;
+ }
- if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
- }
+ if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
+ }
- if ((p = strchr(to, '@'))) {
- switch_copy_string(name, to, ++p-to);
- } else {
- switch_copy_string(name, to, sizeof(name));
- }
+ if ((p = strchr(to, '@'))) {
+ switch_copy_string(name, to, ++p-to);
+ } else {
+ switch_copy_string(name, to, sizeof(name));
+ }
- if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
- ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
- return SWITCH_STATUS_FALSE;
- }
+ if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
+ ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
+ return SWITCH_STATUS_FALSE;
+ }
- SWITCH_STANDARD_STREAM(stream);
+ SWITCH_STANDARD_STREAM(stream);
- if (body != NULL && (lbuf = strdup(body))) {
- int argc;
- char *argv[25];
+ if (body != NULL && (lbuf = strdup(body))) {
+ int argc;
+ char *argv[25];
- memset(argv,0,sizeof(argv));
- argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ memset(argv, 0, sizeof(argv));
+ argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- /* try to find a command to execute */
- if (argc) {
- /* special case list */
- if (strcasecmp(argv[0],"list") == 0) {
- conference_list_pretty(conference, &stream);
- /* provide help */
- } else if (strcasecmp(argv[0],"help") == 0 || strcasecmp(argv[0],"commands") == 0) {
- stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
- /* find a normal command */
- } else {
- conf_api_dispatch(conference, &stream, argc, argv, lbuf, 0);
- }
- } else {
- stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
- }
- }
- switch_safe_free(lbuf);
+ /* try to find a command to execute */
+ if (argc) {
+ /* special case list */
+ if (strcasecmp(argv[0], "list") == 0) {
+ conference_list_pretty(conference, &stream);
+ /* provide help */
+ }
+ else {
+ if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+ stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
+ /* find a normal command */
+ } else {
+ conf_api_dispatch(conference, &stream, argc, argv, (const char *)body, 0);
+ }
+ }
+ } else {
+ stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
+ }
+ }
+ switch_safe_free(lbuf);
- ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
- switch_safe_free(stream.data);
+ ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
+ switch_safe_free(stream.data);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static const switch_chat_interface_t conference_chat_interface = {
- /*.name */ CONF_CHAT_PROTO,
- /*.chat_send */ chat_send,
+ /*.name */ CONF_CHAT_PROTO,
+ /*.chat_send */ chat_send,
};
static switch_loadable_module_interface_t conference_module_interface = {
- /*.module_name */ modname,
- /*.endpoint_interface */ NULL,
- /*.timer_interface */ NULL,
- /*.dialplan_interface */ NULL,
- /*.codec_interface */ NULL,
- /*.application_interface */ &conference_application_interface,
- /*.api_interface */ &conf_api_interface,
- /*.file_interface */ NULL,
- /*.speech_interface */ NULL,
- /*.directory_interface */ NULL,
- /*.chat_interface */ &conference_chat_interface
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ &conference_application_interface,
+ /*.api_interface */ &conf_api_interface,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL,
+ /*.chat_interface */ &conference_chat_interface
};
#ifdef OPTION_IVR_MENU_SUPPORT
static switch_ivr_action_t conference_caller_control_menu_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
{
- switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
+ switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
- if (!switch_strlen_zero(param)) {
- if (obj != NULL) {
- int i,found;
- char *action_name = strdup(param);
+ if (!switch_strlen_zero(param)) {
+ if (obj != NULL) {
+ int i, found;
+ char *action_name = strdup(param);
- if (action_name != NULL) {
- char *sep = (action_name != NULL ? strchr(action_name,' ') : NULL);
+ if (action_name != NULL) {
+ char *sep = (action_name != NULL ? strchr(action_name, ' ') : NULL);
- /* split the action from any parameters */
- if (sep != NULL) {
- *sep ='\0';
- }
+ /* split the action from any parameters */
+ if (sep != NULL) {
+ *sep = '\0';
+ }
- /* find and execute the caller control handler */
- for(i=0,found=0; !found && i<CCFNTBL_QTY; i++) {
- found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key,action_name) == 0);
- if (found) {
- if (obj != NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "invoking caller control menu action '%s'\n",ccfntbl[i].key);
- ccfntbl[i].handler((conference_member_t *)obj, (sep != NULL ? sep+1 : NULL));
- if (ccfntbl[i].action == CALLER_CONTROL_HANGUP) {
- action = SWITCH_IVR_ACTION_DIE;
- }
- }
- }
- }
+ /* find and execute the caller control handler */
+ for(i = 0, found = 0; !found && i<CCFNTBL_QTY; i++) {
+ found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key, action_name) == 0);
+ if (found) {
+ if (obj != NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "invoking caller control menu action '%s'\n", ccfntbl[i].key);
+ ccfntbl[i].handler((conference_member_t *)obj, (sep != NULL ? sep+1 : NULL));
+ if (ccfntbl[i].action == CALLER_CONTROL_HANGUP) {
+ action = SWITCH_IVR_ACTION_DIE;
+ }
+ }
+ }
+ }
- free(action_name);
- }
+ free(action_name);
+ }
- if (!found) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown caller control menu action '%s'\n",param);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to invoke caller control menu action '%s', NULL member!\n",param);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL or empty param!\n");
- }
+ if (!found) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown caller control menu action '%s'\n", param);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to invoke caller control menu action '%s', NULL member!\n", param);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL or empty param!\n");
+ }
- return action;
+ return action;
}
/*
-static switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
-{
- switch_status_t status;
+ static switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
+ {
+ switch_status_t status;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_play_file\n");
- status = conference_member_play_file((conference_member_t *)member, file, leadin);
- if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ivr_menu_callback_play_file ERROR\n");
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_play_file\n");
+ status = conference_member_play_file((conference_member_t *)member, file, leadin);
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ivr_menu_callback_play_file ERROR\n");
+ }
- return status;
-}
+ return status;
+ }
-static switch_status_t ivr_menu_callback_say(char *file, uint32_t leadin, void *member)
-{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_say\n");
- return conference_member_say((conference_member_t *)member, file, leadin);
-}
+ static switch_status_t ivr_menu_callback_say(char *file, uint32_t leadin, void *member)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_say\n");
+ return conference_member_say((conference_member_t *)member, file, leadin);
+ }
*/
-static switch_status_t conference_caller_control_menu_build(caller_control_menu_ctx_t **ctx, conference_obj_t *conference, switch_xml_t menu_group, char *menu_name)
+static switch_status_t conference_caller_control_menu_build(caller_control_menu_ctx_t **ctx,
+ conference_obj_t *conference,
+ switch_xml_t menu_group,
+ char *menu_name)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_xml_t xml_menus;
+ switch_xml_t xml_menu;
- if (ctx != NULL && conference != NULL && menu_group != NULL && menu_name != NULL) {
- switch_xml_t xml_menus = switch_xml_child(menu_group, "menus");
- switch_xml_t xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
+ assert(conference != NULL);
+ assert(ctx != NULL);
+ assert(menu_group != NULL);
+ assert(menu_name != NULL);
+ assert(xml_menus != NULL);
- /* if we found the requested menu in our menu_group */
- if (xml_menu != NULL && xml_menu != NULL) {
- *ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool,sizeof(caller_control_menu_ctx_t));
+ xml_menus = switch_xml_child(menu_group, "menus");
+ xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
- if (*ctx != NULL) {
- memset(*ctx,0,sizeof(caller_control_menu_ctx_t));
- /* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
- status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
- if (status == SWITCH_STATUS_SUCCESS) {
- (*ctx)->name = switch_core_strdup(conference->pool,menu_name);
- /* add our xml menu handler to the xml stack parser */
- status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
- if (status != SWITCH_STATUS_SUCCESS)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
+ /* if we found the requested menu in our menu_group */
+ if (xml_menu != NULL && xml_menu != NULL) {
+ *ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool, sizeof(caller_control_menu_ctx_t));
- /* parse the xml stack to build the menu stack */
- status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
- if (status != SWITCH_STATUS_SUCCESS)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
+ if (*ctx != NULL) {
+ memset(*ctx, 0, sizeof(caller_control_menu_ctx_t));
-/*
- // instruct ivr menu to use our file play and tts routines
- status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
- if (status != SWITCH_STATUS_SUCCESS)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
- status = switch_ivr_menu_set_tts_callback((*ctx)->menu_stack, &ivr_menu_callback_say);
- if (status != SWITCH_STATUS_SUCCESS)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set tts calback\n");
-*/
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to init xml menu context\n");
- }
- if (status != SWITCH_STATUS_SUCCESS)
- *ctx = NULL;
- }
- } else {
- if(xml_menus == NULL)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menus\n");
- if(xml_menu == NULL)
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menu '%s'\n",menu_name);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "null parameters!\n");
- }
+ /* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
+ status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
+ if (status == SWITCH_STATUS_SUCCESS) {
+ (*ctx)->name = switch_core_strdup(conference->pool, menu_name);
- return status;
+ /* add our xml menu handler to the xml stack parser */
+ status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
+
+ /* parse the xml stack to build the menu stack */
+ status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
+
+ /*
+ // instruct ivr menu to use our file play and tts routines
+ status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
+ status = switch_ivr_menu_set_tts_callback((*ctx)->menu_stack, &ivr_menu_callback_say);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set tts calback\n");
+ */
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to init xml menu context\n");
+ }
+ if (status != SWITCH_STATUS_SUCCESS)
+ *ctx = NULL;
+ }
+ } else {
+ if (xml_menus == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menus\n");
+ if (xml_menu == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menu '%s'\n", menu_name);
+ }
+
+ return status;
}
#endif
-static switch_status_t conference_new_install_caller_controls_default(conference_obj_t *conference)
+static switch_status_t conf_default_controls(conference_obj_t *conference)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ uint32_t i;
+ caller_control_action_t *action;
- if(conference != NULL) {
- int i;
- caller_control_action_t *action;
+ assert(conference != NULL);
- for(i=0,status=SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<CCFNTBL_QTY; i++) {
- if (!switch_strlen_zero(ccfntbl[i].digits)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing default caller control action '%s' bound to '%s'.\n",
- ccfntbl[i].key,
- ccfntbl[i].digits);
- action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
- if (action != NULL) {
- action->fndesc = &ccfntbl[i];
- action->data = NULL;
- status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,ccfntbl[i].digits,action);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",ccfntbl[i].key,ccfntbl[i].digits);
- status = SWITCH_STATUS_MEMERR;
- }
- }
- }
- }
+ for(i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<CCFNTBL_QTY; i++) {
+ if (!switch_strlen_zero(ccfntbl[i].digits)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing default caller control action '%s' bound to '%s'.\n",
+ ccfntbl[i].key,
+ ccfntbl[i].digits);
+ action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+ if (action != NULL) {
+ action->fndesc = &ccfntbl[i];
+ action->data = NULL;
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, ccfntbl[i].digits, action);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",
+ ccfntbl[i].key, ccfntbl[i].digits);
+ status = SWITCH_STATUS_MEMERR;
+ }
+ }
+ }
+
- return status;
+ return status;
}
static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t *conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_xml_t xml_kvp;
- if (conference != NULL && xml_controls != NULL) {
- switch_xml_t xml_kvp;
+ assert(conference != NULL);
+ assert(xml_controls != NULL);
- /* parse the controls tree for caller control digit strings */
- for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
- char *key = (char *) switch_xml_attr(xml_kvp, "action");
- char *val = (char *) switch_xml_attr(xml_kvp, "digits");
- char *data = (char *)switch_xml_attr_soft(xml_kvp, "data");
+ /* parse the controls tree for caller control digit strings */
+ for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
+ char *key = (char *) switch_xml_attr(xml_kvp, "action");
+ char *val = (char *) switch_xml_attr(xml_kvp, "digits");
+ char *data = (char *)switch_xml_attr_soft(xml_kvp, "data");
- if(!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
- int i;
+ if (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
+ uint32_t i;
- /* scan through all of the valid actions, and if found, */
- /* set the new caller control action digit string, then */
- /* stop scanning the table, and go to the next xml kvp. */
- for(i=0,status=SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
+ /* scan through all of the valid actions, and if found, */
+ /* set the new caller control action digit string, then */
+ /* stop scanning the table, and go to the next xml kvp. */
+ for(i = 0, status = SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
- if(strcasecmp(ccfntbl[i].key,key) == 0) {
- status = SWITCH_STATUS_SUCCESS;
+ if (strcasecmp(ccfntbl[i].key, key) == 0) {
+ status = SWITCH_STATUS_SUCCESS;
#ifdef OPTION_IVR_MENU_SUPPORT
- if (xml_menus != NULL && ccfntbl[i].action == CALLER_CONTROL_MENU) {
- char *menu_group_name = strdup(data);
- char *menu_name = (menu_group_name != NULL ? strchr(menu_group_name,'/') : NULL);
+ if (xml_menus != NULL && ccfntbl[i].action == CALLER_CONTROL_MENU) {
+ char *menu_group_name = strdup(data);
+ char *menu_name = (menu_group_name != NULL ? strchr(menu_group_name, '/') : NULL);
- /* format: "menu_group_name/menu_name" */
- /* separate the menu name from the menu group */
- if (menu_name != NULL) {
- *(menu_name++) = '\0';
- }
- /* if there is a menu name, build the menu */
- if (menu_name != NULL) {
- caller_control_menu_ctx_t *menu_ctx = NULL;
- switch_xml_t menu_group = switch_xml_find_child(xml_menus, "group", "name", menu_group_name);
+ /* format: "menu_group_name/menu_name" */
+ /* separate the menu name from the menu group */
+ if (menu_name != NULL) {
+ *(menu_name++) = '\0';
+ }
+ /* if there is a menu name, build the menu */
+ if (menu_name != NULL) {
+ caller_control_menu_ctx_t *menu_ctx = NULL;
+ switch_xml_t menu_group = switch_xml_find_child(xml_menus, "group", "name", menu_group_name);
- status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
- data = (char *)menu_ctx;
- } else {
- status = SWITCH_STATUS_FALSE;
- }
+ status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
+ data = (char *)menu_ctx;
+ } else {
+ status = SWITCH_STATUS_FALSE;
+ }
- if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build menu '%s' bound to '%s'\n",data,val);
- }
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build menu '%s' bound to '%s'\n", data, val);
+ }
- /* clean up */
- if (menu_group_name != NULL) {
- free(menu_group_name);
- }
- }
+ /* clean up */
+ if (menu_group_name != NULL) {
+ free(menu_group_name);
+ }
+ }
#endif
- if (status == SWITCH_STATUS_SUCCESS) {
- caller_control_action_t *action;
+ if (status == SWITCH_STATUS_SUCCESS) {
+ caller_control_action_t *action;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n",key,val);
- action = (caller_control_action_t *)switch_core_alloc(conference->pool,sizeof(caller_control_action_t));
- if (action != NULL) {
- action->fndesc = &ccfntbl[i];
- action->data = (void *)data;
- status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser,val,action);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",ccfntbl[i].key,ccfntbl[i].digits);
- status = SWITCH_STATUS_MEMERR;
- }
- }
- }
- }
- if(status == SWITCH_STATUS_NOOP) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n",key);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action='%s' digits='%s'\n",key,val);
- }
- }
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n", key, val);
+ action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+ if (action != NULL) {
+ action->fndesc = &ccfntbl[i];
+ action->data = (void *)data;
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, val, action);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits);
+ status = SWITCH_STATUS_MEMERR;
+ }
+ }
+ }
+ }
+ if (status == SWITCH_STATUS_NOOP) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n", key);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val);
+ }
+ }
- return status;
+ return status;
}
/* create a new conferene with a specific profile */
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
{
- conference_obj_t *conference;
- switch_xml_t xml_kvp;
- char *rate_name = NULL;
- char *interval_name = NULL;
- char *timer_name = NULL;
- char *domain = NULL;
- char *tts_engine = NULL;
- char *tts_voice = NULL;
- char *enter_sound = NULL;
- char *exit_sound = NULL;
- char *alone_sound = NULL;
- char *ack_sound = NULL;
- char *nack_sound = NULL;
- char *muted_sound = NULL;
- char *unmuted_sound = NULL;
- char *locked_sound = NULL;
- char *kicked_sound = NULL;
- char *pin = NULL;
- char *pin_sound = NULL;
- char *bad_pin_sound = NULL;
- char *energy_level = NULL;
- char *caller_id_name = NULL;
- char *caller_id_number = NULL;
- char *caller_controls = NULL;
- uint32_t rate = 8000, interval = 20;
- switch_status_t status;
+ conference_obj_t *conference;
+ switch_xml_t xml_kvp;
+ char *rate_name = NULL;
+ char *interval_name = NULL;
+ char *timer_name = NULL;
+ char *domain = NULL;
+ char *tts_engine = NULL;
+ char *tts_voice = NULL;
+ char *enter_sound = NULL;
+ char *exit_sound = NULL;
+ char *alone_sound = NULL;
+ char *ack_sound = NULL;
+ char *nack_sound = NULL;
+ char *muted_sound = NULL;
+ char *unmuted_sound = NULL;
+ char *locked_sound = NULL;
+ char *kicked_sound = NULL;
+ char *pin = NULL;
+ char *pin_sound = NULL;
+ char *bad_pin_sound = NULL;
+ char *energy_level = NULL;
+ char *caller_id_name = NULL;
+ char *caller_id_number = NULL;
+ char *caller_controls = NULL;
+ uint32_t rate = 8000, interval = 20;
+ switch_status_t status;
- /* Validate the conference name */
- if (switch_strlen_zero(name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
- return NULL;
- }
+ /* Validate the conference name */
+ if (switch_strlen_zero(name)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
+ return NULL;
+ }
- /* parse the profile tree for param values */
- for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
- char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
- char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
- char buf[128] = "";
- char *p;
+ /* parse the profile tree for param values */
+ for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
+ char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
+ char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
+ char buf[128] = "";
+ char *p;
- if ((p = strchr(var, '_'))) {
- switch_copy_string(buf, var, sizeof(buf));
- for(p = buf; *p; p++) {
- if (*p == '_') {
- *p = '-';
- }
- }
- var = buf;
- }
+ if ((p = strchr(var, '_'))) {
+ switch_copy_string(buf, var, sizeof(buf));
+ for(p = buf; *p; p++) {
+ if (*p == '_') {
+ *p = '-';
+ }
+ }
+ var = buf;
+ }
- if (!strcasecmp(var, "rate")) {
- rate_name = val;
- } else if (!strcasecmp(var, "domain")) {
- domain = val;
- } else if (!strcasecmp(var, "interval")) {
- interval_name= val;
- } else if (!strcasecmp(var, "timer-name")) {
- timer_name= val;
- } else if (!strcasecmp(var, "tts-engine")) {
- tts_engine= val;
- } else if (!strcasecmp(var, "tts-voice")) {
- tts_voice= val;
- } else if (!strcasecmp(var, "enter-sound")) {
- enter_sound = val;
- } else if (!strcasecmp(var, "exit-sound")) {
- exit_sound = val;
- } else if (!strcasecmp(var, "alone-sound")) {
- alone_sound = val;
- } else if (!strcasecmp(var, "ack-sound")) {
- ack_sound = val;
- } else if (!strcasecmp(var, "nack-sound")) {
- nack_sound = val;
- } else if (!strcasecmp(var, "muted-sound")) {
- muted_sound = val;
- } else if (!strcasecmp(var, "unmuted-sound")) {
- unmuted_sound = val;
- } else if (!strcasecmp(var, "locked-sound")) {
- locked_sound= val;
- } else if (!strcasecmp(var, "kicked-sound")) {
- kicked_sound = val;
- } else if (!strcasecmp(var, "pin")) {
- pin = val;
- } else if (!strcasecmp(var, "pin-sound")) {
- pin_sound = val;
- } else if (!strcasecmp(var, "bad-pin-sound")) {
- bad_pin_sound = val;
- } else if (!strcasecmp(var, "energy-level")) {
- energy_level = val;
- } else if (!strcasecmp(var, "caller-id-name")) {
- caller_id_name = val;
- } else if (!strcasecmp(var, "caller-id-number")) {
- caller_id_number = val;
- } else if (!strcasecmp(var, "caller-controls")) {
- caller_controls = val;
- }
- }
+ if (!strcasecmp(var, "rate")) {
+ rate_name = val;
+ } else if (!strcasecmp(var, "domain")) {
+ domain = val;
+ } else if (!strcasecmp(var, "interval")) {
+ interval_name = val;
+ } else if (!strcasecmp(var, "timer-name")) {
+ timer_name = val;
+ } else if (!strcasecmp(var, "tts-engine")) {
+ tts_engine = val;
+ } else if (!strcasecmp(var, "tts-voice")) {
+ tts_voice = val;
+ } else if (!strcasecmp(var, "enter-sound")) {
+ enter_sound = val;
+ } else if (!strcasecmp(var, "exit-sound")) {
+ exit_sound = val;
+ } else if (!strcasecmp(var, "alone-sound")) {
+ alone_sound = val;
+ } else if (!strcasecmp(var, "ack-sound")) {
+ ack_sound = val;
+ } else if (!strcasecmp(var, "nack-sound")) {
+ nack_sound = val;
+ } else if (!strcasecmp(var, "muted-sound")) {
+ muted_sound = val;
+ } else if (!strcasecmp(var, "unmuted-sound")) {
+ unmuted_sound = val;
+ } else if (!strcasecmp(var, "locked-sound")) {
+ locked_sound = val;
+ } else if (!strcasecmp(var, "kicked-sound")) {
+ kicked_sound = val;
+ } else if (!strcasecmp(var, "pin")) {
+ pin = val;
+ } else if (!strcasecmp(var, "pin-sound")) {
+ pin_sound = val;
+ } else if (!strcasecmp(var, "bad-pin-sound")) {
+ bad_pin_sound = val;
+ } else if (!strcasecmp(var, "energy-level")) {
+ energy_level = val;
+ } else if (!strcasecmp(var, "caller-id-name")) {
+ caller_id_name = val;
+ } else if (!strcasecmp(var, "caller-id-number")) {
+ caller_id_number = val;
+ } else if (!strcasecmp(var, "caller-controls")) {
+ caller_controls = val;
+ }
+ }
- /* Set defaults and various paramaters */
+ /* Set defaults and various paramaters */
- /* Speed in hertz */
- if (!switch_strlen_zero(rate_name)) {
- uint32_t r = atoi(rate_name);
- if (r) {
- rate = r;
- }
- }
+ /* Speed in hertz */
+ if (!switch_strlen_zero(rate_name)) {
+ uint32_t r = atoi(rate_name);
+ if (r) {
+ rate = r;
+ }
+ }
- /* Packet Interval in milliseconds */
- if (!switch_strlen_zero(interval_name)) {
- uint32_t i = atoi(interval_name);
- if (i) {
- interval = i;
- }
- }
+ /* Packet Interval in milliseconds */
+ if (!switch_strlen_zero(interval_name)) {
+ uint32_t i = atoi(interval_name);
+ if (i) {
+ interval = i;
+ }
+ }
- /* Timer module to use */
- if (switch_strlen_zero(timer_name)) {
- timer_name = "soft";
- }
+ /* Timer module to use */
+ if (switch_strlen_zero(timer_name)) {
+ timer_name = "soft";
+ }
- /* Caller ID Name */
- if (switch_strlen_zero(caller_id_name)) {
- caller_id_name = (char *) global_app_name;
- }
+ /* Caller ID Name */
+ if (switch_strlen_zero(caller_id_name)) {
+ caller_id_name = (char *) global_app_name;
+ }
- /* Caller ID Number */
- if (switch_strlen_zero(caller_id_number)) {
- caller_id_number = "0000000000";
- }
+ /* Caller ID Number */
+ if (switch_strlen_zero(caller_id_number)) {
+ caller_id_number = "0000000000";
+ }
- if (!pool) {
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- status = SWITCH_STATUS_TERM;
- return NULL;
- }
- }
+ if (!pool) {
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ status = SWITCH_STATUS_TERM;
+ return NULL;
+ }
+ }
- /* Create the conference object. */
- if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- status = SWITCH_STATUS_TERM;
- return NULL;
- }
+ /* Create the conference object. */
+ if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ status = SWITCH_STATUS_TERM;
+ return NULL;
+ }
- /* initialize the conference object with settings from the specified profile */
- conference->pool = pool;
- conference->timer_name = switch_core_strdup(conference->pool, timer_name);
- conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
- conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
+ /* initialize the conference object with settings from the specified profile */
+ conference->pool = pool;
+ conference->timer_name = switch_core_strdup(conference->pool, timer_name);
+ conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
+ conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
- conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
- conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
+ conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
+ conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
- if (!switch_strlen_zero(enter_sound)) {
- conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
- }
+ if (!switch_strlen_zero(enter_sound)) {
+ conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
+ }
- if (!switch_strlen_zero(exit_sound)) {
- conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
- }
+ if (!switch_strlen_zero(exit_sound)) {
+ conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
+ }
- if (!switch_strlen_zero(ack_sound)) {
- conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
- }
+ if (!switch_strlen_zero(ack_sound)) {
+ conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
+ }
- if (!switch_strlen_zero(nack_sound)) {
- conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
- }
+ if (!switch_strlen_zero(nack_sound)) {
+ conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
+ }
- if (!switch_strlen_zero(muted_sound)) {
- conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
- }
+ if (!switch_strlen_zero(muted_sound)) {
+ conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
+ }
- if (!switch_strlen_zero(unmuted_sound)) {
- conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
- }
+ if (!switch_strlen_zero(unmuted_sound)) {
+ conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
+ }
- if (!switch_strlen_zero(kicked_sound)) {
- conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
- }
+ if (!switch_strlen_zero(kicked_sound)) {
+ conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
+ }
- if (!switch_strlen_zero(pin_sound)) {
- conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
- }
+ if (!switch_strlen_zero(pin_sound)) {
+ conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
+ }
- if (!switch_strlen_zero(bad_pin_sound)) {
- conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
- }
+ if (!switch_strlen_zero(bad_pin_sound)) {
+ conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
+ }
- if (!switch_strlen_zero(pin)) {
- conference->pin = switch_core_strdup(conference->pool, pin);
- }
+ if (!switch_strlen_zero(pin)) {
+ conference->pin = switch_core_strdup(conference->pool, pin);
+ }
- if (!switch_strlen_zero(alone_sound)) {
- conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
- }
+ if (!switch_strlen_zero(alone_sound)) {
+ conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
+ }
- if (!switch_strlen_zero(locked_sound)) {
- conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
- }
+ if (!switch_strlen_zero(locked_sound)) {
+ conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
+ }
- if (!switch_strlen_zero(energy_level)) {
- conference->energy_level = atoi(energy_level);
- }
+ if (!switch_strlen_zero(energy_level)) {
+ conference->energy_level = atoi(energy_level);
+ }
- conference->name = switch_core_strdup(conference->pool, name);
- if (domain) {
- conference->domain = switch_core_strdup(conference->pool, domain);
- } else {
- conference->domain = "cluecon.com";
- }
- conference->rate = rate;
- conference->interval = interval;
- conference->dtmf_parser = NULL;
+ conference->name = switch_core_strdup(conference->pool, name);
+ if (domain) {
+ conference->domain = switch_core_strdup(conference->pool, domain);
+ } else {
+ conference->domain = "cluecon.com";
+ }
+ conference->rate = rate;
+ conference->interval = interval;
+ conference->dtmf_parser = NULL;
- /* caller control configuration chores */
- if(switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
+ /* caller control configuration chores */
+ if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
- /* if no controls, or default controls specified, install default */
- if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) {
- status = conference_new_install_caller_controls_default(conference);
- } else if (strcasecmp(caller_controls,"none") != 0) {
- /* try to build caller control if the group has been specified and != "none" */
- switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls);
+ /* if no controls, or default controls specified, install default */
+ if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) {
+ status = conf_default_controls(conference);
+ } else if (strcasecmp(caller_controls, "none") != 0) {
+ /* try to build caller control if the group has been specified and != "none" */
+ switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls);
#ifdef OPTION_IVR_MENU_SUPPORT
- status = conference_new_install_caller_controls_custom(conference, xml_controls, cfg.menus);
+ status = conference_new_install_caller_controls_custom(conference, xml_controls, cfg.menus);
#else
- status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
+ status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
#endif
- if (status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n",caller_controls);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
- }
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", caller_controls);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
+ }
- /* Activate the conference mutex for exclusivity */
- switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_thread_rwlock_create(&conference->rwlock, conference->pool);
+ /* Activate the conference mutex for exclusivity */
+ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_thread_rwlock_create(&conference->rwlock, conference->pool);
- return conference;
+ return conference;
}
static void pres_event_handler(switch_event_t *event)
{
- char *to = switch_event_get_header(event, "to");
- char *dup_to = NULL, *conf_name, *e;
- conference_obj_t *conference;
+ char *to = switch_event_get_header(event, "to");
+ char *dup_to = NULL, *conf_name, *e;
+ conference_obj_t *conference;
- if (!to || strncasecmp(to, "conf+", 5)) {
- return;
- }
+ if (!to || strncasecmp(to, "conf+", 5)) {
+ return;
+ }
- if (!(dup_to = strdup(to))) {
- return;
- }
+ if (!(dup_to = strdup(to))) {
+ return;
+ }
- conf_name = dup_to + 5;
+ conf_name = dup_to + 5;
- if ((e = strchr(conf_name, '@'))) {
- *e = '\0';
- }
+ if ((e = strchr(conf_name, '@'))) {
+ *e = '\0';
+ }
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- switch_event_t *event;
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ switch_event_t *event;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
- } else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
+ } else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
switch_safe_free(dup_to);
}
static void send_presence(switch_event_types_t id)
{
- switch_xml_t cxml, cfg, advertise, room;
+ switch_xml_t cxml, cfg, advertise, room;
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
- if ((advertise = switch_xml_child(cfg, "advertise"))) {
- for (room = switch_xml_child(advertise, "room"); room; room = room->next) {
- char *name = (char *) switch_xml_attr_soft(room, "name");
- char *status = (char *) switch_xml_attr_soft(room, "status");
- switch_event_t *event;
+ if ((advertise = switch_xml_child(cfg, "advertise"))) {
+ for (room = switch_xml_child(advertise, "room"); room; room = room->next) {
+ char *name = (char *) switch_xml_attr_soft(room, "name");
+ char *status = (char *) switch_xml_attr_soft(room, "status");
+ switch_event_t *event;
- if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
- }
- }
+ if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
+ }
+ }
- done:
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+ done:
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
}
- /* Called by FreeSWITCH when the module loads */
+/* Called by FreeSWITCH when the module loads */
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
- int i;
- size_t nl,ol=0;
- char *p = NULL;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ uint32_t i;
+ size_t nl, ol = 0;
+ char *p = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- memset(&globals, 0, sizeof(globals));
+ memset(&globals, 0, sizeof(globals));
- /* build api interface help ".syntax" field string */
- p=strdup("list\n");
- for (i=0; i<CONFFUNCAPISIZE; i++) {
- nl=strlen(conf_api_sub_commands[i].psyntax)+4;
- if(p != NULL)
- ol = strlen(p);
- p = realloc(p,ol+nl);
- if(p != NULL) {
- strcat(p,"\t\t");
- strcat(p,conf_api_sub_commands[i].psyntax);
- if(i<CONFFUNCAPISIZE-1)
- strcat(p,"\n");
- }
+ /* build api interface help ".syntax" field string */
+ p = strdup("");
+ for (i = 0; i<CONFFUNCAPISIZE; i++) {
+ nl = strlen(conf_api_sub_commands[i].psyntax) + 4;
+ if (p != NULL) {
+ ol = strlen(p);
+ }
+ p = realloc(p, ol+nl);
+ if (p != NULL) {
+ strcat(p, "\t\t");
+ strcat(p, conf_api_sub_commands[i].psyntax);
+ if (i < CONFFUNCAPISIZE-1) {
+ strcat(p, "\n");
+ }
+ }
- }
- /* install api interface help ".syntax" field string */
- if(p != NULL)
- conf_api_interface.syntax = p;
+ }
+ /* install api interface help ".syntax" field string */
+ if (p != NULL) {
+ conf_api_interface.syntax = p;
+ }
- /* Connect my internal structure to the blank pointer passed to me */
- *module_interface = &conference_module_interface;
+ /* Connect my internal structure to the blank pointer passed to me */
+ *module_interface = &conference_module_interface;
- /* create/register custom event message type */
- if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
- return SWITCH_STATUS_TERM;
- }
+ /* create/register custom event message type */
+ if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
+ return SWITCH_STATUS_TERM;
+ }
- /* Setup the pool */
- if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
- return SWITCH_STATUS_TERM;
- }
+ /* Setup the pool */
+ if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
+ return SWITCH_STATUS_TERM;
+ }
- /* Setup a hash to store conferences by name */
- switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
- switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
- switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
- switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+ /* Setup a hash to store conferences by name */
+ switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
+ switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+ switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+ switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
- /* Subscribe to presence request events */
- if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
- return SWITCH_STATUS_GENERR;
- }
+ /* Subscribe to presence request events */
+ if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
+ return SWITCH_STATUS_GENERR;
+ }
- send_presence(SWITCH_EVENT_PRESENCE_IN);
+ send_presence(SWITCH_EVENT_PRESENCE_IN);
- globals.running = 1;
- /* indicate that the module should continue to be loaded */
- return status;
+ globals.running = 1;
+ /* indicate that the module should continue to be loaded */
+ return status;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{
+ if (globals.running) {
+ /* signal all threads to shutdown */
+ globals.running = 0;
- if (globals.running) {
- /* signal all threads to shutdown */
- globals.running = 0;
- /* wait for all threads */
- while (globals.threads) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
- switch_yield(100000);
- }
+ /* wait for all threads */
+ while (globals.threads) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
+ switch_yield(100000);
+ }
- /* free api interface help ".syntax" field string */
- if (conf_api_interface.syntax != NULL)
- free((char *)conf_api_interface.syntax);
- }
+ /* free api interface help ".syntax" field string */
+ if (conf_api_interface.syntax != NULL) {
+ free((char *)conf_api_interface.syntax);
+ }
+ }
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
@@ -4447,5 +4538,5 @@
* c-basic-offset:4
* End:
* For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop = 4 shiftwidth = 4 tabstop = 4 expandtab:
*/
Modified: freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c Sat Dec 23 00:27:43 2006
@@ -150,11 +150,19 @@
for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
char *application = (char*) switch_xml_attr_soft(xaction, "application");
char *data = (char *) switch_xml_attr_soft(xaction, "data");
- char substituted[1024] = "";
+ char *substituted = NULL;
+ uint32_t len = 0;
char *app_data = NULL;
if (field && strchr(expression, '(')) {
- switch_perform_substitution(re, proceed, data, field_data, substituted, sizeof(substituted), ovector);
+ len = (uint32_t)(strlen(data) + strlen(field_data) + 10);
+ if (!(substituted = malloc(len))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+ proceed = 0;
+ goto done;
+ }
+ memset(substituted, 0, len);
+ switch_perform_substitution(re, proceed, data, field_data, substituted, len, ovector);
app_data = substituted;
} else {
app_data = data;
@@ -170,6 +178,7 @@
}
switch_caller_extension_add_application(session, *extension, application, app_data);
+ switch_safe_free(substituted);
}
switch_clean_re(re);
Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Sat Dec 23 00:27:43 2006
@@ -1280,17 +1280,19 @@
}
if (tech_pvt->read_frame.datalen > 0) {
- if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
- bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
- frames = (tech_pvt->read_frame.datalen / bytes);
- } else {
- frames = 1;
- }
- samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
- ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
- tech_pvt->timestamp_recv += (int32_t) samples;
- tech_pvt->read_frame.samples = (int) samples;
- tech_pvt->last_read = tech_pvt->read_frame.datalen;
+ if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+ if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame && bytes) {
+ bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+ frames = (tech_pvt->read_frame.datalen / bytes);
+ } else {
+ frames = 1;
+ }
+ samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
+ ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
+ tech_pvt->timestamp_recv += (int32_t) samples;
+ tech_pvt->read_frame.samples = (int) samples;
+ tech_pvt->last_read = tech_pvt->read_frame.datalen;
+ }
break;
}
Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sat Dec 23 00:27:43 2006
@@ -1614,9 +1614,12 @@
size_t bytes = 0;
int frames = 0;
//tech_pvt->last_read = switch_time_now();
- bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
- frames = (tech_pvt->read_frame.datalen / bytes);
- tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+ if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+ if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
+ frames = (tech_pvt->read_frame.datalen / bytes);
+ tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+ }
+ }
break;
}
}
Modified: freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Sat Dec 23 00:27:43 2006
@@ -415,7 +415,9 @@
if (stream.data) {
if (switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
-
+ if (!stream.data) {
+ stream.write_function(&stream, "Command returned no output!\n");
+ }
if (acs->bg) {
switch_event_t *event;
Modified: freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj (original)
+++ freeswitch/branches/knhor/trunk/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\iksemel-1.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\iksemel\include""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -126,7 +126,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\iksemel-1.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\iksemel\include""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sat Dec 23 00:27:43 2006
@@ -1592,7 +1592,7 @@
/*********************************************************************************/
enum session_tinyid {
SESSION_NAME, SESSION_STATE,
- PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST
+ PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST, SESSION_UUID
};
static JSFunctionSpec session_methods[] = {
@@ -1627,6 +1627,7 @@
{"ani", PROFILE_ANI, JSPROP_READONLY|JSPROP_PERMANENT},
{"aniii", PROFILE_ANI_II, JSPROP_READONLY|JSPROP_PERMANENT},
{"destination", PROFILE_DEST, JSPROP_READONLY|JSPROP_PERMANENT},
+ {"uuid", SESSION_UUID, JSPROP_READONLY|JSPROP_PERMANENT},
{0}
};
@@ -1660,6 +1661,9 @@
case SESSION_NAME:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_name(channel)));
break;
+ case SESSION_UUID:
+ *vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_uuid(channel)));
+ break;
case SESSION_STATE:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_state_name(switch_channel_get_state(channel))));
break;
@@ -2254,7 +2258,9 @@
JS_DefineFunctions(cx, javascript_object, fs_functions);
JS_InitStandardClasses(cx, javascript_object);
-
+
+ /* this doesnt load in standard classes figure out wtf */
+ js_InitFileClass(cx, javascript_object);
JS_InitClass(cx,
javascript_object,
Modified: freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c Sat Dec 23 00:27:43 2006
@@ -223,7 +223,7 @@
{0}
};
-switch_status_t spidermonkey_load(JSContext *cx, JSObject *obj)
+switch_status_t etpan_load(JSContext *cx, JSObject *obj)
{
JS_DefineFunctions(cx, obj, etpan_functions);
@@ -244,7 +244,7 @@
const sm_module_interface_t etpan_module_interface = {
/*.name = */ modname,
- /*.spidermonkey_load*/ spidermonkey_load,
+ /*.spidermonkey_load*/ etpan_load,
/*.next*/ NULL
};
Modified: freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/say/mod_say_en/mod_say_en.c Sat Dec 23 00:27:43 2006
@@ -30,46 +30,84 @@
*/
#include <switch.h>
#include <math.h>
+#include <ctype.h>
static const char modname[] = "mod_say_en";
-typedef struct {
- switch_core_session_t *session;
- switch_input_callback_function_t input_callback;
- void *buf;
- uint32_t buflen;
-} common_args_t;
-static void play_group(int a, int b, int c, char *what, common_args_t *args)
+#define say_num(num) {\
+ 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) {\
+ 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); \
+ if (!switch_channel_ready(switch_core_session_get_channel(session))) {\
+ return SWITCH_STATUS_FALSE;\
+ }}\
+
+
+
+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 tmp[80] = "";
+ char *p;
+ for(p = tosay; p && *p; p++) {
+ int a = tolower((int) *p);
+ if (type == SST_NAME_SPELLED) {
+ say_file("ascii/%d.wav", a);
+ } else if (type == SST_NAME_PHONETIC) {
+ say_file("phonetic-ascii/%d.wav", a);
+ }
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t play_group(int a,
+ int b,
+ int c,
+ char *what,
+ switch_core_session_t *session,
+ switch_input_callback_function_t input_callback,
+ void *buf,
+ uint32_t buflen)
+{
+
if (a) {
- snprintf(tmp, sizeof(tmp), "digits/%d.wav", a);
- switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
- switch_ivr_play_file(args->session, NULL, "digits/hundred.wav", NULL, args->input_callback, args->buf, args->buflen);
+ say_file("digits/%d.wav", a);
+ say_file("digits/hundred.wav");
}
if (b) {
if (b > 1) {
- snprintf(tmp, sizeof(tmp), "digits/%d0.wav", b);
- switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+ say_file("digits/%d0.wav", b);
} else {
- snprintf(tmp, sizeof(tmp), "digits/%d%d.wav", b, c);
- switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+ say_file("digits/%d%d.wav", b, c);
c = 0;
}
}
if (c) {
- snprintf(tmp, sizeof(tmp), "digits/%d.wav", c);
- switch_ivr_play_file(args->session, NULL, tmp, NULL, args->input_callback, args->buf, args->buflen);
+ say_file("digits/%d.wav", c);
}
if (what && (a || b || c)) {
- switch_ivr_play_file(args->session, NULL, what, NULL, args->input_callback, args->buf, args->buflen);
+ say_file(what);
}
+ return SWITCH_STATUS_SUCCESS;
}
static char *strip_commas(char *in, char *out, switch_size_t len)
@@ -106,19 +144,13 @@
switch_channel_t *channel;
int in;
int x = 0, places[9] = {0};
- char tmp[80] = "";
char sbuf[13] = "";
- common_args_t args = {0};
-
+ switch_status_t status;
+
assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- args.session = session;
- args.input_callback = input_callback;
- args.buf = buf;
- args.buflen = buflen;
-
if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
return SWITCH_STATUS_GENERR;
@@ -135,15 +167,20 @@
switch (method) {
case SSM_PRONOUNCED:
- play_group(places[8], places[7], places[6], "digits/million.wav", &args);
- play_group(places[5], places[4], places[3], "digits/thousand.wav", &args);
- play_group(places[2], places[1], places[0], NULL, &args);
+ if ((status = play_group(places[8], places[7], places[6], "digits/million.wav", session, input_callback, buf, buflen)) != 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) {
+ return status;
+ }
+ if ((status = play_group(places[2], places[1], places[0], NULL, session, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
break;
case SSM_ITERATED:
for(x = 8; x >= 0; x--) {
if (places[x]) {
- snprintf(tmp, sizeof(tmp), "digits/%d.wav", places[x]);
- switch_ivr_play_file(session, NULL, tmp, NULL, input_callback, buf, buflen);
+ say_file("digits/%d.wav", places[x]);
}
}
break;
@@ -153,6 +190,138 @@
return SWITCH_STATUS_SUCCESS;
}
+
+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)
+{
+ int32_t t;
+ switch_time_t target = 0;
+ switch_time_exp_t tm;
+ uint8_t say_date = 0, say_time = 0;
+
+ if (type == SST_TIME_MEASUREMENT) {
+ int64_t hours = 0;
+ int64_t minutes = 0;
+ int64_t seconds = 0;
+ int64_t r = 0;
+
+ if (strchr(tosay, ':')) {
+ char *tme = switch_core_session_strdup(session, tosay);
+ char *p;
+
+ if ((p = strrchr(tme, ':'))) {
+ *p++ = '\0';
+ seconds = atoi(p);
+ if ((p = strrchr(tme, ':'))) {
+ *p++ = '\0';
+ minutes = atoi(p);
+ if (tme) {
+ hours = atoi(tme);
+ }
+ }
+ }
+ } else {
+ if ((seconds = atoi(tosay)) <= 0) {
+ seconds = (int64_t) time(NULL);
+ }
+
+ if (seconds >= 60) {
+ minutes = seconds / 60;
+ r = seconds % 60;
+ seconds = r;
+ }
+
+ if (minutes >= 60) {
+ hours = minutes / 60;
+ r = minutes % 60;
+ minutes = r;
+ }
+ }
+
+ if (hours) {
+ say_num(hours);
+ say_file("digits/hours.wav");
+ }
+
+ if (minutes) {
+ say_num(minutes);
+ say_file("digits/minutes.wav");
+ }
+
+ if (seconds) {
+ say_num(seconds);
+ say_file("digits/seconds.wav");
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if ((t = atoi(tosay)) > 0) {
+ target = switch_time_make(t, 0);
+ } else {
+ target = switch_time_now();
+ }
+ switch_time_exp_lt(&tm, target);
+
+ switch(type) {
+ case SST_CURRENT_DATE_TIME:
+ say_date = say_time = 1;
+ break;
+ case SST_CURRENT_DATE:
+ say_date = 1;
+ break;
+ case SST_CURRENT_TIME:
+ say_time = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (say_date) {
+ say_file("digits/day-%d.wav", tm.tm_wday);
+ say_file("digits/mon-%d.wav", tm.tm_mon);
+ say_num(tm.tm_mday);
+ say_num(tm.tm_year + 1900);
+ }
+
+ if (say_time) {
+ int32_t hour = tm.tm_hour, pm = 0;
+
+ if (hour > 12) {
+ hour -= 12;
+ pm = 1;
+ } else if (hour == 12) {
+ pm = 1;
+ } else if (hour == 0) {
+ hour = 12;
+ pm = 0;
+ }
+
+ say_num(hour);
+
+ if (tm.tm_min > 9) {
+ say_num(tm.tm_min);
+ } else if (tm.tm_min) {
+ say_file("digits/oh.wav");
+ say_num(tm.tm_min);
+ } else {
+ say_file("digits/oclock.wav");
+ }
+
+ say_file("digits/%s.wav", pm ? "p-m" : "a-m");
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+
static switch_status_t en_say(switch_core_session_t *session,
char *tosay,
switch_say_type_t type,
@@ -170,6 +339,16 @@
case SST_PERSONS:
case SST_MESSAGES:
say_cb = en_say_general_count;
+ break;
+ case SST_TIME_MEASUREMENT:
+ case SST_CURRENT_DATE:
+ case SST_CURRENT_TIME:
+ case SST_CURRENT_DATE_TIME:
+ say_cb = en_say_time;
+ break;
+ case SST_NAME_SPELLED:
+ case SST_NAME_PHONETIC:
+ say_cb = en_spell;
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Finish ME!\n");
Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj (original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14\include";"$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14";"$(InputDir)..\..\..\..\libs\curl-7.15.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\curl\include""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -125,7 +125,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14\include";"$(InputDir)..\..\..\..\libs\xmlcurl-c-1.03.14";"$(InputDir)..\..\..\..\libs\curl-7.15.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\curl\include""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj (original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj Sat Dec 23 00:27:43 2006
@@ -42,7 +42,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14";"$(InputDir)..\..\..\..\libs\curl-7.15.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\curl\include""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -125,7 +125,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14";"$(InputDir)..\..\..\..\libs\curl-7.15.2\include""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\include";"$(InputDir)include";"$(InputDir)..\..\..\..\libs\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\curl\include""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
Modified: freeswitch/branches/knhor/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_ivr.c (original)
+++ freeswitch/branches/knhor/trunk/src/switch_ivr.c Sat Dec 23 00:27:43 2006
@@ -338,7 +338,7 @@
{
switch_channel_t *channel;
char dtmf[128];
- switch_file_handle_t lfh;
+ switch_file_handle_t lfh = {0};
switch_frame_t *read_frame;
switch_codec_t codec, *read_codec;
char *codec_name;
@@ -346,11 +346,11 @@
char *p;
const char *vval;
time_t start = 0;
+ uint32_t org_silence_hits = 0;
if (!fh) {
fh = &lfh;
}
- memset(fh, 0, sizeof(*fh));
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -433,10 +433,13 @@
}
if (fh->thresh) {
- if (!fh->silence_hits) {
- fh->silence_hits = 20;
+ if (fh->silence_hits) {
+ fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_frame;
+ } else {
+ fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_frame;
}
- }
+ org_silence_hits = fh->silence_hits;
+ }
while(switch_channel_ready(channel)) {
switch_size_t len;
@@ -504,7 +507,9 @@
if (!--fh->silence_hits) {
break;
}
- }
+ } else {
+ fh->silence_hits = org_silence_hits;
+ }
}
if (!switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
@@ -4488,17 +4493,26 @@
if (pattern) {
pcre *re = NULL;
int proceed = 0, ovector[30];
- char substituted[1024] = "";
+ char *substituted = NULL;
+ uint32_t len = 0;
char *odata = NULL;
char *expanded = NULL;
-
+
if ((proceed = switch_perform_regex(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
for (action = switch_xml_child(input, "action"); action; action = action->next) {
char *adata = (char *) switch_xml_attr_soft(action, "data");
char *func = (char *) switch_xml_attr_soft(action, "function");
if (strchr(pattern, '(') && strchr(adata, '$')) {
- switch_perform_substitution(re, proceed, adata, data, substituted, sizeof(substituted), ovector);
+ len = (uint32_t)(strlen(data) + strlen(adata) + 10);
+ if (!(substituted = malloc(len))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+ switch_clean_re(re);
+ switch_safe_free(expanded);
+ goto done;
+ }
+ memset(substituted, 0, len);
+ switch_perform_substitution(re, proceed, adata, data, substituted, len, ovector);
odata = substituted;
} else {
odata = adata;
@@ -4512,7 +4526,7 @@
odata = expanded;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle %s:[%s] (%s)\n", func, odata, lang);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s)\n", func, odata, lang);
if (!strcasecmp(func, "play-file")) {
switch_ivr_play_file(session, NULL, odata, NULL, input_callback, buf, buflen);
@@ -4567,6 +4581,7 @@
switch_clean_re(re);
switch_safe_free(expanded);
+ switch_safe_free(substituted);
}
input = input->next;
Modified: freeswitch/branches/knhor/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_rtp.c (original)
+++ freeswitch/branches/knhor/trunk/src/switch_rtp.c Sat Dec 23 00:27:43 2006
@@ -467,7 +467,7 @@
rtp_session->recv_msg.header.x = 0;
rtp_session->recv_msg.header.cc = 0;
- rtp_session->seq = rtp_session->send_msg.header.seq;
+ rtp_session->seq = (uint16_t)rtp_session->send_msg.header.seq;
rtp_session->payload = payload;
rtp_session->ms_per_packet = ms_per_packet;
rtp_session->packet_size = packet_size;
@@ -782,7 +782,7 @@
*flags |= SFF_CNG;
/* Return a CNG frame */
*payload_type = SWITCH_RTP_CNG_PAYLOAD;
- return SWITCH_RTP_CNG_PAYLOAD;
+ return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
}
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
@@ -857,7 +857,7 @@
*flags |= SFF_CNG;
/* Return a CNG frame */
*payload_type = SWITCH_RTP_CNG_PAYLOAD;
- return SWITCH_RTP_CNG_PAYLOAD;
+ return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
}
}
@@ -896,7 +896,7 @@
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_GOOGLEHACK) && rtp_session->recv_msg.header.pt == 102) {
rtp_session->recv_msg.header.pt = 97;
}
- rtp_session->rseq = ntohs(rtp_session->recv_msg.header.seq);
+ rtp_session->rseq = ntohs((uint16_t)rtp_session->recv_msg.header.seq);
rtp_session->rpayload = (switch_payload_t)rtp_session->recv_msg.header.pt;
} else {
if (rtp_session->recv_msg.header.version == 0 && rtp_session->ice_user) {
@@ -1296,7 +1296,7 @@
if (!rtp_session->mini && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_MINI)) {
rtp_session->mini++;
rtp_session->rpayload = (switch_payload_t)send_msg->header.pt;
- rtp_session->rseq = ntohs(send_msg->header.seq);
+ rtp_session->rseq = ntohs((uint16_t)send_msg->header.seq);
}
}
1
0
Author: mikej
Date: Fri Dec 22 23:21:39 2006
New Revision: 3813
Modified:
freeswitch/trunk/libs/libsndfile/configure (props changed)
freeswitch/trunk/libs/libsndfile/install-sh (props changed)
Log:
add svn:executable
1
0
23 Dec '06
Author: anthm
Date: Fri Dec 22 20:39:27 2006
New Revision: 3812
Modified:
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
Log:
update js
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Fri Dec 22 20:39:27 2006
@@ -2258,7 +2258,9 @@
JS_DefineFunctions(cx, javascript_object, fs_functions);
JS_InitStandardClasses(cx, javascript_object);
-
+
+ /* this doesnt load in standard classes figure out wtf */
+ js_InitFileClass(cx, javascript_object);
JS_InitClass(cx,
javascript_object,
1
0
23 Dec '06
Author: anthm
Date: Fri Dec 22 19:30:42 2006
New Revision: 3811
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
fix small bugs
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Dec 22 19:30:42 2006
@@ -1802,7 +1802,7 @@
/* Play a file in the conference room */
static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
conference_file_node_t *fnode, *nptr;
switch_memory_pool_t *pool;
uint32_t count;
@@ -2982,8 +2982,8 @@
static api_command_t conf_api_sub_commands[] = {
{"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
{"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
- {"volume in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
- {"volume out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
+ {"volume_in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
+ {"volume_out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
{"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
{"say", &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
{"saymember", &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
1
0
Author: anthm
Date: Fri Dec 22 17:51:14 2006
New Revision: 3810
Modified:
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
Log:
pickynes
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Fri Dec 22 17:51:14 2006
@@ -38,7 +38,7 @@
#define say_num(num) {\
char tmp[80];\
switch_status_t status;\
- snprintf(tmp, sizeof(tmp), "%d", num);\
+ snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \
if ((status = en_say_general_count(session, tmp, SST_ITEMS, SSM_PRONOUNCED, input_callback, buf, buflen)) != SWITCH_STATUS_SUCCESS) {\
return status;\
}}\
1
0
Author: mikej
Date: Fri Dec 22 17:46:08 2006
New Revision: 3809
Modified:
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
Log:
datatypes
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Fri Dec 22 17:46:08 2006
@@ -205,10 +205,10 @@
uint8_t say_date = 0, say_time = 0;
if (type == SST_TIME_MEASUREMENT) {
- int32_t hours = 0;
- int32_t minutes = 0;
- int32_t seconds = 0;
- int32_t r = 0;
+ int64_t hours = 0;
+ int64_t minutes = 0;
+ int64_t seconds = 0;
+ int64_t r = 0;
if (strchr(tosay, ':')) {
char *tme = switch_core_session_strdup(session, tosay);
@@ -227,7 +227,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (time_t) time(NULL);
+ seconds = (int64_t) time(NULL);
}
if (seconds >= 60) {
@@ -290,7 +290,7 @@
}
if (say_time) {
- uint8_t hour = tm.tm_hour, pm = 0;
+ int32_t hour = tm.tm_hour, pm = 0;
if (hour > 12) {
hour -= 12;
1
0
Author: anthm
Date: Fri Dec 22 17:40:10 2006
New Revision: 3808
Modified:
freeswitch/trunk/conf/freeswitch.xml
Log:
add config samples for phrase wip
Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml (original)
+++ freeswitch/trunk/conf/freeswitch.xml Fri Dec 22 17:40:10 2006
@@ -485,6 +485,19 @@
<!-- *NOTE* The special context name 'any' will match any context -->
<context name="default">
+ <extension name="556"> <!-- demo phrases -->
+ <condition field="destination_number" expression="^556$">
+ <action application="answer"/>
+ <action application="sleep" data="1000"/>
+ <action application="phrase" data="spell,${caller_id_name}"/>
+ <action application="phrase" data="spell-phonetic,${caller_id_name}"/>
+ <action application="phrase" data="timespec,12:45:15"/>
+ <action application="phrase" data="saydate,0"/>
+ <action application="phrase" data="msgcount,130"/>
+ <!--<action application="phrase" data="timeleft,3:30"/>-->
+ </condition>
+ </extension>
+
<extension name="tollfree">
<condition field="destination_number" expression="^(18(0{2}|8{2}|7{2}|6{2})\d{7})$">
<action application="enum" data="$1"/>
@@ -647,9 +660,29 @@
<!--<action function="speak-text" data="you have $1 messages"/>-->
</input>
</macro>
- <macro name="timeleft">
+ <macro name="saydate">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="current_date_time"/>
+ </input>
+ </macro>
+ <macro name="timespec">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="time_measurement"/>
+ </input>
+ </macro>
+ <macro name="spell">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="name_spelled"/>
+ </input>
+ </macro>
+ <macro name="spell-phonetic">
+ <input pattern="(.*)">
+ <action function="say" data="$1" method="pronounced" type="name_phonetic"/>
+ </input>
+ </macro>
+ <macro name="tts-timeleft">
<input pattern="(\d+):(\d+)">
- <action function="speak-text" data="You have $1 minutes, $2 seconds remaining"/>
+ <action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
</input>
</macro>
</language>
1
0