Thanks for the detailed information.<div><br></div><div>I have came up with this solution:</div><div><br></div><div>I've generate random CALLID and assign to UserEvent()</div><div><br></div><div>exten => xxx,1,UserEvent(CallStatus,UniqueID: ${UNIQUEID}, CallID: ${CALLID})</div>
<div><br></div><div>I then find matching CALLID from the EVENT response which will also tell me what the UniqueID.</div><div><br></div><div>What do you think of this solution?</div><div><br></div><div>Thanks</div><div><br>
<div class="gmail_quote">On Fri, May 11, 2012 at 2:31 PM, Matthew Jordan <span dir="ltr"><<a href="mailto:mjordan@digium.com" target="_blank">mjordan@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
----- Original Message -----<br>
<br>
> From: "Shahid H" <<a href="mailto:shahidh@gmail.com">shahidh@gmail.com</a>><br>
> To: <a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a><br>
> Sent: Friday, May 11, 2012 6:12:25 AM<br>
> Subject: [asterisk-users] Event response (AMI)<br>
<div><div class="h5"><br>
> When I execute the ACTION commands set then the EVENT would response<br>
> back. How would I know which ACTION are they belong/reference to?<br>
<br>
> For example:<br>
<br>
> ACTION: Originate<br>
> Channel: SIP/test<br>
> Exten: 215<br>
> Timeout: 30000<br>
> Context: test<br>
> Priority: 1<br>
> ActionID: 111112222333<br>
<br>
> Response: Success<br>
> ActionID: 111112222333<br>
> Message: Originate successfully queued<br>
<br>
> EVENT response when I hang up the call:<br>
<br>
> Event: Hangup<br>
> Privilege: call,all<br>
> Channel: SIP/test-0000007f<br>
> Uniqueid: 1336690030.189<br>
> CallerIDNum: <unknown><br>
> CallerIDName: <unknown><br>
> Cause: 16<br>
> Cause-txt: Normal Clearing<br>
<br>
> As you can see, how would I know which which ACTION was that belong<br>
> to?<br>
<br>
> If I were coding in PHP (AMI) to Originate the calls then I want to<br>
> detect which call hanged up.<br>
<br>
> Thanks<br>
<br>
</div></div>In general, there is no explicit tying of events with a particular action<br>
that caused those events, as AMI events are completely independent of AMI<br>
actions. The exception to this, of course, are AMI events that are reporting<br>
success/failure of an AMI action, in which case they will share the same<br>
ActionId header (if the action specified an ActionId as well).<br>
<br>
In your particular case, if I were writing a system that wanted to associate<br>
a created channel with an Originate Action, after I issue the Originate,<br>
I'd listen for a NewChannel event. If that NewChannel event specified a<br>
channel that was created in the context I specified and with a<br>
technology/extension that I specified, I'd set that as the channel I just<br>
asked to be created. From there on, subsequent events (VarSet, NewExten,<br>
Hangup, etc.) that are associated with that channel will contain a Channel:<br>
header with that value.<br>
<br>
--<br>
Matthew Jordan<br>
Digium, Inc. | Software Developer<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>
Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</blockquote></div><br></div>