diff -Naur asterisk-original/apps/app_queue.c asterisk/apps/app_queue.c --- asterisk-original/apps/app_queue.c 2006-06-02 16:44:28.000000000 -0500 +++ asterisk/apps/app_queue.c 2006-06-02 16:41:40.000000000 -0500 @@ -342,6 +342,7 @@ unsigned int joinempty:2; unsigned int eventwhencalled:1; unsigned int leavewhenempty:2; + unsigned int channelvarsonevent:1; unsigned int ringinuse:1; unsigned int setinterfacevar:1; unsigned int reportholdtime:1; @@ -869,6 +870,8 @@ q->maskmemberstatus = !ast_true(val); } else if (!strcasecmp(param, "eventwhencalled")) { q->eventwhencalled = ast_true(val); + } else if (!strcasecmp(param, "channelvarsonevent")) { + q->channelvarsonevent = ast_true(val); } else if (!strcasecmp(param, "reportholdtime")) { q->reportholdtime = ast_true(val); } else if (!strcasecmp(param, "memberdelay")) { @@ -1606,7 +1609,59 @@ return 0; } else { if (qe->parent->eventwhencalled) { - manager_event(EVENT_FLAG_AGENT, "AgentCalled", + if (qe->parent->channelvarsonevent) { + char vars[1024]; + char vars2[2048]; + + if (pbx_builtin_serialize_variables(qe->chan,vars,sizeof(vars))) { + int i = 0, j = 0; + + ast_verbose(VERBOSE_PREFIX_3 "Variables are %s\n", vars); + /* convert "\n" to "\nVariable: " */ + strcpy(vars2, "Variable: "); + j += 10; + + while ((i < sizeof(vars)) && (j < sizeof(vars2))) { + vars2[j] = vars[i]; + + if (vars[i] == '\n') { + vars2[j] = '\r'; + vars2[j+1] = '\n'; + j += 2; + + if (vars[i+1] == '\0') + break; + strncpy(&(vars2[j]), "Variable: ", sizeof(vars2) - j); + j += 9; + } + i++; + j++; + } + j -= 2; + if (j >= (sizeof(vars2) - 1)) + j = sizeof(vars2) - 1; + vars2[j] = '\0'; + } else { + /* there are no channel variables; leave it blank */ + *vars2 = '\0'; + } + ast_verbose(VERBOSE_PREFIX_3 "Channel Variables: %s\n", vars2); + + manager_event(EVENT_FLAG_AGENT, "AgentCalled", + "AgentCalled: %s\r\n" + "ChannelCalling: %s\r\n" + "CallerID: %s\r\n" + "CallerIDName: %s\r\n" + "Context: %s\r\n" + "Extension: %s\r\n" + "Priority: %d\r\n" + "%s\r\n", + tmp->interface, qe->chan->name, + tmp->chan->cid.cid_num ? tmp->chan->cid.cid_num : "unknown", + tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown", + qe->chan->context, qe->chan->exten, qe->chan->priority, vars2); + } else { + manager_event(EVENT_FLAG_AGENT, "AgentCalled", "AgentCalled: %s\r\n" "ChannelCalling: %s\r\n" "CallerID: %s\r\n" @@ -1618,9 +1673,10 @@ S_OR(tmp->chan->cid.cid_num, "unknown"), S_OR(tmp->chan->cid.cid_name, "unknown"), qe->chan->context, qe->chan->exten, qe->chan->priority); + } + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", tmp->interface); } - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", tmp->interface); } return 1; } diff -Naur asterisk-original/configs/queues.conf.sample asterisk/configs/queues.conf.sample --- asterisk-original/configs/queues.conf.sample 2006-06-02 16:46:05.000000000 -0500 +++ asterisk/configs/queues.conf.sample 2006-06-02 13:57:16.000000000 -0500 @@ -255,6 +255,12 @@ ; ; eventwhencalled = yes ; +; If this is set to yes, each of the channel variables will be printed +; both to the asterisk cli when verbosity is turned up, and in the manager +; interface. +; +; channelvarsonevent = yes +; ; If this is set to no, the following manager events will be generated: ; QueueMemberStatus ; (may generate a WHOLE LOT of extra manager events)