1

I need to create a channel using ARI and put it into stasis before dialling the extension, which according to the documentation is what should be happening. But as soon as I create the channel it starts ringing and goes into stasis only after being answered.

I have a testing extension configured in sip.conf which I've registered with a softphone, this is the extension I'm creating a channel to.

[101]
 type = friend
 username = 101
 secret = 1234
 context = from-internal
 host = dynamic
Nicolas
  • 1,256
  • 1
  • 10
  • 22

1 Answers1

0

Asterisk have two "legs", incoming and outgoing.

Ringing is first one.

So you have put it in stasis before ringing, after that put in stasis second leg on answer.

You can do it using dial via dial - Local channel.

For that need use dialstring like Local/number@stasis_out and in dialplan write like this

[stasis_out]
exten => _.,1,Stasis(out-app)

exten => h,1,Hangup()

Now you get it in stasis and can do additional Dial for call out.

Please note, stasis app have alot of perfomance issues, if you application expected be hi-load, better use dialplan.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • After changing the dialstring like suggested, the stasis websocket can't connect for some reason now. Also I noticed the `extension@context` format only works for Local, not SIP. Will this work for outside calls as well? The local extension is really just for testing purposes, in the end I need this to be able to make calls to the outside. – Nicolas Oct 04 '19 at 12:34
  • Yes, you should use Local, not SIP. WHY you think sip should use dialplan? This site is for questions, not for manuals. Check some book about asterisk. – arheops Oct 04 '19 at 13:58
  • 2
    I'm asking it here because asterisk documentation is absolute and utter crap. – Nicolas Oct 04 '19 at 14:05
  • This setup works if I put a Dial() into the context before the Stasis(), but then it defeats the purpose. If it's just the Stasis(), the applications doesn't register. – Nicolas Oct 04 '19 at 14:59
  • No, it should go stasis, you should get notification about that and all should freeze. After that in stasis control app do exec dial. – arheops Oct 04 '19 at 18:30
  • Yeah I know it "should" but it doesn't. The websocket never receives the "connect" event. It only works if there is a Dial first. – Nicolas Oct 04 '19 at 20:27
  • Sure. You should get "StasisStart" event. After that you need do dial. Connect event can be received only after dial answered. Maybe you should read something like this https://blogs.asterisk.org/2016/08/24/asterisk-14-ari-create-bridge-dial/ – arheops Oct 04 '19 at 21:42
  • I'm not getting any events, it says stasis application is not registered. – Nicolas Oct 04 '19 at 22:00
  • Likly that mean you not builded it with asterisk or not installed. – arheops Oct 04 '19 at 23:55
  • I have no idea what you mean by that. – Nicolas Oct 07 '19 at 08:57