[Asterisk-code-review] app queue: add RINGNOANSWER event on caller hang up (asterisk[master])

Martin Tomec asteriskteam at digium.com
Thu Dec 22 06:13:54 CST 2016


Martin Tomec has uploaded a new change for review. ( https://gerrit.asterisk.org/4649 )

Change subject: app_queue: add RINGNOANSWER event on caller hang up
......................................................................

app_queue: add RINGNOANSWER 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. "rna" function seems
apropriate for this case, but autopause function shouldnt be used.
Autopause is not intended for short calls canceled by caller.

ASTERISK-26665

Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3
---
M apps/app_queue.c
1 file changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/49/4649/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 9176f93..b163b62 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 digit or * - handle as Ring No Answer (without autopause)*/
+			if (canceled_by_caller) {
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
+				for (o = start; o; o = o->call_next) {
+					if (o->chan) {
+						rna(ast_tvdiff_ms(ast_tvnow(), start_time_tv), qe, o->chan, o->interface, o->member->membername, 0);
+					}
+				}
 				return NULL;
 			}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic70f7b0f32fc95c9378e5bcf63865519014805d3
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Martin Tomec <tomec.martin at gmail.com>



More information about the asterisk-code-review mailing list