Backup action for unavailable stasis app

I have a simple enough dial plan - when a call comes in it is sent out to an ARI stasis app which handles the rest.

The platform has become much busier over time, and now, during updates to the ARI app, there’s a period of some seconds (up to 30 depending on various things) where the ARI app is not available as changes are uploaded and it goes down and reconnects back in. In that time quite a number of calls can get rejected, with a message in the log ‘stasis app not X registered’. It’s not a complete disaster, but it creates a few support calls from those callers when they are not able to get through.

Is there a way to set a number of times to pause and re-try the stasis app? Or another way to just hold on to the incoming call until the app comes back up?

Recent versions will exit and set the STASISSTATUS dialplan variable to “FAILED” for this scenario, from there you can do what you wish in the dialplan. Otherwise there’s no built-in functionality for such things.

So a while loop on the STASISSTATUS var would possibly do it?

You would want to add a Wait() but yes.

ok great, I’ll give that a go. ta

I tried pulling together a simple dialplan to test this, it looks like this:
[sip-inbound-calls-ari]
exten => _[+0-9]!,1,NoOp(Attempting to join ari)
exten => _[+0-9]!,n,Macro(user-callerid,)
exten => [+0-9]!,n,Stasis(stasis-app-non-existant,[+0-9]!)
exten => _[+0-9]!,n,GotoIf($[${STASISSTATUS} = “FAILED”]?here-if-failed,1000,1)
exten => _[+0-9]!,n,GotoIf($[${STASISSTATUS} = “SUCCESS”]?here-if-success,busy,1)
exten => _[+0-9]!,n,Answer

Which in the cli I get (I’ve stripped out the bit before the important couple of lines):

[2016-04-05 21:23:03] ERROR[12110][C-00000006]: res_stasis.c:1242 stasis_app_exec: Stasis app ‘stasis-app-non-existant’ not registered
== Spawn extension (sip-inbound-calls-ari, 999999, 3) exited non-zero on ‘SIP/111.111.111.111-0000002b’

Which appears to me that the it’s giving up and existing when the stasis doesn’t exist, and not falling through to the next line in the dialplan. Have I done something wrong here?

No, there was a bug with this[1] which was fixed in 13.8.0.

[1] https://issues.asterisk.org/jira/browse/ASTERISK-25846

1 Like

I upgraded to 13.8.0, and it’s still doing the same thing. Have I missed something else?

Nope, but I’d suggest creating an issue then with all available information[1].

[1] https://issues.asterisk.org/jira

exten => _[+0-9]!,n,GotoIf($[${STASISSTATUS} = FAILED]?here-if-failed,1000,1)

exten => _[+0-9]!,n,GotoIf($["${STASISSTATUS}" = “FAILED”]?here-if-failed,1000,1)

Try any of these, types are not matching that’s why it fails