Johannes Zweng
2006-Jul-21 14:26 UTC
[asterisk-users] Associate manager events to a previous Originate action
Hi people! I am writing an application that makes heavy use of the manager API to create outbound calls, but I am still learning a lot... :-) At the moment I am thinking about one problem. Let me describe it: - I send an Originate action with extension- and context-parameter to the manager API of * - in the specified extension I have a Dial() command which links the first channel (generated by my Originate command) to a second call - some time later, after sending the Originate I receive a bunch of events, some of them for the first created channel (by the originate), some of them for the channel which was created by the Dial() and some events for completely uninvolved channels.. Although I can associate every incoming event to a specific channel on Asterisk (because of the Uniqueid field) I see no possibility to identify without doubts which channels were created as a result of my Originate action. But I need to monitor the events for these channels because my program needs to be aware about the calls' states. Did someone of you already run into the same problem or has some hint for me? Any help would be appreciated! Thanx! :-) Best regards, John
Stefan Reuter
2006-Jul-21 16:13 UTC
[asterisk-users] Associate manager events to a previous Originate action
Johannes Zweng wrote:> Although I can associate every incoming event to a specific channel on > Asterisk (because of the Uniqueid field) I see no possibility to identify > without doubts which channels were created as a result of my Originate > action.add an ActionId property to your Originate action and you will receive the same ActionId as part of the OriginateSuccess or OriginateFailure event. The OriginateSuccess event also contains a link to the channel so you can relate them after you received the OriginateSuccess event. For the OriginateSuccess/-Failure events to be sent you must also set Async to true when sending the Originate action. =Stefan -- reuter network consulting Neusser Str. 110 50760 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: srt@reucon.net Jabber: srt@jabber.reucon.net -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 254 bytes Desc: OpenPGP digital signature Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060721/3c1572ad/signature.pgp
Johannes Zweng
2006-Jul-22 06:22 UTC
[asterisk-users] Associate manager events to a previous Originate action
Stefan Reuter wrote:>add an ActionId property to your Originate action and you will receive >the same ActionId as part of the OriginateSuccess or OriginateFailure >event. The OriginateSuccess event also contains a link to the channel so >you can relate them after you received the OriginateSuccess event. >For the OriginateSuccess/-Failure events to be sent you must also set >Async to true when sending the Originate action.Thank you very much! This did the trick! I can associate the first channel to my Originate action by reading the Uniqueid field of the OriginateSucess event and I also can associate the second channel (created by the Dial() command) to the first one by reading the fields of the Dial event. This was exactly the hint I needed. Thanks! :-) Best regards, John
Richard Lyman
2006-Jul-22 08:43 UTC
[asterisk-users] Associate manager events to a previous Originate action
Stefan Reuter wrote:>Johannes Zweng wrote: > > >>Although I can associate every incoming event to a specific channel on >>Asterisk (because of the Uniqueid field) I see no possibility to identify >>without doubts which channels were created as a result of my Originate >>action. >> >> > >add an ActionId property to your Originate action and you will receive >the same ActionId as part of the OriginateSuccess or OriginateFailure >event. The OriginateSuccess event also contains a link to the channel so >you can relate them after you received the OriginateSuccess event. >For the OriginateSuccess/-Failure events to be sent you must also set >Async to true when sending the Originate action. > >=Stefan > >iirc, current svn/trunk only has OriginateFailure. (OriginateSuccess output was removed)
Tony Mountifield
2006-Jul-22 09:40 UTC
[asterisk-users] Re: Associate manager events to a previous Originate action
In article <44C24798.7050908@dynx.net>, Richard Lyman <pchammer@dynx.net> wrote:> iirc, current svn/trunk only has OriginateFailure. (OriginateSuccess > output was removed)Really??? If so, that would be a very retrograde step. Fortunately, a look at the latest version of manager.c in trunk at http://svn.digium.com/view/asterisk/trunk/manager.c?rev=38042&view=markup is reassuring, in the function fast_originate(): /* Tell the manager what happened with the channel */ manager_event(EVENT_FLAG_CALL, res ? "OriginateFailure" : "OriginateSuccess", Comparing with 1.2, I see there were originally two calls to manager_event(), one for OriginateFailure and another for OriginateSuccess. They have now been combined into one, with a conditional event name, which may have given rise to the mistaken impression if just skimming the diffs cursorily. Cheers Tony -- Tony Mountifield Work: tony@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org
Richard Lyman
2006-Jul-22 13:38 UTC
[asterisk-users] Re: Associate manager events to a previous Originate action
Tony Mountifield wrote:> *snipped > >Comparing with 1.2, I see there were originally two calls to manager_event(), >one for OriginateFailure and another for OriginateSuccess. > >They have now been combined into one, with a conditional event name, >which may have given rise to the mistaken impression if just skimming >the diffs cursorily. > >Cheers >Tony > >that is exactly what happened. sorry for the false alarm.