summaryrefslogtreecommitdiff
path: root/pbx.c
diff options
context:
space:
mode:
authorMartin Pycko <martinp@digium.com>2003-09-12 16:51:35 +0000
committerMartin Pycko <martinp@digium.com>2003-09-12 16:51:35 +0000
commit4828759ab85a1b9198a4d8dc7eff3da99d0a86c5 (patch)
tree0cfa74e63cdce0bf09e2e845357eac5addf73e15 /pbx.c
parent3672619e13400601b6d92447a0a89e5643217859 (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: https://origsvn.digium.com/svn/asterisk/trunk@1499 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/pbx.c b/pbx.c
index 5ad920948..8a7dd2fd7 100755
--- a/pbx.c
+++ b/pbx.c
@@ -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));