[asterisk-app-dev] Implementing app DIAL using ARI

Jan Svoboda jan at mluv.cz
Thu Mar 27 15:34:27 CDT 2014


Hi,


I am currently trying to implement asterisk applications using ARI, and came 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 dial and 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 to various events.
    - if at least one destination channel is created, indicate ring to originating channel

3. When one of the destination channels answers:
    - hangup all other destination channels
    - bridge the channel which answered with the originating one

This works and calls can be completed, but the problem is when dialled destination channel indicates progress and starts early audio. This can be 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 is unavailable at the moment.”.

As there is no other indication apart from the audio message, this leads to the caller hearing only the ringing indication and then the call is hung up, which makes the misleading impression, that the mobile phone is switched on, but does not answer the call.

I have checked the source code of the DIAL app in app_dial.c, and noticed, that this is handled specially when there is only one destination channel, and that the way it is handled is with ast_channel_early_bridge(in, c). Using the DIAL app, this works, and I can hear the early audio.

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 it something that yet has to be added to ARI ?

Another problem is that it seems there is no way to indicate and play early audio to the caller. Any attempt to do so seems to answer the originating channel and generates ChannelStateChange event with state Up.

There is also a problem when playing music on hold to caller. The log indicates "Started music on hold”, but there is no audio. This also seems to be related to progress not being indicated (and lack of a way to do so), because trying it with the PROGRESS app called from the dialplan before Stasis works.

     Jan Svoboda
     Software Architect

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-app-dev/attachments/20140327/7387424d/attachment.html>


More information about the asterisk-app-dev mailing list