Skip to content

Instantly share code, notes, and snippets.

@benlangfeld
Created November 10, 2011 13:22
Show Gist options
  • Save benlangfeld/1354839 to your computer and use it in GitHub Desktop.
Save benlangfeld/1354839 to your computer and use it in GitHub Desktop.
Index: res/res_agi.c
===================================================================
--- res/res_agi.c (revision 344329)
+++ res/res_agi.c (working copy)
@@ -3373,16 +3373,17 @@
agi_command *c;
const char *ami_res;
char *ami_cmd = ast_strdupa(buf);
- int command_id = ast_random();
int resultcode;
+ parse_args(buf, &argc, argv);
+ c = find_command(argv, 0);
+
manager_event(EVENT_FLAG_AGI, "AGIExec",
"SubEvent: Start\r\n"
"Channel: %s\r\n"
- "CommandId: %d\r\n"
- "Command: %s\r\n", chan->name, command_id, ami_cmd);
- parse_args(buf, &argc, argv);
- c = find_command(argv, 0);
+ "CommandID: %d\r\n"
+ "Command: %s\r\n", chan->name, c->cmd_id, ami_cmd);
+
if (c && (!dead || (dead && c->dead))) {
/* if this command wasn't registered by res_agi, be sure to usecount
the module we are using */
@@ -3418,10 +3419,10 @@
manager_event(EVENT_FLAG_AGI, "AGIExec",
"SubEvent: End\r\n"
"Channel: %s\r\n"
- "CommandId: %d\r\n"
+ "CommandID: %d\r\n"
"Command: %s\r\n"
"ResultCode: %d\r\n"
- "Result: %s\r\n", chan->name, command_id, ami_cmd, resultcode, ami_res);
+ "Result: %s\r\n", chan->name, c->cmd_id, ami_cmd, resultcode, ami_res);
switch (res) {
case RESULT_SHOWUSAGE:
if (ast_strlen_zero(c->usage)) {
@@ -3445,19 +3446,19 @@
manager_event(EVENT_FLAG_AGI, "AGIExec",
"SubEvent: End\r\n"
"Channel: %s\r\n"
- "CommandId: %d\r\n"
+ "CommandID: %d\r\n"
"Command: %s\r\n"
"ResultCode: 511\r\n"
- "Result: Command not permitted on a dead channel\r\n", chan->name, command_id, ami_cmd);
+ "Result: Command not permitted on a dead channel\r\n", chan->name, c->cmd_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"
+ "CommandID: %d\r\n"
"Command: %s\r\n"
"ResultCode: 510\r\n"
- "Result: Invalid or unknown command\r\n", chan->name, command_id, ami_cmd);
+ "Result: Invalid or unknown command\r\n", chan->name, c->cmd_id, ami_cmd);
}
return AGI_RESULT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment