Hi all, I'm writing an application to Queue and Manage AMI Originate actions. Basically, callfiles on steroids if you may :) I'm facing the following challenges, and any ideas or pointers will be hugely appreciated. 1. When I successfully Queue an Originate... (Response is Success), how will i know when the channel has been freed up? I had initially been monitoring the Response/Message/ActionID trio, but i discovered that this returns immedietly asterisk queues the command. I've also noticed that Events keep popping up during the life-time of the Origination. I'm guessingthe solution would be to monitor for a particular event. My question then is... can i _always_ count on Even: Hangup, always being present, _nomatter_ what? (As i've noticed Hangup is raised even on failed events) 2. I have noticed that in version 1.4.21, the events do not carry any associated ActionID (which is understandable, as they may not be in response to any AMI commands). My question then i how can i reliably detect which events have to do with me? If i have a channel SIP/foo, i notice that the events carry a channel tag: SIP/foo-xxxxxxx, where xxxxxxx is a hex number that I don't know how to generate, so if i have to channels, SIP/foo and SIP/foo1, it gets tricky knowing which events belong to which channel. Especially when trying to multiplex just one socket connection. 3. Uhh.... there is really no #3 :), but any other tips or problems hints at solutions to problems I *may* face, from experience, are very much welcome. Thnx. cheers, Essien OS: Linux 2.6.25 Asterisk: 1.4.21
Hi, The only reliable solution I've found for this is to set a custom variable with the Originate action and query new channels for that variable when they appear. We've also used this strategy successfully when implementing Asterisk-Java's live API. Depending on which language you are going to use for your application solutions similar to Asterisk-Java may be available that hide this and similar obstacles. =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: stefan.reuter at reucon.com Jabber: stefan.reuter at reucon.com WWW: http://www.reucon.com Steuernummern 215/5140/1791 USt-IdNr. DE220701760 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20080811/d6b64370/attachment.pgp
Essien Ita Essien wrote:> Hi all, > > I'm writing an application to Queue and Manage AMI Originate actions. > Basically, callfiles on steroids if you may :) > > I'm facing the following challenges, and any ideas or pointers will be > hugely appreciated. > > 1. When I successfully Queue an Originate... (Response is Success), how > will i know when the channel has been freed up? I had initially been > monitoring the Response/Message/ActionID trio, but i discovered that > this returns immedietly asterisk queues the command. > >You have to mod the Event: Hangup manager event to include something useful for you. This is an example of adding the CallerIDNum/Name to the event. http://dynx.net/ASTERISK/gnudialer/channel.c.hangup_callerid_ast1419.diff> I've also noticed that Events keep popping up during the life-time of > the Origination. I'm guessingthe solution would be to monitor for a > particular event. My question then is... can i _always_ count on Even: > Hangup, always being present, _nomatter_ what? (As i've noticed Hangup > is raised even on failed events) > >On failed 'attempts' it would be an origination 'failure', and those you need to use a... ; this extension MUST be here for OriginateFailure triggers exten => failed,1,Hangup in the context you use for your originate attempt. That will produce another manager event, which will provide a Reason: code. That code is the 'AST_CONTROL' of what last happened on that channel. frame.h:#define AST_CONTROL_HANGUP 1 frame.h:#define AST_CONTROL_RING 2 frame.h:#define AST_CONTROL_RINGING 3 frame.h:#define AST_CONTROL_ANSWER 4 frame.h:#define AST_CONTROL_BUSY 5 frame.h:#define AST_CONTROL_TAKEOFFHOOK 6 frame.h:#define AST_CONTROL_OFFHOOK 7 frame.h:#define AST_CONTROL_CONGESTION 8 ...> 2. I have noticed that in version 1.4.21, the events do not carry any > associated ActionID (which is understandable, as they may not be in > response to any AMI commands). My question then i how can i reliably > detect which events have to do with me? > >Refer to the calleridnum/name section above.