[commit] r3427 - in freeswitch/branches/jkr888/trunk: scripts src src/mod/languages/mod_python
Author: jkr888 Date: Mon Nov 20 17:34:19 2006 New Revision: 3427 Modified: freeswitch/branches/jkr888/trunk/scripts/mytest.py freeswitch/branches/jkr888/trunk/scripts/testapi.py freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch.py freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/switch_swig_wrap.c freeswitch/branches/jkr888/trunk/src/switch_swig.c freeswitch/branches/jkr888/trunk/src/switch_swig.i Log: Modified: freeswitch/branches/jkr888/trunk/scripts/mytest.py ============================================================================== --- freeswitch/branches/jkr888/trunk/scripts/mytest.py (original) +++ freeswitch/branches/jkr888/trunk/scripts/mytest.py Mon Nov 20 17:34:19 2006 @@ -16,6 +16,19 @@ fs_channel_answer(session) #fs_switch_ivr_session_transfer(session, "1234", "XML", "default") -fs_ivr_play_file2(session, "/root/call-quality-menu.gsm") +fs_ivr_play_file2(session, "/root/test.gsm") +#fs_switch_ivr_speak_text2(session, "cepstral", "david", "<break time='1s' />Welcome to my first python scripts running from <emphasis level='strong'>free switch </emphasis>application.") + +fs_switch_ivr_speak_text(session, + "cepstral", + "david", + None, + 0, + None, + "Welcome to my first python application", + None, + 0) + +fs_channel_hangup(session, "") Modified: freeswitch/branches/jkr888/trunk/scripts/testapi.py ============================================================================== --- freeswitch/branches/jkr888/trunk/scripts/testapi.py (original) +++ freeswitch/branches/jkr888/trunk/scripts/testapi.py Mon Nov 20 17:34:19 2006 @@ -5,3 +5,4 @@ print sys.path print dir() +print CS_DONE Modified: freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch.py ============================================================================== --- freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch.py (original) +++ freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch.py Mon Nov 20 17:34:19 2006 @@ -85,18 +85,11 @@ fs_switch_ivr_speak_text = _freeswitch.fs_switch_ivr_speak_text +fs_switch_ivr_speak_text2 = _freeswitch.fs_switch_ivr_speak_text2 + fs_switch_channel_get_variable = _freeswitch.fs_switch_channel_get_variable fs_switch_channel_set_variable = _freeswitch.fs_switch_channel_set_variable -SWITCH_LOG_CONSOLE = _freeswitch.SWITCH_LOG_CONSOLE -SWITCH_LOG_DEBUG = _freeswitch.SWITCH_LOG_DEBUG -SWITCH_LOG_INFO = _freeswitch.SWITCH_LOG_INFO -SWITCH_LOG_NOTICE = _freeswitch.SWITCH_LOG_NOTICE -SWITCH_LOG_WARNING = _freeswitch.SWITCH_LOG_WARNING -SWITCH_LOG_ERROR = _freeswitch.SWITCH_LOG_ERROR -SWITCH_LOG_CRIT = _freeswitch.SWITCH_LOG_CRIT -SWITCH_LOG_ALERT = _freeswitch.SWITCH_LOG_ALERT -SWITCH_LOG_EMERG = _freeswitch.SWITCH_LOG_EMERG CS_NEW = _freeswitch.CS_NEW CS_INIT = _freeswitch.CS_INIT CS_RING = _freeswitch.CS_RING Modified: freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/switch_swig_wrap.c ============================================================================== --- freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/switch_swig_wrap.c (original) +++ freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/switch_swig_wrap.c Mon Nov 20 17:34:19 2006 @@ -1421,12 +1421,10 @@ #define SWIGTYPE_p_switch_core_session_t swig_types[4] #define SWIGTYPE_p_switch_file_handle_t swig_types[5] #define SWIGTYPE_p_switch_input_callback_function_t swig_types[6] -#define SWIGTYPE_p_switch_log_level_t swig_types[7] -#define SWIGTYPE_p_uint32_t swig_types[8] -#define SWIGTYPE_ptrdiff_t swig_types[9] -#define SWIGTYPE_size_t swig_types[10] -static swig_type_info *swig_types[12]; -static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0}; +#define SWIGTYPE_ptrdiff_t swig_types[7] +#define SWIGTYPE_size_t swig_types[8] +static swig_type_info *swig_types[10]; +static swig_module_info swig_module = {swig_types, 9, 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) @@ -2008,7 +2006,7 @@ static PyObject *_wrap_fs_switch_ivr_sleep(PyObject *self, PyObject *args) { PyObject *resultobj = NULL; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; - uint32_t arg2 ; + unsigned int arg2 ; int result; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -2017,14 +2015,8 @@ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0); if (SWIG_arg_fail(1)) SWIG_fail; { - uint32_t * argp; - SWIG_Python_ConvertPtr(obj1, (void **)&argp, SWIGTYPE_p_uint32_t, SWIG_POINTER_EXCEPTION); + arg2 = (unsigned int)(SWIG_As_unsigned_SS_int(obj1)); if (SWIG_arg_fail(2)) SWIG_fail; - if (argp == NULL) { - SWIG_null_ref("uint32_t"); - } - if (SWIG_arg_fail(2)) SWIG_fail; - arg2 = *argp; } result = (int)fs_switch_ivr_sleep(arg1,arg2); @@ -2171,7 +2163,7 @@ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; char *arg3 = (char *) 0 ; - uint32_t arg4 ; + unsigned int arg4 ; int result; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -2187,14 +2179,8 @@ SWIG_arg_fail(3);SWIG_fail; } { - uint32_t * argp; - SWIG_Python_ConvertPtr(obj3, (void **)&argp, SWIGTYPE_p_uint32_t, SWIG_POINTER_EXCEPTION); + arg4 = (unsigned int)(SWIG_As_unsigned_SS_int(obj3)); if (SWIG_arg_fail(4)) SWIG_fail; - if (argp == NULL) { - SWIG_null_ref("uint32_t"); - } - if (SWIG_arg_fail(4)) SWIG_fail; - arg4 = *argp; } result = (int)fs_switch_ivr_originate(arg1,arg2,arg3,arg4); @@ -2248,7 +2234,7 @@ char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; - uint32_t arg5 ; + unsigned int arg5 ; switch_input_callback_function_t arg6 ; char *arg7 = (char *) 0 ; void *arg8 = (void *) 0 ; @@ -2277,14 +2263,8 @@ SWIG_arg_fail(4);SWIG_fail; } { - uint32_t * argp; - SWIG_Python_ConvertPtr(obj4, (void **)&argp, SWIGTYPE_p_uint32_t, SWIG_POINTER_EXCEPTION); + arg5 = (unsigned int)(SWIG_As_unsigned_SS_int(obj4)); if (SWIG_arg_fail(5)) SWIG_fail; - if (argp == NULL) { - SWIG_null_ref("uint32_t"); - } - if (SWIG_arg_fail(5)) SWIG_fail; - arg5 = *argp; } { switch_input_callback_function_t * argp; @@ -2319,6 +2299,41 @@ } +static PyObject *_wrap_fs_switch_ivr_speak_text2(PyObject *self, PyObject *args) { + PyObject *resultobj = NULL; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + int result; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OOOO:fs_switch_ivr_speak_text2",&obj0,&obj1,&obj2,&obj3)) goto fail; + SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, 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; + } + result = (int)fs_switch_ivr_speak_text2(arg1,arg2,arg3,arg4); + + { + resultobj = SWIG_From_int((int)(result)); + } + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_fs_switch_channel_get_variable(PyObject *self, PyObject *args) { PyObject *resultobj = NULL; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -2397,6 +2412,7 @@ { (char *)"fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate, METH_VARARGS, NULL}, { (char *)"fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer, METH_VARARGS, NULL}, { (char *)"fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text, METH_VARARGS, NULL}, + { (char *)"fs_switch_ivr_speak_text2", _wrap_fs_switch_ivr_speak_text2, METH_VARARGS, NULL}, { (char *)"fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable, METH_VARARGS, NULL}, { (char *)"fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } @@ -2412,8 +2428,6 @@ static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, 0}; static swig_type_info _swigt__p_switch_file_handle_t = {"_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, 0}; static swig_type_info _swigt__p_switch_input_callback_function_t = {"_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, 0}; -static swig_type_info _swigt__p_switch_log_level_t = {"_p_switch_log_level_t", "enum switch_log_level_t *|switch_log_level_t *", 0, 0, 0}; -static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 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}; @@ -2425,8 +2439,6 @@ &_swigt__p_switch_core_session_t, &_swigt__p_switch_file_handle_t, &_swigt__p_switch_input_callback_function_t, - &_swigt__p_switch_log_level_t, - &_swigt__p_uint32_t, &_swigt__ptrdiff_t, &_swigt__size_t, }; @@ -2438,8 +2450,6 @@ static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_file_handle_t[] = { {&_swigt__p_switch_file_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_switch_log_level_t[] = { {&_swigt__p_switch_log_level_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 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}}; @@ -2451,8 +2461,6 @@ _swigc__p_switch_core_session_t, _swigc__p_switch_file_handle_t, _swigc__p_switch_input_callback_function_t, - _swigc__p_switch_log_level_t, - _swigc__p_uint32_t, _swigc__ptrdiff_t, _swigc__size_t, }; @@ -2891,33 +2899,6 @@ SWIG_InitializeModule(0); SWIG_InstallConstants(d,swig_const_table); - { - PyDict_SetItemString(d,"SWITCH_LOG_CONSOLE", SWIG_From_int((int)(SWITCH_LOG_CONSOLE))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_DEBUG", SWIG_From_int((int)(SWITCH_LOG_DEBUG))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_INFO", SWIG_From_int((int)(SWITCH_LOG_INFO))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_NOTICE", SWIG_From_int((int)(SWITCH_LOG_NOTICE))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_WARNING", SWIG_From_int((int)(SWITCH_LOG_WARNING))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_ERROR", SWIG_From_int((int)(SWITCH_LOG_ERROR))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_CRIT", SWIG_From_int((int)(SWITCH_LOG_CRIT))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_ALERT", SWIG_From_int((int)(SWITCH_LOG_ALERT))); - } - { - PyDict_SetItemString(d,"SWITCH_LOG_EMERG", SWIG_From_int((int)(SWITCH_LOG_EMERG))); - } { PyDict_SetItemString(d,"CS_NEW", SWIG_From_int((int)(CS_NEW))); } Modified: freeswitch/branches/jkr888/trunk/src/switch_swig.c ============================================================================== --- freeswitch/branches/jkr888/trunk/src/switch_swig.c (original) +++ freeswitch/branches/jkr888/trunk/src/switch_swig.c Mon Nov 20 17:34:19 2006 @@ -187,7 +187,7 @@ } int fs_switch_ivr_sleep(switch_core_session_t *session, - uint32_t ms) + unsigned int ms) { switch_status_t status; status = switch_ivr_sleep(session, ms); @@ -247,7 +247,7 @@ int fs_switch_ivr_originate (switch_core_session_t *session, switch_core_session_t **bleg, char * bridgeto, - uint32_t timelimit_sec) + unsigned int timelimit_sec) /*const switch_state_handler_table_t *table, char * cid_name_override, char * cid_num_override, @@ -293,7 +293,7 @@ char *tts_name, char *voice_name, char *timer_name, - uint32_t rate, + unsigned int rate, switch_input_callback_function_t dtmf_callback, char *text, void *buf, @@ -302,6 +302,17 @@ switch_status_t status; status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen); + return status == SWITCH_STATUS_SUCCESS ? 1 : 0; +} + +int fs_switch_ivr_speak_text2 (switch_core_session_t *session, + char *tts_name, + char *voice_name, + char *text) +{ + switch_status_t status; + + status = switch_ivr_speak_text(session,tts_name,voice_name,NULL,0,NULL,text,NULL,0); return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } Modified: freeswitch/branches/jkr888/trunk/src/switch_swig.i ============================================================================== --- freeswitch/branches/jkr888/trunk/src/switch_swig.i (original) +++ freeswitch/branches/jkr888/trunk/src/switch_swig.i Mon Nov 20 17:34:19 2006 @@ -1,21 +1,9 @@ -%module fs_elmoscript +%module freeswitch %{ #include "switch.h" %} %include "/usr/local/freeswitch/include/switch.h" - -typedef enum { - SWITCH_LOG_CONSOLE = 8, - SWITCH_LOG_DEBUG = 7, - SWITCH_LOG_INFO = 6, - SWITCH_LOG_NOTICE = 5, - SWITCH_LOG_WARNING = 4, - SWITCH_LOG_ERROR = 3, - SWITCH_LOG_CRIT = 2, - SWITCH_LOG_ALERT = 1, - SWITCH_LOG_EMERG = 0 -} switch_log_level_t; typedef enum { CS_NEW,
participants (1)
-
Freeswitch SVN