diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 15332839f0..c6564b79f6 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -104,11 +104,13 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg); class API { protected: char *last_data; + char time_buf[64]; public: SWITCH_DECLARE_CONSTRUCTOR API(void); virtual SWITCH_DECLARE_CONSTRUCTOR ~ API(); SWITCH_DECLARE(const char *) execute(const char *command, const char *data); SWITCH_DECLARE(const char *) executeString(const char *command); + SWITCH_DECLARE(char *) getTime(void); }; @@ -398,6 +400,7 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess void *input, switch_input_type_t itype, void *buf, unsigned int buflen); + #ifdef __cplusplus } #endif diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java index 580b8e91b9..283518f1d6 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java @@ -45,4 +45,8 @@ public class API { return freeswitchJNI.API_executeString(swigCPtr, this, command); } + public String getTime() { + return freeswitchJNI.API_getTime(swigCPtr, this); + } + } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index a1cc7bc167..a4585fadfe 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -19,6 +19,7 @@ class freeswitchJNI { public final static native void delete_API(long jarg1); public final static native String API_execute(long jarg1, API jarg1_, String jarg2, String jarg3); public final static native String API_executeString(long jarg1, API jarg1_, String jarg2); + public final static native String API_getTime(long jarg1, API jarg1_); public final static native void input_callback_state_t_function_set(long jarg1, input_callback_state_t jarg1_, long jarg2); public final static native long input_callback_state_t_function_get(long jarg1, input_callback_state_t jarg1_); public final static native void input_callback_state_t_threadState_set(long jarg1, input_callback_state_t jarg1_, long jarg2); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 969cec18b9..a489f9596c 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -458,6 +458,21 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_API_1executeSt } +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_API_1getTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + API *arg1 = (API *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(API **)&jarg1; + result = (char *)(arg1)->getTime(); + if(result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1function_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 2f1c4bd52f..ea119c44af 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1852,6 +1852,31 @@ fail: } +static int _wrap_API_getTime(lua_State* L) { + int SWIG_arg = -1; + API *arg1 = (API *) 0 ; + char *result = 0 ; + + SWIG_check_num_args("getTime",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getTime",1,"API *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ + SWIG_fail_ptr("API_getTime",1,SWIGTYPE_p_API); + } + + result = (char *)(arg1)->getTime(); + SWIG_arg=0; + lua_pushstring(L,(const char*)result); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static void swig_delete_API(void *obj) { API *arg1 = (API *) obj; delete arg1; @@ -1859,6 +1884,7 @@ delete arg1; static swig_lua_method swig_API_methods[] = { {"execute", _wrap_API_execute}, {"executeString", _wrap_API_executeString}, + {"getTime", _wrap_API_getTime}, {0,0} }; static swig_lua_attribute swig_API_attributes[] = { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 4a85cf555b..a0b9d29309 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -7120,21 +7120,19 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_float_param_tts(void * jar } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4) { int jresult ; switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ; void *arg2 = (void *) 0 ; switch_size_t *arg3 = (switch_size_t *) 0 ; - uint32_t *arg4 = (uint32_t *) 0 ; - switch_speech_flag_t *arg5 = (switch_speech_flag_t *) 0 ; + switch_speech_flag_t *arg4 = (switch_speech_flag_t *) 0 ; switch_status_t result; arg1 = (switch_speech_handle_t *)jarg1; arg2 = (void *)jarg2; arg3 = (switch_size_t *)jarg3; - arg4 = (uint32_t *)jarg4; - arg5 = (switch_speech_flag_t *)jarg5; - result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4,arg5); + arg4 = (switch_speech_flag_t *)jarg4; + result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4); jresult = result; return jresult; } @@ -14084,10 +14082,10 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_feed_tts_get SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_set(void * jarg1, void * jarg2) { switch_speech_interface *arg1 = (switch_speech_interface *) 0 ; - switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *)) 0 ; + switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) 0 ; arg1 = (switch_speech_interface *)jarg1; - arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *))jarg2; + arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *))jarg2; if (arg1) (arg1)->speech_read_tts = arg2; } @@ -14096,10 +14094,10 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_set(v SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_get(void * jarg1) { void * jresult ; switch_speech_interface *arg1 = (switch_speech_interface *) 0 ; - switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *) = 0 ; + switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = 0 ; arg1 = (switch_speech_interface *)jarg1; - result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,uint32_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts); + result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts); jresult = (void *)result; return jresult; } @@ -14584,6 +14582,150 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_memory_pool_get(void * } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_resampler_set(void * jarg1, void * jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ; + + arg1 = (switch_speech_handle *)jarg1; + arg2 = (switch_audio_resampler_t *)jarg2; + if (arg1) (arg1)->resampler = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_resampler_get(void * jarg1) { + void * jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_audio_resampler_t *result = 0 ; + + arg1 = (switch_speech_handle *)jarg1; + result = (switch_audio_resampler_t *) ((arg1)->resampler); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_buffer_set(void * jarg1, void * jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_buffer_t *arg2 = (switch_buffer_t *) 0 ; + + arg1 = (switch_speech_handle *)jarg1; + arg2 = (switch_buffer_t *)jarg2; + if (arg1) (arg1)->buffer = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_buffer_get(void * jarg1) { + void * jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_buffer_t *result = 0 ; + + arg1 = (switch_speech_handle *)jarg1; + result = (switch_buffer_t *) ((arg1)->buffer); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuf_set(void * jarg1, void * jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_byte_t *arg2 = (switch_byte_t *) 0 ; + + arg1 = (switch_speech_handle *)jarg1; + arg2 = (switch_byte_t *)jarg2; + if (arg1) (arg1)->dbuf = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuf_get(void * jarg1) { + void * jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_byte_t *result = 0 ; + + arg1 = (switch_speech_handle *)jarg1; + result = (switch_byte_t *) ((arg1)->dbuf); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_set(void * jarg1, void * jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_size_t arg2 ; + switch_size_t *argp2 ; + + arg1 = (switch_speech_handle *)jarg1; + argp2 = (switch_size_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->dbuflen = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_get(void * jarg1) { + void * jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + switch_size_t result; + + arg1 = (switch_speech_handle *)jarg1; + result = ((arg1)->dbuflen); + jresult = new switch_size_t((switch_size_t &)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samplerate_set(void * jarg1, unsigned long jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_speech_handle *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->samplerate = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samplerate_get(void * jarg1) { + unsigned long jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + uint32_t result; + + arg1 = (switch_speech_handle *)jarg1; + result = (uint32_t) ((arg1)->samplerate); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_native_rate_set(void * jarg1, unsigned long jarg2) { + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_speech_handle *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->native_rate = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_native_rate_get(void * jarg1) { + unsigned long jresult ; + switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; + uint32_t result; + + arg1 = (switch_speech_handle *)jarg1; + result = (uint32_t) ((arg1)->native_rate); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_private_info_set(void * jarg1, void * jarg2) { switch_speech_handle *arg1 = (switch_speech_handle *) 0 ; void *arg2 = (void *) 0 ; @@ -26238,6 +26380,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_Api_ExecuteString(void * jarg1, char * jarg } +SWIGEXPORT char * SWIGSTDCALL CSharp_Api_getTime(void * jarg1) { + char * jresult ; + API *arg1 = (API *) 0 ; + char *result = 0 ; + + arg1 = (API *)jarg1; + result = (char *)(arg1)->getTime(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_function_set(void * jarg1, void * jarg2) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 7eda6618af..57878036c3 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -52,6 +52,11 @@ public class Api : IDisposable { return ret; } + public string getTime() { + string ret = freeswitchPINVOKE.Api_getTime(swigCPtr); + return ret; + } + } } @@ -1670,8 +1675,8 @@ public class freeswitch { freeswitchPINVOKE.switch_core_speech_float_param_tts(switch_speech_handle.getCPtr(sh), param, val); } - public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long rate, SWIGTYPE_p_unsigned_long flags) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(rate), SWIGTYPE_p_unsigned_long.getCPtr(flags)); + public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long flags) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(flags)); return ret; } @@ -6066,7 +6071,7 @@ class freeswitchPINVOKE { public static extern void switch_core_speech_float_param_tts(HandleRef jarg1, string jarg2, double jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_read_tts")] - public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5); + public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_close")] public static extern int switch_core_speech_close(HandleRef jarg1, HandleRef jarg2); @@ -7868,6 +7873,42 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_get")] public static extern IntPtr switch_speech_handle_memory_pool_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_set")] + public static extern void switch_speech_handle_resampler_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_get")] + public static extern IntPtr switch_speech_handle_resampler_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_set")] + public static extern void switch_speech_handle_buffer_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_get")] + public static extern IntPtr switch_speech_handle_buffer_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_set")] + public static extern void switch_speech_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_get")] + public static extern IntPtr switch_speech_handle_dbuf_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_set")] + public static extern void switch_speech_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_get")] + public static extern IntPtr switch_speech_handle_dbuflen_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_set")] + public static extern void switch_speech_handle_samplerate_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_get")] + public static extern uint switch_speech_handle_samplerate_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_set")] + public static extern void switch_speech_handle_native_rate_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_get")] + public static extern uint switch_speech_handle_native_rate_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_set")] public static extern void switch_speech_handle_private_info_set(HandleRef jarg1, HandleRef jarg2); @@ -10568,6 +10609,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_Api_ExecuteString")] public static extern string Api_ExecuteString(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_Api_getTime")] + public static extern string Api_getTime(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_set")] public static extern void input_callback_state_t_function_set(HandleRef jarg1, HandleRef jarg2); @@ -11255,36 +11299,6 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; -public class SWIGTYPE_p_CoreSession { - private HandleRef swigCPtr; - - internal SWIGTYPE_p_CoreSession(IntPtr cPtr, bool futureUse) { - swigCPtr = new HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_CoreSession() { - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - - internal static HandleRef getCPtr(SWIGTYPE_p_CoreSession obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -} - -} -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.35 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -namespace FreeSWITCH.Native { - -using System; -using System.Runtime.InteropServices; - public class SWIGTYPE_p_FILE { private HandleRef swigCPtr; @@ -12935,18 +12949,18 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; -public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t { +public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t { private HandleRef swigCPtr; - internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) { + internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) { swigCPtr = new HandleRef(this, cPtr); } - protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t() { + protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t() { swigCPtr = new HandleRef(null, IntPtr.Zero); } - internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t obj) { + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; } } @@ -14435,36 +14449,6 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; -public class SWIGTYPE_p_SWITCH_DECLARE_CLASS { - private HandleRef swigCPtr; - - internal SWIGTYPE_p_SWITCH_DECLARE_CLASS(IntPtr cPtr, bool futureUse) { - swigCPtr = new HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_SWITCH_DECLARE_CLASS() { - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - - internal static HandleRef getCPtr(SWIGTYPE_p_SWITCH_DECLARE_CLASS obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -} - -} -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.35 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -namespace FreeSWITCH.Native { - -using System; -using System.Runtime.InteropServices; - public class SWIGTYPE_p_switch_event_node { private HandleRef swigCPtr; @@ -23607,7 +23591,9 @@ namespace FreeSWITCH.Native { SWITCH_SPEECH_FLAG_PEEK = (1 << 1), SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2), SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3), - SWITCH_SPEECH_FLAG_PAUSE = (1 << 4) + SWITCH_SPEECH_FLAG_PAUSE = (1 << 4), + SWITCH_SPEECH_FLAG_OPEN = (1 << 5), + SWITCH_SPEECH_FLAG_DONE = (1 << 6) } } @@ -23754,6 +23740,71 @@ public class switch_speech_handle : IDisposable { } } + public switch_audio_resampler_t resampler { + set { + freeswitchPINVOKE.switch_speech_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_resampler_get(swigCPtr); + switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_switch_buffer buffer { + set { + freeswitchPINVOKE.switch_speech_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_buffer_get(swigCPtr); + SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_unsigned_char dbuf { + set { + freeswitchPINVOKE.switch_speech_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_dbuf_get(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_switch_size_t dbuflen { + set { + freeswitchPINVOKE.switch_speech_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_speech_handle_dbuflen_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public uint samplerate { + set { + freeswitchPINVOKE.switch_speech_handle_samplerate_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_speech_handle_samplerate_get(swigCPtr); + return ret; + } + } + + public uint native_rate { + set { + freeswitchPINVOKE.switch_speech_handle_native_rate_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_speech_handle_native_rate_get(swigCPtr); + return ret; + } + } + public SWIGTYPE_p_void private_info { set { freeswitchPINVOKE.switch_speech_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); @@ -23855,13 +23906,13 @@ public class switch_speech_interface : IDisposable { } } - public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t speech_read_tts { + public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t speech_read_tts { set { - freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t.getCPtr(value)); + freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_read_tts_get(swigCPtr); - SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_unsigned_long__switch_status_t(cPtr, false); + SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(cPtr, false); return ret; } } diff --git a/src/mod/languages/mod_perl/freeswitch.pm b/src/mod/languages/mod_perl/freeswitch.pm index f422316289..c98854a9a5 100644 --- a/src/mod/languages/mod_perl/freeswitch.pm +++ b/src/mod/languages/mod_perl/freeswitch.pm @@ -122,6 +122,7 @@ sub DESTROY { *execute = *freeswitchc::API_execute; *executeString = *freeswitchc::API_executeString; +*getTime = *freeswitchc::API_getTime; sub DISOWN { my $self = shift; my $ptr = tied(%$self); diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index ba3122e3ab..4cba0dd7b1 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -2416,6 +2416,34 @@ XS(_wrap_API_executeString) { } +XS(_wrap_API_getTime) { + { + API *arg1 = (API *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: API_getTime(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_getTime" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + result = (char *)(arg1)->getTime(); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + XS(_wrap_input_callback_state_t_function_set) { { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; @@ -11045,6 +11073,7 @@ static swig_command_info swig_commands[] = { {"freeswitchc::delete_API", _wrap_delete_API}, {"freeswitchc::API_execute", _wrap_API_execute}, {"freeswitchc::API_executeString", _wrap_API_executeString}, +{"freeswitchc::API_getTime", _wrap_API_getTime}, {"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set}, {"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get}, {"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set}, @@ -11483,17 +11512,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index e1af53eba4..5017279876 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -81,6 +81,7 @@ class API(_object): __del__ = lambda self : None; def execute(*args): return _freeswitch.API_execute(*args) def executeString(*args): return _freeswitch.API_executeString(*args) + def getTime(*args): return _freeswitch.API_getTime(*args) API_swigregister = _freeswitch.API_swigregister API_swigregister(API) diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 5a800640e5..b3f4844efd 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -3472,6 +3472,28 @@ fail: } +SWIGINTERN PyObject *_wrap_API_getTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + API *arg1 = (API *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:API_getTime",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_getTime" "', argument " "1"" of type '" "API *""'"); + } + arg1 = reinterpret_cast< API * >(argp1); + result = (char *)(arg1)->getTime(); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; @@ -9936,6 +9958,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL}, { (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL}, { (char *)"API_executeString", _wrap_API_executeString, METH_VARARGS, NULL}, + { (char *)"API_getTime", _wrap_API_getTime, METH_VARARGS, NULL}, { (char *)"API_swigregister", API_swigregister, METH_VARARGS, NULL}, { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL}, { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL}, diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 498d7987b6..9c8f45dbb8 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -177,6 +177,17 @@ SWITCH_DECLARE(const char *) API::execute(const char *cmd, const char *arg) return last_data; } + +/* we have to do this as a string because swig and languages can't find an embedded way to pass a big int */ +SWITCH_DECLARE_NONSTD(char *) API::getTime(void) +{ + switch_time_t now = switch_micro_time_now() / 1000; + snprintf(time_buf, sizeof(time_buf), "%" SWITCH_TIME_T_FMT, now); + return time_buf; +} + + + SWITCH_DECLARE(const char *) API::executeString(const char *cmd) { char *arg;