Summary:ASTERISK-06703: [patch] app_exec always returns 0 and sets channel-variable RESULT instead
Reporter:Philipp Dunkel (pdunkel)Labels:
Date Opened:2006-04-04 17:59:51Date Closed:2006-04-04 22:54:14
Versions:Frequency of
Environment:Attachments:( 0) app_exec.patch
( 1) app_tryexec.c
Description:The purpose of this patch is to have an Application that can be used sort of like a try{}catch{} block.
There are apps that regularly fail without any really problematic situation having occurred. If these apps return non 0, the execution of the dialplan extension ist stopped and the channel is hung up.
This may be great for a majority of cases, but there are those that would rather be able to deal with the failing of an application in the dialplan.
For this purpose I modified app_exec to always return 0 and set the channel-variable RESULT to NOAPP, NOMEMORY, FAILED or SUCCESS depending on the result of the executed app. The next priority can then evaluate ${RESULT} and deal with it.
I have this as a seperate app and maybe it would be better to keep this seperate, but since 99.999% of the code is identical, I'd feel silly to open a new file in the trunk and claim authorship.
Comments:By: Tilghman Lesher (tilghman) 2006-04-04 20:07:57

First, we'd need a disclaimer on file for us to even look at this patch.  Second, a result variable should be named according to the app it belongs to, so the recommended result variable name should be something like EXECSTATUS.

Given that Exec has a well-defined (and not unreasonable behavior), I'd suggest creating a patch for this source file, but create a wholly separate command, such as TryExec, and then have a TRYSTATUS result variable.

You might even try writing this as a function, then returning the status as the value of the function.

By: Philipp Dunkel (pdunkel) 2006-04-04 21:06:29

The disclaimer has been sent to digium by fax at the same time as the patch was posted. In addition I scanned the file and mailed it to office@digium.com

As I had written, I had written this as a seperate app and agree with you 100% that its probably better off that way. I uploaded the file and made the changes requested.

App is now named TryExec, and sets the channel-variable TRYSTATUS.

By: Tilghman Lesher (tilghman) 2006-04-04 22:54:14

Committed to trunk.  Thank you.