[svn-commits] rmudgett: branch rmudgett/ntptmp r1133 - /team/rmudgett/ntptmp/q931.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Sep 23 16:14:19 CDT 2009


Author: rmudgett
Date: Wed Sep 23 16:14:16 2009
New Revision: 1133

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1133
Log:
Be more discerning about the call states we will accept for disconnect transfer.

Modified:
    team/rmudgett/ntptmp/q931.c

Modified: team/rmudgett/ntptmp/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/ntptmp/q931.c?view=diff&rev=1133&r1=1132&r2=1133
==============================================================================
--- team/rmudgett/ntptmp/q931.c (original)
+++ team/rmudgett/ntptmp/q931.c Wed Sep 23 16:14:16 2009
@@ -5618,13 +5618,14 @@
 			}
 			switch (winner->ourcallstate) {
 			case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
-			case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
 			case Q931_CALL_STATE_CALL_DELIVERED:
 			case Q931_CALL_STATE_CALL_RECEIVED:
+			case Q931_CALL_STATE_CONNECT_REQUEST:
+			case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
 			case Q931_CALL_STATE_ACTIVE:
 				break;
 			default:
-				/* Active call not in the right state. */
+				/* Active call not in a good state to transfer. */
 				continue;
 			}
 			if (q931_party_number_cmp(&winner->remote_id.number,
@@ -5667,6 +5668,18 @@
 			winner = q931_find_winning_call(cur);
 			if (!winner || (BRI_NT_PTMP(ctrl) && winner->pri != active_call->pri)) {
 				/* There is no winner or the held call does not go to the same TEI. */
+				continue;
+			}
+			switch (winner->ourcallstate) {
+			case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
+			case Q931_CALL_STATE_CALL_DELIVERED:
+			case Q931_CALL_STATE_CALL_RECEIVED:
+			case Q931_CALL_STATE_CONNECT_REQUEST:
+			case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
+			case Q931_CALL_STATE_ACTIVE:
+				break;
+			default:
+				/* Held call not in a good state to transfer. */
 				continue;
 			}
 			if (q931_party_number_cmp(&winner->remote_id.number,
@@ -6115,32 +6128,33 @@
 		 * Determine if there are any calls that can be proposed for
 		 * a transfer of held call on disconnect.
 		 */
-		if (c->master_call->hold_state == Q931_HOLD_STATE_CALL_HELD) {
-			/* Held call is being hung up first. */
-			ctrl->ev.hangup.call_held = c->master_call;
-			ctrl->ev.hangup.call_active = q931_find_held_active_call(ctrl, c);
-		} else {
-			/* Active call is being hung up first. */
-			ctrl->ev.hangup.call_held = NULL;
-			ctrl->ev.hangup.call_active = NULL;
-			if (q931_find_winning_call(c) == c) {
-				/*
-				 * Only a normal call or the winning call of a broadcast SETUP
-				 * can participate in a transfer of held call on disconnet.
-				 */
-				switch (c->ourcallstate) {
-				case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
-				case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
-				case Q931_CALL_STATE_CALL_DELIVERED:
-				case Q931_CALL_STATE_CALL_RECEIVED:
-				case Q931_CALL_STATE_ACTIVE:
+		ctrl->ev.hangup.call_held = NULL;
+		ctrl->ev.hangup.call_active = NULL;
+		switch (c->ourcallstate) {
+		case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING:
+		case Q931_CALL_STATE_CALL_DELIVERED:
+		case Q931_CALL_STATE_CALL_RECEIVED:
+		case Q931_CALL_STATE_CONNECT_REQUEST:
+		case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
+		case Q931_CALL_STATE_ACTIVE:
+			if (c->master_call->hold_state == Q931_HOLD_STATE_CALL_HELD) {
+				/* Held call is being disconnected first. */
+				ctrl->ev.hangup.call_held = c->master_call;
+				ctrl->ev.hangup.call_active = q931_find_held_active_call(ctrl, c);
+			} else {
+				/* Active call is being disconnected first. */
+				if (q931_find_winning_call(c) == c) {
+					/*
+					 * Only a normal call or the winning call of a broadcast SETUP
+					 * can participate in a transfer of held call on disconnet.
+					 */
 					ctrl->ev.hangup.call_active = c->master_call;
 					ctrl->ev.hangup.call_held = q931_find_held_call(ctrl, c);
-					break;
-				default:
-					break;
 				}
 			}
+			break;
+		default:
+			break;
 		}
 		if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
 			if (ctrl->ev.hangup.call_held) {




More information about the svn-commits mailing list