Error: "Channel not in Stasis application" when adding channel to a bridge - asterisk

I'm working with Asterisk ARI. When I create channels via ARI, I specify application name and I can add those channels to a bridge with no problem. But when I use other client (like Zoiper) to make calls, and try to add those channels to a bridge, I get an error "Channel not in Stasis application". I am not sure what is Stasis, I followed this article and put the following in extensions conf file, but it still doesn't work:
same => n,Stasis(myApp)
same => n,Hangup()
So, what is a stasis app and how can I be able to bridge channels which are created outside of ARI?

You can't bridge already bridged calls
You can bridge by AMI calls which are set to MOH or AsyncAGI applications.

You can't perform operations on channels that are not in a Stasis application. This is a safety mechanism: a Stasis application hands complete control of the channel over to your external application to control. Channels in dialplan are not in that state, and many operations on a channel that are possible through ARI would cause problems (read: crash) if they were performed on a channel in dialplan.
You'll need to place the channel into the Stasis dialplan application to control it using the /channels resource.

Related

IVR call simulation on Asterisk 15 server

I am using Asterisk 15 server and wanted to configure IVR call simulation. My configuration scenario is
1. A subscriber will register to Asterisk server and start a call.
2. The IVR audio will come from the Asterisk sever to sbscriber.
3. Once the subscriber pressed the botton, the call will connect to a number based on DTMF digit pressed by subscriber. Then call will continue for 30 seconds.
I observered for normal call pjsip.conf file is used for configuration of a subscribers.
Could you please help me on below queries ?
1. Which file we need to configure for the IVR call simulation ?
2. Please suggest a good documentation for IVR simulation.
Files are extensions.conf and pjsip.conf/sip.conf
You have read book for beginner, for example "Asterisk the future of telephony".
After that write dialling core or reuse vicidial.org or other core and write dialplan in extensions.conf for you ivr.
What you tried to do usually called "press-1 outbound dialling campaign"

Replacing dialplan with ARI for "dynamic" inbound extensions

I'm experimenting with the ARI interface in Asterisk (v15.5). I've managed to placing and manage outbound calls relatively well, and I'm now trying to tackle inbound calls.
I don't have any dialplan to speak of on my test server; it hasn't been needed: I just connect via ARI, Originate channels, and bridge them together. However, trying to send an inbound call to the server gives me an error
chan_sip.c:26513 handle_request_invite: Call from 'upstreamserver' (192.168.x.x:5060) to extension '12345' rejected because extension not found in context 'default'.
Fair enough - Asterisk doesn't know about extension 12345 or what to do with it. I could, of course, add this into extensions.conf, put the extension into stasis and let my application deal with this: however, this has two downsides:
We have potentially hundreds of inbound numbers, and we'd need to keep the dialplan up to date
We'd like to have multiple ARI applications connecting to the server: it seems we need to specify a specific application name for each extension
Ideally, I'd like to use ARI to programatically tell Asterisk: hey Asterisk, I'm an ARI application, let me know if there's any calls for extension 12345, and I'll take care of those for you. Is there currently a way to do this, or is it back to editing the dialplan and pointing it to my app by hand?
If you want control all via ARI you should do something like this
[default]
exten => _.,1,Noop(need ban this <${CHANNEL(recvip)}>);use fail2ban
exten => h,1,Hangup
[from-trunk]
exten => _.,1,Stasis()
exten => h,1,Hangup
You should not use default context in your peers/extensions
You also can use dynamic realtime and fastagi for control dialplan.

How to route call from VoiceBlue Next device to Asterisk Server

I want to setup and IVR Menu i mean if a user calls to a particular GSM Number then the number should be redirected to Asterisk Server and the user needs to Get IVR Menu
I am using VoiceBlue Next firmware version 1.31.1.34.1 inserted working SIM Card
If i make a call to that particular number i am able to accept call,reject call and other options from VoiceBlueNext Web Interface.
I have made a SIP account in pjsip.conf file and created and extension as 100 in extensions.conf but unable to transfer the call to Asterisk Server
In asterisk server are there any other files to be changed or any settings in VoiceBlue Next
There are not many details to understand your scenario, I have not used VoiceBlue but on Asterisk if you want to receive calls, from your VoiceBlue or any other provider. You have to do two things, one you have to register this peer to allow receive calls, or you can also set allowguest=yes(but very dangerous anyone can send you calls) or add peers at end of pjsip.conf file as little secure way.
Next, you need to add dialplan, suppose if you get any number _X will be any number, now you can put Dial your extension to receive any number from the provider.
As for sip client to call out you have to register peer and both must be in the same context.
Sending outgoing calls, now if you call any number beginning 6 and 7 they will be forwarded to VoiceBlue
exten=>_6XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
exten=>_7XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
for incoming please add following in your pjsip.conf
[VoiceBlueNext]
type=peer
host=10.0.0.20
username=voiceblue
secret=password
fromdomain=10.0.0.20
and in same file on top put following general section
[general]
port = 5060
bindaddr = 0.0.0.0
allowgues=no
context = sip
disallow=all
allow=ulaw
Notice I allowguest = no , so you must provide peer VoiceBlue peer information to receive calls, but if you want to test, make it yes and you will get calls without any security.

Asterisk ARI initiating a call

I am trying to initiate a call between two local endpoints, a softphone(PJSIP/100) and a harphone(PJSIP/102). Using ARI I have created two channels, with app parameters and put them both into the same mixing bridge in stasisStart event.
At this moment, both of the channels are in the same bridge, but their state is "Down". If I now dial both of them separately from ARI and then press answer on both endpoints, they can share audio, but is it possible to avoid dialing and answering both of them? I have played around the "originator" and "callerid" parameters, which is passed when creating channels, but that does not help.
Is it possible to "dial" one of them from another via ARI?
It’s not 100% clear what you’re trying to do here, but from what I understand...
Dial PJSIP/100 and put it into bridge_1 in statisStart
Dial PJSIP/102 and put it into bridge_1 in stasisStart
You could dial them using stasis originate or an originate via the dialplan.

No ring back tone on outbound calls. [FreePBX]

I have a FreePBX 13 server set up with a SIP Trunk connection, however for some reason we are not getting the ring back tone for calls going out of the trunk connection.
I was able to implement a work around for this by placing the "Tr" options under "Asterisk Trunk Dial Options" to force Asterisk to produce the ring back tone for outbound calls.
However this only works while manually dialing from a soft-phone / VoIP Phone, when I try to launch a call via the Asterisk AMI "Originate" command we are not getting the ring back tone, even when the "r" option is set on the trunk. This is how the command I'm sending looks:
Action: Originate,
Channel: SIP/{extension},
Context: from-internal,
Exten: {phoneNumber},
Priority: 1,
Callerid: {callerId},
Timeout: 30000,
Async: yes
Any idea about what can I do to force the ring back tone?
This could be due to inband progress.
Try to add the following to your sip.conf
under [general] section,
prematuremedia=no
progressinband=yes
if you are using freepbx, then navigate to your trunk settings in the user interface and add the above 2 configs under the peer settings.
restart asterisk and try after that.
Launch Originate via Local/ channel call, if still not work, launch via custom context which answer first.
This is not an uncommon problem. Your ITSP is being lazy and either not providing or not forwarding RFC-complaince SIP 180/183 responses.
My usual solution is to put the local caller into an MOH state where the MOH is a ring tone, and then when the other end picks up, bridge the two calls.
This is kind of jarring, however, if the remote end is busy or is congested, since you go from "fake ring" to "real error tone". The other option is to reverse your dialing process ... call the remote end and then hook the local end, so that the local end doesn't need to hear ringing.
Of course, you can also reach out to your ITSP and tell them you need them to be RFC SIP 180/183 complaint.

Resources