freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
May 2008
- 10 participants
- 495 discussions
[Freeswitch-svn] [commit] r8250 - freeswitch/trunk/src/mod/endpoints/mod_reference
by Freeswitch SVN 02 May '08
by Freeswitch SVN 02 May '08
02 May '08
Author: anthm
Date: Fri May 2 13:51:48 2008
New Revision: 8250
Added:
freeswitch/trunk/src/mod/endpoints/mod_reference/
freeswitch/trunk/src/mod/endpoints/mod_reference/Makefile
freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
Log:
add
Added: freeswitch/trunk/src/mod/endpoints/mod_reference/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_reference/Makefile Fri May 2 13:51:48 2008
@@ -0,0 +1,2 @@
+MODNAME=mod_conference
+include ../../../../build/modmake.rules
Added: freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_reference/mod_reference.c Fri May 2 13:51:48 2008
@@ -0,0 +1,603 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ *
+ * mod_reference.c -- REFERENCE Endpoint Module
+ *
+ */
+#include <switch.h>
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_reference_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_reference_shutdown);
+//SWITCH_MODULE_RUNTIME_FUNCTION(mod_reference_runtime);
+SWITCH_MODULE_DEFINITION(mod_reference, mod_reference_load, mod_reference_shutdown, NULL);//mod_reference_runtime);
+
+
+switch_endpoint_interface_t *reference_endpoint_interface;
+static switch_memory_pool_t *module_pool = NULL;
+static int running = 1;
+
+
+typedef enum {
+ TFLAG_IO = (1 << 0),
+ TFLAG_INBOUND = (1 << 1),
+ TFLAG_OUTBOUND = (1 << 2),
+ TFLAG_DTMF = (1 << 3),
+ TFLAG_VOICE = (1 << 4),
+ TFLAG_HANGUP = (1 << 5),
+ TFLAG_LINEAR = (1 << 6),
+ TFLAG_CODEC = (1 << 7),
+ TFLAG_BREAK = (1 << 8)
+} TFLAGS;
+
+typedef enum {
+ GFLAG_MY_CODEC_PREFS = (1 << 0)
+} GFLAGS;
+
+
+static struct {
+ int debug;
+ char *ip;
+ int port;
+ char *dialplan;
+ char *codec_string;
+ char *codec_order[SWITCH_MAX_CODECS];
+ int codec_order_last;
+ char *codec_rates_string;
+ char *codec_rates[SWITCH_MAX_CODECS];
+ int codec_rates_last;
+ unsigned int flags;
+ int calls;
+ switch_mutex_t *mutex;
+} globals;
+
+struct private_object {
+ unsigned int flags;
+ switch_codec_t read_codec;
+ switch_codec_t write_codec;
+ switch_frame_t read_frame;
+ unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ switch_core_session_t *session;
+ switch_caller_profile_t *caller_profile;
+ switch_mutex_t *mutex;
+ switch_mutex_t *flag_mutex;
+ //switch_thread_cond_t *cond;
+};
+
+typedef struct private_object private_t;
+
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip);
+
+
+
+static switch_status_t channel_on_init(switch_core_session_t *session);
+static switch_status_t channel_on_hangup(switch_core_session_t *session);
+static switch_status_t channel_on_ring(switch_core_session_t *session);
+static switch_status_t channel_on_loopback(switch_core_session_t *session);
+static switch_status_t channel_on_transmit(switch_core_session_t *session);
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+
+
+
+static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
+{
+ tech_pvt->read_frame.data = tech_pvt->databuf;
+ tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
+ switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ switch_core_session_set_private(session, tech_pvt);
+ tech_pvt->session = session;
+}
+
+/*
+ State methods they get called when the state changes to the specific state
+ returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
+ so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
+*/
+static switch_status_t channel_on_init(switch_core_session_t *session)
+{
+ switch_channel_t *channel;
+ private_t *tech_pvt = NULL;
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+ switch_set_flag_locked(tech_pvt, TFLAG_IO);
+
+ /* Move Channel's State Machine to RING */
+ switch_channel_set_state(channel, CS_RING);
+ switch_mutex_lock(globals.mutex);
+ globals.calls++;
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_ring(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_execute(switch_core_session_t *session)
+{
+
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_hangup(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ //switch_thread_cond_signal(tech_pvt->cond);
+
+ if (tech_pvt->read_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->read_codec);
+ }
+
+ if (tech_pvt->write_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->write_codec);
+ }
+
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
+ switch_mutex_lock(globals.mutex);
+ globals.calls--;
+ if (globals.calls < 0) {
+ globals.calls = 0;
+ }
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ //switch_thread_cond_signal(tech_pvt->cond);
+ break;
+ case SWITCH_SIG_BREAK:
+ switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+ break;
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_loopback(switch_core_session_t *session)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_on_transmit(switch_core_session_t *session)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
+{
+ private_t *tech_pvt = NULL;
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
+{
+ private_t *tech_pvt = NULL;
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+{
+ private_t *tech_pvt = switch_core_session_get_private(session);
+ switch_assert(tech_pvt != NULL);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+ switch_time_t started = switch_time_now();
+ unsigned int elapsed;
+ switch_byte_t *data;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+ tech_pvt->read_frame.flags = SFF_NONE;
+ *frame = NULL;
+
+ while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+
+ if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+ switch_clear_flag(tech_pvt, TFLAG_BREAK);
+ goto cng;
+ }
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ if (!tech_pvt->read_frame.datalen) {
+ continue;
+ }
+ *frame = &tech_pvt->read_frame;
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (timeout > -1) {
+ elapsed = (unsigned int) ((switch_time_now() - started) / 1000);
+ if (elapsed >= (unsigned int) timeout) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
+
+
+ switch_yield(1000);
+ }
+
+
+ return SWITCH_STATUS_FALSE;
+
+ cng:
+ data = (switch_byte_t *) tech_pvt->read_frame.data;
+ data[0] = 65;
+ data[1] = 0;
+ tech_pvt->read_frame.datalen = 2;
+ tech_pvt->read_frame.flags = SFF_CNG;
+ *frame = &tech_pvt->read_frame;
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+ //switch_frame_t *pframe;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ return SWITCH_STATUS_FALSE;
+ }
+#ifdef BIGENDIAN
+ if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+ switch_swap_linear(frame->data, (int) frame->datalen / 2);
+ }
+#endif
+
+
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+static switch_status_t channel_answer_channel(switch_core_session_t *session)
+{
+ private_t *tech_pvt;
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+ switch_channel_t *channel;
+ private_t *tech_pvt;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = (private_t *) switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ switch (msg->message_id) {
+ case SWITCH_MESSAGE_INDICATE_ANSWER:
+ {
+ channel_answer_channel(session);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
+ that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
+*/
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+ if ((*new_session = switch_core_session_request(reference_endpoint_interface, pool)) != 0) {
+ private_t *tech_pvt;
+ switch_channel_t *channel;
+ switch_caller_profile_t *caller_profile;
+
+ switch_core_session_add_stream(*new_session, NULL);
+ if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
+ channel = switch_core_session_get_channel(*new_session);
+ tech_init(tech_pvt, *new_session);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
+
+ if (outbound_profile) {
+ char name[128];
+
+ snprintf(name, sizeof(name), "REFERENCE/%s", outbound_profile->destination_number);
+ switch_channel_set_name(channel, name);
+
+ caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+ switch_channel_set_caller_profile(channel, caller_profile);
+ tech_pvt->caller_profile = caller_profile;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
+
+
+
+ switch_channel_set_flag(channel, CF_OUTBOUND);
+ switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+ switch_channel_set_state(channel, CS_INIT);
+ return SWITCH_CAUSE_SUCCESS;
+ }
+
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+}
+
+static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+ struct private_object *tech_pvt = switch_core_session_get_private(session);
+ char *body = switch_event_get_body(event);
+ switch_assert(tech_pvt != NULL);
+
+ if (!body) {
+ body = "";
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+switch_state_handler_table_t reference_state_handlers = {
+ /*.on_init */ channel_on_init,
+ /*.on_ring */ channel_on_ring,
+ /*.on_execute */ channel_on_execute,
+ /*.on_hangup */ channel_on_hangup,
+ /*.on_loopback */ channel_on_loopback,
+ /*.on_transmit */ channel_on_transmit
+};
+
+switch_io_routines_t reference_io_routines = {
+ /*.outgoing_channel */ channel_outgoing_channel,
+ /*.read_frame */ channel_read_frame,
+ /*.write_frame */ channel_write_frame,
+ /*.kill_channel */ channel_kill_channel,
+ /*.waitfor_read */ channel_waitfor_read,
+ /*.waitfor_write */ channel_waitfor_write,
+ /*.send_dtmf */ channel_send_dtmf,
+ /*.receive_message*/ channel_receive_message,
+ /*.receive_event */ channel_receive_event
+};
+
+static switch_status_t load_config(void)
+{
+ char *cf = "reference.conf";
+ switch_xml_t cfg, xml, settings, param;
+
+ memset(&globals, 0, sizeof(globals));
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
+ if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+ return SWITCH_STATUS_TERM;
+ }
+
+ if ((settings = switch_xml_child(cfg, "settings"))) {
+ for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+
+ if (!strcmp(var, "debug")) {
+ globals.debug = atoi(val);
+ } else if (!strcmp(var, "port")) {
+ globals.port = atoi(val);
+ } else if (!strcmp(var, "ip")) {
+ set_global_ip(val);
+ } else if (!strcmp(var, "codec-master")) {
+ if (!strcasecmp(val, "us")) {
+ switch_set_flag(&globals, GFLAG_MY_CODEC_PREFS);
+ }
+ } else if (!strcmp(var, "dialplan")) {
+ set_global_dialplan(val);
+ } else if (!strcmp(var, "codec-prefs")) {
+ set_global_codec_string(val);
+ globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
+ } else if (!strcmp(var, "codec-rates")) {
+ set_global_codec_rates_string(val);
+ globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
+ }
+ }
+ }
+
+ if (!globals.dialplan) {
+ set_global_dialplan("default");
+ }
+
+ if (!globals.port) {
+ globals.port = 4569;
+ }
+
+ switch_xml_free(xml);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_reference_load)
+{
+
+ module_pool = pool;
+
+ load_config();
+
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ reference_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+ reference_endpoint_interface->interface_name = "reference";
+ reference_endpoint_interface->io_routines = &reference_io_routines;
+ reference_endpoint_interface->state_handler = &reference_state_handlers;
+
+
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/*
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_reference_runtime)
+{
+ return SWITCH_STATUS_TERM;
+}
+*/
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_reference_shutdown)
+{
+ int x = 0;
+
+ running = -1;
+
+ while (running) {
+ if (x++ > 100) {
+ break;
+ }
+ switch_yield(20000);
+ }
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
1
0
[Freeswitch-svn] [commit] r8249 - in freeswitch/trunk/src: . include mod/languages/mod_java mod/languages/mod_java/src/org/freeswitch/swig mod/languages/mod_lua mod/languages/mod_perl mod/languages/mod_python
by Freeswitch SVN 02 May '08
by Freeswitch SVN 02 May '08
02 May '08
Author: anthm
Date: Fri May 2 12:43:54 2008
New Revision: 8249
Modified:
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_perl/Makefile
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/switch_cpp.cpp
freeswitch/trunk/src/switch_ivr_menu.c
Log:
update script langs
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Fri May 2 12:43:54 2008
@@ -64,6 +64,33 @@
SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
SWITCH_DECLARE(void) consoleCleanLog(char *msg);
+class CoreSession;
+
+class IVRMenu {
+ protected:
+ switch_ivr_menu_t *menu;
+ switch_memory_pool_t *pool;
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu *main,
+ const char *name,
+ const char *greeting_sound,
+ const char *short_greeting_sound,
+ const char *invalid_sound,
+ const char *exit_sound,
+ const char *confirm_macro,
+ const char *confirm_key,
+ int confirm_attempts,
+ int inter_timeout,
+ int digit_len,
+ int timeout,
+ int max_failures
+ );
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~IVRMenu();
+ SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
+ SWITCH_DECLARE(void) execute(CoreSession *session, const char *name);
+};
+
+
class API {
protected:
char *last_data;
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Fri May 2 12:43:54 2008
@@ -717,6 +717,8 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
+
/*!
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
*\param name The xml tag name to add to the parser engine
Modified: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java (original)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java Fri May 2 12:43:54 2008
@@ -11,6 +11,10 @@
class freeswitchJNI {
public final static native void consoleLog(String jarg1, String jarg2);
public final static native void consoleCleanLog(String jarg1);
+ public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13);
+ public final static native void delete_IVRMenu(long jarg1);
+ public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4);
+ public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
public final static native long new_API();
public final static native void delete_API(long jarg1);
public final static native String API_execute(long jarg1, API jarg1_, String jarg2, String jarg3);
Modified: freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp Fri May 2 12:43:54 2008
@@ -244,6 +244,144 @@
}
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jint jarg9, jint jarg10, jint jarg11, jint jarg12, jint jarg13) {
+ jlong jresult = 0 ;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ int arg9 ;
+ int arg10 ;
+ int arg11 ;
+ int arg12 ;
+ int arg13 ;
+ IVRMenu *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(IVRMenu **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return 0;
+ }
+ arg4 = 0;
+ if (jarg4) {
+ arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+ if (!arg4) return 0;
+ }
+ arg5 = 0;
+ if (jarg5) {
+ arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
+ if (!arg5) return 0;
+ }
+ arg6 = 0;
+ if (jarg6) {
+ arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0);
+ if (!arg6) return 0;
+ }
+ arg7 = 0;
+ if (jarg7) {
+ arg7 = (char *)jenv->GetStringUTFChars(jarg7, 0);
+ if (!arg7) return 0;
+ }
+ arg8 = 0;
+ if (jarg8) {
+ arg8 = (char *)jenv->GetStringUTFChars(jarg8, 0);
+ if (!arg8) return 0;
+ }
+ arg9 = (int)jarg9;
+ arg10 = (int)jarg10;
+ arg11 = (int)jarg11;
+ arg12 = (int)jarg12;
+ arg13 = (int)jarg13;
+ result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+ *(IVRMenu **)&jresult = result;
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+ if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
+ if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6);
+ if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
+ if (arg8) jenv->ReleaseStringUTFChars(jarg8, (const char *)arg8);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(IVRMenu **)&jarg1;
+ delete arg1;
+
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_IVRMenu_1bindAction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(IVRMenu **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ arg4 = 0;
+ if (jarg4) {
+ arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+ if (!arg4) return ;
+ }
+ (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_IVRMenu_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ (void)jarg2_;
+ arg1 = *(IVRMenu **)&jarg1;
+ arg2 = *(CoreSession **)&jarg2;
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->execute(arg2,(char const *)arg3);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1API(JNIEnv *jenv, jclass jcls) {
jlong jresult = 0 ;
API *result = 0 ;
Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp Fri May 2 12:43:54 2008
@@ -1487,23 +1487,24 @@
#define SWIGTYPE_p_API swig_types[0]
#define SWIGTYPE_p_CoreSession swig_types[1]
#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_Session swig_types[3]
-#define SWIGTYPE_p_Stream swig_types[4]
-#define SWIGTYPE_p_input_callback_state swig_types[5]
-#define SWIGTYPE_p_lua_State swig_types[6]
-#define SWIGTYPE_p_session_flag_t swig_types[7]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
-#define SWIGTYPE_p_switch_channel_t swig_types[9]
-#define SWIGTYPE_p_switch_core_session_t swig_types[10]
-#define SWIGTYPE_p_switch_event_t swig_types[11]
-#define SWIGTYPE_p_switch_input_args_t swig_types[12]
-#define SWIGTYPE_p_switch_input_type_t swig_types[13]
-#define SWIGTYPE_p_switch_priority_t swig_types[14]
-#define SWIGTYPE_p_switch_status_t swig_types[15]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[16]
-#define SWIGTYPE_p_void swig_types[17]
-static swig_type_info *swig_types[19];
-static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
+#define SWIGTYPE_p_IVRMenu swig_types[3]
+#define SWIGTYPE_p_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 SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -1571,6 +1572,175 @@
}
+static int _wrap_new_IVRMenu(lua_State* L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ int arg9 ;
+ int arg10 ;
+ int arg11 ;
+ int arg12 ;
+ int arg13 ;
+ IVRMenu *result = 0 ;
+
+ SWIG_check_num_args("IVRMenu",13,13)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
+ if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *");
+ if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *");
+ if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
+ if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
+ if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
+ if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
+ if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
+ if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
+ if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
+ if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+ SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ arg4 = (char *)lua_tostring(L, 4);
+ arg5 = (char *)lua_tostring(L, 5);
+ arg6 = (char *)lua_tostring(L, 6);
+ arg7 = (char *)lua_tostring(L, 7);
+ arg8 = (char *)lua_tostring(L, 8);
+ arg9 = (int)lua_tonumber(L, 9);
+ arg10 = (int)lua_tonumber(L, 10);
+ arg11 = (int)lua_tonumber(L, 11);
+ arg12 = (int)lua_tonumber(L, 12);
+ arg13 = (int)lua_tonumber(L, 13);
+ result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+ SWIG_arg=0;
+ SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++;
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_delete_IVRMenu(lua_State* L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+
+ SWIG_check_num_args("IVRMenu",1,1)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){
+ SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu);
+ }
+
+ delete arg1;
+
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_IVRMenu_bindAction(lua_State* L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+
+ SWIG_check_num_args("bindAction",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *");
+ if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+ SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ arg4 = (char *)lua_tostring(L, 4);
+ (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_IVRMenu_execute(lua_State* L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ SWIG_check_num_args("execute",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *");
+ if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
+ SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession);
+ }
+
+ arg3 = (char *)lua_tostring(L, 3);
+ (arg1)->execute(arg2,(char const *)arg3);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static void swig_delete_IVRMenu(void *obj) {
+IVRMenu *arg1 = (IVRMenu *) obj;
+delete arg1;
+}
+static swig_lua_method swig_IVRMenu_methods[] = {
+ {"bindAction", _wrap_IVRMenu_bindAction},
+ {"execute", _wrap_IVRMenu_execute},
+ {0,0}
+};
+static swig_lua_attribute swig_IVRMenu_attributes[] = {
+ {0,0,0}
+};
+static swig_lua_class *swig_IVRMenu_bases[] = {0};
+static const char *swig_IVRMenu_base_names[] = {0};
+static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names };
+
static int _wrap_new_API(lua_State* L) {
int SWIG_arg = -1;
API *result = 0 ;
@@ -5474,6 +5644,7 @@
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_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)&_wrap_class_Session, 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
@@ -5494,6 +5665,7 @@
&_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
+ &_swigt__p_IVRMenu,
&_swigt__p_Session,
&_swigt__p_Stream,
&_swigt__p_input_callback_state,
@@ -5514,6 +5686,7 @@
static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_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}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
@@ -5534,6 +5707,7 @@
_swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
+ _swigc__p_IVRMenu,
_swigc__p_Session,
_swigc__p_Stream,
_swigc__p_input_callback_state,
Modified: freeswitch/trunk/src/mod/languages/mod_perl/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/Makefile Fri May 2 12:43:54 2008
@@ -11,7 +11,7 @@
swigclean: clean
- rm -f mod_perl_wrap.*
+ rm -f mod_perl_wrap.* freeswitch.so freeswitch.pm
mod_perl_wrap.cpp:
swig -static -shadow -perl5 -c++ -DMULTIPLICITY -I../../../../src/include -o mod_perl_wrap.cpp freeswitch.i
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm Fri May 2 12:43:54 2008
@@ -56,6 +56,45 @@
*hanguphook = *freeswitchc::hanguphook;
*dtmf_callback = *freeswitchc::dtmf_callback;
+############# Class : freeswitch::IVRMenu ##############
+
+package freeswitch::IVRMenu;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( freeswitch );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+ my $pkg = shift;
+ my $self = freeswitchc::new_IVRMenu(@_);
+ 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_IVRMenu($self);
+ delete $OWNER{$self};
+ }
+}
+
+*bindAction = *freeswitchc::IVRMenu_bindAction;
+*execute = *freeswitchc::IVRMenu_execute;
+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::API ##############
package freeswitch::API;
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c Fri May 2 12:43:54 2008
@@ -121,14 +121,16 @@
}
if (!error) {
char *file = input_code;
-
+ char *err;
+
if (!switch_is_file_path(file)) {
- file = switch_mprintf("do '%s/%s';\n", SWITCH_GLOBAL_dirs.script_dir, file);
+ file = switch_mprintf("require '%s/%s';", SWITCH_GLOBAL_dirs.script_dir, file);
switch_assert(file);
} else {
- file = switch_mprintf("do '%s';\n", file);
+ file = switch_mprintf("require '%s';", file);
switch_assert(file);
}
+
error = Perl_safe_eval(my_perl, file);
switch_safe_free(file);
}
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Fri May 2 12:43:54 2008
@@ -1449,24 +1449,25 @@
#define SWIGTYPE_p_API swig_types[0]
#define SWIGTYPE_p_CoreSession swig_types[1]
#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_PerlInterpreter swig_types[3]
-#define SWIGTYPE_p_Session 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_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_IVRMenu swig_types[3]
+#define SWIGTYPE_p_PerlInterpreter swig_types[4]
+#define SWIGTYPE_p_Session 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 SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -1557,42 +1558,6 @@
-SWIGINTERNINLINE SV *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
- SV *obj = sv_newmortal();
- if (carray) {
- sv_setpvn(obj, carray, size);
- } else {
- sv_setsv(obj, &PL_sv_undef);
- }
- return obj;
-}
-
-
-SWIGINTERNINLINE SV *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
-SWIGINTERNINLINE SV *
-SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
-{
- SV *obj = sv_newmortal();
- sv_setiv(obj, (IV) value);
- return obj;
-}
-
-
-SWIGINTERNINLINE SV *
-SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
-{
- return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
-}
-
-
#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
@@ -1722,6 +1687,42 @@
SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+ SV *obj = sv_newmortal();
+ if (carray) {
+ sv_setpvn(obj, carray, size);
+ } else {
+ sv_setsv(obj, &PL_sv_undef);
+ }
+ return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtr(const char *cptr)
+{
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
+{
+ SV *obj = sv_newmortal();
+ sv_setiv(obj, (IV) value);
+ return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
+{
+ return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+SWIGINTERNINLINE SV *
SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value)
{
SV *obj = sv_newmortal();
@@ -1923,6 +1924,297 @@
}
+XS(_wrap_new_IVRMenu) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ int arg9 ;
+ int arg10 ;
+ int arg11 ;
+ int arg12 ;
+ int arg13 ;
+ IVRMenu *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int res5 ;
+ char *buf5 = 0 ;
+ int alloc5 = 0 ;
+ int res6 ;
+ char *buf6 = 0 ;
+ int alloc6 = 0 ;
+ int res7 ;
+ char *buf7 = 0 ;
+ int alloc7 = 0 ;
+ int res8 ;
+ char *buf8 = 0 ;
+ int alloc8 = 0 ;
+ int val9 ;
+ int ecode9 = 0 ;
+ int val10 ;
+ int ecode10 = 0 ;
+ int val11 ;
+ int ecode11 = 0 ;
+ int val12 ;
+ int ecode12 = 0 ;
+ int val13 ;
+ int ecode13 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 13) || (items > 13)) {
+ SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
+ }
+ arg5 = reinterpret_cast< char * >(buf5);
+ res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
+ }
+ arg6 = reinterpret_cast< char * >(buf6);
+ res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
+ }
+ arg7 = reinterpret_cast< char * >(buf7);
+ res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
+ }
+ arg8 = reinterpret_cast< char * >(buf8);
+ ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+ if (!SWIG_IsOK(ecode9)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
+ }
+ arg9 = static_cast< int >(val9);
+ ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
+ if (!SWIG_IsOK(ecode10)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
+ }
+ arg10 = static_cast< int >(val10);
+ ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
+ if (!SWIG_IsOK(ecode11)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
+ }
+ arg11 = static_cast< int >(val11);
+ ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
+ if (!SWIG_IsOK(ecode12)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
+ }
+ arg12 = static_cast< int >(val12);
+ ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
+ if (!SWIG_IsOK(ecode13)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
+ }
+ arg13 = static_cast< int >(val13);
+ result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+
+
+
+
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_delete_IVRMenu) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_IVRMenu(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ delete arg1;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_IVRMenu_bindAction) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_IVRMenu_execute) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'");
+ }
+ arg2 = reinterpret_cast< CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->execute(arg2,(char const *)arg3);
+
+
+
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
XS(_wrap_new_API) {
{
API *result = 0 ;
@@ -6964,6 +7256,7 @@
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_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0};
static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)"freeswitch::Session", 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
@@ -6985,6 +7278,7 @@
&_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
+ &_swigt__p_IVRMenu,
&_swigt__p_PerlInterpreter,
&_swigt__p_Session,
&_swigt__p_Stream,
@@ -7006,6 +7300,7 @@
static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_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}};
@@ -7027,6 +7322,7 @@
_swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
+ _swigc__p_IVRMenu,
_swigc__p_PerlInterpreter,
_swigc__p_Session,
_swigc__p_Stream,
@@ -7060,6 +7356,10 @@
static swig_command_info swig_commands[] = {
{"freeswitchc::consoleLog", _wrap_consoleLog},
{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
+{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
+{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
+{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
+{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
{"freeswitchc::new_API", _wrap_new_API},
{"freeswitchc::delete_API", _wrap_delete_API},
{"freeswitchc::API_execute", _wrap_API_execute},
@@ -7454,6 +7754,7 @@
SvREADONLY_on(sv);
}
+ SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Fri May 2 12:43:54 2008
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org)
-# Version 1.3.31
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
@@ -50,6 +50,23 @@
consoleLog = _freeswitch.consoleLog
consoleCleanLog = _freeswitch.consoleCleanLog
+class IVRMenu(_object):
+ __swig_setmethods__ = {}
+ __setattr__ = lambda self, name, value: _swig_setattr(self, IVRMenu, name, value)
+ __swig_getmethods__ = {}
+ __getattr__ = lambda self, name: _swig_getattr(self, IVRMenu, name)
+ __repr__ = _swig_repr
+ def __init__(self, *args):
+ this = _freeswitch.new_IVRMenu(*args)
+ try: self.this.append(this)
+ except: self.this = this
+ __swig_destroy__ = _freeswitch.delete_IVRMenu
+ __del__ = lambda self : None;
+ def bindAction(*args): return _freeswitch.IVRMenu_bindAction(*args)
+ def execute(*args): return _freeswitch.IVRMenu_execute(*args)
+IVRMenu_swigregister = _freeswitch.IVRMenu_swigregister
+IVRMenu_swigregister(IVRMenu)
+
class API(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, API, name, value)
@@ -152,7 +169,7 @@
__setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, CoreSession, name)
- def __init__(self): raise AttributeError, "No constructor defined"
+ def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _freeswitch.delete_CoreSession
__del__ = lambda self : None;
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Fri May 2 12:43:54 2008
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.31
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#ifdef __cplusplus
-template<class T> class SwigValueWrapper {
+template<typename T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,6 +25,10 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
+
+template <typename T> T SwigValueInit() {
+ return T();
+}
#endif
/* -----------------------------------------------------------------------------
@@ -34,14 +38,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC)
-# if (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+# define SWIGTEMPLATEDISAMBIGUATOR template
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -124,6 +128,12 @@
# define _CRT_SECURE_NO_DEPRECATE
#endif
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
/* Python.h has to appear first */
#include <Python.h>
@@ -137,7 +147,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -172,6 +182,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -312,10 +323,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -360,7 +371,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (l1 - f1) - (l2 - f2);
+ return (int)((l1 - f1) - (l2 - f2));
}
/*
@@ -442,8 +453,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -867,7 +878,7 @@
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1107,14 +1118,14 @@
/* Unpack the argument tuple */
SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
if (!args) {
if (!min && !max) {
return 1;
} else {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
- name, (min == max ? "" : "at least "), min);
+ name, (min == max ? "" : "at least "), (int)min);
return 0;
}
}
@@ -1122,14 +1133,14 @@
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
- register int l = PyTuple_GET_SIZE(args);
+ register Py_ssize_t l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at least "), min, l);
+ name, (min == max ? "" : "at least "), (int)min, (int)l);
return 0;
} else if (l > max) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at most "), max, l);
+ name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
register int i;
@@ -1427,7 +1438,7 @@
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1445,12 +1456,13 @@
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1608,9 +1620,11 @@
(unaryfunc)0, /*nb_float*/
(unaryfunc)PySwigObject_oct, /*nb_oct*/
(unaryfunc)PySwigObject_hex, /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02020000
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
};
@@ -1953,7 +1967,7 @@
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1974,6 +1988,8 @@
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1987,7 +2003,15 @@
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1997,7 +2021,8 @@
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2062,8 +2087,13 @@
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2468,24 +2498,25 @@
#define SWIGTYPE_p_API swig_types[0]
#define SWIGTYPE_p_CoreSession swig_types[1]
#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_PySession swig_types[3]
-#define SWIGTYPE_p_Stream swig_types[4]
-#define SWIGTYPE_p_char swig_types[5]
-#define SWIGTYPE_p_input_callback_state swig_types[6]
-#define SWIGTYPE_p_session_flag_t swig_types[7]
-#define SWIGTYPE_p_swap_state_t swig_types[8]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[9]
-#define SWIGTYPE_p_switch_channel_t swig_types[10]
-#define SWIGTYPE_p_switch_core_session_t swig_types[11]
-#define SWIGTYPE_p_switch_event_t swig_types[12]
-#define SWIGTYPE_p_switch_input_args_t swig_types[13]
-#define SWIGTYPE_p_switch_input_type_t swig_types[14]
-#define SWIGTYPE_p_switch_priority_t swig_types[15]
-#define SWIGTYPE_p_switch_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_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 SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2504,7 +2535,7 @@
#define SWIG_name "_freeswitch"
-#define SWIGVERSION 0x010331
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -2532,7 +2563,9 @@
PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
{
- if (initial_ref) Py_XINCREF(_obj);
+ if (initial_ref) {
+ Py_XINCREF(_obj);
+ }
}
PyObject_ptr & operator=(const PyObject_ptr& item)
@@ -2647,49 +2680,13 @@
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
- if (carray) {
- if (size > INT_MAX) {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- return pchar_descriptor ?
- SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
- } else {
- return PyString_FromStringAndSize(carray, static_cast< int >(size));
- }
- } else {
- return SWIG_Py_Void();
- }
-}
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
- #define SWIG_From_long PyInt_FromLong
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_From_int (int value)
-{
- return SWIG_From_long (value);
-}
-
-
#include <limits.h>
-#ifndef LLONG_MIN
-# define LLONG_MIN LONG_LONG_MIN
-#endif
-#ifndef LLONG_MAX
-# define LLONG_MAX LONG_LONG_MAX
-#endif
-#ifndef ULLONG_MAX
-# define ULLONG_MAX ULONG_LONG_MAX
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+# define LLONG_MAX __LONG_LONG_MAX__
+# define LLONG_MIN (-LLONG_MAX - 1LL)
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
#endif
@@ -2828,6 +2825,40 @@
}
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+ if (carray) {
+ if (size > INT_MAX) {
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+ return pchar_descriptor ?
+ SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+ } else {
+ return PyString_FromStringAndSize(carray, static_cast< int >(size));
+ }
+ } else {
+ return SWIG_Py_Void();
+ }
+}
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtr(const char *cptr)
+{
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+ #define SWIG_From_long PyInt_FromLong
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_int (int value)
+{
+ return SWIG_From_long (value);
+}
+
+
SWIGINTERNINLINE PyObject*
SWIG_From_bool (bool value)
{
@@ -2913,18 +2944,11 @@
SWIGINTERN int
SWIG_AsVal_bool (PyObject *obj, bool *val)
{
- if (obj == Py_True) {
- if (val) *val = true;
- return SWIG_OK;
- } else if (obj == Py_False) {
- if (val) *val = false;
- return SWIG_OK;
- } else {
- long v = 0;
- int res = SWIG_AddCast(SWIG_AsVal_long (obj, val ? &v : 0));
- if (SWIG_IsOK(res) && val) *val = v ? true : false;
- return res;
- }
+ int r = PyObject_IsTrue(obj);
+ if (r == -1)
+ return SWIG_ERROR;
+ if (val) *val = r ? true : false;
+ return SWIG_OK;
}
#ifdef __cplusplus
@@ -2990,6 +3014,285 @@
}
+SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ int arg9 ;
+ int arg10 ;
+ int arg11 ;
+ int arg12 ;
+ int arg13 ;
+ IVRMenu *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int res5 ;
+ char *buf5 = 0 ;
+ int alloc5 = 0 ;
+ int res6 ;
+ char *buf6 = 0 ;
+ int alloc6 = 0 ;
+ int res7 ;
+ char *buf7 = 0 ;
+ int alloc7 = 0 ;
+ int res8 ;
+ char *buf8 = 0 ;
+ int alloc8 = 0 ;
+ int val9 ;
+ int ecode9 = 0 ;
+ int val10 ;
+ int ecode10 = 0 ;
+ int val11 ;
+ int ecode11 = 0 ;
+ int val12 ;
+ int ecode12 = 0 ;
+ int val13 ;
+ int ecode13 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
+ PyObject * obj5 = 0 ;
+ PyObject * obj6 = 0 ;
+ PyObject * obj7 = 0 ;
+ PyObject * obj8 = 0 ;
+ PyObject * obj9 = 0 ;
+ PyObject * obj10 = 0 ;
+ PyObject * obj11 = 0 ;
+ PyObject * obj12 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
+ }
+ arg5 = reinterpret_cast< char * >(buf5);
+ res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
+ }
+ arg6 = reinterpret_cast< char * >(buf6);
+ res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
+ }
+ arg7 = reinterpret_cast< char * >(buf7);
+ res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
+ }
+ arg8 = reinterpret_cast< char * >(buf8);
+ ecode9 = SWIG_AsVal_int(obj8, &val9);
+ if (!SWIG_IsOK(ecode9)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
+ }
+ arg9 = static_cast< int >(val9);
+ ecode10 = SWIG_AsVal_int(obj9, &val10);
+ if (!SWIG_IsOK(ecode10)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
+ }
+ arg10 = static_cast< int >(val10);
+ ecode11 = SWIG_AsVal_int(obj10, &val11);
+ if (!SWIG_IsOK(ecode11)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
+ }
+ arg11 = static_cast< int >(val11);
+ ecode12 = SWIG_AsVal_int(obj11, &val12);
+ if (!SWIG_IsOK(ecode12)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
+ }
+ arg12 = static_cast< int >(val12);
+ ecode13 = SWIG_AsVal_int(obj12, &val13);
+ if (!SWIG_IsOK(ecode13)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
+ }
+ arg13 = static_cast< int >(val13);
+ result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0 );
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:delete_IVRMenu",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ delete arg1;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOOO:IVRMenu_bindAction",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:IVRMenu_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'");
+ }
+ arg1 = reinterpret_cast< IVRMenu * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'");
+ }
+ arg2 = reinterpret_cast< CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->execute(arg2,(char const *)arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+}
+
SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
API *result = 0 ;
@@ -3107,7 +3410,7 @@
SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3363,7 +3666,7 @@
SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3409,7 +3712,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -3427,7 +3730,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n Possible C/C++ prototypes are:\n Stream()\n Stream(switch_stream_handle_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " Stream()\n"
+ " Stream(switch_stream_handle_t *)\n");
return NULL;
}
@@ -3511,7 +3817,7 @@
SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3804,7 +4110,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -3854,7 +4160,12 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n Possible C/C++ prototypes are:\n Event(char const *,char const *)\n Event(char const *)\n Event(switch_event_t *,int)\n Event(switch_event_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " Event(char const *,char const *)\n"
+ " Event(char const *)\n"
+ " Event(switch_event_t *,int)\n"
+ " Event(switch_event_t *)\n");
return NULL;
}
@@ -3943,7 +4254,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -3971,7 +4282,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n Possible C/C++ prototypes are:\n serialize(char const *)\n serialize()\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " serialize(Event *,char const *)\n"
+ " serialize(Event *)\n");
return NULL;
}
@@ -4043,7 +4357,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -4071,7 +4385,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n Possible C/C++ prototypes are:\n setPriority(switch_priority_t)\n setPriority()\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " setPriority(Event *,switch_priority_t)\n"
+ " setPriority(Event *)\n");
return NULL;
}
@@ -4292,7 +4609,7 @@
SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -4749,7 +5066,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -4777,7 +5094,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n Possible C/C++ prototypes are:\n hangup(char *)\n hangup()\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " hangup(CoreSession *,char *)\n"
+ " hangup(CoreSession *)\n");
return NULL;
}
@@ -5131,7 +5451,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 5); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5225,7 +5545,12 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n Possible C/C++ prototypes are:\n recordFile(char *,int,int,int)\n recordFile(char *,int,int)\n recordFile(char *,int)\n recordFile(char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " recordFile(CoreSession *,char *,int,int,int)\n"
+ " recordFile(CoreSession *,char *,int,int)\n"
+ " recordFile(CoreSession *,char *,int)\n"
+ " recordFile(CoreSession *,char *)\n");
return NULL;
}
@@ -5376,7 +5701,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 4); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5424,7 +5749,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n Possible C/C++ prototypes are:\n originate(CoreSession *,char *,int)\n originate(CoreSession *,char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " originate(CoreSession *,CoreSession *,char *,int)\n"
+ " originate(CoreSession *,CoreSession *,char *)\n");
return NULL;
}
@@ -5896,7 +6224,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 3); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5934,7 +6262,10 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n Possible C/C++ prototypes are:\n streamFile(char *,int)\n streamFile(char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " streamFile(CoreSession *,char *,int)\n"
+ " streamFile(CoreSession *,char *)\n");
return NULL;
}
@@ -6299,7 +6630,7 @@
SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -6550,7 +6881,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
+ argc = (int)PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -6576,7 +6907,11 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n Possible C/C++ prototypes are:\n PySession()\n PySession(char *)\n PySession(switch_core_session_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " PySession()\n"
+ " PySession(char *)\n"
+ " PySession(switch_core_session_t *)\n");
return NULL;
}
@@ -6809,7 +7144,7 @@
SWIGINTERN PyObject *PySession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -6817,6 +7152,11 @@
static PyMethodDef SwigMethods[] = {
{ (char *)"consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
{ (char *)"consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
+ { (char *)"new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
+ { (char *)"delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
+ { (char *)"IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
+ { (char *)"IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
+ { (char *)"IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
{ (char *)"new_API", _wrap_new_API, METH_VARARGS, NULL},
{ (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL},
{ (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL},
@@ -6922,16 +7262,17 @@
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static void *_p_PySessionTo_p_CoreSession(void *x) {
+static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
return (void *)((CoreSession *) ((PySession *) x));
}
static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_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};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
@@ -6949,6 +7290,7 @@
&_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
+ &_swigt__p_IVRMenu,
&_swigt__p_PySession,
&_swigt__p_Stream,
&_swigt__p_char,
@@ -6970,6 +7312,7 @@
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_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}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -6991,6 +7334,7 @@
_swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
+ _swigc__p_IVRMenu,
_swigc__p_PySession,
_swigc__p_Stream,
_swigc__p_char,
@@ -7075,7 +7419,7 @@
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -7085,6 +7429,9 @@
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -7113,6 +7460,12 @@
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri May 2 12:43:54 2008
@@ -37,6 +37,59 @@
#pragma warning(disable:4127 4003)
#endif
+
+SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
+ const char *name,
+ const char *greeting_sound,
+ const char *short_greeting_sound,
+ const char *invalid_sound,
+ const char *exit_sound,
+ const char *confirm_macro,
+ const char *confirm_key,
+ int confirm_attempts,
+ int inter_timeout,
+ int digit_len,
+ int timeout,
+ int max_failures)
+{
+ menu = NULL;
+ switch_core_new_memory_pool(&pool);
+ switch_assert(pool);
+ if (switch_strlen_zero(name)) {
+ name = "no name";
+ }
+
+ switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound,
+ exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, pool);
+
+
+}
+
+SWITCH_DECLARE_CONSTRUCTOR IVRMenu::~IVRMenu()
+{
+ if (menu) {
+ switch_ivr_menu_stack_free(menu);
+ }
+ switch_core_destroy_memory_pool(&pool);
+}
+
+SWITCH_DECLARE(void) IVRMenu::bindAction(char *action, const char *arg, const char *bind)
+{
+ switch_ivr_action_t ivr_action = SWITCH_IVR_ACTION_NOOP;
+
+ if (switch_ivr_menu_str2action(action, &ivr_action) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bind %s to %s(%s)\n", bind, action, arg);
+ switch_ivr_menu_bind_action(menu, ivr_action, arg, bind);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid action %s\n", action);
+ }
+}
+
+SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name)
+{
+ switch_ivr_menu_execute(session->session, menu, (char *)name, NULL);
+}
+
SWITCH_DECLARE_CONSTRUCTOR API::API()
{
last_data = NULL;
Modified: freeswitch/trunk/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_menu.c (original)
+++ freeswitch/trunk/src/switch_ivr_menu.c Fri May 2 12:43:54 2008
@@ -601,6 +601,27 @@
};
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action)
+{
+ int i;
+
+ if (!switch_strlen_zero(action_name)) {
+ for(i = 0;;i++) {
+ if (!iam[i].name) {
+ break;
+ }
+
+ if (!strcasecmp(iam[i].name, action_name)) {
+ *action = iam[i].action;
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
+ }
+
+ return SWITCH_STATUS_FALSE;
+}
+
+
static switch_bool_t is_valid_action(const char *action)
{
int i;
1
0
[Freeswitch-svn] [commit] r8248 - freeswitch/trunk/src/mod/endpoints/mod_sofia
by Freeswitch SVN 02 May '08
by Freeswitch SVN 02 May '08
02 May '08
Author: anthm
Date: Fri May 2 12:43:07 2008
New Revision: 8248
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
Log:
update
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Fri May 2 12:43:07 2008
@@ -2298,23 +2298,26 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((profile = (sofia_profile_t *) switch_core_hash_find(mod_sofia_globals.profile_hash, key))) {
if (!(profile->pflags & PFLAG_RUNNING)) {
+#ifdef SOFIA_DEBUG_RWLOCKS
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not running\n", profile->name);
+#endif
profile = NULL;
goto done;
}
if (switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
#ifdef SOFIA_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "Profile %s is locked\n", profile->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is locked\n", profile->name);
#endif
profile = NULL;
}
} else {
#ifdef SOFIA_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "Profile %s is not in the hash\n", key);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not in the hash\n", key);
#endif
}
#ifdef SOFIA_DEBUG_RWLOCKS
if (profile) {
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX LOCK %s\n", profile->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX LOCK %s\n", profile->name);
}
#endif
@@ -2328,7 +2331,7 @@
{
if (profile) {
#ifdef SOFIA_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX UNLOCK %s\n", profile->name);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX UNLOCK %s\n", profile->name);
#endif
switch_thread_rwlock_unlock(profile->rwlock);
}
1
0
[Freeswitch-svn] [commit] r8247 - in freeswitch/trunk/src: . mod/languages/mod_lua mod/languages/mod_perl
by Freeswitch SVN 02 May '08
by Freeswitch SVN 02 May '08
02 May '08
Author: anthm
Date: Fri May 2 09:58:44 2008
New Revision: 8247
Modified:
freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/trunk/src/switch_cpp.cpp
freeswitch/trunk/src/switch_event.c
Log:
make callback stuff work on mod_perl
Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp Fri May 2 09:58:44 2008
@@ -211,47 +211,3 @@
return SWITCH_STATUS_SUCCESS;
}
-
-
-#if 0
-int Session::answer() {}
-int Session::preAnswer() {}
-void Session::hangup(char *cause) {}
-void Session::setVariable(char *var, char *val) {}
-const char *Session::getVariable(char *var) {}
-int Session::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) {}
-void Session::setCallerData(char *var, char *val) {}
-int Session::originate(CoreSession *a_leg_session, char *dest, int timeout) {}
-void Session::setDTMFCallback(void *cbfunc, char *funcargs) {}
-int Session::speak(char *text) {}
-void Session::set_tts_parms(char *tts_name, char *voice_name) {}
-int Session::collectDigits(int timeout) {}
-int Session::getDigits(char *dtmf_buf,
- switch_size_t buflen,
- switch_size_t maxdigits,
- char *terminators,
- char *terminator,
- int timeout) {}
-
-int Session::transfer(char *extensions, char *dialplan, char *context) {}
-int Session::playAndGetDigits(int min_digits,
- int max_digits,
- int max_tries,
- int timeout,
- char *terminators,
- char *audio_files,
- char *bad_input_audio_files,
- char *dtmf_buf,
- char *digits_regex) {}
-
-int Session::streamFile(char *file, int starting_sample_count) {}
-int Session::flushEvents() {}
-int Session::flushDigits() {}
-int Session::setAutoHangup(bool val) {}
-void Session::setHangupHook(void *hangup_func) {}
-bool Session::ready() {}
-void Session::execute(char *app, char *data) {}
-char* Session::get_uuid() {}
-const switch_input_args_t& Session::get_cb_args() {}
-
-#endif
Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.c Fri May 2 09:58:44 2008
@@ -175,11 +175,6 @@
char *input_code = (char *) obj;
lua_State *L = lua_init(); /* opens Lua */
- //switch_event_t *event;
- //switch_event_create(&event, SWITCH_EVENT_MESSAGE);
- //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "testing", "1234");
- //mod_lua_conjure_event(L, event, "blah");
-
lua_parse_and_execute(L, input_code);
if (input_code) {
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp Fri May 2 09:58:44 2008
@@ -4,22 +4,21 @@
static STRLEN n_a;
+#define init_me() cb_function = hangup_func_str = NULL; hh = mark = 0; my_perl = NULL; cb_arg = NULL
+
Session::Session() : CoreSession()
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
Session::Session(char *uuid) : CoreSession(uuid)
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
Session::~Session()
@@ -143,8 +142,6 @@
switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
{
- const char *ret;
-
if (!getPERL()) {
return SWITCH_STATUS_FALSE;;
}
@@ -173,15 +170,11 @@
sv_setpv(this_sv, str);
hv_store(hash, "duration", 8, this_sv, 0);
- if (cb_arg) {
- //this_sv = get_sv(cb_arg, TRUE); DOH!
- }
-
- code = switch_mprintf("%s('dtmf', \\%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
- Perl_eval_pv(my_perl, code, TRUE);
+ code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
+ Perl_eval_pv(my_perl, code, FALSE);
free(code);
- return process_callback_result(SvPV(get_sv(cb_function, FALSE), n_a));
+ return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
case SWITCH_INPUT_TYPE_EVENT:
@@ -192,12 +185,11 @@
mod_perl_conjure_event(my_perl, event, "__Input_Event__");
- code = switch_mprintf("%s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
+ code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, TRUE);
free(code);
-
- return process_callback_result((char *)ret);
+ return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
}
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c Fri May 2 09:58:44 2008
@@ -123,10 +123,10 @@
char *file = input_code;
if (!switch_is_file_path(file)) {
- file = switch_mprintf("require '%s/%s';\n", SWITCH_GLOBAL_dirs.script_dir, file);
+ file = switch_mprintf("do '%s/%s';\n", SWITCH_GLOBAL_dirs.script_dir, file);
switch_assert(file);
} else {
- file = switch_mprintf("require '%s';\n", file);
+ file = switch_mprintf("do '%s';\n", file);
switch_assert(file);
}
error = Perl_safe_eval(my_perl, file);
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Fri May 2 09:58:44 2008
@@ -1462,12 +1462,11 @@
#define SWIGTYPE_p_switch_input_args_t swig_types[13]
#define SWIGTYPE_p_switch_input_type_t swig_types[14]
#define SWIGTYPE_p_switch_priority_t swig_types[15]
-#define SWIGTYPE_p_switch_size_t swig_types[16]
-#define SWIGTYPE_p_switch_status_t swig_types[17]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
-#define SWIGTYPE_p_void swig_types[19]
-static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+#define SWIGTYPE_p_switch_status_t swig_types[16]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
+#define SWIGTYPE_p_void swig_types[18]
+static swig_type_info *swig_types[20];
+static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -5224,15 +5223,15 @@
XS(_wrap_CoreSession_getDigits) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
- switch_size_t arg2 ;
+ int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
int arg5 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
@@ -5252,17 +5251,11 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_size_t, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- } else {
- arg2 = *(reinterpret_cast< switch_size_t * >(argp2));
- }
- }
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
@@ -5281,12 +5274,14 @@
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
XSRETURN(argvi);
fail:
+
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
@@ -6982,7 +6977,6 @@
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_size_t = {"_p_switch_size_t", "switch_size_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};
@@ -7004,7 +6998,6 @@
&_swigt__p_switch_input_args_t,
&_swigt__p_switch_input_type_t,
&_swigt__p_switch_priority_t,
- &_swigt__p_switch_size_t,
&_swigt__p_switch_status_t,
&_swigt__p_switch_stream_handle_t,
&_swigt__p_void,
@@ -7026,7 +7019,6 @@
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_size_t[] = { {&_swigt__p_switch_size_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}};
@@ -7048,7 +7040,6 @@
_swigc__p_switch_input_args_t,
_swigc__p_switch_input_type_t,
_swigc__p_switch_priority_t,
- _swigc__p_switch_size_t,
_swigc__p_switch_status_t,
_swigc__p_switch_stream_handle_t,
_swigc__p_void,
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri May 2 09:58:44 2008
@@ -154,8 +154,11 @@
}
if (event) {
- switch_event_fire(&event);
- return true;
+ switch_event_t *new_event;
+ if (switch_event_dup(&new_event, event) == SWITCH_STATUS_SUCCESS) {
+ switch_event_fire(&new_event);
+ return true;
+ }
}
return false;
}
@@ -416,10 +419,11 @@
SWITCH_DECLARE(void) CoreSession::sendEvent(Event *sendME)
{
- if (sendME->mine) {
- switch_core_session_receive_event(session, &sendME->event);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Not My event!\n");
+ if (sendME->event) {
+ switch_event_t *new_event;
+ if (switch_event_dup(&new_event, sendME->event) == SWITCH_STATUS_SUCCESS) {
+ switch_core_session_receive_event(session, &new_event);
+ }
}
}
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Fri May 2 09:58:44 2008
@@ -632,6 +632,7 @@
if (ret == -1) {
return SWITCH_STATUS_GENERR;
} else {
+ switch_safe_free(event->body);
event->body = data;
return SWITCH_STATUS_SUCCESS;
}
1
0
Author: anthm
Date: Fri May 2 09:18:54 2008
New Revision: 8246
Modified:
freeswitch/trunk/src/switch_cpp.cpp
Log:
tweak
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri May 2 09:18:54 2008
@@ -835,6 +835,10 @@
switch_file_handle_t *fh = NULL;
+ if (switch_strlen_zero(ret)) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
if (fhp) {
fh = fhp;
} else {
@@ -857,10 +861,6 @@
return SWITCH_STATUS_FALSE;
}
- if (!ret) {
- return SWITCH_STATUS_SUCCESS;
- }
-
if (!session) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because session is null\n");
return SWITCH_STATUS_FALSE;
1
0
02 May '08
Author: verifier
Date: Fri May 2 07:23:27 2008
New Revision: 8245
Added:
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs
Modified:
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs
freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs
Log:
Been working on the IvrInterface.
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/EventWatcher/CallManager.cs Fri May 2 07:23:27 2008
@@ -222,20 +222,20 @@
{
GetVariableReply gvr = (GetVariableReply) reply;
if (!gvr.Success)
- Debug.WriteLine("OnBridgeCallId " + reply.ErrCode);
+ Debug.WriteLine("OnBridgeCallId " + reply.ErrorMessage);
string otherChannelId = (string) command.ContextData;
SetVariable sv = new SetVariable(otherChannelId, "gate_callid", gvr.Value);
- sv.OnReply += OnCallIdReply;
+ sv.ReplyReceived += OnCallIdReply;
_eventMgr.Send(sv);
- command.OnReply -= OnBridgeCallId;
+ command.ReplyReceived -= OnBridgeCallId;
}
private void OnCallIdReply(CmdBase command, CommandReply reply)
{
if (!reply.Success)
- Debug.WriteLine("OnCallIdReply " + reply.ErrCode);
- command.OnReply -= OnCallIdReply;
+ Debug.WriteLine("OnCallIdReply " + reply.ErrorMessage);
+ command.ReplyReceived -= OnCallIdReply;
}
#region Nested type: ExtensionMapper
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecute.cs Fri May 2 07:23:27 2008
@@ -1,10 +1,32 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
namespace FreeSwitch.EventSocket
{
public class EventChannelExecute : EventChannelState
{
+ private string _appName;
+ private string _arguments;
+
+ public string AppName
+ {
+ get { return _appName; }
+ set { _appName = value; }
+ }
+
+ public string Arguments
+ {
+ get { return _arguments; }
+ set { _arguments = value; }
+ }
+
+ public override bool ParseCommand(string name, string value)
+ {
+ if (name == "application")
+ AppName = value;
+ else if (name == "application-data")
+ Arguments = value;
+ else
+ return base.ParseCommand(name, value);
+
+ return true;
+ }
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/ChannelEvents/EventChannelExecuteComplete.cs Fri May 2 07:23:27 2008
@@ -2,6 +2,32 @@
{
public class EventChannelExecuteComplete : EventChannelState
{
+ private string _appName;
+ private string _arguments;
+
+ public string AppName
+ {
+ get { return _appName; }
+ set { _appName = value; }
+ }
+
+ public string Arguments
+ {
+ get { return _arguments; }
+ set { _arguments = value; }
+ }
+
+ public override bool ParseCommand(string name, string value)
+ {
+ if (name == "application")
+ AppName = value;
+ else if (name == "application-data")
+ Arguments = value;
+ else
+ return base.ParseCommand(name, value);
+
+ return true;
+ }
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AnyCommand.cs Fri May 2 07:23:27 2008
@@ -28,7 +28,7 @@
else
{
CommandReply reply = new CommandReply(false);
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/AuthCommand.cs Fri May 2 07:23:27 2008
@@ -26,7 +26,7 @@
else
{
CommandReply reply = new CommandReply(false);
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CmdBase.cs Fri May 2 07:23:27 2008
@@ -8,7 +8,7 @@
public abstract class CmdBase
{
- public event ReplyHandler OnReply;
+ public event ReplyHandler ReplyReceived;
private object _contextData;
@@ -35,16 +35,21 @@
public virtual void HandleReply(CommandReply reply)
{
// a command is only invoked once.
- if (OnReply != null)
+ if (ReplyReceived != null)
{
- OnReply(this, reply);
- OnReply = null;
+ ReplyReceived(this, reply);
+ ReplyReceived = null;
}
}
public virtual CommandReply CreateReply(string dataToParse)
{
- return null;
+ if (string.IsNullOrEmpty(dataToParse.Trim()))
+ return new CommandReply(false);
+
+ CommandReply reply = new CommandReply(dataToParse.Trim()[0] == '+');
+ reply.ErrorMessage = dataToParse;
+ return reply;
}
public override string ToString()
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/CommandReply.cs Fri May 2 07:23:27 2008
@@ -6,7 +6,7 @@
public class CommandReply
{
private bool _success;
- private string _errCode;
+ private string _ErrorMessage;
public CommandReply(bool success)
{
@@ -18,10 +18,10 @@
get { return _success; }
}
- public string ErrCode
+ public string ErrorMessage
{
- get { return _errCode; }
- set { _errCode = value; }
+ get { return _ErrorMessage; }
+ set { _ErrorMessage = value; }
}
public override string ToString()
@@ -29,7 +29,7 @@
if (_success)
return "Success";
else
- return "Failed: " + _errCode;
+ return "Failed: " + _ErrorMessage;
}
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/ExecuteJavascript.cs Fri May 2 07:23:27 2008
@@ -47,7 +47,7 @@
else
{
CommandReply reply = new CommandReply(false);
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/GetVariable.cs Fri May 2 07:23:27 2008
@@ -39,7 +39,7 @@
else
{
GetVariableReply reply = new GetVariableReply(false, string.Empty);
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs Fri May 2 07:23:27 2008
@@ -97,9 +97,9 @@
{
OriginateReply reply = new OriginateReply(false, string.Empty);
if (nameValue.Length > 1)
- reply.ErrCode = nameValue[1];
+ reply.ErrorMessage = nameValue[1];
else
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Playback.cs Fri May 2 07:23:27 2008
@@ -6,6 +6,7 @@
public class PlaybackCmd : SendMsg
{
private readonly string _fileName;
+ private readonly string _dtmfAbort = string.Empty;
/// <summary>
///
@@ -21,6 +22,12 @@
_fileName = fileName;
}
+ public PlaybackCmd(string uuid, string fileName, string dtmfAbort) : base(uuid)
+ {
+ _fileName = fileName;
+ _dtmfAbort = dtmfAbort;
+ }
+
public override string Command
{
get { return "playback"; }
@@ -30,5 +37,10 @@
{
get { return _fileName; }
}
+
+ public string DtmfAbort
+ {
+ get { return _dtmfAbort; }
+ }
}
}
Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SendEventCmd.cs Fri May 2 07:23:27 2008
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket.Commands
+{
+ public class SendEventCmd : CmdBase
+ {
+ private EventBase _event;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="evt">Note that all events have NOT being developed to be sent, only to be received.</param>
+ public SendEventCmd(EventBase evt)
+ {
+ _event = evt;
+ }
+
+
+ public override string Command
+ {
+ get { return "sendevent " + _event.Name + "\n"; }
+ }
+
+ public override string Arguments
+ {
+ get { return _event.ToString(); }
+ }
+ }
+}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/SetVariable.cs Fri May 2 07:23:27 2008
@@ -25,7 +25,17 @@
public override string Arguments
{
- get { return _channelId + " " + _name + " " + _value; }
+ get { return _channelId + " " + Name + " " + Value; }
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ }
+
+ public string Value
+ {
+ get { return _value; }
}
public override CommandReply CreateReply(string dataToParse)
@@ -35,7 +45,7 @@
else
{
CommandReply reply = new CommandReply(false);
- reply.ErrCode = dataToParse;
+ reply.ErrorMessage = dataToParse;
return reply;
}
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs Fri May 2 07:23:27 2008
@@ -79,7 +79,6 @@
}
catch (SocketException)
{
- Console.WriteLine("EventSocket: Connect failed");
HandleDisconnect();
}
}
@@ -88,8 +87,6 @@
{
lock (_lockobj)
{
- Console.WriteLine("EventSocket.TryConnect: Connecting to " + _hostName + ":" + _port);
-
_socket.Connect(_hostName, _port);
if (_stream == null)
_stream = new NetworkStream(_socket, false);
@@ -167,9 +164,7 @@
{
try
{
- Console.WriteLine("EventSocket.Write: Trying to connect eventsocket.");
TryConnect();
- Console.WriteLine("EventSocket.Write: Connected.");
}
catch (SocketException)
{
@@ -189,7 +184,7 @@
if (msg.ContentType == "auth/request")
{
AuthCommand cmd = new AuthCommand(_password);
- cmd.OnReply += OnAuthed;
+ cmd.ReplyReceived += OnAuthed;
_commands.Enqueue(cmd);
Write(cmd + "\n\n");
}
@@ -199,7 +194,6 @@
if (_commands.Count > 0)
{
CmdBase cmd = _commands.Dequeue();
- Console.WriteLine("Reply to " + cmd.GetType().Name + ": " + msg.Body);
cmd.HandleReply(cmd.CreateReply(msg.Body));
}
else
@@ -285,14 +279,11 @@
EventSocket client = (EventSocket) state;
try
{
- Console.WriteLine("EventSocket.Timer: Trying to connect eventsocket.");
client.TryConnect();
Console.WriteLine("EventSocket.Timer: Connected.");
}
- catch (SocketException err)
- {
- Console.WriteLine("Eventsocket.TryConnect: " + err.Message);
- }
+ catch (SocketException)
+ {}
}
}
}
\ No newline at end of file
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs Fri May 2 07:23:27 2008
@@ -19,7 +19,27 @@
public string Name
{
- get { return m_name; }
+ get
+ {
+ lock (this)
+ {
+ if (string.IsNullOrEmpty(m_name))
+ {
+ string name = GetType().Name.Substring(5); //remove (Event)
+ m_name = string.Empty;
+ m_name += char.ToUpper(name[0]);
+ for (int i = 1; i < name.Length; ++i)
+ {
+ if (char.IsUpper(name[i]))
+ m_name += '_';
+ else
+ m_name += char.ToUpper(name[i]);
+ }
+ }
+ }
+
+ return m_name;
+ }
set { m_name = value; }
}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventMessageWaiting.cs Fri May 2 07:23:27 2008
@@ -8,6 +8,18 @@
private int _totalMessages;
private int _totalUrgentMessages;
+ public EventMessageWaiting()
+ {
+
+ }
+
+ public EventMessageWaiting(string account, int newMessages, int totalMessages)
+ {
+ _account = account;
+ _newMessages = newMessages;
+ _totalMessages = totalMessages;
+ }
+
/// <summary>
/// Messages are for this account
/// </summary>
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj Fri May 2 07:23:27 2008
@@ -35,10 +35,6 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="Tiny.Net, Version=1.0.0.1, Culture=neutral, PublicKeyToken=15480ee9e0247fcb, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\dlls\Debug\Tiny.Net.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ChannelEvents\EventChannelApplication.cs" />
@@ -65,12 +61,16 @@
<Compile Include="Commands\ParkCmd.cs" />
<Compile Include="Commands\Playback.cs" />
<Compile Include="Commands\RecordCmd.cs" />
+ <Compile Include="Commands\SendEventCmd.cs" />
<Compile Include="Commands\SendMsg.cs" />
<Compile Include="Commands\SetVariable.cs" />
<Compile Include="Commands\SleepCmd.cs" />
<Compile Include="EventManager.cs" />
<Compile Include="ChannelEvents\EventDtmfStatus.cs" />
+ <Compile Include="Ivr\DtmfEventArgs.cs" />
<Compile Include="Ivr\IvrInterface.cs" />
+ <Compile Include="Ivr\IvrQueue.cs" />
+ <Compile Include="Ivr\PrivateWaitDtmf.cs" />
<Compile Include="PlainEventMsg.cs" />
<Compile Include="EventParser.cs" />
<Compile Include="Events.cs" />
@@ -118,6 +118,7 @@
</Target>
-->
<PropertyGroup>
- <PostBuildEvent>copy $(TargetPath) $(SolutionDir)..\..\dlls\$(ConfigurationName)</PostBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/DtmfEventArgs.cs Fri May 2 07:23:27 2008
@@ -0,0 +1,44 @@
+using System;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+
+ public class DtmfEventArgs : EventArgs
+ {
+ private string _dtmf;
+ private string _dtmfCopy;
+
+ public DtmfEventArgs(string dtmf)
+ {
+ _dtmf = dtmf;
+ _dtmfCopy = (string)_dtmf.Clone();
+ }
+
+ /// <summary>
+ /// You cannot remove digits from the buffer (since it's a copy of the real buffer).
+ /// </summary>
+ /// <seealso cref="RemoveDigits"/>
+ public string Dtmf
+ {
+ get { return _dtmfCopy; }
+ }
+
+ /// <summary>
+ /// Remove digits from the real buffer.
+ /// </summary>
+ /// <param name="count">number of digits to remove.</param>
+ public void RemoveDigits(int count)
+ {
+ lock (_dtmf)
+ {
+ if (count > _dtmf.Length)
+ _dtmf = string.Empty;
+ else
+ _dtmf = _dtmf.Remove(0, count);
+ _dtmfCopy = (string)_dtmf.Clone();
+ }
+ }
+ }
+
+ public delegate void DtmfHandler(object source, DtmfEventArgs args);
+}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrInterface.cs Fri May 2 07:23:27 2008
@@ -8,16 +8,19 @@
{
public const string AllDigits = "*#0123456789";
private readonly string _uuid;
- private readonly string _baseSoundPath = "sounds\\";
+ private string _baseSoundPath = "sounds\\";
private string _dtmf = string.Empty;
private EventManager _mgr;
public event DtmfHandler DtmfReceived;
- private readonly int _dtmfWaitCount = 0;
- private ManualResetEvent _dtmfWaitEvent;
+ private int _dtmfWaitCount = 0;
private bool _abortSpeechOnDtmf;
private bool _answered;
private IvrInterfaceHandler _handler = null;
private string _lastAbortDigits = "*";
+ private int _defaultTimeout = 10000;
+ private readonly ManualResetEvent _dtmfTimeout = new ManualResetEvent(false);
+ private IvrQueue _queue;
+
public IvrInterface(EventManager mgr, string uuid)
{
@@ -26,6 +29,7 @@
if (string.IsNullOrEmpty(uuid))
throw new ArgumentNullException("uuid");
+ _queue = new IvrQueue(mgr);
_mgr = mgr;
mgr.EventReceived += OnEvent;
_uuid = uuid;
@@ -54,34 +58,64 @@
set { _abortSpeechOnDtmf = value; }
}
+ /// <summary>
+ /// True if IVR call have been answered.
+ /// </summary>
public bool Answered
{
get { return _answered; }
}
+ /// <summary>
+ /// Number of seconds to wait on DTMF
+ /// </summary>
+ public int DefaultTimeout
+ {
+ get { return _defaultTimeout; }
+ set { _defaultTimeout = value; }
+ }
+
+ /// <summary>
+ /// Relative path under FreeSWITCH to where the sound files resides
+ /// </summary>
+ /// <remarks>default is "sounds\"</remarks>
+ public string BaseSoundPath
+ {
+ get { return _baseSoundPath; }
+ set { _baseSoundPath = value; }
+ }
+
private void OnEvent(EventBase receivedEvent)
{
+ if (!receivedEvent.IsChannelEvent)
+ return;
+
+ ChannelEvent channelEvent = (ChannelEvent) receivedEvent;
+ if (channelEvent.UniqueId != _uuid)
+ return;
+
if (receivedEvent is EventChannelAnswer)
{
_answered = true;
}
-/* else if (receivedEvent is EventDtmfStatus)
- {
- // Let's always dequeue dtmf.
- EventDtmfStatus evt = (EventDtmfStatus) receivedEvent;
- if (evt.UniqueId == _uuid)
- _mgr.Send(new GetDtmfCmd(_uuid, evt.Count));
- }*/
else if (receivedEvent is EventDtmf)
{
EventDtmf evt = (EventDtmf) receivedEvent;
- lock (_dtmf)
- _dtmf += evt.Digit;
- if (_dtmfWaitCount >= _dtmf.Length)
- _dtmfWaitEvent.Set();
+ Console.WriteLine("DTMF Event: " + evt.Digit);
+ if (_queue.GotDtmf(evt.Digit))
+ {
+ lock (_dtmf)
+ _dtmf += evt.Digit;
+
+ if (_dtmfWaitCount != 0 && _dtmf.Length >= _dtmfWaitCount)
+ {
+ Console.WriteLine("Got all DTMF: " + _dtmfWaitCount + "/" + _dtmf.Length);
+ _dtmfTimeout.Set();
+ }
- if (DtmfReceived != null)
- DtmfReceived(this, new DtmfEventArgs(_dtmf));
+ if (DtmfReceived != null)
+ DtmfReceived(this, new DtmfEventArgs(_dtmf));
+ }
}
else if (receivedEvent is EventChannelDestroy || receivedEvent is EventChannelHangup)
{
@@ -91,6 +125,16 @@
_mgr = null;
}
}
+ else if (receivedEvent is EventChannelExecute)
+ {
+ EventChannelExecute exec = (EventChannelExecute)receivedEvent;
+ _queue.Execute(exec);
+ }
+ else if (receivedEvent is EventChannelExecuteComplete)
+ {
+ EventChannelExecuteComplete exec = (EventChannelExecuteComplete)receivedEvent;
+ _queue.ExecuteComplete(exec);
+ }
}
/// <summary>
@@ -104,15 +148,26 @@
{
if (_mgr == null)
return string.Empty;
- if (_dtmfWaitEvent != null)
- throw new InvalidOperationException("Already waiting on an event.");
+
+ lock (_dtmf)
+ {
+ if (_dtmfWaitCount > 0)
+ throw new InvalidOperationException("Already waiting on an event.");
+ _dtmfWaitCount = 1;
+ _dtmfTimeout.Reset();
+ }
if (_dtmf.Length < count)
{
- _dtmfWaitEvent = new ManualResetEvent(false);
- if (!_dtmfWaitEvent.WaitOne(timeout * 1000, true))
+ if (_queue.CommandRunning)
+ _queue.Add(new PrivateWaitDtmf(OnDtmfTimeout, timeout));
+
+ _dtmfWaitCount = count - _dtmf.Length;
+ if (!_dtmfTimeout.WaitOne(timeout, true))
{
+ Console.WriteLine("Didn't get any DTMF: " + _dtmf);
_dtmf = string.Empty;
+ _dtmfWaitCount = 0;
return string.Empty;
}
}
@@ -122,14 +177,54 @@
if (_dtmf.Length >= count)
{
string dtmf = _dtmf.Substring(0, count);
- _dtmf = _dtmf.Remove(count);
+ if (_dtmf.Length == count)
+ _dtmf = string.Empty;
+ else
+ _dtmf = _dtmf.Remove(count);
+ _dtmfWaitCount = 0;
return dtmf;
}
}
+ _dtmfWaitCount = 0;
return string.Empty;
}
+ private void OnDtmfTimeout(PrivateWaitDtmf dtmf)
+ {
+ dtmf.Dispose();
+ _dtmfTimeout.Set();
+ }
+
+ /// <summary>
+ /// Wait on dtmf.
+ /// </summary>
+ /// <param name="count">Number of digits to get</param>
+ /// <remarks>You can also used the Dtmf event if you want to use asynchrounous programming.</remarks>
+ /// <seealso cref="DtmfReceived"/>
+ /// <seealso cref="DefaultTimeout"/>
+ public string GetDtmf(int count)
+ {
+ return GetDtmf(count, _defaultTimeout);
+ }
+
+ /// <summary>
+ /// Play a sound file
+ /// </summary>
+ /// <param name="path">Path to sound file.</param>
+ /// <seealso cref="AllDigits"/>
+ /// <remarks>Prepends <see cref="BaseSoundPath"/> to path.</remarks>
+ public void Play(string path)
+ {
+ Play(path, AllDigits);
+ }
+
+ /// <summary>
+ /// Play a sound file
+ /// </summary>
+ /// <param name="path">Path to sound file.</param>
+ /// <param name="digitsToAbortOn">DTMF digits that can abort speech.</param>
+ /// <remarks>Prepends <see cref="BaseSoundPath"/> to path.</remarks>
public void Play(string path, string digitsToAbortOn)
{
if (_mgr == null)
@@ -144,69 +239,61 @@
_lastAbortDigits = digitsToAbortOn;
}
- _mgr.Send(new PlaybackCmd(_uuid, _baseSoundPath + path));
+ _queue.Add(new PlaybackCmd(_uuid, GetSoundPath(path, false), digitsToAbortOn));
}
- public void Record(string path, bool stop, int limit)
- {
- if (_mgr == null)
- return;
- _mgr.Send(new RecordCmd(_uuid, _baseSoundPath + path, stop, limit));
- }
- public void Record(string path, int limit)
- {
- if (_mgr == null)
- return;
- _mgr.Send(new RecordCmd(_uuid, _baseSoundPath + path, limit));
- }
- public void Sleep(int ms)
+ /// <summary>
+ /// Record a sound file
+ /// </summary>
+ /// <param name="path">Where to store the sound</param>
+ /// <param name="limit">Maximum number of seconds that can be recorded.</param>
+ /// <param name="stop">stop an ongoing recording</param>
+ public void Record(string path, int limit, bool stop)
{
if (_mgr == null)
return;
- _mgr.Send(new SleepCmd(_uuid, ms));
- }
- }
- public class DtmfEventArgs : EventArgs
- {
- private string _dtmf;
- private string _dtmfCopy;
+ _queue.Add(new RecordCmd(_uuid, GetSoundPath(path, true), stop, limit));
+ }
- public DtmfEventArgs(string dtmf)
+ /// <summary>
+ /// Record a sound file
+ /// </summary>
+ /// <param name="path">Where to store the sound</param>
+ /// <param name="limit">Maximum number of seconds that can be recorded.</param>
+ public void Record(string path, int limit)
{
- _dtmf = dtmf;
- _dtmfCopy = (string) _dtmf.Clone();
+ Record(path, limit, false);
}
/// <summary>
- /// You cannot remove digits from the buffer (since it's a copy of the real buffer).
+ /// This method can be used to build paths for different languages and such.
/// </summary>
- /// <seealso cref="RemoveDigits"/>
- public string Dtmf
+ /// <param name="fileName">soundfile</param>
+ /// <param name="isRecording">path is to a file being recorded</param>
+ /// <returns>Path to sound file</returns>
+ protected virtual string GetSoundPath(string fileName, bool isRecording)
{
- get { return _dtmfCopy; }
+ return BaseSoundPath + fileName;
}
/// <summary>
- /// Remove digits from the real buffer.
+ /// Tell script to sleep for a while.
/// </summary>
- /// <param name="count">number of digits to remove.</param>
- public void RemoveDigits(int count)
+ /// <param name="ms">number of milliseconds</param>
+ public void Sleep(int ms)
{
- lock (_dtmf)
- {
- if (count > _dtmf.Length)
- _dtmf = string.Empty;
- else
- _dtmf = _dtmf.Remove(0, count);
- _dtmfCopy = (string)_dtmf.Clone();
- }
+ if (_mgr == null)
+ return;
+
+ _queue.Add(new SleepCmd(_uuid, ms));
}
+
+
}
- public delegate void DtmfHandler(object source, DtmfEventArgs args);
public delegate void IvrInterfaceHandler(IvrInterface app);
-}
+}
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/IvrQueue.cs Fri May 2 07:23:27 2008
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+ internal class IvrQueue
+ {
+ private readonly Queue<CmdBase> _items = new Queue<CmdBase>();
+ private readonly EventManager _mgr;
+ private CmdBase _currentCommand;
+
+ public IvrQueue(EventManager mgr)
+ {
+ if (mgr == null)
+ throw new ArgumentNullException("mgr");
+
+ _mgr = mgr;
+ }
+
+ public bool CommandRunning
+ {
+ get { return _currentCommand != null; }
+ }
+
+ public void Add(CmdBase cmd)
+ {
+ lock (_items)
+ _items.Enqueue(cmd);
+ }
+
+ public void Execute(EventChannelExecute evt)
+ {
+ }
+
+ public void ExecuteComplete(EventChannelExecuteComplete evt)
+ {
+ Console.WriteLine(evt.AppName + "(" + evt.Arguments + ") is done.");
+
+ if (_currentCommand != null && evt.AppName != _currentCommand.Command)
+ {
+ Console.WriteLine("Executed something that is not ours: " + _currentCommand.Command);
+ return;
+ }
+
+ // run next command
+ lock (_items)
+ {
+ _currentCommand = null;
+
+ if (_items.Count > 0)
+ {
+ // check if next cmd is waiting on dtmf, then trigger it to start.
+ if (_items.Peek().Command == "privdtmf")
+ ((PrivateWaitDtmf) _items.Peek()).Trigger();
+
+ SendNextCommand();
+ }
+ }
+ }
+
+ /// <summary>
+ /// a DTMF was pressed. Validate it towards the queue
+ /// </summary>
+ /// <param name="digit"></param>
+ /// <returns>true if it can be processed, false if not.</returns>
+ public bool GotDtmf(char digit)
+ {
+ bool isValid = true;
+
+ lock (_items)
+ {
+ // dequeue all play commands if correct digit is pressed.
+ while (_items.Count > 0)
+ {
+ if (_items.Peek().GetType() == typeof (SetVariable))
+ {
+ Console.WriteLine("Is SetVariable");
+ SetVariable var = (SetVariable) _items.Peek();
+ string digits = string.Empty;
+ digits += digit;
+ if (var.Name == "playback_terminators" )
+ {
+ if (var.Value.Contains(digits))
+ {
+ _items.Dequeue();
+ if (_items.Count > 0 && _items.Peek().GetType() == typeof(PlaybackCmd))
+ _items.Dequeue();
+ }
+ else
+ isValid = false; //digit was not one of the terminators. skip it.
+ }
+ }
+ else if (_items.Peek().GetType() == typeof(PlaybackCmd))
+ {
+ Console.WriteLine("Is PlaybackCmd");
+ PlaybackCmd cmd = (PlaybackCmd)_items.Peek();
+ string digits = string.Empty;
+ digits += digit;
+ if (cmd.DtmfAbort.Contains(digits))
+ _items.Dequeue();
+ else
+ {
+ isValid = false; //digit was not one of the terminators, skip it.
+ break;
+ }
+ }
+ else
+ break;
+ }
+
+ // and dequeue the dtmf command.
+ if (_items.Count > 0 && _items.Peek().GetType() == typeof(PrivateWaitDtmf))
+ ((PrivateWaitDtmf) _items.Dequeue()).Dispose();
+ }
+
+ return isValid;
+ }
+
+ private static void OnCommandReply(CmdBase command, CommandReply reply)
+ {
+ command.ReplyReceived -= OnCommandReply;
+ if (!reply.Success)
+ {
+ Console.WriteLine("Command failed: " + reply.ErrorMessage);
+ }
+ }
+
+ public CmdBase Peek()
+ {
+ lock (_items)
+ {
+ return _items.Peek();
+ }
+ }
+
+ public CmdBase Pop()
+ {
+ lock (_items)
+ {
+ return _items.Dequeue();
+ }
+ }
+
+ private void SendNextCommand()
+ {
+ lock (_items)
+ {
+ if (_currentCommand != null)
+ throw new InvalidOperationException("A command is already running.");
+
+ _currentCommand = _items.Dequeue();
+ }
+
+ _currentCommand.ReplyReceived += OnCommandReply;
+ _mgr.Send(_currentCommand);
+ }
+ }
+}
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs Fri May 2 07:23:27 2008
@@ -0,0 +1,70 @@
+using System;
+using System.Threading;
+using FreeSwitch.EventSocket.Commands;
+
+namespace FreeSwitch.EventSocket.Ivr
+{
+ internal delegate void DtmfTimeoutHandler(PrivateWaitDtmf dtmf);
+
+ internal class PrivateWaitDtmf : CmdBase, IDisposable
+ {
+ private Timer _timer;
+ private readonly int _waitTime;
+ private readonly DtmfTimeoutHandler _handler;
+
+ /// <summary>
+ /// DTMF timeouts should be counted AFTER a phrase has been said.
+ /// this small command allows us to start the timer when so.
+ /// </summary>
+ /// <param name="handler">Method that will be signalled when the DTMF command goes on timeout.</param>
+ /// <param name="time">Number of seconds to wait on input.</param>
+ public PrivateWaitDtmf(DtmfTimeoutHandler handler, int time)
+ {
+ if (handler == null)
+ throw new ArgumentNullException("handler");
+ if (time == 0)
+ throw new ArgumentException("time cannot be 0.", "time");
+ if (time < 100)
+ time *= 1000;
+ _waitTime = time;
+ _handler = handler;
+ }
+
+ public override string Command
+ {
+ get { return "privdtmf"; }
+ }
+
+ public override string Arguments
+ {
+ get { return _waitTime.ToString(); }
+ }
+
+ public void Trigger()
+ {
+ _timer = new Timer(OnTimeout, null, _waitTime, Timeout.Infinite);
+ }
+
+ private void OnTimeout(object state)
+ {
+ _timer.Dispose();
+ _timer = null;
+ _handler(this);
+ }
+
+ #region IDisposable Members
+
+ ///<summary>
+ ///Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ ///</summary>
+ ///<filterpriority>2</filterpriority>
+ public void Dispose()
+ {
+ if (_timer != null)
+ _timer.Dispose();
+ _timer = null;
+ }
+
+ #endregion
+ }
+}
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Program.cs Fri May 2 07:23:27 2008
@@ -1,5 +1,7 @@
using System;
+using System.Threading;
using FreeSwitch.EventSocket;
+using FreeSwitch.EventSocket.Commands;
namespace IvrSocket
{
@@ -12,17 +14,13 @@
mgr.EventReceived += IvrManager;
mgr.Subscribe(Event.All);
mgr.Start("localhost");
+ Thread.Sleep(1000);
+ //mgr.Send(new SendEventCmd(new EventMessageWaiting("jonas(a)192.168.0.58", 1, 2)));
Console.ReadLine();
}
private static void IvrManager(EventBase receivedEvent)
{
- Console.WriteLine(receivedEvent.Name);
- if (receivedEvent is ChannelEvent)
- {
- ChannelEvent evt = (ChannelEvent) receivedEvent;
- Console.WriteLine(evt.Name + ": " + evt.UniqueId);
- }
if (receivedEvent is EventChannelAnswer)
{
EventChannelAnswer answer = (EventChannelAnswer)receivedEvent;
Modified: freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs
==============================================================================
--- freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs (original)
+++ freeswitch/trunk/scripts/contrib/verifier/EventSocket/trunk/IvrSocket/Voicemail.cs Fri May 2 07:23:27 2008
@@ -21,6 +21,10 @@
private void OnIvr(IvrInterface app)
{
_ivr.Play("sv\\system\\record_after_beep.wav", IvrInterface.AllDigits);
+ _ivr.Play("sv\\system\\record_after_beep.wav", IvrInterface.AllDigits);
+ _ivr.Play("sv\\system\\record_after_beep.wav", "2");
+ string dtmf = _ivr.GetDtmf(4);
+ Console.WriteLine("Got DTMF: " + dtmf);
//_ivr.Sleep(5000);
//_ivr.Record("voicemails\\" + Guid.NewGuid() + ".wav", 60);
}
1
0
[Freeswitch-svn] [commit] r8244 - freeswitch/trunk/src/mod/languages/mod_python
by Freeswitch SVN 02 May '08
by Freeswitch SVN 02 May '08
02 May '08
Author: greenlizard
Date: Thu May 1 20:57:25 2008
New Revision: 8244
Modified:
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
Log:
reswig against 8241 and fix bugs with changed number of args to playAndGetDigits (note: exising scripts will need to be fixed to pass ONE less argument - see wiki for new syntax). also, comment out hangup hook handler that was causing seg fault, that needs to be redone. registering hangup hooks inscripts will no longer have any effect.
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Thu May 1 20:57:25 2008
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org)
-# Version 1.3.35
+# Version 1.3.31
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
@@ -152,7 +152,7 @@
__setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, CoreSession, name)
- def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
+ def __init__(self): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _freeswitch.delete_CoreSession
__del__ = lambda self : None;
@@ -215,8 +215,6 @@
dtmf_callback = _freeswitch.dtmf_callback
S_SWAPPED_IN = _freeswitch.S_SWAPPED_IN
S_SWAPPED_OUT = _freeswitch.S_SWAPPED_OUT
-api_execute = _freeswitch.api_execute
-api_reply_delete = _freeswitch.api_reply_delete
class PySession(CoreSession):
__swig_setmethods__ = {}
for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp Thu May 1 20:57:25 2008
@@ -55,13 +55,17 @@
char *resultStr;
bool did_swap_in = false;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check_hangup_hook called\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
if (!session) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
return;
}
+ return;
+
+ /*! NEEDS TO BE FIXED:
+
// The did_swap_in boolean was added to fix the following problem:
// Design flaw - we swap in threadstate based on the assumption that thread state
// is currently _swapped out_ when this hangup hook is called. However, nothing known to
@@ -101,7 +105,7 @@
}
Py_XDECREF(result);
-
+ */
}
switch_status_t PySession::run_dtmf_callback(void *input,
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h Thu May 1 20:57:25 2008
@@ -21,8 +21,6 @@
void console_log(char *level_str, char *msg);
void console_clean_log(char *msg);
-char *api_execute(char *cmd, char *arg);
-void api_reply_delete(char *reply);
class PySession : public CoreSession {
private:
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Thu May 1 20:57:25 2008
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.35
+ * Version 1.3.31
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -12,7 +12,7 @@
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
+template<class T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
@@ -25,10 +25,6 @@
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
-
-template <typename T> T SwigValueInit() {
- return T();
-}
#endif
/* -----------------------------------------------------------------------------
@@ -38,14 +34,14 @@
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
+# if defined(__SUNPRO_CC)
+# if (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
# else
-# define SWIGTEMPLATEDISAMBIGUATOR
+# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
@@ -128,12 +124,6 @@
# define _CRT_SECURE_NO_DEPRECATE
#endif
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
/* Python.h has to appear first */
#include <Python.h>
@@ -147,7 +137,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
+#define SWIG_RUNTIME_VERSION "3"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -182,7 +172,6 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -323,10 +312,10 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
+typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store information on one type */
+/* Structure to store inforomation on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -371,7 +360,7 @@
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
- return (int)((l1 - f1) - (l2 - f2));
+ return (l1 - f1) - (l2 - f2);
}
/*
@@ -453,8 +442,8 @@
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
}
/*
@@ -878,7 +867,7 @@
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_SetString(PyExc_RuntimeError, mesg);
+ PyErr_Format(PyExc_RuntimeError, mesg);
}
}
@@ -1118,14 +1107,14 @@
/* Unpack the argument tuple */
SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
{
if (!args) {
if (!min && !max) {
return 1;
} else {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
- name, (min == max ? "" : "at least "), (int)min);
+ name, (min == max ? "" : "at least "), min);
return 0;
}
}
@@ -1133,14 +1122,14 @@
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
- register Py_ssize_t l = PyTuple_GET_SIZE(args);
+ register int l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at least "), (int)min, (int)l);
+ name, (min == max ? "" : "at least "), min, l);
return 0;
} else if (l > max) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at most "), (int)max, (int)l);
+ name, (min == max ? "" : "at most "), max, l);
return 0;
} else {
register int i;
@@ -1438,7 +1427,7 @@
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own == SWIG_POINTER_OWN) {
+ if (sobj->own) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1456,13 +1445,12 @@
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- }
-#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- else {
+ } else {
const char *name = SWIG_TypePrettyName(ty);
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
- }
+#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
#endif
+ }
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1620,11 +1608,9 @@
(unaryfunc)0, /*nb_float*/
(unaryfunc)PySwigObject_oct, /*nb_oct*/
(unaryfunc)PySwigObject_hex, /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
};
@@ -1967,7 +1953,7 @@
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own == SWIG_POINTER_OWN) {
+ if (own) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1988,8 +1974,6 @@
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
- if (own)
- *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -2003,15 +1987,7 @@
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- if (newmemory == SWIG_CAST_NEW_MEMORY) {
- assert(own);
- if (own)
- *own = *own | SWIG_CAST_NEW_MEMORY;
- }
- }
+ if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
break;
}
}
@@ -2021,8 +1997,7 @@
}
}
if (sobj) {
- if (own)
- *own = *own | sobj->own;
+ if (own) *own = sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2087,13 +2062,8 @@
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (tc) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- } else {
- return SWIG_ERROR;
- }
+ if (!tc) return SWIG_ERROR;
+ *ptr = SWIG_TypeCast(tc,vptr);
} else {
*ptr = vptr;
}
@@ -2511,12 +2481,11 @@
#define SWIGTYPE_p_switch_input_args_t swig_types[13]
#define SWIGTYPE_p_switch_input_type_t swig_types[14]
#define SWIGTYPE_p_switch_priority_t swig_types[15]
-#define SWIGTYPE_p_switch_size_t swig_types[16]
-#define SWIGTYPE_p_switch_status_t swig_types[17]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
-#define SWIGTYPE_p_void swig_types[19]
-static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+#define SWIGTYPE_p_switch_status_t swig_types[16]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
+#define SWIGTYPE_p_void swig_types[18]
+static swig_type_info *swig_types[20];
+static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2535,7 +2504,7 @@
#define SWIG_name "_freeswitch"
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010331
#define SWIG_VERSION SWIGVERSION
@@ -2563,9 +2532,7 @@
PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
{
- if (initial_ref) {
- Py_XINCREF(_obj);
- }
+ if (initial_ref) Py_XINCREF(_obj);
}
PyObject_ptr & operator=(const PyObject_ptr& item)
@@ -2715,12 +2682,14 @@
#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
+#ifndef LLONG_MIN
+# define LLONG_MIN LONG_LONG_MIN
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX LONG_LONG_MAX
+#endif
+#ifndef ULLONG_MAX
+# define ULLONG_MAX ULONG_LONG_MAX
#endif
@@ -2944,11 +2913,18 @@
SWIGINTERN int
SWIG_AsVal_bool (PyObject *obj, bool *val)
{
- int r = PyObject_IsTrue(obj);
- if (r == -1)
- return SWIG_ERROR;
- if (val) *val = r ? true : false;
- return SWIG_OK;
+ if (obj == Py_True) {
+ if (val) *val = true;
+ return SWIG_OK;
+ } else if (obj == Py_False) {
+ if (val) *val = false;
+ return SWIG_OK;
+ } else {
+ long v = 0;
+ int res = SWIG_AddCast(SWIG_AsVal_long (obj, val ? &v : 0));
+ if (SWIG_IsOK(res) && val) *val = v ? true : false;
+ return res;
+ }
}
#ifdef __cplusplus
@@ -3131,7 +3107,7 @@
SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3387,7 +3363,7 @@
SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3433,7 +3409,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -3451,10 +3427,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n"
- " Possible C/C++ prototypes are:\n"
- " Stream()\n"
- " Stream(switch_stream_handle_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n Possible C/C++ prototypes are:\n Stream()\n Stream(switch_stream_handle_t *)\n");
return NULL;
}
@@ -3538,7 +3511,7 @@
SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -3831,7 +3804,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -3881,12 +3854,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n"
- " Possible C/C++ prototypes are:\n"
- " Event(char const *,char const *)\n"
- " Event(char const *)\n"
- " Event(switch_event_t *,int)\n"
- " Event(switch_event_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n Possible C/C++ prototypes are:\n Event(char const *,char const *)\n Event(char const *)\n Event(switch_event_t *,int)\n Event(switch_event_t *)\n");
return NULL;
}
@@ -3975,7 +3943,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -4003,10 +3971,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n"
- " Possible C/C++ prototypes are:\n"
- " serialize(Event *,char const *)\n"
- " serialize(Event *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n Possible C/C++ prototypes are:\n serialize(char const *)\n serialize()\n");
return NULL;
}
@@ -4078,7 +4043,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -4106,10 +4071,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
- " Possible C/C++ prototypes are:\n"
- " setPriority(Event *,switch_priority_t)\n"
- " setPriority(Event *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n Possible C/C++ prototypes are:\n setPriority(switch_priority_t)\n setPriority()\n");
return NULL;
}
@@ -4330,7 +4292,7 @@
SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -4787,7 +4749,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 2); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -4815,10 +4777,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
- " Possible C/C++ prototypes are:\n"
- " hangup(CoreSession *,char *)\n"
- " hangup(CoreSession *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n Possible C/C++ prototypes are:\n hangup(char *)\n hangup()\n");
return NULL;
}
@@ -5172,7 +5131,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 5); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5266,12 +5225,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
- " Possible C/C++ prototypes are:\n"
- " recordFile(CoreSession *,char *,int,int,int)\n"
- " recordFile(CoreSession *,char *,int,int)\n"
- " recordFile(CoreSession *,char *,int)\n"
- " recordFile(CoreSession *,char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n Possible C/C++ prototypes are:\n recordFile(char *,int,int,int)\n recordFile(char *,int,int)\n recordFile(char *,int)\n recordFile(char *)\n");
return NULL;
}
@@ -5422,7 +5376,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 4); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5470,10 +5424,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
- " Possible C/C++ prototypes are:\n"
- " originate(CoreSession *,CoreSession *,char *,int)\n"
- " originate(CoreSession *,CoreSession *,char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n Possible C/C++ prototypes are:\n originate(CoreSession *,char *,int)\n originate(CoreSession *,char *)\n");
return NULL;
}
@@ -5631,15 +5582,15 @@
SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- switch_size_t arg2 ;
+ int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
int arg5 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
@@ -5662,19 +5613,11 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_size_t, 0 | 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- } else {
- switch_size_t * temp = reinterpret_cast< switch_size_t * >(argp2);
- arg2 = *temp;
- if (SWIG_IsNewObj(res2)) delete temp;
- }
- }
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
@@ -5953,7 +5896,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 3); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -5991,10 +5934,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
- " Possible C/C++ prototypes are:\n"
- " streamFile(CoreSession *,char *,int)\n"
- " streamFile(CoreSession *,char *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n Possible C/C++ prototypes are:\n streamFile(char *,int)\n streamFile(char *)\n");
return NULL;
}
@@ -6359,7 +6299,7 @@
SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -6544,67 +6484,6 @@
}
-SWIGINTERN PyObject *_wrap_api_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:api_execute",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)api_execute(arg1,arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_api_reply_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:api_reply_delete",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- api_reply_delete(arg1);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
-
-
SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PySession *result = 0 ;
@@ -6671,7 +6550,7 @@
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
+ argc = PyObject_Length(args);
for (ii = 0; (ii < argc) && (ii < 1); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
@@ -6697,11 +6576,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n"
- " Possible C/C++ prototypes are:\n"
- " PySession()\n"
- " PySession(char *)\n"
- " PySession(switch_core_session_t *)\n");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n Possible C/C++ prototypes are:\n PySession()\n PySession(char *)\n PySession(switch_core_session_t *)\n");
return NULL;
}
@@ -6934,7 +6809,7 @@
SWIGINTERN PyObject *PySession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
@@ -7031,8 +6906,6 @@
{ (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
{ (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
{ (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
- { (char *)"api_execute", _wrap_api_execute, METH_VARARGS, NULL},
- { (char *)"api_reply_delete", _wrap_api_reply_delete, METH_VARARGS, NULL},
{ (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
{ (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
{ (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
@@ -7049,7 +6922,7 @@
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
+static void *_p_PySessionTo_p_CoreSession(void *x) {
return (void *)((CoreSession *) ((PySession *) x));
}
static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
@@ -7058,7 +6931,7 @@
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};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
@@ -7068,7 +6941,6 @@
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_size_t = {"_p_switch_size_t", "switch_size_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};
@@ -7090,7 +6962,6 @@
&_swigt__p_switch_input_args_t,
&_swigt__p_switch_input_type_t,
&_swigt__p_switch_priority_t,
- &_swigt__p_switch_size_t,
&_swigt__p_switch_status_t,
&_swigt__p_switch_stream_handle_t,
&_swigt__p_void,
@@ -7112,7 +6983,6 @@
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_size_t[] = { {&_swigt__p_switch_size_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}};
@@ -7134,7 +7004,6 @@
_swigc__p_switch_input_args_t,
_swigc__p_switch_input_type_t,
_swigc__p_switch_priority_t,
- _swigc__p_switch_size_t,
_swigc__p_switch_status_t,
_swigc__p_switch_stream_handle_t,
_swigc__p_void,
@@ -7206,7 +7075,7 @@
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found, init;
+ int found;
clientdata = clientdata;
@@ -7216,9 +7085,6 @@
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
}
/* Try and load any already created modules */
@@ -7247,12 +7113,6 @@
module_head->next = &swig_module;
}
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
1
0
02 May '08
Author: brian
Date: Thu May 1 20:24:09 2008
New Revision: 8243
Modified:
freeswitch/trunk/scripts/lua/helloworld.lua
Log:
elaborate
Modified: freeswitch/trunk/scripts/lua/helloworld.lua
==============================================================================
--- freeswitch/trunk/scripts/lua/helloworld.lua (original)
+++ freeswitch/trunk/scripts/lua/helloworld.lua Thu May 1 20:24:09 2008
@@ -1 +1,4 @@
-session:answer(); session:streamFile("blah.wav"); session:hangup();
+-- Simple answer and playback lua example
+session:answer();
+session:streamFile("blah.wav");
+session:hangup();
1
0
01 May '08
Author: greenlizard
Date: Thu May 1 19:39:53 2008
New Revision: 8242
Added:
freeswitch/trunk/scripts/lua/helloworld.lua
Log:
hello world
Added: freeswitch/trunk/scripts/lua/helloworld.lua
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/lua/helloworld.lua Thu May 1 19:39:53 2008
@@ -0,0 +1 @@
+session:answer(); session:streamFile("blah.wav"); session:hangup();
1
0
[Freeswitch-svn] [commit] r8241 - freeswitch/trunk/src/mod/languages/mod_perl
by Freeswitch SVN 01 May '08
by Freeswitch SVN 01 May '08
01 May '08
Author: anthm
Date: Thu May 1 18:56:14 2008
New Revision: 8241
Added:
freeswitch/trunk/src/mod/languages/mod_perl/hack.diff
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.h
Modified:
freeswitch/trunk/src/mod/languages/mod_perl/Makefile
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
Log:
adding callback stuff, still gotta test it
Modified: freeswitch/trunk/src/mod/languages/mod_perl/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/Makefile Thu May 1 18:56:14 2008
@@ -15,6 +15,10 @@
mod_perl_wrap.cpp:
swig -static -shadow -perl5 -c++ -DMULTIPLICITY -I../../../../src/include -o mod_perl_wrap.cpp freeswitch.i
+ echo "#include \"mod_perl_extra.c\"" >> mod_perl_wrap.cpp
+ patch -s -p0 -i hack.diff
+
+
freeswitch.$(DYNAMIC_LIB_EXTEN): $(LOCAL_OBJS) $(LOCAL_LIBADD)
$(LINK) $(SOLINK) -o freeswitch.$(DYNAMIC_LIB_EXTEN) $(LOCAL_OBJS) $(LOCAL_LIBADD) $(LDFLAGS)
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm Thu May 1 18:56:14 2008
@@ -333,6 +333,16 @@
*end_allow_threads = *freeswitchc::Session_end_allow_threads;
*check_hangup_hook = *freeswitchc::Session_check_hangup_hook;
*run_dtmf_callback = *freeswitchc::Session_run_dtmf_callback;
+*setInputCallback = *freeswitchc::Session_setInputCallback;
+*setHangupHook = *freeswitchc::Session_setHangupHook;
+*ready = *freeswitchc::Session_ready;
+*swig_cb_function_get = *freeswitchc::Session_cb_function_get;
+*swig_cb_function_set = *freeswitchc::Session_cb_function_set;
+*swig_cb_arg_get = *freeswitchc::Session_cb_arg_get;
+*swig_cb_arg_set = *freeswitchc::Session_cb_arg_set;
+*swig_hangup_func_str_get = *freeswitchc::Session_hangup_func_str_get;
+*swig_hangup_func_str_set = *freeswitchc::Session_hangup_func_str_set;
+*setPERL = *freeswitchc::Session_setPERL;
sub DISOWN {
my $self = shift;
my $ptr = tied(%$self);
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp Thu May 1 18:56:14 2008
@@ -1,85 +1,206 @@
+#include <switch.h>
#include "freeswitch_perl.h"
+#include "mod_perl_extra.h"
+
+static STRLEN n_a;
Session::Session() : CoreSession()
{
-
+ cb_function = cb_arg = hangup_func_str = NULL;
+ hh = mark = 0;
}
Session::Session(char *uuid) : CoreSession(uuid)
{
-
+ cb_function = cb_arg = hangup_func_str = NULL;
+ hh = mark = 0;
}
Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
{
-
+ cb_function = cb_arg = hangup_func_str = NULL;
+ hh = mark = 0;
}
-
-Session::~Session()
+static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
+Session::~Session()
{
-
+ switch_safe_free(cb_function);
+ switch_safe_free(cb_arg);
+ switch_safe_free(hangup_func_str);
+ switch_core_event_hook_remove_state_change(session, perl_hanguphook);
}
-
bool Session::begin_allow_threads()
{
+ do_hangup_hook();
return true;
}
bool Session::end_allow_threads()
{
+ do_hangup_hook();
return true;
}
+void Session::setPERL(PerlInterpreter *pi)
+{
+ my_perl = pi;
+}
+
+PerlInterpreter *Session::getPERL()
+{
+ if (!my_perl) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
+ }
+ return my_perl;
+}
+
+
+bool Session::ready() {
+ bool r;
+
+ sanity_check(false);
+ r = switch_channel_ready(channel) != 0;
+ do_hangup_hook();
+
+ return r;
+}
+
void Session::check_hangup_hook()
{
+ if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_RING)) {
+ hh++;
+ }
}
-switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
+void Session::do_hangup_hook()
{
- return SWITCH_STATUS_FALSE;
+ if (hh && !mark) {
+ const char *err = NULL;
+ mark++;
+ char *code;
+ if (!getPERL()) {
+ return;
+ }
+
+ code = switch_mprintf("%s(%s)", hangup_func_str, hook_state == CS_HANGUP ? "hangup" : "transfer");
+ Perl_eval_pv(my_perl, code, TRUE);
+ free(code);
+ }
}
+static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
+{
+ switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
+ CoreSession *coresession = NULL;
+ switch_channel_state_t state = switch_channel_get_state(channel);
-#if 0
-int Session::answer() {}
-int Session::preAnswer() {}
-void Session::hangup(char *cause) {}
-void Session::setVariable(char *var, char *val) {}
-const char *Session::getVariable(char *var) {}
-int Session::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) {}
-void Session::setCallerData(char *var, char *val) {}
-int Session::originate(CoreSession *a_leg_session, char *dest, int timeout) {}
-void Session::setDTMFCallback(void *cbfunc, char *funcargs) {}
-int Session::speak(char *text) {}
-void Session::set_tts_parms(char *tts_name, char *voice_name) {}
-int Session::collectDigits(int timeout) {}
-int Session::getDigits(char *dtmf_buf,
- switch_size_t buflen,
- switch_size_t maxdigits,
- char *terminators,
- char *terminator,
- int timeout) {}
-
-int Session::transfer(char *extensions, char *dialplan, char *context) {}
-int Session::playAndGetDigits(int min_digits,
- int max_digits,
- int max_tries,
- int timeout,
- char *terminators,
- char *audio_files,
- char *bad_input_audio_files,
- char *dtmf_buf,
- char *digits_regex) {}
-
-int Session::streamFile(char *file, int starting_sample_count) {}
-int Session::flushEvents() {}
-int Session::flushDigits() {}
-int Session::setAutoHangup(bool val) {}
-void Session::setHangupHook(void *hangup_func) {}
-bool Session::ready() {}
-void Session::execute(char *app, char *data) {}
-char* Session::get_uuid() {}
-const switch_input_args_t& Session::get_cb_args() {}
+ if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
+ if (coresession->hook_state != state) {
+ coresession->hook_state = state;
+ coresession->check_hangup_hook();
+ }
+ }
-#endif
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+void Session::setHangupHook(char *func) {
+
+ sanity_check_noreturn;
+
+ switch_safe_free(hangup_func_str);
+
+ if (func) {
+ hangup_func_str = strdup(func);
+ switch_channel_set_private(channel, "CoreSession", this);
+ hook_state = switch_channel_get_state(channel);
+ switch_core_event_hook_add_state_change(session, perl_hanguphook);
+ }
+}
+
+void Session::setInputCallback(char *cbfunc, char *funcargs) {
+
+ sanity_check_noreturn;
+
+ switch_safe_free(cb_function);
+ if (cbfunc) {
+ cb_function = strdup(cbfunc);
+ }
+
+ switch_safe_free(cb_arg);
+ if (funcargs) {
+ cb_arg = strdup(funcargs);
+ }
+
+ args.buf = this;
+ switch_channel_set_private(channel, "CoreSession", this);
+
+ args.input_callback = dtmf_callback;
+ ap = &args;
+}
+
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
+{
+ const char *ret;
+
+ if (!getPERL()) {
+ return SWITCH_STATUS_FALSE;;
+ }
+
+ switch (itype) {
+ case SWITCH_INPUT_TYPE_DTMF:
+ {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ char str[32] = "";
+ int arg_count = 2;
+ HV *hash;
+ SV *this_sv;
+ char *code;
+
+ if (!(hash = get_hv("__dtmf", TRUE))) {
+ abort();
+ }
+
+ str[0] = dtmf->digit;
+ this_sv = newSV(strlen(str)+1);
+ sv_setpv(this_sv, str);
+ hv_store(hash, "digit", 5, this_sv, 0);
+
+ switch_snprintf(str, sizeof(str), "%d", dtmf->duration);
+ this_sv = newSV(strlen(str)+1);
+ sv_setpv(this_sv, str);
+ hv_store(hash, "duration", 8, this_sv, 0);
+
+ if (cb_arg) {
+ //this_sv = get_sv(cb_arg, TRUE); DOH!
+ }
+
+ code = switch_mprintf("%s('dtmf', \\%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
+ Perl_eval_pv(my_perl, code, TRUE);
+ free(code);
+
+ return process_callback_result(SvPV(get_sv(cb_function, FALSE), n_a));
+ }
+ break;
+ case SWITCH_INPUT_TYPE_EVENT:
+ {
+ switch_event_t *event = (switch_event_t *) input;
+ int arg_count = 2;
+ char *code;
+
+ mod_perl_conjure_event(my_perl, event, "__Input_Event__");
+
+ code = switch_mprintf("%s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
+ Perl_eval_pv(my_perl, code, TRUE);
+ free(code);
+
+
+ return process_callback_result((char *)ret);
+ }
+ break;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h Thu May 1 18:56:14 2008
@@ -1,22 +1,48 @@
-#ifndef FREESWITCH_PYTHON_H
-#define FREESWITCH_PYTHON_H
+#ifndef FREESWITCH_LUA_H
+#define FREESWITCH_LUA_H
-#include <switch_cpp.h>
+extern "C" {
+#ifdef __ICC
+#pragma warning (disable:1419)
+#endif
+#ifdef _MSC_VER
+#include <perlibs.h>
+#pragma comment(lib, PERL_LIB)
+#endif
+
+#include <EXTERN.h>
+#include <perl.h>
+#include <switch.h>
+}
+#include <switch_cpp.h>
class Session : public CoreSession {
private:
+ virtual void do_hangup_hook();
+ PerlInterpreter *getPERL();
+ PerlInterpreter *my_perl;
+ int hh;
+ int mark;
public:
Session();
Session(char *uuid);
Session(switch_core_session_t *session);
~Session();
-
+
virtual bool begin_allow_threads();
virtual bool end_allow_threads();
virtual void check_hangup_hook();
- virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+ virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+ void setInputCallback(char *cbfunc, char *funcargs);
+ void setHangupHook(char *func);
+ bool ready();
+
+ char *cb_function;
+ char *cb_arg;
+ char *hangup_func_str;
+ void setPERL(PerlInterpreter *pi);
};
#endif
Added: freeswitch/trunk/src/mod/languages/mod_perl/hack.diff
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_perl/hack.diff Thu May 1 18:56:14 2008
@@ -0,0 +1,30 @@
+--- mod_perl_wrap.cpp 2008-05-01 18:05:28.000000000 -0400
++++ old.cpp 2008-05-01 18:05:51.000000000 -0400
+
+@@ -6293,7 +6293,7 @@
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_Session();");
+ }
+- result = (Session *)new Session();
++ result = (Session *)new Session(); result->setPERL(my_perl);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+ XSRETURN(argvi);
+ fail:
+@@ -6320,7 +6320,7 @@
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+ }
+ arg1 = reinterpret_cast< char * >(buf1);
+- result = (Session *)new Session(arg1);
++ result = (Session *)new Session(arg1); result->setPERL(my_perl);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ XSRETURN(argvi);
+@@ -6348,7 +6348,7 @@
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'");
+ }
+ arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+- result = (Session *)new Session(arg1);
++ result = (Session *)new Session(arg1); result->setPERL(my_perl);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+
+ XSRETURN(argvi);
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c Thu May 1 18:56:14 2008
@@ -56,19 +56,87 @@
char *xml_handler;
} globals;
-static int Perl_safe_eval(PerlInterpreter *my_perl, const char *string, int tf)
+
+
+static int Perl_safe_eval(PerlInterpreter *my_perl, const char *string)
{
char *err = NULL;
Perl_eval_pv(my_perl, string, FALSE);
if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%s]\n%s\n", string, err);
return -1;
}
return 0;
}
+
+
+static int perl_parse_and_execute(PerlInterpreter *my_perl, char *input_code, char *setup_code)
+{
+ int error = 0;
+
+ if (switch_strlen_zero(input_code)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
+ return -1;
+ }
+
+ if (setup_code) {
+ error = Perl_safe_eval(my_perl, setup_code);
+ if (error) {
+ return error;
+ }
+ }
+
+ if (*input_code == '~') {
+ char *buff = input_code + 1;
+ error = Perl_safe_eval(my_perl, buff);
+ } else {
+ char *args = strchr(input_code, ' ');
+ if (args) {
+ char *code = NULL;
+ int x, argc;
+ char *argv[128] = { 0 };
+ *args++ = '\0';
+
+ if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+ switch_stream_handle_t stream = { 0 };
+ SWITCH_STANDARD_STREAM(stream);
+
+ stream.write_function(&stream, " @ARGV = ( ");
+ for (x = 0; x < argc; x++) {
+ stream.write_function(&stream, "'%s'%s", argv[x], x == argc-1 ? "" : ", ");
+ }
+ stream.write_function(&stream, " );");
+ code = stream.data;
+ } else {
+ code = switch_mprintf("ARGV = ();");
+ }
+
+ if (code) {
+ error = Perl_safe_eval(my_perl, code);
+ switch_safe_free(code);
+ }
+ }
+ if (!error) {
+ char *file = input_code;
+
+ if (!switch_is_file_path(file)) {
+ file = switch_mprintf("require '%s/%s';\n", SWITCH_GLOBAL_dirs.script_dir, file);
+ switch_assert(file);
+ } else {
+ file = switch_mprintf("require '%s';\n", file);
+ switch_assert(file);
+ }
+ error = Perl_safe_eval(my_perl, file);
+ switch_safe_free(file);
+ }
+ }
+
+ return error;
+}
+
static void destroy_perl(PerlInterpreter ** to_destroy)
{
perl_destruct(*to_destroy);
@@ -83,6 +151,7 @@
return my_perl;
}
+#if 0
static perl_parse_and_execute (PerlInterpreter *my_perl, char *input_code, char *setup_code)
{
int error = 0;
@@ -90,8 +159,8 @@
if (*input_code == '~') {
char *buff = input_code + 1;
perl_parse(my_perl, xs_init, 3, embedding, NULL);
- if (setup_code) Perl_safe_eval(my_perl, setup_code, FALSE);
- Perl_safe_eval(my_perl, buff, TRUE);
+ if (setup_code) Perl_safe_eval(my_perl, setup_code);
+ Perl_safe_eval(my_perl, buff);
} else {
int argc = 0;
char *argv[128] = { 0 };
@@ -102,7 +171,7 @@
argc += switch_separate_string(input_code, ' ', &argv[1], (sizeof(argv) / sizeof(argv[0])) - 1);
if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) {
if (setup_code) {
- if (!Perl_safe_eval(my_perl, setup_code, FALSE)) {
+ if (!Perl_safe_eval(my_perl, setup_code)) {
perl_run(my_perl);
}
}
@@ -115,13 +184,17 @@
}
}
+#endif
static void perl_function(switch_core_session_t *session, char *data)
{
char *uuid = switch_core_session_get_uuid(session);
PerlInterpreter *my_perl = clone_perl();
-
char code[1024];
+
+ perl_parse(my_perl, xs_init, 3, embedding, NULL);
+ Perl_safe_eval(my_perl, code);
+
switch_snprintf(code, sizeof(code),
"use lib '%s/perl';\n"
"use freeswitch;\n"
@@ -133,15 +206,14 @@
uuid);
perl_parse_and_execute(my_perl, data, code);
- Perl_safe_eval(my_perl, "undef $session;", FALSE);
- Perl_safe_eval(my_perl, "undef (*);", FALSE);
+ Perl_safe_eval(my_perl, "undef $session;");
+ Perl_safe_eval(my_perl, "undef (*);");
destroy_perl(&my_perl);
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_perl_shutdown)
{
if (globals.my_perl) {
- perl_destruct(globals.my_perl);
perl_free(globals.my_perl);
globals.my_perl = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Unallocated perl interpreter.\n");
@@ -149,28 +221,71 @@
return SWITCH_STATUS_SUCCESS;
}
+struct perl_o {
+ switch_stream_handle_t *stream;
+ switch_core_session_t *session;
+ char *cmd;
+ int d;
+};
+
static void *SWITCH_THREAD_FUNC perl_thread_run(switch_thread_t *thread, void *obj)
{
- char *input_code = (char *) obj;
PerlInterpreter *my_perl = clone_perl();
char code[1024];
+ SV *sv = NULL;
+ char *uuid = NULL;
+ struct perl_o *po = (struct perl_o *) obj;
+ char *cmd = po->cmd;
+ switch_stream_handle_t *stream = po->stream;
+ switch_core_session_t *session = po->session;
+ if (session) {
+ uuid = switch_core_session_get_uuid(session);
+ }
+
switch_snprintf(code, sizeof(code),
- "use lib '%s/perl';\n"
- "use freeswitch;\n"
- ,
- SWITCH_GLOBAL_dirs.base_dir
- );
+ "use lib '%s/perl';\n"
+ "use freeswitch;\n"
+ "$SWITCH_ENV{UUID} = \"%s\";\n"
+ ,
+
+ SWITCH_GLOBAL_dirs.base_dir,
+ switch_str_nil(uuid)
+ );
+
+ perl_parse(my_perl, xs_init, 3, embedding, NULL);
+ Perl_safe_eval(my_perl, code);
- perl_parse_and_execute(my_perl, input_code, code);
+ if (uuid) {
+ switch_snprintf(code, sizeof(code), "$session = new freeswitch::Session(\"%s\")", uuid);
+ Perl_safe_eval(my_perl, code);
+ }
+
+ if (cmd) {
+ if (stream) {
+ mod_perl_conjure_stream(my_perl, stream, "stream");
+ if (stream->event) {
+ mod_perl_conjure_event(my_perl, stream->event, "env");
+ }
+ }
+ //Perl_safe_eval(my_perl, cmd);
+ perl_parse_and_execute(my_perl, cmd, NULL);
+ }
- if (input_code) {
- free(input_code);
+ if (uuid) {
+ switch_snprintf(code, sizeof(code), "undef $session;", uuid);
+ Perl_safe_eval(my_perl, code);
}
- Perl_safe_eval(my_perl, "undef(*);", FALSE);
+ Perl_safe_eval(my_perl, "undef(*);");
destroy_perl(&my_perl);
+ switch_safe_free(cmd);
+
+ if (po->d) {
+ free(po);
+ }
+
return NULL;
}
@@ -178,11 +293,17 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
+ struct perl_o *po;
+ po = malloc(sizeof(*po));
+ memset(po, 0, sizeof(*po));
+ po->cmd = strdup(text);
+ po->d = 1;
+
switch_threadattr_create(&thd_attr, globals.pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, perl_thread_run, strdup(text), globals.pool);
+ switch_thread_create(&thread, thd_attr, perl_thread_run, po, globals.pool);
return 0;
}
@@ -195,51 +316,11 @@
SWITCH_STANDARD_API(perl_api_function) {
- PerlInterpreter *my_perl = clone_perl();
- char code[1024];
- SV *sv = NULL;
- char *uuid = NULL;
-
- if (session) {
- uuid = switch_core_session_get_uuid(session);
- }
-
- switch_snprintf(code, sizeof(code),
- "use lib '%s/perl';\n"
- "use freeswitch;\n"
- "$SWITCH_ENV{UUID} = \"%s\";\n"
- "use IO::String;\n"
- "$handle = IO::String->new($__OUT);\n"
- "select($handle);"
- ,
-
- SWITCH_GLOBAL_dirs.base_dir,
- switch_str_nil(uuid)
- );
-
- perl_parse(my_perl, xs_init, 3, embedding, NULL);
- Perl_safe_eval(my_perl, code, FALSE);
-
- if (uuid) {
- switch_snprintf(code, sizeof(code), "$session = new freeswitch::Session(\"%s\")", uuid);
- Perl_safe_eval(my_perl, code, FALSE);
- }
-
- if (cmd) {
- Perl_safe_eval(my_perl, cmd, FALSE);
- }
-
- stream->write_function(stream, "%s", switch_str_nil(SvPV(get_sv("__OUT", FALSE), n_a)));
-
- if (uuid) {
- switch_snprintf(code, sizeof(code), "undef $session;", uuid);
- Perl_safe_eval(my_perl, code, FALSE);
- }
-
- Perl_safe_eval(my_perl, "undef(*);", FALSE);
- destroy_perl(&my_perl);
-
- return SWITCH_STATUS_SUCCESS;
+ struct perl_o po = { 0 };
+ po.cmd = strdup(cmd);
+ po.stream = stream;
+ po.session = session;
+ perl_thread_run(NULL, &po);
}
static switch_xml_t perl_fetch(const char *section,
@@ -326,7 +407,7 @@
,
SWITCH_GLOBAL_dirs.base_dir
);
- Perl_safe_eval(my_perl, code, FALSE);
+ Perl_safe_eval(my_perl, code);
perl_run(my_perl);
str = SvPV(get_sv("XML_STRING", FALSE), n_a);
Added: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.c Thu May 1 18:56:14 2008
@@ -0,0 +1,27 @@
+SWITCH_BEGIN_EXTERN_C
+
+
+void mod_perl_conjure_event(PerlInterpreter *my_perl, switch_event_t *event, const char *name)
+{
+ Event *result = 0 ;
+ SV *sv;
+ PERL_SET_CONTEXT(my_perl);
+ sv = sv_2mortal(get_sv(name, TRUE));
+ result = (Event *)new Event(event);
+ SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+}
+
+
+void mod_perl_conjure_stream(PerlInterpreter *my_perl, switch_stream_handle_t *stream, const char *name)
+{
+ Stream *result = 0 ;
+ SV *sv;
+ PERL_SET_CONTEXT(my_perl);
+ sv = sv_2mortal(get_sv(name, TRUE));
+ result = (Stream *)new Stream(stream);
+ SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
+}
+
+
+
+SWITCH_END_EXTERN_C
Added: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_extra.h Thu May 1 18:56:14 2008
@@ -0,0 +1,9 @@
+#ifndef MOD_PERL_EXTRA
+#define MOD_PERL_EXTRA
+SWITCH_BEGIN_EXTERN_C
+
+void mod_perl_conjure_event(PerlInterpreter *my_perl, switch_event_t *event, const char *name);
+void mod_perl_conjure_stream(PerlInterpreter *my_perl, switch_stream_handle_t *stream, const char *name);
+
+SWITCH_END_EXTERN_C
+#endif
Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Thu May 1 18:56:14 2008
@@ -1449,23 +1449,25 @@
#define SWIGTYPE_p_API swig_types[0]
#define SWIGTYPE_p_CoreSession swig_types[1]
#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_Session swig_types[3]
-#define SWIGTYPE_p_Stream swig_types[4]
-#define SWIGTYPE_p_char swig_types[5]
-#define SWIGTYPE_p_input_callback_state swig_types[6]
-#define SWIGTYPE_p_session_flag_t swig_types[7]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
-#define SWIGTYPE_p_switch_channel_t swig_types[9]
-#define SWIGTYPE_p_switch_core_session_t swig_types[10]
-#define SWIGTYPE_p_switch_event_t swig_types[11]
-#define SWIGTYPE_p_switch_input_args_t swig_types[12]
-#define SWIGTYPE_p_switch_input_type_t swig_types[13]
-#define SWIGTYPE_p_switch_priority_t swig_types[14]
-#define SWIGTYPE_p_switch_status_t swig_types[15]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[16]
-#define SWIGTYPE_p_void swig_types[17]
-static swig_type_info *swig_types[19];
-static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
+#define SWIGTYPE_p_PerlInterpreter swig_types[3]
+#define SWIGTYPE_p_Session 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_switch_channel_state_t swig_types[9]
+#define SWIGTYPE_p_switch_channel_t swig_types[10]
+#define SWIGTYPE_p_switch_core_session_t swig_types[11]
+#define SWIGTYPE_p_switch_event_t swig_types[12]
+#define SWIGTYPE_p_switch_input_args_t swig_types[13]
+#define SWIGTYPE_p_switch_input_type_t swig_types[14]
+#define SWIGTYPE_p_switch_priority_t swig_types[15]
+#define SWIGTYPE_p_switch_size_t swig_types[16]
+#define SWIGTYPE_p_switch_status_t swig_types[17]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
+#define SWIGTYPE_p_void swig_types[19]
+static swig_type_info *swig_types[21];
+static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -5222,15 +5224,15 @@
XS(_wrap_CoreSession_getDigits) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
+ switch_size_t arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
int arg5 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
@@ -5250,11 +5252,17 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(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 '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
+ {
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_size_t, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
+ } else {
+ arg2 = *(reinterpret_cast< switch_size_t * >(argp2));
+ }
+ }
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
@@ -5273,14 +5281,12 @@
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
XSRETURN(argvi);
fail:
-
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
@@ -6288,7 +6294,7 @@
if ((items < 0) || (items > 0)) {
SWIG_croak("Usage: new_Session();");
}
- result = (Session *)new Session();
+ result = (Session *)new Session(); result->setPERL(my_perl);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
XSRETURN(argvi);
fail:
@@ -6315,7 +6321,7 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
- result = (Session *)new Session(arg1);
+ result = (Session *)new Session(arg1); result->setPERL(my_perl);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
XSRETURN(argvi);
@@ -6343,7 +6349,7 @@
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'");
}
arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = (Session *)new Session(arg1);
+ result = (Session *)new Session(arg1); result->setPERL(my_perl);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
XSRETURN(argvi);
@@ -6586,6 +6592,374 @@
}
+XS(_wrap_Session_setInputCallback) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3"" of type '" "char *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->setInputCallback(arg2,arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_setHangupHook) {
+ {
+ Session *arg1 = (Session *) 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: Session_setHangupHook(self,func);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ (arg1)->setHangupHook(arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_ready) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ bool result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_ready(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ result = (bool)(arg1)->ready();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_cb_function_set) {
+ {
+ Session *arg1 = (Session *) 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: Session_cb_function_set(self,cb_function);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ if (arg1->cb_function) delete[] arg1->cb_function;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->cb_function = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+ } else {
+ arg1->cb_function = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_cb_function_get) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_cb_function_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ result = (char *) ((arg1)->cb_function);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_cb_arg_set) {
+ {
+ Session *arg1 = (Session *) 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: Session_cb_arg_set(self,cb_arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ if (arg1->cb_arg) delete[] arg1->cb_arg;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+ } else {
+ arg1->cb_arg = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_cb_arg_get) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_cb_arg_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ result = (char *) ((arg1)->cb_arg);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_hangup_func_str_set) {
+ {
+ Session *arg1 = (Session *) 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: Session_hangup_func_str_set(self,hangup_func_str);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_set" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ if (arg1->hangup_func_str) delete[] arg1->hangup_func_str;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->hangup_func_str = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+ } else {
+ arg1->hangup_func_str = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_hangup_func_str_get) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ char *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_hangup_func_str_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_get" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ result = (char *) ((arg1)->hangup_func_str);
+ ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_Session_setPERL) {
+ {
+ Session *arg1 = (Session *) 0 ;
+ PerlInterpreter *arg2 = (PerlInterpreter *) 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: Session_setPERL(self,pi);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Session, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1"" of type '" "Session *""'");
+ }
+ arg1 = reinterpret_cast< Session * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_PerlInterpreter, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2"" of type '" "PerlInterpreter *""'");
+ }
+ arg2 = reinterpret_cast< PerlInterpreter * >(argp2);
+ (arg1)->setPERL(arg2);
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+}
+
+
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
@@ -6595,6 +6969,7 @@
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_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)"freeswitch::Session", 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
@@ -6607,6 +6982,7 @@
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_size_t = {"_p_switch_size_t", "switch_size_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};
@@ -6615,6 +6991,7 @@
&_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
+ &_swigt__p_PerlInterpreter,
&_swigt__p_Session,
&_swigt__p_Stream,
&_swigt__p_char,
@@ -6627,6 +7004,7 @@
&_swigt__p_switch_input_args_t,
&_swigt__p_switch_input_type_t,
&_swigt__p_switch_priority_t,
+ &_swigt__p_switch_size_t,
&_swigt__p_switch_status_t,
&_swigt__p_switch_stream_handle_t,
&_swigt__p_void,
@@ -6635,6 +7013,7 @@
static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_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}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -6647,6 +7026,7 @@
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_size_t[] = { {&_swigt__p_switch_size_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}};
@@ -6655,6 +7035,7 @@
_swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
+ _swigc__p_PerlInterpreter,
_swigc__p_Session,
_swigc__p_Stream,
_swigc__p_char,
@@ -6667,6 +7048,7 @@
_swigc__p_switch_input_args_t,
_swigc__p_switch_input_type_t,
_swigc__p_switch_priority_t,
+ _swigc__p_switch_size_t,
_swigc__p_switch_status_t,
_swigc__p_switch_stream_handle_t,
_swigc__p_void,
@@ -6777,6 +7159,16 @@
{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
+{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
+{"freeswitchc::Session_ready", _wrap_Session_ready},
+{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
+{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
+{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
+{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
+{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
+{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
+{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
{0,0}
};
/* -----------------------------------------------------------------------------
@@ -7096,3 +7488,4 @@
XSRETURN(1);
}
+#include "mod_perl_extra.c"
1
0