[libpri-commits] rmudgett: branch rmudgett/t312 r2220 - /team/rmudgett/t312/

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri Feb 25 16:29:46 CST 2011


Author: rmudgett
Date: Fri Feb 25 16:29:41 2011
New Revision: 2220

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2220
Log:
Cannot use retranstimer for the fake clearing anymore.

Modified:
    team/rmudgett/t312/pri_internal.h
    team/rmudgett/t312/q931.c

Modified: team/rmudgett/t312/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/t312/pri_internal.h?view=diff&rev=2220&r1=2219&r2=2220
==============================================================================
--- team/rmudgett/t312/pri_internal.h (original)
+++ team/rmudgett/t312/pri_internal.h Fri Feb 25 16:29:41 2011
@@ -579,6 +579,7 @@
 	int t303_timer;
 	int t303_expirycnt;
 	int t312_timer;
+	int fake_clearing_timer;
 
 	int hangupinitiated;
 	/*! \brief TRUE if we broadcast this call's SETUP message. */

Modified: team/rmudgett/t312/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/t312/q931.c?view=diff&rev=2220&r1=2219&r2=2220
==============================================================================
--- team/rmudgett/t312/q931.c (original)
+++ team/rmudgett/t312/q931.c Fri Feb 25 16:29:41 2011
@@ -4193,9 +4193,14 @@
 
 static void cleanup_and_free_call(struct q931_call *cur)
 {
+	struct pri *ctrl;
+
+	ctrl = cur->pri;
+	pri_schedule_del(ctrl, cur->retranstimer);
+	pri_schedule_del(ctrl, cur->hold_timer);
+	pri_schedule_del(ctrl, cur->fake_clearing_timer);
 	stop_t303(cur);
 	stop_t312(cur);
-	pri_schedule_del(cur->pri, cur->retranstimer);
 	pri_call_apdu_queue_cleanup(cur);
 	if (cur->cc.record) {
 		/* Unlink CC associations. */
@@ -4342,6 +4347,12 @@
 				}
 			}
 
+			if (cur->fake_clearing_timer) {
+				/* Ooops!  Upper layer likely just lost a B channel.  Must fix! */
+				pri_error(ctrl, "BAD! Fake clearing timer was still running.  cref:%d\n",
+					cur->cr);
+			}
+
 			/* Master call or normal call destruction. */
 			if (prev)
 				prev->next = cur->next;
@@ -4354,7 +4365,6 @@
 					q931_call_state_str(cur->ourcallstate),
 					q931_call_state_str(cur->peercallstate),
 					q931_hold_state_str(cur->hold_state));
-			pri_schedule_del(ctrl, cur->hold_timer);
 			cleanup_and_free_call(cur);
 			return;
 		}
@@ -5723,31 +5733,40 @@
 
 static int pri_internal_clear(struct q931_call *c);
 
-/* Fake RELEASE for NT-PTMP initiated SETUPs w/o response */
-static void pri_fake_clearing(void *data)
-{
-	struct q931_call *c = data;/* Call is not a subcall call record. */
+/*!
+ * \brief Fake RELEASE for NT-PTMP initiated SETUPs w/o response
+ *
+ * \param param call Call is not a subcall call record.
+ */
+static void pri_fake_clearing(struct q931_call *call)
+{
 	struct pri *ctrl;
 
-	ctrl = c->pri;
+	ctrl = call->pri;
 	if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
-		pri_message(ctrl, "Fake clearing.  cref:%d\n", c->cr);
-	}
-	/*
-	 * We cannot clear the retranstimer id because we are called by t303_expiry also.
-	 * Fortunately, it doesn't matter because pri_internal_clear() will stop it if
-	 * it was actually running.
-	 */
-	//c->retranstimer = 0;
-	if (pri_internal_clear(c) == Q931_RES_HAVEEVENT) {
+		pri_message(ctrl, "Fake clearing.  cref:%d\n", call->cr);
+	}
+	if (pri_internal_clear(call) == Q931_RES_HAVEEVENT) {
 		ctrl->schedev = 1;
 	}
 }
 
+static void pri_fake_clearing_expiry(void *data)
+{
+	struct q931_call *call = data;/* Call is not a subcall call record. */
+
+	call->fake_clearing_timer = 0;
+	pri_fake_clearing(call);
+}
+
 static void pri_create_fake_clearing(struct pri *ctrl, struct q931_call *master)
 {
-	pri_schedule_del(ctrl, master->retranstimer);
-	master->retranstimer = pri_schedule_event(ctrl, 0, pri_fake_clearing, master);
+	if (ctrl->debug & PRI_DEBUG_Q931_STATE) {
+		pri_message(ctrl, "Requesting fake clearing.  cref:%d\n", master->cr);
+	}
+	pri_schedule_del(ctrl, master->fake_clearing_timer);
+	master->fake_clearing_timer = pri_schedule_event(ctrl, 0, pri_fake_clearing_expiry,
+		master);
 }
 
 static void t303_expiry(void *data)
@@ -7028,6 +7047,7 @@
 	}
 	cur->t303_timer = 0;/* T303 should only be on on the master call */
 	cur->t312_timer = 0;/* T312 should only be on on the master call */
+	cur->fake_clearing_timer = 0;/* Fake clearing should only be on on the master call */
 	cur->hold_timer = 0;
 	cur->retranstimer = 0;
 




More information about the libpri-commits mailing list