diff options
author | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-12 16:51:35 +0000 |
---|---|---|
committer | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-12 16:51:35 +0000 |
commit | da1033cad245fbad3570aab1b49ddba9eb010d6e (patch) | |
tree | 0cfa74e63cdce0bf09e2e845357eac5addf73e15 /pbx.c | |
parent | 72f06d4e1646591ef482d0bbf8dddfbcaac51c63 (diff) |
Add distinguishing between BUSY and FAILURE for outgoing spool calls. Always save CDR record (even if the call fails). If the call fails try to see if there is
"failed" extension in the specified context (only if you use context,extension,priority syntax) and execute it.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1499 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -3779,7 +3779,7 @@ static void *async_wait(void *data) return NULL; } -int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable ) +int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char *context, char *exten, int priority, int *reason, int sync, char *callerid, char *variable) { struct ast_channel *chan; struct async_stat *as; @@ -3828,6 +3828,27 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", chan->name); ast_hangup(chan); } + } else { + /* 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); + if (chan) { + strncpy(chan->name, "OutgoingSpoolFailed", sizeof(chan->name) - 1); + if (context && strlen(context)) + strncpy(chan->context, context, sizeof(chan->context) - 1); + strncpy(chan->exten, "failed", sizeof(chan->exten) - 1); + chan->priority = 1; + /* JDG chanvar */ + tmp = variable; + /* FIXME replace this call with strsep NOT*/ + while( (var = strtok_r(NULL, "|", &tmp)) ) { + pbx_builtin_setvar( chan, var ); + } /* /JDG */ + ast_pbx_run(chan); + } else + ast_log(LOG_WARNING, "Can't allocate the channel structure, skipping execution of extension 'failed'\n"); + } } } else { as = malloc(sizeof(struct async_stat)); |