[asterisk-bugs] [JIRA] Updated: (ASTERISK-20318) We are using AMI and during load testing we occasionally see two calls with the same channelname. We decided to use the UniqueId for identification purposes, but discovered the channel's uniqueid is not included in the "AsyncAGI" and "AGIExec" events

Michael L. Young (JIRA) noreply at issues.asterisk.org
Fri Aug 24 12:18:07 CDT 2012


     [ https://issues.asterisk.org/jira/browse/ASTERISK-20318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael L. Young updated ASTERISK-20318:
----------------------------------------

    Reference Notes:   (was: Here is a diff (Asterisk 10 revision 371657) for the changes that are required to res_agi.c to include the channel's uniqueid
We have been running similar changes with Asterisk 10.3.0 for a couple months now and it has been working great.


root at Genesis:/usr/src/10# svn diff
Index: res/res_agi.c
===================================================================
--- res/res_agi.c       (revision 371657)
+++ res/res_agi.c       (working copy)
@@ -1311,7 +1311,8 @@
        manager_event(EVENT_FLAG_AGI, "AsyncAGI",
                "SubEvent: Start\r\n"
                "Channel: %s\r\n"
-               "Env: %s\r\n", chan->name, ami_buffer);
+               "Uniqueid: %s\r\n"
+               "Env: %s\r\n", chan->name, chan->uniqueid, ami_buffer);
        hungup = ast_check_hangup(chan);
        for (;;) {
                /*
@@ -1345,13 +1346,15 @@
                                manager_event(EVENT_FLAG_AGI, "AsyncAGI",
                                        "SubEvent: Exec\r\n"
                                        "Channel: %s\r\n"
-                                       "Result: %s\r\n", chan->name, ami_buffer);
+                                       "Uniqueid: %s\r\n"
+                                       "Result: %s\r\n", chan->name, chan->uniqueid, ami_buffer);
                        } else {
                                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", chan->name, cmd->cmd_id, ami_buffer);
+                                       "Result: %s\r\n", chan->name, chan->uniqueid, cmd->cmd_id, ami_buffer);
                        }
                        free_agi_cmd(cmd);

@@ -1414,7 +1417,8 @@
           controlled anymore by Async AGI */
        manager_event(EVENT_FLAG_AGI, "AsyncAGI",
                "SubEvent: End\r\n"
-               "Channel: %s\r\n", chan->name);
+               "Channel: %s\r\n"
+               "Uniqueid: %s\r\n", chan->name, chan->uniqueid);

 async_agi_abort:
        /* close the pipe */
@@ -3374,8 +3378,9 @@
        manager_event(EVENT_FLAG_AGI, "AGIExec",
                        "SubEvent: Start\r\n"
                        "Channel: %s\r\n"
+                       "Uniqueid: %s\r\n"
                        "CommandId: %d\r\n"
-                       "Command: %s\r\n", chan->name, command_id, ami_cmd);
+                       "Command: %s\r\n", chan->name, chan->uniqueid, command_id, ami_cmd);
        parse_args(buf, &argc, argv);
        c = find_command(argv, 0);
        if (c && (!dead || (dead && c->dead))) {
@@ -3413,10 +3418,11 @@
                manager_event(EVENT_FLAG_AGI, "AGIExec",
                                "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", chan->name, command_id, ami_cmd, resultcode, ami_res);
+                                "Result: %s\r\n", chan->name, chan->uniqueid, command_id, ami_cmd, resultcode, ami_res);
                switch (res) {
                case RESULT_SHOWUSAGE:
                        if (ast_strlen_zero(c->usage)) {
@@ -3440,19 +3446,21 @@
                manager_event(EVENT_FLAG_AGI, "AGIExec",
                                "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", chan->name, command_id, ami_cmd);
+                               "Result: Command not permitted on a dead channel\r\n", chan->name, chan->uniqueid, 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"
+                               "Uniqueid: %s\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, chan->uniqueid, command_id, ami_cmd);
        }
        return AGI_RESULT_SUCCESS;
 }

)

> We are using AMI and during load testing we occasionally see two calls with the same channelname.  We decided to use the UniqueId for identification purposes, but discovered the channel's uniqueid is not included in the "AsyncAGI" and "AGIExec" events
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-20318
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20318
>             Project: Asterisk
>          Issue Type: Improvement
>      Security Level: None
>          Components: Resources/res_agi
>    Affects Versions: 10.3.1, 10.7.0
>         Environment: Debian 64 bit, virtual machine, SIP.
>            Reporter: Dan Cropp
>
> We are using AMI and during load testing we occasionally see two calls with the same channelname.  
> For the load test, we originate calls to ourselves.  Basically a loop back.  We go through a few thousand calls before encountering a case where the channel name matches another channel name.
> We decided to use the UniqueId for identification purposes.  This works great for the calls.  However, since we are using AsyncAGI, we rely on the AsyncAGI related events to also have the UniqueId.
> The channel's uniqueid is not included in the "AsyncAGI" and "AGIExec" events.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list