[asterisk-app-dev] ARI dial application

Phil Mickelson phil at cbasoftware.com
Fri Dec 19 12:17:26 CST 2014


Paul,

Let me give it a try here.  I'm just showing you what works for me.  And,
my application is an answering service so this might not work for anyone
else:

My extensions.conf has an entry like this:

exten => s,1,Answer()
same => n,Stasis(xxx_xxx,external)
same => n,Hangup()

All external calls come into that routine.  You can see that the first
thing I do is answer the call which solves a bunch of problems I had (early
media? etc).

(BTW, I'm using Node.js for all of the stasis interface and websockets to
the clients.  I'm using ZeroMQ and PHP workers to do all the heavy lifting.)

In Node I then get the StasisStart event.  I "answer" the call again so
that I have control of the call.  I found that if I didn't that I would
lose the call after a couple of rings.  If this is the wrong method please
let me know!!  I know it's an external call from args[0] = 'external'.

Yes, the caller no longer hears ringing so I do channels.ring() to that
channel.  Solves that problem.

I then do a bunch of stuff internally to let the operators know a call is
incoming and what company it's for, how long it's been ringing, etc.

One of the operators (who already has an open channel and bridge) chooses
the call.  The ringing is turned off, the incoming channel is connected to
the operator's bridge and the operator gets a beep to let them know the
call is on the line.

Obviously, I also display information about the company being called so
that the operator can answer the phone properly, etc.

But that's all there is to it.  I've got other routines to make outbound
calls, to transfer calls (both transfer and announce and just straight
blind transfer).  I can easily put the call on hold, etc.

Each of these options above take a few lines of JS code to the Asterisk
routine and that's it.  So far, except for a bad softphone, I've had little
to no problems.  And, the folks at Digium solved the softphone problem also!

Hope this helps a little.  It's very easy.  My biggest problem was getting
over trying to make it too complex.  It isn't.

Phil M




On Fri, Dec 19, 2014 at 1:01 PM, Joshua Colp <jcolp at digium.com> wrote:
>
> Paul Belanger wrote:
>
> <snip>
>
>
>> So, how would that look in ARI?
>>
>> Answer channel
>> invoke originate (far end answers)
>> create bridge
>> move channel A and B into bridge
>>
>> Right?
>>
>> Some differences I can see right from the start, in the ARI example
>> caller A does not hear ringback, with app_dial they would. So my
>> questions are:
>>
>> When does app_dial indicate ringing to the channel?
>>
>
> When ringing is received from the dialed end it is then indicated to the
> caller within app_dial. Of course if there are multiple dialed parties then
> it uses a bit more intelligence.
>
>  When does app_dial create the bridge? Does caller A live in the bridge
>> before Caller B is answered?
>>
>
> app_dial creates a bridge upon answer and bridges the two. HOWEVER before
> the remote end has answered there is a pseudo bridge implemented inside of
> app_dial which exchanges media so early media works.
>
>
>> If you had to do this in ARI, how would you do it? Because, what I'd
>> like to do, is come up with the spec for it, write it, then see about
>> making a few simple demos for different languanges.
>>
>
> Right now you can't directly replace app_dial with an ARI equivalent
> because of early media. There is no way to do anything with a channel until
> it has answered and no way to exchange early media.
>
> --
> Joshua Colp
> Digium, Inc. | Senior Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
>
>
> _______________________________________________
> asterisk-app-dev mailing list
> asterisk-app-dev at lists.digium.com
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-app-dev/attachments/20141219/13b2bd22/attachment.html>


More information about the asterisk-app-dev mailing list