I’ve got an ARI application that I’ve been experimenting with, and I’ve managed to get outbound calls working using ARI. I originate the channel, and pass a reference to my stasis app, and I start getting events on the channel. What I’m wondering about though is any sort of outbound call progress, like SIT tone detection, on the outbound call. I’ve found that a lot of carriers are just playing in-band busy tones instead of sending back a 486, and you’ll also get the number not in service tones. There’s also the issue of fax/voicemail/live answer detection. I could handle this with an audiosocket to get the media stream and a tone detection library to pick up the tones, but I noticed that there was a built in Application_ToneScan dialplan app that might already do what I needed.
This is where I’m a little lost. What I’d like to do is have the ARI application originate the channel, have it detect whether there’s a live answer, SIT tone, etc, and then pass that result back into the ARI application. Is it possible to hand off control to a dialplan app from a Stasis app like this, or do I have to have my stasis app call a dialplan extension that invokes tonescan and then passes control back to the stasis app?
You can’t execute a dialplan application while a channel is in ARI. You have to direct it back to the dialplan and out of your ARI application. There’s nothing built into ARI to do tone scanning or detection.
[outbound]
exten => 1234,1,NoOp()
same => n,ToneScan()
same => n,Stasis(asteriskTester)
same => n,Hangup()
Although when I tried this, my call went through, but it didn’t come back in to my stasis app (no StasisStart event). I’m also not sure how/whether there’s a way to have the stasis application get the result of the ToneScan application in this case (I presumed I’d be able to get it off the StasisStart event, but the first step is getting the channel back into my application).
I can’t comment on ToneScan itself. The above dialplan should direct the channel back into the ARI application, why it isn’t you’d need to investigate and see.
OK, thanks. It does look like it worked, but the ToneScan doesn’t seem to be working properly. Once I changed my dialplan to look like this:
exten => 1234,1,NoOp()
same => n,ToneScan("us",15)
same => n,Stasis(asteriskTester)
same => n,Hangup()
That hit stasis after a 15s timeout. I could extract the result from the TONESCANSTATUS channel variable, which would give me TIMEOUT, or occasionally RINGING for some reason, even with a live answer. Seems like at least the dial plan is doing what it’s supposed to, so it’s just the tone detector that isn’t working in this context.
Good question, although given that there’s only one channel (created with a channel/originate), I’m not sure how it could be created on the wrong channel.