[Freeswitch-svn] [commit] r8225 - in freeswitch/trunk/src: . include mod/languages/mod_java mod/languages/mod_java/src/org/freeswitch/swig mod/languages/mod_lua mod/languages/mod_perl mod/languages/mod_python
Freeswitch SVN
anthm at freeswitch.org
Wed Apr 30 19:42:38 EDT 2008
Author: anthm
Date: Wed Apr 30 19:42:37 2008
New Revision: 8225
Modified:
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c
freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/switch_cpp.cpp
Log:
break all the api in the swig stuff
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Wed Apr 30 19:42:37 2008
@@ -61,6 +61,19 @@
*/
+SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
+SWITCH_DECLARE(void) consoleCleanLog(char *msg);
+
+class API {
+ protected:
+ char *last_data;
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR API(void);
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~API();
+ SWITCH_DECLARE(char *) execute(const char *command, const char *data);
+ SWITCH_DECLARE(char *) executeString(const char *command);
+};
+
typedef struct input_callback_state {
void *function; // pointer to the language specific callback function
@@ -291,8 +304,6 @@
SWITCH_DECLARE(void) console_log(char *level_str, char *msg);
SWITCH_DECLARE(void) console_clean_log(char *msg);
-SWITCH_DECLARE(char *)api_execute(char *cmd, char *arg);
-SWITCH_DECLARE(void) api_reply_delete(char *reply);
/** \brief bridge the audio of session_b into session_a
*
Modified: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java (original)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java Wed Apr 30 19:42:37 2008
@@ -9,20 +9,20 @@
package org.freeswitch.swig;
public class freeswitch {
- public static void console_log(String level_str, String msg) {
- freeswitchJNI.console_log(level_str, msg);
+ public static void consoleLog(String level_str, String msg) {
+ freeswitchJNI.consoleLog(level_str, msg);
}
- public static void console_clean_log(String msg) {
- freeswitchJNI.console_clean_log(msg);
+ public static void consoleCleanLog(String msg) {
+ freeswitchJNI.consoleCleanLog(msg);
}
- public static String api_execute(String cmd, String arg) {
- return freeswitchJNI.api_execute(cmd, arg);
+ public static void console_log(String level_str, String msg) {
+ freeswitchJNI.console_log(level_str, msg);
}
- public static void api_reply_delete(String reply) {
- freeswitchJNI.api_reply_delete(reply);
+ public static void console_clean_log(String msg) {
+ freeswitchJNI.console_clean_log(msg);
}
public static void bridge(CoreSession session_a, CoreSession session_b) {
Modified: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java (original)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java Wed Apr 30 19:42:37 2008
@@ -9,6 +9,12 @@
package org.freeswitch.swig;
class freeswitchJNI {
+ public final static native void consoleLog(String jarg1, String jarg2);
+ public final static native void consoleCleanLog(String jarg1);
+ public final static native long new_API();
+ 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 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);
@@ -101,8 +107,6 @@
public final static native long CoreSession_run_dtmf_callback(long jarg1, CoreSession jarg1_, long jarg2, long jarg3);
public final static native void console_log(String jarg1, String jarg2);
public final static native void console_clean_log(String jarg1);
- public final static native String api_execute(String jarg1, String jarg2);
- public final static native void api_reply_delete(String jarg1);
public final static native void bridge(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_);
public final static native long hanguphook(long jarg1);
public final static native long dtmf_callback(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
Modified: freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp Wed Apr 30 19:42:37 2008
@@ -207,6 +207,117 @@
extern "C" {
#endif
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_consoleLog(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return ;
+ }
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ consoleLog(arg1,arg2);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_consoleCleanLog(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+ char *arg1 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return ;
+ }
+ consoleCleanLog(arg1);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1API(JNIEnv *jenv, jclass jcls) {
+ jlong jresult = 0 ;
+ API *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ result = (API *)new API();
+ *(API **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1API(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ API *arg1 = (API *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(API **)&jarg1;
+ delete arg1;
+
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_API_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ jstring jresult = 0 ;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(API **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return 0;
+ }
+ result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_API_1executeString(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ jstring jresult = 0 ;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(API **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ result = (char *)(arg1)->executeString((char const *)arg2);
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ 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 ;
@@ -1915,47 +2026,6 @@
}
-SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_api_1execute(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
- jstring jresult = 0 ;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- (void)jenv;
- (void)jcls;
- arg1 = 0;
- if (jarg1) {
- arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
- if (!arg1) return 0;
- }
- arg2 = 0;
- if (jarg2) {
- arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
- if (!arg2) return 0;
- }
- result = (char *)api_execute(arg1,arg2);
- if(result) jresult = jenv->NewStringUTF((const char *)result);
- if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
- if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
- return jresult;
-}
-
-
-SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_api_1reply_1delete(JNIEnv *jenv, jclass jcls, jstring jarg1) {
- char *arg1 = (char *) 0 ;
-
- (void)jenv;
- (void)jcls;
- arg1 = 0;
- if (jarg1) {
- arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
- if (!arg1) return ;
- }
- api_reply_delete(arg1);
- if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
-}
-
-
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_bridge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
CoreSession *arg1 = 0 ;
CoreSession *arg2 = 0 ;
Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c Wed Apr 30 19:42:37 2008
@@ -140,7 +140,15 @@
}
}
if (!error) {
- error = luaL_loadfile(L, input_code) || docall(L, 0, 1);
+ char *file = input_code, *fdup = NULL;
+
+ if (!switch_is_file_path(file)) {
+ fdup = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.script_dir, file);
+ switch_assert(fdup);
+ file = fdup;
+ }
+ error = luaL_loadfile(L, file) || docall(L, 0, 1);
+ switch_safe_free(fdup);
}
}
Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp Wed Apr 30 19:42:37 2008
@@ -1484,26 +1484,27 @@
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_CoreSession swig_types[0]
-#define SWIGTYPE_p_Event swig_types[1]
-#define SWIGTYPE_p_Session swig_types[2]
-#define SWIGTYPE_p_Stream swig_types[3]
-#define SWIGTYPE_p_input_callback_state swig_types[4]
-#define SWIGTYPE_p_lua_State swig_types[5]
-#define SWIGTYPE_p_session_flag_t swig_types[6]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[7]
-#define SWIGTYPE_p_switch_channel_t swig_types[8]
-#define SWIGTYPE_p_switch_core_session_t swig_types[9]
-#define SWIGTYPE_p_switch_event_t swig_types[10]
-#define SWIGTYPE_p_switch_input_args_t swig_types[11]
-#define SWIGTYPE_p_switch_input_type_t swig_types[12]
-#define SWIGTYPE_p_switch_priority_t swig_types[13]
-#define SWIGTYPE_p_switch_size_t swig_types[14]
-#define SWIGTYPE_p_switch_status_t swig_types[15]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[16]
-#define SWIGTYPE_p_void swig_types[17]
-static swig_type_info *swig_types[19];
-static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
+#define SWIGTYPE_p_API swig_types[0]
+#define SWIGTYPE_p_CoreSession swig_types[1]
+#define SWIGTYPE_p_Event swig_types[2]
+#define SWIGTYPE_p_Session swig_types[3]
+#define SWIGTYPE_p_Stream swig_types[4]
+#define SWIGTYPE_p_input_callback_state swig_types[5]
+#define SWIGTYPE_p_lua_State swig_types[6]
+#define SWIGTYPE_p_session_flag_t swig_types[7]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
+#define SWIGTYPE_p_switch_channel_t swig_types[9]
+#define SWIGTYPE_p_switch_core_session_t swig_types[10]
+#define SWIGTYPE_p_switch_event_t swig_types[11]
+#define SWIGTYPE_p_switch_input_args_t swig_types[12]
+#define SWIGTYPE_p_switch_input_type_t swig_types[13]
+#define SWIGTYPE_p_switch_priority_t swig_types[14]
+#define SWIGTYPE_p_switch_size_t swig_types[15]
+#define SWIGTYPE_p_switch_status_t swig_types[16]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
+#define SWIGTYPE_p_void swig_types[18]
+static swig_type_info *swig_types[20];
+static swig_module_info swig_module = {swig_types, 19, 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)
@@ -1528,6 +1529,167 @@
#ifdef __cplusplus
extern "C" {
#endif
+static int _wrap_consoleLog(lua_State* L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ SWIG_check_num_args("consoleLog",2,2)
+ if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *");
+ arg1 = (char *)lua_tostring(L, 1);
+ arg2 = (char *)lua_tostring(L, 2);
+ consoleLog(arg1,arg2);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_consoleCleanLog(lua_State* L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0 ;
+
+ SWIG_check_num_args("consoleCleanLog",1,1)
+ if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *");
+ arg1 = (char *)lua_tostring(L, 1);
+ consoleCleanLog(arg1);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_new_API(lua_State* L) {
+ int SWIG_arg = -1;
+ API *result = 0 ;
+
+ SWIG_check_num_args("API",0,0)
+ result = (API *)new API();
+ SWIG_arg=0;
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_delete_API(lua_State* L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0 ;
+
+ SWIG_check_num_args("API",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){
+ SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API);
+ }
+
+ delete arg1;
+
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_API_execute(lua_State* L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *result = 0 ;
+
+ SWIG_check_num_args("execute",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
+ SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+ 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 int _wrap_API_executeString(lua_State* L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+
+ SWIG_check_num_args("executeString",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
+ SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ result = (char *)(arg1)->executeString((char const *)arg2);
+ 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;
+}
+static swig_lua_method swig_API_methods[] = {
+ {"execute", _wrap_API_execute},
+ {"executeString", _wrap_API_executeString},
+ {0,0}
+};
+static swig_lua_attribute swig_API_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_class *swig_API_bases[] = {0};
+static const char *swig_API_base_names[] = {0};
+static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
+
static int _wrap_input_callback_state_t_function_set(lua_State* L) {
int SWIG_arg = -1;
input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
@@ -4640,50 +4802,6 @@
}
-static int _wrap_api_execute(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("api_execute",2,2)
- if(!lua_isstring(L,1)) SWIG_fail_arg("api_execute",1,"char *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("api_execute",2,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- arg2 = (char *)lua_tostring(L, 2);
- result = (char *)api_execute(arg1,arg2);
- 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 int _wrap_api_reply_delete(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
-
- SWIG_check_num_args("api_reply_delete",1,1)
- if(!lua_isstring(L,1)) SWIG_fail_arg("api_reply_delete",1,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- api_reply_delete(arg1);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
-
-
static int _wrap_bridge(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = 0 ;
@@ -5349,10 +5467,10 @@
#endif
static const struct luaL_reg swig_commands[] = {
+ { "consoleLog", _wrap_consoleLog},
+ { "consoleCleanLog", _wrap_consoleCleanLog},
{ "console_log", _wrap_console_log},
{ "console_clean_log", _wrap_console_clean_log},
- { "api_execute", _wrap_api_execute},
- { "api_reply_delete", _wrap_api_reply_delete},
{ "bridge", _wrap_bridge},
{ "hanguphook", _wrap_hanguphook},
{ "dtmf_callback", _wrap_dtmf_callback},
@@ -5375,6 +5493,7 @@
static void *_p_SessionTo_p_CoreSession(void *x, int *newmemory) {
return (void *)((CoreSession *) ((Session *) x));
}
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)&_wrap_class_Session, 0};
@@ -5395,6 +5514,7 @@
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
&_swigt__p_Session,
@@ -5415,6 +5535,7 @@
&_swigt__p_void,
};
+static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_Session, 0, 0, 0},{0, 0, 0, 0}};
@@ -5435,6 +5556,7 @@
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
_swigc__p_Session,
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm Wed Apr 30 19:42:37 2008
@@ -48,13 +48,54 @@
package freeswitch;
+*consoleLog = *freeswitchc::consoleLog;
+*consoleCleanLog = *freeswitchc::consoleCleanLog;
*console_log = *freeswitchc::console_log;
*console_clean_log = *freeswitchc::console_clean_log;
-*api_execute = *freeswitchc::api_execute;
-*api_reply_delete = *freeswitchc::api_reply_delete;
*bridge = *freeswitchc::bridge;
*hanguphook = *freeswitchc::hanguphook;
*dtmf_callback = *freeswitchc::dtmf_callback;
+*api_execute = *freeswitchc::api_execute;
+*api_reply_delete = *freeswitchc::api_reply_delete;
+
+############# Class : freeswitch::API ##############
+
+package freeswitch::API;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( freeswitch );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+ my $pkg = shift;
+ my $self = freeswitchc::new_API(@_);
+ bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+ return unless $_[0]->isa('HASH');
+ my $self = tied(%{$_[0]});
+ return unless defined $self;
+ delete $ITERATORS{$self};
+ if (exists $OWNER{$self}) {
+ freeswitchc::delete_API($self);
+ delete $OWNER{$self};
+ }
+}
+
+*execute = *freeswitchc::API_execute;
+*executeString = *freeswitchc::API_executeString;
+sub DISOWN {
+ my $self = shift;
+ my $ptr = tied(%$self);
+ delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+ my $self = shift;
+ my $ptr = tied(%$self);
+ $OWNER{$ptr} = 1;
+}
+
############# Class : freeswitch::input_callback_state_t ##############
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Wed Apr 30 19:42:37 2008
@@ -1446,26 +1446,27 @@
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_CoreSession swig_types[0]
-#define SWIGTYPE_p_Event swig_types[1]
-#define SWIGTYPE_p_Session swig_types[2]
-#define SWIGTYPE_p_Stream swig_types[3]
-#define SWIGTYPE_p_char swig_types[4]
-#define SWIGTYPE_p_input_callback_state swig_types[5]
-#define SWIGTYPE_p_session_flag_t swig_types[6]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[7]
-#define SWIGTYPE_p_switch_channel_t swig_types[8]
-#define SWIGTYPE_p_switch_core_session_t swig_types[9]
-#define SWIGTYPE_p_switch_event_t swig_types[10]
-#define SWIGTYPE_p_switch_input_args_t swig_types[11]
-#define SWIGTYPE_p_switch_input_type_t swig_types[12]
-#define SWIGTYPE_p_switch_priority_t swig_types[13]
-#define SWIGTYPE_p_switch_size_t swig_types[14]
-#define SWIGTYPE_p_switch_status_t swig_types[15]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[16]
-#define SWIGTYPE_p_void swig_types[17]
-static swig_type_info *swig_types[19];
-static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
+#define SWIGTYPE_p_API swig_types[0]
+#define SWIGTYPE_p_CoreSession swig_types[1]
+#define SWIGTYPE_p_Event swig_types[2]
+#define SWIGTYPE_p_Session swig_types[3]
+#define SWIGTYPE_p_Stream swig_types[4]
+#define SWIGTYPE_p_char swig_types[5]
+#define SWIGTYPE_p_input_callback_state swig_types[6]
+#define SWIGTYPE_p_session_flag_t swig_types[7]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
+#define SWIGTYPE_p_switch_channel_t swig_types[9]
+#define SWIGTYPE_p_switch_core_session_t swig_types[10]
+#define SWIGTYPE_p_switch_event_t swig_types[11]
+#define SWIGTYPE_p_switch_input_args_t swig_types[12]
+#define SWIGTYPE_p_switch_input_type_t swig_types[13]
+#define SWIGTYPE_p_switch_priority_t swig_types[14]
+#define SWIGTYPE_p_switch_size_t swig_types[15]
+#define SWIGTYPE_p_switch_status_t swig_types[16]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
+#define SWIGTYPE_p_void swig_types[18]
+static swig_type_info *swig_types[20];
+static swig_module_info swig_module = {swig_types, 19, 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)
@@ -1855,6 +1856,208 @@
#ifdef __cplusplus
extern "C" {
#endif
+XS(_wrap_consoleLog) {
+ {
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: consoleLog(level_str,msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ consoleLog(arg1,arg2);
+
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_consoleCleanLog) {
+ {
+ char *arg1 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: consoleCleanLog(msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ consoleCleanLog(arg1);
+
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_new_API) {
+ {
+ API *result = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_API();");
+ }
+ result = (API *)new API();
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_delete_API) {
+ {
+ API *arg1 = (API *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_API(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ delete arg1;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_API_execute) {
+ {
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: API_execute(self,command,data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_API_executeString) {
+ {
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: API_executeString(self,command);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ result = (char *)(arg1)->executeString((char const *)arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
XS(_wrap_input_callback_state_t_function_set) {
{
input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
@@ -5978,74 +6181,6 @@
}
-XS(_wrap_api_execute) {
- {
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: api_execute(cmd,arg);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)api_execute(arg1,arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
-
-
-XS(_wrap_api_reply_delete) {
- {
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: api_reply_delete(reply);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- api_reply_delete(arg1);
-
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- SWIG_croak_null();
- }
-}
-
-
XS(_wrap_bridge) {
{
CoreSession *arg1 = 0 ;
@@ -6185,6 +6320,74 @@
}
+XS(_wrap_api_execute) {
+ {
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: api_execute(cmd,arg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ result = (char *)api_execute(arg1,arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_api_reply_delete) {
+ {
+ char *arg1 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: api_reply_delete(reply);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ api_reply_delete(arg1);
+
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ SWIG_croak_null();
+ }
+}
+
+
XS(_wrap_new_Session__SWIG_0) {
{
Session *result = 0 ;
@@ -6898,6 +7101,7 @@
static void *_p_SessionTo_p_CoreSession(void *x, int *newmemory) {
return (void *)((CoreSession *) ((Session *) x));
}
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)"freeswitch::API", 0};
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)"freeswitch::CoreSession", 0};
static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)"freeswitch::Event", 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)"freeswitch::Session", 0};
@@ -6918,6 +7122,7 @@
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
&_swigt__p_Session,
@@ -6938,6 +7143,7 @@
&_swigt__p_void,
};
+static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_Session, 0, 0, 0},{0, 0, 0, 0}};
@@ -6958,6 +7164,7 @@
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
_swigc__p_Session,
@@ -6991,6 +7198,12 @@
{0,0,0,0}
};
static swig_command_info swig_commands[] = {
+{"freeswitchc::consoleLog", _wrap_consoleLog},
+{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
+{"freeswitchc::new_API", _wrap_new_API},
+{"freeswitchc::delete_API", _wrap_delete_API},
+{"freeswitchc::API_execute", _wrap_API_execute},
+{"freeswitchc::API_executeString", _wrap_API_executeString},
{"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},
@@ -7068,11 +7281,11 @@
{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
{"freeswitchc::console_log", _wrap_console_log},
{"freeswitchc::console_clean_log", _wrap_console_clean_log},
-{"freeswitchc::api_execute", _wrap_api_execute},
-{"freeswitchc::api_reply_delete", _wrap_api_reply_delete},
{"freeswitchc::bridge", _wrap_bridge},
{"freeswitchc::hanguphook", _wrap_hanguphook},
{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
+{"freeswitchc::api_execute", _wrap_api_execute},
+{"freeswitchc::api_reply_delete", _wrap_api_reply_delete},
{"freeswitchc::new_Session", _wrap_new_Session},
{"freeswitchc::delete_Session", _wrap_delete_Session},
{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
@@ -7385,6 +7598,7 @@
SvREADONLY_on(sv);
}
+ SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@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);
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 Wed Apr 30 19:42:37 2008
@@ -48,6 +48,25 @@
del types
+consoleLog = _freeswitch.consoleLog
+consoleCleanLog = _freeswitch.consoleCleanLog
+class API(_object):
+ __swig_setmethods__ = {}
+ __setattr__ = lambda self, name, value: _swig_setattr(self, API, name, value)
+ __swig_getmethods__ = {}
+ __getattr__ = lambda self, name: _swig_getattr(self, API, name)
+ __repr__ = _swig_repr
+ def __init__(self, *args):
+ this = _freeswitch.new_API(*args)
+ try: self.this.append(this)
+ except: self.this = this
+ __swig_destroy__ = _freeswitch.delete_API
+ __del__ = lambda self : None;
+ def execute(*args): return _freeswitch.API_execute(*args)
+ def executeString(*args): return _freeswitch.API_executeString(*args)
+API_swigregister = _freeswitch.API_swigregister
+API_swigregister(API)
+
class input_callback_state_t(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state_t, name, value)
@@ -191,13 +210,13 @@
console_log = _freeswitch.console_log
console_clean_log = _freeswitch.console_clean_log
-api_execute = _freeswitch.api_execute
-api_reply_delete = _freeswitch.api_reply_delete
bridge = _freeswitch.bridge
hanguphook = _freeswitch.hanguphook
dtmf_callback = _freeswitch.dtmf_callback
S_SWAPPED_IN = _freeswitch.S_SWAPPED_IN
S_SWAPPED_OUT = _freeswitch.S_SWAPPED_OUT
+api_execute = _freeswitch.api_execute
+api_reply_delete = _freeswitch.api_reply_delete
class PySession(CoreSession):
__swig_setmethods__ = {}
for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
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 Wed Apr 30 19:42:37 2008
@@ -2495,27 +2495,28 @@
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_CoreSession swig_types[0]
-#define SWIGTYPE_p_Event swig_types[1]
-#define SWIGTYPE_p_PySession swig_types[2]
-#define SWIGTYPE_p_Stream swig_types[3]
-#define SWIGTYPE_p_char swig_types[4]
-#define SWIGTYPE_p_input_callback_state swig_types[5]
-#define SWIGTYPE_p_session_flag_t swig_types[6]
-#define SWIGTYPE_p_swap_state_t swig_types[7]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
-#define SWIGTYPE_p_switch_channel_t swig_types[9]
-#define SWIGTYPE_p_switch_core_session_t swig_types[10]
-#define SWIGTYPE_p_switch_event_t swig_types[11]
-#define SWIGTYPE_p_switch_input_args_t swig_types[12]
-#define SWIGTYPE_p_switch_input_type_t swig_types[13]
-#define SWIGTYPE_p_switch_priority_t swig_types[14]
-#define SWIGTYPE_p_switch_size_t swig_types[15]
-#define SWIGTYPE_p_switch_status_t swig_types[16]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
-#define SWIGTYPE_p_void swig_types[18]
-static swig_type_info *swig_types[20];
-static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
+#define SWIGTYPE_p_API swig_types[0]
+#define SWIGTYPE_p_CoreSession swig_types[1]
+#define SWIGTYPE_p_Event swig_types[2]
+#define SWIGTYPE_p_PySession swig_types[3]
+#define SWIGTYPE_p_Stream swig_types[4]
+#define SWIGTYPE_p_char swig_types[5]
+#define SWIGTYPE_p_input_callback_state swig_types[6]
+#define SWIGTYPE_p_session_flag_t swig_types[7]
+#define SWIGTYPE_p_swap_state_t swig_types[8]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[9]
+#define SWIGTYPE_p_switch_channel_t swig_types[10]
+#define SWIGTYPE_p_switch_core_session_t swig_types[11]
+#define SWIGTYPE_p_switch_event_t swig_types[12]
+#define SWIGTYPE_p_switch_input_args_t swig_types[13]
+#define SWIGTYPE_p_switch_input_type_t swig_types[14]
+#define SWIGTYPE_p_switch_priority_t swig_types[15]
+#define SWIGTYPE_p_switch_size_t swig_types[16]
+#define SWIGTYPE_p_switch_status_t swig_types[17]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
+#define SWIGTYPE_p_void swig_types[19]
+static swig_type_info *swig_types[21];
+static swig_module_info swig_module = {swig_types, 20, 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)
@@ -2953,6 +2954,188 @@
#ifdef __cplusplus
extern "C" {
#endif
+SWIGINTERN PyObject *_wrap_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:consoleLog",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ consoleLog(arg1,arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:consoleCleanLog",&obj0)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ consoleCleanLog(arg1);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return resultobj;
+fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ API *result = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)":new_API")) SWIG_fail;
+ result = (API *)new API();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:delete_API",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ delete arg1;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_API_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:API_execute",&obj0,&obj1,&obj2)) 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_execute" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+ resultobj = SWIG_FromCharPtr((const char *)result);
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_API_executeString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:API_executeString",&obj0,&obj1)) 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_executeString" "', argument " "1"" of type '" "API *""'");
+ }
+ arg1 = reinterpret_cast< API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ result = (char *)(arg1)->executeString((char const *)arg2);
+ resultobj = SWIG_FromCharPtr((const char *)result);
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+}
+
SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
@@ -6294,67 +6477,6 @@
}
-SWIGINTERN PyObject *_wrap_api_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:api_execute",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)api_execute(arg1,arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_api_reply_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:api_reply_delete",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- api_reply_delete(arg1);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = 0 ;
@@ -6475,6 +6597,67 @@
}
+SWIGINTERN PyObject *_wrap_api_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:api_execute",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ result = (char *)api_execute(arg1,arg2);
+ resultobj = SWIG_FromCharPtr((const char *)result);
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_api_reply_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:api_reply_delete",&obj0)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+ api_reply_delete(arg1);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return resultobj;
+fail:
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PySession *result = 0 ;
@@ -6810,6 +6993,13 @@
}
static PyMethodDef SwigMethods[] = {
+ { (char *)"consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
+ { (char *)"consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
+ { (char *)"new_API", _wrap_new_API, METH_VARARGS, NULL},
+ { (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_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},
{ (char *)"input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
@@ -6891,11 +7081,11 @@
{ (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
{ (char *)"console_log", _wrap_console_log, METH_VARARGS, NULL},
{ (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
- { (char *)"api_execute", _wrap_api_execute, METH_VARARGS, NULL},
- { (char *)"api_reply_delete", _wrap_api_reply_delete, METH_VARARGS, NULL},
{ (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
{ (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
{ (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
+ { (char *)"api_execute", _wrap_api_execute, METH_VARARGS, NULL},
+ { (char *)"api_reply_delete", _wrap_api_reply_delete, METH_VARARGS, NULL},
{ (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
{ (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
{ (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
@@ -6915,6 +7105,7 @@
static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
return (void *)((CoreSession *) ((PySession *) x));
}
+static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0};
@@ -6936,6 +7127,7 @@
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
&_swigt__p_PySession,
@@ -6957,6 +7149,7 @@
&_swigt__p_void,
};
+static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}};
@@ -6978,6 +7171,7 @@
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
_swigc__p_PySession,
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Wed Apr 30 19:42:37 2008
@@ -37,6 +37,46 @@
#pragma warning(disable:4127 4003)
#endif
+SWITCH_DECLARE_CONSTRUCTOR API::API()
+{
+ last_data = NULL;
+}
+
+SWITCH_DECLARE_CONSTRUCTOR API::~API()
+{
+ switch_safe_free(last_data);
+}
+
+
+SWITCH_DECLARE(char *) API::execute(const char *cmd, const char *arg)
+{
+ switch_stream_handle_t stream = { 0 };
+ SWITCH_STANDARD_STREAM(stream);
+ switch_api_execute(cmd, arg, NULL, &stream);
+ last_data = (char *) stream.data;
+ return last_data;
+}
+
+SWITCH_DECLARE(char *) API::executeString(const char *cmd)
+{
+ char *arg;
+ switch_stream_handle_t stream = { 0 };
+ char *mycmd = strdup(cmd);
+
+ switch_assert(mycmd);
+
+ if ((arg = strchr(mycmd, ' '))) {
+ *arg++ = '\0';
+ }
+
+ switch_safe_free(last_data);
+
+ SWITCH_STANDARD_STREAM(stream);
+ switch_api_execute(mycmd, arg, NULL, &stream);
+ last_data = (char *) stream.data;
+ switch_safe_free(mycmd);
+ return last_data;
+}
SWITCH_DECLARE_CONSTRUCTOR Event::Event(const char *type, const char *subclass_name)
{
@@ -697,6 +737,15 @@
/* ---- methods not bound to CoreSession instance ---- */
+SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg)
+{
+ return console_log(level_str, msg);
+}
+
+SWITCH_DECLARE(void) consoleCleanLog(char *msg)
+{
+ return console_clean_log(msg);
+}
SWITCH_DECLARE(void) console_log(char *level_str, char *msg)
{
@@ -716,22 +765,6 @@
}
-SWITCH_DECLARE(char *)api_execute(char *cmd, char *arg)
-{
- switch_stream_handle_t stream = { 0 };
- SWITCH_STANDARD_STREAM(stream);
- switch_api_execute(cmd, arg, NULL, &stream);
- return (char *) stream.data;
-}
-
-SWITCH_DECLARE(void) api_reply_delete(char *reply)
-{
- if (!switch_strlen_zero(reply)) {
- free(reply);
- }
-}
-
-
SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bridge called, session_a uuid: %s\n", session_a.get_uuid());
@@ -746,7 +779,6 @@
}
-
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup)
{
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
More information about the Freeswitch-svn
mailing list