[svn-commits] mattf: trunk r129 - in /trunk: isup.c isup.h libss7.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Oct 26 19:36:39 CDT 2007


Author: mattf
Date: Fri Oct 26 19:36:39 2007
New Revision: 129

URL: http://svn.digium.com/view/libss7?view=rev&rev=129
Log:
Add circuit group query support

Modified:
    trunk/isup.c
    trunk/isup.h
    trunk/libss7.h

Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?view=diff&rev=129&r1=128&r2=129
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Fri Oct 26 19:36:39 2007
@@ -64,6 +64,8 @@
 static int cpg_params[] = { ISUP_PARM_EVENT_INFO, -1};
 
 static int cicgroup_params[] = { ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND, ISUP_PARM_RANGE_AND_STATUS, -1};
+
+static int cqr_params[] = { ISUP_PARM_RANGE_AND_STATUS, ISUP_PARM_CIRCUIT_STATE_IND, -1};
 
 static int empty_params[] = { -1};
 
@@ -96,6 +98,8 @@
 	{ISUP_RSC, 0, 0, 0, empty_params},
 	{ISUP_CPG, 1, 0, 1, cpg_params},
 	{ISUP_UCIC, 0, 0, 0, empty_params},
+	{ISUP_CQM, 0, 1, 0, greset_params},
+	{ISUP_CQR, 0, 2, 0, cqr_params},
 };
 
 static int isup_send_message(struct ss7 *ss7, struct isup_call *c, int messagetype, int parms[]);
@@ -710,6 +714,10 @@
 	c->range = parm[0];
 	numcics = c->range + 1;
 
+	/* No status for these messages */
+	if ((messagetype == ISUP_CQR) || (messagetype == ISUP_CQM) || (messagetype == ISUP_GRS))
+		return len;
+
 	for (i = 0; i < numcics; i++) {
 		if (parm[1 + (i/8)] & (1 << (i%8)))
 			c->status[i] = 1;
@@ -727,7 +735,8 @@
 
 	parm[0] = c->range & 0xff;
 
-	if (messagetype == ISUP_GRS)
+	/* No status for these messages */
+	if ((messagetype == ISUP_CQR) || (messagetype == ISUP_CQM) || (messagetype == ISUP_GRS))
 		return 1;
 
 	statuslen = (numcics / 8) + !!(numcics % 8);
@@ -1431,6 +1440,94 @@
 {
 	ss7_message(ss7, "\t\t\tDelay: %dms\n", (unsigned short)(((parm[0] & 0xff) << 8) | (parm[0] & 0xff)));
 	return len;
+}
+
+static FUNC_DUMP(circuit_state_ind_dump)
+{
+	unsigned char dcbits, babits, febits;
+	char *ba_str, *dc_str, *fe_str;
+	int i;
+	
+	for (i = 0; i < len; i++) {
+		babits = parm[i] & 0x3;
+		dcbits = (parm[i] >> 2) & 0x3;
+		febits = (parm[i] >> 4) & 0x3;
+
+		if (dcbits == 0) {
+			switch (babits) {
+				case 0:
+					ba_str = "transient";
+					break;
+				case 1:
+				case 2:
+					ba_str = "spare";
+					break;
+				case 3:
+					ba_str = "unequipped";
+					break;
+			}
+		} else {
+			switch (babits) {
+				case 0:
+					ba_str = "no blocking (active)";
+					break;
+				case 1:
+					ba_str = "locally blocked";
+					break;
+				case 2:
+					ba_str = "remotely blocked";
+					break;
+				case 3:
+					ba_str = "locally and remotely blocked";
+					break;
+			}
+
+			switch (dcbits) {
+				case 1:
+					dc_str = "circuit incoming busy";
+					break;
+				case 2:
+					dc_str = "circuit outgoing busy";
+					break;
+				case 3:
+					dc_str = "idle";
+					break;
+			}
+
+			switch (febits) {
+				case 0:
+					fe_str = "no blocking (active)";
+					break;
+				case 1:
+					fe_str = "locally blocked";
+					break;
+				case 2:
+					fe_str = "remotely blocked";
+					break;
+				case 3:
+					fe_str = "locally and remotely blocked";
+					break;
+			}
+
+		}
+
+		ss7_message(ss7, "\t\t\tMaintenance blocking state: %s (%d)\n", ba_str, babits);
+		if (!dcbits)
+			continue;
+		ss7_message(ss7, "\t\t\tCall processing state: %s (%d)\n", dc_str, dcbits);
+		ss7_message(ss7, "\t\t\tHardware blocking state: %s (%d)\n", fe_str, febits);
+	}
+	return len;
+}
+
+static FUNC_SEND(circuit_state_ind_transmit)
+{
+	int numcics = c->range + 1, i;
+
+	for (i = 0; i < numcics; i++)
+		parm[i] = c->status[i];
+
+	return numcics;
 }
 
 static struct parm_func parms[] = {
@@ -1472,6 +1569,7 @@
 	{ISUP_PARM_JIP, "Jurisdiction Information Parameter", jip_dump, jip_receive, NULL},
 	{ISUP_PARM_ECHO_CONTROL_INFO, "Echo Control Information", echo_control_info_dump, NULL, NULL},
 	{ISUP_PARM_PARAMETER_COMPAT_INFO, "Parameter Compatibility Information", parameter_compat_info_dump, NULL, NULL},
+	{ISUP_PARM_CIRCUIT_STATE_IND, "Circuit State Indicator", circuit_state_ind_dump, NULL, circuit_state_ind_transmit},
 };
 
 static char * param2str(int parm)
@@ -2128,6 +2226,12 @@
 			e->iam.charge_num_plan = c->charge_num_plan;
 			e->iam.oli_ani2 = c->oli_ani2;
 			e->iam.call = c;
+			return 0;
+		case ISUP_CQM:
+			e->e = ISUP_EVENT_CQM;
+			e->cqm.startcic = cic;
+			e->cqm.endcic = cic + c->range;
+			isup_free_call(ss7, c); /* Won't need this again */
 			return 0;
 		case ISUP_GRS:
 			e->e = ISUP_EVENT_GRS;
@@ -2268,6 +2372,24 @@
 	return isup_send_message(ss7, &call, messagetype, cicgroup_params);
 }
 
+int isup_cqr(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char status[])
+{
+	struct isup_call call;
+	int i;
+
+	for (i = 0; (i + begincic) <= endcic; i++)
+		call.status[i] = status[i];
+
+	call.cic = begincic;
+	call.range = endcic - begincic;
+	call.dpc = dpc;
+
+	if (call.range > 31)
+		return -1;
+
+	return isup_send_message(ss7, &call, ISUP_CQR, cqr_params);
+}
+
 int isup_grs(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc)
 {
 	struct isup_call call;
@@ -2467,4 +2589,5 @@
 
 	return isup_send_message_ciconly(ss7, ISUP_UBA, cic, dpc);
 }
+
 /* Janelle is the bomb (Again) */

Modified: trunk/isup.h
URL: http://svn.digium.com/view/libss7/trunk/isup.h?view=diff&rev=129&r1=128&r2=129
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Fri Oct 26 19:36:39 2007
@@ -108,6 +108,7 @@
 #define ISUP_PARM_JIP 0xc4
 #define ISUP_PARM_ECHO_CONTROL_INFO 0x37
 #define ISUP_PARM_PARAMETER_COMPAT_INFO 0x39
+#define ISUP_PARM_CIRCUIT_STATE_IND 0x26
 
 
 

Modified: trunk/libss7.h
URL: http://svn.digium.com/view/libss7/trunk/libss7.h?view=diff&rev=129&r1=128&r2=129
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Fri Oct 26 19:36:39 2007
@@ -42,6 +42,7 @@
 #define ISUP_EVENT_CPG		22
 #define ISUP_EVENT_UCIC		23
 #define ISUP_EVENT_LPA 		24
+#define ISUP_EVENT_CQM 		25
 
 /* Different SS7 types */
 #define SS7_ITU		(1 << 0)
@@ -179,6 +180,7 @@
 	ss7_event_generic gen;
 	ss7_event_iam iam;
 	ss7_event_cicrange grs;
+	ss7_event_cicrange cqm;
 	ss7_event_cicrange gra;
 	ss7_event_cicrange cgb;
 	ss7_event_cicrange cgu;
@@ -286,6 +288,9 @@
 
 int isup_rsc(struct ss7 *ss7, int cic, unsigned int dpc);
 
+int isup_cqr(struct ss7 *ss7, int begincic, int endcic, unsigned int dpc, unsigned char status[]);
+
+/* Various call related sets */
 void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc);
 
 void isup_set_call_dpc(struct isup_call *c, unsigned int dpc);
@@ -297,5 +302,6 @@
 void isup_set_charge(struct isup_call *c, const char *charge, unsigned char charge_nai, unsigned char charge_num_plan);
 
 void isup_set_oli(struct isup_call *c, int oli_ani2);
+/* End of call related sets */
 
 #endif /* _LIBSS7_H */




More information about the svn-commits mailing list