mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 22:30:28 +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
10
main/dial.c
10
main/dial.c
@@ -166,14 +166,12 @@ static int predial_disable(void *data)
|
||||
static void answer_exec_run(struct ast_dial *dial, struct ast_dial_channel *dial_channel, char *app, char *args)
|
||||
{
|
||||
struct ast_channel *chan = dial_channel->owner;
|
||||
struct ast_app *ast_app = pbx_findapp(app);
|
||||
|
||||
/* If the application was not found, return immediately */
|
||||
if (!ast_app)
|
||||
/* Execute the application, if available */
|
||||
if (ast_pbx_exec_application(chan, app, args)) {
|
||||
/* If the application was not found, return immediately */
|
||||
return;
|
||||
|
||||
/* All is well... execute the application */
|
||||
pbx_exec(chan, ast_app, args);
|
||||
}
|
||||
|
||||
/* If another thread is not taking over hang up the channel */
|
||||
ast_mutex_lock(&dial->lock);
|
||||
|
||||
Reference in New Issue
Block a user