From a1cf7067b6040b140f39e1e3a870ce4be1bef8b0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 2 Jul 2008 21:12:57 +0000 Subject: [PATCH] add EventConsumer obj to cpp git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8884 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_cpp.h | 8 +- .../org/freeswitch/swig/EventConsumer.java | 104 +++ .../org/freeswitch/swig/freeswitchJNI.java | 17 + .../languages/mod_java/switch_swig_wrap.cpp | 304 +++++++ src/mod/languages/mod_lua/mod_lua_wrap.cpp | 638 +++++++++++++- src/mod/languages/mod_perl/freeswitch.pm | 50 ++ src/mod/languages/mod_perl/mod_perl_wrap.cpp | 795 +++++++++++++++++- src/mod/languages/mod_python/freeswitch.py | 34 + .../languages/mod_python/mod_python_wrap.cpp | 652 +++++++++++++- src/switch_cpp.cpp | 78 +- 10 files changed, 2597 insertions(+), 83 deletions(-) create mode 100644 src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index f15c8acd20..8848a12f20 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -138,13 +138,17 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg); class EventConsumer { protected: + switch_memory_pool_t *pool; + public: + switch_queue_t *events; switch_event_types_t e_event_id; switch_event_node_t *node; char *e_callback; char *e_subclass_name; - public: - SWITCH_DECLARE_CONSTRUCTOR EventConsumer(switch_event_types_t event_id, const char *subclass_name = "", const char *callback = "event_consumer"); + char *e_cb_arg; + SWITCH_DECLARE_CONSTRUCTOR EventConsumer(const char *event_name, const char *subclass_name = ""); SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer(); + SWITCH_DECLARE(Event *) pop(int block = 0); }; class CoreSession { diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java new file mode 100644 index 0000000000..0e96cb0be9 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/EventConsumer.java @@ -0,0 +1,104 @@ +/* ---------------------------------------------------------------------------- + * 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. + * ----------------------------------------------------------------------------- */ + +package org.freeswitch.swig; + +public class EventConsumer { + private long swigCPtr; + protected boolean swigCMemOwn; + + protected EventConsumer(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr(EventConsumer obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } + + protected void finalize() { + delete(); + } + + public synchronized void delete() { + if(swigCPtr != 0 && swigCMemOwn) { + swigCMemOwn = false; + freeswitchJNI.delete_EventConsumer(swigCPtr); + } + swigCPtr = 0; + } + + public void setEvents(SWIGTYPE_p_switch_queue_t value) { + freeswitchJNI.EventConsumer_events_set(swigCPtr, this, SWIGTYPE_p_switch_queue_t.getCPtr(value)); + } + + public SWIGTYPE_p_switch_queue_t getEvents() { + long cPtr = freeswitchJNI.EventConsumer_events_get(swigCPtr, this); + return (cPtr == 0) ? null : new SWIGTYPE_p_switch_queue_t(cPtr, false); + } + + public void setE_event_id(SWIGTYPE_p_switch_event_types_t value) { + freeswitchJNI.EventConsumer_e_event_id_set(swigCPtr, this, SWIGTYPE_p_switch_event_types_t.getCPtr(value)); + } + + public SWIGTYPE_p_switch_event_types_t getE_event_id() { + return new SWIGTYPE_p_switch_event_types_t(freeswitchJNI.EventConsumer_e_event_id_get(swigCPtr, this), true); + } + + public void setNode(SWIGTYPE_p_switch_event_node_t value) { + freeswitchJNI.EventConsumer_node_set(swigCPtr, this, SWIGTYPE_p_switch_event_node_t.getCPtr(value)); + } + + public SWIGTYPE_p_switch_event_node_t getNode() { + long cPtr = freeswitchJNI.EventConsumer_node_get(swigCPtr, this); + return (cPtr == 0) ? null : new SWIGTYPE_p_switch_event_node_t(cPtr, false); + } + + public void setE_callback(String value) { + freeswitchJNI.EventConsumer_e_callback_set(swigCPtr, this, value); + } + + public String getE_callback() { + return freeswitchJNI.EventConsumer_e_callback_get(swigCPtr, this); + } + + public void setE_subclass_name(String value) { + freeswitchJNI.EventConsumer_e_subclass_name_set(swigCPtr, this, value); + } + + public String getE_subclass_name() { + return freeswitchJNI.EventConsumer_e_subclass_name_get(swigCPtr, this); + } + + public void setE_cb_arg(String value) { + freeswitchJNI.EventConsumer_e_cb_arg_set(swigCPtr, this, value); + } + + public String getE_cb_arg() { + return freeswitchJNI.EventConsumer_e_cb_arg_get(swigCPtr, this); + } + + public EventConsumer(String event_name, String subclass_name) { + this(freeswitchJNI.new_EventConsumer__SWIG_0(event_name, subclass_name), true); + } + + public EventConsumer(String event_name) { + this(freeswitchJNI.new_EventConsumer__SWIG_1(event_name), true); + } + + public Event pop(int block) { + long cPtr = freeswitchJNI.EventConsumer_pop__SWIG_0(swigCPtr, this, block); + return (cPtr == 0) ? null : new Event(cPtr, false); + } + + public Event pop() { + long cPtr = freeswitchJNI.EventConsumer_pop__SWIG_1(swigCPtr, this); + return (cPtr == 0) ? null : new Event(cPtr, false); + } + +} 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 b0099b45c6..c6ffd5ec29 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 @@ -59,6 +59,23 @@ class freeswitchJNI { public final static native boolean Event_addHeader(long jarg1, Event jarg1_, String jarg2, String jarg3); public final static native boolean Event_delHeader(long jarg1, Event jarg1_, String jarg2); public final static native boolean Event_fire(long jarg1, Event jarg1_); + public final static native void EventConsumer_events_set(long jarg1, EventConsumer jarg1_, long jarg2); + public final static native long EventConsumer_events_get(long jarg1, EventConsumer jarg1_); + public final static native void EventConsumer_e_event_id_set(long jarg1, EventConsumer jarg1_, long jarg2); + public final static native long EventConsumer_e_event_id_get(long jarg1, EventConsumer jarg1_); + public final static native void EventConsumer_node_set(long jarg1, EventConsumer jarg1_, long jarg2); + public final static native long EventConsumer_node_get(long jarg1, EventConsumer jarg1_); + public final static native void EventConsumer_e_callback_set(long jarg1, EventConsumer jarg1_, String jarg2); + public final static native String EventConsumer_e_callback_get(long jarg1, EventConsumer jarg1_); + public final static native void EventConsumer_e_subclass_name_set(long jarg1, EventConsumer jarg1_, String jarg2); + public final static native String EventConsumer_e_subclass_name_get(long jarg1, EventConsumer jarg1_); + public final static native void EventConsumer_e_cb_arg_set(long jarg1, EventConsumer jarg1_, String jarg2); + public final static native String EventConsumer_e_cb_arg_get(long jarg1, EventConsumer jarg1_); + public final static native long new_EventConsumer__SWIG_0(String jarg1, String jarg2); + public final static native long new_EventConsumer__SWIG_1(String jarg1); + public final static native void delete_EventConsumer(long jarg1); + public final static native long EventConsumer_pop__SWIG_0(long jarg1, EventConsumer jarg1_, int jarg2); + public final static native long EventConsumer_pop__SWIG_1(long jarg1, EventConsumer jarg1_); public final static native void delete_CoreSession(long jarg1); public final static native void CoreSession_session_set(long jarg1, CoreSession jarg1_, long jarg2); public final static native long CoreSession_session_get(long jarg1, CoreSession jarg1_); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index 3a96168bbb..c4af8353b5 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -1113,6 +1113,310 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_Event_1fire(J } +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *arg2 = (switch_queue_t *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = *(switch_queue_t **)&jarg2; + if (arg1) (arg1)->events = arg2; + +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1events_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (switch_queue_t *) ((arg1)->events); + *(switch_queue_t **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1event_1id_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t arg2 ; + switch_event_types_t *argp2 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + argp2 = *(switch_event_types_t **)&jarg2; + if (!argp2) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_event_types_t"); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->e_event_id = arg2; + +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1event_1id_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = ((arg1)->e_event_id); + *(switch_event_types_t **)&jresult = new switch_event_types_t((switch_event_types_t &)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1node_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *arg2 = (switch_event_node_t *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = *(switch_event_node_t **)&jarg2; + if (arg1) (arg1)->node = arg2; + +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1node_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (switch_event_node_t *) ((arg1)->node); + *(switch_event_node_t **)&jresult = result; + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1callback_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + if (arg1->e_callback) delete [] arg1->e_callback; + if (arg2) { + arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_callback, (const char *)arg2); + } else { + arg1->e_callback = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1callback_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (char *) ((arg1)->e_callback); + if(result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1subclass_1name_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + if (arg1->e_subclass_name) delete [] arg1->e_subclass_name; + if (arg2) { + arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_subclass_name, (const char *)arg2); + } else { + arg1->e_subclass_name = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1subclass_1name_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (char *) ((arg1)->e_subclass_name); + if(result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1cb_1arg_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return ; + } + { + if (arg1->e_cb_arg) delete [] arg1->e_cb_arg; + if (arg2) { + arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_cb_arg, (const char *)arg2); + } else { + arg1->e_cb_arg = 0; + } + } + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); +} + + +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1e_1cb_1arg_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jstring jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (char *) ((arg1)->e_cb_arg); + if(result) jresult = jenv->NewStringUTF((const char *)result); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1EventConsumer_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) { + jlong jresult = 0 ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + EventConsumer *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 = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); + *(EventConsumer **)&jresult = result; + if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1); + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1EventConsumer_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jlong jresult = 0 ; + char *arg1 = (char *) 0 ; + EventConsumer *result = 0 ; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0); + if (!arg1) return 0; + } + result = (EventConsumer *)new EventConsumer((char const *)arg1); + *(EventConsumer **)&jresult = result; + if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1EventConsumer(JNIEnv *jenv, jclass jcls, jlong jarg1) { + EventConsumer *arg1 = (EventConsumer *) 0 ; + + (void)jenv; + (void)jcls; + arg1 = *(EventConsumer **)&jarg1; + delete arg1; + +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1pop_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) { + jlong jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + int arg2 ; + Event *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + arg2 = (int)jarg2; + result = (Event *)(arg1)->pop(arg2); + *(Event **)&jresult = result; + return jresult; +} + + +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_EventConsumer_1pop_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { + jlong jresult = 0 ; + EventConsumer *arg1 = (EventConsumer *) 0 ; + Event *result = 0 ; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(EventConsumer **)&jarg1; + result = (Event *)(arg1)->pop(); + *(Event **)&jresult = result; + return jresult; +} + + SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1CoreSession(JNIEnv *jenv, jclass jcls, jlong jarg1) { CoreSession *arg1 = (CoreSession *) 0 ; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index f48d6813ca..212f907d21 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1487,24 +1487,28 @@ SWIG_Lua_dostring(lua_State *L, const char* str) { #define SWIGTYPE_p_API swig_types[0] #define SWIGTYPE_p_CoreSession swig_types[1] #define SWIGTYPE_p_Event swig_types[2] -#define SWIGTYPE_p_IVRMenu swig_types[3] -#define SWIGTYPE_p_LUA__Session swig_types[4] -#define SWIGTYPE_p_Stream swig_types[5] -#define SWIGTYPE_p_input_callback_state swig_types[6] -#define SWIGTYPE_p_lua_State swig_types[7] -#define SWIGTYPE_p_session_flag_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_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_EventConsumer swig_types[3] +#define SWIGTYPE_p_IVRMenu swig_types[4] +#define SWIGTYPE_p_LUA__Session swig_types[5] +#define SWIGTYPE_p_Stream swig_types[6] +#define SWIGTYPE_p_input_callback_state swig_types[7] +#define SWIGTYPE_p_lua_State swig_types[8] +#define SWIGTYPE_p_session_flag_t swig_types[9] +#define SWIGTYPE_p_switch_channel_state_t swig_types[10] +#define SWIGTYPE_p_switch_channel_t swig_types[11] +#define SWIGTYPE_p_switch_core_session_t swig_types[12] +#define SWIGTYPE_p_switch_event_node_t swig_types[13] +#define SWIGTYPE_p_switch_event_t swig_types[14] +#define SWIGTYPE_p_switch_event_types_t swig_types[15] +#define SWIGTYPE_p_switch_input_args_t swig_types[16] +#define SWIGTYPE_p_switch_input_type_t swig_types[17] +#define SWIGTYPE_p_switch_priority_t swig_types[18] +#define SWIGTYPE_p_switch_queue_t swig_types[19] +#define SWIGTYPE_p_switch_status_t swig_types[20] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[21] +#define SWIGTYPE_p_void swig_types[22] +static swig_type_info *swig_types[24]; +static swig_module_info swig_module = {swig_types, 23, 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) @@ -3092,6 +3096,588 @@ static swig_lua_class *swig_Event_bases[] = {0}; static const char *swig_Event_base_names[] = {0}; static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names }; +static int _wrap_EventConsumer_events_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *arg2 = (switch_queue_t *) 0 ; + + SWIG_check_num_args("events",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("events",2,"switch_queue_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_events_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_queue_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("EventConsumer_events_set",2,SWIGTYPE_p_switch_queue_t); + } + + if (arg1) (arg1)->events = arg2; + + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_events_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *result = 0 ; + + SWIG_check_num_args("events",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_events_get",1,SWIGTYPE_p_EventConsumer); + } + + result = (switch_queue_t *) ((arg1)->events); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_queue_t,0); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_event_id_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t arg2 ; + switch_event_types_t *argp2 ; + + SWIG_check_num_args("e_event_id",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("e_event_id",2,"switch_event_types_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_event_types_t,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_set",2,SWIGTYPE_p_switch_event_types_t); + } + arg2 = *argp2; + + if (arg1) (arg1)->e_event_id = arg2; + + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_event_id_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t result; + + SWIG_check_num_args("e_event_id",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_get",1,SWIGTYPE_p_EventConsumer); + } + + result = ((arg1)->e_event_id); + SWIG_arg=0; + { + switch_event_types_t * resultptr = new switch_event_types_t((switch_event_types_t &) result); + SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_event_types_t,1); SWIG_arg++; + } + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_node_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *arg2 = (switch_event_node_t *) 0 ; + + SWIG_check_num_args("node",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node",1,"EventConsumer *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("node",2,"switch_event_node_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_node_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_node_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("EventConsumer_node_set",2,SWIGTYPE_p_switch_event_node_t); + } + + if (arg1) (arg1)->node = arg2; + + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_node_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *result = 0 ; + + SWIG_check_num_args("node",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_node_get",1,SWIGTYPE_p_EventConsumer); + } + + result = (switch_event_node_t *) ((arg1)->node); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_node_t,0); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_callback_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + SWIG_check_num_args("e_callback",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_callback",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_callback_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); + { + if (arg1->e_callback) delete [] arg1->e_callback; + if (arg2) { + arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_callback, (const char *)arg2); + } else { + arg1->e_callback = 0; + } + } + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_callback_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + SWIG_check_num_args("e_callback",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_callback_get",1,SWIGTYPE_p_EventConsumer); + } + + result = (char *) ((arg1)->e_callback); + 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_EventConsumer_e_subclass_name_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + SWIG_check_num_args("e_subclass_name",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_subclass_name",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_subclass_name_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); + { + if (arg1->e_subclass_name) delete [] arg1->e_subclass_name; + if (arg2) { + arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_subclass_name, (const char *)arg2); + } else { + arg1->e_subclass_name = 0; + } + } + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_subclass_name_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + SWIG_check_num_args("e_subclass_name",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_subclass_name_get",1,SWIGTYPE_p_EventConsumer); + } + + result = (char *) ((arg1)->e_subclass_name); + 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_EventConsumer_e_cb_arg_set(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 0 ; + + SWIG_check_num_args("e_cb_arg",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_cb_arg",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_cb_arg_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); + { + if (arg1->e_cb_arg) delete [] arg1->e_cb_arg; + if (arg2) { + arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_cb_arg, (const char *)arg2); + } else { + arg1->e_cb_arg = 0; + } + } + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_e_cb_arg_get(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + + SWIG_check_num_args("e_cb_arg",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_cb_arg_get",1,SWIGTYPE_p_EventConsumer); + } + + result = (char *) ((arg1)->e_cb_arg); + 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_new_EventConsumer__SWIG_0(lua_State* L) { + int SWIG_arg = -1; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + EventConsumer *result = 0 ; + + SWIG_check_num_args("EventConsumer",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("EventConsumer",2,"char const *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); + result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_new_EventConsumer__SWIG_1(lua_State* L) { + int SWIG_arg = -1; + char *arg1 = (char *) 0 ; + EventConsumer *result = 0 ; + + SWIG_check_num_args("EventConsumer",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *"); + arg1 = (char *)lua_tostring(L, 1); + result = (EventConsumer *)new EventConsumer((char const *)arg1); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_new_EventConsumer(lua_State* L) { + int argc; + int argv[3]={ + 1,2,3 + }; + + argc = lua_gettop(L); + if (argc == 1) { + int _v; + { + _v = lua_isstring(L,argv[0]); + } + if (_v) { + return _wrap_new_EventConsumer__SWIG_1(L); + } + } + if (argc == 2) { + int _v; + { + _v = lua_isstring(L,argv[0]); + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + return _wrap_new_EventConsumer__SWIG_0(L); + } + } + } + + lua_pushstring(L,"No matching function for overloaded 'new_EventConsumer'"); + lua_error(L);return 0; +} + + +static int _wrap_delete_EventConsumer(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + + SWIG_check_num_args("EventConsumer",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("EventConsumer",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_EventConsumer",1,SWIGTYPE_p_EventConsumer); + } + + delete arg1; + + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_pop__SWIG_0(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + int arg2 ; + Event *result = 0 ; + + SWIG_check_num_args("pop",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("pop",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (int)lua_tonumber(L, 2); + result = (Event *)(arg1)->pop(arg2); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_pop__SWIG_1(lua_State* L) { + int SWIG_arg = -1; + EventConsumer *arg1 = (EventConsumer *) 0 ; + Event *result = 0 ; + + SWIG_check_num_args("pop",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer); + } + + result = (Event *)(arg1)->pop(); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,0); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_EventConsumer_pop(lua_State* L) { + int argc; + int argv[3]={ + 1,2,3 + }; + + argc = lua_gettop(L); + if (argc == 1) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_EventConsumer, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + return _wrap_EventConsumer_pop__SWIG_1(L); + } + } + if (argc == 2) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_EventConsumer, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + { + _v = lua_isnumber(L,argv[1]); + } + if (_v) { + return _wrap_EventConsumer_pop__SWIG_0(L); + } + } + } + + lua_pushstring(L,"No matching function for overloaded 'EventConsumer_pop'"); + lua_error(L);return 0; +} + + +static void swig_delete_EventConsumer(void *obj) { +EventConsumer *arg1 = (EventConsumer *) obj; +delete arg1; +} +static swig_lua_method swig_EventConsumer_methods[] = { + {"pop", _wrap_EventConsumer_pop}, + {0,0} +}; +static swig_lua_attribute swig_EventConsumer_attributes[] = { + { "events", _wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set}, + { "e_event_id", _wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set}, + { "node", _wrap_EventConsumer_node_get, _wrap_EventConsumer_node_set}, + { "e_callback", _wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set}, + { "e_subclass_name", _wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set}, + { "e_cb_arg", _wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set}, + {0,0,0} +}; +static swig_lua_class *swig_EventConsumer_bases[] = {0}; +static const char *swig_EventConsumer_base_names[] = {0}; +static swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases, swig_EventConsumer_base_names }; + static int _wrap_delete_CoreSession(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; @@ -6412,6 +6998,7 @@ static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) { 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_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)&_wrap_class_EventConsumer, 0}; static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0}; static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0}; static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0}; @@ -6421,10 +7008,13 @@ static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum ses static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -6433,6 +7023,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_API, &_swigt__p_CoreSession, &_swigt__p_Event, + &_swigt__p_EventConsumer, &_swigt__p_IVRMenu, &_swigt__p_LUA__Session, &_swigt__p_Stream, @@ -6442,10 +7033,13 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_channel_state_t, &_swigt__p_switch_channel_t, &_swigt__p_switch_core_session_t, + &_swigt__p_switch_event_node_t, &_swigt__p_switch_event_t, + &_swigt__p_switch_event_types_t, &_swigt__p_switch_input_args_t, &_swigt__p_switch_input_type_t, &_swigt__p_switch_priority_t, + &_swigt__p_switch_queue_t, &_swigt__p_switch_status_t, &_swigt__p_switch_stream_handle_t, &_swigt__p_void, @@ -6454,6 +7048,7 @@ static swig_type_info *swig_type_initial[] = { 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_LUA__Session, _p_LUA__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_EventConsumer[] = { {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; @@ -6463,10 +7058,13 @@ static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}}; 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_event_node_t[] = { {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_event_types_t[] = { {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_queue_t[] = { {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -6475,6 +7073,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_API, _swigc__p_CoreSession, _swigc__p_Event, + _swigc__p_EventConsumer, _swigc__p_IVRMenu, _swigc__p_LUA__Session, _swigc__p_Stream, @@ -6484,10 +7083,13 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_channel_state_t, _swigc__p_switch_channel_t, _swigc__p_switch_core_session_t, + _swigc__p_switch_event_node_t, _swigc__p_switch_event_t, + _swigc__p_switch_event_types_t, _swigc__p_switch_input_args_t, _swigc__p_switch_input_type_t, _swigc__p_switch_priority_t, + _swigc__p_switch_queue_t, _swigc__p_switch_status_t, _swigc__p_switch_stream_handle_t, _swigc__p_void, diff --git a/src/mod/languages/mod_perl/freeswitch.pm b/src/mod/languages/mod_perl/freeswitch.pm index 3e5555ed82..097cfa7937 100644 --- a/src/mod/languages/mod_perl/freeswitch.pm +++ b/src/mod/languages/mod_perl/freeswitch.pm @@ -270,6 +270,56 @@ sub ACQUIRE { } +############# Class : freeswitch::EventConsumer ############## + +package freeswitch::EventConsumer; +use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); +@ISA = qw( freeswitch ); +%OWNER = (); +%ITERATORS = (); +*swig_events_get = *freeswitchc::EventConsumer_events_get; +*swig_events_set = *freeswitchc::EventConsumer_events_set; +*swig_e_event_id_get = *freeswitchc::EventConsumer_e_event_id_get; +*swig_e_event_id_set = *freeswitchc::EventConsumer_e_event_id_set; +*swig_node_get = *freeswitchc::EventConsumer_node_get; +*swig_node_set = *freeswitchc::EventConsumer_node_set; +*swig_e_callback_get = *freeswitchc::EventConsumer_e_callback_get; +*swig_e_callback_set = *freeswitchc::EventConsumer_e_callback_set; +*swig_e_subclass_name_get = *freeswitchc::EventConsumer_e_subclass_name_get; +*swig_e_subclass_name_set = *freeswitchc::EventConsumer_e_subclass_name_set; +*swig_e_cb_arg_get = *freeswitchc::EventConsumer_e_cb_arg_get; +*swig_e_cb_arg_set = *freeswitchc::EventConsumer_e_cb_arg_set; +sub new { + my $pkg = shift; + my $self = freeswitchc::new_EventConsumer(@_); + 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_EventConsumer($self); + delete $OWNER{$self}; + } +} + +*pop = *freeswitchc::EventConsumer_pop; +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::CoreSession ############## package freeswitch::CoreSession; diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index a44f4e7f2d..326c65e2d8 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -1449,25 +1449,29 @@ SWIG_Perl_SetModule(swig_module_info *module) { #define SWIGTYPE_p_API swig_types[0] #define SWIGTYPE_p_CoreSession swig_types[1] #define SWIGTYPE_p_Event swig_types[2] -#define SWIGTYPE_p_IVRMenu swig_types[3] -#define SWIGTYPE_p_PERL__Session swig_types[4] -#define SWIGTYPE_p_PerlInterpreter swig_types[5] -#define SWIGTYPE_p_Stream swig_types[6] -#define SWIGTYPE_p_char swig_types[7] -#define SWIGTYPE_p_input_callback_state swig_types[8] -#define SWIGTYPE_p_session_flag_t swig_types[9] -#define SWIGTYPE_p_switch_channel_state_t swig_types[10] -#define SWIGTYPE_p_switch_channel_t swig_types[11] -#define SWIGTYPE_p_switch_core_session_t swig_types[12] -#define SWIGTYPE_p_switch_event_t swig_types[13] -#define SWIGTYPE_p_switch_input_args_t swig_types[14] -#define SWIGTYPE_p_switch_input_type_t swig_types[15] -#define SWIGTYPE_p_switch_priority_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 SWIGTYPE_p_EventConsumer swig_types[3] +#define SWIGTYPE_p_IVRMenu swig_types[4] +#define SWIGTYPE_p_PERL__Session swig_types[5] +#define SWIGTYPE_p_PerlInterpreter swig_types[6] +#define SWIGTYPE_p_Stream swig_types[7] +#define SWIGTYPE_p_char swig_types[8] +#define SWIGTYPE_p_input_callback_state swig_types[9] +#define SWIGTYPE_p_session_flag_t swig_types[10] +#define SWIGTYPE_p_switch_channel_state_t swig_types[11] +#define SWIGTYPE_p_switch_channel_t swig_types[12] +#define SWIGTYPE_p_switch_core_session_t swig_types[13] +#define SWIGTYPE_p_switch_event_node_t swig_types[14] +#define SWIGTYPE_p_switch_event_t swig_types[15] +#define SWIGTYPE_p_switch_event_types_t swig_types[16] +#define SWIGTYPE_p_switch_input_args_t swig_types[17] +#define SWIGTYPE_p_switch_input_type_t swig_types[18] +#define SWIGTYPE_p_switch_priority_t swig_types[19] +#define SWIGTYPE_p_switch_queue_t swig_types[20] +#define SWIGTYPE_p_switch_status_t swig_types[21] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[22] +#define SWIGTYPE_p_void swig_types[23] +static swig_type_info *swig_types[25]; +static swig_module_info swig_module = {swig_types, 24, 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) @@ -3869,6 +3873,727 @@ XS(_wrap_Event_fire) { } +XS(_wrap_EventConsumer_events_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *arg2 = (switch_queue_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: EventConsumer_events_set(self,events);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_queue_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_events_set" "', argument " "2"" of type '" "switch_queue_t *""'"); + } + arg2 = reinterpret_cast< switch_queue_t * >(argp2); + if (arg1) (arg1)->events = arg2; + + + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_events_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_events_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_queue_t *) ((arg1)->events); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_queue_t, 0 | 0); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_event_id_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: EventConsumer_e_event_id_set(self,e_event_id);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + { + res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_event_types_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } else { + arg2 = *(reinterpret_cast< switch_event_types_t * >(argp2)); + } + } + if (arg1) (arg1)->e_event_id = arg2; + + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_event_id_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t result; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_e_event_id_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = ((arg1)->e_event_id); + ST(argvi) = SWIG_NewPointerObj((new switch_event_types_t(static_cast< const switch_event_types_t& >(result))), SWIGTYPE_p_switch_event_types_t, SWIG_POINTER_OWN | 0); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_node_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *arg2 = (switch_event_node_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: EventConsumer_node_set(self,node);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_event_node_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_node_set" "', argument " "2"" of type '" "switch_event_node_t *""'"); + } + arg2 = reinterpret_cast< switch_event_node_t * >(argp2); + if (arg1) (arg1)->node = arg2; + + + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_node_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_node_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_event_node_t *) ((arg1)->node); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_node_t, 0 | 0); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_callback_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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: EventConsumer_e_callback_set(self,e_callback);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_callback_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_callback) delete[] arg1->e_callback; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_callback = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_callback = 0; + } + + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_callback_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_e_callback_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_callback); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_subclass_name_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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: EventConsumer_e_subclass_name_set(self,e_subclass_name);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_subclass_name) delete[] arg1->e_subclass_name; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_subclass_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_subclass_name = 0; + } + + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_subclass_name_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_e_subclass_name_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_subclass_name); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_cb_arg_set) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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: EventConsumer_e_cb_arg_set(self,e_cb_arg);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_cb_arg) delete[] arg1->e_cb_arg; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_cb_arg = 0; + } + + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_e_cb_arg_get) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_e_cb_arg_get(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_cb_arg); + ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_new_EventConsumer__SWIG_0) { + { + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + EventConsumer *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: new_EventConsumer(event_name,subclass_name);"); + } + res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'"); + } + 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 '" "new_EventConsumer" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_OWNER | SWIG_SHADOW); 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_new_EventConsumer__SWIG_1) { + { + char *arg1 = (char *) 0 ; + EventConsumer *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: new_EventConsumer(event_name);"); + } + res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (EventConsumer *)new EventConsumer((char const *)arg1); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + XSRETURN(argvi); + fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + SWIG_croak_null(); + } +} + + +XS(_wrap_new_EventConsumer) { + dXSARGS; + + { + unsigned long _index = 0; + SWIG_TypeRank _rank = 0; + if (items == 1) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_1; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 1; + if (_rank == _rankm) goto dispatch; + } + } + check_1: + + if (items == 2) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 2; + if (_rank == _rankm) goto dispatch; + } + } + check_2: + + dispatch: + switch(_index) { + case 1: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EventConsumer__SWIG_1); return; + case 2: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_EventConsumer__SWIG_0); return; + } + } + + croak("No matching function for overloaded 'new_EventConsumer'"); + XSRETURN(0); +} + + +XS(_wrap_delete_EventConsumer) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: delete_EventConsumer(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EventConsumer" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + delete arg1; + + + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_pop__SWIG_0) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + int arg2 ; + Event *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 2) || (items > 2)) { + SWIG_croak("Usage: EventConsumer_pop(self,block);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (Event *)(arg1)->pop(arg2); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ; + + + XSRETURN(argvi); + fail: + + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_pop__SWIG_1) { + { + EventConsumer *arg1 = (EventConsumer *) 0 ; + Event *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 1) || (items > 1)) { + SWIG_croak("Usage: EventConsumer_pop(self);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (Event *)(arg1)->pop(); + ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | SWIG_SHADOW); argvi++ ; + + XSRETURN(argvi); + fail: + + SWIG_croak_null(); + } +} + + +XS(_wrap_EventConsumer_pop) { + dXSARGS; + + { + unsigned long _index = 0; + SWIG_TypeRank _rank = 0; + if (items == 1) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EventConsumer, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_1; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 1; + if (_rank == _rankm) goto dispatch; + } + } + check_1: + + if (items == 2) { + SWIG_TypeRank _ranki = 0; + SWIG_TypeRank _rankm = 0; + SWIG_TypeRank _pi = 1; + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_EventConsumer, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + { + { + int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL); + _v = SWIG_CheckState(res); + } + } + if (!_v) goto check_2; + _ranki += _v*_pi; + _rankm += _pi; + _pi *= SWIG_MAXCASTRANK; + if (!_index || (_ranki < _rank)) { + _rank = _ranki; _index = 2; + if (_rank == _rankm) goto dispatch; + } + } + check_2: + + dispatch: + switch(_index) { + case 1: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EventConsumer_pop__SWIG_1); return; + case 2: + ++PL_markstack_ptr; SWIG_CALLXS(_wrap_EventConsumer_pop__SWIG_0); return; + } + } + + croak("No matching function for overloaded 'EventConsumer_pop'"); + XSRETURN(0); +} + + XS(_wrap_delete_CoreSession) { { CoreSession *arg1 = (CoreSession *) 0 ; @@ -8401,6 +9126,7 @@ static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) { 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_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)"freeswitch::EventConsumer", 0}; static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0}; static swig_type_info _swigt__p_PERL__Session = {"_p_PERL__Session", "PERL::Session *", 0, 0, (void*)"freeswitch::Session", 0}; static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0}; @@ -8411,10 +9137,13 @@ static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum ses static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -8423,6 +9152,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_API, &_swigt__p_CoreSession, &_swigt__p_Event, + &_swigt__p_EventConsumer, &_swigt__p_IVRMenu, &_swigt__p_PERL__Session, &_swigt__p_PerlInterpreter, @@ -8433,10 +9163,13 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_channel_state_t, &_swigt__p_switch_channel_t, &_swigt__p_switch_core_session_t, + &_swigt__p_switch_event_node_t, &_swigt__p_switch_event_t, + &_swigt__p_switch_event_types_t, &_swigt__p_switch_input_args_t, &_swigt__p_switch_input_type_t, &_swigt__p_switch_priority_t, + &_swigt__p_switch_queue_t, &_swigt__p_switch_status_t, &_swigt__p_switch_stream_handle_t, &_swigt__p_void, @@ -8445,6 +9178,7 @@ static swig_type_info *swig_type_initial[] = { 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_PERL__Session, _p_PERL__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_EventConsumer[] = { {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PERL__Session[] = { {&_swigt__p_PERL__Session, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}}; @@ -8455,10 +9189,13 @@ static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}}; 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_event_node_t[] = { {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_event_types_t[] = { {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_queue_t[] = { {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -8467,6 +9204,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_API, _swigc__p_CoreSession, _swigc__p_Event, + _swigc__p_EventConsumer, _swigc__p_IVRMenu, _swigc__p_PERL__Session, _swigc__p_PerlInterpreter, @@ -8477,10 +9215,13 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_channel_state_t, _swigc__p_switch_channel_t, _swigc__p_switch_core_session_t, + _swigc__p_switch_event_node_t, _swigc__p_switch_event_t, + _swigc__p_switch_event_types_t, _swigc__p_switch_input_args_t, _swigc__p_switch_input_type_t, _swigc__p_switch_priority_t, + _swigc__p_switch_queue_t, _swigc__p_switch_status_t, _swigc__p_switch_stream_handle_t, _swigc__p_void, @@ -8540,6 +9281,21 @@ static swig_command_info swig_commands[] = { {"freeswitchc::Event_addHeader", _wrap_Event_addHeader}, {"freeswitchc::Event_delHeader", _wrap_Event_delHeader}, {"freeswitchc::Event_fire", _wrap_Event_fire}, +{"freeswitchc::EventConsumer_events_set", _wrap_EventConsumer_events_set}, +{"freeswitchc::EventConsumer_events_get", _wrap_EventConsumer_events_get}, +{"freeswitchc::EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set}, +{"freeswitchc::EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get}, +{"freeswitchc::EventConsumer_node_set", _wrap_EventConsumer_node_set}, +{"freeswitchc::EventConsumer_node_get", _wrap_EventConsumer_node_get}, +{"freeswitchc::EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set}, +{"freeswitchc::EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get}, +{"freeswitchc::EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set}, +{"freeswitchc::EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get}, +{"freeswitchc::EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set}, +{"freeswitchc::EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get}, +{"freeswitchc::new_EventConsumer", _wrap_new_EventConsumer}, +{"freeswitchc::delete_EventConsumer", _wrap_delete_EventConsumer}, +{"freeswitchc::EventConsumer_pop", _wrap_EventConsumer_pop}, {"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession}, {"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set}, {"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get}, @@ -8930,6 +9686,7 @@ XS(SWIG_init) { } while(0) /*@SWIG@*/; SWIG_TypeClientData(SWIGTYPE_p_Stream, (void*) "freeswitch::Stream"); SWIG_TypeClientData(SWIGTYPE_p_Event, (void*) "freeswitch::Event"); + SWIG_TypeClientData(SWIGTYPE_p_EventConsumer, (void*) "freeswitch::EventConsumer"); SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void*) "freeswitch::CoreSession"); SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void*) "freeswitch::Session"); ST(0) = &PL_sv_yes; diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index e5b92b052a..495aa59237 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -164,6 +164,40 @@ class Event(_object): Event_swigregister = _freeswitch.Event_swigregister Event_swigregister(Event) +class EventConsumer(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, EventConsumer, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, EventConsumer, name) + __repr__ = _swig_repr + __swig_setmethods__["events"] = _freeswitch.EventConsumer_events_set + __swig_getmethods__["events"] = _freeswitch.EventConsumer_events_get + if _newclass:events = _swig_property(_freeswitch.EventConsumer_events_get, _freeswitch.EventConsumer_events_set) + __swig_setmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_set + __swig_getmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_get + if _newclass:e_event_id = _swig_property(_freeswitch.EventConsumer_e_event_id_get, _freeswitch.EventConsumer_e_event_id_set) + __swig_setmethods__["node"] = _freeswitch.EventConsumer_node_set + __swig_getmethods__["node"] = _freeswitch.EventConsumer_node_get + if _newclass:node = _swig_property(_freeswitch.EventConsumer_node_get, _freeswitch.EventConsumer_node_set) + __swig_setmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_set + __swig_getmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_get + if _newclass:e_callback = _swig_property(_freeswitch.EventConsumer_e_callback_get, _freeswitch.EventConsumer_e_callback_set) + __swig_setmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_set + __swig_getmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_get + if _newclass:e_subclass_name = _swig_property(_freeswitch.EventConsumer_e_subclass_name_get, _freeswitch.EventConsumer_e_subclass_name_set) + __swig_setmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_set + __swig_getmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_get + if _newclass:e_cb_arg = _swig_property(_freeswitch.EventConsumer_e_cb_arg_get, _freeswitch.EventConsumer_e_cb_arg_set) + def __init__(self, *args): + this = _freeswitch.new_EventConsumer(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _freeswitch.delete_EventConsumer + __del__ = lambda self : None; + def pop(*args): return _freeswitch.EventConsumer_pop(*args) +EventConsumer_swigregister = _freeswitch.EventConsumer_swigregister +EventConsumer_swigregister(EventConsumer) + class CoreSession(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value) diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index d8756626c4..7dfcdb65a5 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -2498,25 +2498,29 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_API swig_types[0] #define SWIGTYPE_p_CoreSession swig_types[1] #define SWIGTYPE_p_Event swig_types[2] -#define SWIGTYPE_p_IVRMenu swig_types[3] -#define SWIGTYPE_p_PySession swig_types[4] -#define SWIGTYPE_p_Stream swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_input_callback_state swig_types[7] -#define SWIGTYPE_p_session_flag_t swig_types[8] -#define SWIGTYPE_p_swap_state_t swig_types[9] -#define SWIGTYPE_p_switch_channel_state_t swig_types[10] -#define SWIGTYPE_p_switch_channel_t swig_types[11] -#define SWIGTYPE_p_switch_core_session_t swig_types[12] -#define SWIGTYPE_p_switch_event_t swig_types[13] -#define SWIGTYPE_p_switch_input_args_t swig_types[14] -#define SWIGTYPE_p_switch_input_type_t swig_types[15] -#define SWIGTYPE_p_switch_priority_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 SWIGTYPE_p_EventConsumer swig_types[3] +#define SWIGTYPE_p_IVRMenu swig_types[4] +#define SWIGTYPE_p_PySession swig_types[5] +#define SWIGTYPE_p_Stream swig_types[6] +#define SWIGTYPE_p_char swig_types[7] +#define SWIGTYPE_p_input_callback_state swig_types[8] +#define SWIGTYPE_p_session_flag_t swig_types[9] +#define SWIGTYPE_p_swap_state_t swig_types[10] +#define SWIGTYPE_p_switch_channel_state_t swig_types[11] +#define SWIGTYPE_p_switch_channel_t swig_types[12] +#define SWIGTYPE_p_switch_core_session_t swig_types[13] +#define SWIGTYPE_p_switch_event_node_t swig_types[14] +#define SWIGTYPE_p_switch_event_t swig_types[15] +#define SWIGTYPE_p_switch_event_types_t swig_types[16] +#define SWIGTYPE_p_switch_input_args_t swig_types[17] +#define SWIGTYPE_p_switch_input_type_t swig_types[18] +#define SWIGTYPE_p_switch_priority_t swig_types[19] +#define SWIGTYPE_p_switch_queue_t swig_types[20] +#define SWIGTYPE_p_switch_status_t swig_types[21] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[22] +#define SWIGTYPE_p_void swig_types[23] +static swig_type_info *swig_types[25]; +static swig_module_info swig_module = {swig_types, 24, 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) @@ -4614,6 +4618,584 @@ SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject return SWIG_Py_Void(); } +SWIGINTERN PyObject *_wrap_EventConsumer_events_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *arg2 = (switch_queue_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_events_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_queue_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_events_set" "', argument " "2"" of type '" "switch_queue_t *""'"); + } + arg2 = reinterpret_cast< switch_queue_t * >(argp2); + if (arg1) (arg1)->events = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_events_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_queue_t *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_events_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_events_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_queue_t *) ((arg1)->events); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_queue_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_e_event_id_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_types_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "EventConsumer_e_event_id_set" "', argument " "2"" of type '" "switch_event_types_t""'"); + } else { + switch_event_types_t * temp = reinterpret_cast< switch_event_types_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->e_event_id = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_event_id_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_types_t result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_event_id_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_event_id_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = ((arg1)->e_event_id); + resultobj = SWIG_NewPointerObj((new switch_event_types_t(static_cast< const switch_event_types_t& >(result))), SWIGTYPE_p_switch_event_types_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_node_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *arg2 = (switch_event_node_t *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_node_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_node_t, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_node_set" "', argument " "2"" of type '" "switch_event_node_t *""'"); + } + arg2 = reinterpret_cast< switch_event_node_t * >(argp2); + if (arg1) (arg1)->node = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_node_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + switch_event_node_t *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_node_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_node_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (switch_event_node_t *) ((arg1)->node); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_node_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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:EventConsumer_e_callback_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_callback_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_callback) delete[] arg1->e_callback; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_callback = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_callback = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_callback_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_callback_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_callback_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_callback); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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:EventConsumer_e_subclass_name_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_subclass_name_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_subclass_name) delete[] arg1->e_subclass_name; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_subclass_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_subclass_name = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_subclass_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_subclass_name_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_subclass_name_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_subclass_name); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *arg2 = (char *) 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:EventConsumer_e_cb_arg_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "EventConsumer_e_cb_arg_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->e_cb_arg) delete[] arg1->e_cb_arg; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->e_cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->e_cb_arg = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_e_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_e_cb_arg_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_e_cb_arg_get" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (char *) ((arg1)->e_cb_arg); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_EventConsumer__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + EventConsumer *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:new_EventConsumer",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_EventConsumer" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_POINTER_NEW | 0 ); + 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_new_EventConsumer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + EventConsumer *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_EventConsumer",&obj0)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_EventConsumer" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (EventConsumer *)new EventConsumer((char const *)arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_EventConsumer, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_EventConsumer(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 1) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_EventConsumer__SWIG_1(self, args); + } + } + if (argc == 2) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_EventConsumer__SWIG_0(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_EventConsumer'.\n" + " Possible C/C++ prototypes are:\n" + " EventConsumer(char const *,char const *)\n" + " EventConsumer(char const *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_EventConsumer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_EventConsumer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_EventConsumer" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_pop__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + int arg2 ; + Event *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:EventConsumer_pop",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (Event *)(arg1)->pop(arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_pop__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + EventConsumer *arg1 = (EventConsumer *) 0 ; + Event *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:EventConsumer_pop",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_EventConsumer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); + } + arg1 = reinterpret_cast< EventConsumer * >(argp1); + result = (Event *)(arg1)->pop(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_EventConsumer_pop(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 1) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EventConsumer, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_EventConsumer_pop__SWIG_1(self, args); + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_EventConsumer, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_EventConsumer_pop__SWIG_0(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'EventConsumer_pop'.\n" + " Possible C/C++ prototypes are:\n" + " pop(EventConsumer *,int)\n" + " pop(EventConsumer *)\n"); + return NULL; +} + + +SWIGINTERN PyObject *EventConsumer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_EventConsumer, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; CoreSession *arg1 = (CoreSession *) 0 ; @@ -7907,6 +8489,22 @@ static PyMethodDef SwigMethods[] = { { (char *)"Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL}, { (char *)"Event_fire", _wrap_Event_fire, METH_VARARGS, NULL}, { (char *)"Event_swigregister", Event_swigregister, METH_VARARGS, NULL}, + { (char *)"EventConsumer_events_set", _wrap_EventConsumer_events_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_events_get", _wrap_EventConsumer_events_get, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get, METH_VARARGS, NULL}, + { (char *)"EventConsumer_node_set", _wrap_EventConsumer_node_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_node_get", _wrap_EventConsumer_node_get, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set, METH_VARARGS, NULL}, + { (char *)"EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get, METH_VARARGS, NULL}, + { (char *)"new_EventConsumer", _wrap_new_EventConsumer, METH_VARARGS, NULL}, + { (char *)"delete_EventConsumer", _wrap_delete_EventConsumer, METH_VARARGS, NULL}, + { (char *)"EventConsumer_pop", _wrap_EventConsumer_pop, METH_VARARGS, NULL}, + { (char *)"EventConsumer_swigregister", EventConsumer_swigregister, METH_VARARGS, NULL}, { (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL}, { (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL}, { (char *)"CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL}, @@ -7988,6 +8586,7 @@ static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) { 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_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0}; @@ -7998,10 +8597,13 @@ static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_st static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_node_t = {"_p_switch_event_node_t", "switch_event_node_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_event_types_t = {"_p_switch_event_types_t", "switch_event_types_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -8010,6 +8612,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_API, &_swigt__p_CoreSession, &_swigt__p_Event, + &_swigt__p_EventConsumer, &_swigt__p_IVRMenu, &_swigt__p_PySession, &_swigt__p_Stream, @@ -8020,10 +8623,13 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_channel_state_t, &_swigt__p_switch_channel_t, &_swigt__p_switch_core_session_t, + &_swigt__p_switch_event_node_t, &_swigt__p_switch_event_t, + &_swigt__p_switch_event_types_t, &_swigt__p_switch_input_args_t, &_swigt__p_switch_input_type_t, &_swigt__p_switch_priority_t, + &_swigt__p_switch_queue_t, &_swigt__p_switch_status_t, &_swigt__p_switch_stream_handle_t, &_swigt__p_void, @@ -8032,6 +8638,7 @@ static swig_type_info *swig_type_initial[] = { 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_EventConsumer[] = { {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; @@ -8042,10 +8649,13 @@ static swig_cast_info _swigc__p_swap_state_t[] = { {&_swigt__p_swap_state_t, 0, static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}}; 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_event_node_t[] = { {&_swigt__p_switch_event_node_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_event_types_t[] = { {&_swigt__p_switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_switch_queue_t[] = { {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -8054,6 +8664,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_API, _swigc__p_CoreSession, _swigc__p_Event, + _swigc__p_EventConsumer, _swigc__p_IVRMenu, _swigc__p_PySession, _swigc__p_Stream, @@ -8064,10 +8675,13 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_channel_state_t, _swigc__p_switch_channel_t, _swigc__p_switch_core_session_t, + _swigc__p_switch_event_node_t, _swigc__p_switch_event_t, + _swigc__p_switch_event_types_t, _swigc__p_switch_input_args_t, _swigc__p_switch_input_type_t, _swigc__p_switch_priority_t, + _swigc__p_switch_queue_t, _swigc__p_switch_status_t, _swigc__p_switch_stream_handle_t, _swigc__p_void, diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 6c595144e8..9fb9623eb4 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -39,37 +39,65 @@ static void event_handler(switch_event_t *event) { -} - -SWITCH_DECLARE_CONSTRUCTOR EventConsumer::EventConsumer(switch_event_types_t event_id, const char *subclass_name, const char *callback) -{ - e_event_id = event_id; - - if (!switch_strlen_zero(subclass_name)) { - e_subclass_name = strdup(subclass_name); - } else { - e_subclass_name = ""; - } - - if (switch_strlen_zero(callback)) { - callback = "event_consumer"; - } - - e_callback = strdup(callback); - + EventConsumer *E = (EventConsumer *) event->bind_user_data; + switch_event_t *dup; - switch_event_bind_removable(__FILE__, e_event_id, subclass_name, event_handler, this, &node); + switch_event_dup(&dup, event); + + if (switch_queue_trypush(E->events, dup) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot queue any more events.....\n"); + } + } +SWITCH_DECLARE_CONSTRUCTOR EventConsumer::EventConsumer(const char *event_name, const char *subclass_name) +{ + switch_name_event(event_name, &e_event_id); + switch_core_new_memory_pool(&pool); + + if (!switch_strlen_zero(subclass_name)) { + e_subclass_name = switch_core_strdup(pool, subclass_name); + } else { + e_subclass_name = NULL; + } + + switch_queue_create(&events, 5000, pool); + + if (switch_event_bind_removable(__FILE__, e_event_id, e_subclass_name, event_handler, this, &node) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "bound to %s %s\n", event_name, switch_str_nil(e_subclass_name)); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to %s %s\n", event_name, switch_str_nil(e_subclass_name)); + } + +} + + +SWITCH_DECLARE(Event *) EventConsumer::pop(int block) +{ + void *pop = NULL; + Event *ret = NULL; + switch_event_t *event; + + if (block) { + switch_queue_pop(events, &pop); + } else { + switch_queue_trypop(events, &pop); + } + + if ((event = (switch_event_t *) pop)) { + ret = new Event(event); + } + + return ret; +} SWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer() { - switch_safe_free(e_subclass_name); - switch_safe_free(e_callback); - if (node) { switch_event_unbind(&node); } + + switch_core_destroy_memory_pool(&pool); } SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main, @@ -210,10 +238,9 @@ SWITCH_DECLARE(const char *)Event::serialize(const char *format) this_check(""); - if (serialized_string) { - free(serialized_string); - } + switch_safe_free(serialized_string); + if (!event) { return ""; } @@ -233,6 +260,7 @@ SWITCH_DECLARE(const char *)Event::serialize(const char *format) } } else { if (switch_event_serialize(event, &serialized_string, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + serialized_string = switch_mprintf("'%s'", serialized_string); return serialized_string; } }