[asterisk-commits] qwell: branch group/pimp_my_sip r386867 - in /team/group/pimp_my_sip: ./ addo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 29 12:56:16 CDT 2013


Author: qwell
Date: Mon Apr 29 12:56:05 2013
New Revision: 386867

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386867
Log:
Multiple revisions 386577,386623-386624,386638,386640,386676,386684-386686,386731,386746,386760,386774,386793,386841

........
  r386577 | file | 2013-04-25 16:32:48 -0500 (Thu, 25 Apr 2013) | 2 lines
  
  Don't bind to anything in the sample configuration so we don't clash with chan_sip on a "make samples" right now.
........
  r386623 | dlee | 2013-04-26 15:03:32 -0500 (Fri, 26 Apr 2013) | 1 line
  
  Ignore *.[oi] files in res/res_sip
........
  r386624 | dlee | 2013-04-26 15:05:15 -0500 (Fri, 26 Apr 2013) | 27 lines
  
  Example of how to use the Stasis message bus
  
  In order to get people familiar with the Stasis message bus, it would
  be useful to have something of a tutorial. Since I'm not clever enough
  to think of some cool integration we could do with Twitter, I settled
  for something that might actually be useful.
  
  This patch adds a res_statsd.so module, which implements a basic
  statsd[1] client. Statsd is a very simple statistics gathering server,
  which can publish its results to a backend graphing engine, like
  Graphite[2]. There are several different Statsd server
  implementations[3], so you can pick what works best for your
  environment.
  
  The actual example of how to use the Stasis message bus is in
  res_chan_stats.so. This module demonstrates how to use subscriptions
  and the message router by monitoring messages and posting channels
  stats to the statsd server.
  
  A wiki page walking through res_chan_stats.so is forthcoming.
  
   [1]: https://github.com/etsy/statsd/
   [2]: http://graphite.readthedocs.org/en/latest/
   [3]: http://joemiller.me/2011/09/21/list-of-statsd-server-implementations/
  
  Review: https://reviewboard.asterisk.org/r/2460/
........
  r386638 | mmichelson | 2013-04-26 15:32:11 -0500 (Fri, 26 Apr 2013) | 5 lines
  
  Add an \extref doxygen pointer for libuuid.
  
  Thanks to Olle Johansson for suggesting this.
........
  r386640 | dlee | 2013-04-26 16:00:45 -0500 (Fri, 26 Apr 2013) | 1 line
  
  Removing stray printf from r386540
........
  r386676 | mjordan | 2013-04-26 16:27:24 -0500 (Fri, 26 Apr 2013) | 19 lines
  
  Clean up resources in features on exit
  
  This patch cleans up two things features:
  * It properly unregisters the CLI commands that features registered
  * It cancels and performs a pthread_join on the created parking thread. This
    not only properly joins a non-detached thread, but also prevents disposing
    of the parking lots prior to the parking thread completely exiting.
  
  (closes issue ASTERISK-21407)
  Reported by: Corey Farrell
  patches:
    features_shutdown-r2.patch uploaded by Corey Farrell (License 5909)
  ........
  
  Merged revisions 386641 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 386642 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r386684 | dlee | 2013-04-26 16:31:39 -0500 (Fri, 26 Apr 2013) | 5 lines
  
  By popular demand, putting the about-to-load-module printf back.
  
  But now it only prints during the initial startup, and prints at verbose 1
  level.
........
  r386685 | mjordan | 2013-04-26 16:34:16 -0500 (Fri, 26 Apr 2013) | 20 lines
  
  Clean up memory leak in config file on off nominal paths when glob is allowed
  
  If a system allows for its usage, Asterisk will use glob to help parse
  Asterisk .conf files. The config file loading routine was leaking the memory
  allocated by the glob() routine when the config file was in an unmodified
  or invalid state.
  
  This patch properly calls globfree in those off nominal paths.
  
  (closes issue ASTERISK-21412)
  Reported by: Corey Farrell
  patches:
    config_glob_leak.patch uploaded by Corey Farrell (license 5909)
  ........
  
  Merged revisions 386672 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 386677 from http://svn.asterisk.org/svn/asterisk/branches/11
........
  r386686 | mjordan | 2013-04-26 16:52:06 -0500 (Fri, 26 Apr 2013) | 16 lines
  
  Add missing module dependencies to various res_sip* modules
  
  This patch updates the various res_sip modules with their proper menuselect
  options and proper dependencies, such that Asterisk still has a snowball's
  chance in hell of compiling without pjproject.
  
  Much thanks to snuffy(-home|-work) for making everyone's life
  easier with this patch.
  
  Review: https://reviewboard.asterisk.org/r/2472/
  
  (closes issue ASTERISK-21669)
  Reported by: snuffy
  patches:
    xml-depends.diff uploaded by snuffy (license 5024)
........
  r386731 | file | 2013-04-27 07:01:29 -0500 (Sat, 27 Apr 2013) | 11 lines
  
  Add support for a realtime sorcery module.
  
  This change does the following:
  
  1. Adds the sorcery realtime module
  2. Adds unit tests for the sorcery realtime module
  3. Changes the realtime core to use an ast_variable list instead of variadic arguments
  4. Changes all realtime drivers to accept an ast_variable list
  
  Review: https://reviewboard.asterisk.org/r/2424/
........
  r386746 | file | 2013-04-27 11:17:01 -0500 (Sat, 27 Apr 2013) | 2 lines
  
  Update res_config_sqlite to use the ast_variable lists.
........
  r386760 | file | 2013-04-27 14:03:39 -0500 (Sat, 27 Apr 2013) | 2 lines
  
  Tweak res_sip priority so it gets loaded first before all other SIP stuff.
........
  r386774 | kmoore | 2013-04-27 22:32:35 -0500 (Sat, 27 Apr 2013) | 1 line
  
  Fix spelling error in python doc
........
  r386793 | oej | 2013-04-29 03:40:16 -0500 (Mon, 29 Apr 2013) | 2 lines
  
  Change pointer to existing wiki page instead of non-existing page
........
  r386841 | oej | 2013-04-29 08:38:59 -0500 (Mon, 29 Apr 2013) | 10 lines
  
  Play periodic prompts for first call in a call queue
  
  Review: https://reviewboard.asterisk.org/r/2263/
  ........
  
  Merged revisions 386792 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........
  
  Merged revisions 386794 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 386577,386623-386624,386638,386640,386676,386684-386686,386731,386746,386760,386774,386793,386841 from http://svn.asterisk.org/svn/asterisk/trunk

Added:
    team/group/pimp_my_sip/configs/statsd.conf.sample
      - copied unchanged from r386841, trunk/configs/statsd.conf.sample
    team/group/pimp_my_sip/include/asterisk/statsd.h
      - copied unchanged from r386841, trunk/include/asterisk/statsd.h
    team/group/pimp_my_sip/res/res_chan_stats.c
      - copied unchanged from r386841, trunk/res/res_chan_stats.c
    team/group/pimp_my_sip/res/res_sorcery_realtime.c
      - copied unchanged from r386841, trunk/res/res_sorcery_realtime.c
    team/group/pimp_my_sip/res/res_statsd.c
      - copied unchanged from r386841, trunk/res/res_statsd.c
    team/group/pimp_my_sip/res/res_statsd.exports.in
      - copied unchanged from r386841, trunk/res/res_statsd.exports.in
    team/group/pimp_my_sip/tests/test_sorcery_realtime.c
      - copied unchanged from r386841, trunk/tests/test_sorcery_realtime.c
Modified:
    team/group/pimp_my_sip/   (props changed)
    team/group/pimp_my_sip/CHANGES
    team/group/pimp_my_sip/addons/res_config_mysql.c
    team/group/pimp_my_sip/apps/app_queue.c
    team/group/pimp_my_sip/configs/res_sip.conf.sample
    team/group/pimp_my_sip/include/asterisk/config.h
    team/group/pimp_my_sip/include/asterisk/doxygen/commits.h
    team/group/pimp_my_sip/include/asterisk/utils.h
    team/group/pimp_my_sip/main/config.c
    team/group/pimp_my_sip/main/features.c
    team/group/pimp_my_sip/main/loader.c
    team/group/pimp_my_sip/main/sorcery.c
    team/group/pimp_my_sip/main/uuid.c
    team/group/pimp_my_sip/res/res_config_curl.c
    team/group/pimp_my_sip/res/res_config_ldap.c
    team/group/pimp_my_sip/res/res_config_odbc.c
    team/group/pimp_my_sip/res/res_config_pgsql.c
    team/group/pimp_my_sip/res/res_config_sqlite.c
    team/group/pimp_my_sip/res/res_config_sqlite3.c
    team/group/pimp_my_sip/res/res_sip/   (props changed)
    team/group/pimp_my_sip/res/res_sip.c
    team/group/pimp_my_sip/res/res_sip_acl.c
    team/group/pimp_my_sip/res/res_sip_dtmf_info.c
    team/group/pimp_my_sip/res/res_sip_endpoint_identifier_constant.c
    team/group/pimp_my_sip/res/res_sip_endpoint_identifier_ip.c
    team/group/pimp_my_sip/res/res_sip_endpoint_identifier_user.c
    team/group/pimp_my_sip/res/res_sip_logger.c
    team/group/pimp_my_sip/res/res_sip_mwi.c
    team/group/pimp_my_sip/res/res_sip_nat.c
    team/group/pimp_my_sip/res/res_sip_outbound_authenticator_digest.c
    team/group/pimp_my_sip/res/res_sip_outbound_registration.c
    team/group/pimp_my_sip/res/res_sip_pubsub.c
    team/group/pimp_my_sip/res/res_sip_registrar.c
    team/group/pimp_my_sip/res/res_sip_rfc3326.c
    team/group/pimp_my_sip/rest-api-templates/swagger_model.py

Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr 29 12:56:05 2013
@@ -1,1 +1,1 @@
-/trunk:1-386489,386540-386541
+/trunk:1-386866

Modified: team/group/pimp_my_sip/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/CHANGES?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/CHANGES (original)
+++ team/group/pimp_my_sip/CHANGES Mon Apr 29 12:56:05 2013
@@ -147,9 +147,17 @@
    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 --------------------
 ------------------------------------------------------------------------------
+
+
 
 Build System
 -------------------
@@ -294,6 +302,9 @@
    state_interface has been set.
 
  * Add queue monitoring hints.  exten => 8501,hint,Queue:markq.
+
+ * App_queue will now play periodic announcements for the caller that
+   holds the first position in the queue while waiting for answer.
 
 SayUnixTime
 ------------------

Modified: team/group/pimp_my_sip/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/addons/res_config_mysql.c?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/addons/res_config_mysql.c (original)
+++ team/group/pimp_my_sip/addons/res_config_mysql.c Mon Apr 29 12:56:05 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/group/pimp_my_sip/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_queue.c?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/apps/app_queue.c (original)
+++ team/group/pimp_my_sip/apps/app_queue.c Mon Apr 29 12:56:05 2013
@@ -4071,7 +4071,7 @@
  *
  * \todo eventually all call forward logic should be intergerated into and replaced by ast_call_forward()
  */
-static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed)
+static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed, int ringing)
 {
 	const char *queue = qe->parent->name;
 	struct callattempt *o, *start = NULL, *prev = NULL;
@@ -4582,6 +4582,16 @@
 		}
 	}
 
+	/* Make a position announcement, if enabled */
+ 	if (qe->parent->announcefrequency) {
+		say_position(qe, ringing);
+	}
+
+ 	/* Make a periodic announcement, if enabled */
+ 	if (qe->parent->periodicannouncefrequency) {
+ 		say_periodic_announcement(qe, ringing);
+ 	}
+ 
 	if (!*to) {
 		for (o = start; o; o = o->call_next) {
 			rna(orig, qe, o->interface, o->member->membername, 1);
@@ -5378,7 +5388,7 @@
 	ring_one(qe, outgoing, &numbusies);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies,
 		ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT),
-		forwardsallowed);
+		forwardsallowed, ringing);
 	/* The ast_channel_datastore_remove() function could fail here if the
 	 * datastore was moved to another channel during a masquerade. If this is
 	 * the case, don't free the datastore here because later, when the channel

Modified: team/group/pimp_my_sip/configs/res_sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/configs/res_sip.conf.sample?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/configs/res_sip.conf.sample (original)
+++ team/group/pimp_my_sip/configs/res_sip.conf.sample Mon Apr 29 12:56:05 2013
@@ -1,10 +1,10 @@
 ; This is an in-flux configuration file for the res_sip module, it will change as things progress
 
 ;;; Transports
-[local]
-type=transport
-protocol=udp ; Supported protocols are udp, tcp, and tls
-bind=0.0.0.0 ; This supports both IPv4 and IPv6, port is optional
+;[local]
+;type=transport
+;protocol=udp ; Supported protocols are udp, tcp, and tls
+;bind=0.0.0.0 ; This supports both IPv4 and IPv6, port is optional
 
 ;;; Endpoints
 [endpoint]

Modified: team/group/pimp_my_sip/include/asterisk/config.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/config.h?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/config.h (original)
+++ team/group/pimp_my_sip/include/asterisk/config.h Mon Apr 29 12:56:05 2013
@@ -98,12 +98,12 @@
 };
 
 typedef struct ast_config *config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, struct ast_flags flags, const char *suggested_include_file, const char *who_asked);
-typedef struct ast_variable *realtime_var_get(const char *database, const char *table, va_list ap);
-typedef struct ast_config *realtime_multi_get(const char *database, const char *table, va_list ap);
-typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
-typedef int realtime_update2(const char *database, const char *table, va_list ap);
-typedef int realtime_store(const char *database, const char *table, va_list ap);
-typedef int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
+typedef struct ast_variable *realtime_var_get(const char *database, const char *table, const struct ast_variable *fields);
+typedef struct ast_config *realtime_multi_get(const char *database, const char *table, const struct ast_variable *fields);
+typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields);
+typedef int realtime_update2(const char *database, const char *table, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields);
+typedef int realtime_store(const char *database, const char *table, const struct ast_variable *fields);
+typedef int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, const struct ast_variable *fields);
 
 /*!
  * \brief Function pointer called to ensure database schema is properly configured for realtime use
@@ -305,7 +305,9 @@
  * You should use the constant SENTINEL to terminate arguments, in
  * order to preserve cross-platform compatibility.
  */
+struct ast_variable *ast_load_realtime_fields(const char *family, const struct ast_variable *fields);
 struct ast_variable *ast_load_realtime(const char *family, ...) attribute_sentinel;
+struct ast_variable *ast_load_realtime_all_fields(const char *family, const struct ast_variable *fields);
 struct ast_variable *ast_load_realtime_all(const char *family, ...) attribute_sentinel;
 
 /*!
@@ -363,6 +365,7 @@
  * \brief Retrieve realtime configuration
  *
  * \param family which family/config to lookup
+ * \param fields list of fields
  *
  * \details
  * This will use builtin configuration backends to look up a particular
@@ -373,6 +376,23 @@
  *
  * \return An ast_config with one or more results
  * \retval NULL Error or no results returned
+ */
+struct ast_config *ast_load_realtime_multientry_fields(const char *family, const struct ast_variable *fields);
+
+/*!
+ * \brief Retrieve realtime configuration
+ *
+ * \param family which family/config to lookup
+ *
+ * \details
+ * This will use builtin configuration backends to look up a particular
+ * entity in realtime and return a variable list of its parameters. Unlike
+ * the ast_load_realtime, this function can return more than one entry and
+ * is thus stored inside a traditional ast_config structure rather than
+ * just returning a linked list of variables.
+ *
+ * \return An ast_config with one or more results
+ * \retval NULL Error or no results returned
  *
  * \note You should use the constant SENTINEL to terminate arguments, in
  * order to preserve cross-platform compatibility.
@@ -385,6 +405,21 @@
  * \param family which family/config to be updated
  * \param keyfield which field to use as the key
  * \param lookup which value to look for in the key field to match the entry.
+ * \param fields fields to update
+ *
+ * \details
+ * This function is used to update a parameter in realtime configuration space.
+ *
+ * \return Number of rows affected, or -1 on error.
+ */
+int ast_update_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields);
+
+/*!
+ * \brief Update realtime configuration
+ *
+ * \param family which family/config to be updated
+ * \param keyfield which field to use as the key
+ * \param lookup which value to look for in the key field to match the entry.
  *
  * \details
  * This function is used to update a parameter in realtime configuration space.
@@ -400,6 +435,8 @@
  * \brief Update realtime configuration
  *
  * \param family which family/config to be updated
+ * \param lookup_fields fields used to look up entries
+ * \param update_fields fields to update
  *
  * \details
  * This function is used to update a parameter in realtime configuration space.
@@ -408,6 +445,21 @@
  * lookup values and the other to terminate the listing of fields to update.
  *
  * \return Number of rows affected, or -1 on error.
+ */
+int ast_update2_realtime_fields(const char *family, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields);
+
+/*!
+ * \brief Update realtime configuration
+ *
+ * \param family which family/config to be updated
+ *
+ * \details
+ * This function is used to update a parameter in realtime configuration space.
+ * It includes the ability to lookup a row based upon multiple key criteria.
+ * As a result, this function includes two sentinel values, one to terminate
+ * lookup values and the other to terminate the listing of fields to update.
+ *
+ * \return Number of rows affected, or -1 on error.
  *
  * \note You should use the constant SENTINEL to terminate arguments, in
  * order to preserve cross-platform compatibility.
@@ -418,6 +470,7 @@
  * \brief Create realtime configuration
  *
  * \param family which family/config to be created
+ * \param fields fields themselves
  *
  * \details
  * This function is used to create a parameter in realtime configuration space.
@@ -428,11 +481,44 @@
  * On the MySQL engine only, for reasons of backwards compatibility, the return
  * value is the insert ID.  This value is nonportable and may be changed in a
  * future version to match the other engines.
+ */
+int ast_store_realtime_fields(const char *family, const struct ast_variable *fields);
+
+/*!
+ * \brief Create realtime configuration
+ *
+ * \param family which family/config to be created
+ *
+ * \details
+ * This function is used to create a parameter in realtime configuration space.
+ *
+ * \return Number of rows affected, or -1 on error.
+ *
+ * \note
+ * On the MySQL engine only, for reasons of backwards compatibility, the return
+ * value is the insert ID.  This value is nonportable and may be changed in a
+ * future version to match the other engines.
  *
  * \note You should use the constant SENTINEL to terminate arguments, in
  * order to preserve cross-platform compatibility.
  */
 int ast_store_realtime(const char *family, ...) attribute_sentinel;
+
+/*!
+ * \brief Destroy realtime configuration
+ *
+ * \param family which family/config to be destroyed
+ * \param keyfield which field to use as the key
+ * \param lookup which value to look for in the key field to match the entry.
+ * \param fields fields themselves
+ *
+ * \details
+ * This function is used to destroy an entry in realtime configuration space.
+ * Additional params are used as keys.
+ *
+ * \return Number of rows affected, or -1 on error.
+ */
+int ast_destroy_realtime_fields(const char *family, const char *keyfield, const char *lookup, const struct ast_variable *fields);
 
 /*!
  * \brief Destroy realtime configuration
@@ -502,6 +588,19 @@
  * \retval 0 if it is not
  */
 int ast_realtime_is_mapping_defined(const char *family);
+
+#ifdef TEST_FRAMEWORK
+/*!
+ * \brief Add an explicit mapping for a family
+ *
+ * \param name Family name
+ * \param driver Driver to use
+ * \param database Database to access
+ * \param table Table to use
+ * \param priority Priority of this mapping
+ */
+int ast_realtime_append_mapping(const char *name, const char *driver, const char *database, const char *table, int priority);
+#endif
 
 /*!
  * \brief Exposed initialization method for core process

Modified: team/group/pimp_my_sip/include/asterisk/doxygen/commits.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/doxygen/commits.h?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/doxygen/commits.h (original)
+++ team/group/pimp_my_sip/include/asterisk/doxygen/commits.h Mon Apr 29 12:56:05 2013
@@ -110,5 +110,5 @@
  *
  * For more detailed information about working with branches and merging,
  * see the following page on %asterisk.org:
- * \arg http://www.asterisk.org/developers/svn-branching-merging
+ * \arg https://wiki.asterisk.org/wiki/display/AST/Subversion+Usage
  */

Modified: team/group/pimp_my_sip/include/asterisk/utils.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/utils.h?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/utils.h (original)
+++ team/group/pimp_my_sip/include/asterisk/utils.h Mon Apr 29 12:56:05 2013
@@ -458,6 +458,11 @@
 
 long int ast_random(void);
 
+/*!
+ * \brief Returns a random number between 0.0 and 1.0, inclusive.
+ * \since 12
+ */
+#define ast_random_double() (((double)ast_random()) / RAND_MAX)
 
 /*!
  * \brief free() wrapper

Modified: team/group/pimp_my_sip/main/config.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/main/config.c?view=diff&rev=386867&r1=386866&r2=386867
==============================================================================
--- team/group/pimp_my_sip/main/config.c (original)
+++ team/group/pimp_my_sip/main/config.c Mon Apr 29 12:56:05 2013
@@ -1617,6 +1617,9 @@
 				AST_LIST_UNLOCK(&cfmtime_head);
 				ast_free(comment_buffer);
 				ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+				globfree(&globbuf);
+#endif
 				return CONFIG_STATUS_FILEUNCHANGED;
 			}
 		}
@@ -1627,6 +1630,9 @@
 		if (cfg == NULL) {
 			ast_free(comment_buffer);
 			ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+				globfree(&globbuf);
+#endif
 			return NULL;
 		}
 
@@ -2214,7 +2220,11 @@
 	}
 }
 
-static int append_mapping(const char *name, const char *driver, const char *database, const char *table, int priority)
+#ifdef TEST_FRAMEWORK

[... 2970 lines stripped ...]



More information about the asterisk-commits mailing list