<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">This makes it very hard to use the command_id for it&#39;s intended purpose.<div>
<br></div><div>The idea is, I think, first you put a channel into async AGI mode in extensions.conf :</div><div><br></div><div>[phone]</div><div>1,1,answer()</div><div>1,2,AGI(agi:async)</div><div>...</div><div><br></div>
<div>Then you connect a manager application, which gets and AsyncAGI event (subevent start) and is then supposed to queue up AGI commands by sending AGIActions. These contain a command_id. </div><div><br></div><div>The commands are converted into a struct agi_cmd (res_agi.c: 963) : </div>
<div><div>struct agi_cmd {</div><div>        char *cmd_buffer;</div><div>        char *cmd_id;</div><div>        AST_LIST_ENTRY(agi_cmd) entry;</div><div>};</div></div><div><br></div><div>When time comes to execute these, they&#39;re executed by agi_handle_command (res_agi.c: 3249) which starts :</div>
<div><br></div><div>static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead) </div><div><div>{</div><div>        const char *argv[MAX_ARGS];</div><div>        int argc = MAX_ARGS, res;</div><div>
        agi_command *c;</div><div>        const char *ami_res = &quot;Unknown Result&quot;;</div><div>        char *ami_cmd = ast_strdupa(buf);</div><div>*****************************</div><div>        int command_id = ast_random(), resultcode = 200;</div>
</div><div>*****************************</div><div><br></div><div>Right there a new command_id is made up as a random string, which is then used to generate events about the command (command start, end, result, ...). This makes it impossible to use the command_id&#39;s for their intended purpose : associate the requested command with events describing it&#39;s execution. Wouldn&#39;t it be better to pass the agi_cmd struct into the agi_handle_command function and use it&#39;s cmd_id ?</div>
<div><br></div><div>Christophe</div><div>--</div><font color="#888888"><div>Reality is that which, when you stop believing in it, doesn&#39;t go away.</div></font></span>