[asterisk-commits] tilghman: branch 1.6.0 r117987 - in /branches/1.6.0: ./ configs/ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 22 16:43:47 CDT 2008


Author: tilghman
Date: Thu May 22 16:43:47 2008
New Revision: 117987

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117987
Log:
Merged revisions 117986 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r117986 | tilghman | 2008-05-22 16:42:50 -0500 (Thu, 22 May 2008) | 2 lines

Add a compatibility option for upgrading realtime extensions

........

Added:
    branches/1.6.0/configs/pbx_realtime.conf
      - copied unchanged from r117986, trunk/configs/pbx_realtime.conf
Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/pbx/pbx_realtime.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/pbx/pbx_realtime.c?view=diff&rev=117987&r1=117986&r2=117987
==============================================================================
--- branches/1.6.0/pbx/pbx_realtime.c (original)
+++ branches/1.6.0/pbx/pbx_realtime.c Thu May 22 16:43:47 2008
@@ -53,6 +53,8 @@
 
 #define EXT_DATA_SIZE 256
 
+/* If set to 0, translate commas to "\," and pipes to "," */
+static int compat16 = 1;
 
 /* Realtime switch looks up extensions in the supplied realtime table.
 
@@ -176,8 +178,24 @@
 		for (v = var; v ; v = v->next) {
 			if (!strcasecmp(v->name, "app"))
 				app = ast_strdupa(v->value);
-			else if (!strcasecmp(v->name, "appdata"))
-				tmp = ast_strdupa(v->value);
+			else if (!strcasecmp(v->name, "appdata")) {
+				if (!compat16) {
+					char *ptr;
+					tmp = alloca(strlen(v->value) * 2 + 1);
+					for (ptr = tmp; *v->value; v->value++) {
+						if (*v->value == ',') {
+							*ptr++ = '\\';
+							*ptr++ = ',';
+						} else if (*v->value == '|') {
+							*ptr++ = ',';
+						} else {
+							*ptr++ = *v->value;
+						}
+					}
+				} else {
+					tmp = ast_strdupa(v->value);
+				}
+			}
 		}
 		ast_variables_destroy(var);
 		if (!ast_strlen_zero(app)) {
@@ -243,6 +261,18 @@
 
 static int load_module(void)
 {
+	struct ast_flags flags = { 0 };
+	struct ast_config *cfg = ast_config_load("pbx_realtime.conf", flags);
+	if (cfg) {
+		const char *tmp = ast_variable_retrieve(cfg, "general", "compat");
+		if (tmp && strncmp(tmp, "1.6", 3)) {
+			compat16 = 0;
+		} else {
+			compat16 = 1;
+		}
+		ast_config_destroy(cfg);
+	}
+
 	if (ast_register_switch(&realtime_switch))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;




More information about the asterisk-commits mailing list