[asterisk-commits] rmudgett: trunk r374075 - /trunk/res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 28 17:11:22 CDT 2012
Author: rmudgett
Date: Fri Sep 28 17:11:19 2012
New Revision: 374075
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374075
Log:
Include channel uniqueid in "AsyncAGI" and "AGIExec" events.
* Added AMI event documentation for AsyncAGI and AGIExec events.
(closes issue ASTERISK-20318)
Reported by: Dan Cropp
Patches:
res_agi_patch.txt (license #6422) patch uploaded by Dan Cropp
modified for trunk.
Modified:
trunk/res/res_agi.c
Modified: trunk/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_agi.c?view=diff&rev=374075&r1=374074&r2=374075
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Fri Sep 28 17:11:19 2012
@@ -1323,10 +1323,32 @@
care of AGI commands on this channel can decide which AGI commands
to execute based on the setup info */
ast_uri_encode(agi_buffer, ami_buffer, AMI_BUF_SIZE, ast_uri_http);
+ /*** DOCUMENTATION
+ <managerEventInstance>
+ <synopsis>Raised when a channel starts AsyncAGI command processing.</synopsis>
+ <syntax>
+ <parameter name="SubEvent">
+ <para>A sub event type, specifying the channel AsyncAGI processing status.</para>
+ <enumlist>
+ <enum name="Start"/>
+ <enum name="Exec"/>
+ <enum name="End"/>
+ </enumlist>
+ </parameter>
+ <parameter name="Env">
+ <para>URL encoded string read from the AsyncAGI server.</para>
+ </parameter>
+ </syntax>
+ </managerEventInstance>
+ ***/
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Start\r\n"
"Channel: %s\r\n"
- "Env: %s\r\n", ast_channel_name(chan), ami_buffer);
+ "Uniqueid: %s\r\n"
+ "Env: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ ami_buffer);
hungup = ast_check_hangup(chan);
for (;;) {
/*
@@ -1369,13 +1391,35 @@
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Exec\r\n"
"Channel: %s\r\n"
- "Result: %s\r\n", ast_channel_name(chan), ami_buffer);
+ "Uniqueid: %s\r\n"
+ "Result: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ ami_buffer);
} else {
+ /*** DOCUMENTATION
+ <managerEventInstance>
+ <synopsis>Raised when AsyncAGI completes an AGI command.</synopsis>
+ <syntax>
+ <parameter name="CommandID" required="false">
+ <para>Optional command ID sent by the AsyncAGI server to identify the command.</para>
+ </parameter>
+ <parameter name="Result">
+ <para>URL encoded result string from the executed AGI command.</para>
+ </parameter>
+ </syntax>
+ </managerEventInstance>
+ ***/
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: Exec\r\n"
"Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
"CommandID: %s\r\n"
- "Result: %s\r\n", ast_channel_name(chan), cmd->cmd_id, ami_buffer);
+ "Result: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ cmd->cmd_id,
+ ami_buffer);
}
free_agi_cmd(cmd);
@@ -1434,11 +1478,18 @@
if (async_agi.speech) {
ast_speech_destroy(async_agi.speech);
}
- /* notify manager users this channel cannot be
- controlled anymore by Async AGI */
+ /* notify manager users this channel cannot be controlled anymore by Async AGI */
+ /*** DOCUMENTATION
+ <managerEventInstance>
+ <synopsis>Raised when a channel stops AsyncAGI command processing.</synopsis>
+ </managerEventInstance>
+ ***/
manager_event(EVENT_FLAG_AGI, "AsyncAGI",
"SubEvent: End\r\n"
- "Channel: %s\r\n", ast_channel_name(chan));
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan));
async_agi_abort:
/* close the pipe */
@@ -3414,11 +3465,36 @@
int command_id = ast_random();
int resultcode;
+ /*** DOCUMENTATION
+ <managerEventInstance>
+ <synopsis>Raised when a received AGI command starts processing.</synopsis>
+ <syntax>
+ <parameter name="SubEvent">
+ <para>A sub event type, specifying whether the AGI command has begun or ended.</para>
+ <enumlist>
+ <enum name="Start"/>
+ <enum name="End"/>
+ </enumlist>
+ </parameter>
+ <parameter name="CommandId">
+ <para>Random identification number assigned to the execution of this command.</para>
+ </parameter>
+ <parameter name="Command">
+ <para>The AGI command as received from the external source.</para>
+ </parameter>
+ </syntax>
+ </managerEventInstance>
+ ***/
manager_event(EVENT_FLAG_AGI, "AGIExec",
- "SubEvent: Start\r\n"
- "Channel: %s\r\n"
- "CommandId: %d\r\n"
- "Command: %s\r\n", ast_channel_name(chan), command_id, ami_cmd);
+ "SubEvent: Start\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "CommandId: %d\r\n"
+ "Command: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ command_id,
+ ami_cmd);
parse_args(buf, &argc, argv);
c = find_command(argv, 0);
if (c && (!dead || (dead && c->dead))) {
@@ -3453,13 +3529,25 @@
resultcode = 200;
break;
}
+ /*** DOCUMENTATION
+ <managerEventInstance>
+ <synopsis>Raised when a received AGI command completes processing.</synopsis>
+ </managerEventInstance>
+ ***/
manager_event(EVENT_FLAG_AGI, "AGIExec",
- "SubEvent: End\r\n"
- "Channel: %s\r\n"
- "CommandId: %d\r\n"
- "Command: %s\r\n"
- "ResultCode: %d\r\n"
- "Result: %s\r\n", ast_channel_name(chan), command_id, ami_cmd, resultcode, ami_res);
+ "SubEvent: End\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "CommandId: %d\r\n"
+ "Command: %s\r\n"
+ "ResultCode: %d\r\n"
+ "Result: %s\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ command_id,
+ ami_cmd,
+ resultcode,
+ ami_res);
switch (res) {
case RESULT_SHOWUSAGE:
if (ast_strlen_zero(c->usage)) {
@@ -3481,21 +3569,31 @@
} else if (c) {
ast_agi_send(agi->fd, chan, "511 Command Not Permitted on a dead channel\n");
manager_event(EVENT_FLAG_AGI, "AGIExec",
- "SubEvent: End\r\n"
- "Channel: %s\r\n"
- "CommandId: %d\r\n"
- "Command: %s\r\n"
- "ResultCode: 511\r\n"
- "Result: Command not permitted on a dead channel\r\n", ast_channel_name(chan), command_id, ami_cmd);
+ "SubEvent: End\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "CommandId: %d\r\n"
+ "Command: %s\r\n"
+ "ResultCode: 511\r\n"
+ "Result: Command not permitted on a dead channel\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ command_id,
+ ami_cmd);
} else {
ast_agi_send(agi->fd, chan, "510 Invalid or unknown command\n");
manager_event(EVENT_FLAG_AGI, "AGIExec",
- "SubEvent: End\r\n"
- "Channel: %s\r\n"
- "CommandId: %d\r\n"
- "Command: %s\r\n"
- "ResultCode: 510\r\n"
- "Result: Invalid or unknown command\r\n", ast_channel_name(chan), command_id, ami_cmd);
+ "SubEvent: End\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "CommandId: %d\r\n"
+ "Command: %s\r\n"
+ "ResultCode: 510\r\n"
+ "Result: Invalid or unknown command\r\n",
+ ast_channel_name(chan),
+ ast_channel_uniqueid(chan),
+ command_id,
+ ami_cmd);
}
return AGI_RESULT_SUCCESS;
}
More information about the asterisk-commits
mailing list