giovanni.v
2011-Nov-17 11:00 UTC
[asterisk-users] AMI: anything to glue originate to events?
Hi all, I'm trying to write an application to dialout something then forward the call to a context/exten depending on some parameters. These questions may be trivial, not for me ;-) --- Action: Originate Channel: Local/00001 at internal Exten: 384087 Context: SIP-UA-00128 Priority: 1 CallerID: 601 ActionID: FFA02C6A03 Response: Success ActionID: FFA02C6A03 Message: Originate successfully queued --- Ok, the /Response/ is clearly related to the /Originate/ action via ActionID, but the next events? --- Event: Newchannel Privilege: call,all Channel: Local/00001 at internal-99fd;1 ChannelState: 0 ChannelStateDesc: Down CallerIDNum: CallerIDName: AccountCode: Exten: 00001 Context: internal Uniqueid: 1321366075.180 Event: Newchannel Privilege: call,all Channel: Local/00001 at internal-99fd;2 ChannelState: 4 ChannelStateDesc: Ring CallerIDNum: CallerIDName: AccountCode: Exten: 00001 Context: internal Uniqueid: 1321366075.181 --- The only glue I can see here is the first part in the Channel variable but what if issuing parallel Originate actions using the same channel? I will also need to re build the leg between the events raised from my Originate action using Channel, Uniqueid, DestUniqueID event values which sounds a bit tricky. Actually the thing is even more complex because the ami connection get also events from any other concurrent call in the system. The task could be easy if it were possible to propagate the action from the /Originate/ ActionID (or anything else) to the resulting events but unfortunately it is not so. What am I missing? Thanks!
Yaroslav Panych
2011-Nov-17 12:11 UTC
[asterisk-users] AMI: anything to glue originate to events?
After origination successfully complete and channel will be created you probably should link ActionID and channel name. Origination action will be next: Action: Originate Channel: Local/00001 at internal Exten: 384087 Context: SIP-UA-00128 Priority: 1 CallerID: 601 ActionID: FFA02C6A03 Variable: ActionID=FFA02C6A03 [SIP-UA-00128] exten => 384087,1,UserEvent(LinkOriginate,CHANNEL:${CHANNEL(name),ACTIONID:${ActionID}} .... UserEvent application will generate event into AMI in form Event: LinkOriginate CHANNEL: channle-name (channel id created by asterisk) ACTIONID: FFA02C6A03 (action id you set in originate) They you(AMI client side) should associate received CHANNLE value with ActionID, so later when you receive any event which contains channel name you can easily find ActionID and do your work.
Danny Nicholas
2011-Nov-17 14:46 UTC
[asterisk-users] AMI: anything to glue originate to events?
You have two items to "join with" in the example you provided; #1 local/00001 at internal-99fd,1 is call 99fd on local/00001. If you started 10 calls from local/00001, they would all have differing -xxxx (99fd). #2 UniqueID - part 1 is a constant. Part 2 is a sequence so you can join events using the constant part 1 and order them with the sequence part 2. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of giovanni.v Sent: Thursday, November 17, 2011 5:00 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] AMI: anything to glue originate to events? Hi all, I'm trying to write an application to dialout something then forward the call to a context/exten depending on some parameters. These questions may be trivial, not for me ;-) --- Action: Originate Channel: Local/00001 at internal Exten: 384087 Context: SIP-UA-00128 Priority: 1 CallerID: 601 ActionID: FFA02C6A03 Response: Success ActionID: FFA02C6A03 Message: Originate successfully queued --- Ok, the /Response/ is clearly related to the /Originate/ action via ActionID, but the next events? --- Event: Newchannel Privilege: call,all Channel: Local/00001 at internal-99fd;1 ChannelState: 0 ChannelStateDesc: Down CallerIDNum: CallerIDName: AccountCode: Exten: 00001 Context: internal Uniqueid: 1321366075.180 Event: Newchannel Privilege: call,all Channel: Local/00001 at internal-99fd;2 ChannelState: 4 ChannelStateDesc: Ring CallerIDNum: CallerIDName: AccountCode: Exten: 00001 Context: internal Uniqueid: 1321366075.181 --- The only glue I can see here is the first part in the Channel variable but what if issuing parallel Originate actions using the same channel? I will also need to re build the leg between the events raised from my Originate action using Channel, Uniqueid, DestUniqueID event values which sounds a bit tricky. Actually the thing is even more complex because the ami connection get also events from any other concurrent call in the system. The task could be easy if it were possible to propagate the action from the /Originate/ ActionID (or anything else) to the resulting events but unfortunately it is not so. What am I missing? Thanks! -- _____________________________________________________________________ -- 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
c.savinovich at itntelecom.com
2011-Nov-17 18:45 UTC
[asterisk-users] AMI: anything to glue originate to events?
<html><body><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div>Excuse me if I am off the mark here, I don't have the chance to read too well into your post. But if it is what I think it is, I remember I had a similar situation a few years ago, and I ended up having to create an internal table in my code, so that I could keep track of the channel ids + action ids .</div><div><br></div><div>Please never mind if it is something else</div><div><br></div><div>CS</div><div><br></div> <blockquote id="replyBlockquote" webmail="1" style="border-left: 2px solid blue; margin-left: 8px; padding-left: 8px; font-size: 10pt; color: black; font-family: verdana;"> <div id="wmQuoteWrapper"> -------- Original Message --------<br> Subject: Re: [asterisk-users] AMI: anything to glue originate to<br> events?<br> From: "giovanni.v" <<a href="mailto:iax@keybits.org">iax@keybits.org</a>><br> Date: Thu, November 17, 2011 11:22 am<br> To: <a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a><br> <br> On 17/11/2011 13.11, Yaroslav Panych wrote:<br>> exten => 384087,1,UserEvent(LinkOriginate,CHANNEL:${CHANNEL(name),ACTIONID:${ActionID}}<br> > ....<br> > UserEvent application will generate event into AMI in form<br> > Event: LinkOriginate<br> > CHANNEL: channle-name (channel id created by asterisk)<br> > ACTIONID: FFA02C6A03 (action id you set in originate)<br><br> Thanks Yaroslav,<br> unfortunately this doesn't add much because only generate another event <br> but nothing will propagate to Originate child events.<br> Also the event is fired in asynchronous mode... usually reported later <br> in the middle of other events when almost of the call flow was already <br> processed.<br> <br> Thanks anyway.<br> <br> --<br> _____________________________________________________________________<br> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">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">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">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br> </div> </blockquote></span></body></html>