Freeswitch-branches
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
- 1655 discussions
[commit] r3884 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 01 Jan '07
by Freeswitch SVN 01 Jan '07
01 Jan '07
Author: knhor
Date: Mon Jan 1 14:33:36 2007
New Revision: 3884
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
instead of requiring a profile name for the conference, use the profile "default" for not specified
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 Mon Jan 1 14:33:36 2007
@@ -3094,13 +3094,12 @@
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;
- char *profile_name = strchr(argv[0],'@');
assert(conference != NULL);
assert(stream != NULL);
/* if we have a conference name with a profile name, and at least one member to transfer */
- if (argc >= 2 && !switch_strlen_zero(argv[0]) && !switch_strlen_zero(profile_name)) {
+ if (argc >= 2 && !switch_strlen_zero(argv[0])) {
int x;
for (x = 1; x<argc; x++) {
@@ -3122,6 +3121,7 @@
switch_memory_pool_t *pool = NULL;
conf_xml_cfg_t xml_cfg = {0};
char *conf_name;
+ char *profile_name;
/* Setup a memory pool to use. */
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
@@ -3133,13 +3133,15 @@
if ((profile_name = strchr(conf_name, '@'))) {
*profile_name++ = '\0';
+ } else {
+ profile_name = "default";
+ }
/* get the xml config sections */
if (conference_get_xml_sections(profile_name, &xml_cfg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
goto done;
}
- }
/* Create the conference object. */
new_conference = conference_new(conf_name, &xml_cfg, pool);
@@ -3243,7 +3245,7 @@
{"say", (api_cmd_fn_t)&conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
{"saymember", (api_cmd_fn_t)&conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
{"stop", (api_cmd_fn_t)&conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
- {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name@conference_profile_name> <member id> [...<member id>]"},
+ {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name[@conference_profile_name]> <member id> [...<member id>]"},
{"undeaf", (api_cmd_fn_t)&conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
{"unlock", (api_cmd_fn_t)&conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
{"unmute", (api_cmd_fn_t)&conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
@@ -3686,13 +3688,15 @@
/* is there profile specification ? */
if ((profile_name = strchr(conf_name, '@'))) {
*profile_name++ = '\0';
+ } else {
+ profile_name = "default";
+ }
/* get the xml config sections */
if (conference_get_xml_sections(profile_name, &xml_cfg) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
- goto done;
- }
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+ goto done;
+ }
/* if this is a bridging call, and it's not a duplicate, build a */
/* conference object, and skip pin handling, and locked checking */
1
0
[commit] r3883 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 01 Jan '07
by Freeswitch SVN 01 Jan '07
01 Jan '07
Author: knhor
Date: Mon Jan 1 11:14:46 2007
New Revision: 3883
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
require a profile name when transfering members to another conference.
fix conference presence for transfered members
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 Mon Jan 1 11:14:46 2007
@@ -3094,11 +3094,13 @@
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;
+ char *profile_name = strchr(argv[0],'@');
assert(conference != NULL);
assert(stream != NULL);
- if (argc >= 2 && !switch_strlen_zero(argv[0])) {
+ /* if we have a conference name with a profile name, and at least one member to transfer */
+ if (argc >= 2 && !switch_strlen_zero(argv[0]) && !switch_strlen_zero(profile_name)) {
int x;
for (x = 1; x<argc; x++) {
@@ -3120,7 +3122,6 @@
switch_memory_pool_t *pool = NULL;
conf_xml_cfg_t xml_cfg = {0};
char *conf_name;
- char *profile_name;
/* Setup a memory pool to use. */
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
@@ -3242,7 +3243,7 @@
{"say", (api_cmd_fn_t)&conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
{"saymember", (api_cmd_fn_t)&conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
{"stop", (api_cmd_fn_t)&conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
- {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
+ {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name@conference_profile_name> <member id> [...<member id>]"},
{"undeaf", (api_cmd_fn_t)&conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
{"unlock", (api_cmd_fn_t)&conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
{"unmute", (api_cmd_fn_t)&conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
@@ -4123,7 +4124,23 @@
conf_api_dispatch(conference, &stream, argc, argv, (const char *)body);
}
#endif
- }
+ } else if (perm != NULL) {
+ char *p = strdup(perm);
+
+ if (p != NULL) {
+ char *str = p;
+
+ while(*p) {
+ if(*p == '|') {
+ *p = '\n';
+ }
+ p++;
+ }
+ stream.write_function(&stream, "valid commands are;%s", str);
+
+ free(str);
+ }
+ }
} else {
stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
}
@@ -4180,6 +4197,8 @@
char *commands = (char *) switch_xml_attr(xml_kvp, "commands");
if (!switch_strlen_zero(name) && !switch_strlen_zero(commands)) {
+ // "commands" MUST be validated against the conf_api_sub_commands[] table
+ // and any invalid commands MUST be removed before being inserted in the hash
switch_core_hash_insert(conference->chat_permissions_map, name, commands);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "chat-permissions %s=%s\n",name,commands);
count ++;
@@ -4460,7 +4479,8 @@
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, "from", "%s@%s", conference->name, conference->domain); // i think this is wrong
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
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);
1
0
[commit] r3882 - freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql
by Freeswitch SVN 01 Jan '07
by Freeswitch SVN 01 Jan '07
01 Jan '07
Author: outcast
Date: Mon Jan 1 04:33:18 2007
New Revision: 3882
Modified:
freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c
Log:
Giving credit where credit is due!!!!!
Modified: freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c
==============================================================================
--- freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c (original)
+++ freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c Mon Jan 1 04:33:18 2007
@@ -28,7 +28,7 @@
*
* mod_xml_mysql.c -- CURL XML Gateway
*
- * Based on mod_xml_curl by Michael Jerris <mike(a)jerris.com>
+ * Based on mod_xml_curl by Anthony Minessale II <anthmct(a)yahoo.com>
*/
1
0
[commit] r3881 - freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql
by Freeswitch SVN 01 Jan '07
by Freeswitch SVN 01 Jan '07
01 Jan '07
Author: outcast
Date: Mon Jan 1 04:28:22 2007
New Revision: 3881
Added:
freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/
freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/Makefile
freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/README
freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c
Log:
new mod_xml_mysql module. Just testing some stuff. I will have better version soon.
Added: freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/Makefile
==============================================================================
--- (empty file)
+++ freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/Makefile Mon Jan 1 04:28:22 2007
@@ -0,0 +1,20 @@
+FLAGS += $(shell mysql_config --include)
+LDFLAGS += $(shell mysql_config --libs)
+
+all: depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
+
+depends:
+
+
+
+$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c
+ $(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o
+ $(CC) $(SOLINK) -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(MODNAME).o $(LDFLAGS)
+
+
+clean:
+ rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~
+ rm -fr *.$(DYNAMIC_LIB_EXTEN) *.so *~
+
+install:
+ cp -f $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(PREFIX)/mod
Added: freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/README
==============================================================================
--- (empty file)
+++ freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/README Mon Jan 1 04:28:22 2007
@@ -0,0 +1,10 @@
+mod_xml_mysql
+-----
+
+
+This is an experimental module that I have written to load Freeswitch's configuration from a MySQL database. It may seem a bit crude. This is my first module for Freeswitch and the first time I have used the MySQL API. I would highly recommend not to use this in production. The database schema currently is not included due to the fact it is lame. I will come up with a better database schema and version of the module hopfully by mid-Jan. If you have any quesitons please email me.
+
+
+Outcast aka James Jones <james(a)virtualrealmsoftware.com>
+
+
Added: freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c
==============================================================================
--- (empty file)
+++ freeswitch/branches/outcast/src/mod/xml_int/mod_xml_mysql/mod_xml_mysql.c Mon Jan 1 04:28:22 2007
@@ -0,0 +1,219 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct(a)yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct(a)yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Outcast aka James Jones <james(a)virtualrealmsoftware.com>
+ * Michael Jerris <mike(a)jerris.com>
+ *
+ * mod_xml_mysql.c -- CURL XML Gateway
+ *
+ * Based on mod_xml_curl by Michael Jerris <mike(a)jerris.com>
+ */
+
+
+#include <switch.h>
+#include <mysql/mysql.h>
+
+static const char modname[] = "mod_xml_mysql";
+
+
+static struct {
+ char *dbname;
+ char *bindings;
+ char *dbuser;
+ char *dbpass;
+ char *dbhost;
+ char *debug;
+ MYSQL mysql;
+} globals;
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dbname, globals.dbname);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dbuser, globals.dbuser);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dbpass, globals.dbpass);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dbhost, globals.dbhost);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_debug, globals.debug);
+
+
+static switch_xml_t xml_mysql_fetch(char *section,
+ char *tag_name,
+ char *key_name,
+ char *key_value,
+ char *params)
+{
+ char *mysql_section = NULL;
+ char *mysql_tag_name = NULL;
+ char *mysql_key_name = NULL;
+ char *mysql_key_value = NULL;
+ char *mysql_params = NULL;
+ char *mysql_xml = NULL;
+ char mysql_query[1000];
+ switch_xml_t xml = NULL;
+ MYSQL_RES *result;
+ MYSQL_ROW row;
+
+ if (!((mysql_section = section) && (mysql_tag_name = tag_name) && (mysql_key_name = key_name) && (mysql_key_value = key_value))) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ return NULL;
+ }
+
+ snprintf(mysql_query, sizeof(mysql_query), "SELECT data FROM xml_templates WHERE section = \"%s\" and name = \"%s\"", mysql_section, mysql_key_value);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Built query: %s\nSize: %d\n", mysql_query, sizeof(mysql_query));
+
+ if(mysql_real_query(&globals.mysql, mysql_query, strlen(mysql_query)) == 0){
+
+ result = mysql_store_result(&globals.mysql);
+ if(result){
+
+ if(mysql_num_fields(result) == 1) {
+ if(!(row = mysql_fetch_row(result))) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database returned an empty result\n");
+ return NULL;
+ } else {
+
+ mysql_xml = strdup(row[0]);
+ }
+ } else {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Incorrect amount of fields retrived please check MySQL query.\n");
+ return NULL;
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No records found for %s in database\n", mysql_key_value);
+ return NULL;
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Mysql Error: %s\n", mysql_error(&globals.mysql));
+ return NULL;
+ }
+
+ if(mysql_query == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database returned a null value\n");
+ return NULL;
+ }
+
+ if (!(xml = switch_xml_parse_str(mysql_xml, strlen(mysql_xml)))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
+ }
+ mysql_free_result(result);
+ return xml;
+}
+
+
+static switch_loadable_module_interface_t xml_mysql_module_interface = {
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ NULL,
+ /*.api_interface */ NULL,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL
+};
+
+static switch_status_t do_config(void)
+{
+ char *cf = "xml_mysql.conf";
+ switch_xml_t cfg, xml, settings, param;
+
+ if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+ return SWITCH_STATUS_TERM;
+ }
+
+ if ((settings = switch_xml_child(cfg, "settings"))) {
+ for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+
+ if (!strcasecmp(var, "dbname")) {
+ char *bindings = (char *) switch_xml_attr_soft(param, "bindings");
+ set_global_bindings(bindings);
+ set_global_dbname(val);
+ } else if (!strcasecmp(var, "dbhost")) {
+ set_global_dbhost(val);
+ } else if (!strcasecmp(var, "dbuser")) {
+ set_global_dbuser(val);
+ } else if (!strcasecmp(var, "dbpass")) {
+ set_global_dbpass(val);
+ } else if (!strcasecmp(var, "dbdebug")) {
+ set_global_debug(val);
+ }
+ }
+ }
+
+ switch_xml_free(xml);
+
+ return globals.dbname ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
+
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
+{
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = &xml_mysql_module_interface;
+
+ if (do_config() == SWITCH_STATUS_SUCCESS) {
+ if(mysql_init(&globals.mysql)==NULL) {
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to iniate MySQL Connection\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!mysql_real_connect(&globals.mysql,globals.dbhost, globals.dbuser, globals.dbpass, globals.dbname,0,NULL,0)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to connect to Database: %s @ %s\n", globals.dbname, globals.dbhost);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding MySQL Fetch Function [%s] [%s]\n",
+ globals.dbname, globals.bindings ? globals.bindings : "all");
+ switch_xml_bind_search_function(xml_mysql_fetch, switch_xml_parse_section_string(globals.bindings));
+ } else {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
+{
+ mysql_close(&globals.mysql);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+/* 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:
+ */
1
0
Author: sphere
Date: Sun Dec 31 17:01:46 2006
New Revision: 3880
Added:
freeswitch/branches/enterux_solutions/
Log:
Creating empty folder for enterux_solutions
1
0
[commit] r3878 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 31 Dec '06
by Freeswitch SVN 31 Dec '06
31 Dec '06
Author: knhor
Date: Sun Dec 31 15:02:01 2006
New Revision: 3878
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
oops.. don't keep the xml config registry locked!
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 Sun Dec 31 15:02:01 2006
@@ -199,7 +199,6 @@
uint32_t count;
int32_t energy_level;
uint8_t min;
- conf_xml_cfg_t xml_cfg;
switch_hash_t *chat_permissions_map;
} conference_obj_t;
@@ -1679,31 +1678,6 @@
/* Start the input thread */
launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
- /* caller control configuration chores */
- if (switch_ivr_digit_stream_parser_new(member->pool, &member->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
- switch_status_t status = SWITCH_STATUS_FALSE;
-
- /* if no controls, or default controls specified, install default */
- if (member->conference->caller_controls == NULL || *member->conference->caller_controls == '\0' || strcasecmp(member->conference->caller_controls, "default") == 0) {
- status = caller_control_build_default(member);
- } else if (strcasecmp(member->conference->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(member->conference->xml_cfg.controls, "group", "name", member->conference->caller_controls);
-#ifdef OPTION_IVR_MENU_SUPPORT
- status = caller_control_build_custom(member, xml_controls, member->conference->xml_cfg.menus);
-#else
- status = caller_control_build_custom(member, 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", member->conference->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");
- }
-
/* build a digit stream object */
if (member->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->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");
@@ -3174,10 +3148,6 @@
if (pool != NULL) {
switch_core_destroy_memory_pool(&pool);
}
- /* Release the config registry handle */
- if (xml_cfg.cxml) {
- switch_xml_free(xml_cfg.cxml);
- }
goto done;
}
@@ -3189,6 +3159,12 @@
/* Start the conference thread for this conference */
launch_conference_thread(new_conference);
+
+ /* Release the config registry thread lock */
+ if (xml_cfg.cxml) {
+ switch_xml_free(xml_cfg.cxml);
+ memset(&xml_cfg,0,sizeof(xml_cfg));
+ }
}
/* move the member from the old conference to the new one */
@@ -3952,6 +3928,37 @@
msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
switch_core_session_receive_message(session, &msg);
+ /* caller control configuration chores */
+ if (switch_ivr_digit_stream_parser_new(member.pool, &member.dtmf_parser) == SWITCH_STATUS_SUCCESS) {
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ /* if no controls, or default controls specified, install default */
+ if (member.conference->caller_controls == NULL || *member.conference->caller_controls == '\0' || strcasecmp(member.conference->caller_controls, "default") == 0) {
+ status = caller_control_build_default(&member);
+ } else if (strcasecmp(member.conference->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(xml_cfg.controls, "group", "name", member.conference->caller_controls);
+#ifdef OPTION_IVR_MENU_SUPPORT
+ status = caller_control_build_custom(&member, xml_controls, xml_cfg.menus);
+#else
+ status = caller_control_build_custom(&member, 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", member.conference->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");
+ }
+
+ /* Release the config registry thread lock */
+ if (xml_cfg.cxml) {
+ switch_xml_free(xml_cfg.cxml);
+ memset(&xml_cfg,0,sizeof(xml_cfg));
+ }
+
/* Run the confernece loop */
conference_loop_output(&member);
@@ -3976,11 +3983,6 @@
switch_buffer_destroy(&member.audio_buffer);
switch_buffer_destroy(&member.mux_buffer);
- /* Release the config registry handle */
- if (xml_cfg.cxml) {
- switch_xml_free(xml_cfg.cxml);
- }
-
if (freepool) {
switch_core_destroy_memory_pool(&freepool);
}
@@ -4154,15 +4156,15 @@
/*.chat_interface */ &conference_chat_interface
};
-switch_status_t chat_permissions_get(conference_obj_t *conference)
+switch_status_t chat_permissions_get(conference_obj_t *conference, conf_xml_cfg_t *xml_cfg)
{
- switch_status_t status = SWITCH_STATUS_FALSE;
int count = 0;
assert(conference != NULL);
+ assert(xml_cfg != NULL);
- if (conference->xml_cfg.chat_permissions != NULL && !switch_strlen_zero(conference->chat_permissions)) {
- switch_xml_t profile = switch_xml_find_child(conference->xml_cfg.chat_permissions, "profile", "name", conference->chat_permissions);
+ if (xml_cfg->chat_permissions != NULL && !switch_strlen_zero(conference->chat_permissions)) {
+ switch_xml_t profile = switch_xml_find_child(xml_cfg->chat_permissions, "profile", "name", conference->chat_permissions);
if (profile != NULL) {
switch_xml_t xml_kvp;
@@ -4183,14 +4185,11 @@
count ++;
}
}
- if (count != 0) {
- status = SWITCH_STATUS_SUCCESS;
- }
}
}
}
- return status;
+ return (count != 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE);
}
/* create a new conferene with a specific profile */
@@ -4423,12 +4422,8 @@
conference->rate = rate;
conference->interval = interval;
- /* copy the xml config sections to the new conference */
- memcpy(&conference->xml_cfg,xml_cfg,sizeof(conf_xml_cfg_t));
-
/* build the chat interface permissions map */
- chat_permissions_get(conference);
-
+ chat_permissions_get(conference, xml_cfg);
/* Activate the conference mutex for exclusivity */
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
@@ -4512,7 +4507,7 @@
}
done:
- /* Release the config registry handle */
+ /* Release the config registry thread lock */
if (cxml) {
switch_xml_free(cxml);
cxml = NULL;
1
0
[commit] r3876 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 31 Dec '06
by Freeswitch SVN 31 Dec '06
31 Dec '06
Author: knhor
Date: Sun Dec 31 03:20:45 2006
New Revision: 3876
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
add simple chat permissions using the following configuration syntax example;
<configuration name="conference.conf" description="Audio Conference">
<profiles>
<profile name="default">
<param name="chat-permissions" value="default"/>
</profile>
</profiles>
<chat-permissions>
<profile name="default">
<!-- both of these users have a functionally equivalent capability set -->
<user name="bob(a)somewhere.com" commands="all"/>
<!-- individually specified commands must be book-end'ed with the | charachter -->
<user name="harry(a)somewhere.com" commands="|deaf|dial|energy|kick|list|lock|mute|norecord|play|record|relate|say|saymember|stop|transfer|undeaf|unlock|unmute|volume_in|volume_out|"/>
</profile>
</chat-permissions>
</configuration>
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 Sun Dec 31 03:20:45 2006
@@ -184,6 +184,7 @@
char *profile_name;
char *domain;
char *caller_controls;
+ char *chat_permissions;
uint32_t flags;
switch_call_cause_t bridge_hangup_cause;
switch_mutex_t *flag_mutex;
@@ -199,7 +200,7 @@
int32_t energy_level;
uint8_t min;
conf_xml_cfg_t xml_cfg;
-// switch_hash_t *chat_permissions;
+ switch_hash_t *chat_permissions_map;
} conference_obj_t;
/* Relationship with another member */
@@ -1477,8 +1478,6 @@
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 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));
@@ -3255,7 +3254,7 @@
static api_command_t conf_api_sub_commands[] = {
{"deaf", (api_cmd_fn_t)&conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
{"dial", (api_cmd_fn_t)&conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name> <flags>"},
- {"energy", (api_cmd_fn_t)&conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
+ {"energy", (api_cmd_fn_t)&conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
{"kick", (api_cmd_fn_t)&conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
{"list", (api_cmd_fn_t)&conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
{"lock", (api_cmd_fn_t)&conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
@@ -3627,7 +3626,7 @@
#ifdef OPTION_IVR_MENU_SUPPORT
xml_cfg->menus = switch_xml_child(cfg, "menus");
#endif
- xml_cfg->chat_permissions = switch_xml_child(cfg, "chat-permisions");
+ xml_cfg->chat_permissions = switch_xml_child(cfg, "chat-permissions");
status = SWITCH_STATUS_SUCCESS;
}
}
@@ -4093,12 +4092,15 @@
if (body != NULL && (lbuf = strdup(body))) {
int argc;
char *argv[25];
+ char *perm = NULL;
memset(argv, 0, sizeof(argv));
argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
/* try to find a command to execute */
if (argc) {
+ char *cmd = switch_mprintf("|%s|",argv[0]);
+
/* special case list */
if (strcasecmp(argv[0], "list") == 0) {
stream.write_function(&stream, "(%u member%s, %s)\n",
@@ -4108,12 +4110,16 @@
);
conference_list_pretty(conference, &stream);
#ifdef ENABLE_CHAT_ADMIN
- /* 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);
+ } else if (conference->chat_permissions != NULL
+ && (perm = (char *) switch_core_hash_find(conference->chat_permissions_map, from)) != NULL
+ && (strcasecmp(perm,"all") == 0 || (cmd != NULL && strstr(perm,cmd) != NULL))) {
+ /* provide help */
+ 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);
+ }
#endif
}
} else {
@@ -4148,6 +4154,45 @@
/*.chat_interface */ &conference_chat_interface
};
+switch_status_t chat_permissions_get(conference_obj_t *conference)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ int count = 0;
+
+ assert(conference != NULL);
+
+ if (conference->xml_cfg.chat_permissions != NULL && !switch_strlen_zero(conference->chat_permissions)) {
+ switch_xml_t profile = switch_xml_find_child(conference->xml_cfg.chat_permissions, "profile", "name", conference->chat_permissions);
+
+ if (profile != NULL) {
+ switch_xml_t xml_kvp;
+
+ if (conference->chat_permissions_map != NULL) {
+ switch_core_hash_destroy(conference->chat_permissions_map);
+ }
+ switch_core_hash_init(&conference->chat_permissions_map, conference->pool);
+
+ if (conference->chat_permissions_map != NULL) {
+ for (xml_kvp = switch_xml_child(profile, "user"); xml_kvp; xml_kvp = xml_kvp->next) {
+ char *name = (char *) switch_xml_attr(xml_kvp, "name");
+ char *commands = (char *) switch_xml_attr(xml_kvp, "commands");
+
+ if (!switch_strlen_zero(name) && !switch_strlen_zero(commands)) {
+ switch_core_hash_insert(conference->chat_permissions_map, name, commands);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "chat-permissions %s=%s\n",name,commands);
+ count ++;
+ }
+ }
+ if (count != 0) {
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ }
+ }
+ }
+
+ return status;
+}
+
/* create a new conferene with a specific profile */
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t *xml_cfg, switch_memory_pool_t *pool)
{
@@ -4175,6 +4220,7 @@
char *caller_id_name = NULL;
char *caller_id_number = NULL;
char *caller_controls = NULL;
+ char *chat_permissions = NULL;
uint32_t rate = 8000, interval = 20;
switch_status_t status;
@@ -4245,6 +4291,8 @@
caller_id_number = val;
} else if (!strcasecmp(var, "caller-controls")) {
caller_controls = val;
+ } else if (!strcasecmp(var, "chat-permissions")) {
+ chat_permissions = val;
}
}
@@ -4362,6 +4410,10 @@
conference->caller_controls = switch_core_strdup(conference->pool, caller_controls);
}
+ if (!switch_strlen_zero(chat_permissions)) {
+ conference->chat_permissions = switch_core_strdup(conference->pool, chat_permissions);
+ }
+
conference->name = switch_core_strdup(conference->pool, name);
if (domain) {
conference->domain = switch_core_strdup(conference->pool, domain);
@@ -4374,6 +4426,10 @@
/* copy the xml config sections to the new conference */
memcpy(&conference->xml_cfg,xml_cfg,sizeof(conf_xml_cfg_t));
+ /* build the chat interface permissions map */
+ chat_permissions_get(conference);
+
+
/* 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);
1
0
[commit] r3875 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 30 Dec '06
by Freeswitch SVN 30 Dec '06
30 Dec '06
Author: knhor
Date: Sat Dec 30 18:58:06 2006
New Revision: 3875
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
add flags paramenter back to dial api command.
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 Sat Dec 30 18:58:06 2006
@@ -3109,7 +3109,7 @@
assert(stream != NULL);
if (argc >= 1) {
- conference_outcall(conference, NULL, argv[0], 60, NULL, (argc >= 3 ?argv[2] : NULL), (argc >=2 ? argv[1] : NULL));
+ conference_outcall(conference, NULL, argv[0], 60, (argc >= 4 ? argv[3] : NULL), (argc >= 3 ? argv[2] : NULL), (argc >=2 ? argv[1] : NULL));
stream->write_function(stream, "OK\n");
} else {
ret_status = SWITCH_STATUS_GENERR;
@@ -3253,26 +3253,26 @@
/* API Interface Function sub-commands */
static api_command_t conf_api_sub_commands[] = {
- {"deaf", (api_cmd_fn_t)&conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
- {"dial", (api_cmd_fn_t)&conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
- {"energy", (api_cmd_fn_t)&conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
- {"kick", (api_cmd_fn_t)&conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
- {"list", (api_cmd_fn_t)&conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
- {"lock", (api_cmd_fn_t)&conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
- {"mute", (api_cmd_fn_t)&conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
- {"norecord", (api_cmd_fn_t)&conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
- {"play", (api_cmd_fn_t)&conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
- {"record", (api_cmd_fn_t)&conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
- {"relate", (api_cmd_fn_t)&conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
- {"say", (api_cmd_fn_t)&conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
- {"saymember", (api_cmd_fn_t)&conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
- {"stop", (api_cmd_fn_t)&conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
- {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
- {"undeaf", (api_cmd_fn_t)&conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
- {"unlock", (api_cmd_fn_t)&conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
- {"unmute", (api_cmd_fn_t)&conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
- {"volume_in", (api_cmd_fn_t)&conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
- {"volume_out", (api_cmd_fn_t)&conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
+ {"deaf", (api_cmd_fn_t)&conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+ {"dial", (api_cmd_fn_t)&conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name> <flags>"},
+ {"energy", (api_cmd_fn_t)&conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
+ {"kick", (api_cmd_fn_t)&conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+ {"list", (api_cmd_fn_t)&conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+ {"lock", (api_cmd_fn_t)&conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+ {"mute", (api_cmd_fn_t)&conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+ {"norecord", (api_cmd_fn_t)&conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+ {"play", (api_cmd_fn_t)&conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+ {"record", (api_cmd_fn_t)&conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+ {"relate", (api_cmd_fn_t)&conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
+ {"say", (api_cmd_fn_t)&conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+ {"saymember", (api_cmd_fn_t)&conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
+ {"stop", (api_cmd_fn_t)&conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
+ {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
+ {"undeaf", (api_cmd_fn_t)&conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
+ {"unlock", (api_cmd_fn_t)&conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+ {"unmute", (api_cmd_fn_t)&conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
+ {"volume_in", (api_cmd_fn_t)&conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
+ {"volume_out", (api_cmd_fn_t)&conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
};
#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
1
0
[commit] r3874 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 30 Dec '06
by Freeswitch SVN 30 Dec '06
30 Dec '06
Author: knhor
Date: Sat Dec 30 16:52:09 2006
New Revision: 3874
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
fix void function pointer for mikej
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 Sat Dec 30 16:52:09 2006
@@ -158,7 +158,7 @@
#ifdef OPTION_IVR_MENU_SUPPORT
switch_xml_t menus;
#endif
-// switch_xml_t chat_admin;
+ switch_xml_t chat_permissions;
} conf_xml_cfg_t;
/* Conference Object */
@@ -199,8 +199,7 @@
int32_t energy_level;
uint8_t min;
conf_xml_cfg_t xml_cfg;
-// switch_hash_t *chat_admin;
-// switch_hash_t *chat_id;
+// switch_hash_t *chat_permissions;
} conference_obj_t;
/* Relationship with another member */
@@ -258,10 +257,12 @@
CONF_API_SUB_ARGS_AS_ONE
} conference_fntype_t;
+typedef void (*api_cmd_fn_t)(void *);
+
/* API command parser */
typedef struct api_command {
char *pname;
- void *pfnapicmd;
+ api_cmd_fn_t pfnapicmd;
conference_fntype_t fntype;
char *psyntax;
} api_command_t;
@@ -1373,13 +1374,13 @@
{"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 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 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 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 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
@@ -3252,26 +3253,26 @@
/* API Interface Function sub-commands */
static api_command_t conf_api_sub_commands[] = {
- {"deaf", &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
- {"dial", &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
- {"energy", &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
- {"kick", &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
- {"list", &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
- {"lock", &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
- {"mute", &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
- {"norecord", &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
- {"play", &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
- {"record", &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
- {"relate", &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
- {"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>]"},
- {"transfer", &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
- {"undeaf", &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
- {"unlock", &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
- {"unmute", &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
- {"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>]"},
+ {"deaf", (api_cmd_fn_t)&conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+ {"dial", (api_cmd_fn_t)&conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
+ {"energy", (api_cmd_fn_t)&conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET, "<confname> energy <member_id|all|last> [<newval>]"},
+ {"kick", (api_cmd_fn_t)&conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+ {"list", (api_cmd_fn_t)&conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+ {"lock", (api_cmd_fn_t)&conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+ {"mute", (api_cmd_fn_t)&conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+ {"norecord", (api_cmd_fn_t)&conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+ {"play", (api_cmd_fn_t)&conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+ {"record", (api_cmd_fn_t)&conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+ {"relate", (api_cmd_fn_t)&conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
+ {"say", (api_cmd_fn_t)&conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+ {"saymember", (api_cmd_fn_t)&conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"},
+ {"stop", (api_cmd_fn_t)&conf_api_sub_stop, CONF_API_SUB_MEMBER_TARGET, "<confname> stop <[current|all|last]> [<member_id>]"},
+ {"transfer", (api_cmd_fn_t)&conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "<confname> transfer <conference_name> <member id> [...<member id>]"},
+ {"undeaf", (api_cmd_fn_t)&conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "<confname> undeaf <[member_id|all]|last>"},
+ {"unlock", (api_cmd_fn_t)&conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+ {"unmute", (api_cmd_fn_t)&conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET, "<confname> unmute <[member_id|all]|last>"},
+ {"volume_in", (api_cmd_fn_t)&conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_in <member_id|all|last> [<newval>]"},
+ {"volume_out", (api_cmd_fn_t)&conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"},
};
#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
@@ -3308,7 +3309,7 @@
int last = ( id == 0 && strcasecmp(argv[1], "last") == 0 );
if (all) {
- conference_member_itterator(conference, stream, conf_api_sub_commands[i].pfnapicmd, argv[2]);
+ conference_member_itterator(conference, stream, (conf_api_member_cmd_t)conf_api_sub_commands[i].pfnapicmd, argv[2]);
} else if (last) {
conference_member_t *member = NULL;
conference_member_t *last_member = NULL;
@@ -3626,7 +3627,7 @@
#ifdef OPTION_IVR_MENU_SUPPORT
xml_cfg->menus = switch_xml_child(cfg, "menus");
#endif
-// xml_cfg->chat_admin = switch_xml_child(cfg, "chat-admin");
+ xml_cfg->chat_permissions = switch_xml_child(cfg, "chat-permisions");
status = SWITCH_STATUS_SUCCESS;
}
}
1
0
[commit] r3873 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 30 Dec '06
by Freeswitch SVN 30 Dec '06
30 Dec '06
Author: knhor
Date: Sat Dec 30 15:04:41 2006
New Revision: 3873
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
move caller control digit parser from the conference to the caller
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 Sat Dec 30 15:04:41 2006
@@ -55,7 +55,7 @@
//#define OPTION_IVR_MENU_SUPPORT */
/* define this if you want your xmpp users to be able to admin the conferences via chat */
-//#define ENABLE_CHAT_ADMIN
+#define ENABLE_CHAT_ADMIN
typedef enum {
FILE_STOP_CURRENT,
@@ -178,12 +178,12 @@
char *kicked_sound;
char *caller_id_name;
char *caller_id_number;
- switch_ivr_digit_stream_parser_t *dtmf_parser;
char *pin;
char *pin_sound;
char *bad_pin_sound;
char *profile_name;
char *domain;
+ char *caller_controls;
uint32_t flags;
switch_call_cause_t bridge_hangup_cause;
switch_mutex_t *flag_mutex;
@@ -198,6 +198,7 @@
uint32_t count;
int32_t energy_level;
uint8_t min;
+ conf_xml_cfg_t xml_cfg;
// switch_hash_t *chat_admin;
// switch_hash_t *chat_id;
} conference_obj_t;
@@ -239,6 +240,7 @@
switch_audio_resampler_t *read_resampler;
conference_file_node_t *fnode;
conference_relationship_t *relationships;
+ switch_ivr_digit_stream_parser_t *dtmf_parser;
switch_ivr_digit_stream_t *digit_stream;
struct conference_member *next;
};
@@ -295,7 +297,7 @@
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_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, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
+static conference_obj_t *conference_new(char *name, conf_xml_cfg_t *xml_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);
@@ -885,8 +887,6 @@
switch_thread_rwlock_unlock(conference->rwlock);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n");
- 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);
@@ -1389,6 +1389,256 @@
};
#define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0]))
+#ifdef OPTION_IVR_MENU_SUPPORT
+static switch_ivr_action_t caller_control_ivr_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
+{
+ switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
+
+ if (!switch_strlen_zero(param)) {
+ if (obj != NULL) {
+ int i, found;
+ char *action_name = strdup(param);
+
+ if (action_name != NULL) {
+ char *sep = (action_name != NULL ? strchr(action_name, ' ') : NULL);
+
+ /* split the action from any parameters */
+ if (sep != NULL) {
+ *sep = '\0';
+ }
+
+ /* 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;
+ }
+ }
+ }
+ }
+
+ 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 switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
+ {
+ switch_status_t status;
+
+ 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");
+ }
+
+ return status;
+ }
+
+ 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);
+ }
+*/
+
+static switch_status_t caller_control_ivr_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;
+
+ 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 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 (*ctx != NULL) {
+ memset(*ctx, 0, sizeof(caller_control_menu_ctx_t));
+
+ /* 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", &caller_control_ivr_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");
+
+ /*
+ // 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 switch_status_t caller_control_build_default(conference_member_t *member)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ uint32_t i;
+ caller_control_action_t *action;
+
+ assert(member != NULL);
+
+ 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(member->pool, sizeof(caller_control_action_t));
+ if (action != NULL) {
+ action->fndesc = &ccfntbl[i];
+ action->data = NULL;
+ status = switch_ivr_digit_stream_parser_set_event(member->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;
+ }
+ }
+ }
+
+
+ return status;
+}
+
+static switch_status_t caller_control_build_custom(conference_member_t *member, switch_xml_t xml_controls, switch_xml_t xml_menus)
+{
+ switch_status_t status = SWITCH_STATUS_FALSE;
+ switch_xml_t xml_kvp;
+
+ assert(member != NULL);
+ assert(xml_controls != NULL);
+
+ /* 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 (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
+ uint32_t i;
+
+ /* 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++) {
+
+ 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);
+
+ /* 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);
+
+ status = caller_control_ivr_build(&menu_ctx, conference, menu_group, menu_name);
+ data = (char *)menu_ctx;
+ } else {
+ status = SWITCH_STATUS_FALSE;
+ }
+
+ 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);
+ }
+
+ /* clean up */
+ if (menu_group_name != NULL) {
+ free(menu_group_name);
+ }
+ }
+#endif
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ caller_control_action_t *action;
+
+ 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(member->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(member->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);
+ }
+ }
+
+ return status;
+}
+
/* 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)
@@ -1429,8 +1679,33 @@
/* Start the input thread */
launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
+ /* caller control configuration chores */
+ if (switch_ivr_digit_stream_parser_new(member->pool, &member->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ /* if no controls, or default controls specified, install default */
+ if (member->conference->caller_controls == NULL || *member->conference->caller_controls == '\0' || strcasecmp(member->conference->caller_controls, "default") == 0) {
+ status = caller_control_build_default(member);
+ } else if (strcasecmp(member->conference->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(member->conference->xml_cfg.controls, "group", "name", member->conference->caller_controls);
+#ifdef OPTION_IVR_MENU_SUPPORT
+ status = caller_control_build_custom(member, xml_controls, member->conference->xml_cfg.menus);
+#else
+ status = caller_control_build_custom(member, 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", member->conference->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");
+ }
+
/* 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) {
+ if (member->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->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");
}
@@ -1482,15 +1757,15 @@
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
- if (member->conference->dtmf_parser != NULL) {
+ if (member->dtmf_parser != NULL) {
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);
+ caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->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');
+ } else if (member->dtmf_parser != NULL) {
+ caller_action = (caller_control_action_t *)switch_ivr_digit_stream_parser_feed(member->dtmf_parser, member->digit_stream, '\0');
}
/* if a caller action has been detected, handle it */
@@ -1618,6 +1893,10 @@
switch_ivr_digit_stream_destroy(member->digit_stream);
}
+ if (member->dtmf_parser != NULL) {
+ switch_ivr_digit_stream_parser_destroy(member->dtmf_parser);
+ }
+
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer);
@@ -2888,18 +3167,17 @@
}
/* Create the conference object. */
- new_conference = conference_new(conf_name, xml_cfg, pool);
-
- /* Release the config registry handle */
- if (xml_cfg.cxml) {
- switch_xml_free(xml_cfg.cxml);
- }
+ new_conference = conference_new(conf_name, &xml_cfg, pool);
if (!new_conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
if (pool != NULL) {
switch_core_destroy_memory_pool(&pool);
}
+ /* Release the config registry handle */
+ if (xml_cfg.cxml) {
+ switch_xml_free(xml_cfg.cxml);
+ }
goto done;
}
@@ -3454,7 +3732,7 @@
}
/* Create the conference object. */
- conference = conference_new(conf_name, xml_cfg, pool);
+ conference = conference_new(conf_name, &xml_cfg, pool);
if (!conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
@@ -3481,7 +3759,7 @@
freepool = pool;
/* couldn't find the conference, create one */
} else {
- conference = conference_new(conf_name, xml_cfg, pool);
+ conference = conference_new(conf_name, &xml_cfg, pool);
if (!conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
@@ -3568,12 +3846,6 @@
}
}
- /* Release the config registry handle */
- if (xml_cfg.cxml) {
- switch_xml_free(xml_cfg.cxml);
- xml_cfg.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) {
@@ -3875,258 +4147,8 @@
/*.chat_interface */ &conference_chat_interface
};
-#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;
-
- if (!switch_strlen_zero(param)) {
- if (obj != NULL) {
- int i, found;
- char *action_name = strdup(param);
-
- if (action_name != NULL) {
- char *sep = (action_name != NULL ? strchr(action_name, ' ') : NULL);
-
- /* split the action from any parameters */
- if (sep != NULL) {
- *sep = '\0';
- }
-
- /* 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;
- }
- }
- }
- }
-
- 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 switch_status_t ivr_menu_callback_play_file(char *file, uint32_t leadin, void *member)
- {
- switch_status_t status;
-
- 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");
- }
-
- return status;
- }
-
- 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);
- }
-*/
-
-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;
-
- 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 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 (*ctx != NULL) {
- memset(*ctx, 0, sizeof(caller_control_menu_ctx_t));
-
- /* 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");
-
- /*
- // 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 switch_status_t conf_default_controls(conference_obj_t *conference)
-{
- switch_status_t status = SWITCH_STATUS_FALSE;
- uint32_t i;
- caller_control_action_t *action;
-
- assert(conference != NULL);
-
- 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;
- }
- }
- }
-
-
- 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)
-{
- switch_status_t status = SWITCH_STATUS_FALSE;
- switch_xml_t xml_kvp;
-
- assert(conference != NULL);
- assert(xml_controls != NULL);
-
- /* 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 (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
- uint32_t i;
-
- /* 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++) {
-
- 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);
-
- /* 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);
-
- status = conference_caller_control_menu_build(&menu_ctx, conference, menu_group, menu_name);
- data = (char *)menu_ctx;
- } else {
- status = SWITCH_STATUS_FALSE;
- }
-
- 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);
- }
-
- /* clean up */
- if (menu_group_name != NULL) {
- free(menu_group_name);
- }
- }
-#endif
-
- if (status == SWITCH_STATUS_SUCCESS) {
- caller_control_action_t *action;
-
- 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);
- }
- }
-
- return status;
-}
-
/* 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)
+static conference_obj_t *conference_new(char *name, conf_xml_cfg_t *xml_cfg, switch_memory_pool_t *pool)
{
conference_obj_t *conference;
switch_xml_t xml_kvp;
@@ -4162,7 +4184,7 @@
}
/* parse the profile tree for param values */
- for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
+ for (xml_kvp = switch_xml_child(xml_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] = "";
@@ -4335,6 +4357,10 @@
conference->energy_level = atoi(energy_level);
}
+ if (!switch_strlen_zero(caller_controls)) {
+ conference->caller_controls = switch_core_strdup(conference->pool, caller_controls);
+ }
+
conference->name = switch_core_strdup(conference->pool, name);
if (domain) {
conference->domain = switch_core_strdup(conference->pool, domain);
@@ -4343,31 +4369,9 @@
}
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 = conf_default_controls(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");
- }
+ /* copy the xml config sections to the new conference */
+ memcpy(&conference->xml_cfg,xml_cfg,sizeof(conf_xml_cfg_t));
/* Activate the conference mutex for exclusivity */
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
1
0