[svn-commits] mattf: branch 1.0 r281 - in /branches/1.0: isup.c isup.h libss7.h mtp3.c ss7.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 22 15:13:08 CST 2010


Author: mattf
Date: Mon Feb 22 15:13:04 2010
New Revision: 281

URL: http://svnview.digium.com/svn/libss7?view=rev&rev=281
Log:
Add support for ISUP Suspend and Resume messages.  Also, fix problem with ANSI SLC being located in a previously unexpected location (multi link ANSI nodes should work better).

Modified:
    branches/1.0/isup.c
    branches/1.0/isup.h
    branches/1.0/libss7.h
    branches/1.0/mtp3.c
    branches/1.0/ss7.c

Modified: branches/1.0/isup.c
URL: http://svnview.digium.com/svn/libss7/branches/1.0/isup.c?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- branches/1.0/isup.c (original)
+++ branches/1.0/isup.c Mon Feb 22 15:13:04 2010
@@ -88,6 +88,8 @@
 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 sus_res_params[] = { ISUP_PARM_SUSPEND_RESUME_IND, -1};
 
 static int empty_params[] = { -1};
 
@@ -126,7 +128,9 @@
 	{ISUP_CQR, 0, 2, 0, cqr_params},
 	{ISUP_FAA, 1, 0, 1, faa_params},
 	{ISUP_FAR, 1, 0, 1, far_params},
-	{ISUP_CFN, 0, 1, 0, rel_params}
+	{ISUP_CFN, 0, 1, 0, rel_params},
+	{ISUP_SUS, 1, 0, 1, sus_res_params},
+	{ISUP_RES, 1, 0, 1, sus_res_params}
 };
 
 static int isup_send_message(struct ss7 *ss7, struct isup_call *c, int messagetype, int parms[]);
@@ -188,6 +192,10 @@
 			return "CVR";
 		case ISUP_CFN:
 			return "CFN";
+		case ISUP_SUS:
+			return "SUS";
+		case ISUP_RES:
+			return "RES";
 		default:
 			return "Unknown";
 	}
@@ -1972,6 +1980,18 @@
 	return len;	
 }	
 
+static FUNC_DUMP(suspend_resume_ind_dump)
+{
+	int indicator = parm[0] & 1;
+	ss7_message(ss7, "\t\t\t%s (%d)", indicator ? "Network initiated" : "ISDN Subscriber initiated", indicator);
+	return 1;	
+}	
+
+static FUNC_RECV(suspend_resume_ind_receive)
+{
+	c->network_isdn_indicator = parm[0] & 1;
+	return 1;	
+}	
 
 static struct parm_func parms[] = {
 	{ISUP_PARM_NATURE_OF_CONNECTION_IND, "Nature of Connection Indicator", nature_of_connection_ind_dump, nature_of_connection_ind_receive, nature_of_connection_ind_transmit },
@@ -2018,6 +2038,7 @@
 	{ISUP_PARM_FACILITY_IND, "Facility Indicator", facility_ind_dump, facility_ind_receive, facility_ind_transmit},
 	{ISUP_PARM_REDIRECTING_NUMBER, "Redirecting Number", redirecting_number_dump, redirecting_number_receive, redirecting_number_transmit},
 	{ISUP_PARM_ACCESS_DELIVERY_INFO, "Access Delivery Information", },
+	{ISUP_PARM_SUSPEND_RESUME_IND, "Suspend/Resume Indicators", suspend_resume_ind_dump, suspend_resume_ind_receive},
 };
 
 static char * param2str(int parm)
@@ -3065,6 +3086,32 @@
 			e->ucic.opc = opc; /* keep OPC information */
 			e->far.call = c;
 			return 0;
+		case ISUP_RES:
+			e = ss7_next_empty_event(ss7);
+			if (!e) {
+				isup_free_call(ss7, c);
+				return -1;
+			}
+
+			e->e = ISUP_EVENT_RES;
+			e->res.cic = c->cic;
+			e->res.opc = opc; /* keep OPC information */
+			e->res.call = c;
+			e->res.network_isdn_indicator = c->network_isdn_indicator;
+			return 0;
+		case ISUP_SUS:
+			e = ss7_next_empty_event(ss7);
+			if (!e) {
+				isup_free_call(ss7, c);
+				return -1;
+			}
+
+			e->e = ISUP_EVENT_SUS;
+			e->sus.cic = c->cic;
+			e->sus.opc = opc; /* keep OPC information */
+			e->sus.call = c;
+			e->sus.network_isdn_indicator = c->network_isdn_indicator;
+			return 0;
 		default:
 			isup_free_call(ss7, c);
 			return 0;

Modified: branches/1.0/isup.h
URL: http://svnview.digium.com/svn/libss7/branches/1.0/isup.h?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- branches/1.0/isup.h (original)
+++ branches/1.0/isup.h Mon Feb 22 15:13:04 2010
@@ -89,6 +89,7 @@
 #define ISUP_EXM	0xed
 
 /* ISUP Parameters */
+#define ISUP_PARM_SUSPEND_RESUME_IND 0x22
 #define ISUP_PARM_NATURE_OF_CONNECTION_IND 0x06
 #define ISUP_PARM_FORWARD_CALL_IND 0x07
 #define ISUP_PARM_CALLING_PARTY_CAT 0x09
@@ -212,6 +213,8 @@
 	unsigned int dpc;
 	/* Backward Call Indicator variables */
 	unsigned char called_party_status_ind;
+	/* Suspend/Resume Indicator */
+	int network_isdn_indicator;
 };
 
 int isup_receive(struct ss7 *ss7, struct mtp2 *sl, struct routing_label *rl, unsigned char *sif, int len);

Modified: branches/1.0/libss7.h
URL: http://svnview.digium.com/svn/libss7/branches/1.0/libss7.h?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- branches/1.0/libss7.h (original)
+++ branches/1.0/libss7.h Mon Feb 22 15:13:04 2010
@@ -65,6 +65,8 @@
 #define ISUP_EVENT_FAA		27
 #define ISUP_EVENT_CVT		28
 #define ISUP_EVENT_CVR		29
+#define ISUP_EVENT_SUS		30
+#define ISUP_EVENT_RES		31
 
 /* Different SS7 types */
 #define SS7_ITU		(1 << 0)
@@ -263,6 +265,14 @@
 	struct isup_call *call;
 } ss7_event_far;
 
+typedef struct {
+	int e;
+	int cic;
+	int network_isdn_indicator;
+	unsigned int opc;
+	struct isup_call *call;
+} ss7_event_sus_res;
+
 
 typedef union {
 	int e;
@@ -292,6 +302,8 @@
 	ss7_event_ciconly ucic;
 	ss7_event_rsc rsc;
 	ss7_event_cpg cpg;
+	ss7_event_sus_res sus;
+	ss7_event_sus_res res;
 	ss7_event_ciconly lpa;
 } ss7_event;
 
@@ -309,6 +321,8 @@
 int ss7_add_link(struct ss7 *ss7, int transport, int fd);
 
 int ss7_set_adjpc(struct ss7 *ss7, int fd, unsigned int pc);
+
+int ss7_set_slc(struct ss7 *ss7, int fd, unsigned int slc);
 
 int ss7_set_network_ind(struct ss7 *ss7, int ni);
 

Modified: branches/1.0/mtp3.c
URL: http://svnview.digium.com/svn/libss7/branches/1.0/mtp3.c?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- branches/1.0/mtp3.c (original)
+++ branches/1.0/mtp3.c Mon Feb 22 15:13:04 2010
@@ -171,6 +171,21 @@
 static inline unsigned char  get_h1(unsigned char *byte)
 {
 	return (((*byte) & 0xf0) >> 4);
+}
+
+static inline struct mtp2 * slc_to_link(struct ss7 *ss7, unsigned char sls)
+{
+	struct mtp2 *winner = ss7->links[0];
+	int i;
+
+	for (i = 0; i < ss7->numlinks; i++) {
+		if (ss7->links[i]->slc == sls) {
+			winner = ss7->links[i];
+			break;
+		}
+	}
+
+	return winner;
 }
 
 static inline struct mtp2 * sls_to_link(struct ss7 *ss7, unsigned char sls)
@@ -293,7 +308,7 @@
 
 	set_h0(layer4, 1);
 	set_h1(layer4, 1);
-	layer4[1] = (testlen << 4);
+	layer4[1] = (testlen << 4) | (link->slc & 0xf);
 	memcpy(&layer4[2], testmessage, testlen);
 
 	ss7_msg_userpart_len(m, rllen + testlen + 2);
@@ -422,7 +437,7 @@
 		/* Success! */
 		set_h0(layer4, 1);
 		set_h1(layer4, 2);
-		layer4[1] = (testpatsize << 4);
+		layer4[1] = (testpatsize << 4) | (mtp2->slc & 0xf);
 		memcpy(&layer4[2], &headerptr[2], testpatsize);
 		
 		ss7_msg_userpart_len(m, rllen + testpatsize + 2);
@@ -462,7 +477,10 @@
 	sio = m->buf + MTP2_SIZE;
 	sif = sio + 1;
 
-	winner = sls_to_link(ss7, sls);
+	if (userpart != SIG_ISUP)
+		winner = slc_to_link(ss7, sls);
+	else
+		winner = sls_to_link(ss7, sls);
 
 	if (ss7->switchtype == SS7_ITU)
 		(*sio) = (ss7->ni << 6) | userpart;

Modified: branches/1.0/ss7.c
URL: http://svnview.digium.com/svn/libss7/branches/1.0/ss7.c?view=diff&rev=281&r1=280&r2=281
==============================================================================
--- branches/1.0/ss7.c (original)
+++ branches/1.0/ss7.c Mon Feb 22 15:13:04 2010
@@ -237,6 +237,24 @@
 		flags |= POLLOUT;
 
 	return flags;
+}
+
+/* TODO: Add entry to routing table instead */
+int ss7_set_slc(struct ss7 *ss7, int fd, unsigned int slc)
+{
+	int i;
+	int winner = -1;
+
+	for (i = 0; i < ss7->numlinks; i++) {
+		if (ss7->links[i]->fd == fd)
+			winner = i;
+	}
+	if (winner > -1)
+		ss7->links[winner]->slc = slc;
+	else
+		return -1;
+
+	return 0;
 }
 
 /* TODO: Add entry to routing table instead */




More information about the svn-commits mailing list