From 200ed6a405405497ba1e498c52fd27f5b84b43f7 Mon Sep 17 00:00:00 2001
From: Matthew Jordan <mjordan@digium.com>
Date: Wed, 7 Aug 2013 21:38:17 +0000
Subject: [PATCH] Perform Ring-No-Answer checks before processing Hangup logic

The rna() routine will raise a Stasis message involving both the caller and the
agent. This doesn't work so well if we already hung up the agent channel, as
the channel doesn't quite exist. Not surprisingly, this will crash. This patch
properly runs the rna subroutine (performing all of the Ring-No-Answer logic)
prior to hanging up the agent channel.

(closes issue ASTERISK-22258)
Reported by: Kiril Valchev
Tested by: Kiril Valchev



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 737de9df8e..7801584ce3 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4584,10 +4584,10 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
 						case AST_CONTROL_BUSY:
 							ast_verb(3, "%s is busy\n", ochan_name);
 							ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
-							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime * 1000, qe, o->chan, on, membername, qe->parent->autopausebusy);
+							do_hang(o);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
 								if (qe->parent->timeoutrestart) {
 									start_time_tv = ast_tvnow();
-- 
GitLab