mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 03:50:31 +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
Kevin Harwell
parent
28d8647d4d
commit
e23ed9bf06
@@ -1000,7 +1000,6 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, const char *data)
|
||||
{
|
||||
char *s, *appname;
|
||||
struct ast_timing timing;
|
||||
struct ast_app *app;
|
||||
static const char * const usage = "ExecIfTime requires an argument:\n <time range>,<days of week>,<days of month>,<months>[,<timezone>]?<appname>[(<appargs>)]";
|
||||
|
||||
if (ast_strlen_zero(data)) {
|
||||
@@ -1038,13 +1037,7 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, const char *data)
|
||||
ast_log(LOG_WARNING, "Failed to find closing parenthesis\n");
|
||||
}
|
||||
|
||||
|
||||
if ((app = pbx_findapp(appname))) {
|
||||
return pbx_exec(chan, app, S_OR(s, ""));
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Cannot locate application %s\n", appname);
|
||||
return -1;
|
||||
}
|
||||
return ast_pbx_exec_application(chan, appname, S_OR(s, ""));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Reference in New Issue
Block a user