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:
Naveen Albert
2022-05-15 12:41:06 +00:00
committed by Kevin Harwell
parent d052418b94
commit 4a11ae7ecf
8 changed files with 51 additions and 49 deletions

View File

@@ -263,14 +263,8 @@ static struct ast_channel_tech snoop_tech = {
static void *snoop_stasis_thread(void *obj)
{
RAII_VAR(struct stasis_app_snoop *, snoop, obj, ao2_cleanup);
struct ast_app *stasis = pbx_findapp("Stasis");
if (!stasis) {
ast_hangup(snoop->chan);
return NULL;
}
pbx_exec(snoop->chan, stasis, ast_str_buffer(snoop->app));
ast_pbx_exec_application(snoop->chan, "Stasis", ast_str_buffer(snoop->app));
ast_hangup(snoop->chan);