[asterisk-users] Event response (AMI)

Shahid H shahidh at gmail.com
Fri May 11 14:02:45 CDT 2012


Thanks for the detailed information.

I have came up with this solution:

I've generate random CALLID and assign to UserEvent()

exten => xxx,1,UserEvent(CallStatus,UniqueID: ${UNIQUEID}, CallID:
${CALLID})

I then find matching CALLID from the EVENT response which will also tell me
what the UniqueID.

What do you think of this solution?

Thanks

On Fri, May 11, 2012 at 2:31 PM, Matthew Jordan <mjordan at digium.com> wrote:

>
> ----- Original Message -----
>
> > From: "Shahid H" <shahidh at gmail.com>
> > To: asterisk-users at lists.digium.com
> > Sent: Friday, May 11, 2012 6:12:25 AM
> > Subject: [asterisk-users] Event response (AMI)
>
> > When I execute the ACTION commands set then the EVENT would response
> > back. How would I know which ACTION are they belong/reference to?
>
> > For example:
>
> > ACTION: Originate
> > Channel: SIP/test
> > Exten: 215
> > Timeout: 30000
> > Context: test
> > Priority: 1
> > ActionID: 111112222333
>
> > Response: Success
> > ActionID: 111112222333
> > Message: Originate successfully queued
>
> > EVENT response when I hang up the call:
>
> > Event: Hangup
> > Privilege: call,all
> > Channel: SIP/test-0000007f
> > Uniqueid: 1336690030.189
> > CallerIDNum: <unknown>
> > CallerIDName: <unknown>
> > Cause: 16
> > Cause-txt: Normal Clearing
>
> > As you can see, how would I know which which ACTION was that belong
> > to?
>
> > If I were coding in PHP (AMI) to Originate the calls then I want to
> > detect which call hanged up.
>
> > Thanks
>
> In general, there is no explicit tying of events with a particular action
> that caused those events, as AMI events are completely independent of AMI
> actions.  The exception to this, of course, are AMI events that are
> reporting
> success/failure of an AMI action, in which case they will share the same
> ActionId header (if the action specified an ActionId as well).
>
> In your particular case, if I were writing a system that wanted to
> associate
> a created channel with an Originate Action, after I issue the Originate,
> I'd listen for a NewChannel event.  If that NewChannel event specified a
> channel that was created in the context I specified and with a
> technology/extension that I specified, I'd set that as the channel I just
> asked to be created. From there on, subsequent events (VarSet, NewExten,
> Hangup, etc.) that are associated with that channel will contain a Channel:
> header with that value.
>
> --
> Matthew Jordan
> Digium, Inc. | Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> Check us out at: http://digium.com & http://asterisk.org
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120511/b01fe454/attachment.htm>


More information about the asterisk-users mailing list