mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
pbx: Add helper function to execute applications.
Finding an application and executing it if found is a common task throughout Asterisk. This adds a helper function around pbx_exec to do this, to eliminate redundant code and make it easier for modules to substitute variables and execute applications by name. ASTERISK-30061 #close Change-Id: Ifee4d2825df7545fb515d763d393065675140c84
This commit is contained in:
committed by
Friendly Automation
parent
2d500a090f
commit
6720caa29c
@@ -361,7 +361,6 @@ static int disa_exec(struct ast_channel *chan, const char *data)
|
||||
|
||||
if (k == 3) {
|
||||
int recheck = 0;
|
||||
struct ast_app *app_reset_cdr;
|
||||
|
||||
if (!ast_exists_extension(chan, args.context, exten, 1,
|
||||
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
|
||||
@@ -386,10 +385,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
|
||||
ast_channel_unlock(chan);
|
||||
}
|
||||
|
||||
app_reset_cdr = pbx_findapp("ResetCDR");
|
||||
if (app_reset_cdr) {
|
||||
pbx_exec(chan, app_reset_cdr, special_noanswer ? "" : "e");
|
||||
} else {
|
||||
if (ast_pbx_exec_application(chan, "ResetCDR", special_noanswer ? "" : "e")) {
|
||||
ast_log(AST_LOG_NOTICE, "ResetCDR application not found; CDR will not be reset\n");
|
||||
}
|
||||
ast_explicit_goto(chan, args.context, exten, 1);
|
||||
|
Reference in New Issue
Block a user