[asterisk-commits] mjordan: trunk r375416 - in /trunk: UPGRADE.txt apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 29 16:02:24 CDT 2012


Author: mjordan
Date: Mon Oct 29 16:02:20 2012
New Revision: 375416

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375416
Log:
Ensure that CDRs for a caller in a Queue that is not answered is NO ANSWER.

When a caller enters a queue and no queue member answers the call, the current
behaviour can be a little odd depending on the paused status of the queue
members.  If any queue member is paused, but not all, the CDR disposition
will be BUSY.  If all queue members are paused, then the CDR disposition is
based instead on the disposition of the call prior to entering the Queue.

This patch modifies the behaviour in the following ways:
* If no queue members are paused, the CDR disposition is whatever the
  disposition was prior to going into Queue.  If the call was answered this
  will be ANSWERED; otherwise, it is NO ANSWER.
* If some queue members are pused, the CDR result is NO ANSWER. (This is a
  change in behaviour, as the result would previously have been BUSY)
* If all queue members are paused, the CDR result is whatever the result was
  prior to going into Queue.  This is the same as the behaviour prior to this
  patch.
* If the caller hangs up, times out, or presses '*' with the 'h' option, the
  CDR disposition is again not set and is dependent on whether or not the
  caller was Answered prior to entering Queue.

This patch was based on one provided by Thomas Arimont, but has been modified
to accomodate findings by the reviewers.

Review: https://reviewboard.asterisk.org/r/2064/

(closes issue AST-906)
Reported by: Thomas Arimont

(closes issue ASTERISK-17776)
Reported by: Attila Megyeri


Modified:
    trunk/UPGRADE.txt
    trunk/apps/app_queue.c

Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=375416&r1=375415&r2=375416
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Mon Oct 29 16:02:20 2012
@@ -28,12 +28,16 @@
    a peer once a peer has been found to qualify.  Once the qualify has been
    completed it will now issue a SIPqualifypeerdone event.
 
-Queue:
+Queues:
  - Queue logging for PAUSEALL/UNPAUSEALL now only occurs if the interface this is
    performed on is a member of at least one queue.
  - Queue strategy rrmemory now has a predictable order similar to strategy
    rrordered. Members will be called in the order that they are added to the
    queue.
+ - CDR behavior in app_queue has been modified slightly.  The CDR record will
+   now only record a disposition of BUSY if all Queue members were actually
+   busy on a call or some Queue members were busy or paused.  Previously, any
+   Queue member being paused would result in a disposition of BUSY.
 
 Dial:
  - Now recognizes 'W' to pause sending DTMF for one second in addition to

Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=375416&r1=375415&r2=375416
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Oct 29 16:02:20 2012
@@ -3520,10 +3520,8 @@
 	/* on entry here, we know that tmp->chan == NULL */
 	if (tmp->member->paused) {
 		ast_debug(1, "%s paused, can't receive call\n", tmp->interface);
-		if (ast_channel_cdr(qe->chan)) {
-			ast_cdr_busy(ast_channel_cdr(qe->chan));
-		}
 		tmp->stillgoing = 0;
+		(*busies)++;
 		return 0;
 	}
 
@@ -3531,9 +3529,6 @@
 		(!tmp->lastqueue && qe->parent->wrapuptime && (time(NULL) - tmp->lastcall < qe->parent->wrapuptime))) {
 		ast_debug(1, "Wrapuptime not yet expired on queue %s for %s\n",
 				(tmp->lastqueue ? tmp->lastqueue->name : qe->parent->name), tmp->interface);
-		if (ast_channel_cdr(qe->chan)) {
-			ast_cdr_busy(ast_channel_cdr(qe->chan));
-		}
 		tmp->stillgoing = 0;
 		(*busies)++;
 		return 0;
@@ -3550,19 +3545,14 @@
 		}
 		if ((tmp->member->status != AST_DEVICE_NOT_INUSE) && (tmp->member->status != AST_DEVICE_UNKNOWN)) {
 			ast_debug(1, "%s in use, can't receive call\n", tmp->interface);
-			if (ast_channel_cdr(qe->chan)) {
-				ast_cdr_busy(ast_channel_cdr(qe->chan));
-			}
 			tmp->stillgoing = 0;
+			(*busies)++;
 			return 0;
 		}
 	}
 
 	if (use_weight && compare_weight(qe->parent,tmp->member)) {
 		ast_debug(1, "Priority queue delaying call to %s:%s\n", qe->parent->name, tmp->interface);
-		if (ast_channel_cdr(qe->chan)) {
-			ast_cdr_busy(ast_channel_cdr(qe->chan));
-		}
 		tmp->stillgoing = 0;
 		(*busies)++;
 		return 0;
@@ -4077,7 +4067,7 @@
 		}
 	}
 #endif
-	
+
 	while (*to && !peer) {
 		int numlines, retry, pos = 1;
 		struct ast_channel *watchers[AST_MAX_WATCHERS];
@@ -4115,8 +4105,14 @@
 		if (pos == 1 /* not found */) {
 			if (numlines == (numbusies + numnochan)) {
 				ast_debug(1, "Everyone is busy at this time\n");
+				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
+					ast_cdr_busy(ast_channel_cdr(in));
+				}
 			} else {
 				ast_debug(3, "No one is answering queue '%s' (%d numlines / %d busies / %d failed channels)\n", queue, numlines, numbusies, numnochan);
+				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
+					ast_cdr_failed(ast_channel_cdr(in));
+				}
 			}
 			*to = 0;
 			return NULL;
@@ -4358,7 +4354,7 @@
 						case AST_CONTROL_CONGESTION:
 							ast_verb(3, "%s is circuit-busy\n", ochan_name);
 							if (ast_channel_cdr(in)) {
-								ast_cdr_busy(ast_channel_cdr(in));
+								ast_cdr_failed(ast_channel_cdr(in));
 							}
 							endtime = (long) time(NULL);
 							endtime -= starttime;
@@ -4491,6 +4487,9 @@
 				ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
 				*to = 0;
 				ast_frfree(f);
+				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
+					ast_cdr_noanswer(ast_channel_cdr(in));
+				}
 				return NULL;
 			}
 			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
@@ -4498,6 +4497,9 @@
 				*to = 0;
 				*digit = f->subclass.integer;
 				ast_frfree(f);
+				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
+					ast_cdr_noanswer(ast_channel_cdr(in));
+				}
 				return NULL;
 			}
 
@@ -4540,6 +4542,12 @@
 			for (o = start; o; o = o->call_next) {
 				rna(orig, qe, o->interface, o->member->membername, 1);
 			}
+		}
+
+		if (ast_channel_cdr(in)
+			&& ast_channel_state(in) != AST_STATE_UP
+			&& (!*to || ast_check_hangup(in))) {
+			ast_cdr_noanswer(ast_channel_cdr(in));
 		}
 	}
 




More information about the asterisk-commits mailing list