[asterisk-commits] mattf: trunk r47801 - /trunk/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 17 11:26:34 MST 2006


Author: mattf
Date: Fri Nov 17 12:26:33 2006
New Revision: 47801

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47801
Log:
Add some sense of link state.  Don't make calls if link is down.  Only reset if we're bringing the 
link up for the first time.

Modified:
    trunk/channels/chan_zap.c

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=47801&r1=47800&r2=47801
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Fri Nov 17 12:26:33 2006
@@ -426,6 +426,10 @@
 	int linkstate[NUM_DCHANS];
 	int numchans;
 	int type;
+	enum {
+		LINKSET_STATE_DOWN = 0,
+		LINKSET_STATE_UP
+	} state;
 	struct ss7 *ss7;
 	struct zt_pvt *pvts[MAX_CHANNELS];				/*!< Member channel pvt structs */
 };
@@ -8536,10 +8540,18 @@
 			switch (e->e) {
 			case SS7_EVENT_UP:
 				ast_verbose("--- SS7 Up ---\n");
-				ss7_reset_linkset(linkset);
+				if (linkset->state != LINKSET_STATE_UP)
+					ss7_reset_linkset(linkset);
+				linkset->state = LINKSET_STATE_UP;
 				break;
 			case SS7_EVENT_DOWN:
 				ast_verbose("--- SS7 Down ---\n");
+				linkset->state = LINKSET_STATE_DOWN;
+				for (i = 0; i < linkset->numchans; i++) {
+					struct zt_pvt *p = linkset->pvts[i];
+					if (p)
+						p->inalarm = 1;
+				}
 				break;
 			case MTP2_LINK_UP:
 				ast_log(LOG_DEBUG, "MTP2 link up\n");



More information about the asterisk-commits mailing list