[svn-commits] mattf: trunk r365 - /trunk/q931.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Jul 21 08:43:32 MST 2006


Author: mattf
Date: Fri Jul 21 10:43:31 2006
New Revision: 365

URL: http://svn.digium.com/view/libpri?rev=365&view=rev
Log:
Improve call state handling code.  (#7269)

Modified:
    trunk/q931.c

Modified: trunk/q931.c
URL: http://svn.digium.com/view/libpri/trunk/q931.c?rev=365&r1=364&r2=365&view=diff
==============================================================================
--- trunk/q931.c (original)
+++ trunk/q931.c Fri Jul 21 10:43:31 2006
@@ -2693,18 +2693,17 @@
 		c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
 	} else
 		c->progressmask = 0;
-	if (pri->localtype == PRI_CPE) {
+	if(pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG)
+		UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE);
+	else
 		UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CONNECT_REQUEST);
-	} else {
-		UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE);
-	}
 	c->peercallstate = Q931_CALL_STATE_ACTIVE;
 	c->alive = 1;
-	/* Setup timer */
+	/* Connect request timer */
 	if (c->retranstimer)
 		pri_schedule_del(pri, c->retranstimer);
 	c->retranstimer = 0;
-	if ((pri->localtype == PRI_CPE) && (!pri->subchannel))
+	if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (!pri->subchannel))
 		c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c);
 	return send_message(pri, c, Q931_CONNECT, connect_ies);
 }
@@ -3422,7 +3421,9 @@
 			q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
 			break;
 		}
-		if (c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) {
+		if (!(c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) &&
+		    !(c->ourcallstate == Q931_CALL_STATE_ACTIVE &&
+		      (pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG))) {
 			q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
 			break;
 		}



More information about the svn-commits mailing list