[asterisk-commits] tilghman: branch 1.6.0 r120172 - in /branches/1.6.0: ./ configs/ include/aste...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 3 17:08:56 CDT 2008
Author: tilghman
Date: Tue Jun 3 17:08:56 2008
New Revision: 120172
URL: http://svn.digium.com/view/asterisk?view=rev&rev=120172
Log:
Merged revisions 120171 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r120171 | tilghman | 2008-06-03 17:05:16 -0500 (Tue, 03 Jun 2008) | 5 lines
Move compatibility options into asterisk.conf, default them to on for upgrades,
and off for new installations. This includes the translation from pipes to commas
for pbx_realtime and the EXEC command for AGI, as well as the change to the Set
application not to support multiple variables at once.
........
Removed:
branches/1.6.0/configs/pbx_realtime.conf
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/Makefile
branches/1.6.0/include/asterisk/options.h
branches/1.6.0/main/asterisk.c
branches/1.6.0/main/pbx.c
branches/1.6.0/pbx/pbx_realtime.c
branches/1.6.0/res/res_agi.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/Makefile
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/Makefile?view=diff&rev=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/Makefile (original)
+++ branches/1.6.0/Makefile Tue Jun 3 17:08:56 2008
@@ -687,6 +687,11 @@
echo ";astctlowner = root" ; \
echo ";astctlgroup = apache" ; \
echo ";astctl = asterisk.ctl" ; \
+ echo "" ; \
+ echo "[compat]" ; \
+ echo "pbx_realtime=1.6" ; \
+ echo "res_agi=1.6" ; \
+ echo "app_set=1.6" ; \
) > $(DESTDIR)$(ASTCONFPATH) ; \
else \
echo "Skipping asterisk.conf creation"; \
Modified: branches/1.6.0/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/options.h?view=diff&rev=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/include/asterisk/options.h (original)
+++ branches/1.6.0/include/asterisk/options.h Tue Jun 3 17:08:56 2008
@@ -112,6 +112,18 @@
extern struct ast_flags ast_options;
+enum ast_compat_flags {
+ AST_COMPAT_DELIM_PBX_REALTIME = (1 << 0),
+ AST_COMPAT_DELIM_RES_AGI = (1 << 1),
+ AST_COMPAT_APP_SET = (1 << 2),
+};
+
+#define ast_compat_pbx_realtime ast_test_flag(&ast_compat, AST_COMPAT_DELIM_PBX_REALTIME)
+#define ast_compat_res_agi ast_test_flag(&ast_compat, AST_COMPAT_DELIM_RES_AGI)
+#define ast_compat_app_set ast_test_flag(&ast_compat, AST_COMPAT_APP_SET)
+
+extern struct ast_flags ast_compat;
+
extern int option_verbose;
extern int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
extern int option_debug; /*!< Debugging */
Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Tue Jun 3 17:08:56 2008
@@ -155,6 +155,7 @@
/*! @{ */
struct ast_flags ast_options = { AST_DEFAULT_OPTIONS };
+struct ast_flags ast_compat = { 7 };
int option_verbose; /*!< Verbosity level */
int option_debug; /*!< Debug level */
@@ -2758,6 +2759,20 @@
option_minmemfree = 0;
}
#endif
+ }
+ }
+ for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) {
+ float version;
+ if (sscanf(v->value, "%f", &version) != 1) {
+ ast_log(LOG_WARNING, "Compatibility version for option '%s' is not a number: '%s'\n", v->name, v->value);
+ continue;
+ }
+ if (!strcasecmp(v->name, "app_set")) {
+ ast_set2_flag(&ast_compat, version < 1.5 ? 1 : 0, AST_COMPAT_APP_SET);
+ } else if (!strcasecmp(v->name, "res_agi")) {
+ ast_set2_flag(&ast_compat, version < 1.5 ? 1 : 0, AST_COMPAT_DELIM_RES_AGI);
+ } else if (!strcasecmp(v->name, "pbx_realtime")) {
+ ast_set2_flag(&ast_compat, version < 1.5 ? 1 : 0, AST_COMPAT_DELIM_PBX_REALTIME);
}
}
ast_config_destroy(cfg);
Modified: branches/1.6.0/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/pbx.c?view=diff&rev=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/main/pbx.c (original)
+++ branches/1.6.0/main/pbx.c Tue Jun 3 17:08:56 2008
@@ -7548,6 +7548,10 @@
{
char *name, *value, *mydata;
+ if (ast_compat_app_set) {
+ return pbx_builtin_setvar_multiple(chan, data);
+ }
+
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Set requires one variable name/value pair.\n");
return 0;
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=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/pbx/pbx_realtime.c (original)
+++ branches/1.6.0/pbx/pbx_realtime.c Tue Jun 3 17:08:56 2008
@@ -52,9 +52,6 @@
#define MODE_CANMATCH 2
#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.
@@ -179,7 +176,7 @@
if (!strcasecmp(v->name, "app"))
app = ast_strdupa(v->value);
else if (!strcasecmp(v->name, "appdata")) {
- if (!compat16) {
+ if (ast_compat_pbx_realtime) {
char *ptr;
int in = 0;
tmp = alloca(strlen(v->value) * 2 + 1);
@@ -270,18 +267,6 @@
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;
Modified: branches/1.6.0/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/res/res_agi.c?view=diff&rev=120172&r1=120171&r2=120172
==============================================================================
--- branches/1.6.0/res/res_agi.c (original)
+++ branches/1.6.0/res/res_agi.c Tue Jun 3 17:08:56 2008
@@ -1474,7 +1474,23 @@
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]);
if ((app = pbx_findapp(argv[1]))) {
- res = pbx_exec(chan, app, argv[2]);
+ if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) {
+ char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr;
+ for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
+ if (*vptr == ',') {
+ *cptr++ = '\\';
+ *cptr++ = ',';
+ } else if (*vptr == '|') {
+ *cptr++ = ',';
+ } else {
+ *cptr++ = *vptr;
+ }
+ }
+ *cptr = '\0';
+ res = pbx_exec(chan, app, compat);
+ } else {
+ res = pbx_exec(chan, app, argv[2]);
+ }
} else {
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
res = -2;
More information about the asterisk-commits
mailing list