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
- 12151 discussions
Author: anthm
Date: Thu Dec 21 15:48:09 2006
New Revision: 3786
Modified:
freeswitch/trunk/src/switch_ivr.c
Log:
expand vars
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu Dec 21 15:48:09 2006
@@ -4489,6 +4489,7 @@
int proceed = 0, ovector[30];
char substituted[1024] = "";
char *odata = NULL;
+ char *expanded = NULL;
if ((proceed = switch_perform_regex(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
for (action = switch_xml_child(input, "action"); action; action = action->next) {
@@ -4501,7 +4502,15 @@
} else {
odata = adata;
}
+
+ expanded = switch_channel_expand_variables(channel, odata);
+ if (expanded == odata) {
+ expanded = NULL;
+ } else {
+ odata = expanded;
+ }
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle %s:[%s] (%s)\n", func, odata, lang);
if (!strcasecmp(func, "play-file")) {
@@ -4556,6 +4565,7 @@
}
switch_clean_re(re);
+ switch_safe_free(expanded);
}
input = input->next;
1
0
21 Dec '06
Author: anthm
Date: Thu Dec 21 15:42:43 2006
New Revision: 3785
Modified:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
Log:
grr
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am Thu Dec 21 15:42:43 2006
@@ -93,9 +93,9 @@
# ----------------------------------------------------------------------
# Tests
-TESTS = torture_sip run_test_sip_msg run_date_test
+#TESTS = torture_sip run_test_sip_msg run_date_test
-dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
+#dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
# ----------------------------------------------------------------------
# Sofia specific rules
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in Thu Dec 21 15:42:43 2006
@@ -25,7 +25,6 @@
# ---------------------------------------------------
-
SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c torture_sip.c validator.c
srcdir = @srcdir@
@@ -53,9 +52,8 @@
target_triplet = @target@
check_PROGRAMS = torture_sip$(EXEEXT) test_sip_msg$(EXEEXT) \
validator$(EXEEXT) date_test$(EXEEXT)
-DIST_COMMON = $(dist_noinst_SCRIPTS) $(nobase_include_sofia_HEADERS) \
- $(srcdir)/../sofia.am $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/sip
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@@ -97,7 +95,6 @@
validator_LDADD = $(LDADD)
validator_DEPENDENCIES = libsip.la ../msg/libmsg.la ../bnf/libbnf.la \
../url/liburl.la ../su/libsu.la
-SCRIPTS = $(dist_noinst_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -348,11 +345,6 @@
tests/test35.txt tests/test36.txt tests/test37.txt tests/test38.txt \
tests/test39.txt tests/test40.txt tests/test41.txt tests/test42.txt
-
-# ----------------------------------------------------------------------
-# Tests
-TESTS = torture_sip run_test_sip_msg run_date_test
-dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
@@ -381,6 +373,13 @@
# ----------------------------------------------------------------------
+# Tests
+
+#TESTS = torture_sip run_test_sip_msg run_date_test
+
+#dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
+
+# ----------------------------------------------------------------------
# Sofia specific rules
MSG_PARSER_AWK = $(srcdir)/../msg/msg_parser.awk
AWK_SIP_AWK = $(AWK) -f $(MSG_PARSER_AWK) module=sip
@@ -580,79 +579,6 @@
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; \
- srcdir=$(srcdir); export srcdir; \
- list='$(TESTS)'; \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- echo "XPASS: $$tst"; \
- ;; \
- *) \
- echo "PASS: $$tst"; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
- xfail=`expr $$xfail + 1`; \
- echo "XFAIL: $$tst"; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- echo "SKIP: $$tst"; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all tests failed"; \
- else \
- banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
- fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- skipped="($$skip tests were not run)"; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- else :; fi
-
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/.. $(distdir)/images $(distdir)/sofia-sip $(distdir)/tests
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -683,10 +609,9 @@
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(include_sofiadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
@@ -770,7 +695,7 @@
uninstall-am: uninstall-info-am uninstall-nobase_include_sofiaHEADERS
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
1
0
21 Dec '06
Author: mikej
Date: Thu Dec 21 15:27:51 2006
New Revision: 3784
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
add knhor changes
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Thu Dec 21 15:27:51 2006
@@ -9,7 +9,7 @@
* 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,
+ * 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.
@@ -48,14 +48,14 @@
#define CONF_CHAT_PROTO "conf"
#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
+#define MIN(a, b) ((a)<(b)?(a):(b))
#endif
/* this doesn't work correctly yet, don't bother trying! */
//#define OPTION_IVR_MENU_SUPPORT */
typedef enum {
- FILE_STOP_CURRENT,
+ FILE_STOP_CURRENT,
FILE_STOP_ALL
} file_stop_t;
@@ -72,20 +72,20 @@
} globals;
typedef enum {
- CALLER_CONTROL_MUTE,
- CALLER_CONTROL_DEAF_MUTE,
- CALLER_CONTROL_ENERGY_UP,
- CALLER_CONTROL_ENERGY_EQU_CONF,
- CALLER_CONTROL_ENERGEY_DN,
- CALLER_CONTROL_VOL_TALK_UP,
- CALLER_CONTROL_VOL_TALK_ZERO,
- CALLER_CONTROL_VOL_TALK_DN,
- CALLER_CONTROL_VOL_LISTEN_UP,
- CALLER_CONTROL_VOL_LISTEN_ZERO,
- CALLER_CONTROL_VOL_LISTEN_DN,
- CALLER_CONTROL_HANGUP,
- CALLER_CONTROL_MENU,
- CALLER_CONTROL_DIAL,
+ CALLER_CONTROL_MUTE,
+ CALLER_CONTROL_DEAF_MUTE,
+ CALLER_CONTROL_ENERGY_UP,
+ CALLER_CONTROL_ENERGY_EQU_CONF,
+ CALLER_CONTROL_ENERGEY_DN,
+ CALLER_CONTROL_VOL_TALK_UP,
+ CALLER_CONTROL_VOL_TALK_ZERO,
+ CALLER_CONTROL_VOL_TALK_DN,
+ CALLER_CONTROL_VOL_LISTEN_UP,
+ CALLER_CONTROL_VOL_LISTEN_ZERO,
+ CALLER_CONTROL_VOL_LISTEN_DN,
+ CALLER_CONTROL_HANGUP,
+ CALLER_CONTROL_MENU,
+ CALLER_CONTROL_DIAL,
} caller_control_t;
/* forward declaration for conference_obj and caller_control */
@@ -110,30 +110,30 @@
} caller_control_menu_info_t;
typedef enum {
- MFLAG_RUNNING = (1 << 0),
- MFLAG_CAN_SPEAK = (1 << 1),
- MFLAG_CAN_HEAR = (1 << 2),
- MFLAG_KICKED = (1 << 3),
- MFLAG_ITHREAD = (1 << 4),
+ MFLAG_RUNNING = (1 << 0),
+ MFLAG_CAN_SPEAK = (1 << 1),
+ MFLAG_CAN_HEAR = (1 << 2),
+ MFLAG_KICKED = (1 << 3),
+ MFLAG_ITHREAD = (1 << 4),
MFLAG_NOCHANNEL = (1 << 5)
} member_flag_t;
typedef enum {
- CFLAG_RUNNING = (1 << 0),
- CFLAG_DYNAMIC = (1 << 1),
- CFLAG_ENFORCE_MIN = (1 << 2),
- CFLAG_DESTRUCT = (1 << 3),
- CFLAG_LOCKED = (1 << 4),
+ CFLAG_RUNNING = (1 << 0),
+ CFLAG_DYNAMIC = (1 << 1),
+ CFLAG_ENFORCE_MIN = (1 << 2),
+ CFLAG_DESTRUCT = (1 << 3),
+ CFLAG_LOCKED = (1 << 4),
CFLAG_ANSWERED = (1 << 5)
} conf_flag_t;
typedef enum {
- RFLAG_CAN_SPEAK = (1 << 0),
+ RFLAG_CAN_SPEAK = (1 << 0),
RFLAG_CAN_HEAR = (1 << 1)
} relation_flag_t;
typedef enum {
- NODE_TYPE_FILE,
+ NODE_TYPE_FILE,
NODE_TYPE_SPEECH
} node_type_t;
@@ -147,6 +147,15 @@
struct conference_file_node *next;
} conference_file_node_t;
+/* conference xml config sections */
+typedef struct conf_xml_cfg {
+ switch_xml_t profile;
+ switch_xml_t controls;
+#ifdef OPTION_IVR_MENU_SUPPORT
+ switch_xml_t menus;
+#endif
+} conf_xml_cfg_t;
+
/* Conference Object */
typedef struct conference_obj {
char *name;
@@ -223,6 +232,7 @@
switch_audio_resampler_t *read_resampler;
conference_file_node_t *fnode;
conference_relationship_t *relationships;
+ switch_ivr_digit_stream_t *digit_stream;
struct conference_member *next;
};
@@ -233,57 +243,75 @@
switch_memory_pool_t *pool;
} conference_record_t;
+typedef enum {
+ CONF_API_SUB_ARGS_SPLIT,
+ CONF_API_SUB_MEMBER_TARGET,
+ CONF_API_SUB_ARGS_AS_ONE
+} conference_fntype_t;
+
/* API command parser */
typedef struct api_command {
char *pname;
void *pfnapicmd;
- int fntype;
+ conference_fntype_t fntype;
char *psyntax;
} api_command_t;
+
/* Function Prototypes */
static uint32_t next_member_id(void);
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id);
static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id);
-static void member_del_relationship(conference_member_t *member, uint32_t id);
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id);
static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member);
-static void conference_del_member(conference_obj_t *conference, conference_member_t *member);
+static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member);
static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj);
-static void conference_loop(conference_member_t *member);
+static void conference_loop_output(conference_member_t *member);
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel);
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin);
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin);
static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
-static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
+static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
-static switch_status_t conference_outcall(conference_obj_t *conference,
- switch_core_session_t *session,
- char *bridgeto,
- uint32_t timeout,
- char *flags,
- char *cid_name,
+static switch_status_t conference_outcall(conference_obj_t *conference,
+ switch_core_session_t *session,
+ char *bridgeto,
+ uint32_t timeout,
+ char *flags,
+ char *cid_name,
char *cid_num);
static void conference_function(switch_core_session_t *session, char *data);
static void launch_conference_thread(conference_obj_t *conference);
-static void *SWITCH_THREAD_FUNC input_thread_run(switch_thread_t *thread, void *obj);
-static void launch_input_thread(conference_member_t *member, switch_memory_pool_t *pool);
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len);
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
-static switch_status_t conference_member_say(conference_obj_t *conference, conference_member_t *member, char *text, uint32_t leadin);
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
-static conference_obj_t *conference_new(char *name, switch_xml_t profile, switch_memory_pool_t *pool);
+static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
static void launch_conference_record_thread(conference_obj_t *conference, char *path);
-typedef int (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
-typedef int (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
-typedef int (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, char*);
+typedef switch_status_t (*conf_api_args_cmd_t)(conference_obj_t*, switch_stream_handle_t*, int, char**);
+typedef switch_status_t (*conf_api_member_cmd_t)(conference_member_t*, switch_stream_handle_t*, void*);
+typedef switch_status_t (*conf_api_text_cmd_t)(conference_obj_t*, switch_stream_handle_t*, const char*);
-static void conference_member_itterator(conference_obj_t *conference,
- switch_stream_handle_t *stream,
- int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
+static void conference_member_itterator(conference_obj_t *conference,
+ switch_stream_handle_t *stream,
+ conf_api_member_cmd_t pfncallback,
void *data);
+static switch_status_t conf_api_sub_mute(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_unmute(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_deaf(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member,
+ switch_stream_handle_t *stream,
+ void *data);
/* Return a Distinct ID # */
static uint32_t next_member_id(void)
@@ -300,31 +328,35 @@
/* if other_member has a relationship with member, produce it */
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member)
{
- conference_relationship_t *rel = NULL, *global = NULL;
+ conference_relationship_t *rel = NULL;
- switch_mutex_lock(member->flag_mutex);
- switch_mutex_lock(other_member->flag_mutex);
+ if (member != NULL && other_member != NULL) {
+ conference_relationship_t *global = NULL;
- if (member->relationships) {
- for (rel = member->relationships; rel; rel = rel->next) {
- if (rel->id == other_member->id) {
- break;
- }
+ switch_mutex_lock(member->flag_mutex);
+ switch_mutex_lock(other_member->flag_mutex);
- /* 0 matches everyone.
- (We will still test the others brcause a real match carries more clout) */
+ if (member->relationships) {
+ for (rel = member->relationships; rel; rel = rel->next) {
+ if (rel->id == other_member->id) {
+ break;
+ }
- if (rel->id == 0) {
- global = rel;
+ /* 0 matches everyone.
+ (We will still test the others brcause a real match carries more clout) */
+
+ if (rel->id == 0) {
+ global = rel;
+ }
}
}
- }
- switch_mutex_unlock(other_member->flag_mutex);
- switch_mutex_unlock(member->flag_mutex);
+ switch_mutex_unlock(other_member->flag_mutex);
+ switch_mutex_unlock(member->flag_mutex);
- if (!rel && global) {
- rel = global;
+ if (!rel && global) {
+ rel = global;
+ }
}
return rel;
@@ -335,33 +367,39 @@
{
conference_member_t *member = NULL;
- for(member = conference->members; member; member = member->next) {
+ assert(conference != NULL);
+ assert(id != 0);
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- continue;
- }
+ for(member = conference->members; member; member = member->next) {
+
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ continue;
+ }
+
+ if (member->id == id) {
+ break;
+ }
+ }
+
- if (member->id == id) {
- break;
- }
- }
-
return member;
}
/* stop the specified recording */
-static int conference_record_stop(conference_obj_t *conference, char *path)
+static switch_status_t conference_record_stop(conference_obj_t *conference, char *path)
{
conference_member_t *member = NULL;
int count = 0;
- for(member = conference->members; member; member = member->next) {
- if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
- switch_clear_flag_locked(member, MFLAG_RUNNING);
- count++;
- }
- }
+ assert (conference != NULL);
+ for(member = conference->members; member; member = member->next) {
+ if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
+ switch_clear_flag_locked(member, MFLAG_RUNNING);
+ count++;
+ }
+ }
+
return count;
}
@@ -370,7 +408,7 @@
{
conference_relationship_t *rel = NULL;
- if ((rel = switch_core_alloc(member->pool, sizeof(*rel)))) {
+ if (member != NULL && id != 0 && (rel = switch_core_alloc(member->pool, sizeof(*rel)))) {
rel->id = id;
switch_mutex_lock(member->flag_mutex);
@@ -383,114 +421,133 @@
}
/* Remove a custom relationship from a member */
-static void member_del_relationship(conference_member_t *member, uint32_t id)
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id)
{
+ switch_status_t status = SWITCH_STATUS_FALSE;
conference_relationship_t *rel, *last = NULL;
- switch_mutex_lock(member->flag_mutex);
- for (rel = member->relationships; rel; rel = rel->next) {
- if (rel->id == id) {
- /* we just forget about rel here cos it was allocated by the member's pool
- it will be freed when the member is */
- if (last) {
- last->next = rel->next;
- } else {
- member->relationships = rel->next;
+ if (member != NULL && id != 0) {
+ switch_mutex_lock(member->flag_mutex);
+ for (rel = member->relationships; rel; rel = rel->next) {
+ if (rel->id == id) {
+ /* we just forget about rel here cos it was allocated by the member's pool
+ it will be freed when the member is */
+ status = SWITCH_STATUS_SUCCESS;
+ if (last) {
+ last->next = rel->next;
+ } else {
+ member->relationships = rel->next;
+ }
}
+ last = rel;
}
- last = rel;
+ switch_mutex_unlock(member->flag_mutex);
}
- switch_mutex_unlock(member->flag_mutex);
+
+ return status;
}
/* Gain exclusive access and add the member to the list */
static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member)
{
- switch_event_t *event;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_event_t *event;
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- switch_mutex_lock(member->audio_in_mutex);
- switch_mutex_lock(member->audio_out_mutex);
- switch_mutex_lock(member->flag_mutex);
- member->conference = member->last_conference = conference;
- member->next = conference->members;
- member->energy_level = conference->energy_level;
- conference->members = member;
+ assert(conference != NULL);
+ assert(member != NULL);
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ switch_mutex_lock(member->audio_in_mutex);
+ switch_mutex_lock(member->audio_out_mutex);
+ switch_mutex_lock(member->flag_mutex);
+ member->conference = member->last_conference = conference;
+ member->next = conference->members;
+ member->energy_level = conference->energy_level;
+ conference->members = member;
- if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
- conference->count++;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
+ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ conference->count++;
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
- if (conference->enter_sound) {
- conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
- }
- if (conference->count == 1 && conference->alone_sound) {
- conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
- }
+ if (conference->enter_sound) {
+ conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session));
+ }
- if (conference->min && conference->count >= conference->min) {
- switch_set_flag(conference, CFLAG_ENFORCE_MIN);
- }
+ if (conference->count == 1 && conference->alone_sound) {
+ conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (conference->min && conference->count >= conference->min) {
+ switch_set_flag(conference, CFLAG_ENFORCE_MIN);
+ }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
- switch_event_fire(&event);
- }
- }
- switch_mutex_unlock(member->flag_mutex);
- switch_mutex_unlock(member->audio_out_mutex);
- switch_mutex_unlock(member->audio_in_mutex);
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- return SWITCH_STATUS_SUCCESS;
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
+ switch_event_fire(&event);
+ }
+ }
+ switch_mutex_unlock(member->flag_mutex);
+ switch_mutex_unlock(member->audio_out_mutex);
+ switch_mutex_unlock(member->audio_in_mutex);
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ status = SWITCH_STATUS_SUCCESS;
+
+
+ return status;
}
/* Gain exclusive access and remove the member from the list */
-static void conference_del_member(conference_obj_t *conference, conference_member_t *member)
+static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member)
{
- conference_member_t *imember, *last = NULL;
- switch_event_t *event;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ conference_member_t *imember, *last = NULL;
+ switch_event_t *event;
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- switch_mutex_lock(member->audio_in_mutex);
- switch_mutex_lock(member->audio_out_mutex);
- switch_mutex_lock(member->flag_mutex);
+ assert(conference != NULL);
+ assert(member != NULL);
+
- for (imember = conference->members; imember; imember = imember->next) {
- if (imember == member) {
- if (last) {
- last->next = imember->next;
- } else {
- conference->members = imember->next;
- }
- break;
- }
- last = imember;
- }
- if (member->fnode) { /* Close Unused Handles */
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ switch_mutex_lock(member->audio_in_mutex);
+ switch_mutex_lock(member->audio_out_mutex);
+ switch_mutex_lock(member->flag_mutex);
+
+ for (imember = conference->members; imember; imember = imember->next) {
+ if (imember == member ) {
+ if (last) {
+ last->next = imember->next;
+ } else {
+ conference->members = imember->next;
+ }
+ break;
+ }
+ last = imember;
+ }
+
+ /* Close Unused Handles */
+ if (member->fnode) {
conference_file_node_t *fnode, *cur;
switch_memory_pool_t *pool;
-
+
fnode = member->fnode;
while(fnode) {
cur = fnode;
@@ -502,55 +559,57 @@
} else {
switch_core_file_close(&cur->fh);
}
-
+
pool = cur->pool;
switch_core_destroy_memory_pool(&pool);
}
-
- member->fnode = NULL;
}
- member->conference = NULL;
+ member->conference = NULL;
- if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
- conference->count--;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
+ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ conference->count--;
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
- if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
- || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
- switch_set_flag(conference, CFLAG_DESTRUCT);
- } else {
- if (conference->exit_sound) {
- conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
- }
- if (conference->count == 1 && conference->alone_sound) {
- conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
- }
- }
+ if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
+ || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
+ switch_set_flag(conference, CFLAG_DESTRUCT);
+ } else {
+ if (conference->exit_sound) {
+ conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session));
+ }
+ if (conference->count == 1 && conference->alone_sound) {
+ conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session));
+ }
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
- switch_event_fire(&event);
- }
- }
- switch_mutex_unlock(member->flag_mutex);
- switch_mutex_unlock(member->audio_out_mutex);
- switch_mutex_unlock(member->audio_in_mutex);
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
+ switch_event_fire(&event);
+ }
+ }
+ switch_mutex_unlock(member->flag_mutex);
+ switch_mutex_unlock(member->audio_out_mutex);
+ switch_mutex_unlock(member->audio_in_mutex);
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ status = SWITCH_STATUS_SUCCESS;
+
+
+ return status;
}
/* Main monitor thread (1 per distinct conference room) */
@@ -609,9 +668,9 @@
int len = (int) imember->read;
imember->mux_resampler->from_len = switch_short_to_float(bptr, imember->mux_resampler->from, (int) len / 2);
- imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
- imember->mux_resampler->from_len, imember->mux_resampler->to,
- imember->mux_resampler->to_size, 0);
+ imember->mux_resampler->to_len = switch_resample_process(imember->mux_resampler, imember->mux_resampler->from,
+ imember->mux_resampler->from_len, imember->mux_resampler->to,
+ imember->mux_resampler->to_size, 0);
switch_float_to_short(imember->mux_resampler->to, out, len);
len = imember->mux_resampler->to_len * 2;
switch_buffer_write(imember->resample_buffer, out, len);
@@ -637,10 +696,10 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = conference->rate;
- if (switch_core_speech_read_tts(&conference->fnode->sh,
- file_frame,
- &file_data_len,
- &rate,
+ if (switch_core_speech_read_tts(&conference->fnode->sh,
+ file_frame,
+ &file_data_len,
+ &rate,
&flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
@@ -748,8 +807,6 @@
switch_mutex_unlock(conference->mutex);
} /* Rinse ... Repeat */
-
-
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
@@ -761,34 +818,34 @@
switch_event_fire(&event);
}
-
switch_core_timer_destroy(&timer);
if (switch_test_flag(conference, CFLAG_DESTRUCT)) {
switch_mutex_lock(conference->mutex);
- if (conference->fnode) { /* Close Unused Handles */
- conference_file_node_t *fnode, *cur;
- switch_memory_pool_t *pool;
+ /* Close Unused Handles */
+ if (conference->fnode) {
+ conference_file_node_t *fnode, *cur;
+ switch_memory_pool_t *pool;
- fnode = conference->fnode;
- while (fnode) {
- cur = fnode;
- fnode = fnode->next;
+ fnode = conference->fnode;
+ while (fnode) {
+ cur = fnode;
+ fnode = fnode->next;
- if (cur->type == NODE_TYPE_SPEECH) {
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- switch_core_speech_close(&cur->sh, &flags);
- } else {
- switch_core_file_close(&cur->fh);
- }
+ if (cur->type == NODE_TYPE_SPEECH) {
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_core_speech_close(&cur->sh, &flags);
+ } else {
+ switch_core_file_close(&cur->fh);
+ }
- pool = cur->pool;
- switch_core_destroy_memory_pool(&pool);
- }
- conference->fnode = NULL;
- }
+ pool = cur->pool;
+ switch_core_destroy_memory_pool(&pool);
+ }
+ conference->fnode = NULL;
+ }
for(imember = conference->members; imember; imember = imember->next) {
switch_channel_t *channel;
@@ -822,7 +879,9 @@
switch_thread_rwlock_unlock(conference->rwlock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n");
- if (conference->pool) {
+ switch_ivr_digit_stream_parser_destroy(conference->dtmf_parser);
+
+ if (conference->pool) {
switch_memory_pool_t *pool = conference->pool;
switch_core_destroy_memory_pool(&pool);
}
@@ -835,10 +894,502 @@
return NULL;
}
-/* Sub-Routine called by a channel inside a conference */
-static void conference_loop(conference_member_t *member)
+static void conference_loop_fn_mute_toggle(conference_member_t *member, void *data)
{
+ if (member != NULL) {
+ if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+ conf_api_sub_mute(member, NULL, NULL);
+ } else {
+ conf_api_sub_unmute(member, NULL, NULL);
+ }
+ }
+}
+
+static void conference_loop_fn_deafmute_toggle(conference_member_t *member, void *data)
+{
+ if (member != NULL) {
+ if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+ conf_api_sub_mute(member, NULL, NULL);
+ conf_api_sub_deaf(member, NULL, NULL);
+ } else {
+ conf_api_sub_unmute(member, NULL, NULL);
+ conf_api_sub_undeaf(member, NULL, NULL);
+ }
+ }
+}
+
+static void conference_loop_fn_energy_up(conference_member_t *member, void *data)
+{
+ if (member != NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level += 200;
+ if (member->energy_level > 3000) {
+ member->energy_level = 3000;
+ }
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_energy_equ_conf(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = member->conference->energy_level;
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_energy_dn(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level -= 100;
+ if (member->energy_level < 0) {
+ member->energy_level = 0;
+ }
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_talk_up(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level++;
+ switch_normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_talk_zero(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level = 0;
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_talk_dn(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level--;
+ switch_normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_listen_up(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level++;
+ switch_normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_listen_zero(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level = 0;
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_volume_listen_dn(conference_member_t *member, void *data)
+{
+ if (member!= NULL) {
+ char msg[512];
+ switch_event_t *event;
+
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level--;
+ switch_normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+
+ snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+ conference_member_say(member, msg, 0);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
+ switch_event_fire(&event);
+ }
+ }
+}
+
+static void conference_loop_fn_hangup(conference_member_t *member, void *data)
+{
+ switch_clear_flag_locked(member, MFLAG_RUNNING);
+}
+
+#ifdef OPTION_IVR_MENU_SUPPORT
+typedef struct caller_control_menu_ctx {
+ switch_ivr_menu_xml_ctx_t *xml_ctx;
+ switch_ivr_menu_t *menu_stack;
+ char *name;
+} caller_control_menu_ctx_t;
+
+static void conference_loop_fn_menu(conference_member_t *member, void *data)
+{
+ if (member != NULL && data != NULL) {
+ caller_control_menu_ctx_t *menu_ctx = (caller_control_menu_ctx_t *)data;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference_loop_fn_menu handler '%s'\n", menu_ctx->name);
+ if (menu_ctx->menu_stack != NULL && menu_ctx->xml_ctx != NULL) {
+ switch_ivr_menu_execute(member->session, menu_ctx->menu_stack, menu_ctx->name, member);
+ } else {
+ if (menu_ctx->menu_stack == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL menu_stack\n");
+ if (menu_ctx->xml_ctx == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_loop_fn_menu handler NULL xml_ctx\n");
+ }
+ }
+}
+#endif
+
+static void conference_loop_fn_dial(conference_member_t *member, void *data)
+{
+ if (member != NULL && data != NULL) {
+ char *lbuf = strdup(data);
+ char *argv[4];
+ int argc = 0;
+
+ if (lbuf != NULL) {
+ memset(argv, 0, sizeof(argv));
+ argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dial argc %u 1 '%s' 2 '%s' 3 '%s' 4 '%s'\n",
+ argc, argv[0], argv[1], argv[2], argv[3]);
+ if (argc >= 4) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "executing conference outcall\n");
+ conference_outcall(member->conference, NULL, argv[0], atoi(argv[1]), NULL, argv[3], argv[2]);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference outcall not executed\n");
+ }
+
+ free(lbuf);
+ }
+ }
+}
+
+
+/* marshall frames from the call leg to the conference thread for muxing to other call legs */
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
+{
+ conference_member_t *member = obj;
switch_channel_t *channel;
+ switch_status_t status;
+ switch_frame_t *read_frame = NULL;
+ switch_codec_t *read_codec;
+ uint32_t hangover = 40,
+ hangunder = 15,
+ hangover_hits = 0,
+ hangunder_hits = 0,
+ energy_level = 0,
+ diff_level = 400;
+ uint8_t talking = 0;
+
+ assert(member != NULL);
+
+ channel = switch_core_session_get_channel(member->session);
+ assert(channel != NULL);
+
+ read_codec = switch_core_session_get_read_codec(member->session);
+ assert(read_codec != NULL);
+
+ /* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it
+ and mux it with any audio from other channels. */
+
+ while(switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
+ /* Read a frame. */
+ status = switch_core_session_read_frame(member->session, &read_frame, -1, 0);
+
+ /* end the loop, if appropriate */
+ if (!SWITCH_READ_ACCEPTABLE(status) || !switch_test_flag(member, MFLAG_RUNNING)) {
+ break;
+ }
+
+ if (switch_test_flag(read_frame, SFF_CNG)) {
+ continue;
+ }
+
+ energy_level = member->energy_level;
+
+ /* if the member can speak, compute the audio energy level and */
+ /* generate events when the level crosses the threshold */
+ if (switch_test_flag(member, MFLAG_CAN_SPEAK) && energy_level) {
+ uint32_t energy = 0, i = 0, samples = 0, j = 0, score = 0;
+ int16_t *data;
+
+ data = read_frame->data;
+ if ((samples = read_frame->datalen / sizeof(*data))) {
+
+ for (i = 0; i < samples; i++) {
+ energy += abs(data[j]);
+ j += read_codec->implementation->number_of_channels;
+ }
+ score = energy / samples;
+ }
+
+ if (score > energy_level) {
+ uint32_t diff = score - energy_level;
+ if (hangover_hits) {
+ hangover_hits--;
+ }
+
+ if (diff >= diff_level || ++hangunder_hits >= hangunder) {
+ hangover_hits = hangunder_hits = 0;
+
+ if (!talking) {
+ switch_event_t *event;
+ talking = 1;
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
+ switch_event_fire(&event);
+ }
+ }
+ }
+ } else {
+ if (hangunder_hits) {
+ hangunder_hits--;
+ }
+ if (talking) {
+ switch_event_t *event;
+ if (++hangover_hits >= hangover) {
+ hangover_hits = hangunder_hits = 0;
+ talking = 0;
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "stop-talking");
+ switch_event_fire(&event);
+ }
+ }
+ }
+ }
+ }
+
+ /* skip frames that are not actual media or when we are muted or silent */
+ if ((talking || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+ if (member->read_resampler) {
+ int16_t *bptr = (int16_t *) read_frame->data;
+ int len = (int) read_frame->datalen;;
+
+ member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
+ member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
+ member->read_resampler->from_len, member->read_resampler->to,
+ member->read_resampler->to_size, 0);
+ switch_float_to_short(member->read_resampler->to, read_frame->data, len);
+ len = member->read_resampler->to_len * 2;
+ read_frame->datalen = len;
+ read_frame->samples = len / 2;
+ }
+ /* Check for input volume adjustments */
+ if (member->volume_in_level) {
+ switch_change_sln_volume(read_frame->data, read_frame->datalen / 2, member->volume_in_level);
+ }
+
+ /* Write the audio into the input buffer */
+ switch_mutex_lock(member->audio_in_mutex);
+ switch_buffer_write(member->audio_buffer, read_frame->data, read_frame->datalen);
+ switch_mutex_unlock(member->audio_in_mutex);
+ }
+ }
+
+ switch_clear_flag_locked(member, MFLAG_ITHREAD);
+
+ return NULL;
+}
+
+/* launch an input thread for the call leg */
+static void launch_conference_loop_input(conference_member_t *member, switch_memory_pool_t *pool)
+{
+ if (member != NULL) {
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+
+ switch_threadattr_create(&thd_attr, pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_set_flag_locked(member, MFLAG_ITHREAD);
+ switch_thread_create(&thread, thd_attr, conference_loop_input, member, pool);
+ }
+}
+
+static caller_control_fn_table_t ccfntbl[] = {
+ {"mute", "0", CALLER_CONTROL_MUTE, conference_loop_fn_mute_toggle},
+ {"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle},
+ {"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up},
+ {"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf},
+ {"energy dn", "7", CALLER_CONTROL_ENERGEY_DN, conference_loop_fn_energy_dn},
+ {"vol talk up", "3", CALLER_CONTROL_VOL_TALK_UP, conference_loop_fn_volume_talk_up},
+ {"vol talk zero", "2", CALLER_CONTROL_VOL_TALK_ZERO, conference_loop_fn_volume_talk_zero},
+ {"vol talk dn", "1", CALLER_CONTROL_VOL_TALK_DN, conference_loop_fn_volume_talk_dn},
+ {"vol listen up", "6", CALLER_CONTROL_VOL_LISTEN_UP, conference_loop_fn_volume_listen_up},
+ {"vol listen zero", "5", CALLER_CONTROL_VOL_LISTEN_ZERO, conference_loop_fn_volume_listen_zero},
+ {"vol listen dn", "4", CALLER_CONTROL_VOL_LISTEN_DN, conference_loop_fn_volume_listen_dn},
+ {"hangup", "#", CALLER_CONTROL_HANGUP, conference_loop_fn_hangup},
+#ifdef OPTION_IVR_MENU_SUPPORT
+ {"menu", NULL, CALLER_CONTROL_MENU, conference_loop_fn_menu},
+#endif
+ {"dial", NULL, CALLER_CONTROL_DIAL, conference_loop_fn_dial},
+};
+#define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
+
+/* marshall frames from the conference (or file or tts output) to the call leg */
+/* NB. this starts the input thread after some initial setup for the call leg */
+static void conference_loop_output(conference_member_t *member)
+{
+ switch_channel_t *channel;
switch_frame_t write_frame = {0};
uint8_t data[SWITCH_RECCOMMENDED_BUFFER_SIZE];
switch_timer_t timer = {0};
@@ -851,10 +1402,10 @@
assert(channel != NULL);
assert(member->conference != NULL);
- if (switch_core_timer_init(&timer,
- member->conference->timer_name,
- member->conference->interval,
- samples,
+ if (switch_core_timer_init(&timer,
+ member->conference->timer_name,
+ member->conference->interval,
+ samples,
NULL) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer %s success interval: %u samples: %u\n",
member->conference->timer_name, member->conference->interval, samples);
@@ -871,10 +1422,15 @@
switch_channel_answer(channel);
}
- /* Start a thread to read data and feed it into the buffer and use this thread to generate output */
- launch_input_thread(member, switch_core_session_get_pool(member->session));
+ /* Start the input thread */
+ launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
- /* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
+ /* build a digit stream object */
+ if (member->conference->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n");
+ }
+
+ /* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
/* you better not block this thread loop for more than the duration of member->conference->timer_name! */
while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) {
char dtmf[128] = "";
@@ -882,8 +1438,8 @@
switch_size_t file_data_len = samples * 2;
switch_size_t file_sample_len = samples;
char *digit;
- char msg[512];
switch_event_t *event;
+ caller_control_action_t *caller_action = NULL;
if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
char *from = switch_event_get_header(event, "from");
@@ -922,246 +1478,41 @@
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
- for (digit = dtmf; *digit; digit++) {
- switch(*digit) {
- case '0':
- {
- char *action = "mute-member";
+ if (member->conference->dtmf_parser != NULL) {
- if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- switch_clear_flag_locked(member, MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR);
- if (member->conference->muted_sound) {
- conference_member_play_file(member, member->conference->muted_sound, 0);
- } else {
- snprintf(msg, sizeof(msg), "Muted");
- conference_member_say(member->conference, member, msg, 0);
- }
- } else {
- action = "unmute-member";
- switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
- if (member->conference->unmuted_sound) {
- conference_member_play_file(member, member->conference->unmuted_sound, 0);
- } else {
- snprintf(msg, sizeof(msg), "Un-Muted");
- conference_member_say(member->conference, member, msg, 0);
- }
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", action);
- switch_event_fire(&event);
- }
- }
- break;
- case '*':
- {
- char *action = "mute-deaf-member";
- if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- switch_clear_flag_locked(member, MFLAG_CAN_SPEAK|MFLAG_CAN_HEAR);
- if (member->conference->muted_sound) {
- conference_member_play_file(member, member->conference->muted_sound, 0);
- } else {
- snprintf(msg, sizeof(msg), "Muted");
- conference_member_say(member->conference, member, msg, 0);
- }
- } else {
- action = "unmute-deaf-member";
- switch_set_flag_locked(member, MFLAG_CAN_SPEAK|MFLAG_CAN_HEAR);
- if (member->conference->unmuted_sound) {
- conference_member_play_file(member, member->conference->unmuted_sound, 0);
- } else {
- snprintf(msg, sizeof(msg), "UN-Muted");
- conference_member_say(member->conference, member, msg, 0);
- }
- }
+ for (digit = dtmf; *digit && caller_action == NULL; digit++) {
+ caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit);
+ }
+ }
+ /* otherwise, clock the parser so that it can handle digit timeout detection */
+ } else if (member->conference->dtmf_parser != NULL) {
+ caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0');
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", action);
- switch_event_fire(&event);
- }
- }
+ /* if a caller action has been detected, handle it */
+ if (caller_action != NULL && caller_action->fndesc != NULL && caller_action->fndesc->handler != NULL) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_caller_profile_t *profile = switch_channel_get_caller_profile(channel);
+ char *param = NULL;
- break;
- case '9':
- switch_mutex_lock(member->flag_mutex);
- member->energy_level += 200;
- if (member->energy_level > 3000) {
- member->energy_level = 3000;
- }
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
- conference_member_say(member->conference, member, msg, 0);
+ if (caller_action->fndesc->action != CALLER_CONTROL_MENU) {
+ param = caller_action->data;
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
- switch_event_fire(&event);
- }
- break;
- case '8':
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = member->conference->energy_level;
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
- switch_event_fire(&event);
- }
- break;
- case '7':
- switch_mutex_lock(member->flag_mutex);
- member->energy_level -= 100;
- if (member->energy_level < 0) {
- member->energy_level = 0;
- }
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level");
- switch_event_fire(&event);
- }
- break;
- case '3':
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level++;
- switch_normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
- switch_event_fire(&event);
- }
- break;
- case '2':
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level = 0;
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
- switch_event_fire(&event);
- }
- break;
- case '1':
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level--;
- switch_normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-level");
- switch_event_fire(&event);
- }
- break;
- case '6':
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level++;
- switch_normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
- switch_event_fire(&event);
- }
- break;
- case '5':
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level = 0;
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
- switch_event_fire(&event);
- }
- break;
- case '4':
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level--;
- switch_normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
- conference_member_say(member->conference, member, msg, 0);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "gain-level");
- switch_event_fire(&event);
- }
- break;
- case '#':
- switch_clear_flag_locked(member, MFLAG_RUNNING);
- break;
- default:
- break;
- }
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG,
+ SWITCH_LOG_INFO,
+ "executing caller control '%s' param '%s' on call '%u, %s, %s, %s'\n",
+ caller_action->fndesc->key,
+ param ? param : "none",
+ member->id,
+ switch_channel_get_name(channel),
+ profile->caller_id_name,
+ profile->caller_id_number
+ );
+ caller_action->fndesc->handler(member, caller_action->data);
+
+ /* set up for next pass */
+ caller_action = NULL;
}
/* handle file and TTS frames */
@@ -1196,10 +1547,10 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = member->conference->rate;
- if (switch_core_speech_read_tts(&member->fnode->sh,
- file_frame,
- &file_data_len,
- &rate,
+ if (switch_core_speech_read_tts(&member->fnode->sh,
+ file_frame,
+ &file_data_len,
+ &rate,
&flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2;
} else {
@@ -1252,18 +1603,22 @@
}
switch_mutex_unlock(member->audio_out_mutex);
- continue;
+ continue;
}
- }
+ }
- switch_core_timer_next(&timer);
+ switch_core_timer_next(&timer);
} /* Rinse ... Repeat */
+ if (member->digit_stream != NULL) {
+ switch_ivr_digit_stream_destroy(member->digit_stream);
+ }
+
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
- switch_channel_cause2str(switch_channel_get_cause(channel)));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
+ switch_channel_cause2str(switch_channel_get_cause(channel)));
/* if it's an outbound channel, store the release cause in the conference struct, we might need it */
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -1336,9 +1691,9 @@
goto end;
}
- if (switch_core_file_open(&fh,
- rec->path,
- SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
+ if (switch_core_file_open(&fh,
+ rec->path,
+ SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
rec->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
goto end;
@@ -1373,7 +1728,7 @@
switch_core_file_close(&fh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
-end:
+ end:
if (rec->pool) {
switch_memory_pool_t *pool = rec->pool;
@@ -1392,24 +1747,26 @@
/* Make files stop playing in a conference either the current one or all of them */
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
{
- conference_file_node_t *nptr;
uint32_t count = 0;
+ conference_file_node_t *nptr;
- switch_mutex_lock(conference->mutex);
+ assert(conference != NULL);
- if (stop == FILE_STOP_ALL) {
- for (nptr = conference->fnode; nptr; nptr = nptr->next) {
- nptr->done++;
- count++;
- }
- } else {
- if (conference->fnode) {
- conference->fnode->done++;
- count++;
- }
- }
+ switch_mutex_lock(conference->mutex);
- switch_mutex_unlock(conference->mutex);
+ if (stop == FILE_STOP_ALL) {
+ for (nptr = conference->fnode; nptr; nptr = nptr->next) {
+ nptr->done++;
+ count++;
+ }
+ } else {
+ if (conference->fnode) {
+ conference->fnode->done++;
+ count++;
+ }
+ }
+
+ switch_mutex_unlock(conference->mutex);
return count;
}
@@ -1417,1537 +1774,1726 @@
/* stop playing a file for the member of the conference */
static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop)
{
- conference_file_node_t *nptr;
uint32_t count = 0;
- switch_mutex_lock(member->flag_mutex);
+ if (member != NULL) {
+ conference_file_node_t *nptr;
- if (stop == FILE_STOP_ALL) {
- for (nptr = member->fnode; nptr; nptr = nptr->next) {
- nptr->done++;
- count++;
+ switch_mutex_lock(member->flag_mutex);
+
+ if (stop == FILE_STOP_ALL) {
+ for (nptr = member->fnode; nptr; nptr = nptr->next) {
+ nptr->done++;
+ count++;
+ }
+ } else {
+ if (member->fnode) {
+ member->fnode->done++;
+ count++;
+ }
}
- } else {
- if (member->fnode) {
- member->fnode->done++;
- count++;
- }
+
+ switch_mutex_unlock(member->flag_mutex);
}
- switch_mutex_unlock(member->flag_mutex);
-
return count;
}
/* Play a file in the conference room */
static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel)
{
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- uint32_t count;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ uint32_t count;
char *expanded = NULL;
- uint8_t frexp = 0;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- count = conference->count;
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ assert(conference != NULL);
- if (!count) {
- return SWITCH_STATUS_FALSE;
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ count = conference->count;
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
- if (channel) {
- if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
- file = expanded;
- frexp = 1;
- }
- }
+ if (!count) {
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
+ if (channel) {
+ if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
+ file = expanded;
+ } else {
+ expanded = NULL;
+ }
+ }
+ if
#ifdef WIN32
- if (*(file +1) != ':' && *file != '/') {
+ (*(file +1) != ':' && *file != '/')
#else
- if (*file != '/') {
+ (*file != '/')
#endif
- status = conference_say(conference, file, leadin);
- goto done;
- }
+ {
+ status = conference_say(conference, file, leadin);
+ goto done;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
- fnode->type = NODE_TYPE_FILE;
- fnode->leadin = leadin;
+ fnode->type = NODE_TYPE_FILE;
+ fnode->leadin = leadin;
- /* Open the file */
- if (switch_core_file_open(&fnode->fh,
- file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- pool) != SWITCH_STATUS_SUCCESS) {
- switch_core_destroy_memory_pool(&pool);
- status = SWITCH_STATUS_NOTFOUND;
- goto done;
- }
+ /* Open the file */
+ if (switch_core_file_open(&fnode->fh,
+ file,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
+ pool) != SWITCH_STATUS_SUCCESS) {
+ switch_core_destroy_memory_pool(&pool);
+ status = SWITCH_STATUS_NOTFOUND;
+ goto done;
+ }
- fnode->pool = pool;
+ fnode->pool = pool;
- /* Queue the node */
- switch_mutex_lock(conference->mutex);
- for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+ /* Queue the node */
+ switch_mutex_lock(conference->mutex);
+ for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
- if (nptr) {
- nptr->next = fnode;
- } else {
- conference->fnode = fnode;
- }
- switch_mutex_unlock(conference->mutex);
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ conference->fnode = fnode;
+ }
+ switch_mutex_unlock(conference->mutex);
- done:
+ done:
- if (frexp) {
- switch_safe_free(expanded);
- }
- return status;
+ switch_safe_free(expanded);
+
+
+
+ return status;
}
/* Play a file in the conference room to a member */
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
{
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
+ switch_status_t status = SWITCH_STATUS_FALSE;
- if (*file != '/') {
- return conference_member_say(member->conference, member, file, leadin);
- }
+ if (member != NULL && file != NULL) {
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
+ if (*file != '/') {
+ return conference_member_say(member, file, leadin);
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- fnode->type = NODE_TYPE_FILE;
- fnode->leadin = leadin;
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Open the file */
- if (switch_core_file_open(&fnode->fh,
- file,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- pool) != SWITCH_STATUS_SUCCESS) {
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_NOTFOUND;
- }
+ fnode->type = NODE_TYPE_FILE;
+ fnode->leadin = leadin;
- fnode->pool = pool;
+ /* Open the file */
+ if (switch_core_file_open(&fnode->fh,
+ file,
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
+ pool) != SWITCH_STATUS_SUCCESS) {
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_NOTFOUND;
+ }
- /* Queue the node */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n",file);
- switch_mutex_lock(member->flag_mutex);
- for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+ fnode->pool = pool;
- if (nptr) {
- nptr->next = fnode;
- } else {
- member->fnode = fnode;
- }
- switch_mutex_unlock(member->flag_mutex);
+ /* Queue the node */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "queueing file '%s' for play\n", file);
+ switch_mutex_lock(member->flag_mutex);
+ for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
- return SWITCH_STATUS_SUCCESS;
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ member->fnode = fnode;
+ }
+ switch_mutex_unlock(member->flag_mutex);
+
+ status = SWITCH_STATUS_SUCCESS;
+ }
+
+ return status;
}
/* Say some thing with TTS in the conference room */
-static switch_status_t conference_member_say(conference_obj_t *conference, conference_member_t *member, char *text, uint32_t leadin)
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin)
{
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ switch_status_t status = SWITCH_STATUS_FALSE;
- if (!(conference->tts_engine && conference->tts_voice)) {
- return SWITCH_STATUS_SUCCESS;
- }
+ if (member != NULL && !switch_strlen_zero(text)) {
+ conference_obj_t *conference = (member != NULL ? member->conference : NULL);
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
+ assert(conference != NULL);
+
+ if (!(conference->tts_engine && conference->tts_voice)) {
+ return SWITCH_STATUS_SUCCESS;
+ }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- fnode->type = NODE_TYPE_SPEECH;
- fnode->leadin = leadin;
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh,
- conference->tts_engine,
- conference->tts_voice,
- conference->rate,
- &flags,
- conference->pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
- }
+ fnode->type = NODE_TYPE_SPEECH;
+ fnode->leadin = leadin;
+ memset(&fnode->sh, 0, sizeof(fnode->sh));
+ if (switch_core_speech_open(&fnode->sh,
+ conference->tts_engine,
+ conference->tts_voice,
+ conference->rate,
+ &flags,
+ conference->pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
- fnode->pool = pool;
+ fnode->pool = pool;
- /* Queue the node */
- switch_mutex_lock(member->flag_mutex);
- for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
+ /* Queue the node */
+ switch_mutex_lock(member->flag_mutex);
+ for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
- if (nptr) {
- nptr->next = fnode;
- } else {
- member->fnode = fnode;
- }
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ member->fnode = fnode;
+ }
- /* Begin Generation */
- switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, text, &flags);
- switch_mutex_unlock(member->flag_mutex);
+ /* Begin Generation */
+ switch_sleep(200000);
+ switch_core_speech_feed_tts(&fnode->sh, text, &flags);
+ switch_mutex_unlock(member->flag_mutex);
- return SWITCH_STATUS_SUCCESS;
+ status = SWITCH_STATUS_SUCCESS;
+ }
+
+ return status;
}
/* Say some thing with TTS in the conference room */
-static switch_status_t conference_say(conference_obj_t *conference, char *text, uint32_t leadin)
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin)
{
- conference_file_node_t *fnode, *nptr;
- switch_memory_pool_t *pool;
- switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
- uint32_t count;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ conference_file_node_t *fnode, *nptr;
+ switch_memory_pool_t *pool;
+ switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
+ uint32_t count;
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- count = conference->count;
- if (!(conference->tts_engine && conference->tts_voice)) {
- count = 0;
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
+ assert(conference != NULL);
- if (!count) {
- return SWITCH_STATUS_FALSE;
- }
+ if (switch_strlen_zero(text)) {
+ return SWITCH_STATUS_GENERR;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return SWITCH_STATUS_MEMERR;
- }
- /* Create a node object*/
- if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- return SWITCH_STATUS_MEMERR;
- }
- fnode->type = NODE_TYPE_SPEECH;
- fnode->leadin = leadin;
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ count = conference->count;
+ if (!(conference->tts_engine && conference->tts_voice)) {
+ count = 0;
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
- memset(&fnode->sh, 0, sizeof(fnode->sh));
- if (switch_core_speech_open(&fnode->sh,
- conference->tts_engine,
- conference->tts_voice,
- conference->rate,
- &flags,
- conference->pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
- return SWITCH_STATUS_FALSE;
- }
+ if (!count) {
+ return SWITCH_STATUS_FALSE;
+ }
- fnode->pool = pool;
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return SWITCH_STATUS_MEMERR;
+ }
- /* Queue the node */
- switch_mutex_lock(conference->mutex);
- for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+ /* Create a node object*/
+ if (!(fnode = switch_core_alloc(pool, sizeof(*fnode)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ return SWITCH_STATUS_MEMERR;
+ }
- if (nptr) {
- nptr->next = fnode;
- } else {
- conference->fnode = fnode;
- }
+ fnode->type = NODE_TYPE_SPEECH;
+ fnode->leadin = leadin;
- /* Begin Generation */
- switch_sleep(200000);
- switch_core_speech_feed_tts(&fnode->sh, text, &flags);
- switch_mutex_unlock(conference->mutex);
+ memset(&fnode->sh, 0, sizeof(fnode->sh));
+ if (switch_core_speech_open(&fnode->sh,
+ conference->tts_engine,
+ conference->tts_voice,
+ conference->rate,
+ &flags,
+ conference->pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
+ return SWITCH_STATUS_FALSE;
+ }
- return SWITCH_STATUS_SUCCESS;
+ fnode->pool = pool;
+
+ /* Queue the node */
+ switch_mutex_lock(conference->mutex);
+ for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
+
+ if (nptr) {
+ nptr->next = fnode;
+ } else {
+ conference->fnode = fnode;
+ }
+
+ /* Begin Generation */
+ switch_sleep(200000);
+ switch_core_speech_feed_tts(&fnode->sh, (char *)text, &flags);
+ switch_mutex_unlock(conference->mutex);
+
+ status = SWITCH_STATUS_SUCCESS;
+
+ return status;
}
-static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*), void *data)
+/* execute a callback for every member of the conference */
+static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
{
- conference_member_t *member = NULL;
+ conference_member_t *member = NULL;
- if(conference != NULL && stream != NULL && pfncallback != NULL) {
- switch_mutex_lock(conference->member_mutex);
+ assert(conference != NULL);
+ assert(stream != NULL);
+ assert(pfncallback != NULL);
- for (member = conference->members; member; member = member->next) {
- pfncallback(conference,member,member->id,stream,data);
- }
- switch_mutex_unlock(conference->member_mutex);
- }
+ switch_mutex_lock(conference->member_mutex);
+
+ for (member = conference->members; member; member = member->next) {
+ pfncallback(member, stream, data);
+ }
+
+ switch_mutex_unlock(conference->member_mutex);
+
}
+static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
+{
+ conference_member_t *member = NULL;
+
+ assert(conference != NULL);
+ assert(stream != NULL);
+
+ switch_mutex_lock(conference->member_mutex);
+ // stream->write_function(stream, "<pre>Current Callers:\n");
+
+ for (member = conference->members; member; member = member->next) {
+ switch_channel_t *channel;
+ switch_caller_profile_t *profile;
+
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ continue;
+ }
+ channel = switch_core_session_get_channel(member->session);
+ profile = switch_channel_get_caller_profile(channel);
+
+
+ stream->write_function(stream, "%u) %s (%s)\n",
+ member->id,
+ profile->caller_id_name,
+ profile->caller_id_number
+ );
+
+ }
+
+ switch_mutex_unlock(conference->member_mutex);
+
+}
+
static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
{
- conference_member_t *member = NULL;
+ conference_member_t *member = NULL;
- switch_mutex_lock(conference->member_mutex);
+ assert(conference != NULL);
+ assert(stream != NULL);
+ assert(delim != NULL);
- for (member = conference->members; member; member = member->next) {
- switch_channel_t *channel;
- switch_caller_profile_t *profile;
- char *uuid;
- char *name;
- uint32_t count = 0;
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- continue;
- }
+ switch_mutex_lock(conference->member_mutex);
- uuid = switch_core_session_get_uuid(member->session);
- channel = switch_core_session_get_channel(member->session);
- profile = switch_channel_get_caller_profile(channel);
- name = switch_channel_get_name(channel);
+ for (member = conference->members; member; member = member->next) {
+ switch_channel_t *channel;
+ switch_caller_profile_t *profile;
+ char *uuid;
+ char *name;
+ uint32_t count = 0;
+ if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "continue\n");
+ continue;
+ }
- stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
- member->id,delim,
- name,delim,
- uuid,delim,
- profile->caller_id_name,delim,
- profile->caller_id_number, delim);
+ uuid = switch_core_session_get_uuid(member->session);
+ channel = switch_core_session_get_channel(member->session);
+ profile = switch_channel_get_caller_profile(channel);
+ name = switch_channel_get_name(channel);
- if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
- stream->write_function(stream, "hear");
- count++;
- }
- if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
- count++;
- }
+ stream->write_function(stream, "%u%s%s%s%s%s%s%s%s%s",
+ member->id, delim,
+ name, delim,
+ uuid, delim,
+ profile->caller_id_name, delim,
+ profile->caller_id_number, delim);
- stream->write_function(stream, "%s%d%s%d%s%d\n",
- delim,
- member->volume_in_level, delim,
- member->volume_out_level, delim,
+ if (switch_test_flag(member, MFLAG_CAN_HEAR)) {
+ stream->write_function(stream, "hear");
+ count++;
+ }
+
+ if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+ stream->write_function(stream, "%s%s", count ? "|" : "", "speak");
+ count++;
+ }
+
+ stream->write_function(stream, "%s%d%s%d%s%d\n",
+ delim,
+ member->volume_in_level, delim,
+ member->volume_out_level, delim,
member->energy_level);
}
-
- switch_mutex_unlock(conference->member_mutex);
+
+ switch_mutex_unlock(conference->member_mutex);
+
}
-static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
+static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- conference_member_t *member = NULL;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- switch_mutex_lock(conference->member_mutex);
- stream->write_function(stream, "<pre>Current Callers:\n");
+ if (member != NULL) {
+ switch_event_t *event;
- for (member = conference->members; member; member = member->next) {
- switch_channel_t *channel;
- switch_caller_profile_t *profile;
+ switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
+ if (member->conference->muted_sound) {
+ conference_member_play_file(member, member->conference->muted_sound, 0);
+ } else {
+ char msg[512];
- if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
- continue;
- }
- channel = switch_core_session_get_channel(member->session);
- profile = switch_channel_get_caller_profile(channel);
+ snprintf(msg, sizeof(msg), "Muted");
+ conference_member_say(member, msg, 0);
+ }
+ if (stream != NULL) {
+ stream->write_function(stream, "OK mute %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- stream->write_function(stream, "*) %s (%s)\n",
- profile->caller_id_name,
- profile->caller_id_number
- );
+ return ret_status;
+}
- }
- switch_mutex_unlock(conference->member_mutex);
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
+{
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+
+ if (member != NULL) {
+ switch_event_t *event;
+
+ switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK unmute %u\n", member->id);
+ }
+ if (member->conference->unmuted_sound) {
+ conference_member_play_file(member, member->conference->unmuted_sound, 0);
+ } else {
+ char msg[512];
+
+ snprintf(msg, sizeof(msg), "Un-Muted");
+ conference_member_say(member, msg, 0);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-static int conference_function_mute_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
- if (member->conference->muted_sound) {
- conference_member_play_file(member, member->conference->muted_sound, 0);
- }
- stream->write_function(stream, "OK mute %u\n", id);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK deaf %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return err;
+ return ret_status;
}
-static int conference_function_unmute_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
- stream->write_function(stream, "OK unmute %u\n", id);
- if (member->conference->unmuted_sound) {
- conference_member_play_file(member, member->conference->unmuted_sound, 0);
- }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ switch_set_flag_locked(member, MFLAG_CAN_HEAR);
+ if (stream != NULL) {
+ stream->write_function(stream, "OK undeaf %u\n", member->id);
+ }
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return err;
+ return ret_status;
}
-static int conference_function_deaf_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
- stream->write_function(stream, "OK deaf %u\n", id);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ switch_mutex_lock(member->flag_mutex);
+ switch_clear_flag(member, MFLAG_RUNNING);
+ switch_set_flag(member, MFLAG_KICKED);
+ switch_mutex_unlock(member->flag_mutex);
+ switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "OK kicked %u\n", member->id);
+ }
- return err;
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
+ switch_event_fire(&event);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-static int conference_function_undeaf_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_set_flag_locked(member, MFLAG_CAN_HEAR);
- stream->write_function(stream, "OK undeaf %u\n", id);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = atoi((char *)data);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
+ }
- return err;
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-static int conference_function_kick_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- switch_mutex_lock(member->flag_mutex);
- switch_clear_flag(member, MFLAG_RUNNING);
- switch_set_flag(member, MFLAG_KICKED);
- switch_mutex_unlock(member->flag_mutex);
- switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
- stream->write_function(stream, "OK kicked %u\n", id);
-
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level = atoi((char *)data);
+ switch_normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ if (stream != NULL) {
+ stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
+ }
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- return err;
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
}
-static int conference_function_energy_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
- int err = 0;
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ if (member != NULL) {
+ switch_event_t *event;
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = atoi((char *)data);
- switch_mutex_unlock(member->flag_mutex);
- }
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level = atoi((char *)data);
+ switch_normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
+ if (stream != NULL) {
+ stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
+ }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
- switch_event_fire(&event);
- }
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- return err;
+ return ret_status;
}
-static int conference_function_volume_in_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int err = 0;
+ int ret_status = SWITCH_STATUS_GENERR;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ switch_hash_index_t *hi;
+ void *val;
+ char *d = ";";
+ int pretty = 0;
+ int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0); // detect being called from chat vs. api
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level = atoi((char *)data);
- switch_normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- }
+ if (argv[1+argofs]) {
+ if (argv[2+argofs] && !strcasecmp(argv[1+argofs], "delim")) {
+ d = argv[2+argofs];
- stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ if (*d == '"') {
+ if (++d) {
+ char *p;
+ if ((p = strchr(d, '"'))) {
+ *p = '\0';
+ }
+ } else {
+ d = ";";
+ }
+ }
+ } else if (strcasecmp(argv[1+argofs], "pretty") == 0) {
+ pretty = 1;
+ }
+ }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+ if (conference == NULL) {
+ for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, NULL, NULL, &val);
+ conference = (conference_obj_t *) val;
- switch_event_fire(&event);
- }
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ stream->write_function(stream, "Conference %s (%u member%s)\n",
+ conference->name,
+ conference->count,
+ conference->count == 1 ? "" : "");
+ if (pretty) {
+ conference_list_pretty(conference, stream);
+ } else {
+ conference_list(conference, stream, d);
+ }
+ }
+ } else {
+ if (pretty) {
+ conference_list_pretty(conference, stream);
+ } else {
+ conference_list(conference, stream, d);
+ }
+ }
- return err;
+ ret_status = SWITCH_STATUS_SUCCESS;
+
+ return ret_status;
}
-static int conference_function_volume_out_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
{
- int err = 0;
+ int ret_status = SWITCH_STATUS_GENERR;
+ switch_event_t *event;
- if (member != NULL || (member = conference_member_get(conference, id))) {
- switch_event_t *event;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level = atoi((char *)data);
- switch_normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- }
+
+ if (argc == 3) {
+ if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+ switch_event_fire(&event);
+ }
+ } else {
+ stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else if (argc == 4) {
+ uint32_t id = atoi(argv[3]);
+ conference_member_t *member;
- stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
+ if ((member = conference_member_get(conference, id))) {
+ if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
+ switch_event_fire(&event);
+ }
+ } else {
+ stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "Member: %u not found.\n", id);
+ }
+ }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
+ return ret_status;
+}
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
+static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
+{
+ int ret_status = SWITCH_STATUS_GENERR;
- switch_event_fire(&event);
- }
- }
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
- }
+ if (switch_strlen_zero(text)) {
+ stream->write_function(stream, "(say) Error! No text.");
+ return ret_status;
+ }
- return err;
+ if (conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
+ switch_event_t *event;
+
+ stream->write_function(stream, "(say) OK\n");
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+ switch_event_fire(&event);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "(say) Error!");
+ }
+
+ return ret_status;
}
-/* API Interface Function */
-static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
+static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
{
- char *lbuf = NULL;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- char *http = NULL;
- switch_memory_pool_t *pool = NULL;
+ int ret_status = SWITCH_STATUS_GENERR;
+ char *expanded = NULL;
+ char *start_text = NULL;
+ char *workspace = NULL;
+ uint32_t id = 0;
+ conference_member_t *member;
- if (session) {
- return SWITCH_STATUS_FALSE;
- }
+ if (switch_strlen_zero(text)) {
+ stream->write_function(stream, "(saymember) No Text!\n");
+ goto done;
+ }
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
- }
+ if (!(workspace = strdup(text))) {
+ stream->write_function(stream, "(saymember) Memory Error!\n");
+ goto done;
+ }
- if (http) {
- /* Output must be to a web browser */
- stream->write_function(stream, "<pre>\n");
- }
+ if ((start_text = strchr(workspace, ' '))) {
+ *start_text++ = '\0';
+ text = start_text;
+ }
- if (!buf) {
- stream->write_function(stream, "%s", conf_api_interface.syntax);
- return status;
- }
+ id = atoi(workspace);
- if ((lbuf = strdup(buf))) {
- conference_obj_t *conference = NULL;
- int argc;
- char *argv[25];
- switch_event_t *event;
+ if (!id || switch_strlen_zero(text)) {
+ stream->write_function(stream, "(saymember) No Text!\n");
+ goto done;
+ }
- argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if (!(member = conference_member_get(conference, id))) {
+ stream->write_function(stream, "(saymember) Unknown Member %u!", id);
+ goto done;
+ }
- /* Figure out what conference */
- if (argc) {
- if (!strcasecmp(argv[0], "commands")) {
- stream->write_function(stream, "%s", conf_api_interface.syntax);
- goto done;
- } else if (!strcasecmp(argv[0], "list")) {
- switch_hash_index_t *hi;
- void *val;
- char *d = ";";
+ if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), (char *)text)) != text) {
+ text = expanded;
+ } else {
+ expanded = NULL;
+ }
- if (argv[1]) {
- if (argv[2] && !strcasecmp(argv[1], "delim")) {
- d = argv[2];
+ if (text && conference_member_say(member, (char *)text, 0) == SWITCH_STATUS_SUCCESS) {
+ switch_event_t *event;
- if (*d == '"') {
- if (++d) {
- char *p;
- if ((p = strchr(d, '"'))) {
- *p = '\0';
- }
- } else {
- d = ";";
- }
- }
- }
- }
+ stream->write_function(stream, "(saymember) OK\n");
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
+ switch_event_fire(&event);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ stream->write_function(stream, "(saymember) Error!");
+ }
- for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, NULL, NULL, &val);
- conference = (conference_obj_t *) val;
+ done:
+ switch_safe_free(workspace);
+ switch_safe_free(expanded);
+ return ret_status;
+}
- stream->write_function(stream, "Conference %s (%u member%s)\n", conference->name, conference->count, conference->count == 1 ? "" : "s");
- conference_list(conference, stream, d);
- stream->write_function(stream, "\n");
- }
- goto done;
- } else if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
- stream->write_function(stream, "No Conference called %s found.\n", argv[0]);
- goto done;
- }
+static switch_status_t conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ int ret_status = SWITCH_STATUS_GENERR;
+ uint8_t current = 0, all = 0;
- if (argc > 1) {
- if (!strcasecmp(argv[1], "lock")) {
- switch_set_flag_locked(conference, CFLAG_LOCKED);
- stream->write_function(stream, "OK %s locked\n", argv[0]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
- switch_event_fire(&event);
- }
- goto done;
- } else if (!strcasecmp(argv[1], "unlock")) {
- switch_clear_flag_locked(conference, CFLAG_LOCKED);
- stream->write_function(stream, "OK %s unlocked\n", argv[0]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
- switch_event_fire(&event);
- }
- goto done;
- } else if (!strcasecmp(argv[1], "dial")) {
- if (argc > 2) {
- conference_outcall(conference, NULL, argv[2], 60, argv[3], argv[4], argv[5]);
- stream->write_function(stream, "OK\n");
- goto done;
- } else {
- stream->write_function(stream, "Error!\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "play")) {
- if (argc == 3) {
- if (conference_play_file(conference, argv[2], 0, NULL) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(play) Playing file %s\n", argv[2]);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
- switch_event_fire(&event);
- }
- goto done;
- } else {
- stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
- goto done;
- }
- } else if (argc == 4) {
- uint32_t id = atoi(argv[3]);
- conference_member_t *member;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if ((member = conference_member_get(conference, id))) {
- if (conference_member_play_file(member, argv[2], 0) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(play) Playing file %s to member %u\n", argv[2], id);
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
- switch_event_fire(&event);
- }
- goto done;
- } else {
- stream->write_function(stream, "(play) File: %s not found.\n", argv[2] ? argv[2] : "(unspecified)");
- goto done;
- }
- } else {
- stream->write_function(stream, "Member: %u not found.\n", id);
- goto done;
- }
- }
- } else if (!strcasecmp(argv[1], "say")) {
- char *tbuf = NULL;
- char *text;
+ if (argc > 2) {
+ current = strcasecmp(argv[2], "current") ? 0 : 1;
+ all = strcasecmp(argv[2], "all") ? 0 : 1;
+ }
- if (argc > 2 && (tbuf = strdup(buf))) {
- if ((text = strstr(tbuf, "say"))) {
- text += 4;
- while(*text == ' ') {
- text++;
- }
- if (!switch_strlen_zero(text) && conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(say) OK\n");
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
- switch_event_fire(&event);
- }
- goto done;
- } else {
- stream->write_function(stream, "(say) Error!");
- goto done;
- }
- }
+ if (current || all) {
+ if (argc == 4) {
+ uint32_t id = atoi(argv[3]);
+ conference_member_t *member;
- free(tbuf);
- } else {
- stream->write_function(stream, "(say) Error! No text.");
- }
- } else if (!strcasecmp(argv[1], "saymember")) {
- char *tbuf = NULL, *text, *name;
- uint32_t id;
- conference_member_t *member;
+ if ((member = conference_member_get(conference, id))) {
+ uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+ stream->write_function(stream, "Stopped %u files.\n", stopped);
+ } else {
+ stream->write_function(stream, "Member: %u not found.\n", id);
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
+ } else {
+ uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
+ stream->write_function(stream, "Stopped %u files.\n", stopped);
+ ret_status = SWITCH_STATUS_SUCCESS;
+ }
+ }
- if (argc > 3) {
- id = atoi(argv[3]);
- } else {
- stream->write_function(stream, "(saymember) Syntax Error!");
- goto done;
- }
+ return ret_status;
+}
- if ((tbuf = strdup(buf))) {
- if ((name = strstr(tbuf, "saymember "))) {
- name += 10;
+static switch_status_t conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ int ret_status = SWITCH_STATUS_GENERR;
- if (*name) {
- text = strchr(name, ' ');
- id = atoi(name);
- } else {
- stream->write_function(stream, "(saymember) Syntax Error!");
- goto done;
- }
+ assert(conference != NULL);
+ assert(stream != NULL);
+ if (argc > 4) {
+ uint8_t nospeak = 0, nohear = 0, clear = 0;
+ nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
+ nohear = strstr(argv[4], "nohear") ? 1 : 0;
+ if (!strcasecmp(argv[4], "clear")) {
+ clear = 1;
+ }
- if ((member = conference_member_get(conference, id))) {
- if (text && conference_member_say(conference, member, text, 0) == SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "(saymember) OK\n");
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", text);
- switch_event_fire(&event);
- }
- } else {
- stream->write_function(stream, "(saymember) Error!");
- }
- } else {
- stream->write_function(stream, "(saymember) Unknown Member %u!", id);
- }
- } else {
- stream->write_function(stream, "(saymember) Syntax Error!");
- }
+ if (!(clear || nospeak || nohear)) {
+ ret_status = SWITCH_STATUS_GENERR;
+ goto done;
+ }
+ ret_status = SWITCH_STATUS_SUCCESS;
- free(tbuf);
- goto done;
- }
- } else if (!strcasecmp(argv[1], "stop")) {
- uint8_t current = 0, all = 0;
+ if (clear) {
+ conference_member_t *member = NULL;
+ uint32_t id = atoi(argv[2]);
+ uint32_t oid = atoi(argv[3]);
- if (argc > 2) {
- current = strcasecmp(argv[2], "current") ? 0 : 1;
- all = strcasecmp(argv[2], "all") ? 0 : 1;
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ if ((member = conference_member_get(conference, id))) {
+ member_del_relationship(member, oid);
+ stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
+ } else {
+ stream->write_function(stream, "relationship %u->%u not found", id, oid);
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ } else if (nospeak || nohear) {
+ conference_member_t *member = NULL, *other_member = NULL;
+ uint32_t id = atoi(argv[2]);
+ uint32_t oid = atoi(argv[3]);
- if (current || all) {
- if (argc == 4) {
- uint32_t id = atoi(argv[3]);
- conference_member_t *member;
- if ((member = conference_member_get(conference, id))) {
- uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
- stream->write_function(stream, "Stopped %u files.\n", stopped);
- } else {
- stream->write_function(stream, "Member: %u not found.\n", id);
- goto done;
- }
- } else {
- uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
- stream->write_function(stream, "Stopped %u files.\n", stopped);
- }
- } else {
- stream->write_function(stream, "Usage stop [current/all]\n");
- goto done;
- }
+ switch_mutex_lock(conference->mutex);
+ switch_mutex_lock(conference->member_mutex);
+ if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
+ conference_relationship_t *rel = NULL;
+ if ((rel = member_get_relationship(member, other_member))) {
+ rel->flags = 0;
+ } else {
+ rel = member_add_relationship(member, oid);
+ }
- } else if (!strcasecmp(argv[1], "energy")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+ if (rel) {
+ switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
+ if (nospeak) {
+ switch_clear_flag(rel, RFLAG_CAN_SPEAK);
+ }
+ if (nohear) {
+ switch_clear_flag(rel, RFLAG_CAN_HEAR);
+ }
+ stream->write_function(stream, "ok %u->%u set\n", id, oid);
+ } else {
+ stream->write_function(stream, "error!\n");
+ }
+ } else {
+ stream->write_function(stream, "relationship %u->%u not found", id, oid);
+ }
+ switch_mutex_unlock(conference->member_mutex);
+ switch_mutex_unlock(conference->mutex);
+ }
+ }
- if (!all) {
- conference_function_energy_member(conference, NULL, id, stream, argv[3]);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_energy_member, argv[3]);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage energy <id|all> [<newval>]\n");
- goto done;
- }
+ done:
+ return ret_status;
+}
- } else if (!strcasecmp(argv[1], "volume_in")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+static switch_status_t conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_event_t *event;
- if (!all) {
- conference_function_volume_in_member(conference, NULL, id, stream, argv[3]);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_volume_in_member, argv[3]);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage volume_in <[id|all]> [<newval>]\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "volume_out")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (!all) {
- conference_function_volume_out_member(conference, NULL, id, stream, argv[3]);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_volume_out_member, argv[3]);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage volume_out <[id|all> [<newval>]\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "mute")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+ switch_set_flag_locked(conference, CFLAG_LOCKED);
+ stream->write_function(stream, "OK %s locked\n", argv[0]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
+ switch_event_fire(&event);
+ }
- if (!all) {
- conference_function_mute_member(conference, NULL, id, stream, NULL);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_mute_member, NULL);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage mute <[id|all]>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "unmute")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+ return 0;
+}
- if (!all) {
- conference_function_unmute_member(conference, NULL, id, stream, NULL);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_unmute_member, NULL);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage unmute <[id|all]>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "deaf")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_event_t *event;
- if (!all) {
- conference_function_deaf_member(conference, NULL, id, stream, NULL);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_deaf_member, NULL);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage deaf <[id|all]>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "undeaf")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (!all) {
- conference_function_undeaf_member(conference, NULL, id, stream, NULL);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_undeaf_member, NULL);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage undeaf <[id|all]>\n");
- goto done;
- }
+ switch_clear_flag_locked(conference, CFLAG_LOCKED);
+ stream->write_function(stream, "OK %s unlocked\n", argv[0]);
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
+ switch_event_fire(&event);
+ }
+
- } else if (!strcasecmp(argv[1], "record")) {
- if (argc > 2) {
- launch_conference_record_thread(conference, argv[2]);
- goto done;
- } else {
- stream->write_function(stream, "usage record <filename>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "norecord")) {
- if (argc > 2) {
- int all = (strcasecmp(argv[2], "all") == 0 );
+ return 0;
+}
- if(!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
- stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
- }
- goto done;
- } else {
- stream->write_function(stream, "usage norecord <[filename | all]>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "kick")) {
- if (argc > 2) {
- uint32_t id = atoi(argv[2]);
- int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
+static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
- if (!all) {
- conference_function_kick_member(conference, NULL, id, stream, NULL);
- goto done;
- } else {
- conference_member_itterator(conference, stream, &conference_function_kick_member, NULL);
- goto done;
- }
- } else {
- stream->write_function(stream, "usage kick <[id|all]>\n");
- goto done;
- }
- } else if (!strcasecmp(argv[1], "transfer")) {
- char *transfer_usage = "Usage transfer <confname> <id> [..<idN>]\n";
- if (switch_strlen_zero(argv[2])) {
- stream->write_function(stream, transfer_usage);
+ assert(conference != NULL);
+ assert(stream != NULL);
+
+ if (argc > 2) {
+ conference_outcall(conference, NULL, argv[2], 60, NULL, argv[4], argv[3]);
+ stream->write_function(stream, "OK\n");
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
+}
+
+static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+
+ assert(conference != NULL);
+ assert(stream != NULL);
+
+ if (argc > 3 && !switch_strlen_zero(argv[2])) {
+ int x;
+
+ for (x = 3; x<argc; x++) {
+ conference_member_t *member = NULL;
+ uint32_t id = atoi(argv[x]);
+ conference_obj_t *new_conference = NULL;
+ switch_channel_t *channel;
+ switch_event_t *event;
+ char *profile_name;
+ switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+
+ if (!(member = conference_member_get(conference, id))) {
+ stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
+ continue;
+ }
+
+ channel = switch_core_session_get_channel(member->session);
+
+ /* build a new conference if it doesn't exist */
+ if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
+ switch_memory_pool_t *pool = NULL;
+ char *conf_name;
+ conf_xml_cfg_t xml_cfg = {0};
+
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ goto done;
+ }
+
+ conf_name = switch_core_strdup(pool, argv[2]);
+
+ if ((profile_name = strchr(conf_name, '@'))) {
+ *profile_name++ = '\0';
+
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
goto done;
}
- if (argc > 3) {
- int x = 0;
- for(x = 3; x < argc; x++) {
- conference_member_t *member = NULL;
- uint32_t id = atoi(argv[x]);
- conference_obj_t *new_conference = NULL;
- switch_channel_t *channel;
- switch_event_t *event;
- char *profile_name;
- switch_xml_t cxml = NULL, cfg = NULL, profile = NULL, profiles = NULL;
- if (!(member = conference_member_get(conference, id))) {
- stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
- continue;
- }
+ if ((profiles = switch_xml_child(cfg, "profiles"))) {
+ xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+ }
+ xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+#ifdef OPTION_IVR_MENU_SUPPORT
+ xml_cfg.menus = switch_xml_child(cfg, "menus");
+#endif
+ }
- channel = switch_core_session_get_channel(member->session);
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
- if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[2]))) {
- char *conf_name;
+ /* Create the conference object. */
+ new_conference = conference_new(conf_name, xml_cfg, pool);
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- goto done;
- }
+ if (!new_conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ if (pool != NULL) {
+ switch_core_destroy_memory_pool(&pool);
+ }
+ goto done;
+ }
- conf_name = switch_core_strdup(pool, argv[2]);
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ new_conference->min = 1;
- if ((profile_name = strchr(conf_name, '@'))) {
- *profile_name++ = '\0';
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
+ /* Start the conference thread for this conference */
+ launch_conference_thread(new_conference);
+ }
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
- }
- }
+ /* move the member from the old conference to the new one */
+ conference_del_member(member->last_conference, member);
+ conference_add_member(new_conference, member);
+ stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+ /* tell them what happened */
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- /* Create the conference object. */
- new_conference = conference_new(conf_name, profile, pool);
+ done:
+ return ret_status;
+}
+static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+ assert(conference != NULL);
+ assert(stream != NULL);
- if (!new_conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto done;
- }
+ if (argc > 2) {
+ launch_conference_record_thread(conference, argv[2]);
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- new_conference->min = 1;
-
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+ return ret_status;
+}
- pool = NULL;
- /* Start the conference thread for this conference */
- launch_conference_thread(new_conference);
+static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
+{
+ switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+
+ assert(conference != NULL);
+ assert(stream != NULL);
+
+ if (argc > 2) {
+ int all = (strcasecmp(argv[2], "all") == 0 );
+
+ if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
+ stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
+ }
+ } else {
+ ret_status = SWITCH_STATUS_GENERR;
+ }
+
+ return ret_status;
+}
+
+
+
+/* API Interface Function sub-commands */
+static api_command_t conf_api_sub_commands[] = {
+ {"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+ {"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
+ {"volume in", &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
+ {"volume out", &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
+ {"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+ {"say", &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+ {"saymember", &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
+ {"stop", &conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
+ {"kick", &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+ {"mute", &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+ {"unmute", &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
+ {"deaf", &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+ {"undeaf", &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
+ {"relate", &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
+ {"lock", &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+ {"unlock", &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+ {"dial", &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
+ {"transfer", &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
+ {"record", &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+ {"norecord", &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+};
+
+#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
+
+
+switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ uint32_t i, found = 0;
+ assert(conference != NULL);
+ assert(stream != NULL);
+
+ /* loop through the command table to find a match */
+ for (i = 0; i<CONFFUNCAPISIZE && !found; i++) {
+ if (strcasecmp(argv[argn], conf_api_sub_commands[i].pname) == 0) {
+ found = 1;
+ switch(conf_api_sub_commands[i].fntype) {
+
+ /* commands that we've broken the command line into arguments for */
+ case CONF_API_SUB_ARGS_SPLIT:
+ { conf_api_args_cmd_t pfn = (conf_api_args_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+
+ if (pfn(conference, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
+ /* command returned error, so show syntax usage */
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ }
+ }
+ break;
+
+ /* member specific command that can be itteratted */
+ case CONF_API_SUB_MEMBER_TARGET:
+ {
+ uint32_t id = atoi(argv[argn+1]);
+ int all = ( id == 0 && strcasecmp(argv[argn+1], "all") == 0 );
+ int last = ( id == 0 && strcasecmp(argv[argn+1], "last") == 0 );
+
+ if (all) {
+ conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[argn+2]);
+ } else if (last) {
+ conference_member_t *member = NULL;
+ conference_member_t *last_member = NULL;
+
+ switch_mutex_lock(conference->member_mutex);
+
+ /* find last (oldest) member */
+ member = conference->members;
+ while (member != NULL) {
+ if (last_member == NULL || member->id > last_member->id) {
+ last_member = member;
}
+ member = member->next;
+ }
- conference_del_member(member->last_conference, member);
- conference_add_member(new_conference, member);
- stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
+ /* exec functio on last (oldest) member */
+ if (last_member != NULL) {
+ conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+ pfn(last_member, stream, argv[argn+2]);
+ }
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[2]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
- switch_event_fire(&event);
+ switch_mutex_unlock(conference->member_mutex);
+ } else {
+ conf_api_member_cmd_t pfn = (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd;
+ conference_member_t *member = conference_member_get(conference, id);
+
+ if (member != NULL) {
+ pfn(conference_member_get(conference, id), stream, argv[argn+2]);
+ } else {
+ if (id == 0) {
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
}
}
- } else {
- stream->write_function(stream, transfer_usage);
- goto done;
- }
- } else if (!strcasecmp(argv[1], "relate")) {
- char *relate_usage = "Usage relate <id> <id> [nospeak|nohear|clear]\n";
- if (argc > 4) {
- uint8_t nospeak = 0, nohear = 0, clear = 0;
- nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
- nohear = strstr(argv[4], "nohear") ? 1 : 0;
+ }
+ }
+ break;
- if (!strcasecmp(argv[4], "clear")) {
- clear = 1;
- }
+ /* commands that deals with all text after command */
+ case CONF_API_SUB_ARGS_AS_ONE:
+ {
+ conf_api_text_cmd_t pfn = (conf_api_text_cmd_t) conf_api_sub_commands[i].pfnapicmd;
+ char *start_text;
+ const char *modified_cmdline = cmdline;
+ const char *cmd = conf_api_sub_commands[i].pname;
- if (!(clear || nospeak || nohear)) {
- stream->write_function(stream, relate_usage);
- goto done;
- }
+ if ((start_text = strstr(modified_cmdline, cmd))) {
+ modified_cmdline = start_text + strlen(cmd);
+ while(modified_cmdline && *modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
+ modified_cmdline++;
+ }
+ }
+
+ /* call the command handler */
+ if (pfn(conference, stream, modified_cmdline) != SWITCH_STATUS_SUCCESS) {
+ /* command returned error, so show syntax usage */
+ stream->write_function(stream, conf_api_sub_commands[i].psyntax);
+ }
+ }
+ break;
+ }
+ }
+ }
- if (clear) {
- conference_member_t *member = NULL;
- uint32_t id = atoi(argv[2]);
- uint32_t oid = atoi(argv[3]);
+ if (!found) {
+ stream->write_function(stream, "Confernece command '%s' not found.\n", argv[argn]);
+ } else {
+ status = SWITCH_STATUS_SUCCESS;
+ }
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- if ((member = conference_member_get(conference, id))) {
- member_del_relationship(member, oid);
- stream->write_function(stream, "relationship %u->%u cleared.", id, oid);
- } else {
- stream->write_function(stream, "relationship %u->%u not found", id, oid);
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
- } else if (nospeak || nohear) {
- conference_member_t *member = NULL, *other_member = NULL;
- uint32_t id = atoi(argv[2]);
- uint32_t oid = atoi(argv[3]);
+ return status;
+}
- switch_mutex_lock(conference->mutex);
- switch_mutex_lock(conference->member_mutex);
- if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
- conference_relationship_t *rel = NULL;
- if ((rel = member_get_relationship(member, other_member))) {
- rel->flags = 0;
- } else {
- rel = member_add_relationship(member, oid);
- }
+/* API Interface Function */
+static switch_status_t conf_api_main(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
+{
+ char *lbuf = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ char *http = NULL;
+ int argc;
+ char *argv[25] = {0};
- if (rel) {
- switch_set_flag(rel, RFLAG_CAN_SPEAK | RFLAG_CAN_HEAR);
- if (nospeak) {
- switch_clear_flag(rel, RFLAG_CAN_SPEAK);
- }
- if (nohear) {
- switch_clear_flag(rel, RFLAG_CAN_HEAR);
- }
- stream->write_function(stream, "ok %u->%u set\n", id, oid);
- } else {
- stream->write_function(stream, "error!\n");
- }
+ if (!buf) {
+ buf = "help";
+ }
- } else {
- stream->write_function(stream, "relationship %u->%u not found", id, oid);
- }
- switch_mutex_unlock(conference->member_mutex);
- switch_mutex_unlock(conference->mutex);
- }
+ if (session) {
+ return SWITCH_STATUS_FALSE;
+ }
+ if (stream->event) {
+ http = switch_event_get_header(stream->event, "http-host");
+ }
- } else {
- stream->write_function(stream, relate_usage);
- }
- } else if (!strcasecmp(argv[1], "list")) {
- char *d = ";";
+ if (http) {
+ /* Output must be to a web browser */
+ stream->write_function(stream, "<pre>\n");
+ }
- if (argv[2]) {
- if (argv[3] && !strcasecmp(argv[2], "delim")) {
- d = argv[3];
+ if (!(lbuf = strdup(buf))) {
+ return status;
+ }
- if (*d == '"') {
- if (++d) {
- char *p;
- if ((p = strchr(d, '"'))) {
- *p = '\0';
- }
- } else {
- d = ";";
- }
- }
- }
- }
- conference_list(conference, stream, d);
- } else {
- stream->write_function(stream, "Command: %s not found.\n", argv[1]);
- goto done;
- }
+ argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- } else {
- stream->write_function(stream, "Command not specified.\n");
- goto done;
- }
- } else {
- stream->write_function(stream, "USAGE: %s\n", conf_api_interface.syntax);
- }
- } else {
- stream->write_function(stream, "Memory Error!\n");
- }
+ /* try to find a command to execute */
+ if (argc) {
+ conference_obj_t *conference = NULL;
- done:
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[0]))) {
+ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+ }
+ if (argc >= 2) {
+ status = conf_api_dispatch(conference, stream, argc, argv, (const char *)buf, 1);
+ } else {
+ stream->write_function(stream, "Conference command, not specified.\nTry 'help'\n");
+ }
+
+ switch_thread_rwlock_unlock(conference->rwlock);
+
+ } else {
+ /* special case the list command, because it doesn't require a conference argument */
+ if (strcasecmp(argv[0], "list") == 0) {
+ conf_api_sub_list(NULL, stream, argc, argv);
+ } else if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+ stream->write_function(stream, "%s\n", conf_api_interface.syntax);
+ } else {
+ stream->write_function(stream, "Conference %s not found\n", argv[0]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s not found\n", argv[0]);
+ }
+ }
+
+ } else {
+ stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
+ }
+
switch_safe_free(lbuf);
- if (pool) {
- switch_core_destroy_memory_pool(&pool);
- }
- return status;
+ return status;
+
}
/* outbound call bridge progress call state callback handler */
static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
{
- switch_channel_t *channel = NULL;
+ switch_channel_t *channel = NULL;
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
- /* put the channel in a passive state so we can loop audio to it */
- switch_channel_set_state(channel, CS_TRANSMIT);
- return SWITCH_STATUS_FALSE;
+ /* put the channel in a passive state so we can loop audio to it */
+ switch_channel_set_state(channel, CS_TRANSMIT);
+ return SWITCH_STATUS_FALSE;
}
static const switch_state_handler_table_t audio_bridge_peer_state_handlers = {
- /*.on_init */ NULL,
- /*.on_ring */ audio_bridge_on_ring,
- /*.on_execute */ NULL,
- /*.on_hangup */ NULL,
- /*.on_loopback */ NULL,
- /*.on_transmit */ NULL,
- /*.on_hold */ NULL,
+ /*.on_init */ NULL,
+ /*.on_ring */ audio_bridge_on_ring,
+ /*.on_execute */ NULL,
+ /*.on_hangup */ NULL,
+ /*.on_loopback */ NULL,
+ /*.on_transmit */ NULL,
+ /*.on_hold */ NULL,
};
/* generate an outbound call from the conference */
-static switch_status_t conference_outcall(conference_obj_t *conference,
- switch_core_session_t *session,
- char *bridgeto,
- uint32_t timeout,
- char *flags,
- char *cid_name,
- char *cid_num)
+static switch_status_t conference_outcall(conference_obj_t *conference,
+ switch_core_session_t *session,
+ char *bridgeto,
+ uint32_t timeout,
+ char *flags,
+ char *cid_name,
+ char *cid_num)
{
- switch_core_session_t *peer_session;
- switch_channel_t *peer_channel;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_channel_t *caller_channel = NULL;
- char appdata[512];
- switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
+ switch_core_session_t *peer_session;
+ switch_channel_t *peer_channel;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_channel_t *caller_channel = NULL;
+ char appdata[512];
+ switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
- if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
- return SWITCH_STATUS_FALSE;
- }
+ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
+ return SWITCH_STATUS_FALSE;
+ }
- if (session) {
- caller_channel = switch_core_session_get_channel(session);
+ if (session != NULL) {
+ caller_channel = switch_core_session_get_channel(session);
- }
+ }
- /* establish an outbound call leg */
- if (switch_ivr_originate(session,
- &peer_session,
- &cause,
- bridgeto,
- timeout,
- &audio_bridge_peer_state_handlers,
- cid_name,
- cid_num,
- NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
- switch_channel_cause2str(cause));
- if (caller_channel) {
- switch_channel_hangup(caller_channel, cause);
- }
- goto done;
- }
+ if (switch_strlen_zero(cid_name)) {
+ cid_name = conference->caller_id_name;
+ }
+ if (switch_strlen_zero(cid_num)) {
+ cid_num = conference->caller_id_number;
+ }
- peer_channel = switch_core_session_get_channel(peer_session);
- assert(peer_channel != NULL);
+ /* establish an outbound call leg */
+ if (switch_ivr_originate(session,
+ &peer_session,
+ &cause,
+ bridgeto,
+ timeout,
+ &audio_bridge_peer_state_handlers,
+ cid_name,
+ cid_num,
+ NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
+ switch_channel_cause2str(cause));
+ if (caller_channel) {
+ switch_channel_hangup(caller_channel, cause);
+ }
+ goto done;
+ }
- /* make sure the conference still exists */
- if (!switch_test_flag(conference, CFLAG_RUNNING)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
- if (caller_channel) {
- switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
- }
- switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
- goto done;
- }
- if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
- switch_channel_answer(caller_channel);
- }
+ peer_channel = switch_core_session_get_channel(peer_session);
+ assert(peer_channel != NULL);
- /* if the outbound call leg is ready */
- if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
- switch_caller_extension_t *extension = NULL;
+ /* make sure the conference still exists */
+ if (!switch_test_flag(conference, CFLAG_RUNNING)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
+ if (caller_channel) {
+ switch_channel_hangup(caller_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+ }
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+ goto done;
+ }
- /* build an extension name object */
- if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
- status = SWITCH_STATUS_MEMERR;
- goto done;
- }
- /* add them to the conference */
- if (flags && strcasecmp(flags, "none")) {
- snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
- switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
- } else {
- switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
- }
+ if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
+ switch_channel_answer(caller_channel);
+ }
- switch_channel_set_caller_extension(peer_channel, extension);
- switch_channel_set_state(peer_channel, CS_EXECUTE);
+ /* if the outbound call leg is ready */
+ if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
+ switch_caller_extension_t *extension = NULL;
- } else {
- switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
+ /* build an extension name object */
+ if ((extension = switch_caller_extension_new(peer_session, conference->name, conference->name)) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
+ status = SWITCH_STATUS_MEMERR;
+ goto done;
+ }
+ /* add them to the conference */
+ if (flags && strcasecmp(flags, "none")) {
+ snprintf(appdata, sizeof(appdata), "%s +flags{%s}", conference->name, flags);
+ switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
+ } else {
+ switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference->name);
+ }
-done:
- switch_thread_rwlock_unlock(conference->rwlock);
- return status;
+ switch_channel_set_caller_extension(peer_channel, extension);
+ switch_channel_set_state(peer_channel, CS_EXECUTE);
+
+ } else {
+ switch_channel_hangup(peer_channel, SWITCH_CAUSE_NO_ANSWER);
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
+
+ done:
+ switch_thread_rwlock_unlock(conference->rwlock);
+ return status;
}
/* Play a file */
static switch_status_t conference_local_play_file(switch_core_session_t *session, char *path, uint32_t leadin, char *buf, switch_size_t len)
{
- uint32_t x = 0;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ uint32_t x = 0;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- /* generate some space infront of the file to be played */
- for (x = 0; x < leadin; x++) {
- switch_frame_t *read_frame;
- switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
+ /* generate some space infront of the file to be played */
+ for (x = 0; x < leadin; x++) {
+ switch_frame_t *read_frame;
+ switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
- break;
- }
- }
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
+ }
- /* if all is well, really play the file */
- if (status == SWITCH_STATUS_SUCCESS) {
- status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
- }
+ /* if all is well, really play the file */
+ if (status == SWITCH_STATUS_SUCCESS) {
+ status = switch_ivr_play_file(session, NULL, path, NULL, NULL, NULL, 0);
+ }
- return status;
+ return status;
}
/* Application interface function that is called from the dialplan to join the channel to a conference */
static void conference_function(switch_core_session_t *session, char *data)
{
- switch_codec_t *read_codec = NULL;
- switch_memory_pool_t *pool = NULL, *freepool = NULL;
- uint32_t flags = 0;
- conference_member_t member = {0};
- conference_obj_t *conference = NULL;
- switch_channel_t *channel = NULL;
- char *mydata = switch_core_session_strdup(session, data);
- char *conf_name = NULL;
- char *bridge_prefix = "bridge:";
- char *flags_prefix = "+flags{";
- char *bridgeto = NULL;
- char *profile_name = NULL;
- switch_xml_t cxml = NULL, cfg = NULL, profile = NULL, profiles = NULL;
- char *flags_str;
- member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
- switch_core_session_message_t msg = {0};
- uint8_t rl = 0, isbr = 0;
- char *dpin = NULL;
+ switch_codec_t *read_codec = NULL;
+ switch_memory_pool_t *pool = NULL, *freepool = NULL;
+ uint32_t flags = 0;
+ conference_member_t member = {0};
+ conference_obj_t *conference = NULL;
+ switch_channel_t *channel = NULL;
+ char *mydata = switch_core_session_strdup(session, data);
+ char *conf_name = NULL;
+ char *bridge_prefix = "bridge:";
+ char *flags_prefix = "+flags{";
+ char *bridgeto = NULL;
+ char *profile_name = NULL;
+ switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
+ char *flags_str;
+ member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+ switch_core_session_message_t msg = {0};
+ uint8_t rl = 0, isbr = 0;
+ char *dpin = NULL;
+ conf_xml_cfg_t xml_cfg = {0};
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
- if (!mydata) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return;
- }
+ if (!mydata) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return;
+ }
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- return;
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ return;
+ }
- /* Start the conference muted or deaf ? */
- if ((flags_str=strstr(mydata, flags_prefix))) {
- char *p;
+ /* Start the conference muted or deaf ? */
+ if ((flags_str = strstr(mydata, flags_prefix))) {
+ char *p;
- *flags_str = '\0';
- flags_str += strlen(flags_prefix);
- if ((p = strchr(flags_str, '}'))) {
- *p = '\0';
- }
+ *flags_str = '\0';
+ flags_str += strlen(flags_prefix);
+ if ((p = strchr(flags_str, '}'))) {
+ *p = '\0';
+ }
- if (strstr(flags_str, "mute")) {
- uflags &= ~MFLAG_CAN_SPEAK;
- } else if (strstr(flags_str, "deaf")) {
- uflags &= ~MFLAG_CAN_HEAR;
- }
- }
+ if (strstr(flags_str, "mute")) {
+ uflags &= ~MFLAG_CAN_SPEAK;
+ } else if (strstr(flags_str, "deaf")) {
+ uflags &= ~MFLAG_CAN_HEAR;
+ }
+ }
- /* is this a bridging conference ? */
- if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
- isbr = 1;
- mydata += strlen(bridge_prefix);
- if ((bridgeto = strchr(mydata, ':'))) {
- *bridgeto++ = '\0';
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
- goto done;
- }
- }
+ /* is this a bridging conference ? */
+ if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
+ isbr = 1;
+ mydata += strlen(bridge_prefix);
+ if ((bridgeto = strchr(mydata, ':'))) {
+ *bridgeto++ = '\0';
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
+ goto done;
+ }
+ }
- conf_name = mydata;
+ conf_name = mydata;
- /* is there a conference pin ? */
- if ((dpin = strchr(conf_name, '+'))) {
- *dpin++ = '\0';
- }
+ /* is there a conference pin ? */
+ if ((dpin = strchr(conf_name, '+'))) {
+ *dpin++ = '\0';
+ }
- /* is there profile specification ? */
- if ((profile_name = strchr(conf_name, '@'))) {
- *profile_name++ = '\0';
+ /* is there profile specification ? */
+ if ((profile_name = strchr(conf_name, '@'))) {
+ *profile_name++ = '\0';
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
- }
- }
+ if ((profiles = switch_xml_child(cfg, "profiles"))) {
+ xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+ }
- /* if this is a bridging call, and it's not a duplicate, build a */
- /* conference object, and skip pin handling, and locked checking */
- if (isbr) {
- char *uuid = switch_core_session_get_uuid(session);
+ xml_cfg.controls = switch_xml_child(cfg, "caller-controls");
+#ifdef OPTION_IVR_MENU_SUPPORT
+ xml_cfg.menus = switch_xml_child(cfg, "menus");
+#endif
+ }
- if (!strcmp(conf_name, "_uuid_")) {
- conf_name = uuid;
- }
+ /* if this is a bridging call, and it's not a duplicate, build a */
+ /* conference object, and skip pin handling, and locked checking */
+ if (isbr) {
+ char *uuid = switch_core_session_get_uuid(session);
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
- goto done;
- }
+ if (!strcmp(conf_name, "_uuid_")) {
+ conf_name = uuid;
+ }
- /* Create the conference object. */
- conference = conference_new(conf_name, profile, pool);
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference %s already exists!\n", conf_name);
+ goto done;
+ }
- if (!conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto done;
- }
+ /* Create the conference object. */
+ conference = conference_new(conf_name, xml_cfg, pool);
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- conference->min = 2;
+ if (!conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto done;
+ }
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ conference->min = 2;
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+ /* if the dialplan specified a pin, override the profile's value */
+ if (dpin) {
+ conference->pin = switch_core_strdup(conference->pool, dpin);
+ }
- /* Start the conference thread for this conference */
- launch_conference_thread(conference);
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(conference, CFLAG_DYNAMIC);
- } else {
- /* if the conference exists, get the pointer to it */
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- freepool = pool;
- /* couldn't find the conference, create one */
- } else {
- conference = conference_new(conf_name, profile, pool);
+ /* Start the conference thread for this conference */
+ launch_conference_thread(conference);
- if (!conference) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- goto done;
- }
+ } else {
+ /* if the conference exists, get the pointer to it */
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ freepool = pool;
+ /* couldn't find the conference, create one */
+ } else {
+ conference = conference_new(conf_name, xml_cfg, pool);
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
+ if (!conference) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto done;
+ }
- /* Set the minimum number of members (once you go above it you cannot go below it) */
- conference->min = 1;
+ /* if the dialplan specified a pin, override the profile's value */
+ if (dpin) {
+ conference->pin = switch_core_strdup(conference->pool, dpin);
+ }
- /* Indicate the conference is dynamic */
- switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+ /* Set the minimum number of members (once you go above it you cannot go below it) */
+ conference->min = 1;
- /* Start the conference thread for this conference */
- launch_conference_thread(conference);
- }
+ /* Indicate the conference is dynamic */
+ switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+ /* Start the conference thread for this conference */
+ launch_conference_thread(conference);
+ }
+
/* acquire a read lock on the thread so it can't leave without us */
if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
@@ -2955,216 +3501,215 @@
}
rl++;
- /* if this is not an outbound call, deal with conference pins */
- if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
- char pin_buf[80] = "";
- int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
- int pin_valid = 0;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ /* if this is not an outbound call, deal with conference pins */
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND) && conference->pin) {
+ char pin_buf[80] = "";
+ int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
+ int pin_valid = 0;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- /* Answer the channel */
- switch_channel_answer(channel);
+ /* Answer the channel */
+ switch_channel_answer(channel);
- while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
+ while(!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
- /* be friendly */
- if (conference->pin_sound) {
- conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
- }
- /* wait for them if neccessary */
- if (strlen(pin_buf) < strlen(conference->pin)) {
- char *buf = pin_buf + strlen(pin_buf);
- char term = '\0';
+ /* be friendly */
+ if (conference->pin_sound) {
+ conference_local_play_file(session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+ }
+ /* wait for them if neccessary */
+ if (strlen(pin_buf) < strlen(conference->pin)) {
+ char *buf = pin_buf + strlen(pin_buf);
+ char term = '\0';
- status = switch_ivr_collect_digits_count(session,
- buf,
- sizeof(pin_buf) - (unsigned int)strlen(pin_buf),
- (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf),
- "#", &term, 10000);
- }
+ status = switch_ivr_collect_digits_count(session,
+ buf,
+ sizeof(pin_buf) - (unsigned int)strlen(pin_buf),
+ (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin_buf),
+ "#", &term, 10000);
+ }
- pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
- if (!pin_valid) {
- /* zero the collected pin */
- memset(pin_buf,0,sizeof(pin_buf));
+ pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
+ if (!pin_valid) {
+ /* zero the collected pin */
+ memset(pin_buf, 0, sizeof(pin_buf));
- /* more friendliness */
- if (conference->bad_pin_sound) {
- conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
- }
- }
- pin_retries --;
- }
+ /* more friendliness */
+ if (conference->bad_pin_sound) {
+ conference_local_play_file(session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf));
+ }
+ }
+ pin_retries --;
+ }
- if (!pin_valid) {
- goto done;
- }
- }
+ if (!pin_valid) {
+ goto done;
+ }
+ }
- /* don't allow more callers if the conference is locked, unless we invited them */
- if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
- if (conference->locked_sound) {
- /* Answer the channel */
- switch_channel_answer(channel);
- conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
- }
- goto done;
- }
- }
+ /* don't allow more callers if the conference is locked, unless we invited them */
+ if (switch_test_flag(conference, CFLAG_LOCKED) && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Conference %s is locked.\n", conf_name);
+ if (conference->locked_sound) {
+ /* Answer the channel */
+ switch_channel_answer(channel);
+ conference_local_play_file(session, conference->locked_sound, 20, NULL, 0);
+ }
+ goto done;
+ }
+ }
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
- /* if we're using "bridge:" make an outbound call and bridge it in */
- if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
- if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
- goto done;
- }
- } else {
- /* if we're not using "bridge:" set the conference answered flag */
- /* and this isn't an outbound channel, answer the call */
- if (!switch_channel_test_flag(channel, CF_OUTBOUND))
- switch_set_flag(conference, CFLAG_ANSWERED);
- }
+ /* if we're using "bridge:" make an outbound call and bridge it in */
+ if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
+ if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+ goto done;
+ }
+ } else {
+ /* if we're not using "bridge:" set the conference answered flag */
+ /* and this isn't an outbound channel, answer the call */
+ if (!switch_channel_test_flag(channel, CF_OUTBOUND))
+ switch_set_flag(conference, CFLAG_ANSWERED);
+ }
- /* Save the original read codec. */
- read_codec = switch_core_session_get_read_codec(session);
- member.native_rate = read_codec->implementation->samples_per_second;
+ /* Save the original read codec. */
+ read_codec = switch_core_session_get_read_codec(session);
+ member.native_rate = read_codec->implementation->samples_per_second;
- /* Setup a Signed Linear codec for reading audio. */
- if (switch_core_codec_init(&member.read_codec,
- "L16",
- NULL,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- pool) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- flags = 0;
- goto done;
- }
+ /* Setup a Signed Linear codec for reading audio. */
+ if (switch_core_codec_init(&member.read_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL,
+ pool) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ flags = 0;
+ goto done;
+ }
- if (read_codec->implementation->samples_per_second != conference->rate) {
- switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
- &member.read_resampler : &member.mux_resampler;
+ if (read_codec->implementation->samples_per_second != conference->rate) {
+ switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
+ &member.read_resampler : &member.mux_resampler;
- switch_resample_create(resampler,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->samples_per_second * 20,
- conference->rate,
- conference->rate * 20,
- switch_core_session_get_pool(session));
+ switch_resample_create(resampler,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->samples_per_second * 20,
+ conference->rate,
+ conference->rate * 20,
+ switch_core_session_get_pool(session));
- /* Setup an audio buffer for the resampled audio */
- if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto done;
- }
- }
- /* Setup a Signed Linear codec for writing audio. */
- if (switch_core_codec_init(&member.write_codec,
- "L16",
- NULL,
- conference->rate,
- conference->interval,
- 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL,
- pool) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- conference->rate, conference->interval);
- flags = 0;
- goto codec_done2;
- }
+ /* Setup an audio buffer for the resampled audio */
+ if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto done;
+ }
+ }
+ /* Setup a Signed Linear codec for writing audio. */
+ if (switch_core_codec_init(&member.write_codec,
+ "L16",
+ NULL,
+ conference->rate,
+ conference->interval,
+ 1,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL,
+ pool) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ conference->rate, conference->interval);
+ flags = 0;
+ goto codec_done2;
+ }
- /* Setup an audio buffer for the incoming audio */
- if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto codec_done1;
- }
+ /* Setup an audio buffer for the incoming audio */
+ if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto codec_done1;
+ }
- /* Setup an audio buffer for the outgoing audio */
- if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
- goto codec_done1;
- }
+ /* Setup an audio buffer for the outgoing audio */
+ if (switch_buffer_create_dynamic(&member.mux_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
+ goto codec_done1;
+ }
+ /* Prepare MUTEXS */
+ member.id = next_member_id();
+ member.pool = pool;
+ member.session = session;
+ switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
+ switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
+ switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
- /* Prepare MUTEXS */
- member.id = next_member_id();
- member.pool = pool;
- member.session = session;
- switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, pool);
- switch_mutex_init(&member.audio_in_mutex, SWITCH_MUTEX_NESTED, pool);
- switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, pool);
+ /* Install our Signed Linear codec so we get the audio in that format */
+ switch_core_session_set_read_codec(member.session, &member.read_codec);
- /* Install our Signed Linear codec so we get the audio in that format */
- switch_core_session_set_read_codec(member.session, &member.read_codec);
+ /* Add the caller to the conference */
+ if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
+ goto codec_done1;
+ }
+ switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
- /* Add the caller to the conference */
- if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
- goto codec_done1;
- }
- switch_set_flag_locked((&member), MFLAG_RUNNING | uflags);
+ msg.from = __FILE__;
- msg.from = __FILE__;
+ /* Tell the channel we are going to be in a bridge */
+ msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
+ switch_core_session_receive_message(session, &msg);
- /* Tell the channel we are going to be in a bridge */
- msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
- switch_core_session_receive_message(session, &msg);
+ /* Run the confernece loop */
+ conference_loop_output(&member);
- /* Run the confernece loop */
- conference_loop(&member);
+ /* Tell the channel we are no longer going to be in a bridge */
+ msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
+ switch_core_session_receive_message(session, &msg);
- /* Tell the channel we are no longer going to be in a bridge */
- msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
- switch_core_session_receive_message(session, &msg);
+ /* Remove the caller from the conference */
+ conference_del_member(member.last_conference, &member);
- /* Remove the caller from the conference */
- conference_del_member(member.last_conference, &member);
+ /* Put the original codec back */
+ switch_core_session_set_read_codec(member.session, read_codec);
- /* Put the original codec back */
- switch_core_session_set_read_codec(member.session, read_codec);
+ /* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
+ codec_done1:
+ switch_core_codec_destroy(&member.read_codec);
+ codec_done2:
+ switch_core_codec_destroy(&member.write_codec);
+ done:
- /* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
-codec_done1:
- switch_core_codec_destroy(&member.read_codec);
-codec_done2:
- switch_core_codec_destroy(&member.write_codec);
-done:
+ switch_buffer_destroy(&member.resample_buffer);
+ switch_buffer_destroy(&member.audio_buffer);
+ switch_buffer_destroy(&member.mux_buffer);
- switch_buffer_destroy(&member.resample_buffer);
- switch_buffer_destroy(&member.audio_buffer);
- switch_buffer_destroy(&member.mux_buffer);
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ }
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- }
+ if (freepool) {
+ switch_core_destroy_memory_pool(&freepool);
+ }
- if (freepool) {
- switch_core_destroy_memory_pool(&freepool);
- }
+ if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
+ switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
+ }
- if (switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
- switch_ivr_play_file(session, NULL, conference->kicked_sound, NULL, NULL, NULL, 0);
- }
+ switch_core_session_reset(session);
- switch_core_session_reset(session);
-
/* release the readlock */
if (rl) {
switch_thread_rwlock_unlock(conference->rwlock);
@@ -3174,655 +3719,815 @@
/* Create a thread for the conference and launch it */
static void launch_conference_thread(conference_obj_t *conference)
{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
- switch_set_flag_locked(conference, CFLAG_RUNNING);
- switch_threadattr_create(&thd_attr, conference->pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_mutex_lock(globals.hash_mutex);
- switch_core_hash_insert(globals.conference_hash, conference->name, conference);
- switch_mutex_unlock(globals.hash_mutex);
- switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
+ switch_set_flag_locked(conference, CFLAG_RUNNING);
+ switch_threadattr_create(&thd_attr, conference->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_mutex_lock(globals.hash_mutex);
+ switch_core_hash_insert(globals.conference_hash, conference->name, conference);
+ switch_mutex_unlock(globals.hash_mutex);
+ switch_thread_create(&thread, thd_attr, conference_thread_run, conference, conference->pool);
}
static void launch_conference_record_thread(conference_obj_t *conference, char *path)
{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
- switch_memory_pool_t *pool;
- conference_record_t *rec;
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+ switch_memory_pool_t *pool;
+ conference_record_t *rec;
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- }
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ }
- /* Create a node object*/
- if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
- switch_core_destroy_memory_pool(&pool);
- }
+ /* Create a node object*/
+ if (!(rec = switch_core_alloc(pool, sizeof(*rec)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
+ switch_core_destroy_memory_pool(&pool);
+ }
- rec->conference = conference;
- rec->path = switch_core_strdup(pool, path);
- rec->pool = pool;
+ rec->conference = conference;
+ rec->path = switch_core_strdup(pool, path);
+ rec->pool = pool;
- switch_threadattr_create(&thd_attr, rec->pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
+ switch_threadattr_create(&thd_attr, rec->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, conference_record_thread_run, rec, rec->pool);
}
-static void *SWITCH_THREAD_FUNC input_thread_run(switch_thread_t *thread, void *obj)
-{
- conference_member_t *member = obj;
- switch_channel_t *channel;
- switch_status_t status;
- switch_frame_t *read_frame = NULL;
- switch_codec_t *read_codec;
- uint32_t hangover = 40,
- hangunder = 15,
- hangover_hits = 0,
- hangunder_hits = 0,
- energy_level = 0,
- diff_level = 400;
- uint8_t talking = 0;
+static const switch_application_interface_t conference_application_interface = {
+ /*.interface_name */ global_app_name,
+ /*.application_function */ conference_function,
+ NULL, NULL, NULL,
+ /*.next*/ NULL
+};
- assert(member != NULL);
+static switch_api_interface_t conf_api_interface = {
+ /*.interface_name */ "conference",
+ /*.desc */ "Conference module commands",
+ /*.function */ conf_api_main,
+ /*.syntax */ /* see switch_module_load, this is built on the fly */
+ /*.next */
+};
- channel = switch_core_session_get_channel(member->session);
- assert(channel != NULL);
+static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
+{
+ char name[512] = "", *p, *lbuf;
+ switch_chat_interface_t *ci;
+ conference_obj_t *conference = NULL;
+ switch_stream_handle_t stream = {0};
- read_codec = switch_core_session_get_read_codec(member->session);
- assert(read_codec != NULL);
+ if ((p = strchr(to, '+'))) {
+ to = ++p;
+ }
- /* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it
- and mux it with any audio from other channels. */
+ if (!body) {
+ return SWITCH_STATUS_SUCCESS;
+ }
- while(switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
- /* Read a frame. */
- status = switch_core_session_read_frame(member->session, &read_frame, -1, 0);
+ if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
+ }
- /* end the loop, if appropriate */
- if (!SWITCH_READ_ACCEPTABLE(status) || !switch_test_flag(member, MFLAG_RUNNING)) {
- break;
- }
- if (switch_test_flag(read_frame, SFF_CNG)) {
- continue;
- }
+ if ((p = strchr(to, '@'))) {
+ switch_copy_string(name, to, ++p-to);
+ } else {
+ switch_copy_string(name, to, sizeof(name));
+ }
- energy_level = member->energy_level;
+ if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
+ ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
+ return SWITCH_STATUS_FALSE;
+ }
- if (switch_test_flag(member, MFLAG_CAN_SPEAK) && energy_level) {
- uint32_t energy = 0, i = 0, samples = 0, j = 0, score = 0;
- int16_t *data;
+ SWITCH_STANDARD_STREAM(stream);
- data = read_frame->data;
- if ((samples = read_frame->datalen / sizeof(*data))) {
+ if (body != NULL && (lbuf = strdup(body))) {
+ int argc;
+ char *argv[25];
- for (i = 0; i < samples; i++) {
- energy += abs(data[j]);
- j += read_codec->implementation->number_of_channels;
- }
+ memset(argv, 0, sizeof(argv));
+ argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
- score = energy / samples;
+ /* try to find a command to execute */
+ if (argc) {
+ /* special case list */
+ if (strcasecmp(argv[0], "list") == 0) {
+ conference_list_pretty(conference, &stream);
+ /* provide help */
+ } else if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
+ stream.write_function(&stream, "%s\n", conf_api_interface.syntax);
+ /* find a normal command */
+ } else {
+ conf_api_dispatch(conference, &stream, argc, argv, (const char *)body, 0);
}
+ } else {
+ stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
+ }
+ }
+ switch_safe_free(lbuf);
- if (score > energy_level) {
- uint32_t diff = score - energy_level;
- if (hangover_hits) {
- hangover_hits--;
- }
+ ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
+ switch_safe_free(stream.data);
- if (diff >= diff_level || ++hangunder_hits >= hangunder) {
- hangover_hits = hangunder_hits = 0;
+ return SWITCH_STATUS_SUCCESS;
+}
- if (!talking) {
- switch_event_t *event;
- talking = 1;
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
- switch_event_fire(&event);
- }
- }
- }
- } else {
- if (hangunder_hits) {
- hangunder_hits--;
- }
- if (talking) {
- switch_event_t *event;
- if (++hangover_hits >= hangover) {
- hangover_hits = hangunder_hits = 0;
- talking = 0;
+static const switch_chat_interface_t conference_chat_interface = {
+ /*.name */ CONF_CHAT_PROTO,
+ /*.chat_send */ chat_send,
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", member->conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "stop-talking");
- switch_event_fire(&event);
- }
- }
- }
- }
- }
+};
- /* skip frames that are not actual media or when we are muted or silent */
- if ((talking || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
- if (member->read_resampler) {
- int16_t *bptr = (int16_t *) read_frame->data;
- int len = (int) read_frame->datalen;;
+static switch_loadable_module_interface_t conference_module_interface = {
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ &conference_application_interface,
+ /*.api_interface */ &conf_api_interface,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL,
+ /*.chat_interface */ &conference_chat_interface
+};
- member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
- member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
- member->read_resampler->from_len, member->read_resampler->to,
- member->read_resampler->to_size, 0);
- switch_float_to_short(member->read_resampler->to, read_frame->data, len);
- len = member->read_resampler->to_len * 2;
- read_frame->datalen = len;
- read_frame->samples = len / 2;
- }
- /* Check for input volume adjustments */
- if (member->volume_in_level) {
- switch_change_sln_volume(read_frame->data, read_frame->datalen / 2, member->volume_in_level);
- }
+#ifdef OPTION_IVR_MENU_SUPPORT
+static switch_ivr_action_t conference_caller_control_menu_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
+{
+ switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
- /* Write the audio into the input buffer */
- switch_mutex_lock(member->audio_in_mutex);
- switch_buffer_write(member->audio_buffer, read_frame->data, read_frame->datalen);
- switch_mutex_unlock(member->audio_in_mutex);
- }
- }
+ if (!switch_strlen_zero(param)) {
+ if (obj != NULL) {
+ int i, found;
+ char *action_name = strdup(param);
- switch_clear_flag_locked(member, MFLAG_ITHREAD);
+ if (action_name != NULL) {
+ char *sep = (action_name != NULL ? strchr(action_name, ' ') : NULL);
- return NULL;
-}
+ /* split the action from any parameters */
+ if (sep != NULL) {
+ *sep = '\0';
+ }
-/* Create a thread for the conference and launch it */
-static void launch_input_thread(conference_member_t *member, switch_memory_pool_t *pool)
-{
- switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
+ /* find and execute the caller control handler */
+ for(i = 0, found = 0; !found && i<CCFNTBL_QTY; i++) {
+ found = (ccfntbl[i].action != CALLER_CONTROL_MENU && strcasecmp(ccfntbl[i].key, action_name) == 0);
+ if (found) {
+ if (obj != NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "invoking caller control menu action '%s'\n", ccfntbl[i].key);
+ ccfntbl[i].handler((conference_member_t *)obj, (sep != NULL ? sep+1 : NULL));
+ if (ccfntbl[i].action == CALLER_CONTROL_HANGUP) {
+ action = SWITCH_IVR_ACTION_DIE;
+ }
+ }
+ }
+ }
- switch_threadattr_create(&thd_attr, pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_set_flag_locked(member, MFLAG_ITHREAD);
- switch_thread_create(&thread, thd_attr, input_thread_run, member, pool);
+ free(action_name);
+ }
+
+ if (!found) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unknown caller control menu action '%s'\n", param);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to invoke caller control menu action '%s', NULL member!\n", param);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL or empty param!\n");
+ }
+
+ return action;
}
-static const switch_application_interface_t conference_application_interface = {
- /*.interface_name */ global_app_name,
- /*.application_function */ conference_function,
- NULL, NULL, NULL,
- /*.next*/ NULL
-};
+/*
+ static switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
+ {
+ switch_status_t status;
-static switch_api_interface_t conf_api_interface = {
- /*.interface_name */ "conference",
- /*.desc */ "Conference",
- /*.function */ conf_function,
- /*.syntax */
- "list [delim <string>]\n"
- "\t<confname> list [delim <string>]\n"
- "\t<confname> energy <member_id|all> [<newval>]\n"
- "\t<confname> volume_in <member_id|all> [<newval>]\n"
- "\t<confname> volume_out <member_id|all> [<newval>]\n"
- "\t<confname> play <file_path> [<member_id>]\n"
- "\t<confname> say <text>\n"
- "\t<confname> saymember <member_id> <text>\n"
- "\t<confname> stop <[current|all]> [<member_id>]\n"
- "\t<confname> kick <[member_id|all]>\n"
- "\t<confname> mute <[member_id|all]>\n"
- "\t<confname> unmute <[member_id|all]>\n"
- "\t<confname> deaf <[member_id|all]>\n"
- "\t<confname> undeaf <[member_id|all]>\n"
- "\t<confname> relate <member_id> <other_member_id> [nospeak|nohear]\n"
- "\t<confname> lock\n"
- "\t<confname> unlock\n"
- "\t<confname> dial <endpoint_module_name>/<destination>\n"
- "\t<confname> transfer <conference_name> <member_id_1> [...<member_id_N>]\n"
- "\t<confname> record <filename>\n"
- "\t<confname> norecord <[filename|all]>\n",
- /*.next */
-};
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_play_file\n");
+ status = conference_member_play_file((conference_member_t *)member, file, leadin);
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ivr_menu_callback_play_file ERROR\n");
+ }
-static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint)
-{
- char name[512] = "", *p;
- switch_chat_interface_t *ci;
- conference_obj_t *conference = NULL;
- switch_stream_handle_t stream = {0};
+ return status;
+ }
- if ((p = strchr(to, '+'))) {
- to = ++p;
- }
+ static switch_status_t ivr_menu_callback_say(char *file, uint32_t leadin, void *member)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ivr_menu_callback_say\n");
+ return conference_member_say((conference_member_t *)member, file, leadin);
+ }
+*/
- if (!body) {
- return SWITCH_STATUS_SUCCESS;
- }
+static switch_status_t conference_caller_control_menu_build(caller_control_menu_ctx_t **ctx,
+ conference_obj_t *conference,
+ switch_xml_t menu_group,
+ char *menu_name)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_xml_t xml_menus;
+ switch_xml_t xml_menu;
- if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
- }
+ assert(conference != NULL);
+ assert(ctx != NULL);
+ assert(menu_group != NULL);
+ assert(menu_name != NULL);
+ assert(xml_menus != NULL);
+ xml_menus = switch_xml_child(menu_group, "menus");
+ xml_menu = (xml_menus != NULL ? switch_xml_find_child(xml_menus, "menu", "name", menu_name) : NULL);
- if ((p = strchr(to, '@'))) {
- switch_copy_string(name, to, ++p-to);
- } else {
- switch_copy_string(name, to, sizeof(name));
- }
- if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
- ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Sorry, We're Closed", NULL);
- return SWITCH_STATUS_FALSE;
- }
- SWITCH_STANDARD_STREAM(stream);
+ /* if we found the requested menu in our menu_group */
+ if (xml_menu != NULL && xml_menu != NULL) {
+ *ctx = (caller_control_menu_ctx_t *)switch_core_alloc(conference->pool, sizeof(caller_control_menu_ctx_t));
- if (strstr(body, "list")) {
- conference_list_pretty(conference, &stream);
- } else {
- stream.write_function(&stream, "The only command we have so far is 'list'.\nGet coding or go press PayPal!!\n");
- }
+ if (*ctx != NULL) {
+ memset(*ctx, 0, sizeof(caller_control_menu_ctx_t));
- ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, NULL);
- switch_safe_free(stream.data);
+ /* setup an xml parser context, and a menu stack context for the specified menu in our memory pool */
+ status = switch_ivr_menu_stack_xml_init(&(*ctx)->xml_ctx, conference->pool);
+ if (status == SWITCH_STATUS_SUCCESS) {
+ (*ctx)->name = switch_core_strdup(conference->pool, menu_name);
+ /* add our xml menu handler to the xml stack parser */
+ status = switch_ivr_menu_stack_xml_add_custom((*ctx)->xml_ctx, "control", &conference_caller_control_menu_handler);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add custom xml handler\n");
+ /* parse the xml stack to build the menu stack */
+ status = switch_ivr_menu_stack_xml_build((*ctx)->xml_ctx, &(*ctx)->menu_stack, xml_menus, xml_menu, conference->timer_name);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build xml menu stack\n");
- return SWITCH_STATUS_SUCCESS;
+ /*
+ // instruct ivr menu to use our file play and tts routines
+ status = switch_ivr_menu_set_fileplay_callback((*ctx)->menu_stack, &ivr_menu_callback_play_file);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set file play calback\n");
+ status = switch_ivr_menu_set_tts_callback((*ctx)->menu_stack, &ivr_menu_callback_say);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to set tts calback\n");
+ */
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to init xml menu context\n");
+ }
+ if (status != SWITCH_STATUS_SUCCESS)
+ *ctx = NULL;
+ }
+ } else {
+ if (xml_menus == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menus\n");
+ if (xml_menu == NULL)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "caller control menu unable to find xml menu '%s'\n", menu_name);
+ }
+
+ return status;
}
+#endif
-static const switch_chat_interface_t conference_chat_interface = {
- /*.name */ CONF_CHAT_PROTO,
- /*.chat_send */ chat_send,
+static switch_status_t conference_new_install_caller_controls_default(conference_obj_t *conference)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ uint32_t i;
+ caller_control_action_t *action;
-};
+ assert(conference != NULL);
-static switch_loadable_module_interface_t conference_module_interface = {
- /*.module_name */ modname,
- /*.endpoint_interface */ NULL,
- /*.timer_interface */ NULL,
- /*.dialplan_interface */ NULL,
- /*.codec_interface */ NULL,
- /*.application_interface */ &conference_application_interface,
- /*.api_interface */ &conf_api_interface,
- /*.file_interface */ NULL,
- /*.speech_interface */ NULL,
- /*.directory_interface */ NULL,
- /*.chat_interface */ &conference_chat_interface
-};
+ for(i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i<CCFNTBL_QTY; i++) {
+ if (!switch_strlen_zero(ccfntbl[i].digits)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing default caller control action '%s' bound to '%s'.\n",
+ ccfntbl[i].key,
+ ccfntbl[i].digits);
+ action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+ if (action != NULL) {
+ action->fndesc = &ccfntbl[i];
+ action->data = NULL;
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, ccfntbl[i].digits, action);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n",
+ ccfntbl[i].key, ccfntbl[i].digits);
+ status = SWITCH_STATUS_MEMERR;
+ }
+ }
+ }
+
-/* create a new conferene with a specific profile */
-static conference_obj_t *conference_new(char *name, switch_xml_t profile, switch_memory_pool_t *pool)
+ return status;
+}
+
+static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t *conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
{
- conference_obj_t *conference;
- switch_xml_t param;
- char *rate_name = NULL;
- char *interval_name = NULL;
- char *timer_name = NULL;
- char *domain = NULL;
- char *tts_engine = NULL;
- char *tts_voice = NULL;
- char *enter_sound = NULL;
- char *exit_sound = NULL;
- char *alone_sound = NULL;
- char *ack_sound = NULL;
- char *nack_sound = NULL;
- char *muted_sound = NULL;
- char *unmuted_sound = NULL;
- char *locked_sound = NULL;
- char *kicked_sound = NULL;
- char *pin = NULL;
- char *pin_sound = NULL;
- char *bad_pin_sound = NULL;
- char *energy_level = NULL;
- char *caller_id_name = NULL;
- char *caller_id_number = NULL;
- uint32_t rate = 8000, interval = 20;
- switch_status_t status;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_xml_t xml_kvp;
- /* Validate the conference name */
- if (switch_strlen_zero(name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
- return NULL;
- }
+ assert(conference != NULL);
+ assert(xml_controls != NULL);
- for (param = switch_xml_child(profile, "param"); param; param = param->next) {
- char *var = (char *) switch_xml_attr_soft(param, "name");
- char *val = (char *) switch_xml_attr_soft(param, "value");
- char buf[128] = "";
- char *p;
+ /* parse the controls tree for caller control digit strings */
+ for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) {
+ char *key = (char *) switch_xml_attr(xml_kvp, "action");
+ char *val = (char *) switch_xml_attr(xml_kvp, "digits");
+ char *data = (char *)switch_xml_attr_soft(xml_kvp, "data");
- if ((p = strchr(var, '_'))) {
- switch_copy_string(buf, var, sizeof(buf));
- for(p = buf; *p; p++) {
- if (*p == '_') {
- *p = '-';
- }
- }
- var = buf;
- }
+ if (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
+ uint32_t i;
- if (!strcasecmp(var, "rate")) {
- rate_name = val;
- } else if (!strcasecmp(var, "domain")) {
- domain = val;
- } else if (!strcasecmp(var, "interval")) {
- interval_name= val;
- } else if (!strcasecmp(var, "timer-name")) {
- timer_name= val;
- } else if (!strcasecmp(var, "tts-engine")) {
- tts_engine= val;
- } else if (!strcasecmp(var, "tts-voice")) {
- tts_voice= val;
- } else if (!strcasecmp(var, "enter-sound")) {
- enter_sound = val;
- } else if (!strcasecmp(var, "exit-sound")) {
- exit_sound = val;
- } else if (!strcasecmp(var, "alone-sound")) {
- alone_sound = val;
- } else if (!strcasecmp(var, "ack-sound")) {
- ack_sound = val;
- } else if (!strcasecmp(var, "nack-sound")) {
- nack_sound = val;
- } else if (!strcasecmp(var, "muted-sound")) {
- muted_sound = val;
- } else if (!strcasecmp(var, "unmuted-sound")) {
- unmuted_sound = val;
- } else if (!strcasecmp(var, "locked-sound")) {
- locked_sound= val;
- } else if (!strcasecmp(var, "kicked-sound")) {
- kicked_sound = val;
- } else if (!strcasecmp(var, "pin")) {
- pin = val;
- } else if (!strcasecmp(var, "pin-sound")) {
- pin_sound = val;
- } else if (!strcasecmp(var, "bad-pin-sound")) {
- bad_pin_sound = val;
- } else if (!strcasecmp(var, "energy-level")) {
- energy_level = val;
- } else if (!strcasecmp(var, "caller-id-name")) {
- caller_id_name = val;
- } else if (!strcasecmp(var, "caller-id-number")) {
- caller_id_number = val;
- }
- }
+ /* scan through all of the valid actions, and if found, */
+ /* set the new caller control action digit string, then */
+ /* stop scanning the table, and go to the next xml kvp. */
+ for(i = 0, status = SWITCH_STATUS_NOOP; i<CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) {
- /* Set defaults and various paramaters */
+ if (strcasecmp(ccfntbl[i].key, key) == 0) {
+ status = SWITCH_STATUS_SUCCESS;
+#ifdef OPTION_IVR_MENU_SUPPORT
+ if (xml_menus != NULL && ccfntbl[i].action == CALLER_CONTROL_MENU) {
+ char *menu_group_name = strdup(data);
+ char *menu_name = (menu_group_name != NULL ? strchr(menu_group_name, '/') : NULL);
- /* Speed in hertz */
- if (!switch_strlen_zero(rate_name)) {
- uint32_t r = atoi(rate_name);
- if (r) {
- rate = r;
- }
- }
+ /* format: "menu_group_name/menu_name" */
+ /* separate the menu name from the menu group */
+ if (menu_name != NULL) {
+ *(menu_name++) = '\0';
+ }
+ /* if there is a menu name, build the menu */
+ if (menu_name != NULL) {
+ caller_control_menu_ctx_t *menu_ctx = NULL;
+ switch_xml_t menu_group = switch_xml_find_child(xml_menus, "group", "name", menu_group_name);
- /* Packet Interval in milliseconds */
- if (!switch_strlen_zero(interval_name)) {
- uint32_t i = atoi(interval_name);
- if (i) {
- interval = i;
- }
- }
+ status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
+ data = (char *)menu_ctx;
+ } else {
+ status = SWITCH_STATUS_FALSE;
+ }
- /* Timer module to use */
- if (switch_strlen_zero(timer_name)) {
- timer_name = "soft";
- }
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to build menu '%s' bound to '%s'\n", data, val);
+ }
- /* Caller ID Name */
- if (switch_strlen_zero(caller_id_name)) {
- caller_id_name = (char *) global_app_name;
- }
+ /* clean up */
+ if (menu_group_name != NULL) {
+ free(menu_group_name);
+ }
+ }
+#endif
- /* Caller ID Number */
- if (switch_strlen_zero(caller_id_number)) {
- caller_id_number = "0000000000";
- }
+ if (status == SWITCH_STATUS_SUCCESS) {
+ caller_control_action_t *action;
- if (!pool) {
- /* Setup a memory pool to use. */
- if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
- status = SWITCH_STATUS_TERM;
- return NULL;
- }
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n", key, val);
+ action = (caller_control_action_t *)switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
+ if (action != NULL) {
+ action->fndesc = &ccfntbl[i];
+ action->data = (void *)data;
+ status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, val, action);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits);
+ status = SWITCH_STATUS_MEMERR;
+ }
+ }
+ }
+ }
+ if (status == SWITCH_STATUS_NOOP) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n", key);
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val);
+ }
+ }
- /* Create the conference object. */
- if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- status = SWITCH_STATUS_TERM;
- return NULL;
- }
+ return status;
+}
- /* initialize the conference object with settings from the specified profile */
- conference->pool = pool;
- conference->timer_name = switch_core_strdup(conference->pool, timer_name);
- conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
- conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
+/* create a new conferene with a specific profile */
+static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
+{
+ conference_obj_t *conference;
+ switch_xml_t xml_kvp;
+ char *rate_name = NULL;
+ char *interval_name = NULL;
+ char *timer_name = NULL;
+ char *domain = NULL;
+ char *tts_engine = NULL;
+ char *tts_voice = NULL;
+ char *enter_sound = NULL;
+ char *exit_sound = NULL;
+ char *alone_sound = NULL;
+ char *ack_sound = NULL;
+ char *nack_sound = NULL;
+ char *muted_sound = NULL;
+ char *unmuted_sound = NULL;
+ char *locked_sound = NULL;
+ char *kicked_sound = NULL;
+ char *pin = NULL;
+ char *pin_sound = NULL;
+ char *bad_pin_sound = NULL;
+ char *energy_level = NULL;
+ char *caller_id_name = NULL;
+ char *caller_id_number = NULL;
+ char *caller_controls = NULL;
+ uint32_t rate = 8000, interval = 20;
+ switch_status_t status;
- conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
- conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
+ /* Validate the conference name */
+ if (switch_strlen_zero(name)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
+ return NULL;
+ }
- if (!switch_strlen_zero(enter_sound)) {
- conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
- }
+ /* parse the profile tree for param values */
+ for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
+ char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
+ char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
+ char buf[128] = "";
+ char *p;
- if (!switch_strlen_zero(exit_sound)) {
- conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
- }
+ if ((p = strchr(var, '_'))) {
+ switch_copy_string(buf, var, sizeof(buf));
+ for(p = buf; *p; p++) {
+ if (*p == '_') {
+ *p = '-';
+ }
+ }
+ var = buf;
+ }
- if (!switch_strlen_zero(ack_sound)) {
- conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
- }
+ if (!strcasecmp(var, "rate")) {
+ rate_name = val;
+ } else if (!strcasecmp(var, "domain")) {
+ domain = val;
+ } else if (!strcasecmp(var, "interval")) {
+ interval_name = val;
+ } else if (!strcasecmp(var, "timer-name")) {
+ timer_name = val;
+ } else if (!strcasecmp(var, "tts-engine")) {
+ tts_engine = val;
+ } else if (!strcasecmp(var, "tts-voice")) {
+ tts_voice = val;
+ } else if (!strcasecmp(var, "enter-sound")) {
+ enter_sound = val;
+ } else if (!strcasecmp(var, "exit-sound")) {
+ exit_sound = val;
+ } else if (!strcasecmp(var, "alone-sound")) {
+ alone_sound = val;
+ } else if (!strcasecmp(var, "ack-sound")) {
+ ack_sound = val;
+ } else if (!strcasecmp(var, "nack-sound")) {
+ nack_sound = val;
+ } else if (!strcasecmp(var, "muted-sound")) {
+ muted_sound = val;
+ } else if (!strcasecmp(var, "unmuted-sound")) {
+ unmuted_sound = val;
+ } else if (!strcasecmp(var, "locked-sound")) {
+ locked_sound = val;
+ } else if (!strcasecmp(var, "kicked-sound")) {
+ kicked_sound = val;
+ } else if (!strcasecmp(var, "pin")) {
+ pin = val;
+ } else if (!strcasecmp(var, "pin-sound")) {
+ pin_sound = val;
+ } else if (!strcasecmp(var, "bad-pin-sound")) {
+ bad_pin_sound = val;
+ } else if (!strcasecmp(var, "energy-level")) {
+ energy_level = val;
+ } else if (!strcasecmp(var, "caller-id-name")) {
+ caller_id_name = val;
+ } else if (!strcasecmp(var, "caller-id-number")) {
+ caller_id_number = val;
+ } else if (!strcasecmp(var, "caller-controls")) {
+ caller_controls = val;
+ }
+ }
- if (!switch_strlen_zero(nack_sound)) {
- conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
- }
+ /* Set defaults and various paramaters */
- if (!switch_strlen_zero(muted_sound)) {
- conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
- }
+ /* Speed in hertz */
+ if (!switch_strlen_zero(rate_name)) {
+ uint32_t r = atoi(rate_name);
+ if (r) {
+ rate = r;
+ }
+ }
- if (!switch_strlen_zero(unmuted_sound)) {
- conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
- }
+ /* Packet Interval in milliseconds */
+ if (!switch_strlen_zero(interval_name)) {
+ uint32_t i = atoi(interval_name);
+ if (i) {
+ interval = i;
+ }
+ }
- if (!switch_strlen_zero(kicked_sound)) {
- conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
- }
+ /* Timer module to use */
+ if (switch_strlen_zero(timer_name)) {
+ timer_name = "soft";
+ }
- if (!switch_strlen_zero(pin_sound)) {
- conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
- }
+ /* Caller ID Name */
+ if (switch_strlen_zero(caller_id_name)) {
+ caller_id_name = (char *) global_app_name;
+ }
- if (!switch_strlen_zero(bad_pin_sound)) {
- conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
- }
+ /* Caller ID Number */
+ if (switch_strlen_zero(caller_id_number)) {
+ caller_id_number = "0000000000";
+ }
- if (!switch_strlen_zero(pin)) {
- conference->pin = switch_core_strdup(conference->pool, pin);
- }
+ if (!pool) {
+ /* Setup a memory pool to use. */
+ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+ status = SWITCH_STATUS_TERM;
+ return NULL;
+ }
+ }
- if (!switch_strlen_zero(alone_sound)) {
- conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
- }
+ /* Create the conference object. */
+ if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ status = SWITCH_STATUS_TERM;
+ return NULL;
+ }
- if (!switch_strlen_zero(locked_sound)) {
- conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
- }
+ /* initialize the conference object with settings from the specified profile */
+ conference->pool = pool;
+ conference->timer_name = switch_core_strdup(conference->pool, timer_name);
+ conference->tts_engine = switch_core_strdup(conference->pool, tts_engine);
+ conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
- if (!switch_strlen_zero(energy_level)) {
- conference->energy_level = atoi(energy_level);
- }
+ conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
+ conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
- conference->name = switch_core_strdup(conference->pool, name);
- if (domain) {
- conference->domain = switch_core_strdup(conference->pool, domain);
- } else {
- conference->domain = "cluecon.com";
- }
- conference->rate = rate;
- conference->interval = interval;
+ if (!switch_strlen_zero(enter_sound)) {
+ conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
+ }
+ if (!switch_strlen_zero(exit_sound)) {
+ conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
+ }
- /* Activate the conference mutex for exclusivity */
- switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
- switch_thread_rwlock_create(&conference->rwlock, conference->pool);
+ if (!switch_strlen_zero(ack_sound)) {
+ conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
+ }
- return conference;
-}
+ if (!switch_strlen_zero(nack_sound)) {
+ conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
+ }
-static void pres_event_handler(switch_event_t *event)
-{
- char *to = switch_event_get_header(event, "to");
- char *dup_to = NULL, *conf_name, *e;
- conference_obj_t *conference;
+ if (!switch_strlen_zero(muted_sound)) {
+ conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
+ }
- if (!to || strncasecmp(to, "conf+", 5)) {
- return;
+ if (!switch_strlen_zero(unmuted_sound)) {
+ conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
}
-
- if (!(dup_to = strdup(to))) {
- return;
+
+ if (!switch_strlen_zero(kicked_sound)) {
+ conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
}
-
- conf_name = dup_to + 5;
- if ((e = strchr(conf_name, '@'))) {
- *e = '\0';
+ if (!switch_strlen_zero(pin_sound)) {
+ conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
}
-
- if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
- switch_event_t *event;
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
- }
- } else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
+ if (!switch_strlen_zero(bad_pin_sound)) {
+ conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
}
- switch_safe_free(dup_to);
-}
+ if (!switch_strlen_zero(pin)) {
+ conference->pin = switch_core_strdup(conference->pool, pin);
+ }
-static void send_presence(switch_event_types_t id)
-{
- switch_xml_t cxml, cfg, advertise, room;
+ if (!switch_strlen_zero(alone_sound)) {
+ conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
+ }
- /* Open the config from the xml registry */
- if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
+ if (!switch_strlen_zero(locked_sound)) {
+ conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
}
- if ((advertise = switch_xml_child(cfg, "advertise"))) {
- for (room = switch_xml_child(advertise, "room"); room; room = room->next) {
- char *name = (char *) switch_xml_attr_soft(room, "name");
- char *status = (char *) switch_xml_attr_soft(room, "status");
- switch_event_t *event;
+ if (!switch_strlen_zero(energy_level)) {
+ conference->energy_level = atoi(energy_level);
+ }
- if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
- switch_event_fire(&event);
+ conference->name = switch_core_strdup(conference->pool, name);
+ if (domain) {
+ conference->domain = switch_core_strdup(conference->pool, domain);
+ } else {
+ conference->domain = "cluecon.com";
+ }
+ conference->rate = rate;
+ conference->interval = interval;
+ conference->dtmf_parser = NULL;
+
+ /* caller control configuration chores */
+ if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
+
+ /* if no controls, or default controls specified, install default */
+ if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) {
+ status = conference_new_install_caller_controls_default(conference);
+ } else if (strcasecmp(caller_controls, "none") != 0) {
+ /* try to build caller control if the group has been specified and != "none" */
+ switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls);
+#ifdef OPTION_IVR_MENU_SUPPORT
+ status = conference_new_install_caller_controls_custom(conference, xml_controls, cfg.menus);
+#else
+ status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL);
+#endif
+ if (status != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", caller_controls);
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n");
}
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n");
}
-
- done:
- /* Release the config registry handle */
- if (cxml) {
- switch_xml_free(cxml);
- cxml = NULL;
- }
+
+ /* Activate the conference mutex for exclusivity */
+ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+ switch_thread_rwlock_create(&conference->rwlock, conference->pool);
+
+ return conference;
}
+static void pres_event_handler(switch_event_t *event)
+{
+ char *to = switch_event_get_header(event, "to");
+ char *dup_to = NULL, *conf_name, *e;
+ conference_obj_t *conference;
+
+ if (!to || strncasecmp(to, "conf+", 5)) {
+ return;
+ }
+
+ if (!(dup_to = strdup(to))) {
+ return;
+ }
+
+ conf_name = dup_to + 5;
+
+ if ((e = strchr(conf_name, '@'))) {
+ *e = '\0';
+ }
+
+ if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+ switch_event_t *event;
+
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
+ } else if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conf_name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
+
+ switch_safe_free(dup_to);
+}
+
+static void send_presence(switch_event_types_t id)
+{
+ switch_xml_t cxml, cfg, advertise, room;
+
+ /* Open the config from the xml registry */
+ if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
+
+ if ((advertise = switch_xml_child(cfg, "advertise"))) {
+ for (room = switch_xml_child(advertise, "room"); room; room = room->next) {
+ char *name = (char *) switch_xml_attr_soft(room, "name");
+ char *status = (char *) switch_xml_attr_soft(room, "status");
+ switch_event_t *event;
+
+ if (name && switch_event_create(&event, id) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status ? status : "Available");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+ switch_event_fire(&event);
+ }
+ }
+ }
+
+ done:
+ /* Release the config registry handle */
+ if (cxml) {
+ switch_xml_free(cxml);
+ cxml = NULL;
+ }
+}
+
/* Called by FreeSWITCH when the module loads */
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ uint32_t i;
+ size_t nl, ol = 0;
+ char *p = NULL;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
- memset(&globals, 0, sizeof(globals));
+ memset(&globals, 0, sizeof(globals));
- /* Connect my internal structure to the blank pointer passed to me */
- *module_interface = &conference_module_interface;
+ /* build api interface help ".syntax" field string */
+ p = strdup("");
+ for (i = 0; i<CONFFUNCAPISIZE; i++) {
+ nl = strlen(conf_api_sub_commands[i].psyntax) + 4;
+ if (p != NULL) {
+ ol = strlen(p);
+ }
+ p = realloc(p, ol+nl);
+ if (p != NULL) {
+ strcat(p, "\t\t");
+ strcat(p, conf_api_sub_commands[i].psyntax);
+ if (i < CONFFUNCAPISIZE-1) {
+ strcat(p, "\n");
+ }
+ }
+
+ }
+ /* install api interface help ".syntax" field string */
+ if (p != NULL) {
+ conf_api_interface.syntax = p;
+ }
- /* create/register custom event message type */
- if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
- return SWITCH_STATUS_TERM;
- }
+ /* Connect my internal structure to the blank pointer passed to me */
+ *module_interface = &conference_module_interface;
- /* Setup the pool */
- if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
- return SWITCH_STATUS_TERM;
- }
+ /* create/register custom event message type */
+ if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!", CONF_EVENT_MAINT);
+ return SWITCH_STATUS_TERM;
+ }
- /* Setup a hash to store conferences by name */
- switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
- switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
- switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
- switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
-
- /* Get presence request events */
- if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
- return SWITCH_STATUS_GENERR;
+ /* Setup the pool */
+ if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
+ return SWITCH_STATUS_TERM;
+ }
- }
+ /* Setup a hash to store conferences by name */
+ switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
+ switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+ switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+ switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
+
+ /* Subscribe to presence request events */
+ if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
+ return SWITCH_STATUS_GENERR;
+ }
+
send_presence(SWITCH_EVENT_PRESENCE_IN);
- globals.running = 1;
- /* indicate that the module should continue to be loaded */
- return status;
+ globals.running = 1;
+ /* indicate that the module should continue to be loaded */
+ return status;
}
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{
+ if (globals.running) {
+ /* signal all threads to shutdown */
+ globals.running = 0;
- if (globals.running) {
- /* signal all threads to shutdown */
- globals.running = 0;
- /* wait for all threads */
- while (globals.threads) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
- switch_yield(100000);
- }
- }
+ /* wait for all threads */
+ while (globals.threads) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for %d threads\n", globals.threads);
+ switch_yield(100000);
+ }
- return SWITCH_STATUS_SUCCESS;
+ /* free api interface help ".syntax" field string */
+ if (conf_api_interface.syntax != NULL) {
+ free((char *)conf_api_interface.syntax);
+ }
+ }
+
+ return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
@@ -3833,5 +4538,5 @@
* c-basic-offset:4
* End:
* For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ * vim:set softtabstop = 4 shiftwidth = 4 tabstop = 4 expandtab:
*/
1
0
21 Dec '06
Author: mikej
Date: Thu Dec 21 15:24:04 2006
New Revision: 3783
Modified:
freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
Log:
send right data type for break
Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c Thu Dec 21 15:24:04 2006
@@ -334,7 +334,7 @@
break;
case SWITCH_SIG_BREAK:
{
- int p = 0;
+ const char p = 0;
switch_size_t len = sizeof(p);
switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, &p, &len);
}
1
0
[commit] r3782 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 21 Dec '06
by Freeswitch SVN 21 Dec '06
21 Dec '06
Author: mikej
Date: Thu Dec 21 12:19:02 2006
New Revision: 3782
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
hand merge r3779
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Thu Dec 21 12:19:02 2006
@@ -912,9 +912,9 @@
switch_event_t *event;
switch_mutex_lock(member->flag_mutex);
- member->energy_level += 100;
- if (member->energy_level > 1200) {
- member->energy_level = 1200;
+ member->energy_level += 200;
+ if (member->energy_level > 3000) {
+ member->energy_level = 3000;
}
switch_mutex_unlock(member->flag_mutex);
1
0
21 Dec '06
Author: mikej
Date: Thu Dec 21 12:11:43 2006
New Revision: 3781
Added:
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
- copied unchanged from r3780, /freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
- copied unchanged from r3780, /freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/freeswitch_python.h
freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
- copied unchanged from r3780, /freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/mod_python.i
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
- copied unchanged from r3780, /freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c.bkp
- copied unchanged from r3780, /freeswitch/branches/jkr888/trunk/src/mod/languages/mod_python/switch_swig_wrap.c.bkp
Modified:
freeswitch/trunk/src/mod/languages/mod_python/Makefile
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
Log:
merge changes to mod_python from jkr888 branch. Thanks Johny.
Modified: freeswitch/trunk/src/mod/languages/mod_python/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/Makefile (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/Makefile Thu Dec 21 12:11:43 2006
@@ -1,24 +1,32 @@
LCFLAGS=-fPIC
CFLAGS += -fPIC -I$(PREFIX)/include/python2.4/
PYMOD=freeswitch
-LDFLAGS=-lpython2.4 -Xlinker -export-dynamic -L$(PREFIX)/lib/python2.4/config/ -lutil
+LDFLAGS=-lpython2.4 -Xlinker -export-dynamic -L$(PREFIX)/lib/python2.4/config/ -lutil -lstdc++
SWIGCFILE=../../../switch_swig.c
SWIGIFILE=../../../switch_swig.i
+CPPCC = g++
+OBJS=freeswitch_python.o mod_python_wrap.o
-all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PYMOD).$(DYNAMIC_LIB_EXTEN)
+#all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PYMOD).$(DYNAMIC_LIB_EXTEN)
+all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(OBJS)
depends:
MAKE=$(MAKE) PY_CFLAGS=-fPIC $(BASE)/build/buildlib.sh $(BASE) install Python-2.4.3.tgz --prefix=$(PREFIX) --enable-threads
+%.o: %.cpp
+ $(CPPCC) -Wall -Werror -fPIC $(CFLAGS) -c -o $@ $<
+
%.o: %.c
$(CC) $(LCFLAGS) $(CFLAGS) -c $< -o $@
-mod_python.c:
+od_python.c:
$(CC) $(LCFLAGS) $(CFLAGS) -c mod_python.c -o mod_python.o
reswig:
- rm -f switch_swig_wrap.c config.m4 CREDITS *${PYMOD}*
- swig -o switch_swig_wrap.c -l$(SWIGIFILE) -ignoremissing -DMULTIPLICITY -python -module $(PYMOD) $(SWIGCFILE)
+ # rm -f switch_swig_wrap.c config.m4 CREDITS *${PYMOD}*
+ # swig -o switch_swig_wrap.c -l$(SWIGIFILE) -ignoremissing -DMULTIPLICITY -python -module $(PYMOD) $(SWIGCFILE)
+ swig -python -shadow -c++ -o mod_python_wrap.cpp mod_python.i
+ # patch -p0 -i fix.diff
switch_swig_wrap.o: switch_swig_wrap.c Makefile
$(CC) -w $(CFLAGS) -c $< -o $@
@@ -27,12 +35,14 @@
$(CC) -w $(CFLAGS) -c $< -o $@
-$(PYMOD).$(DYNAMIC_LIB_EXTEN): $(MODNAME).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o Makefile
- $(CC) $(SOLINK) -o py_$(PYMOD).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o $(LDFLAGS)
+# $(PYMOD).$(DYNAMIC_LIB_EXTEN): $(MODNAME).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o Makefile
+# $(CC) $(SOLINK) -o py_$(PYMOD).$(DYNAMIC_LIB_EXTEN) switch_swig_wrap.o switch_swig.o $(LDFLAGS)
+# $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS) switch_swig_wrap.o switch_swig.o Makefile
+# $(CC) $(LCFLAGS) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o switch_swig_wrap.o switch_swig.o $(OBJS) $(LDFLAGS)
-$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS) switch_swig_wrap.o switch_swig.o Makefile
- $(CC) $(LCFLAGS) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o switch_swig_wrap.o switch_swig.o $(OBJS) $(LDFLAGS)
+$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c $(MODNAME).o $(OBJS) Makefile
+ $(CC) $(LCFLAGS) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(OBJS) $(LDFLAGS)
clean:
rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~
@@ -40,4 +50,5 @@
install:
# cp -f py_$(PYMOD).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
+ cp -f freeswitch.py $(PREFIX)/lib/python2.4/site-packages/
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 Dec 21 12:11:43 2006
@@ -1,10 +1,10 @@
-# This file was created automatically by SWIG.
+# This file was created automatically by SWIG 1.3.27.
# Don't modify this file, modify the SWIG interface instead.
-# This file is compatible with both classic and new-style classes.
import _freeswitch
-def _swig_setattr(self,class_type,name,value):
+# This file is compatible with both classic and new-style classes.
+def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "this"):
if isinstance(value, class_type):
self.__dict__[name] = value.this
@@ -13,8 +13,14 @@
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
- self.__dict__[name] = value
+ if (not static) or hasattr(self,name) or (name == "thisown"):
+ self.__dict__[name] = value
+ else:
+ raise AttributeError("You cannot add attributes to %s" % self)
+def _swig_setattr(self,class_type,name,value):
+ return _swig_setattr_nondynamic(self,class_type,name,value,0)
+
def _swig_getattr(self,class_type,name):
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
@@ -31,55 +37,45 @@
-fs_core_set_globals = _freeswitch.fs_core_set_globals
+PythonDTMFCallback = _freeswitch.PythonDTMFCallback
+class SessionContainer(_object):
+ __swig_setmethods__ = {}
+ __setattr__ = lambda self, name, value: _swig_setattr(self, SessionContainer, name, value)
+ __swig_getmethods__ = {}
+ __getattr__ = lambda self, name: _swig_getattr(self, SessionContainer, name)
+ def __repr__(self):
+ return "<%s.%s; proxy of C++ SessionContainer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
+ def __init__(self, *args):
+ _swig_setattr(self, SessionContainer, 'this', _freeswitch.new_SessionContainer(*args))
+ _swig_setattr(self, SessionContainer, 'thisown', 1)
+ def __del__(self, destroy=_freeswitch.delete_SessionContainer):
+ try:
+ if self.thisown: destroy(self)
+ except: pass
-fs_core_init = _freeswitch.fs_core_init
+ def console_log(*args): return _freeswitch.SessionContainer_console_log(*args)
+ def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args)
+ def answer(*args): return _freeswitch.SessionContainer_answer(*args)
+ def pre_answer(*args): return _freeswitch.SessionContainer_pre_answer(*args)
+ def hangup(*args): return _freeswitch.SessionContainer_hangup(*args)
+ def set_variable(*args): return _freeswitch.SessionContainer_set_variable(*args)
+ def get_variable(*args): return _freeswitch.SessionContainer_get_variable(*args)
+ def set_state(*args): return _freeswitch.SessionContainer_set_state(*args)
+ def play_file(*args): return _freeswitch.SessionContainer_play_file(*args)
+ def set_dtmf_callback(*args): return _freeswitch.SessionContainer_set_dtmf_callback(*args)
+ def speak_text(*args): return _freeswitch.SessionContainer_speak_text(*args)
+ def set_tts_parms(*args): return _freeswitch.SessionContainer_set_tts_parms(*args)
+ def get_digits(*args): return _freeswitch.SessionContainer_get_digits(*args)
+ def transfer(*args): return _freeswitch.SessionContainer_transfer(*args)
+ def play_and_get_digits(*args): return _freeswitch.SessionContainer_play_and_get_digits(*args)
-fs_core_destroy = _freeswitch.fs_core_destroy
+class SessionContainerPtr(SessionContainer):
+ def __init__(self, this):
+ _swig_setattr(self, SessionContainer, 'this', this)
+ if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
+ self.__class__ = SessionContainer
+_freeswitch.SessionContainer_swigregister(SessionContainerPtr)
+cvar = _freeswitch.cvar
-fs_loadable_module_init = _freeswitch.fs_loadable_module_init
-fs_loadable_module_shutdown = _freeswitch.fs_loadable_module_shutdown
-
-fs_console_loop = _freeswitch.fs_console_loop
-
-fs_consol_log = _freeswitch.fs_consol_log
-
-fs_consol_clean = _freeswitch.fs_consol_clean
-
-fs_core_session_locate = _freeswitch.fs_core_session_locate
-
-fs_channel_answer = _freeswitch.fs_channel_answer
-
-fs_channel_pre_answer = _freeswitch.fs_channel_pre_answer
-
-fs_channel_hangup = _freeswitch.fs_channel_hangup
-
-fs_channel_set_variable = _freeswitch.fs_channel_set_variable
-
-fs_channel_get_variable = _freeswitch.fs_channel_get_variable
-
-fs_channel_set_state = _freeswitch.fs_channel_set_state
-
-fs_ivr_play_file = _freeswitch.fs_ivr_play_file
-
-fs_switch_ivr_record_file = _freeswitch.fs_switch_ivr_record_file
-
-fs_switch_ivr_sleep = _freeswitch.fs_switch_ivr_sleep
-
-fs_ivr_play_file2 = _freeswitch.fs_ivr_play_file2
-
-fs_switch_ivr_collect_digits_callback = _freeswitch.fs_switch_ivr_collect_digits_callback
-
-fs_switch_ivr_collect_digits_count = _freeswitch.fs_switch_ivr_collect_digits_count
-
-fs_switch_ivr_originate = _freeswitch.fs_switch_ivr_originate
-
-fs_switch_ivr_session_transfer = _freeswitch.fs_switch_ivr_session_transfer
-
-fs_switch_ivr_speak_text = _freeswitch.fs_switch_ivr_speak_text
-
-fs_switch_channel_get_variable = _freeswitch.fs_switch_channel_get_variable
-
-fs_switch_channel_set_variable = _freeswitch.fs_switch_channel_set_variable
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.c Thu Dec 21 12:11:43 2006
@@ -24,7 +24,7 @@
* Contributor(s):
*
* Brian Fertig <brian.fertig(a)convergencetek.com>
- * Johny Kadarisman <jkr888 at gmail.com>
+ * Johny Kadarisman <jkr888(a)gmail.com>
*
* mod_python.c -- Python Module
*
@@ -43,6 +43,7 @@
#include <switch.h>
void init_freeswitch(void);
+static switch_api_interface_t python_run_interface;
const char modname[] = "mod_python";
@@ -63,11 +64,39 @@
}
+static switch_status_t launch_python(char *text, switch_core_session_t *session, switch_stream_handle_t *stream)
+{
+ FILE* pythonfile;
+
+ if (switch_strlen_zero(text)) {
+ stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ pythonfile = fopen(text, "r");
+
+ Py_Initialize();
+ init_freeswitch();
+ PyRun_SimpleFile(pythonfile, "");
+ Py_Finalize();
+
+ stream->write_function(stream, "OK\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
static const switch_application_interface_t python_application_interface = {
/*.interface_name */ "python",
/*.application_function */ python_function
};
+static switch_api_interface_t python_run_interface = {
+ /*.interface_name */ "python",
+ /*.desc */ "run a python script",
+ /*.function */ launch_python,
+ /*.syntax */ "python </path/to/script>",
+ /*.next */ NULL
+};
+
static switch_loadable_module_interface_t python_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
@@ -75,7 +104,7 @@
/*.dialplan_interface */ NULL,
/*.codec_interface */ NULL,
/*.application_interface */ &python_application_interface,
- /*.api_interface */ NULL,
+ /*.api_interface */ &python_run_interface,
/*.file_interface */ NULL,
/*.speech_interface */ NULL,
/*.directory_interface */ NULL
@@ -110,14 +139,3 @@
/* Return the number of arguments of the application command line */
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:nil
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
- */
Modified: freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c Thu Dec 21 12:11:43 2006
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.21
+ * Version 1.3.27
*
* 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
@@ -9,74 +9,116 @@
* ----------------------------------------------------------------------------- */
#define SWIGPYTHON
-
-#include "Python.h"
-
-/*************************************************************** -*- c -*-
- * python/precommon.swg
+/***********************************************************************
*
- * Rename all exported symbols from common.swg, to avoid symbol
- * clashes if multiple interpreters are included
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
*
************************************************************************/
-#define SWIG_TypeRegister SWIG_Python_TypeRegister
-#define SWIG_TypeCheck SWIG_Python_TypeCheck
-#define SWIG_TypeCast SWIG_Python_TypeCast
-#define SWIG_TypeDynamicCast SWIG_Python_TypeDynamicCast
-#define SWIG_TypeName SWIG_Python_TypeName
-#define SWIG_TypeQuery SWIG_Python_TypeQuery
-#define SWIG_TypeClientData SWIG_Python_TypeClientData
-#define SWIG_PackData SWIG_Python_PackData
-#define SWIG_UnpackData SWIG_Python_UnpackData
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__) || defined(__ICC)
+# define SWIGUNUSED __attribute__ ((unused))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods for Windows DLLs */
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# define SWIGEXPORT
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+
+
+#include <Python.h>
+
/***********************************************************************
- * common.swg
+ * swigrun.swg
*
- * This file contains generic SWIG runtime support for pointer
- * type checking as well as a few commonly used macros to control
- * external linkage.
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
*
- * Author : David Beazley (beazley(a)cs.uchicago.edu)
- *
- * Copyright (c) 1999-2000, The University of Chicago
- *
- * This file may be freely redistributed without license or fee provided
- * this copyright message remains intact.
************************************************************************/
-#include <string.h>
+/* 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 "2"
-#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(_MSC_VER) || defined(__GNUC__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT(a) a
-# define SWIGIMPORT(a) extern a
-# else
-# define SWIGEXPORT(a) __declspec(dllexport) a
-# define SWIGIMPORT(a) extern a
-# endif
-# else
-# if defined(__BORLANDC__)
-# define SWIGEXPORT(a) a _export
-# define SWIGIMPORT(a) a _export
-# else
-# define SWIGEXPORT(a) a
-# define SWIGIMPORT(a) a
-# endif
-# endif
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
-# define SWIGEXPORT(a) a
-# define SWIGIMPORT(a) a
+# define SWIG_TYPE_TABLE_NAME
#endif
-#ifdef SWIG_GLOBAL
-# define SWIGRUNTIME(a) SWIGEXPORT(a)
-#else
-# define SWIGRUNTIME(a) static a
+/*
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+ creating a static or dynamic library from the swig runtime code.
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
+
+ But only do this if is strictly necessary, ie, if you have problems
+ with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
#endif
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+#include <string.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -84,106 +126,141 @@
typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
+/* Structure to store inforomation on one type */
typedef struct swig_type_info {
- const char *name;
- swig_converter_func converter;
- const char *str;
- void *clientdata;
- swig_dycast_func dcast;
- struct swig_type_info *next;
- struct swig_type_info *prev;
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
} swig_type_info;
-#ifdef SWIG_NOINCLUDE
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+} swig_cast_info;
-SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
-SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
-SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
-SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
-SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
-SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
-SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
-SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
-SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+} swig_module_info;
-#else
-static swig_type_info *swig_type_list = 0;
+/*
+ Compare two type names skipping the space characters, therefore
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-/* Register a type mapping with the type-checking */
-SWIGRUNTIME(swig_type_info *)
-SWIG_TypeRegister(swig_type_info *ti) {
- swig_type_info *tc, *head, *ret, *next;
- /* Check to see if this type has already been registered */
- tc = swig_type_list;
- while (tc) {
- if (strcmp(tc->name, ti->name) == 0) {
- /* Already exists in the table. Just add additional types to the list */
- if (tc->clientdata) ti->clientdata = tc->clientdata;
- head = tc;
- next = tc->next;
- goto l1;
- }
- tc = tc->prev;
+ Return 0 when the two name types are equivalent, as in
+ strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+ const char *f2, const char *l2) {
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
+ if (*f1 != *f2) return (int)(*f1 - *f2);
}
- head = ti;
- next = 0;
+ return (l1 - f1) - (l2 - f2);
+}
- /* Place in list */
- ti->prev = swig_type_list;
- swig_type_list = ti;
-
- /* Build linked lists */
- l1:
- ret = head;
- tc = ti + 1;
- /* Patch up the rest of the links */
- while (tc->name) {
- head->next = tc;
- tc->prev = head;
- head = tc;
- tc++;
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne) ++ne;
}
- if (next) next->prev = head;
- head->next = next;
- return ret;
+ return equiv;
}
-/* Check the typename */
-SWIGRUNTIME(swig_type_info *)
-SWIG_TypeCheck(char *c, swig_type_info *ty) {
- swig_type_info *s;
- if (!ty) return 0; /* Void pointer */
- s = ty->next; /* First element always just a name */
- do {
- if (strcmp(s->name,c) == 0) {
- if (s == ty->next) return s;
- /* Move s to the top of the linked list */
- s->prev->next = s->next;
- if (s->next) {
- s->next->prev = s->prev;
- }
- /* Insert s as second element in the list */
- s->next = ty->next;
- if (ty->next) ty->next->prev = s;
- ty->next = s;
- s->prev = ty;
- return s;
+/*
+ Check type equivalence in a name list like <name1>|<name2>|...
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char* te = tb + strlen(tb);
+ const char* ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|') break;
}
- s = s->next;
- } while (s && (s != ty->next));
- return 0;
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne) ++ne;
+ }
+ return equiv;
}
-/* Cast a pointer up an inheritance hierarchy */
-SWIGRUNTIME(void *)
-SWIG_TypeCast(swig_type_info *ty, void *ptr) {
- if ((!ty) || (!ty->converter)) return ptr;
- return (*ty->converter)(ptr);
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty) \
+ if (ty) { \
+ swig_cast_info *iter = ty->cast; \
+ while (iter) { \
+ if (comparison) { \
+ if (iter == ty->cast) return iter; \
+ /* Move iter to the top of the linked list */ \
+ iter->prev->next = iter->next; \
+ if (iter->next) \
+ iter->next->prev = iter->prev; \
+ iter->next = ty->cast; \
+ iter->prev = 0; \
+ if (ty->cast) ty->cast->prev = iter; \
+ ty->cast = iter; \
+ return iter; \
+ } \
+ iter = iter->next; \
+ } \
+ } \
+ return 0
+
+/*
+ Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
}
-/* Dynamic pointer casting. Down an inheritance hierarchy */
-SWIGRUNTIME(swig_type_info *)
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+ SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+ 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);
+}
+
+/*
+ Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
swig_type_info *lastty = ty;
if (!ty || !ty->dcast) return ty;
@@ -194,118 +271,285 @@
return lastty;
}
-/* Return the name associated with this type */
-SWIGRUNTIME(const char *)
+/*
+ Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
return ty->name;
}
-/* Search for a swig_type_info structure */
-SWIGRUNTIME(swig_type_info *)
-SWIG_TypeQuery(const char *name) {
- swig_type_info *ty = swig_type_list;
- while (ty) {
- if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
- if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
- ty = ty->prev;
+/*
+ Return the pretty name associated with this type,
+ that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|') last_name = s+1;
+ return last_name;
}
- return 0;
+ else
+ return type->name;
}
-/* Set the clientdata field for a type */
-SWIGRUNTIME(void)
+/*
+ Set the clientdata field for a type
+*/
+SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_type_info *tc, *equiv;
- if (ti->clientdata == clientdata) return;
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
ti->clientdata = clientdata;
- equiv = ti->next;
- while (equiv) {
- if (!equiv->converter) {
- tc = swig_type_list;
- while (tc) {
- if ((strcmp(tc->name, equiv->name) == 0))
- SWIG_TypeClientData(tc,clientdata);
- tc = tc->prev;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
}
+ }
+ cast = cast->next;
+ }
+}
+
+/*
+ Search for a swig_type_info structure only by mangled name
+ Search is a O(log #types)
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ register size_t l = 0;
+ register size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ register size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ register int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
}
- equiv = equiv->next;
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
+}
+
+/*
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
+ It first searches the mangled names of the types, which is a O(log #types)
+ If a type is not found it then searches the human readable names, which is O(#types).
+
+ We start searching at module start, and finish searching when start == end.
+ Note: if start == end at the beginning of the function, we go all the way around
+ the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+ swig_module_info *end,
+ const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ register size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
}
+
+ /* neither found a match */
+ return 0;
}
-/* Pack binary data into a string */
-SWIGRUNTIME(char *)
-SWIG_PackData(char *c, void *ptr, int sz) {
- static char hex[17] = "0123456789abcdef";
- int i;
- unsigned char *u = (unsigned char *) ptr;
- register unsigned char uu;
- for (i = 0; i < sz; i++,u++) {
- uu = *u;
+
+/*
+ Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ register const unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
return c;
}
-/* Unpack binary data from a string */
-SWIGRUNTIME(char *)
-SWIG_UnpackData(char *c, void *ptr, int sz) {
- register unsigned char uu = 0;
- register int d;
- unsigned char *u = (unsigned char *) ptr;
- int i;
- for (i = 0; i < sz; i++, u++) {
- d = *(c++);
+/*
+ Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ register unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register char d = *(c++);
+ register unsigned char uu = 0;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
+ else
+ return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (d - ('a'-10));
+ else
+ return (char *) 0;
*u = uu;
}
return c;
}
-#endif
+/*
+ Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+ strcpy(r,name);
+ return buff;
+}
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2*sz + 2 + lname) > bsz) return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ if (lname) {
+ strncpy(r,name,lname+1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c,"NULL") == 0) {
+ memset(ptr,0,sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c,ptr,sz);
+}
+
#ifdef __cplusplus
}
#endif
-/***********************************************************************
- * python.swg
- *
- * This file contains the runtime support for Python modules
- * and includes code for managing global variables and pointer
- * type checking.
- *
- * Author : David Beazley (beazley(a)cs.uchicago.edu)
- ************************************************************************/
+/* -----------------------------------------------------------------------------
+ * SWIG API. Portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
-#include "Python.h"
-
#ifdef __cplusplus
extern "C" {
#endif
+/* -----------------------------------------------------------------------------
+ * for internal method declarations
+ * ----------------------------------------------------------------------------- */
+
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/*
+ Exception handling in wrappers
+*/
+#define SWIG_fail goto fail
+#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
+#define SWIG_append_errmsg(msg) SWIG_Python_AddErrMesg(msg,0)
+#define SWIG_preppend_errmsg(msg) SWIG_Python_AddErrMesg(msg,1)
+#define SWIG_type_error(type,obj) SWIG_Python_TypeError(type,obj)
+#define SWIG_null_ref(type) SWIG_Python_NullRef(type)
+
+/*
+ Contract support
+*/
+#define SWIG_contract_assert(expr, msg) \
+ if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
+
+/* -----------------------------------------------------------------------------
+ * Constant declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Constant Types */
#define SWIG_PY_INT 1
#define SWIG_PY_FLOAT 2
#define SWIG_PY_STRING 3
#define SWIG_PY_POINTER 4
#define SWIG_PY_BINARY 5
-/* Flags for pointer conversion */
-
-#define SWIG_POINTER_EXCEPTION 0x1
-#define SWIG_POINTER_DISOWN 0x2
-
-/* Exception handling in wrappers */
-#define SWIG_fail goto fail
-
/* Constant information structure */
typedef struct swig_const_info {
int type;
@@ -316,175 +560,618 @@
swig_type_info **ptype;
} swig_const_info;
+
+/* -----------------------------------------------------------------------------
+ * Alloc. memory flags
+ * ----------------------------------------------------------------------------- */
+#define SWIG_OLDOBJ 1
+#define SWIG_NEWOBJ SWIG_OLDOBJ + 1
+#define SWIG_PYSTR SWIG_NEWOBJ + 1
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/***********************************************************************
+ * pyrun.swg
+ *
+ * This file contains the runtime support for Python modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ *
+ * Author : David Beazley (beazley(a)cs.uchicago.edu)
+ ************************************************************************/
+
/* Common SWIG API */
-#define SWIG_ConvertPtr(obj, pp, type, flags) \
- SWIG_Python_ConvertPtr(obj, pp, type, flags)
-#define SWIG_NewPointerObj(p, type, flags) \
- SWIG_Python_NewPointerObj(p, type, flags)
-#define SWIG_MustGetPtr(p, type, argnum, flags) \
- SWIG_Python_MustGetPtr(p, type, argnum, flags)
+#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags)
+#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
+
/* Python-specific SWIG API */
-#define SWIG_newvarlink() \
- SWIG_Python_newvarlink()
-#define SWIG_addvarlink(p, name, get_attr, set_attr) \
- SWIG_Python_addvarlink(p, name, get_attr, set_attr)
-#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) \
- SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
-#define SWIG_NewPackedObj(ptr, sz, type) \
- SWIG_Python_NewPackedObj(ptr, sz, type)
-#define SWIG_InstallConstants(d, constants) \
- SWIG_Python_InstallConstants(d, constants)
+#define SWIG_ConvertPacked(obj, ptr, sz, ty, flags) SWIG_Python_ConvertPacked(obj, ptr, sz, ty, flags)
+#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
-#ifdef SWIG_NOINCLUDE
+/* Runtime API */
+#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
+#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
-SWIGIMPORT(int) SWIG_Python_ConvertPtr(PyObject *, void **, swig_type_info *, int);
-SWIGIMPORT(PyObject *) SWIG_Python_NewPointerObj(void *, swig_type_info *,int own);
-SWIGIMPORT(void *) SWIG_Python_MustGetPtr(PyObject *, swig_type_info *, int, int);
-SWIGIMPORT(PyObject *) SWIG_Python_newvarlink(void);
-SWIGIMPORT(void) SWIG_Python_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
-SWIGIMPORT(int) SWIG_Python_ConvertPacked(PyObject *, void *, int sz, swig_type_info *, int);
-SWIGIMPORT(PyObject *) SWIG_Python_NewPackedObj(void *, int sz, swig_type_info *);
-SWIGIMPORT(void) SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]);
+/* -----------------------------------------------------------------------------
+ * Pointer declarations
+ * ----------------------------------------------------------------------------- */
+/*
+ Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
+ C/C++ pointers in the python side. Very useful for debugging, but
+ not always safe.
+*/
+#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
+# define SWIG_COBJECT_TYPES
+#endif
-#else
+/* Flags for pointer conversion */
+#define SWIG_POINTER_EXCEPTION 0x1
+#define SWIG_POINTER_DISOWN 0x2
+
+/* Add PyOS_snprintf for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+#define PyOS_snprintf snprintf
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* -----------------------------------------------------------------------------
- * global variable support code.
+ * Create a new pointer string
* ----------------------------------------------------------------------------- */
+#ifndef SWIG_BUFFER_SIZE
+#define SWIG_BUFFER_SIZE 1024
+#endif
-typedef struct swig_globalvar {
- char *name; /* Name of global variable */
- PyObject *(*get_attr)(void); /* Return the current value */
- int (*set_attr)(PyObject *); /* Set the value */
- struct swig_globalvar *next;
-} swig_globalvar;
+/* A crude PyString_FromFormat implementation for old Pythons */
+#if PY_VERSION_HEX < 0x02020000
+static PyObject *
+PyString_FromFormat(const char *fmt, ...) {
+ va_list ap;
+ char buf[SWIG_BUFFER_SIZE * 2];
+ int res;
+ va_start(ap, fmt);
+ res = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ return (res < 0 || res >= sizeof(buf)) ? 0 : PyString_FromString(buf);
+}
+#endif
-typedef struct swig_varlinkobject {
+#if PY_VERSION_HEX < 0x01060000
+#define PyObject_Del(op) PyMem_DEL((op))
+#endif
+
+#if defined(SWIG_COBJECT_TYPES)
+#if !defined(SWIG_COBJECT_PYTHON)
+/* -----------------------------------------------------------------------------
+ * Implements a simple Swig Object type, and use it instead of PyCObject
+ * ----------------------------------------------------------------------------- */
+
+typedef struct {
PyObject_HEAD
- swig_globalvar *vars;
-} swig_varlinkobject;
+ void *ptr;
+ const char *desc;
+} PySwigObject;
-static PyObject *
-swig_varlink_repr(swig_varlinkobject *v) {
- v = v;
- return PyString_FromString("<Global variables>");
-}
+/* Declarations for objects of type PySwigObject */
-static int
-swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
- swig_globalvar *var;
+SWIGRUNTIME int
+PySwigObject_print(PySwigObject *v, FILE *fp, int flags)
+{
+ char result[SWIG_BUFFER_SIZE];
flags = flags;
- fprintf(fp,"Global variables { ");
- for (var = v->vars; var; var=var->next) {
- fprintf(fp,"%s", var->name);
- if (var->next) fprintf(fp,", ");
+ if (SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result))) {
+ fputs("<Swig Object at ", fp); fputs(result, fp); fputs(">", fp);
+ return 0;
+ } else {
+ return 1;
}
- fprintf(fp," }\n");
- return 0;
}
+
+SWIGRUNTIME PyObject *
+PySwigObject_repr(PySwigObject *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
+ PyString_FromFormat("<Swig Object at %s>", result) : 0;
+}
-static PyObject *
-swig_varlink_getattr(swig_varlinkobject *v, char *n) {
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- return (*var->get_attr)();
+SWIGRUNTIME PyObject *
+PySwigObject_str(PySwigObject *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ return SWIG_PackVoidPtr(result, v->ptr, v->desc, sizeof(result)) ?
+ PyString_FromString(result) : 0;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_long(PySwigObject *v)
+{
+ return PyLong_FromVoidPtr(v->ptr);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_format(const char* fmt, PySwigObject *v)
+{
+ PyObject *res = NULL;
+ PyObject *args = PyTuple_New(1);
+ if (args && (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0)) {
+ PyObject *ofmt = PyString_FromString(fmt);
+ if (ofmt) {
+ res = PyString_Format(ofmt,args);
+ Py_DECREF(ofmt);
}
- var = var->next;
+ Py_DECREF(args);
+ }
+ return res;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_oct(PySwigObject *v)
+{
+ return PySwigObject_format("%o",v);
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_hex(PySwigObject *v)
+{
+ return PySwigObject_format("%x",v);
+}
+
+SWIGRUNTIME int
+PySwigObject_compare(PySwigObject *v, PySwigObject *w)
+{
+ int c = strcmp(v->desc, w->desc);
+ if (c) {
+ return (c > 0) ? 1 : -1;
+ } else {
+ void *i = v->ptr;
+ void *j = w->ptr;
+ return (i < j) ? -1 : ((i > j) ? 1 : 0);
}
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- return NULL;
}
-static int
-swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- return (*var->set_attr)(p);
+SWIGRUNTIME void
+PySwigObject_dealloc(PySwigObject *self)
+{
+ PyObject_Del(self);
+}
+
+SWIGRUNTIME PyTypeObject*
+PySwigObject_type(void) {
+ static char pyswigobject_type__doc__[] =
+ "Swig object carries a C/C++ instance pointer";
+
+ static PyNumberMethods PySwigObject_as_number = {
+ (binaryfunc)0, /*nb_add*/
+ (binaryfunc)0, /*nb_subtract*/
+ (binaryfunc)0, /*nb_multiply*/
+ (binaryfunc)0, /*nb_divide*/
+ (binaryfunc)0, /*nb_remainder*/
+ (binaryfunc)0, /*nb_divmod*/
+ (ternaryfunc)0,/*nb_power*/
+ (unaryfunc)0, /*nb_negative*/
+ (unaryfunc)0, /*nb_positive*/
+ (unaryfunc)0, /*nb_absolute*/
+ (inquiry)0, /*nb_nonzero*/
+ 0, /*nb_invert*/
+ 0, /*nb_lshift*/
+ 0, /*nb_rshift*/
+ 0, /*nb_and*/
+ 0, /*nb_xor*/
+ 0, /*nb_or*/
+ (coercion)0, /*nb_coerce*/
+ (unaryfunc)PySwigObject_long, /*nb_int*/
+ (unaryfunc)PySwigObject_long, /*nb_long*/
+ (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
+ 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
+#endif
+ };
+
+ static PyTypeObject pyswigobject_type
+#if !defined(__cplusplus)
+ ;
+ static int type_init = 0;
+ if (!type_init) {
+ PyTypeObject tmp
+#endif
+ = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ (char *)"PySwigObject", /*tp_name*/
+ sizeof(PySwigObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PySwigObject_dealloc, /*tp_dealloc*/
+ (printfunc)PySwigObject_print, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc)PySwigObject_compare, /*tp_compare*/
+ (reprfunc)PySwigObject_repr, /*tp_repr*/
+ &PySwigObject_as_number, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ (hashfunc)0, /*tp_hash*/
+ (ternaryfunc)0, /*tp_call*/
+ (reprfunc)PySwigObject_str, /*tp_str*/
+ /* Space for future expansion */
+ 0,0,0,0,
+ pyswigobject_type__doc__, /* Documentation string */
+#if PY_VERSION_HEX >= 0x02000000
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+#endif
+#if PY_VERSION_HEX >= 0x02010000
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#endif
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+#if !defined(__cplusplus)
+ pyswigobject_type = tmp;
+ type_init = 1;
+ }
+#endif
+ return &pyswigobject_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigObject_FromVoidPtrAndDesc(void *ptr, const char *desc)
+{
+ PySwigObject *self = PyObject_NEW(PySwigObject, PySwigObject_type());
+ if (self) {
+ self->ptr = ptr;
+ self->desc = desc;
+ }
+ return (PyObject *)self;
+}
+
+SWIGRUNTIMEINLINE void *
+PySwigObject_AsVoidPtr(PyObject *self)
+{
+ return ((PySwigObject *)self)->ptr;
+}
+
+SWIGRUNTIMEINLINE const char *
+PySwigObject_GetDesc(PyObject *self)
+{
+ return ((PySwigObject *)self)->desc;
+}
+
+SWIGRUNTIMEINLINE int
+PySwigObject_Check(PyObject *op) {
+ return ((op)->ob_type == PySwigObject_type())
+ || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
+}
+
+/* -----------------------------------------------------------------------------
+ * Implements a simple Swig Packed type, and use it instead of string
+ * ----------------------------------------------------------------------------- */
+
+typedef struct {
+ PyObject_HEAD
+ void *pack;
+ const char *desc;
+ size_t size;
+} PySwigPacked;
+
+SWIGRUNTIME int
+PySwigPacked_print(PySwigPacked *v, FILE *fp, int flags)
+{
+ char result[SWIG_BUFFER_SIZE];
+ flags = flags;
+ fputs("<Swig Packed ", fp);
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ fputs("at ", fp);
+ fputs(result, fp);
+ }
+ fputs(v->desc,fp);
+ fputs(">", fp);
+ return 0;
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_repr(PySwigPacked *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ return PyString_FromFormat("<Swig Packed at %s%s>", result, v->desc);
+ } else {
+ return PyString_FromFormat("<Swig Packed %s>", v->desc);
+ }
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_str(PySwigPacked *v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
+ return PyString_FromFormat("%s%s", result, v->desc);
+ } else {
+ return PyString_FromString(v->desc);
+ }
+}
+
+SWIGRUNTIME int
+PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
+{
+ int c = strcmp(v->desc, w->desc);
+ if (c) {
+ return (c > 0) ? 1 : -1;
+ } else {
+ size_t i = v->size;
+ size_t j = w->size;
+ int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+ return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
+ }
+}
+
+SWIGRUNTIME void
+PySwigPacked_dealloc(PySwigPacked *self)
+{
+ free(self->pack);
+ PyObject_Del(self);
+}
+
+SWIGRUNTIME PyTypeObject*
+PySwigPacked_type(void) {
+ static char pyswigpacked_type__doc__[] =
+ "Swig object carries a C/C++ instance pointer";
+ static PyTypeObject pyswigpacked_type
+#if !defined(__cplusplus)
+ ;
+ static int type_init = 0;
+ if (!type_init) {
+ PyTypeObject tmp
+#endif
+ = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /*ob_size*/
+ (char *)"PySwigPacked", /*tp_name*/
+ sizeof(PySwigPacked), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PySwigPacked_dealloc, /*tp_dealloc*/
+ (printfunc)PySwigPacked_print, /*tp_print*/
+ (getattrfunc)0, /*tp_getattr*/
+ (setattrfunc)0, /*tp_setattr*/
+ (cmpfunc)PySwigPacked_compare, /*tp_compare*/
+ (reprfunc)PySwigPacked_repr, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ (hashfunc)0, /*tp_hash*/
+ (ternaryfunc)0, /*tp_call*/
+ (reprfunc)PySwigPacked_str, /*tp_str*/
+ /* Space for future expansion */
+ 0,0,0,0,
+ pyswigpacked_type__doc__, /* Documentation string */
+#if PY_VERSION_HEX >= 0x02000000
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+#endif
+#if PY_VERSION_HEX >= 0x02010000
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#endif
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+#if !defined(__cplusplus)
+ pyswigpacked_type = tmp;
+ type_init = 1;
+ }
+#endif
+ return &pyswigpacked_type;
+}
+
+SWIGRUNTIME PyObject *
+PySwigPacked_FromDataAndDesc(void *ptr, size_t size, const char *desc)
+{
+ PySwigPacked *self = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+ if (self == NULL) {
+ return NULL;
+ } else {
+ void *pack = malloc(size);
+ if (pack) {
+ memcpy(pack, ptr, size);
+ self->pack = pack;
+ self->desc = desc;
+ self->size = size;
+ return (PyObject *) self;
}
- var = var->next;
+ return NULL;
}
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- return 1;
}
-statichere PyTypeObject varlinktype = {
- PyObject_HEAD_INIT(0)
- 0,
- (char *)"swigvarlink", /* Type name */
- sizeof(swig_varlinkobject), /* Basic size */
- 0, /* Itemsize */
- 0, /* Deallocator */
- (printfunc) swig_varlink_print, /* Print */
- (getattrfunc) swig_varlink_getattr, /* get attr */
- (setattrfunc) swig_varlink_setattr, /* Set attr */
- 0, /* tp_compare */
- (reprfunc) swig_varlink_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_mapping*/
- 0, /* tp_hash */
-};
+SWIGRUNTIMEINLINE const char *
+PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+{
+ PySwigPacked *self = (PySwigPacked *)obj;
+ if (self->size != size) return 0;
+ memcpy(ptr, self->pack, size);
+ return self->desc;
+}
-/* Create a variable linking object for use later */
-SWIGRUNTIME(PyObject *)
-SWIG_Python_newvarlink(void) {
- swig_varlinkobject *result = 0;
- result = PyMem_NEW(swig_varlinkobject,1);
- varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
- result->ob_type = &varlinktype;
- result->vars = 0;
- result->ob_refcnt = 0;
- Py_XINCREF((PyObject *) result);
- return ((PyObject*) result);
+SWIGRUNTIMEINLINE const char *
+PySwigPacked_GetDesc(PyObject *self)
+{
+ return ((PySwigPacked *)self)->desc;
}
-SWIGRUNTIME(void)
-SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
- swig_varlinkobject *v;
- swig_globalvar *gv;
- v= (swig_varlinkobject *) p;
- gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
- gv->name = (char *) malloc(strlen(name)+1);
- strcpy(gv->name,name);
- gv->get_attr = get_attr;
- gv->set_attr = set_attr;
- gv->next = v->vars;
- v->vars = gv;
+SWIGRUNTIMEINLINE int
+PySwigPacked_Check(PyObject *op) {
+ return ((op)->ob_type == PySwigPacked_type())
+ || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
}
+#else
+/* -----------------------------------------------------------------------------
+ * Use the old Python PyCObject instead of PySwigObject
+ * ----------------------------------------------------------------------------- */
+
+#define PySwigObject_GetDesc(obj) PyCObject_GetDesc(obj)
+#define PySwigObject_Check(obj) PyCObject_Check(obj)
+#define PySwigObject_AsVoidPtr(obj) PyCObject_AsVoidPtr(obj)
+#define PySwigObject_FromVoidPtrAndDesc(p, d) PyCObject_FromVoidPtrAndDesc(p, d, NULL)
+
+#endif
+
+#endif
+
+/* -----------------------------------------------------------------------------
+ * errors manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGRUNTIME void
+SWIG_Python_TypeError(const char *type, PyObject *obj)
+{
+ if (type) {
+#if defined(SWIG_COBJECT_TYPES)
+ if (obj && PySwigObject_Check(obj)) {
+ const char *otype = (const char *) PySwigObject_GetDesc(obj);
+ if (otype) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
+ type, otype);
+ return;
+ }
+ } else
+#endif
+ {
+ const char *otype = (obj ? obj->ob_type->tp_name : 0);
+ if (otype) {
+ PyObject *str = PyObject_Str(obj);
+ const char *cstr = str ? PyString_AsString(str) : 0;
+ if (cstr) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
+ type, otype, cstr);
+ } else {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
+ type, otype);
+ }
+ Py_XDECREF(str);
+ return;
+ }
+ }
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
+ } else {
+ PyErr_Format(PyExc_TypeError, "unexpected type is received");
+ }
+}
+
+SWIGRUNTIMEINLINE void
+SWIG_Python_NullRef(const char *type)
+{
+ if (type) {
+ PyErr_Format(PyExc_TypeError, "null reference of type '%s' was received",type);
+ } else {
+ PyErr_Format(PyExc_TypeError, "null reference was received");
+ }
+}
+
+SWIGRUNTIME int
+SWIG_Python_AddErrMesg(const char* mesg, int infront)
+{
+ if (PyErr_Occurred()) {
+ PyObject *type = 0;
+ PyObject *value = 0;
+ PyObject *traceback = 0;
+ PyErr_Fetch(&type, &value, &traceback);
+ if (value) {
+ PyObject *old_str = PyObject_Str(value);
+ Py_XINCREF(type);
+ PyErr_Clear();
+ if (infront) {
+ PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+ } else {
+ PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+ }
+ Py_DECREF(old_str);
+ }
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+SWIGRUNTIME int
+SWIG_Python_ArgFail(int argnum)
+{
+ if (PyErr_Occurred()) {
+ /* add information about failing argument */
+ char mesg[256];
+ PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+ return SWIG_Python_AddErrMesg(mesg, 1);
+ } else {
+ return 0;
+ }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
/* Convert a pointer value */
-SWIGRUNTIME(int)
+SWIGRUNTIME int
SWIG_Python_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags) {
- swig_type_info *tc;
- char *c = 0;
+ swig_cast_info *tc;
+ const char *c = 0;
static PyObject *SWIG_this = 0;
int newref = 0;
PyObject *pyobj = 0;
-
+ void *vptr;
+
if (!obj) return 0;
if (obj == Py_None) {
*ptr = 0;
return 0;
}
+
#ifdef SWIG_COBJECT_TYPES
- if (!(PyCObject_Check(obj))) {
+ if (!(PySwigObject_Check(obj))) {
if (!SWIG_this)
SWIG_this = PyString_FromString("this");
pyobj = obj;
obj = PyObject_GetAttr(obj,SWIG_this);
newref = 1;
if (!obj) goto type_error;
- if (!PyCObject_Check(obj)) {
+ if (!PySwigObject_Check(obj)) {
Py_DECREF(obj);
goto type_error;
}
}
- *ptr = PyCObject_AsVoidPtr(obj);
- c = (char *) PyCObject_GetDesc(obj);
- if (newref) Py_DECREF(obj);
- goto cobject;
+ vptr = PySwigObject_AsVoidPtr(obj);
+ c = (const char *) PySwigObject_GetDesc(obj);
+ if (newref) { Py_DECREF(obj); }
+ goto type_check;
#else
if (!(PyString_Check(obj))) {
if (!SWIG_this)
@@ -500,72 +1187,78 @@
}
c = PyString_AsString(obj);
/* Pointer values must start with leading underscore */
- if (*c != '_') {
- *ptr = (void *) 0;
- if (strcmp(c,"NULL") == 0) {
- if (newref) { Py_DECREF(obj); }
- return 0;
- } else {
- if (newref) { Py_DECREF(obj); }
- goto type_error;
- }
- }
- c++;
- c = SWIG_UnpackData(c,ptr,sizeof(void *));
+ c = SWIG_UnpackVoidPtr(c, &vptr, ty->name);
if (newref) { Py_DECREF(obj); }
+ if (!c) goto type_error;
#endif
-#ifdef SWIG_COBJECT_TYPES
-cobject:
-#endif
-
+type_check:
if (ty) {
tc = SWIG_TypeCheck(c,ty);
if (!tc) goto type_error;
- *ptr = SWIG_TypeCast(tc,(void*) *ptr);
+ *ptr = SWIG_TypeCast(tc,vptr);
+ } else {
+ *ptr = vptr;
}
-
if ((pyobj) && (flags & SWIG_POINTER_DISOWN)) {
- PyObject *zero = PyInt_FromLong(0);
- PyObject_SetAttrString(pyobj,(char*)"thisown",zero);
- Py_DECREF(zero);
+ PyObject_SetAttrString(pyobj,(char*)"thisown",Py_False);
}
return 0;
type_error:
+ PyErr_Clear();
+ if (pyobj && !obj) {
+ obj = pyobj;
+ if (PyCFunction_Check(obj)) {
+ /* here we get the method pointer for callbacks */
+ char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+ c = doc ? strstr(doc, "swig_ptr: ") : 0;
+ if (c) {
+ c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0;
+ if (!c) goto type_error;
+ goto type_check;
+ }
+ }
+ }
if (flags & SWIG_POINTER_EXCEPTION) {
- if (ty && c) {
- char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
- sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
- PyErr_SetString(PyExc_TypeError, temp);
- free((char *) temp);
+ if (ty) {
+ SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
} else {
- PyErr_SetString(PyExc_TypeError,"Expected a pointer");
+ SWIG_Python_TypeError("C/C++ pointer", obj);
}
}
return -1;
}
/* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME(void *)
+SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
void *result;
- SWIG_Python_ConvertPtr(obj, &result, ty, flags | SWIG_POINTER_EXCEPTION);
+ if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+ PyErr_Clear();
+ if (flags & SWIG_POINTER_EXCEPTION) {
+ SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+ SWIG_Python_ArgFail(argnum);
+ }
+ }
return result;
}
/* Convert a packed value value */
-SWIGRUNTIME(int)
-SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
- swig_type_info *tc;
- char *c = 0;
+SWIGRUNTIME int
+SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty, int flags) {
+ swig_cast_info *tc;
+ const char *c = 0;
+#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON)
+ c = PySwigPacked_UnpackData(obj, ptr, sz);
+#else
if ((!obj) || (!PyString_Check(obj))) goto type_error;
c = PyString_AsString(obj);
/* Pointer values must start with leading underscore */
- if (*c != '_') goto type_error;
- c++;
- c = SWIG_UnpackData(c,ptr,sz);
+ c = SWIG_UnpackDataName(c, ptr, sz, ty->name);
+#endif
+ if (!c) goto type_error;
if (ty) {
tc = SWIG_TypeCheck(c,ty);
if (!tc) goto type_error;
@@ -573,38 +1266,38 @@
return 0;
type_error:
-
- if (flags) {
- if (ty && c) {
- char *temp = (char *) malloc(64+strlen(ty->name)+strlen(c));
- sprintf(temp,"Type error. Got %s, expected %s", c, ty->name);
- PyErr_SetString(PyExc_TypeError, temp);
- free((char *) temp);
+ PyErr_Clear();
+ if (flags & SWIG_POINTER_EXCEPTION) {
+ if (ty) {
+ SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
} else {
- PyErr_SetString(PyExc_TypeError,"Expected a pointer");
+ SWIG_Python_TypeError("C/C++ packed data", obj);
}
}
return -1;
-}
+}
-/* Create a new pointer object */
-SWIGRUNTIME(PyObject *)
+/* Create a new array object */
+SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int own) {
- PyObject *robj;
+ PyObject *robj = 0;
+ if (!type) {
+ if (!PyErr_Occurred()) {
+ PyErr_Format(PyExc_TypeError, "Swig: null type passed to NewPointerObj");
+ }
+ return robj;
+ }
if (!ptr) {
Py_INCREF(Py_None);
return Py_None;
}
#ifdef SWIG_COBJECT_TYPES
- robj = PyCObject_FromVoidPtrAndDesc((void *) ptr, (char *) type->name, NULL);
+ robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)type->name);
#else
{
- char result[1024];
- char *r = result;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- strcpy(r,type->name);
- robj = PyString_FromString(result);
+ char result[SWIG_BUFFER_SIZE];
+ robj = SWIG_PackVoidPtr(result, ptr, type->name, sizeof(result)) ?
+ PyString_FromString(result) : 0;
}
#endif
if (!robj || (robj == Py_None)) return robj;
@@ -616,9 +1309,7 @@
Py_DECREF(args);
if (inst) {
if (own) {
- PyObject *n = PyInt_FromLong(1);
- PyObject_SetAttrString(inst,(char*)"thisown",n);
- Py_DECREF(n);
+ PyObject_SetAttrString(inst,(char*)"thisown",Py_True);
}
robj = inst;
}
@@ -626,55 +1317,95 @@
return robj;
}
-SWIGRUNTIME(PyObject *)
-SWIG_Python_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
- char result[1024];
- char *r = result;
- if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- strcpy(r,type->name);
- return PyString_FromString(result);
+SWIGRUNTIME PyObject *
+SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
+ PyObject *robj = 0;
+ if (!ptr) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+#if defined(SWIG_COBJECT_TYPES) && !defined(SWIG_COBJECT_PYTHON)
+ robj = PySwigPacked_FromDataAndDesc((void *) ptr, sz, (char *)type->name);
+#else
+ {
+ char result[SWIG_BUFFER_SIZE];
+ robj = SWIG_PackDataName(result, ptr, sz, type->name, sizeof(result)) ?
+ PyString_FromString(result) : 0;
+ }
+#endif
+ return robj;
}
-/* Install Constants */
-SWIGRUNTIME(void)
-SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
- int i;
- PyObject *obj;
- for (i = 0; constants[i].type; i++) {
- switch(constants[i].type) {
- case SWIG_PY_INT:
- obj = PyInt_FromLong(constants[i].lvalue);
- break;
- case SWIG_PY_FLOAT:
- obj = PyFloat_FromDouble(constants[i].dvalue);
- break;
- case SWIG_PY_STRING:
- obj = PyString_FromString((char *) constants[i].pvalue);
- break;
- case SWIG_PY_POINTER:
- obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
- break;
- case SWIG_PY_BINARY:
- obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
- break;
- default:
- obj = 0;
- break;
+/* -----------------------------------------------------------------------------*
+ * Get type list
+ * -----------------------------------------------------------------------------*/
+
+#ifdef SWIG_LINK_RUNTIME
+void *SWIG_ReturnGlobalTypeList(void *);
+#endif
+
+SWIGRUNTIME swig_module_info *
+SWIG_Python_GetModule(void) {
+ static void *type_pointer = (void *)0;
+ /* first check if module already created */
+ if (!type_pointer) {
+#ifdef SWIG_LINK_RUNTIME
+ type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+#else
+ type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ type_pointer = (void *)0;
}
- if (obj) {
- PyDict_SetItemString(d,constants[i].name,obj);
- Py_DECREF(obj);
- }
+#endif
}
+ return (swig_module_info *) type_pointer;
}
+#if PY_MAJOR_VERSION < 2
+/* PyModule_AddObject function was introduced in Python 2.0. The following function
+is copied out of Python/modsupport.c in python version 2.3.4 */
+SWIGINTERN int
+PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+{
+ PyObject *dict;
+ if (!PyModule_Check(m)) {
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs module as first arg");
+ return -1;
+ }
+ if (!o) {
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs non-NULL value");
+ return -1;
+ }
+
+ dict = PyModule_GetDict(m);
+ if (dict == NULL) {
+ /* Internal error -- modules must have a dict! */
+ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
+ PyModule_GetName(m));
+ return -1;
+ }
+ if (PyDict_SetItemString(dict, name, o))
+ return -1;
+ Py_DECREF(o);
+ return 0;
+}
#endif
-/* Contract support */
+SWIGRUNTIME void
+SWIG_Python_SetModule(swig_module_info *swig_module) {
+ static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { PyErr_SetString(PyExc_RuntimeError, (char *) msg ); goto fail; } else
+ PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
+ swig_empty_runtime_method_table);
+ PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, NULL);
+ if (pointer && module) {
+ PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+ }
+}
#ifdef __cplusplus
}
@@ -683,13 +1414,19 @@
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_switch_channel_t swig_types[0]
-#define SWIGTYPE_p_switch_file_handle_t swig_types[1]
-#define SWIGTYPE_p_switch_core_session_t swig_types[2]
-#define SWIGTYPE_p_p_switch_core_session_t swig_types[3]
-#define SWIGTYPE_p_uint32_t swig_types[4]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[5]
-static swig_type_info *swig_types[7];
+#define SWIGTYPE_p_char swig_types[0]
+#define SWIGTYPE_p_p_switch_core_session_t swig_types[1]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[2]
+#define SWIGTYPE_p_switch_channel_t swig_types[3]
+#define SWIGTYPE_p_switch_core_session_t swig_types[4]
+#define SWIGTYPE_p_switch_file_handle_t swig_types[5]
+#define SWIGTYPE_p_switch_input_callback_function_t swig_types[6]
+#define SWIGTYPE_ptrdiff_t swig_types[7]
+#define SWIGTYPE_size_t swig_types[8]
+static swig_type_info *swig_types[10];
+static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
/* -------- TYPES TABLE (END) -------- */
@@ -700,40 +1437,180 @@
#define SWIG_init init_freeswitch
#define SWIG_name "_freeswitch"
-extern void fs_core_set_globals(void);
-extern int fs_core_init(char *);
-extern int fs_core_destroy(void);
-extern int fs_loadable_module_init(void);
-extern int fs_loadable_module_shutdown(void);
-extern int fs_console_loop(void);
-extern void fs_consol_log(char *,char *);
-extern void fs_consol_clean(char *);
-extern switch_core_session_t *fs_core_session_locate(char *);
-extern void fs_channel_answer(switch_core_session_t *);
-extern void fs_channel_pre_answer(switch_core_session_t *);
-extern void fs_channel_hangup(switch_core_session_t *,char *);
-extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
-extern void fs_channel_get_variable(switch_core_session_t *,char *);
-extern void fs_channel_set_state(switch_core_session_t *,char *);
-extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
-extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
-extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
-extern int fs_ivr_play_file2(switch_core_session_t *,char *);
-extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
-extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
-extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
-extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
-extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
-extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
-extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
+/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize)
+{
+ static swig_type_info* pchar_info = 0;
+ char* vptr = 0;
+ if (!pchar_info) pchar_info = SWIG_TypeQuery("char *");
+ if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) {
+ if (cptr) *cptr = vptr;
+ if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+ return SWIG_OLDOBJ;
+ } else {
+ PyErr_Clear();
+ if (PyString_Check(obj)) {
+ if (cptr) {
+ *cptr = PyString_AS_STRING(obj);
+ if (psize) {
+ *psize = PyString_GET_SIZE(obj) + 1;
+ }
+ }
+ return SWIG_PYSTR;
+ }
+ }
+ if (cptr) {
+ SWIG_type_error("char *", obj);
+ }
+ return 0;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsCharPtr(PyObject *obj, char **val)
+{
+ if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) {
+ return 1;
+ }
+ if (val) {
+ PyErr_Clear();
+ SWIG_type_error("char *", obj);
+ }
+ return 0;
+}
+
+
+ /*@/usr/share/swig1.3/python/pymacros.swg,72,SWIG_define@*/
+#define SWIG_From_int PyInt_FromLong
+/*@@*/
+
+
+#include <limits.h>
+
+
+SWIGINTERNINLINE int
+ SWIG_CheckUnsignedLongInRange(unsigned long value,
+ unsigned long max_value,
+ const char *errmsg)
+{
+ if (value > max_value) {
+ if (errmsg) {
+ PyErr_Format(PyExc_OverflowError,
+ "value %lu is greater than '%s' minimum %lu",
+ value, errmsg, max_value);
+ }
+ return 0;
+ }
+ return 1;
+ }
+
+
+SWIGINTERN int
+ SWIG_AsVal_unsigned_SS_long(PyObject *obj, unsigned long *val)
+{
+ if (PyLong_Check(obj)) {
+ unsigned long v = PyLong_AsUnsignedLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val) *val = v;
+ return 1;
+ } else {
+ if (!val) PyErr_Clear();
+ return 0;
+ }
+ }
+ if (PyInt_Check(obj)) {
+ long v = PyInt_AsLong(obj);
+ if (v >= 0) {
+ if (val) *val = v;
+ return 1;
+ }
+ }
+ if (val) {
+ SWIG_type_error("unsigned long", obj);
+ }
+ return 0;
+}
+
+
+#if UINT_MAX != ULONG_MAX
+SWIGINTERN int
+ SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val)
+{
+ const char* errmsg = val ? "unsigned int" : (char*)0;
+ unsigned long v;
+ if (SWIG_AsVal_unsigned_SS_long(obj, &v)) {
+ if (SWIG_CheckUnsignedLongInRange(v, INT_MAX, errmsg)) {
+ if (val) *val = (unsigned int)(v);
+ return 1;
+ }
+ } else {
+ PyErr_Clear();
+ }
+ if (val) {
+ SWIG_type_error(errmsg, obj);
+ }
+ return 0;
+}
+#else
+SWIGINTERNINLINE unsigned int
+ SWIG_AsVal_unsigned_SS_int(PyObject *obj, unsigned int *val)
+{
+ return SWIG_AsVal_unsigned_SS_long(obj,(unsigned long *)val);
+}
+#endif
+
+
+SWIGINTERNINLINE unsigned int
+SWIG_As_unsigned_SS_int(PyObject* obj)
+{
+ unsigned int v;
+ if (!SWIG_AsVal_unsigned_SS_int(obj, &v)) {
+ /*
+ this is needed to make valgrind/purify happier.
+ */
+ memset((void*)&v, 0, sizeof(unsigned int));
+ }
+ return v;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_Check_unsigned_SS_int(PyObject* obj)
+{
+ return SWIG_AsVal_unsigned_SS_int(obj, (unsigned int*)0);
+}
+
+
+SWIGINTERN PyObject *
+SWIG_FromCharPtr(const char* cptr)
+{
+ if (cptr) {
+ size_t size = strlen(cptr);
+ if (size > INT_MAX) {
+ return SWIG_NewPointerObj((char*)(cptr),
+ SWIG_TypeQuery("char *"), 0);
+ } else {
+ if (size != 0) {
+ return PyString_FromStringAndSize(cptr, size);
+ } else {
+ return PyString_FromString(cptr);
+ }
+ }
+ }
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
#include "switch.h"
#ifdef __cplusplus
extern "C" {
#endif
static PyObject *_wrap_fs_core_set_globals(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
if(!PyArg_ParseTuple(args,(char *)":fs_core_set_globals")) goto fail;
fs_core_set_globals();
@@ -746,14 +1623,20 @@
static PyObject *_wrap_fs_core_init(PyObject *self, PyObject *args) {
- PyObject *resultobj;
- char *arg1 ;
+ PyObject *resultobj = NULL;
+ char *arg1 = (char *) 0 ;
int result;
+ PyObject * obj0 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"s:fs_core_init",&arg1)) goto fail;
+ if(!PyArg_ParseTuple(args,(char *)"O:fs_core_init",&obj0)) goto fail;
+ if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) {
+ SWIG_arg_fail(1);SWIG_fail;
+ }
result = (int)fs_core_init(arg1);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -761,13 +1644,15 @@
static PyObject *_wrap_fs_core_destroy(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
int result;
if(!PyArg_ParseTuple(args,(char *)":fs_core_destroy")) goto fail;
result = (int)fs_core_destroy();
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -775,13 +1660,15 @@
static PyObject *_wrap_fs_loadable_module_init(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
int result;
if(!PyArg_ParseTuple(args,(char *)":fs_loadable_module_init")) goto fail;
result = (int)fs_loadable_module_init();
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -789,13 +1676,15 @@
static PyObject *_wrap_fs_loadable_module_shutdown(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
int result;
if(!PyArg_ParseTuple(args,(char *)":fs_loadable_module_shutdown")) goto fail;
result = (int)fs_loadable_module_shutdown();
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -803,26 +1692,36 @@
static PyObject *_wrap_fs_console_loop(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
int result;
if(!PyArg_ParseTuple(args,(char *)":fs_console_loop")) goto fail;
result = (int)fs_console_loop();
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
}
-static PyObject *_wrap_fs_consol_log(PyObject *self, PyObject *args) {
- PyObject *resultobj;
- char *arg1 ;
- char *arg2 ;
+static PyObject *_wrap_fs_console_log(PyObject *self, PyObject *args) {
+ PyObject *resultobj = NULL;
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"ss:fs_consol_log",&arg1,&arg2)) goto fail;
- fs_consol_log(arg1,arg2);
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_console_log",&obj0,&obj1)) goto fail;
+ if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) {
+ SWIG_arg_fail(1);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ fs_console_log(arg1,arg2);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
@@ -831,12 +1730,16 @@
}
-static PyObject *_wrap_fs_consol_clean(PyObject *self, PyObject *args) {
- PyObject *resultobj;
- char *arg1 ;
+static PyObject *_wrap_fs_console_clean(PyObject *self, PyObject *args) {
+ PyObject *resultobj = NULL;
+ char *arg1 = (char *) 0 ;
+ PyObject * obj0 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"s:fs_consol_clean",&arg1)) goto fail;
- fs_consol_clean(arg1);
+ if(!PyArg_ParseTuple(args,(char *)"O:fs_console_clean",&obj0)) goto fail;
+ if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) {
+ SWIG_arg_fail(1);SWIG_fail;
+ }
+ fs_console_clean(arg1);
Py_INCREF(Py_None); resultobj = Py_None;
return resultobj;
@@ -846,14 +1749,18 @@
static PyObject *_wrap_fs_core_session_locate(PyObject *self, PyObject *args) {
- PyObject *resultobj;
- char *arg1 ;
+ PyObject *resultobj = NULL;
+ char *arg1 = (char *) 0 ;
switch_core_session_t *result;
+ PyObject * obj0 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"s:fs_core_session_locate",&arg1)) goto fail;
+ if(!PyArg_ParseTuple(args,(char *)"O:fs_core_session_locate",&obj0)) goto fail;
+ if (!SWIG_AsCharPtr(obj0, (char**)&arg1)) {
+ SWIG_arg_fail(1);SWIG_fail;
+ }
result = (switch_core_session_t *)fs_core_session_locate(arg1);
- resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_switch_core_session_t, 0);
+ resultobj = SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_switch_core_session_t, 0);
return resultobj;
fail:
return NULL;
@@ -861,12 +1768,13 @@
static PyObject *_wrap_fs_channel_answer(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"O:fs_channel_answer",&obj0)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
fs_channel_answer(arg1);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -877,12 +1785,13 @@
static PyObject *_wrap_fs_channel_pre_answer(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"O:fs_channel_pre_answer",&obj0)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
fs_channel_pre_answer(arg1);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -893,13 +1802,18 @@
static PyObject *_wrap_fs_channel_hangup(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Os:fs_channel_hangup",&obj0,&arg2)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_channel_hangup",&obj0,&obj1)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
fs_channel_hangup(arg1,arg2);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -910,14 +1824,23 @@
static PyObject *_wrap_fs_channel_set_variable(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
- char *arg3 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Oss:fs_channel_set_variable",&obj0,&arg2,&arg3)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOO:fs_channel_set_variable",&obj0,&obj1,&obj2)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
fs_channel_set_variable(arg1,arg2,arg3);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -928,13 +1851,18 @@
static PyObject *_wrap_fs_channel_get_variable(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Os:fs_channel_get_variable",&obj0,&arg2)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_channel_get_variable",&obj0,&obj1)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
fs_channel_get_variable(arg1,arg2);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -945,13 +1873,18 @@
static PyObject *_wrap_fs_channel_set_state(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Os:fs_channel_set_state",&obj0,&arg2)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_channel_set_state",&obj0,&obj1)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
fs_channel_set_state(arg1,arg2);
Py_INCREF(Py_None); resultobj = Py_None;
@@ -962,30 +1895,54 @@
static PyObject *_wrap_fs_ivr_play_file(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
- char *arg3 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
switch_input_callback_function_t arg4 ;
void *arg5 = (void *) 0 ;
unsigned int arg6 ;
int result;
- switch_input_callback_function_t *argp4 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
PyObject * obj5 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"OssOOO:fs_ivr_play_file",&obj0,&arg2,&arg3,&obj3,&obj4,&obj5)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj3,(void **) &argp4, SWIGTYPE_p_switch_input_callback_function_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg4 = *argp4;
- if ((SWIG_ConvertPtr(obj4,(void **) &arg5, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- arg6 = (unsigned int) PyInt_AsLong(obj5);
- if (PyErr_Occurred()) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOOOOO:fs_ivr_play_file",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ {
+ switch_input_callback_function_t * argp;
+ SWIG_Python_ConvertPtr(obj3, (void **)&argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ if (argp == NULL) {
+ SWIG_null_ref("switch_input_callback_function_t");
+ }
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ arg4 = *argp;
+ }
+ {
+ if ((SWIG_ConvertPtr(obj4,(void **)(&arg5),0,SWIG_POINTER_EXCEPTION|0))== -1) {
+ SWIG_arg_fail(5);SWIG_fail;
+ }
+ }
+ {
+ arg6 = (unsigned int)(SWIG_As_unsigned_SS_int(obj5));
+ if (SWIG_arg_fail(6)) SWIG_fail;
+ }
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -993,36 +1950,53 @@
static PyObject *_wrap_fs_switch_ivr_record_file(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
- char *arg3 ;
+ char *arg3 = (char *) 0 ;
switch_input_callback_function_t arg4 ;
void *arg5 = (void *) 0 ;
unsigned int arg6 ;
- unsigned int arg7 ;
int result;
- switch_input_callback_function_t *argp4 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
PyObject * obj5 = 0 ;
- PyObject * obj6 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"OOsOOOO:fs_switch_ivr_record_file",&obj0,&obj1,&arg3,&obj3,&obj4,&obj5,&obj6)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_switch_file_handle_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj3,(void **) &argp4, SWIGTYPE_p_switch_input_callback_function_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg4 = *argp4;
- if ((SWIG_ConvertPtr(obj4,(void **) &arg5, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- arg6 = (unsigned int) PyInt_AsLong(obj5);
- if (PyErr_Occurred()) SWIG_fail;
- arg7 = (unsigned int) PyInt_AsLong(obj6);
- if (PyErr_Occurred()) SWIG_fail;
- result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+ if(!PyArg_ParseTuple(args,(char *)"OOOOOO:fs_switch_ivr_record_file",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ SWIG_Python_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_switch_file_handle_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(2)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ {
+ switch_input_callback_function_t * argp;
+ SWIG_Python_ConvertPtr(obj3, (void **)&argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ if (argp == NULL) {
+ SWIG_null_ref("switch_input_callback_function_t");
+ }
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ arg4 = *argp;
+ }
+ {
+ if ((SWIG_ConvertPtr(obj4,(void **)(&arg5),0,SWIG_POINTER_EXCEPTION|0))== -1) {
+ SWIG_arg_fail(5);SWIG_fail;
+ }
+ }
+ {
+ arg6 = (unsigned int)(SWIG_As_unsigned_SS_int(obj5));
+ if (SWIG_arg_fail(6)) SWIG_fail;
+ }
+ result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1030,21 +2004,25 @@
static PyObject *_wrap_fs_switch_ivr_sleep(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- uint32_t arg2 ;
+ unsigned int arg2 ;
int result;
- uint32_t *argp2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"OO:fs_switch_ivr_sleep",&obj0,&obj1)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **) &argp2, SWIGTYPE_p_uint32_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg2 = *argp2;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ {
+ arg2 = (unsigned int)(SWIG_As_unsigned_SS_int(obj1));
+ if (SWIG_arg_fail(2)) SWIG_fail;
+ }
result = (int)fs_switch_ivr_sleep(arg1,arg2);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1052,17 +2030,24 @@
static PyObject *_wrap_fs_ivr_play_file2(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
int result;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Os:fs_ivr_play_file2",&obj0,&arg2)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_ivr_play_file2",&obj0,&obj1)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
result = (int)fs_ivr_play_file2(arg1,arg2);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1070,14 +2055,13 @@
static PyObject *_wrap_fs_switch_ivr_collect_digits_callback(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_input_callback_function_t arg2 ;
void *arg3 = (void *) 0 ;
unsigned int arg4 ;
unsigned int arg5 ;
int result;
- switch_input_callback_function_t *argp2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
@@ -1085,17 +2069,36 @@
PyObject * obj4 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"OOOOO:fs_switch_ivr_collect_digits_callback",&obj0,&obj1,&obj2,&obj3,&obj4)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **) &argp2, SWIGTYPE_p_switch_input_callback_function_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg2 = *argp2;
- if ((SWIG_ConvertPtr(obj2,(void **) &arg3, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- arg4 = (unsigned int) PyInt_AsLong(obj3);
- if (PyErr_Occurred()) SWIG_fail;
- arg5 = (unsigned int) PyInt_AsLong(obj4);
- if (PyErr_Occurred()) SWIG_fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ {
+ switch_input_callback_function_t * argp;
+ SWIG_Python_ConvertPtr(obj1, (void **)&argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
+ if (SWIG_arg_fail(2)) SWIG_fail;
+ if (argp == NULL) {
+ SWIG_null_ref("switch_input_callback_function_t");
+ }
+ if (SWIG_arg_fail(2)) SWIG_fail;
+ arg2 = *argp;
+ }
+ {
+ if ((SWIG_ConvertPtr(obj2,(void **)(&arg3),0,SWIG_POINTER_EXCEPTION|0))== -1) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ }
+ {
+ arg4 = (unsigned int)(SWIG_As_unsigned_SS_int(obj3));
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ }
+ {
+ arg5 = (unsigned int)(SWIG_As_unsigned_SS_int(obj4));
+ if (SWIG_arg_fail(5)) SWIG_fail;
+ }
result = (int)fs_switch_ivr_collect_digits_callback(arg1,arg2,arg3,arg4,arg5);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1103,31 +2106,52 @@
static PyObject *_wrap_fs_switch_ivr_collect_digits_count(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
unsigned int arg3 ;
unsigned int arg4 ;
- char *arg5 ;
- char *arg6 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
unsigned int arg7 ;
int result;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
+ PyObject * obj5 = 0 ;
PyObject * obj6 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"OsOOssO:fs_switch_ivr_collect_digits_count",&obj0,&arg2,&obj2,&obj3,&arg5,&arg6,&obj6)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- arg3 = (unsigned int) PyInt_AsLong(obj2);
- if (PyErr_Occurred()) SWIG_fail;
- arg4 = (unsigned int) PyInt_AsLong(obj3);
- if (PyErr_Occurred()) SWIG_fail;
- arg7 = (unsigned int) PyInt_AsLong(obj6);
- if (PyErr_Occurred()) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOOOOOO:fs_switch_ivr_collect_digits_count",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ {
+ arg3 = (unsigned int)(SWIG_As_unsigned_SS_int(obj2));
+ if (SWIG_arg_fail(3)) SWIG_fail;
+ }
+ {
+ arg4 = (unsigned int)(SWIG_As_unsigned_SS_int(obj3));
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj4, (char**)&arg5)) {
+ SWIG_arg_fail(5);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj5, (char**)&arg6)) {
+ SWIG_arg_fail(6);SWIG_fail;
+ }
+ {
+ arg7 = (unsigned int)(SWIG_As_unsigned_SS_int(obj6));
+ if (SWIG_arg_fail(7)) SWIG_fail;
+ }
result = (int)fs_switch_ivr_collect_digits_count(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1135,25 +2159,34 @@
static PyObject *_wrap_fs_switch_ivr_originate(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
- char *arg3 ;
- uint32_t arg4 ;
+ char *arg3 = (char *) 0 ;
+ unsigned int arg4 ;
int result;
- uint32_t *argp4 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"OOsO:fs_switch_ivr_originate",&obj0,&obj1,&arg3,&obj3)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj3,(void **) &argp4, SWIGTYPE_p_uint32_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg4 = *argp4;
+ if(!PyArg_ParseTuple(args,(char *)"OOOO:fs_switch_ivr_originate",&obj0,&obj1,&obj2,&obj3)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ SWIG_Python_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(2)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ {
+ arg4 = (unsigned int)(SWIG_As_unsigned_SS_int(obj3));
+ if (SWIG_arg_fail(4)) SWIG_fail;
+ }
result = (int)fs_switch_ivr_originate(arg1,arg2,arg3,arg4);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1161,19 +2194,34 @@
static PyObject *_wrap_fs_switch_ivr_session_transfer(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
- char *arg3 ;
- char *arg4 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
int result;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Osss:fs_switch_ivr_session_transfer",&obj0,&arg2,&arg3,&arg4)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOOO:fs_switch_ivr_session_transfer",&obj0,&obj1,&obj2,&obj3)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj3, (char**)&arg4)) {
+ SWIG_arg_fail(4);SWIG_fail;
+ }
result = (int)fs_switch_ivr_session_transfer(arg1,arg2,arg3,arg4);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1181,55 +2229,128 @@
static PyObject *_wrap_fs_switch_ivr_speak_text(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- char *arg2 ;
- char *arg3 ;
- char *arg4 ;
- uint32_t arg5 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ unsigned int arg5 ;
switch_input_callback_function_t arg6 ;
- char *arg7 ;
+ char *arg7 = (char *) 0 ;
void *arg8 = (void *) 0 ;
unsigned int arg9 ;
int result;
- uint32_t *argp5 ;
- switch_input_callback_function_t *argp6 ;
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 ;
- if(!PyArg_ParseTuple(args,(char *)"OsssOOsOO:fs_switch_ivr_speak_text",&obj0,&arg2,&arg3,&arg4,&obj4,&obj5,&arg7,&obj7,&obj8)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj4,(void **) &argp5, SWIGTYPE_p_uint32_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg5 = *argp5;
- if ((SWIG_ConvertPtr(obj5,(void **) &argp6, SWIGTYPE_p_switch_input_callback_function_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
- arg6 = *argp6;
- if ((SWIG_ConvertPtr(obj7,(void **) &arg8, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- arg9 = (unsigned int) PyInt_AsLong(obj8);
- if (PyErr_Occurred()) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:fs_switch_ivr_speak_text",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj3, (char**)&arg4)) {
+ SWIG_arg_fail(4);SWIG_fail;
+ }
+ {
+ arg5 = (unsigned int)(SWIG_As_unsigned_SS_int(obj4));
+ if (SWIG_arg_fail(5)) SWIG_fail;
+ }
+ {
+ switch_input_callback_function_t * argp;
+ SWIG_Python_ConvertPtr(obj5, (void **)&argp, SWIGTYPE_p_switch_input_callback_function_t, SWIG_POINTER_EXCEPTION);
+ if (SWIG_arg_fail(6)) SWIG_fail;
+ if (argp == NULL) {
+ SWIG_null_ref("switch_input_callback_function_t");
+ }
+ if (SWIG_arg_fail(6)) SWIG_fail;
+ arg6 = *argp;
+ }
+ if (!SWIG_AsCharPtr(obj6, (char**)&arg7)) {
+ SWIG_arg_fail(7);SWIG_fail;
+ }
+ {
+ if ((SWIG_ConvertPtr(obj7,(void **)(&arg8),0,SWIG_POINTER_EXCEPTION|0))== -1) {
+ SWIG_arg_fail(8);SWIG_fail;
+ }
+ }
+ {
+ arg9 = (unsigned int)(SWIG_As_unsigned_SS_int(obj8));
+ if (SWIG_arg_fail(9)) SWIG_fail;
+ }
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
}
+static PyObject *_wrap_fs_switch_ivr_speak_text2(PyObject *self, PyObject *args) {
+ PyObject *resultobj = NULL;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ int result;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"OOOO:fs_switch_ivr_speak_text2",&obj0,&obj1,&obj2,&obj3)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj3, (char**)&arg4)) {
+ SWIG_arg_fail(4);SWIG_fail;
+ }
+ result = (int)fs_switch_ivr_speak_text2(arg1,arg2,arg3,arg4);
+
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_fs_switch_channel_get_variable(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
- char *arg2 ;
+ char *arg2 = (char *) 0 ;
char *result;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Os:fs_switch_channel_get_variable",&obj0,&arg2)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_channel_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OO:fs_switch_channel_get_variable",&obj0,&obj1)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
result = (char *)fs_switch_channel_get_variable(arg1,arg2);
- resultobj = result ? PyString_FromString(result) : Py_BuildValue((char*)"");
+ resultobj = SWIG_FromCharPtr(result);
return resultobj;
fail:
return NULL;
@@ -1237,18 +2358,29 @@
static PyObject *_wrap_fs_switch_channel_set_variable(PyObject *self, PyObject *args) {
- PyObject *resultobj;
+ PyObject *resultobj = NULL;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
- char *arg2 ;
- char *arg3 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
int result;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
- if(!PyArg_ParseTuple(args,(char *)"Oss:fs_switch_channel_set_variable",&obj0,&arg2,&arg3)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_channel_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ if(!PyArg_ParseTuple(args,(char *)"OOO:fs_switch_channel_set_variable",&obj0,&obj1,&obj2)) goto fail;
+ SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_EXCEPTION | 0);
+ if (SWIG_arg_fail(1)) SWIG_fail;
+ if (!SWIG_AsCharPtr(obj1, (char**)&arg2)) {
+ SWIG_arg_fail(2);SWIG_fail;
+ }
+ if (!SWIG_AsCharPtr(obj2, (char**)&arg3)) {
+ SWIG_arg_fail(3);SWIG_fail;
+ }
result = (int)fs_switch_channel_set_variable(arg1,arg2,arg3);
- resultobj = PyInt_FromLong((long)result);
+ {
+ resultobj = SWIG_From_int((int)(result));
+ }
return resultobj;
fail:
return NULL;
@@ -1256,84 +2388,546 @@
static PyMethodDef SwigMethods[] = {
- { (char *)"fs_core_set_globals", _wrap_fs_core_set_globals, METH_VARARGS },
- { (char *)"fs_core_init", _wrap_fs_core_init, METH_VARARGS },
- { (char *)"fs_core_destroy", _wrap_fs_core_destroy, METH_VARARGS },
- { (char *)"fs_loadable_module_init", _wrap_fs_loadable_module_init, METH_VARARGS },
- { (char *)"fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown, METH_VARARGS },
- { (char *)"fs_console_loop", _wrap_fs_console_loop, METH_VARARGS },
- { (char *)"fs_consol_log", _wrap_fs_consol_log, METH_VARARGS },
- { (char *)"fs_consol_clean", _wrap_fs_consol_clean, METH_VARARGS },
- { (char *)"fs_core_session_locate", _wrap_fs_core_session_locate, METH_VARARGS },
- { (char *)"fs_channel_answer", _wrap_fs_channel_answer, METH_VARARGS },
- { (char *)"fs_channel_pre_answer", _wrap_fs_channel_pre_answer, METH_VARARGS },
- { (char *)"fs_channel_hangup", _wrap_fs_channel_hangup, METH_VARARGS },
- { (char *)"fs_channel_set_variable", _wrap_fs_channel_set_variable, METH_VARARGS },
- { (char *)"fs_channel_get_variable", _wrap_fs_channel_get_variable, METH_VARARGS },
- { (char *)"fs_channel_set_state", _wrap_fs_channel_set_state, METH_VARARGS },
- { (char *)"fs_ivr_play_file", _wrap_fs_ivr_play_file, METH_VARARGS },
- { (char *)"fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file, METH_VARARGS },
- { (char *)"fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep, METH_VARARGS },
- { (char *)"fs_ivr_play_file2", _wrap_fs_ivr_play_file2, METH_VARARGS },
- { (char *)"fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback, METH_VARARGS },
- { (char *)"fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count, METH_VARARGS },
- { (char *)"fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate, METH_VARARGS },
- { (char *)"fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer, METH_VARARGS },
- { (char *)"fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text, METH_VARARGS },
- { (char *)"fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable, METH_VARARGS },
- { (char *)"fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable, METH_VARARGS },
- { NULL, NULL }
+ { (char *)"fs_core_set_globals", _wrap_fs_core_set_globals, METH_VARARGS, NULL},
+ { (char *)"fs_core_init", _wrap_fs_core_init, METH_VARARGS, NULL},
+ { (char *)"fs_core_destroy", _wrap_fs_core_destroy, METH_VARARGS, NULL},
+ { (char *)"fs_loadable_module_init", _wrap_fs_loadable_module_init, METH_VARARGS, NULL},
+ { (char *)"fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown, METH_VARARGS, NULL},
+ { (char *)"fs_console_loop", _wrap_fs_console_loop, METH_VARARGS, NULL},
+ { (char *)"fs_console_log", _wrap_fs_console_log, METH_VARARGS, NULL},
+ { (char *)"fs_console_clean", _wrap_fs_console_clean, METH_VARARGS, NULL},
+ { (char *)"fs_core_session_locate", _wrap_fs_core_session_locate, METH_VARARGS, NULL},
+ { (char *)"fs_channel_answer", _wrap_fs_channel_answer, METH_VARARGS, NULL},
+ { (char *)"fs_channel_pre_answer", _wrap_fs_channel_pre_answer, METH_VARARGS, NULL},
+ { (char *)"fs_channel_hangup", _wrap_fs_channel_hangup, METH_VARARGS, NULL},
+ { (char *)"fs_channel_set_variable", _wrap_fs_channel_set_variable, METH_VARARGS, NULL},
+ { (char *)"fs_channel_get_variable", _wrap_fs_channel_get_variable, METH_VARARGS, NULL},
+ { (char *)"fs_channel_set_state", _wrap_fs_channel_set_state, METH_VARARGS, NULL},
+ { (char *)"fs_ivr_play_file", _wrap_fs_ivr_play_file, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep, METH_VARARGS, NULL},
+ { (char *)"fs_ivr_play_file2", _wrap_fs_ivr_play_file2, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text, METH_VARARGS, NULL},
+ { (char *)"fs_switch_ivr_speak_text2", _wrap_fs_switch_ivr_speak_text2, METH_VARARGS, NULL},
+ { (char *)"fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable, METH_VARARGS, NULL},
+ { (char *)"fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable, METH_VARARGS, NULL},
+ { NULL, NULL, 0, NULL }
};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static swig_type_info _swigt__p_switch_channel_t[] = {{"_p_switch_channel_t", 0, "switch_channel_t *", 0},{"_p_switch_channel_t"},{0}};
-static swig_type_info _swigt__p_switch_file_handle_t[] = {{"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0},{"_p_switch_file_handle_t"},{0}};
-static swig_type_info _swigt__p_switch_core_session_t[] = {{"_p_switch_core_session_t", 0, "switch_core_session_t *", 0},{"_p_switch_core_session_t"},{0}};
-static swig_type_info _swigt__p_p_switch_core_session_t[] = {{"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0},{"_p_p_switch_core_session_t"},{0}};
-static swig_type_info _swigt__p_uint32_t[] = {{"_p_uint32_t", 0, "uint32_t *", 0},{"_p_uint32_t"},{0}};
-static swig_type_info _swigt__p_switch_input_callback_function_t[] = {{"_p_switch_input_callback_function_t", 0, "switch_input_callback_function_t *", 0},{"_p_switch_input_callback_function_t"},{0}};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, 0};
+static swig_type_info _swigt__p_p_switch_core_session_t = {"_p_p_switch_core_session_t", "switch_core_session_t **", 0, 0, 0};
+static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "enum switch_channel_state_t *|switch_channel_state_t *", 0, 0, 0};
+static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, 0};
+static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, 0};
+static swig_type_info _swigt__p_switch_file_handle_t = {"_p_switch_file_handle_t", "switch_file_handle_t *", 0, 0, 0};
+static swig_type_info _swigt__p_switch_input_callback_function_t = {"_p_switch_input_callback_function_t", "switch_input_callback_function_t *", 0, 0, 0};
+static swig_type_info _swigt__ptrdiff_t = {"_ptrdiff_t", "ptrdiff_t", 0, 0, 0};
+static swig_type_info _swigt__size_t = {"_size_t", "size_t", 0, 0, 0};
-static swig_type_info *swig_types_initial[] = {
-_swigt__p_switch_channel_t,
-_swigt__p_switch_file_handle_t,
-_swigt__p_switch_core_session_t,
-_swigt__p_p_switch_core_session_t,
-_swigt__p_uint32_t,
-_swigt__p_switch_input_callback_function_t,
-0
+static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_char,
+ &_swigt__p_p_switch_core_session_t,
+ &_swigt__p_switch_channel_state_t,
+ &_swigt__p_switch_channel_t,
+ &_swigt__p_switch_core_session_t,
+ &_swigt__p_switch_file_handle_t,
+ &_swigt__p_switch_input_callback_function_t,
+ &_swigt__ptrdiff_t,
+ &_swigt__size_t,
};
+static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_switch_core_session_t[] = { {&_swigt__p_p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_file_handle_t[] = { {&_swigt__p_switch_file_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_switch_input_callback_function_t[] = { {&_swigt__p_switch_input_callback_function_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__ptrdiff_t[] = { {&_swigt__ptrdiff_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__size_t[] = { {&_swigt__size_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_char,
+ _swigc__p_p_switch_core_session_t,
+ _swigc__p_switch_channel_state_t,
+ _swigc__p_switch_channel_t,
+ _swigc__p_switch_core_session_t,
+ _swigc__p_switch_file_handle_t,
+ _swigc__p_switch_input_callback_function_t,
+ _swigc__ptrdiff_t,
+ _swigc__size_t,
+};
+
+
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
static swig_const_info swig_const_table[] = {
-{0}};
+{0, 0, 0, 0.0, 0, 0}};
#ifdef __cplusplus
}
#endif
+/*************************************************************************
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop though that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ * 1) If the cast->type has already been loaded AND the type we are adding
+ * casting info to has not been loaded (it is in this module), THEN we
+ * replace the cast->type pointer with the type pointer that has already
+ * been loaded.
+ * 2) If BOTH types (the one we are adding casting info to, and the
+ * cast->type) are loaded, THEN the cast info has already been loaded by
+ * the previous module so we just ignore it.
+ * 3) Finally, if cast->type has not already been loaded, then we add that
+ * swig_cast_info to the linked list (because the cast->type) pointer will
+ * be correct.
+**/
+
#ifdef __cplusplus
+extern "C" {
+#endif
+
+ SWIGRUNTIME void
+ SWIG_InitializeModule(void *clientdata) {
+ swig_type_info *type, *ret;
+ swig_cast_info *cast;
+ size_t i;
+ swig_module_info *module_head;
+ static int init_run = 0;
+
+ clientdata = clientdata;
+
+ if (init_run) return;
+ init_run = 1;
+
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (module_head) {
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ } else {
+ /* This is the first module loaded */
+ swig_module.next = &swig_module;
+ SWIG_SetModule(clientdata, &swig_module);
+ }
+
+ /* Now work on filling in swig_module.types */
+ for (i = 0; i < swig_module.size; ++i) {
+ type = 0;
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
+ if (swig_module.type_initial[i]->clientdata) type->clientdata = swig_module.type_initial[i]->clientdata;
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+ /* Don't need to add information already in the list */
+ ret = 0;
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+ }
+ if (ret && type == swig_module.type_initial[i]) {
+ cast->type = ret;
+ ret = 0;
+ }
+
+ if (!ret) {
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+
+ cast++;
+ }
+
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+ }
+
+ /* This function will propagate the clientdata field of type to
+ * any new swig_type_info structures that have been added into the list
+ * of equivalent types. It is like calling
+ * SWIG_TypeClientData(type, clientdata) a second time.
+ */
+ SWIGRUNTIME void
+ SWIG_PropagateClientData(void) {
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run) return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* Python-specific SWIG API */
+#define SWIG_newvarlink() SWIG_Python_newvarlink()
+#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
+#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
+
+ /* -----------------------------------------------------------------------------
+ * global variable support code.
+ * ----------------------------------------------------------------------------- */
+
+ typedef struct swig_globalvar {
+ char *name; /* Name of global variable */
+ PyObject *(*get_attr)(void); /* Return the current value */
+ int (*set_attr)(PyObject *); /* Set the value */
+ struct swig_globalvar *next;
+ } swig_globalvar;
+
+ typedef struct swig_varlinkobject {
+ PyObject_HEAD
+ swig_globalvar *vars;
+ } swig_varlinkobject;
+
+ SWIGINTERN PyObject *
+ swig_varlink_repr(swig_varlinkobject *v) {
+ v = v;
+ return PyString_FromString("<Swig global variables>");
+ }
+
+ SWIGINTERN int
+ swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags) {
+ swig_globalvar *var;
+ flags = flags;
+ fprintf(fp,"Swig global variables { ");
+ for (var = v->vars; var; var=var->next) {
+ fprintf(fp,"%s", var->name);
+ if (var->next) fprintf(fp,", ");
+ }
+ fprintf(fp," }\n");
+ return 0;
+ }
+
+ SWIGINTERN PyObject *
+ swig_varlink_getattr(swig_varlinkobject *v, char *n) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ return (*var->get_attr)();
+ }
+ var = var->next;
+ }
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return NULL;
+ }
+
+ SWIGINTERN int
+ swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name,n) == 0) {
+ return (*var->set_attr)(p);
+ }
+ var = var->next;
+ }
+ PyErr_SetString(PyExc_NameError,"Unknown C global variable");
+ return 1;
+ }
+
+ SWIGINTERN PyTypeObject*
+ swig_varlink_type(void) {
+ static char varlink__doc__[] = "Swig var link object";
+ static PyTypeObject varlink_type
+#if !defined(__cplusplus)
+ ;
+ static int type_init = 0;
+ if (!type_init) {
+ PyTypeObject tmp
+#endif
+ = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /* Number of items in variable part (ob_size) */
+ (char *)"swigvarlink", /* Type name (tp_name) */
+ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
+ 0, /* Itemsize (tp_itemsize) */
+ 0, /* Deallocator (tp_dealloc) */
+ (printfunc) swig_varlink_print, /* Print (tp_print) */
+ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+ 0, /* tp_compare */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ varlink__doc__, /* tp_doc */
+#if PY_VERSION_HEX >= 0x02000000
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+#endif
+#if PY_VERSION_HEX >= 0x02010000
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+#endif
+#if PY_VERSION_HEX >= 0x02020000
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+#endif
+#if PY_VERSION_HEX >= 0x02030000
+ 0, /* tp_del */
+#endif
+#ifdef COUNT_ALLOCS
+ 0,0,0,0 /* tp_alloc -> tp_next */
+#endif
+ };
+#if !defined(__cplusplus)
+ varlink_type = tmp;
+ type_init = 1;
+ }
+#endif
+ return &varlink_type;
+ }
+
+ /* Create a variable linking object for use later */
+ SWIGINTERN PyObject *
+ SWIG_Python_newvarlink(void) {
+ swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+ if (result) {
+ result->vars = 0;
+ }
+ return ((PyObject*) result);
+ }
+
+ SWIGINTERN void
+ SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
+ swig_varlinkobject *v = (swig_varlinkobject *) p;
+ swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+ if (gv) {
+ size_t size = strlen(name)+1;
+ gv->name = (char *)malloc(size);
+ if (gv->name) {
+ strncpy(gv->name,name,size);
+ gv->get_attr = get_attr;
+ gv->set_attr = set_attr;
+ gv->next = v->vars;
+ }
+ }
+ v->vars = gv;
+ }
+
+ /* -----------------------------------------------------------------------------
+ * constants/methods manipulation
+ * ----------------------------------------------------------------------------- */
+
+ /* Install Constants */
+ SWIGINTERN void
+ SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
+ PyObject *obj = 0;
+ size_t i;
+ for (i = 0; constants[i].type; ++i) {
+ switch(constants[i].type) {
+ case SWIG_PY_INT:
+ obj = PyInt_FromLong(constants[i].lvalue);
+ break;
+ case SWIG_PY_FLOAT:
+ obj = PyFloat_FromDouble(constants[i].dvalue);
+ break;
+ case SWIG_PY_STRING:
+ if (constants[i].pvalue) {
+ obj = PyString_FromString((char *) constants[i].pvalue);
+ } else {
+ Py_INCREF(Py_None);
+ obj = Py_None;
+ }
+ break;
+ case SWIG_PY_POINTER:
+ obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+ break;
+ case SWIG_PY_BINARY:
+ obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+ break;
+ default:
+ obj = 0;
+ break;
+ }
+ if (obj) {
+ PyDict_SetItemString(d,constants[i].name,obj);
+ Py_DECREF(obj);
+ }
+ }
+ }
+
+ /* -----------------------------------------------------------------------------*/
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ /* -----------------------------------------------------------------------------*/
+
+ SWIGINTERN void
+ SWIG_Python_FixMethods(PyMethodDef *methods,
+ swig_const_info *const_table,
+ swig_type_info **types,
+ swig_type_info **types_initial) {
+ size_t i;
+ for (i = 0; methods[i].ml_name; ++i) {
+ char *c = methods[i].ml_doc;
+ if (c && (c = strstr(c, "swig_ptr: "))) {
+ int j;
+ swig_const_info *ci = 0;
+ char *name = c + 10;
+ for (j = 0; const_table[j].type; ++j) {
+ if (strncmp(const_table[j].name, name,
+ strlen(const_table[j].name)) == 0) {
+ ci = &(const_table[j]);
+ break;
+ }
+ }
+ if (ci) {
+ size_t shift = (ci->ptype) - types;
+ swig_type_info *ty = types_initial[shift];
+ size_t ldoc = (c - methods[i].ml_doc);
+ size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
+ char *ndoc = (char*)malloc(ldoc + lptr + 10);
+ if (ndoc) {
+ char *buff = ndoc;
+ void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+ if (ptr) {
+ strncpy(buff, methods[i].ml_doc, ldoc);
+ buff += ldoc;
+ strncpy(buff, "swig_ptr: ", 10);
+ buff += 10;
+ SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+ methods[i].ml_doc = ndoc;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* -----------------------------------------------------------------------------*
+ * Initialize type list
+ * -----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------*
+ * Partial Init method
+ * -----------------------------------------------------------------------------*/
+
+#ifdef __cplusplus
extern "C"
#endif
-SWIGEXPORT(void) SWIG_init(void) {
+SWIGEXPORT void SWIG_init(void) {
static PyObject *SWIG_globals = 0;
- static int typeinit = 0;
PyObject *m, *d;
- int i;
if (!SWIG_globals) SWIG_globals = SWIG_newvarlink();
+
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+
m = Py_InitModule((char *) SWIG_name, SwigMethods);
d = PyModule_GetDict(m);
- if (!typeinit) {
- for (i = 0; swig_types_initial[i]; i++) {
- swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
- }
- typeinit = 1;
- }
+ SWIG_InitializeModule(0);
SWIG_InstallConstants(d,swig_const_table);
+ {
+ PyDict_SetItemString(d,"CS_NEW", SWIG_From_int((int)(CS_NEW)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_INIT", SWIG_From_int((int)(CS_INIT)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_RING", SWIG_From_int((int)(CS_RING)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_TRANSMIT", SWIG_From_int((int)(CS_TRANSMIT)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_EXECUTE", SWIG_From_int((int)(CS_EXECUTE)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_LOOPBACK", SWIG_From_int((int)(CS_LOOPBACK)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_HOLD", SWIG_From_int((int)(CS_HOLD)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_HIBERNATE", SWIG_From_int((int)(CS_HIBERNATE)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_HANGUP", SWIG_From_int((int)(CS_HANGUP)));
+ }
+ {
+ PyDict_SetItemString(d,"CS_DONE", SWIG_From_int((int)(CS_DONE)));
+ }
}
1
0
[commit] r3780 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sip libsofia-sip-ua/su
by Freeswitch SVN 21 Dec '06
by Freeswitch SVN 21 Dec '06
21 Dec '06
Author: mikej
Date: Thu Dec 21 11:55:03 2006
New Revision: 3780
Added:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_sip_msg.c
Modified:
freeswitch/trunk/libs/sofia-sip/ (props changed)
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/ (props changed)
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c
Log:
update to current sofia darcs, fix partial rename of sip_test_msg->test_sip_msg
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am Thu Dec 21 11:55:03 2006
@@ -17,7 +17,7 @@
noinst_LTLIBRARIES = libsip.la
check_PROGRAMS = torture_sip \
- sip_test_msg validator date_test
+ test_sip_msg validator date_test
# ----------------------------------------------------------------------
# Rules for building the targets
@@ -58,7 +58,7 @@
../su/libsu.la
torture_sip_LDFLAGS = -static
-sip_test_msg_LDFLAGS = -static
+test_sip_msg_LDFLAGS = -static
date_test_LDFLAGS = -static
# ----------------------------------------------------------------------
@@ -93,9 +93,9 @@
# ----------------------------------------------------------------------
# Tests
-#TESTS = torture_sip run_sip_test_msg run_date_test
+TESTS = torture_sip run_test_sip_msg run_date_test
-#dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
+dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
# ----------------------------------------------------------------------
# Sofia specific rules
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in Thu Dec 21 11:55:03 2006
@@ -25,8 +25,9 @@
# ---------------------------------------------------
-SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c torture_sip.c validator.c
+SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c torture_sip.c validator.c
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -50,10 +51,11 @@
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-check_PROGRAMS = torture_sip$(EXEEXT) sip_test_msg$(EXEEXT) \
+check_PROGRAMS = torture_sip$(EXEEXT) test_sip_msg$(EXEEXT) \
validator$(EXEEXT) date_test$(EXEEXT)
-DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(dist_noinst_SCRIPTS) $(nobase_include_sofia_HEADERS) \
+ $(srcdir)/../sofia.am $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/sip
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@@ -80,10 +82,10 @@
date_test_LDADD = $(LDADD)
date_test_DEPENDENCIES = libsip.la ../msg/libmsg.la ../bnf/libbnf.la \
../url/liburl.la ../su/libsu.la
-sip_test_msg_SOURCES = sip_test_msg.c
-sip_test_msg_OBJECTS = sip_test_msg.$(OBJEXT)
-sip_test_msg_LDADD = $(LDADD)
-sip_test_msg_DEPENDENCIES = libsip.la ../msg/libmsg.la \
+test_sip_msg_SOURCES = test_sip_msg.c
+test_sip_msg_OBJECTS = test_sip_msg.$(OBJEXT)
+test_sip_msg_LDADD = $(LDADD)
+test_sip_msg_DEPENDENCIES = libsip.la ../msg/libmsg.la \
../bnf/libbnf.la ../url/liburl.la ../su/libsu.la
torture_sip_SOURCES = torture_sip.c
torture_sip_OBJECTS = torture_sip.$(OBJEXT)
@@ -95,6 +97,7 @@
validator_LDADD = $(LDADD)
validator_DEPENDENCIES = libsip.la ../msg/libmsg.la ../bnf/libbnf.la \
../url/liburl.la ../su/libsu.la
+SCRIPTS = $(dist_noinst_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -106,9 +109,9 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c \
+SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c \
torture_sip.c validator.c
-DIST_SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c \
+DIST_SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c \
torture_sip.c validator.c
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -314,7 +317,7 @@
../su/libsu.la
torture_sip_LDFLAGS = -static
-sip_test_msg_LDFLAGS = -static
+test_sip_msg_LDFLAGS = -static
date_test_LDFLAGS = -static
# ----------------------------------------------------------------------
@@ -345,6 +348,11 @@
tests/test35.txt tests/test36.txt tests/test37.txt tests/test38.txt \
tests/test39.txt tests/test40.txt tests/test41.txt tests/test42.txt
+
+# ----------------------------------------------------------------------
+# Tests
+TESTS = torture_sip run_test_sip_msg run_date_test
+dist_noinst_SCRIPTS = run_test_sip_msg run_date_test
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
@@ -373,13 +381,6 @@
# ----------------------------------------------------------------------
-# Tests
-
-#TESTS = torture_sip run_sip_test_msg run_date_test
-
-#dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
-
-# ----------------------------------------------------------------------
# Sofia specific rules
MSG_PARSER_AWK = $(srcdir)/../msg/msg_parser.awk
AWK_SIP_AWK = $(AWK) -f $(MSG_PARSER_AWK) module=sip
@@ -439,9 +440,9 @@
date_test$(EXEEXT): $(date_test_OBJECTS) $(date_test_DEPENDENCIES)
@rm -f date_test$(EXEEXT)
$(LINK) $(date_test_LDFLAGS) $(date_test_OBJECTS) $(date_test_LDADD) $(LIBS)
-sip_test_msg$(EXEEXT): $(sip_test_msg_OBJECTS) $(sip_test_msg_DEPENDENCIES)
- @rm -f sip_test_msg$(EXEEXT)
- $(LINK) $(sip_test_msg_LDFLAGS) $(sip_test_msg_OBJECTS) $(sip_test_msg_LDADD) $(LIBS)
+test_sip_msg$(EXEEXT): $(test_sip_msg_OBJECTS) $(test_sip_msg_DEPENDENCIES)
+ @rm -f test_sip_msg$(EXEEXT)
+ $(LINK) $(test_sip_msg_LDFLAGS) $(test_sip_msg_OBJECTS) $(test_sip_msg_LDADD) $(LIBS)
torture_sip$(EXEEXT): $(torture_sip_OBJECTS) $(torture_sip_DEPENDENCIES)
@rm -f torture_sip$(EXEEXT)
$(LINK) $(torture_sip_LDFLAGS) $(torture_sip_OBJECTS) $(torture_sip_LDADD) $(LIBS)
@@ -475,9 +476,9 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag_class.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag_ref.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_test_msg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sip_msg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/torture_sip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validator.Po@am__quote@
@@ -579,6 +580,79 @@
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list='$(TESTS)'; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/.. $(distdir)/images $(distdir)/sofia-sip $(distdir)/tests
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -609,9 +683,10 @@
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(include_sofiadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
@@ -695,7 +770,7 @@
uninstall-am: uninstall-info-am uninstall-nobase_include_sofiaHEADERS
-.PHONY: CTAGS GTAGS all all-am check check-am clean \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
Added: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_sip_msg.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/test_sip_msg.c Thu Dec 21 11:55:03 2006
@@ -0,0 +1,293 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@SIP_PARSER
+ *
+ * @file test_sip_msg.c Simple SIP message parser/printer tester.
+ *
+ * @author Pekka Pessi <Pekka.Pessi(a)nokia.com>.
+ *
+ * @date Created: Fri Feb 18 10:25:08 2000 ppessi
+ */
+
+#include "config.h"
+
+/* Avoid casting sip_t to msg_pub_t and sip_header_t to msg_header_t */
+#define MSG_PUB_T struct sip_s
+#define MSG_HDR_T union sip_header_u
+
+#include "sofia-sip/sip_parser.h"
+#include "sofia-sip/msg_mclass.h"
+#include "sofia-sip/msg_mclass_hash.h"
+#include <sofia-sip/sip_header.h>
+#include <sofia-sip/sip_util.h>
+#include <sofia-sip/msg_addr.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+int diff(const char *olds, const char *news, int *linep, int *pos)
+{
+ const char *o, *n;
+
+ *linep = 0;
+
+ for (o = olds, n = news; *o && *n && *o == *n ; o++, n++) {
+ if (*o == '\n') ++*linep;
+ }
+
+ *pos = o - olds;
+
+ return *o != *n;
+}
+
+int test_msg_class(msg_mclass_t *mc)
+{
+ int i, j, N;
+
+ N = mc->mc_hash_size;
+
+ /* Check parser table sanity */
+ for (i = 0; i < N; i++) {
+ /* Verify each header entry */
+ msg_hclass_t *hc = mc->mc_hash[i].hr_class;
+
+ if (hc == NULL)
+ continue;
+
+ /* Short form */
+ if (hc->hc_short[0])
+ assert(mc->mc_short[hc->hc_short[0] - 'a'].hr_class == hc);
+
+ /* Long form */
+ for (j = MC_HASH(hc->hc_name, N); j != i; j = (j + 1) % N)
+ assert(mc->mc_hash[j].hr_class);
+ }
+
+ return 0;
+}
+
+char * url_print(url_t *url, char buf[1024])
+{
+ url_e(buf, 1024, url);
+
+ return buf;
+}
+
+void print_contact(FILE *f, sip_contact_t *m)
+{
+ char const * const *p;
+ char buf[1024];
+ const char *sep = "\tContact: ";
+
+ for (;m; m = m->m_next) {
+ int quoted_url = 0;
+ fputs(sep, f); sep = ", ";
+
+ if (m->m_display) {
+ quoted_url = 1;
+ fprintf(f, "\"%s\" <", m->m_display);
+ }
+ url_print(m->m_url, buf);
+ if (!quoted_url && strpbrk(buf, ",;?")) {
+ fputs("<", f);
+ }
+ fputs(buf, f);
+ if (quoted_url) fputs(">", f);
+
+ if (m->m_params)
+ for (p = m->m_params; *p; p++)
+ fprintf(f, " ;%s", *p);
+
+ if (m->m_comment)
+ fprintf(f, " (%s)", m->m_comment);
+ }
+
+ fputs("\n", f);
+}
+
+void print_via(FILE *f, sip_via_t *v)
+{
+ char const * const *p;
+ char const * sep = "\tVia: ";
+
+ for (;v; v = v->v_next) {
+ fputs(sep, f); sep = ", ";
+
+ fprintf(f, "%s %s", v->v_protocol, v->v_host);
+ if (v->v_port)
+ fprintf(f, ":%s", v->v_port);
+
+ if (v->v_params)
+ for (p = v->v_params; *p; p++)
+ fprintf(f, " ;%s", *p);
+ if (v->v_comment)
+ fprintf(f, " (%s)", v->v_comment);
+ }
+
+ fputs("\n", f);
+}
+
+int main(int argc, char *argv[])
+{
+ char urlbuf[1024];
+ size_t n;
+ int m, tcp;
+ sip_t *sip;
+ int exitcode = 0;
+ msg_mclass_t *sip_mclass = sip_default_mclass();
+ msg_t *msg = msg_create(sip_mclass, MSG_FLG_EXTRACT_COPY);
+ msg_iovec_t iovec[1];
+
+ tcp = argv[1] && strcmp(argv[1], "-t") == 0;
+
+ test_msg_class(sip_mclass);
+
+ for (n = 0, m = 0;;) {
+ if (msg_recv_iovec(msg, iovec, 1, 1, 0) < 0) {
+ perror("msg_recv_iovec");
+ exit(1);
+ }
+ assert(iovec->mv_len >= 1);
+
+ n = read(0, iovec->mv_base, 1);
+
+ if (n < 0) {
+ perror("test_sip_msg read");
+ exit(1);
+ }
+
+ msg_recv_commit(msg, n, n == 0);
+
+ if (tcp)
+ m = msg_extract(msg);
+
+ if (n == 0 || m < 0)
+ break;
+ }
+
+ if (!tcp)
+ m = msg_extract(msg);
+
+ sip = msg_object(msg);
+ if (sip)
+ fprintf(stdout, "sip flags = %x\n", sip->sip_flags);
+
+ if (m < 0) {
+ fprintf(stderr, "test_sip_msg: parsing error ("MOD_ZD")\n", n);
+ exit(1);
+ }
+
+ if (sip->sip_flags & MSG_FLG_TRUNC) {
+ fprintf(stderr, "test_sip_msg: message truncated\n");
+ exit(1);
+ }
+
+ if (msg_next(msg)) {
+ fprintf(stderr, "test_sip_msg: stuff after message\n");
+ exit(1);
+ }
+
+#if 0
+ fprintf(stderr, "test_sip_msg: %d headers (%d short ones), %d unknown\n",
+ msg->mh_n_headers, msg->mh_n_short, msg->mh_n_unknown);
+
+ if (msg->mh_payload) {
+ fprintf(stderr, "\twith payload of %d bytes\n",
+ msg->mh_payload->pl_len);
+ }
+#endif
+
+ if (MSG_HAS_ERROR(sip->sip_flags) || sip->sip_error) {
+ fprintf(stderr, "test_sip_msg: parsing error\n");
+ exit(1);
+ }
+ else if (sip_sanity_check(sip) < 0) {
+ fprintf(stderr, "test_sip_msg: message failed sanity check\n");
+ exit(1);
+ }
+
+ if (sip->sip_request) {
+ fprintf(stdout, "\trequest %s (%d) %s %s\n",
+ sip->sip_request->rq_method_name,
+ sip->sip_request->rq_method,
+ url_print(sip->sip_request->rq_url, urlbuf),
+ sip->sip_request->rq_version);
+ if (sip->sip_request->rq_url->url_type == url_unknown) {
+ exitcode = 1;
+ fprintf(stderr, "test_sip_msg: invalid request URI\n");
+ }
+ }
+
+ if (sip->sip_status)
+ fprintf(stdout, "\tstatus %s %03d %s\n",
+ sip->sip_status->st_version,
+ sip->sip_status->st_status,
+ sip->sip_status->st_phrase);
+
+ if (sip->sip_cseq)
+ fprintf(stdout, "\tCSeq: %u %s (%d)\n",
+ sip->sip_cseq->cs_seq,
+ sip->sip_cseq->cs_method_name,
+ sip->sip_cseq->cs_method);
+
+ if (sip->sip_call_id)
+ fprintf(stdout, "\tCall-ID: %s (%x)\n",
+ sip->sip_call_id->i_id,
+ sip->sip_call_id->i_hash);
+
+ if (sip->sip_from)
+ fprintf(stdout, "\tFrom: %s@%s%s%s\n",
+ sip->sip_from->a_user ? sip->sip_from->a_user : "[nobody]",
+ sip->sip_from->a_host ? sip->sip_from->a_host : "[nowhere]",
+ sip->sip_from->a_tag ? " ;tag=" : "",
+ sip->sip_from->a_tag ? sip->sip_from->a_tag : "");
+
+ if (sip->sip_to)
+ fprintf(stdout, "\tTo: %s@%s%s%s\n",
+ sip->sip_to->a_user ? sip->sip_to->a_user : "[nobody]",
+ sip->sip_to->a_host ? sip->sip_to->a_host : "[nowhere]",
+ sip->sip_to->a_tag ? " ;tag=" : "",
+ sip->sip_to->a_tag ? sip->sip_to->a_tag : "");
+
+ if (sip->sip_contact)
+ print_contact(stdout, sip->sip_contact);
+ if (sip->sip_via)
+ print_via(stdout, sip->sip_via);
+
+ if (sip->sip_content_length) {
+ fprintf(stdout, "\tcontent length %u\n",
+ sip->sip_content_length->l_length);
+ }
+
+ if (msg_next(msg)) {
+ fprintf(stderr, "test_sip_msg: extra stuff after valid message\n");
+ exit(1);
+ }
+
+ return exitcode;
+}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c Thu Dec 21 11:55:03 2006
@@ -578,6 +578,8 @@
{
su_duration_t tout;
+ t = timers_first(t);
+
if (!t)
return SU_DURATION_MAX;
1
0
21 Dec '06
Author: anthm
Date: Thu Dec 21 11:51:58 2006
New Revision: 3779
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
increase energy to go up in 200 unit increments instead of 100 and max out at 3000 instead of 1200
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Thu Dec 21 11:51:58 2006
@@ -993,9 +993,9 @@
break;
case '9':
switch_mutex_lock(member->flag_mutex);
- member->energy_level += 100;
- if (member->energy_level > 1200) {
- member->energy_level = 1200;
+ member->energy_level += 200;
+ if (member->energy_level > 3000) {
+ member->energy_level = 3000;
}
switch_mutex_unlock(member->flag_mutex);
snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
1
0
[commit] r3778 - in freeswitch/trunk/src/mod/endpoints: mod_dingaling mod_iax mod_portaudio mod_wanpipe mod_woomera
by Freeswitch SVN 21 Dec '06
by Freeswitch SVN 21 Dec '06
21 Dec '06
Author: anthm
Date: Thu Dec 21 11:46:11 2006
New Revision: 3778
Modified:
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
Log:
add case for kill sigs
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Thu Dec 21 11:46:11 2006
@@ -1131,28 +1131,41 @@
switch_channel_t *channel = NULL;
struct private_object *tech_pvt = NULL;
- if ((channel = switch_core_session_get_channel(session))) {
- if ((tech_pvt = switch_core_session_get_private(session))) {
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ if (!(channel = switch_core_session_get_channel(session))) {
+ return SWITCH_STATUS_SUCCESS;
+ }
- if (tech_pvt->dlsession) {
- if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
- ldl_session_terminate(tech_pvt->dlsession);
- switch_set_flag_locked(tech_pvt, TFLAG_TERM);
- }
- ldl_session_destroy(&tech_pvt->dlsession);
+ if (!(tech_pvt = switch_core_session_get_private(session))) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
- }
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ switch_set_flag_locked(tech_pvt, TFLAG_BYE);
- if (switch_rtp_ready(tech_pvt->rtp_session)) {
- switch_rtp_kill_socket(tech_pvt->rtp_session);
- }
+ if (tech_pvt->dlsession) {
+ if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+ ldl_session_terminate(tech_pvt->dlsession);
+ switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+ }
+ ldl_session_destroy(&tech_pvt->dlsession);
+
+ }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
- }
- }
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ switch_rtp_kill_socket(tech_pvt->rtp_session);
+ }
+ break;
+ case SWITCH_SIG_BREAK:
+ switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
+ break;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Thu Dec 21 11:46:11 2006
@@ -566,11 +566,16 @@
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_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- //switch_thread_cond_signal(tech_pvt->cond);
-
+ 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;
+ default:
+ break;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Thu Dec 21 11:46:11 2006
@@ -273,10 +273,15 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- deactivate_audio_device(tech_pvt);
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-
+ switch (sig) {
+ case SWITCH_SIG_KILL:
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ deactivate_audio_device(tech_pvt);
+ switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+ break;
+ default:
+ break;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Thu Dec 21 11:46:11 2006
@@ -755,11 +755,16 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch_mutex_lock(tech_pvt->flag_mutex);
- switch_set_flag(tech_pvt, TFLAG_BYE);
- switch_clear_flag(tech_pvt, TFLAG_MEDIA);
- switch_mutex_unlock(tech_pvt->flag_mutex);
-
+ switch(sig) {
+ case SWITCH_SIG_KILL:
+ switch_mutex_lock(tech_pvt->flag_mutex);
+ switch_set_flag(tech_pvt, TFLAG_BYE);
+ switch_clear_flag(tech_pvt, TFLAG_MEDIA);
+ switch_mutex_unlock(tech_pvt->flag_mutex);
+ break;
+ default:
+ break;
+ }
//sangoma_socket_close(&tech_pvt->wpsock->fd);
//wp_close(tech_pvt);
Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c Thu Dec 21 11:46:11 2006
@@ -327,11 +327,19 @@
return SWITCH_STATUS_FALSE;
}
- udp_socket_close(tech_pvt);
-
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
-
+ switch(sig) {
+ case SWITCH_SIG_KILL:
+ udp_socket_close(tech_pvt);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
+ break;
+ case SWITCH_SIG_BREAK:
+ {
+ int p = 0;
+ switch_size_t len = sizeof(p);
+ switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, &p, &len);
+ }
+ break;
+ }
return SWITCH_STATUS_SUCCESS;
1
0
[commit] r3777 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sip
by Freeswitch SVN 21 Dec '06
by Freeswitch SVN 21 Dec '06
21 Dec '06
Author: anthm
Date: Thu Dec 21 11:25:34 2006
New Revision: 3777
Modified:
freeswitch/trunk/libs/sofia-sip/config.guess
freeswitch/trunk/libs/sofia-sip/config.sub
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
Log:
fix sofia
Modified: freeswitch/trunk/libs/sofia-sip/config.guess
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/config.guess (original)
+++ freeswitch/trunk/libs/sofia-sip/config.guess Thu Dec 21 11:25:34 2006
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-timestamp='2003-06-17'
+timestamp='2004-09-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -136,13 +136,6 @@
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-## for Red Hat Linux
-if test -f /etc/redhat-release ; then
- VENDOR=redhat ;
-else
- VENDOR= ;
-fi
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -204,15 +197,21 @@
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
+ amd64:OpenBSD:*:*)
+ echo x86_64-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ cats:OpenBSD:*:*)
+ echo arm-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
+ luna88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
@@ -228,25 +227,33 @@
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
sgi:OpenBSD:*:*)
- echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ echo mips64-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit 0 ;;
alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
+ case $UNAME_RELEASE in
+ *4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
@@ -284,15 +291,13 @@
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
+ # A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
- Alpha*:OpenVMS:*:*)
- echo alpha-hp-vms
- exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -314,6 +319,9 @@
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
@@ -406,6 +414,9 @@
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
@@ -741,7 +752,7 @@
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
*:UNICOS/mp:*:*)
- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@@ -749,6 +760,11 @@
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
@@ -758,19 +774,8 @@
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
- *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
- # Determine whether the default compiler uses glibc.
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #if __GLIBC__ >= 2
- LIBC=gnu
- #else
- LIBC=
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -803,8 +808,13 @@
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
+ # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit 0 ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
@@ -814,9 +824,18 @@
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit 0 ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit 0 ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit 0 ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
@@ -859,10 +878,10 @@
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
ppc:Linux:*:*)
- echo powerpc-${VENDOR:-unknown}-linux-gnu
+ echo powerpc-unknown-linux-gnu
exit 0 ;;
ppc64:Linux:*:*)
- echo powerpc64-${VENDOR:-unknown}-linux-gnu
+ echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -890,7 +909,7 @@
echo hppa64-unknown-linux-gnu
exit 0 ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
+ echo ${UNAME_MACHINE}-ibm-linux
exit 0 ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -902,7 +921,7 @@
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
x86_64:Linux:*:*)
- echo x86_64-${VENDOR:-unknown}-linux-gnu
+ echo x86_64-unknown-linux-gnu
exit 0 ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
@@ -952,9 +971,12 @@
LIBC=gnuaout
#endif
#endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
i*86:DYNIX/ptx:4*:*)
@@ -982,6 +1004,9 @@
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@@ -1051,9 +1076,9 @@
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit 0 ;;
- M68*:*:R3V[567]*:*)
+ M68*:*:R3V[5678]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1151,9 +1176,10 @@
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Darwin:*:*)
- case `uname -p` in
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
- powerpc) UNAME_PROCESSOR=powerpc ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit 0 ;;
@@ -1168,7 +1194,7 @@
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
*:NonStop-UX:*:*)
@@ -1212,6 +1238,16 @@
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms && exit 0 ;;
+ I*) echo ia64-dec-vms && exit 0 ;;
+ V*) echo vax-dec-vms && exit 0 ;;
+ esac
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
Modified: freeswitch/trunk/libs/sofia-sip/config.sub
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/config.sub (original)
+++ freeswitch/trunk/libs/sofia-sip/config.sub Thu Dec 21 11:25:34 2006
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-timestamp='2003-06-18'
+timestamp='2004-08-29'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -70,7 +70,7 @@
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -118,7 +118,8 @@
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -144,7 +145,7 @@
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
+ -apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@@ -228,14 +229,15 @@
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
- | ip2k \
- | m32r | m68000 | m68k | m88k | mcore \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -247,6 +249,7 @@
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
@@ -257,10 +260,9 @@
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | s390 | s390x \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
@@ -298,15 +300,15 @@
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | cydra-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* \
- | m32r-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -320,21 +322,22 @@
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
+ | mmix-* \
| msp430-* \
- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | s390-* | s390x-* \
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
@@ -361,6 +364,9 @@
basic_machine=a29k-amd
os=-udi
;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@@ -378,6 +384,9 @@
amd64)
basic_machine=x86_64-pc
;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -437,12 +446,27 @@
basic_machine=j90-cray
os=-unicos
;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
crds | unos)
basic_machine=m68k-crds
;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@@ -643,10 +667,6 @@
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@@ -727,10 +747,6 @@
np1)
basic_machine=np1-gould
;;
- nv1)
- basic_machine=nv1-cray
- os=-unicosmp
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -742,6 +758,10 @@
basic_machine=or32-unknown
os=-coff
;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
@@ -833,6 +853,12 @@
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
sa29200)
basic_machine=a29k-amd
os=-udi
@@ -956,6 +982,10 @@
tower | tower-32)
basic_machine=m68k-ncr
;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -1029,6 +1059,9 @@
romp)
basic_machine=romp-ibm
;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
rs6000)
basic_machine=rs6000-ibm
;;
@@ -1051,7 +1084,7 @@
sh64)
basic_machine=sh64-unknown
;;
- sparc | sparcv9 | sparcv9b)
+ sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
@@ -1124,19 +1157,20 @@
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1160,6 +1194,9 @@
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -1172,6 +1209,9 @@
-opened*)
os=-openedition
;;
+ -os400*)
+ os=-os400
+ ;;
-wince*)
os=-wince
;;
@@ -1193,6 +1233,9 @@
-atheos*)
os=-atheos
;;
+ -syllable*)
+ os=-syllable
+ ;;
-386bsd)
os=-bsd
;;
@@ -1215,6 +1258,9 @@
-sinix*)
os=-sysv4
;;
+ -tpf*)
+ os=-tpf
+ ;;
-triton*)
os=-sysv3
;;
@@ -1282,9 +1328,9 @@
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1331,6 +1377,9 @@
*-ibm)
os=-aix
;;
+ *-knuth)
+ os=-mmixware
+ ;;
*-wec)
os=-proelf
;;
@@ -1463,8 +1512,14 @@
-mvs* | -opened*)
vendor=ibm
;;
+ -os400*)
+ vendor=ibm
+ ;;
-ptx*)
vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.am Thu Dec 21 11:25:34 2006
@@ -93,9 +93,9 @@
# ----------------------------------------------------------------------
# Tests
-TESTS = torture_sip run_sip_test_msg run_date_test
+#TESTS = torture_sip run_sip_test_msg run_date_test
-dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
+#dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
# ----------------------------------------------------------------------
# Sofia specific rules
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/Makefile.in Thu Dec 21 11:25:34 2006
@@ -25,9 +25,8 @@
# ---------------------------------------------------
+SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c torture_sip.c validator.c
-SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c torture_sip.c validator.c
-
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -51,11 +50,10 @@
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-check_PROGRAMS = torture_sip$(EXEEXT) test_sip_msg$(EXEEXT) \
+check_PROGRAMS = torture_sip$(EXEEXT) sip_test_msg$(EXEEXT) \
validator$(EXEEXT) date_test$(EXEEXT)
-DIST_COMMON = $(dist_noinst_SCRIPTS) $(nobase_include_sofia_HEADERS) \
- $(srcdir)/../sofia.am $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
subdir = libsofia-sip-ua/sip
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@@ -82,10 +80,10 @@
date_test_LDADD = $(LDADD)
date_test_DEPENDENCIES = libsip.la ../msg/libmsg.la ../bnf/libbnf.la \
../url/liburl.la ../su/libsu.la
-test_sip_msg_SOURCES = test_sip_msg.c
-test_sip_msg_OBJECTS = test_sip_msg.$(OBJEXT)
-test_sip_msg_LDADD = $(LDADD)
-test_sip_msg_DEPENDENCIES = libsip.la ../msg/libmsg.la \
+sip_test_msg_SOURCES = sip_test_msg.c
+sip_test_msg_OBJECTS = sip_test_msg.$(OBJEXT)
+sip_test_msg_LDADD = $(LDADD)
+sip_test_msg_DEPENDENCIES = libsip.la ../msg/libmsg.la \
../bnf/libbnf.la ../url/liburl.la ../su/libsu.la
torture_sip_SOURCES = torture_sip.c
torture_sip_OBJECTS = torture_sip.$(OBJEXT)
@@ -97,7 +95,6 @@
validator_LDADD = $(LDADD)
validator_DEPENDENCIES = libsip.la ../msg/libmsg.la ../bnf/libbnf.la \
../url/liburl.la ../su/libsu.la
-SCRIPTS = $(dist_noinst_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -109,9 +106,9 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c \
+SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c \
torture_sip.c validator.c
-DIST_SOURCES = $(libsip_la_SOURCES) date_test.c test_sip_msg.c \
+DIST_SOURCES = $(libsip_la_SOURCES) date_test.c sip_test_msg.c \
torture_sip.c validator.c
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -348,11 +345,6 @@
tests/test35.txt tests/test36.txt tests/test37.txt tests/test38.txt \
tests/test39.txt tests/test40.txt tests/test41.txt tests/test42.txt
-
-# ----------------------------------------------------------------------
-# Tests
-TESTS = torture_sip run_sip_test_msg run_date_test
-dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
DISTCLEANFILES = $(BUILT_SOURCES)
@@ -381,6 +373,13 @@
# ----------------------------------------------------------------------
+# Tests
+
+#TESTS = torture_sip run_sip_test_msg run_date_test
+
+#dist_noinst_SCRIPTS = run_sip_test_msg run_date_test
+
+# ----------------------------------------------------------------------
# Sofia specific rules
MSG_PARSER_AWK = $(srcdir)/../msg/msg_parser.awk
AWK_SIP_AWK = $(AWK) -f $(MSG_PARSER_AWK) module=sip
@@ -440,9 +439,9 @@
date_test$(EXEEXT): $(date_test_OBJECTS) $(date_test_DEPENDENCIES)
@rm -f date_test$(EXEEXT)
$(LINK) $(date_test_LDFLAGS) $(date_test_OBJECTS) $(date_test_LDADD) $(LIBS)
-test_sip_msg$(EXEEXT): $(test_sip_msg_OBJECTS) $(test_sip_msg_DEPENDENCIES)
- @rm -f test_sip_msg$(EXEEXT)
- $(LINK) $(test_sip_msg_LDFLAGS) $(test_sip_msg_OBJECTS) $(test_sip_msg_LDADD) $(LIBS)
+sip_test_msg$(EXEEXT): $(sip_test_msg_OBJECTS) $(sip_test_msg_DEPENDENCIES)
+ @rm -f sip_test_msg$(EXEEXT)
+ $(LINK) $(sip_test_msg_LDFLAGS) $(sip_test_msg_OBJECTS) $(sip_test_msg_LDADD) $(LIBS)
torture_sip$(EXEEXT): $(torture_sip_OBJECTS) $(torture_sip_DEPENDENCIES)
@rm -f torture_sip$(EXEEXT)
$(LINK) $(torture_sip_LDFLAGS) $(torture_sip_OBJECTS) $(torture_sip_LDADD) $(LIBS)
@@ -476,9 +475,9 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag_class.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_tag_ref.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_test_msg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_time.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sip_util.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sip_msg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/torture_sip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validator.Po@am__quote@
@@ -580,79 +579,6 @@
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; \
- srcdir=$(srcdir); export srcdir; \
- list='$(TESTS)'; \
- if test -n "$$list"; then \
- for tst in $$list; do \
- if test -f ./$$tst; then dir=./; \
- elif test -f $$tst; then dir=; \
- else dir="$(srcdir)/"; fi; \
- if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
- xpass=`expr $$xpass + 1`; \
- failed=`expr $$failed + 1`; \
- echo "XPASS: $$tst"; \
- ;; \
- *) \
- echo "PASS: $$tst"; \
- ;; \
- esac; \
- elif test $$? -ne 77; then \
- all=`expr $$all + 1`; \
- case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
- xfail=`expr $$xfail + 1`; \
- echo "XFAIL: $$tst"; \
- ;; \
- *) \
- failed=`expr $$failed + 1`; \
- echo "FAIL: $$tst"; \
- ;; \
- esac; \
- else \
- skip=`expr $$skip + 1`; \
- echo "SKIP: $$tst"; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- if test "$$xfail" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
- fi; \
- else \
- if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all tests failed"; \
- else \
- banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
- fi; \
- fi; \
- dashes="$$banner"; \
- skipped=""; \
- if test "$$skip" -ne 0; then \
- skipped="($$skip tests were not run)"; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$skipped"; \
- fi; \
- report=""; \
- if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
- report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
- dashes="$$report"; \
- fi; \
- dashes=`echo "$$dashes" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- test -z "$$skipped" || echo "$$skipped"; \
- test -z "$$report" || echo "$$report"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- else :; fi
-
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/.. $(distdir)/images $(distdir)/sofia-sip $(distdir)/tests
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -683,10 +609,9 @@
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(include_sofiadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
@@ -770,7 +695,7 @@
uninstall-am: uninstall-info-am uninstall-nobase_include_sofiaHEADERS
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
1
0