diff options
author | Joshua Colp <jcolp@digium.com> | 2016-08-12 10:50:34 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-08-12 10:50:34 -0500 |
commit | 00584fae4b5da325bbbcdaabc6488535f0872c5b (patch) | |
tree | 59a8235bf05f6057ecf5105ead392556616bac13 | |
parent | 9e06073e830e1029300431eb0b913de18a4ff736 (diff) | |
parent | 225fd1003fa3016e4a8030cbcaa5b5d0d99a7f45 (diff) |
Merge "app_queue: Prevent crash when a call is forwarded to an invalid location"
-rw-r--r-- | apps/app_queue.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 39413f9a6..a5cb12640 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4865,6 +4865,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte char tmpchan[256]; char *stuff; char *tech; + int failed = 0; ast_copy_string(tmpchan, ast_channel_call_forward(o->chan), sizeof(tmpchan)); ast_copy_string(forwarder, ast_channel_name(o->chan), sizeof(forwarder)); @@ -4977,14 +4978,20 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte if (ast_call(o->chan, stuff, 0)) { ast_log(LOG_NOTICE, "Forwarding failed to dial '%s/%s'\n", tech, stuff); - do_hang(o); - numnochan++; + failed = 1; } } - ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL); ast_channel_publish_dial_forward(qe->chan, original, o->chan, NULL, "CANCEL", ast_channel_call_forward(original)); + if (o->chan) { + ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL); + } + + if (failed) { + do_hang(o); + numnochan++; + } /* Hangup the original channel now, in case we needed it */ ast_hangup(winner); |