/* create a fake channel and execute the "failed" extension (if it exists) within the requested context */ /* check if "failed" exists */ if (ast_exists_extension(chan, context, "failed", 1, NULL)) { chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "OutgoingSpoolFailed"); if (chan) { if (!ast_strlen_zero(context)) ast_copy_string(chan->context, context, sizeof(chan->context)); set_ext_pri(chan, "failed", 1); ast_set_variables(chan, vars); if (account) ast_cdr_setaccount(chan, account); ast_pbx_run(chan); } }