[asterisk-commits] mjordan: branch mjordan/cdrs-of-doom r386788 - in /team/mjordan/cdrs-of-doom:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Apr 28 00:11:32 CDT 2013


Author: mjordan
Date: Sun Apr 28 00:11:22 2013
New Revision: 386788

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386788
Log:
Resolve merge conflicts

Added:
    team/mjordan/cdrs-of-doom/channels/chan_gulp.c
      - copied unchanged from r386776, team/group/bridge_construction/channels/chan_gulp.c
    team/mjordan/cdrs-of-doom/configs/res_sip.conf.sample
      - copied unchanged from r386776, team/group/bridge_construction/configs/res_sip.conf.sample
    team/mjordan/cdrs-of-doom/configs/statsd.conf.sample
      - copied unchanged from r386776, team/group/bridge_construction/configs/statsd.conf.sample
    team/mjordan/cdrs-of-doom/include/asterisk/res_sip.h
      - copied unchanged from r386776, team/group/bridge_construction/include/asterisk/res_sip.h
    team/mjordan/cdrs-of-doom/include/asterisk/res_sip_pubsub.h
      - copied unchanged from r386776, team/group/bridge_construction/include/asterisk/res_sip_pubsub.h
    team/mjordan/cdrs-of-doom/include/asterisk/res_sip_session.h
      - copied unchanged from r386776, team/group/bridge_construction/include/asterisk/res_sip_session.h
    team/mjordan/cdrs-of-doom/include/asterisk/statsd.h
      - copied unchanged from r386776, team/group/bridge_construction/include/asterisk/statsd.h
    team/mjordan/cdrs-of-doom/res/res_chan_stats.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_chan_stats.c
    team/mjordan/cdrs-of-doom/res/res_sip/   (props changed)
      - copied from r386776, team/group/bridge_construction/res/res_sip/
    team/mjordan/cdrs-of-doom/res/res_sip.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip.c
    team/mjordan/cdrs-of-doom/res/res_sip.exports.in
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip.exports.in
    team/mjordan/cdrs-of-doom/res/res_sip/config_auth.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/config_auth.c
    team/mjordan/cdrs-of-doom/res/res_sip/config_domain_aliases.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/config_domain_aliases.c
    team/mjordan/cdrs-of-doom/res/res_sip/config_transport.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/config_transport.c
    team/mjordan/cdrs-of-doom/res/res_sip/include/
      - copied from r386776, team/group/bridge_construction/res/res_sip/include/
    team/mjordan/cdrs-of-doom/res/res_sip/include/res_sip_private.h
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/include/res_sip_private.h
    team/mjordan/cdrs-of-doom/res/res_sip/location.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/location.c
    team/mjordan/cdrs-of-doom/res/res_sip/sip_configuration.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/sip_configuration.c
    team/mjordan/cdrs-of-doom/res/res_sip/sip_distributor.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/sip_distributor.c
    team/mjordan/cdrs-of-doom/res/res_sip/sip_options.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/sip_options.c
    team/mjordan/cdrs-of-doom/res/res_sip/sip_outbound_auth.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip/sip_outbound_auth.c
    team/mjordan/cdrs-of-doom/res/res_sip_acl.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_acl.c
    team/mjordan/cdrs-of-doom/res/res_sip_authenticator_digest.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_authenticator_digest.c
    team/mjordan/cdrs-of-doom/res/res_sip_caller_id.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_caller_id.c
    team/mjordan/cdrs-of-doom/res/res_sip_dtmf_info.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_dtmf_info.c
    team/mjordan/cdrs-of-doom/res/res_sip_endpoint_identifier_constant.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_endpoint_identifier_constant.c
    team/mjordan/cdrs-of-doom/res/res_sip_endpoint_identifier_ip.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_endpoint_identifier_ip.c
    team/mjordan/cdrs-of-doom/res/res_sip_endpoint_identifier_user.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_endpoint_identifier_user.c
    team/mjordan/cdrs-of-doom/res/res_sip_logger.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_logger.c
    team/mjordan/cdrs-of-doom/res/res_sip_mwi.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_mwi.c
    team/mjordan/cdrs-of-doom/res/res_sip_nat.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_nat.c
    team/mjordan/cdrs-of-doom/res/res_sip_outbound_authenticator_digest.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_outbound_authenticator_digest.c
    team/mjordan/cdrs-of-doom/res/res_sip_outbound_registration.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_outbound_registration.c
    team/mjordan/cdrs-of-doom/res/res_sip_pubsub.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_pubsub.c
    team/mjordan/cdrs-of-doom/res/res_sip_pubsub.exports.in
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_pubsub.exports.in
    team/mjordan/cdrs-of-doom/res/res_sip_registrar.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_registrar.c
    team/mjordan/cdrs-of-doom/res/res_sip_rfc3326.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_rfc3326.c
    team/mjordan/cdrs-of-doom/res/res_sip_sdp_rtp.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_sdp_rtp.c
    team/mjordan/cdrs-of-doom/res/res_sip_session.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_session.c
    team/mjordan/cdrs-of-doom/res/res_sip_session.exports.in
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sip_session.exports.in
    team/mjordan/cdrs-of-doom/res/res_sorcery_realtime.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_sorcery_realtime.c
    team/mjordan/cdrs-of-doom/res/res_statsd.c
      - copied unchanged from r386776, team/group/bridge_construction/res/res_statsd.c
    team/mjordan/cdrs-of-doom/res/res_statsd.exports.in
      - copied unchanged from r386776, team/group/bridge_construction/res/res_statsd.exports.in
    team/mjordan/cdrs-of-doom/tests/test_sorcery_realtime.c
      - copied unchanged from r386776, team/group/bridge_construction/tests/test_sorcery_realtime.c
Modified:
    team/mjordan/cdrs-of-doom/   (props changed)
    team/mjordan/cdrs-of-doom/CHANGES
    team/mjordan/cdrs-of-doom/addons/res_config_mysql.c
    team/mjordan/cdrs-of-doom/apps/app_bridgewait.c
    team/mjordan/cdrs-of-doom/apps/app_confbridge.c
    team/mjordan/cdrs-of-doom/apps/confbridge/conf_config_parser.c
    team/mjordan/cdrs-of-doom/bridges/bridge_simple.c
    team/mjordan/cdrs-of-doom/channels/Makefile
    team/mjordan/cdrs-of-doom/channels/chan_sip.c
    team/mjordan/cdrs-of-doom/configure
    team/mjordan/cdrs-of-doom/funcs/func_jitterbuffer.c
    team/mjordan/cdrs-of-doom/include/asterisk/abstract_jb.h
    team/mjordan/cdrs-of-doom/include/asterisk/autoconfig.h.in
    team/mjordan/cdrs-of-doom/include/asterisk/bridging.h
    team/mjordan/cdrs-of-doom/include/asterisk/bridging_features.h
    team/mjordan/cdrs-of-doom/include/asterisk/config.h
    team/mjordan/cdrs-of-doom/include/asterisk/sorcery.h
    team/mjordan/cdrs-of-doom/include/asterisk/threadpool.h
    team/mjordan/cdrs-of-doom/include/asterisk/utils.h
    team/mjordan/cdrs-of-doom/main/abstract_jb.c
    team/mjordan/cdrs-of-doom/main/astobj2.c
    team/mjordan/cdrs-of-doom/main/bridging.c
    team/mjordan/cdrs-of-doom/main/config.c
    team/mjordan/cdrs-of-doom/main/features.c
    team/mjordan/cdrs-of-doom/main/loader.c
    team/mjordan/cdrs-of-doom/main/sorcery.c
    team/mjordan/cdrs-of-doom/main/taskprocessor.c
    team/mjordan/cdrs-of-doom/main/threadpool.c
    team/mjordan/cdrs-of-doom/main/uuid.c
    team/mjordan/cdrs-of-doom/res/Makefile
    team/mjordan/cdrs-of-doom/res/res_config_curl.c
    team/mjordan/cdrs-of-doom/res/res_config_ldap.c
    team/mjordan/cdrs-of-doom/res/res_config_odbc.c
    team/mjordan/cdrs-of-doom/res/res_config_pgsql.c
    team/mjordan/cdrs-of-doom/res/res_config_sqlite.c
    team/mjordan/cdrs-of-doom/res/res_config_sqlite3.c
    team/mjordan/cdrs-of-doom/res/res_sorcery_config.c
    team/mjordan/cdrs-of-doom/res/res_stasis.c
    team/mjordan/cdrs-of-doom/tests/test_sorcery.c

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/mjordan/cdrs-of-doom/
------------------------------------------------------------------------------
--- cdrs-of-doom-integrated (original)
+++ cdrs-of-doom-integrated Sun Apr 28 00:11:22 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-386308
+/team/group/bridge_construction:1-386787

Modified: team/mjordan/cdrs-of-doom/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/CHANGES?view=diff&rev=386788&r1=386787&r2=386788
==============================================================================
--- team/mjordan/cdrs-of-doom/CHANGES (original)
+++ team/mjordan/cdrs-of-doom/CHANGES Sun Apr 28 00:11:22 2013
@@ -67,6 +67,11 @@
 
 Channel Drivers
 ------------------
+ * When a channel driver is configured to enable jiterbuffers, they are now
+   applied unconditionally when a channel joins a bridge. If a jitterbuffer
+   is already set for that channel when it enters, such as by the JITTERBUFFER
+   function, then the existing jitterbuffer will be used and the one set by
+   the channel driver will not be applied.
 
 chan_mobile
 ------------------
@@ -99,6 +104,12 @@
    and FEATUREMAP() functions inherited to child channels by setting
    FEATURE(inherit)=yes.
 
+Functions
+------------------
+ * JITTERBUFFER now accepts an argument of 'disabled' which can be used
+   to remove jitterbuffers previously set on a channel with JITTERBUFFER.
+   The value of this setting is ignored when disabled is used for the argument.
+
 Logging
 -------------------
  * When performing queue pause/unpause on an interface without specifying an
@@ -152,6 +163,12 @@
    If any resource is available the device state is considered to be not in use.
    If no resources exist or all are unavailable the device state is considered
    to be unavailable.
+
+Sorcery
+------------------
+ * All future modules which utilize Sorcery for object persistence must have a
+   column named "id" within their schema when using the Sorcery realtime module.
+   This column must be able to contain a string of up to 128 characters in length.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 10 to Asterisk 11 --------------------

Modified: team/mjordan/cdrs-of-doom/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/addons/res_config_mysql.c?view=diff&rev=386788&r1=386787&r2=386788
==============================================================================
--- team/mjordan/cdrs-of-doom/addons/res_config_mysql.c (original)
+++ team/mjordan/cdrs-of-doom/addons/res_config_mysql.c Sun Apr 28 00:11:22 2013
@@ -316,7 +316,7 @@
 	return orig;
 }
 
-static struct ast_variable *realtime_mysql(const char *database, const char *table, va_list ap)
+static struct ast_variable *realtime_mysql(const char *database, const char *table, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
 	MYSQL_RES *result;
@@ -328,7 +328,7 @@
 	char *stringp;
 	char *chunk;
 	char *op;
-	const char *newparam, *newval;
+	const struct ast_variable *field = rt_fields;
 	struct ast_variable *var=NULL, *prev=NULL;
 
 	if (!(dbh = find_database(database, 0))) {
@@ -343,7 +343,7 @@
 	}
 
 	/* Get the first parameter and first value in our list of passed paramater/value pairs */
-	if (!(newparam = va_arg(ap, const char *)) || !(newval = va_arg(ap, const char *)))  {
+	if (!field) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
 		release_database(dbh);
 		return NULL;
@@ -358,21 +358,20 @@
 	/* Create the first part of the query using the first parameter/value pairs we just extracted
 	   If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
 
-	if (!strchr(newparam, ' ')) 
+	if (!strchr(field->name, ' ')) 
 		op = " ="; 
 	else 
 		op = "";
 
-	ESCAPE_STRING(buf, newval);
-	ast_str_set(&sql, 0, "SELECT * FROM %s WHERE %s%s '%s'", table, newparam, op, ast_str_buffer(buf));
-	while ((newparam = va_arg(ap, const char *))) {
-		newval = va_arg(ap, const char *);
-		if (!strchr(newparam, ' ')) 
+	ESCAPE_STRING(buf, field->value);
+	ast_str_set(&sql, 0, "SELECT * FROM %s WHERE %s%s '%s'", table, field->name, op, ast_str_buffer(buf));
+	while ((field = field->next)) {
+		if (!strchr(field->name, ' ')) 
 			op = " ="; 
 		else
 			op = "";
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&sql, 0, " AND %s%s '%s'", newparam, op, ast_str_buffer(buf));
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&sql, 0, " AND %s%s '%s'", field->name, op, ast_str_buffer(buf));
 	}
 
 	ast_debug(1, "MySQL RealTime: Retrieve SQL: %s\n", ast_str_buffer(sql));
@@ -417,7 +416,7 @@
 	return var;
 }
 
-static struct ast_config *realtime_multi_mysql(const char *database, const char *table, va_list ap)
+static struct ast_config *realtime_multi_mysql(const char *database, const char *table, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
 	MYSQL_RES *result;
@@ -430,7 +429,7 @@
 	char *stringp;
 	char *chunk;
 	char *op;
-	const char *newparam, *newval;
+	const struct ast_variable *field = rt_fields;
 	struct ast_variable *var = NULL;
 	struct ast_config *cfg = NULL;
 	struct ast_category *cat = NULL;
@@ -454,14 +453,14 @@
 	}
 
 	/* Get the first parameter and first value in our list of passed paramater/value pairs */
-	if (!(newparam = va_arg(ap, const char *)) || !(newval = va_arg(ap, const char *)))  {
+	if (!field) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime retrieval requires at least 1 parameter and 1 value to search on.\n");
 		ast_config_destroy(cfg);
 		release_database(dbh);
 		return NULL;
 	}
 
-	initfield = ast_strdupa(newparam);
+	initfield = ast_strdupa(field->name);
 	if ((op = strchr(initfield, ' '))) {
 		*op = '\0';
 	}
@@ -476,18 +475,17 @@
 	/* Create the first part of the query using the first parameter/value pairs we just extracted
 	   If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
 
-	if (!strchr(newparam, ' '))
+	if (!strchr(field->name, ' '))
 		op = " =";
 	else
 		op = "";
 
-	ESCAPE_STRING(buf, newval);
-	ast_str_set(&sql, 0, "SELECT * FROM %s WHERE %s%s '%s'", table, newparam, op, ast_str_buffer(buf));
-	while ((newparam = va_arg(ap, const char *))) {
-		newval = va_arg(ap, const char *);
-		if (!strchr(newparam, ' ')) op = " ="; else op = "";
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&sql, 0, " AND %s%s '%s'", newparam, op, ast_str_buffer(buf));
+	ESCAPE_STRING(buf, field->value);
+	ast_str_set(&sql, 0, "SELECT * FROM %s WHERE %s%s '%s'", table, field->name, op, ast_str_buffer(buf));
+	while ((field = field->next)) {
+		if (!strchr(field->name, ' ')) op = " ="; else op = "";
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&sql, 0, " AND %s%s '%s'", field->name, op, ast_str_buffer(buf));
 	}
 
 	if (initfield) {
@@ -540,11 +538,11 @@
 	return cfg;
 }
 
-static int update_mysql(const char *database, const char *tablename, const char *keyfield, const char *lookup, va_list ap)
+static int update_mysql(const char *database, const char *tablename, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
 	my_ulonglong numrows;
-	const char *newparam, *newval;
+	const struct ast_variable *field = rt_fields;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
 	struct tables *table;
 	struct columns *column = NULL;
@@ -574,7 +572,7 @@
 	}
 
 	/* Get the first parameter and first value in our list of passed paramater/value pairs */
-	if (!(newparam = va_arg(ap, const char *)) || !(newval = va_arg(ap, const char *)))  {
+	if (!field) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime update requires at least 1 parameter and 1 value to update.\n");
 		release_table(table);
 		release_database(dbh);
@@ -582,8 +580,8 @@
 	}
 
 	/* Check that the column exists in the table */
-	if (!(column = find_column(table, newparam))) {
-		ast_log(LOG_ERROR, "MySQL RealTime: Updating column '%s', but that column does not exist within the table '%s' (first pair MUST exist)!\n", newparam, tablename);
+	if (!(column = find_column(table, field->name))) {
+		ast_log(LOG_ERROR, "MySQL RealTime: Updating column '%s', but that column does not exist within the table '%s' (first pair MUST exist)!\n", field->name, tablename);
 		release_table(table);
 		release_database(dbh);
 		return -1;
@@ -599,29 +597,27 @@
 	/* Create the first part of the query using the first parameter/value pairs we just extracted
 	   If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
 
-	ESCAPE_STRING(buf, newval);
-	ast_str_set(&sql, 0, "UPDATE %s SET `%s` = '%s'", tablename, newparam, ast_str_buffer(buf));
+	ESCAPE_STRING(buf, field->value);
+	ast_str_set(&sql, 0, "UPDATE %s SET `%s` = '%s'", tablename, field->name, ast_str_buffer(buf));
 
 	/* If the column length isn't long enough, give a chance to lengthen it. */
 	if (strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0) {
-		internal_require(database, tablename, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
-	}
-
-	while ((newparam = va_arg(ap, const char *))) {
-		newval = va_arg(ap, const char *);
-
+		internal_require(database, tablename, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
+	}
+
+	while ((field = field->next)) {
 		/* If the column is not within the table, then skip it */
-		if (!(column = find_column(table, newparam))) {
-			ast_log(LOG_WARNING, "Attempted to update column '%s' in table '%s', but column does not exist!\n", newparam, tablename);
+		if (!(column = find_column(table, field->name))) {
+			ast_log(LOG_WARNING, "Attempted to update column '%s' in table '%s', but column does not exist!\n", field->name, tablename);
 			continue;
 		}
 
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&sql, 0, ", `%s` = '%s'", newparam, ast_str_buffer(buf));
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&sql, 0, ", `%s` = '%s'", field->value, ast_str_buffer(buf));
 
 		/* If the column length isn't long enough, give a chance to lengthen it. */
 		if (strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0) {
-			internal_require(database, tablename, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
+			internal_require(database, tablename, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
 		}
 	}
 
@@ -653,12 +649,12 @@
 	return (int)numrows;
 }
 
-static int update2_mysql(const char *database, const char *tablename, va_list ap)
+static int update2_mysql(const char *database, const char *tablename, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
 {
 	struct mysql_conn *dbh;
 	my_ulonglong numrows;
 	int first;
-	const char *newparam, *newval;
+	const struct ast_variable *field;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
 	struct ast_str *where = ast_str_thread_get(&sql2_buf, 100);
 	struct tables *table;
@@ -697,51 +693,38 @@
 	}
 
 	first = 1;
-	while ((newparam = va_arg(ap, const char *))) {
-		if (!(column = find_column(table, newparam))) {
-			ast_log(LOG_ERROR, "Updating on column '%s', but that column does not exist within the table '%s'!\n", newparam, tablename);
+	for (field = lookup_fields; field; field = field->next) {
+		if (!(column = find_column(table, field->name))) {
+			ast_log(LOG_ERROR, "Updating on column '%s', but that column does not exist within the table '%s'!\n", field->name, tablename);
 			release_table(table);
 			release_database(dbh);
 			return -1;
 		}
-		if (!(newval = va_arg(ap, const char *))) {
-			ast_log(LOG_ERROR, "Invalid arguments: no value specified for column '%s' on '%s@%s'\n", newparam, tablename, database);
-			release_table(table);
-			release_database(dbh);
-			return -1;
-		}
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&where, 0, "%s `%s` = '%s'", first ? "" : " AND", newparam, ast_str_buffer(buf));
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&where, 0, "%s `%s` = '%s'", first ? "" : " AND", field->name, ast_str_buffer(buf));
 		first = 0;
 
 		/* If the column length isn't long enough, give a chance to lengthen it. */
 		if (strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0) {
-			internal_require(database, tablename, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
+			internal_require(database, tablename, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
 		}
 	}
 
 	first = 1;
-	while ((newparam = va_arg(ap, const char *))) {
-		if (!(newval = va_arg(ap, const char *))) {
-			ast_log(LOG_ERROR, "Invalid arguments: no value specified for column '%s' on '%s@%s'\n", newparam, tablename, database);
-			release_table(table);
-			release_database(dbh);
-			return -1;
-		}
-
+	for (field = update_fields; field; field = field->next) {
 		/* If the column is not within the table, then skip it */
-		if (!(column = find_column(table, newparam))) {
-			ast_log(LOG_WARNING, "Attempted to update column '%s' in table '%s', but column does not exist!\n", newparam, tablename);
+		if (!(column = find_column(table, field->name))) {
+			ast_log(LOG_WARNING, "Attempted to update column '%s' in table '%s', but column does not exist!\n", field->name, tablename);
 			continue;
 		}
 
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&sql, 0, "%s `%s` = '%s'", first ? "" : ",", newparam, ast_str_buffer(buf));
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&sql, 0, "%s `%s` = '%s'", first ? "" : ",", field->name, ast_str_buffer(buf));
 		first = 0;
 
 		/* If the column length isn't long enough, give a chance to lengthen it. */
 		if (strncmp(column->type, "char", 4) == 0 || strncmp(column->type, "varchar", 7) == 0) {
-			internal_require(database, tablename, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
+			internal_require(database, tablename, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
 		}
 	}
 
@@ -773,14 +756,14 @@
 	return (int)numrows;
 }
  
-static int store_mysql(const char *database, const char *table, va_list ap)
+static int store_mysql(const char *database, const char *table, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
 	my_ulonglong insertid;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
 	struct ast_str *sql2 = ast_str_thread_get(&sql2_buf, 16);
 	struct ast_str *buf = ast_str_thread_get(&scratch_buf, 16);
-	const char *newparam, *newval;
+	const struct ast_variable *field = rt_fields;
 
 	if (!(dbh = find_database(database, 1))) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
@@ -793,7 +776,7 @@
 		return -1;
 	}
 	/* Get the first parameter and first value in our list of passed paramater/value pairs */
-	if (!(newparam = va_arg(ap, const char *)) || !(newval = va_arg(ap, const char *))) {
+	if (!field) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Realtime storage requires at least 1 parameter and 1 value to search on.\n");
 		release_database(dbh);
 		return -1;
@@ -805,20 +788,17 @@
 	}
 	/* Create the first part of the query using the first parameter/value pairs we just extracted
 		If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
-	ESCAPE_STRING(buf, newval);
-	ast_str_set(&sql, 0, "INSERT INTO %s (`%s`", table, newparam);
+	ESCAPE_STRING(buf, field->value);
+	ast_str_set(&sql, 0, "INSERT INTO %s (`%s`", table, field->name);
 	ast_str_set(&sql2, 0, ") VALUES ('%s'", ast_str_buffer(buf));
 
-	internal_require(database, table, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
-
-	while ((newparam = va_arg(ap, const char *))) {
-		if ((newval = va_arg(ap, const char *))) {
-			ESCAPE_STRING(buf, newval);
-		} else {
-			ast_str_reset(buf);
-		}
-		if (internal_require(database, table, newparam, RQ_CHAR, ast_str_strlen(buf), SENTINEL) == 0) {
-			ast_str_append(&sql, 0, ", `%s`", newparam);
+	internal_require(database, table, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL);
+
+	while ((field = field->next)) {
+		ESCAPE_STRING(buf, field->value);
+
+		if (internal_require(database, table, field->name, RQ_CHAR, ast_str_strlen(buf), SENTINEL) == 0) {
+			ast_str_append(&sql, 0, ", `%s`", field->name);
 			ast_str_append(&sql2, 0, ", '%s'", ast_str_buffer(buf));
 		}
 	}
@@ -846,13 +826,13 @@
 	return (int)insertid;
 }
 
-static int destroy_mysql(const char *database, const char *table, const char *keyfield, const char *lookup, va_list ap)
+static int destroy_mysql(const char *database, const char *table, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
 	my_ulonglong numrows;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
 	struct ast_str *buf = ast_str_thread_get(&scratch_buf, 16);
-	const char *newparam, *newval;
+	const struct ast_variable *field;
 
 	if (!(dbh = find_database(database, 1))) {
 		ast_log(LOG_WARNING, "MySQL RealTime: Invalid database specified: '%s' (check res_mysql.conf)\n", database);
@@ -884,10 +864,9 @@
 	   If there is only 1 set, then we have our query. Otherwise, loop thru the list and concat */
 	ESCAPE_STRING(buf, lookup);
 	ast_str_set(&sql, 0, "DELETE FROM %s WHERE `%s` = '%s'", table, keyfield, ast_str_buffer(buf));
-	while ((newparam = va_arg(ap, const char *))) {
-		newval = va_arg(ap, const char *);
-		ESCAPE_STRING(buf, newval);
-		ast_str_append(&sql, 0, " AND `%s` = '%s'", newparam, ast_str_buffer(buf));
+	for (field = rt_fields; field; field = field->next) {
+		ESCAPE_STRING(buf, field->value);
+		ast_str_append(&sql, 0, " AND `%s` = '%s'", field->name, ast_str_buffer(buf));
 	}
 
 	ast_debug(1, "MySQL RealTime: Delete SQL: %s\n", ast_str_buffer(sql));

Modified: team/mjordan/cdrs-of-doom/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_bridgewait.c?view=diff&rev=386788&r1=386787&r2=386788
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_bridgewait.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_bridgewait.c Sun Apr 28 00:11:22 2013
@@ -196,7 +196,8 @@
 	ast_mutex_lock(&bridgewait_lock);
 	if (!holding_bridge) {
 		holding_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_HOLDING,
-			AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM);
+			AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
+				| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM);
 	}
 	ast_mutex_unlock(&bridgewait_lock);
 	if (!holding_bridge) {

Modified: team/mjordan/cdrs-of-doom/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/cdrs-of-doom/apps/app_confbridge.c?view=diff&rev=386788&r1=386787&r2=386788
==============================================================================
--- team/mjordan/cdrs-of-doom/apps/app_confbridge.c (original)
+++ team/mjordan/cdrs-of-doom/apps/app_confbridge.c Sun Apr 28 00:11:22 2013
@@ -317,14 +317,47 @@
 static int conference_bridge_hash_cb(const void *obj, const int flags)
 {
 	const struct confbridge_conference *conference = obj;
-	return ast_str_case_hash(conference->name);
+	const char *name = obj;
+	int hash;
+
+	switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
+	default:
+	case OBJ_POINTER:
+		name = conference->name;
+		/* Fall through */
+	case OBJ_KEY:
+		hash = ast_str_case_hash(name);
+		break;
+	case OBJ_PARTIAL_KEY:
+		/* Should never happen in hash callback. */
+		ast_assert(0);
+		hash = 0;
+		break;
+	}
+	return hash;
 }
 
 /*! \brief Comparison function used for conference bridges container */
 static int conference_bridge_cmp_cb(void *obj, void *arg, int flags)
 {
-	const struct confbridge_conference *conference0 = obj, *conference1 = arg;
-	return (!strcasecmp(conference0->name, conference1->name) ? CMP_MATCH | CMP_STOP : 0);
+	const struct confbridge_conference *left = obj;
+	const struct confbridge_conference *right = arg;
+	const char *right_name = arg;
+	int cmp;
+
+	switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
+	default:
+	case OBJ_POINTER:
+		right_name = right->name;
+		/* Fall through */
+	case OBJ_KEY:
+		cmp = strcasecmp(left->name, right_name);
+		break;
+	case OBJ_PARTIAL_KEY:
+		cmp = strncasecmp(left->name, right_name, strlen(right_name));
+		break;
+	}
+	return cmp ? 0 : CMP_MATCH;
 }
 
 const char *conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
@@ -1241,12 +1274,9 @@
  */
 static struct confbridge_conference *join_conference_bridge(const char *conference_name, struct confbridge_user *user)
 {
-	struct confbridge_conference *conference = NULL;
+	struct confbridge_conference *conference;
 	struct post_join_action *action;
-	struct confbridge_conference tmp;
 	int max_members_reached = 0;
-
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
 
 	/* We explictly lock the conference bridges container ourselves so that other callers can not create duplicate conferences at the same */
 	ao2_lock(conference_bridges);
@@ -1254,8 +1284,7 @@
 	ast_debug(1, "Trying to find conference bridge '%s'\n", conference_name);
 
 	/* Attempt to find an existing conference bridge */
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
-
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (conference && conference->b_profile.max_members) {
 		max_members_reached = conference->b_profile.max_members > conference->activeusers ? 0 : 1;
 	}
@@ -2231,7 +2260,7 @@
 static char *complete_confbridge_name(const char *line, const char *word, int pos, int state)
 {
 	int which = 0;
-	struct confbridge_conference *conference = NULL;
+	struct confbridge_conference *conference;
 	char *res = NULL;
 	int wordlen = strlen(word);
 	struct ao2_iterator iter;
@@ -2250,17 +2279,15 @@
 	return res;
 }
 
-static char *complete_confbridge_participant(const char *bridge_name, const char *line, const char *word, int pos, int state)
+static char *complete_confbridge_participant(const char *conference_name, const char *line, const char *word, int pos, int state)
 {
 	int which = 0;
 	RAII_VAR(struct confbridge_conference *, conference, NULL, ao2_cleanup);
-	struct confbridge_conference tmp;
 	struct confbridge_user *user;
 	char *res = NULL;
 	int wordlen = strlen(word);
 
-	ast_copy_string(tmp.name, bridge_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		return NULL;
 	}
@@ -2286,8 +2313,7 @@
 
 static char *handle_cli_confbridge_kick(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -2310,8 +2336,7 @@
 		return CLI_SHOWUSAGE;
 	}
 
-	ast_copy_string(tmp.name, a->argv[2], sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, a->argv[2], OBJ_KEY);
 	if (!conference) {
 		ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
 		return CLI_SUCCESS;
@@ -2401,10 +2426,8 @@
 
 	if (a->argc == 3) {
 		struct confbridge_user *user;
-		struct confbridge_conference tmp;
-
-		ast_copy_string(tmp.name, a->argv[2], sizeof(tmp.name));
-		conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+
+		conference = ao2_find(conference_bridges, a->argv[2], OBJ_KEY);
 		if (!conference) {
 			ast_cli(a->fd, "No conference bridge named '%s' found!\n", a->argv[2]);
 			return CLI_SUCCESS;
@@ -2434,12 +2457,10 @@
  */
 static int generic_lock_unlock_helper(int lock, const char *conference_name)
 {
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 	int res = 0;
 
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		return -1;
 	}
@@ -2461,12 +2482,11 @@
  */
 static int generic_mute_unmute_helper(int mute, const char *conference_name, const char *chan_name)
 {
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
-	struct confbridge_user *user = NULL;
+	struct confbridge_conference *conference;
+	struct confbridge_user *user;
 	int res = 0;
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		return -1;
 	}
@@ -2613,8 +2633,7 @@
 static char *handle_cli_confbridge_start_record(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	const char *rec_file = NULL;
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 
 	switch (cmd) {
 	case CLI_INIT:
@@ -2639,8 +2658,7 @@
 		rec_file = a->argv[4];
 	}
 
-	ast_copy_string(tmp.name, a->argv[3], sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, a->argv[3], OBJ_KEY);
 	if (!conference) {
 		ast_cli(a->fd, "Conference not found.\n");
 		return CLI_FAILURE;
@@ -2671,8 +2689,7 @@
 
 static char *handle_cli_confbridge_stop_record(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 	int ret;
 
 	switch (cmd) {
@@ -2692,8 +2709,7 @@
 		return CLI_SHOWUSAGE;
 	}
 
-	ast_copy_string(tmp.name, a->argv[3], sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, a->argv[3], OBJ_KEY);
 	if (!conference) {
 		ast_cli(a->fd, "Conference not found.\n");
 		return CLI_SUCCESS;
@@ -2760,7 +2776,6 @@
 	const char *conference_name = astman_get_header(m, "Conference");
 	struct confbridge_user *user;
 	struct confbridge_conference *conference;
-	struct confbridge_conference tmp;
 	char id_text[80];
 	int total = 0;
 
@@ -2776,8 +2791,7 @@
 		astman_send_error(s, m, "No active conferences.");
 		return 0;
 	}
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		astman_send_error(s, m, "No Conference by that name found.");
 		return 0;
@@ -2810,7 +2824,7 @@
 static int action_confbridgelistrooms(struct mansession *s, const struct message *m)
 {
 	const char *actionid = astman_get_header(m, "ActionID");
-	struct confbridge_conference *conference = NULL;
+	struct confbridge_conference *conference;
 	struct ao2_iterator iter;
 	char id_text[512] = "";
 	int totalitems = 0;
@@ -2936,8 +2950,7 @@
 {
 	const char *conference_name = astman_get_header(m, "Conference");
 	const char *channel = astman_get_header(m, "Channel");
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 	int found = 0;
 
 	if (ast_strlen_zero(conference_name)) {
@@ -2949,8 +2962,7 @@
 		return 0;
 	}
 
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		astman_send_error(s, m, "No Conference by that name found.");
 		return 0;
@@ -2971,8 +2983,7 @@
 {
 	const char *conference_name = astman_get_header(m, "Conference");
 	const char *recordfile = astman_get_header(m, "RecordFile");
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 
 	if (ast_strlen_zero(conference_name)) {
 		astman_send_error(s, m, "No Conference name provided.");
@@ -2983,8 +2994,7 @@
 		return 0;
 	}
 
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		astman_send_error(s, m, "No Conference by that name found.");
 		return 0;
@@ -3017,8 +3027,7 @@
 static int action_confbridgestoprecord(struct mansession *s, const struct message *m)
 {
 	const char *conference_name = astman_get_header(m, "Conference");
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_conference *conference;
 
 	if (ast_strlen_zero(conference_name)) {
 		astman_send_error(s, m, "No Conference name provided.");
@@ -3029,8 +3038,7 @@
 		return 0;
 	}
 
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		astman_send_error(s, m, "No Conference by that name found.");
 		return 0;
@@ -3054,9 +3062,8 @@
 {
 	const char *conference_name = astman_get_header(m, "Conference");
 	const char *channel = astman_get_header(m, "Channel");
-	struct confbridge_user *user = NULL;
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_conference tmp;
+	struct confbridge_user *user;
+	struct confbridge_conference *conference;
 
 	if (ast_strlen_zero(conference_name)) {
 		astman_send_error(s, m, "No Conference name provided.");
@@ -3071,8 +3078,7 @@
 		return 0;
 	}
 
-	ast_copy_string(tmp.name, conference_name, sizeof(tmp.name));
-	conference = ao2_find(conference_bridges, &tmp, OBJ_POINTER);
+	conference = ao2_find(conference_bridges, conference_name, OBJ_KEY);
 	if (!conference) {
 		astman_send_error(s, m, "No Conference by that name found.");
 		return 0;
@@ -3101,10 +3107,9 @@
 
 static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
-	char *parse = NULL;
-	struct confbridge_conference *conference = NULL;
-	struct confbridge_user *user = NULL;
-	struct confbridge_conference tmp;
+	char *parse;
+	struct confbridge_conference *conference;
+	struct confbridge_user *user;
 	int count = 0;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(type);
@@ -3120,12 +3125,7 @@
 	if (ast_strlen_zero(args.confno) || ast_strlen_zero(args.type)) {
 		return -1;
 	}
-	if (!ao2_container_count(conference_bridges)) {
-		snprintf(buf, len, "0");
-		return 0;
-	}
-	ast_copy_string(tmp.name, args.confno, sizeof(tmp.name));

[... 5984 lines stripped ...]



More information about the asterisk-commits mailing list