Thanks for the reply ! Answers follow inline.
On Friday 28 March 2014 at 13:43, Joshua Colp wrote:
Jan Svoboda wrote:Hi,I am currently trying to implement asterisk applications using ARI, andcame across few problems trying to recreate the DIAL app.My current approach is the following:1. When StasisStart event is received, determine which endpoints to dialand create new object, representing the DIAL application in my code,passing it the endpoints to call and the originating channel.2. Create destination channels from all passed endpoints, listening tovarious events.- if at least one destination channel is created, indicate ring tooriginating channel3. When one of the destination channels answers:- hangup all other destination channels- bridge the channel which answered with the originating oneThis works and calls can be completed, but the problem is when dialleddestination channel indicates progress and starts early audio. This canbe for example in case of a call to mobile phone, which is switched off.In this case, there is early audio saying “The called number isunavailable at the moment.”.As there is no other indication apart from the audio message, this leadsto the caller hearing only the ringing indication and then the call ishung up, which makes the misleading impression, that the mobile phone isswitched on, but does not answer the call.I have checked the source code of the DIAL app in app_dial.c, andnoticed, that this is handled specially when there is only onedestination channel, and that the way it is handled is withast_channel_early_bridge(in, c). Using the DIAL app, this works, and Ican hear the early audio.Not really. What actually happens is that since Dial has control of allchannels involved it can create a primitive bridge inside of itself,allowing media to be exchanged back and forth even in an early state.Once answer occurs the normal core bridging is invoked.Bridging the channel early in the app does not seem to be an option,since in this case, the channel does not even enter stasis.Is there any workaround or recommended way to achieve this ? Or is itsomething that yet has to be added to ARI ?This hasn't been added to ARI yet and thus is not achievable. Until thechannel is answered you don't have enough control. Ideally what wouldhappen is that an early bridge technology would exist and you could thenthrow them into a bridge. The early bridge would do the stuff requiredin an unanswered state and then once answered a smart bridge operationwould occur and the bridge would transition to a normal simple bridge ora native RTP bridge. Heck, it would probably even work in early state innormal bridges.
This seems to be an important and essential part to be able to fully use ARI. Early bridge would be nice, but there is also the problem, that the channel is not in Stasis at that time and attempts to add it to bridge fail with “Channel not in Stasis” error.
Another problem is that it seems there is no way to indicate and playearly audio to the caller. Any attempt to do so seems to answer theoriginating channel and generates ChannelStateChange event with state Up.This shouldn't happen. Behavior was changed months ago so stuff shouldnot explicitly answer. What operation were you doing?
This happens calling POST /channels/{channelId}/play
There is also a problem when playing music on hold to caller. The logindicates "Started music on hold”, but there is no audio. This alsoseems to be related to progress not being indicated (and lack of a wayto do so), because trying it with the PROGRESS app called from thedialplan before Stasis works.Can you file an issue for this? The MOH code should be indicating progress.
No problem:
Cheers,--Joshua ColpDigium, Inc. | Senior Software Developer445 Jan Davis Drive NW - Huntsville, AL 35806 - USCheck us out at: www.digium.com & www.asterisk.org_______________________________________________asterisk-app-dev mailing list
Jan Svoboda
Software Architect
_______________________________________________ asterisk-app-dev mailing list asterisk-app-dev@xxxxxxxxxxxxxxxx http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev