[asterisk-commits] branch mattf/asterisk-ss7 r37831 - /team/mattf/asterisk-ss7/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jul 17 16:32:38 MST 2006


Author: mattf
Date: Mon Jul 17 18:32:37 2006
New Revision: 37831

URL: http://svn.digium.com/view/asterisk?rev=37831&view=rev
Log:
Make sure we reset the circuits on the linkset when we bring it up

Modified:
    team/mattf/asterisk-ss7/channels/chan_zap.c

Modified: team/mattf/asterisk-ss7/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-ss7/channels/chan_zap.c?rev=37831&r1=37830&r2=37831&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/channels/chan_zap.c (original)
+++ team/mattf/asterisk-ss7/channels/chan_zap.c Mon Jul 17 18:32:37 2006
@@ -7873,6 +7873,29 @@
 	return winner;
 }
 
+static int ss7_reset_linkset(struct zt_ss7 *linkset)
+{
+	int i, startcic = -1, endcic;
+
+	if (linkset->numchans <= 0)
+		return 0;
+
+	startcic = linkset->pvts[0]->cic;
+
+	for (i = 0; i < linkset->numchans; i++) {
+		if (linkset->pvts[i+1] && (linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) {
+			continue;
+		} else {
+			endcic = linkset->pvts[i]->cic;
+			ast_verbose(VERBOSE_PREFIX_3 "Resetting CICs %d to %d\n", startcic, endcic);
+			isup_grs(linkset->ss7, startcic, endcic);
+
+			if (linkset->pvts[i+1])
+				startcic = linkset->pvts[i+1]->cic;
+		}
+	}
+}
+
 static void *ss7_linkset(void *data)
 {
 	int res, i;
@@ -7965,6 +7988,7 @@
 			switch (e->e) {
 			case SS7_EVENT_UP:
 				ast_log(LOG_DEBUG, "--- SS7 Up ---\n");
+				ss7_reset_linkset(linkset);
 				break;
 			case MTP2_LINK_UP:
 				ast_log(LOG_DEBUG, "MTP2 link up\n");
@@ -7972,7 +7996,6 @@
 			case SS7_EVENT_GRS:
 				ast_log(LOG_DEBUG, "Got GRS from cic %d to %d: Acknowledging\n", e->grs.startcic, e->grs.endcic);
 				isup_gra(ss7, e->grs.startcic, e->grs.endcic);
-				isup_grs(ss7, e->grs.startcic, e->grs.endcic);
 				break;
 			case SS7_EVENT_GRA:
 				ast_log(LOG_DEBUG, "Got GRA from cic %d to %d.\n", e->gra.startcic, e->gra.endcic);



More information about the asterisk-commits mailing list