[svn-commits] oej: branch oej/tilghman-chanvar-backport r222102 - in /team/oej/tilghman-cha...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Oct 2 16:10:18 CDT 2009
Author: oej
Date: Fri Oct 2 16:10:14 2009
New Revision: 222102
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222102
Log:
Ok, so far it works without the function support. Good start.
Modified:
team/oej/tilghman-chanvar-backport/include/asterisk/manager.h
team/oej/tilghman-chanvar-backport/main/manager.c
Modified: team/oej/tilghman-chanvar-backport/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/include/asterisk/manager.h?view=diff&rev=222102&r1=222101&r2=222102
==============================================================================
--- team/oej/tilghman-chanvar-backport/include/asterisk/manager.h (original)
+++ team/oej/tilghman-chanvar-backport/include/asterisk/manager.h Fri Oct 2 16:10:14 2009
@@ -127,7 +127,9 @@
\param contents Contents of event
*/
+/*! \brief Manager event handling (with no ast_chan connections */
#define manager_event(category, event, contents, ...) __ast_channel_manager_event(category, event, 0, NULL, contents, ## __VA_ARGS__)
+
#define ast_channel_manager_event(chan1, chan2, category, event, contents, ...) \
do { \
struct ast_channel *_chans[] = { chan1, chan2 }; \
Modified: team/oej/tilghman-chanvar-backport/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/tilghman-chanvar-backport/main/manager.c?view=diff&rev=222102&r1=222101&r2=222102
==============================================================================
--- team/oej/tilghman-chanvar-backport/main/manager.c (original)
+++ team/oej/tilghman-chanvar-backport/main/manager.c Fri Oct 2 16:10:14 2009
@@ -265,9 +265,11 @@
static void append_channel_vars(struct ast_dynamic_str **pbuf, struct ast_channel *chan)
{
struct manager_channel_variable *var;
+
AST_RWLIST_RDLOCK(&channelvars);
AST_LIST_TRAVERSE(&channelvars, var, entry) {
const char *val = "";
+ ast_log(LOG_DEBUG, "------ Looking for %s\n", var->name);
//if (var->isfunc) {
//struct ast_dynamic_str *res = ast_dynamic_str_thread_get(&manager_event_funcbuf, 16);
//int ret;
@@ -2599,6 +2601,8 @@
struct ast_dynamic_str *buf;
int i;
+ ast_log(LOG_DEBUG, "----- About to send manager event\n");
+
/* Abort if there aren't any manager sessions */
if (!num_sessions)
return 0;
@@ -2620,9 +2624,11 @@
va_start(ap, fmt);
ast_dynamic_str_thread_append_va(&buf, 0, &manager_event_buf, fmt, ap);
va_end(ap);
+ ast_log(LOG_DEBUG, "----- About to append channel variables to event -- channels = %d\n", chancount);
for (i = 0; i < chancount; i++) {
- append_channel_vars(&buf, chans[i]);
+ if (chans[i] != NULL)
+ append_channel_vars(&buf, chans[i]);
}
ast_dynamic_str_thread_append(&buf, 0, &manager_event_buf, "\r\n");
@@ -3139,19 +3145,19 @@
newhttptimeout = atoi(val);
if ((val = ast_variable_retrieve(cfg, "general", "channelvars"))) {
struct manager_channel_variable *mcv;
- char *remaining = ast_strdupa(val), *next;
- AST_RWLIST_WRLOCK(&channelvars);
- while ((next = strsep(&remaining, ",|"))) {
- if (!(mcv = ast_calloc(1, sizeof(*mcv) + strlen(next) + 1))) {
- break;
- }
- strcpy(mcv->name, next); /* SAFE */
- if (strchr(next, '(')) {
- mcv->isfunc = 1;
- }
- AST_RWLIST_INSERT_TAIL(&channelvars, mcv, entry);
- }
- AST_RWLIST_UNLOCK(&channelvars);
+ char *remaining = ast_strdupa(val), *next;
+ AST_RWLIST_WRLOCK(&channelvars);
+ while ((next = strsep(&remaining, ",|"))) {
+ if (!(mcv = ast_calloc(1, sizeof(*mcv) + strlen(next) + 1))) {
+ break;
+ }
+ strcpy(mcv->name, next); /* SAFE */
+ if (strchr(next, '(')) {
+ mcv->isfunc = 1;
+ }
+ AST_RWLIST_INSERT_TAIL(&channelvars, mcv, entry);
+ }
+ AST_RWLIST_UNLOCK(&channelvars);
}
memset(&ba, 0, sizeof(ba));
More information about the svn-commits
mailing list