[asterisk-commits] seanbright: branch seanbright/resolve-shadow-warnings r120279 - in /team/sean...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 3 19:33:56 CDT 2008
Author: seanbright
Date: Tue Jun 3 19:33:54 2008
New Revision: 120279
URL: http://svn.digium.com/view/asterisk?view=rev&rev=120279
Log:
Merged revisions 120166,120169,120171,120174,120227,120230 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r120166 | mmichelson | 2008-06-03 17:22:52 -0400 (Tue, 03 Jun 2008) | 13 lines
Adding two new queue log events. The ADDMEMBER event is logged when
a dynamic realtime queue member is added to the queue, and the
REMOVEMEMBER event is logged when a dynamic realtime member is
removed. Since no calling channel is associated with these events
the string "REALTIME" is placed where the channel's unique id is
normally placed.
(closes issue #12774)
Reported by: atis
Patches:
queue_log_rt_members.patch uploaded by atis (license 242)
................
r120169 | russell | 2008-06-03 17:35:11 -0400 (Tue, 03 Jun 2008) | 12 lines
Merged revisions 120168 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r120168 | russell | 2008-06-03 16:34:55 -0500 (Tue, 03 Jun 2008) | 4 lines
Fix another place where peer->callno could change at a very bad time, and also
fix a place where a peer was used after the reference was released.
(inspired by rev 120001)
........
................
r120171 | tilghman | 2008-06-03 18:05:16 -0400 (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.
................
r120174 | jpeeler | 2008-06-03 18:17:07 -0400 (Tue, 03 Jun 2008) | 14 lines
Merged revisions 120173 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r120173 | jpeeler | 2008-06-03 17:15:33 -0500 (Tue, 03 Jun 2008) | 6 lines
(closes issue #11594)
Reported by: yem
Tested by: yem
This change decreases the buffer size allocated on the stack substantially in config_text_file_load when LOW_MEMORY is turned on. This change combined with the fix from revision 117462 (making mkintf not copy the zt_chan_conf structure) was enough to prevent the crash.
........
................
r120227 | tilghman | 2008-06-03 18:42:03 -0400 (Tue, 03 Jun 2008) | 16 lines
Merged revisions 120226 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r120226 | tilghman | 2008-06-03 17:41:04 -0500 (Tue, 03 Jun 2008) | 8 lines
Due to incorrect use of the AST_LIST_INSERT_HEAD() macro the loopback switch
cannot perform any translation on the extension number before searching for it
in the target context.
(closes issue #12473)
Reported by: chappell
Patches:
pbx_loopback.c.diff uploaded by chappell (license 8)
........
................
r120230 | tilghman | 2008-06-03 19:17:33 -0400 (Tue, 03 Jun 2008) | 7 lines
Add a function, CHANNELS(), which retrieves a list of all active channels.
(closes issue #11330)
Reported by: rain
Patches:
func_channel-channel_list_function.diff uploaded by rain (license 327)
(with some additional changes by me, mostly to meet coding guidelines)
................
Removed:
team/seanbright/resolve-shadow-warnings/configs/pbx_realtime.conf
Modified:
team/seanbright/resolve-shadow-warnings/ (props changed)
team/seanbright/resolve-shadow-warnings/CHANGES
team/seanbright/resolve-shadow-warnings/Makefile
team/seanbright/resolve-shadow-warnings/apps/app_queue.c
team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
team/seanbright/resolve-shadow-warnings/funcs/func_channel.c
team/seanbright/resolve-shadow-warnings/include/asterisk/options.h
team/seanbright/resolve-shadow-warnings/main/asterisk.c
team/seanbright/resolve-shadow-warnings/main/config.c
team/seanbright/resolve-shadow-warnings/main/pbx.c
team/seanbright/resolve-shadow-warnings/pbx/pbx_loopback.c
team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
team/seanbright/resolve-shadow-warnings/res/res_agi.c
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/seanbright/resolve-shadow-warnings/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 3 19:33:54 2008
@@ -1,1 +1,1 @@
-/trunk:1-120159
+/trunk:1-120278
Modified: team/seanbright/resolve-shadow-warnings/CHANGES
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/CHANGES?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/CHANGES (original)
+++ team/seanbright/resolve-shadow-warnings/CHANGES Tue Jun 3 19:33:54 2008
@@ -481,6 +481,11 @@
position announced if their position is less than what is specified by announce-position-limit.
If announce-position is set to "more" then callers beyond the position specified by announce-position-limit
will be told that their are more than announce-position-limit callers waiting.
+ * Two new queue log events have been added. An ADDMEMBER event will be logged
+ when a realtime queue member is added and a REMOVEMEMBER event will be logged
+ when a realtime queue member is removed. Since there is no calling channel associated
+ with these events, the string "REALTIME" is placed where the channel's unique id
+ is typically placed.
MeetMe Changes
--------------
Modified: team/seanbright/resolve-shadow-warnings/Makefile
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/Makefile?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/Makefile (original)
+++ team/seanbright/resolve-shadow-warnings/Makefile Tue Jun 3 19:33:54 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: team/seanbright/resolve-shadow-warnings/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/apps/app_queue.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/apps/app_queue.c (original)
+++ team/seanbright/resolve-shadow-warnings/apps/app_queue.c Tue Jun 3 19:33:54 2008
@@ -1358,6 +1358,7 @@
m->realtime = 1;
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
add_to_interfaces(m->state_interface);
+ ast_queue_log(q->name, "REALTIME", m->interface, "ADDMEMBER", "%s", "");
ao2_link(q->members, m);
ao2_ref(m, -1);
m = NULL;
@@ -1542,6 +1543,7 @@
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
if (m->dead) {
+ ast_queue_log(q->name, "REALTIME", m->interface, "REMOVEMEMBER", "%s", "");
ao2_unlink(q->members, m);
remove_from_interfaces(m->state_interface);
q->membercount--;
@@ -1649,6 +1651,7 @@
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
if (m->dead) {
+ ast_queue_log(q->name, "REALTIME", m->interface, "REMOVEMEMBER", "%s", "");
ao2_unlink(q->members, m);
remove_from_interfaces(m->state_interface);
q->membercount--;
Modified: team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c (original)
+++ team/seanbright/resolve-shadow-warnings/channels/chan_iax2.c Tue Jun 3 19:33:54 2008
@@ -9835,15 +9835,17 @@
static void __iax2_poke_noanswer(const void *data)
{
struct iax2_peer *peer = (struct iax2_peer *)data;
+ int callno;
+
if (peer->lastms > -1) {
ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE! Time: %d\n", peer->name, peer->lastms);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms);
ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
}
- if (peer->callno > 0) {
- ast_mutex_lock(&iaxsl[peer->callno]);
- iax2_destroy(peer->callno);
- ast_mutex_unlock(&iaxsl[peer->callno]);
+ if ((callno = peer->callno) > 0) {
+ ast_mutex_lock(&iaxsl[callno]);
+ iax2_destroy(callno);
+ ast_mutex_unlock(&iaxsl[callno]);
}
peer->callno = 0;
peer->lastms = -1;
@@ -9896,7 +9898,7 @@
}
if (heldcall)
ast_mutex_unlock(&iaxsl[heldcall]);
- peer->callno = find_callno(0, 0, &peer->addr, NEW_FORCE, peer->sockfd, 0);
+ callno = peer->callno = find_callno(0, 0, &peer->addr, NEW_FORCE, peer->sockfd, 0);
if (heldcall)
ast_mutex_lock(&iaxsl[heldcall]);
if (peer->callno < 1) {
@@ -9926,11 +9928,11 @@
peer_unref(peer);
/* And send the poke */
- ast_mutex_lock(&iaxsl[peer->callno]);
- if (iaxs[peer->callno]) {
- send_command(iaxs[peer->callno], AST_FRAME_IAX, IAX_COMMAND_POKE, 0, NULL, 0, -1);
- }
- ast_mutex_unlock(&iaxsl[peer->callno]);
+ ast_mutex_lock(&iaxsl[callno]);
+ if (iaxs[callno]) {
+ send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_POKE, 0, NULL, 0, -1);
+ }
+ ast_mutex_unlock(&iaxsl[callno]);
return 0;
}
Modified: team/seanbright/resolve-shadow-warnings/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/funcs/func_channel.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/funcs/func_channel.c (original)
+++ team/seanbright/resolve-shadow-warnings/funcs/func_channel.c Tue Jun 3 19:33:54 2008
@@ -16,9 +16,10 @@
/*! \file
*
- * \brief Channel info dialplan function
+ * \brief Channel info dialplan functions
*
* \author Kevin P. Fleming <kpfleming at digium.com>
+ * \author Ben Winslow
*
* \ingroup functions
*/
@@ -26,6 +27,8 @@
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include <regex.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
@@ -222,14 +225,76 @@
.write = func_channel_write,
};
+static int func_channels_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t maxlen)
+{
+ struct ast_channel *c = NULL;
+ regex_t re;
+ int res;
+ size_t buflen = 0;
+
+ buf[0] = '\0';
+
+ if (!ast_strlen_zero(data)) {
+ if ((res = regcomp(&re, data, REG_EXTENDED | REG_ICASE | REG_NOSUB))) {
+ regerror(res, &re, buf, maxlen);
+ ast_log(LOG_WARNING, "Error compiling regular expression for %s(%s): %s\n", function, data, buf);
+ return -1;
+ }
+ }
+
+ for (c = ast_channel_walk_locked(NULL); c; ast_channel_unlock(c), c = ast_channel_walk_locked(c)) {
+ if (ast_strlen_zero(data) || regexec(&re, c->name, 0, NULL, 0) == 0) {
+ size_t namelen = strlen(c->name);
+ if (buflen + namelen + (ast_strlen_zero(buf) ? 0 : 1) + 1 < maxlen) {
+ if (!ast_strlen_zero(buf)) {
+ strcat(buf, " ");
+ buflen++;
+ }
+ strcat(buf, c->name);
+ buflen += namelen;
+ } else {
+ ast_log(LOG_WARNING, "Number of channels exceeds the available buffer space. Output will be truncated!\n");
+ }
+ }
+ }
+
+ if (!ast_strlen_zero(data)) {
+ regfree(&re);
+ }
+
+ return 0;
+}
+
+static struct ast_custom_function channels_function = {
+ .name = "CHANNELS",
+ .synopsis = "Gets the list of channels, optionally filtering by a regular expression.",
+ .syntax = "CHANNEL([regular expression])",
+ .desc =
+"Gets the list of channels, optionally filtering by a regular expression. If\n"
+"no argument is provided, all known channels are returned. The regular\n"
+"expression must correspond to the POSIX.2 specification, as shown in\n"
+"regex(7). The list returned will be space-delimited.\n",
+ .read = func_channels_read,
+};
+
static int unload_module(void)
{
- return ast_custom_function_unregister(&channel_function);
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&channel_function);
+ res |= ast_custom_function_unregister(&channels_function);
+
+ return res;
}
static int load_module(void)
{
- return ast_custom_function_register(&channel_function);
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel information dialplan function");
+ int res = 0;
+
+ res |= ast_custom_function_register(&channel_function);
+ res |= ast_custom_function_register(&channels_function);
+
+ return res;
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel information dialplan functions");
Modified: team/seanbright/resolve-shadow-warnings/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/include/asterisk/options.h?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/include/asterisk/options.h (original)
+++ team/seanbright/resolve-shadow-warnings/include/asterisk/options.h Tue Jun 3 19:33:54 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: team/seanbright/resolve-shadow-warnings/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/main/asterisk.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/main/asterisk.c (original)
+++ team/seanbright/resolve-shadow-warnings/main/asterisk.c Tue Jun 3 19:33:54 2008
@@ -156,6 +156,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 */
@@ -2772,6 +2773,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: team/seanbright/resolve-shadow-warnings/main/config.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/main/config.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/main/config.c (original)
+++ team/seanbright/resolve-shadow-warnings/main/config.c Tue Jun 3 19:33:54 2008
@@ -1128,7 +1128,11 @@
static struct ast_config *config_text_file_load(const char *database, const char *table, const char *filename, struct ast_config *cfg, struct ast_flags flags, const char *suggested_include_file, const char *who_asked)
{
char fn[256];
+#if defined(LOW_MEMORY)
+ char buf[512];
+#else
char buf[8192];
+#endif
char *new_buf, *comment_p, *process_buf;
FILE *f;
int lineno=0;
Modified: team/seanbright/resolve-shadow-warnings/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/main/pbx.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/main/pbx.c (original)
+++ team/seanbright/resolve-shadow-warnings/main/pbx.c Tue Jun 3 19:33:54 2008
@@ -7856,6 +7856,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: team/seanbright/resolve-shadow-warnings/pbx/pbx_loopback.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/pbx/pbx_loopback.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/pbx/pbx_loopback.c (original)
+++ team/seanbright/resolve-shadow-warnings/pbx/pbx_loopback.c Tue Jun 3 19:33:54 2008
@@ -45,17 +45,26 @@
#include "asterisk/astdb.h"
-/* Loopback switch substitutes ${EXTEN}, ${CONTEXT}, and ${PRIORITY} into
- the data passed to it to try to get a string of the form:
+/* Loopback switch creates a 'tunnel' to another context. When extension
+ lookups pass through the 'tunnel', Asterisk expressions can be used
+ to modify the target extension, context, and priority in any way desired.
+ If there is a match at the far end, execution jumps through the 'tunnel'
+ to the matched context, extension, and priority.
+
+ Global variables as well as ${CONTEXT}, ${EXTEN}, and ${PRIORITY} are
+ available for substitution. After substitution Loopback expects to get
+ a string of the form:
[exten]@context[:priority][/extramatch]
Where exten, context, and priority are another extension, context, and priority
- to lookup and "extramatch" is an extra match restriction the *original* number
- must fit if specified. The "extramatch" begins with _ like an exten pattern
- if it is specified. Note that the search context MUST be a different context
- from the current context or the search will not succeed in an effort to reduce
- the likelihood of loops (they're still possible if you try hard, so be careful!)
+ to lookup and "extramatch" is a dialplan extension pattern which the *original*
+ number must match. If exten or priority are empty, the original values are
+ used.
+
+ Note that the search context MUST be a different context from the current
+ context or the search will not succeed. This is intended to reduce the
+ likelihood of loops (they're still possible if you try hard, so be careful!)
*/
@@ -66,13 +75,12 @@
char *newexten=(char *)exten, *newcontext=(char *)context; \
int newpriority=priority; \
char *newpattern=NULL; \
- loopback_helper(buf, sizeof(buf), exten, context, priority, data); \
- loopback_subst(&newexten, &newcontext, &newpriority, &newpattern, buf); \
+ loopback_subst(buf, sizeof(buf), exten, context, priority, data); \
+ loopback_parse(&newexten, &newcontext, &newpriority, &newpattern, buf); \
ast_log(LOG_DEBUG, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
if (!strcasecmp(newcontext, context)) return -1
-
-static char *loopback_helper(char *buf, int buflen, const char *exten, const char *context, int priority, const char *data)
+static char *loopback_subst(char *buf, int buflen, const char *exten, const char *context, int priority, const char *data)
{
struct ast_var_t *newvariable;
struct varshead headp;
@@ -80,9 +88,12 @@
snprintf(tmp, sizeof(tmp), "%d", priority);
AST_LIST_HEAD_INIT_NOLOCK(&headp);
- AST_LIST_INSERT_HEAD(&headp, ast_var_assign("EXTEN", exten), entries);
- AST_LIST_INSERT_HEAD(&headp, ast_var_assign("CONTEXT", context), entries);
- AST_LIST_INSERT_HEAD(&headp, ast_var_assign("PRIORITY", tmp), entries);
+ newvariable = ast_var_assign("EXTEN", exten);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ newvariable = ast_var_assign("CONTEXT", context);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
+ newvariable = ast_var_assign("PRIORITY", tmp);
+ AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
/* Substitute variables */
pbx_substitute_variables_varshead(&headp, data, buf, buflen);
/* free the list */
@@ -91,7 +102,7 @@
return buf;
}
-static void loopback_subst(char **newexten, char **newcontext, int *priority, char **newpattern, char *buf)
+static void loopback_parse(char **newexten, char **newcontext, int *priority, char **newpattern, char *buf)
{
char *con;
char *pri;
@@ -135,9 +146,6 @@
int found;
LOOPBACK_COMMON;
res = ast_spawn_extension(chan, newcontext, newexten, newpriority, callerid, &found, 0);
- /* XXX hmmm... res is overridden ? */
- if (newpattern && !ast_extension_match(newpattern, exten))
- res = -1;
return res;
}
Modified: team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c (original)
+++ team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c Tue Jun 3 19:33:54 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: team/seanbright/resolve-shadow-warnings/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/resolve-shadow-warnings/res/res_agi.c?view=diff&rev=120279&r1=120278&r2=120279
==============================================================================
--- team/seanbright/resolve-shadow-warnings/res/res_agi.c (original)
+++ team/seanbright/resolve-shadow-warnings/res/res_agi.c Tue Jun 3 19:33:54 2008
@@ -1456,7 +1456,23 @@
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]);
if ((app_to_exec = pbx_findapp(argv[1]))) {
- res = pbx_exec(chan, app_to_exec, 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_to_exec, compat);
+ } else {
+ res = pbx_exec(chan, app_to_exec, 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