[Home]

Summary:ASTERISK-25846: Gracefully deal with Absent Stasis Apps
Reporter:Andrew Nagy (tm1000)Labels:
Date Opened:2016-03-15 12:52:13Date Closed:2016-03-16 14:16:54
Priority:MinorRegression?
Status:Closed/CompleteComponents:
Versions:13.7.2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I was just reviewing
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Stasis. I noticed there is a handy variable named {code}${STASISSTATUS}{code} returned when Stasis is finished (OR fails). However if I never register my stasis application and dial into the context where stasis is at once Asterisk hits stasis and realizes it can't talk to said app Asterisk just hangs up on the channel. I was hoping to be returned to the dialplan to be able to run a failover destination.

Quick Dialplan:
{code}
[ari-trunk]
exten => 45,1,Noop(Attempting to join test ari)
exten => 45,n,Macro(user-callerid,)
exten => 45,n,Stasis(test,45)
exten => 45,n,GotoIf($[${STASISSTATUS} = "FAILED"]?from-did-direct,1000,1)
exten => 45,n,GotoIf($[${STASISSTATUS} = "SUCCESS"]?app-blackhole,busy,1)
exten => 45,n,Answer
exten => 45,hint,Stasis:45
{code}

CLI:
{code}
   -- Executing [45@from-internal:3] Stasis("PJSIP/1003-00000001",test,45") in new stack
 == Spawn extension (from-internal, 45, 3) exited non-zero on "PJSIP/1003-00000001"
   -- Executing [h@from-internal:1] Macro("PJSIP/1003-00000001","hangupcall") in new stack
{code}

I propose to more gracefully handle this and just return to the dialplan so the creator can do something appropriate instead of just having Asterisk hang up the channel
Comments:By: Asterisk Team (asteriskteam) 2016-03-15 12:52:14.081-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Andrew Nagy (tm1000) 2016-03-15 13:06:42.518-0500

Looks like app_stasis.c returns -1 if the app fails. Sets STASISSTATUS to failed and returns to pbx_core. HOWEVER, when pbx_core gets a return code of "-1" it then hangsup the channel. Therefore the variable ends up being useless in a failed state. You'd never be able to catch it. Proposing a patch in a second here that will return 0 instead of -1 for app_stasis so we can actually use the return value.

By: Andrew Nagy (tm1000) 2016-03-15 13:36:35.256-0500

Proposed patch: https://gerrit.asterisk.org/2402