[asterisk-commits] app queue: add RINGCANCELED log event on caller hang up (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 25 19:14:13 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4649 )

Change subject: app_queue: add RINGCANCELED log event on caller hang up
......................................................................


app_queue: add RINGCANCELED log event on caller hang up

QueueLog did not log ringnoanswer when the caller abandoned call
before first timeout. It was impossible to get agent membername
and ringing duration for this short calls. After some discusions
it seems that the best way is to add new event RINGCANCELED,
which is generated after caller hangup during ringing.

ASTERISK-26665

Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3
---
M UPGRADE.txt
M apps/app_queue.c
2 files changed, 19 insertions(+), 10 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Matthew Fredrickson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/UPGRADE.txt b/UPGRADE.txt
index 6cb6148..569cc92 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -33,6 +33,10 @@
    their ringinuse value updated to the value of the queue. Previously, the
    ringinuse value for dynamic members was not updated on reload.
 
+Queue log:
+ - New RINGCANCELED event is logged when the caller hangs up while ringing.
+   The data1 field contains number of miliseconds since start of ringing.
+
 Channel Drivers:
 
 chan_dahdi:
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 9176f93..5874a49 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4760,6 +4760,7 @@
 #endif
 	char *inchan_name;
 	struct timeval start_time_tv = ast_tvnow();
+	int canceled_by_caller = 0; /* 1 when caller hangs up or press digit or press * */
 
 	ast_channel_lock(qe->chan);
 	inchan_name = ast_strdupa(ast_channel_name(qe->chan));
@@ -5198,29 +5199,33 @@
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
 				/* Got hung up */
 				*to = -1;
-				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				if (f) {
 					if (f->data.uint32) {
 						ast_channel_hangupcause_set(in, f->data.uint32);
 					}
 					ast_frfree(f);
 				}
-				return NULL;
-			}
-
-			if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
+				canceled_by_caller = 1;
+			} else if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
 				ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
 				*to = 0;
-				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				ast_frfree(f);
-				return NULL;
-			}
-			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
+				canceled_by_caller = 1;
+			} else if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
 				ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
 				*to = 0;
-				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				*digit = f->subclass.integer;
 				ast_frfree(f);
+				canceled_by_caller = 1;
+			}
+			/* When caller hung up or pressed * or digit. */
+			if (canceled_by_caller) {
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
+				for (o = start; o; o = o->call_next) {
+					if (o->chan) {
+						ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), o->member->membername, "RINGCANCELED", "%d", (int) ast_tvdiff_ms(ast_tvnow(), start_time_tv));
+					}
+				}
 				return NULL;
 			}
 

-- 
To view, visit https://gerrit.asterisk.org/4649
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Martin Tomec <tomec.martin at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Martin Tomec <tomec.martin at gmail.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Michael L. Young <elgueromexicano at gmail.com>



More information about the asterisk-commits mailing list