[svn-commits] mattf: trunk r88 - in /trunk: README isup.c isup.h libss7.h ss7linktest.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 19 09:49:17 CDT 2007


Author: mattf
Date: Tue Jun 19 09:49:16 2007
New Revision: 88

URL: http://svn.digium.com/view/libss7?view=rev&rev=88
Log:
Add support for nature of address indicator, number presentation, and screening indicator (#10000)

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

Modified: trunk/README
URL: http://svn.digium.com/view/libss7/trunk/README?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- trunk/README (original)
+++ trunk/README Tue Jun 19 09:49:16 2007
@@ -1,6 +1,5 @@
 libss7:
 =======
-
 libss7 is a userspace library that is used for providing SS7 protocol
 services to applications.  It has a working MTP2, MTP3, and ISUP for
 ITU and ANSI style SS7, however it was written in a manner that will easily
@@ -17,7 +16,7 @@
 ================
 Siemens EWSD - (ITU style) MTP2 and MTP3 comes up, ISUP inbound and outbound calls work as well.
 DTI DXC 4K - (ANSI style) 56kbps link, MTP2 and MTP3 come up, ISUP inbound and outbound calls work as well.
-
+Huawei M800 - (ITU style) MTP2 and MTP3 comes up, ISUP National, International inbound and outbound calls work as well, CallerID presentation&screening work.
 
 Thanks:
 =======
@@ -53,13 +52,13 @@
 ANSI MTP2, MTP3, and ISUP, inbound and outbound calling works now.
 ITU style SS7 support
 ANSI-style signalling support
+Called and Calling Nature of Address Indicator
+CallerID presentation&screening
 
 TODO:
 =====
-
 short term:
 SUS/RES
-CallerID presentation
 RDNIS
 Timer for last SU received so we know if layer2 goes out under us
 

Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- trunk/isup.c (original)
+++ trunk/isup.c Tue Jun 19 09:49:16 2007
@@ -322,8 +322,7 @@
 	
 static FUNC_SEND(calling_party_cat_transmit)
 {
-	/* Default to unknown */
-	parm[0] = 0x0a;
+	parm[0] = 0x0a; /* Default to Ordinary calling subscriber */
 	return 1;
 }
 
@@ -380,6 +379,8 @@
 	
 	isup_get_number(c->called_party_num, &parm[2], len - 2, odd);
 
+	c->called_nai = parm[0] & 0x7f; /* Nature of Address Indicator */
+
 	return len;
 }
 
@@ -389,12 +390,12 @@
 
 	isup_put_number(&parm[2], c->called_party_num, &numlen, &oddeven);
 
-	parm[0] = 0x03; /* Assume unknown */
+	parm[0] = c->called_nai & 0x7f; /* Nature of Address Indicator */
 	
 	if (oddeven)
 		parm[0] |= 0x80; /* Odd number of digits */
 
-	parm[1] = (0x1 << 4) | 0x00; /* Assume E.164 numbering plan */
+	parm[1] = 0x1 << 4; /* Assume E.164 ISDN numbering plan, called number complete  */
 
 	return numlen + 2;
 }
@@ -520,6 +521,10 @@
 
 	isup_get_number(c->calling_party_num, &parm[2], len - 2, oddeven);
 
+	c->calling_nai = parm[0] & 0x7f;                /* Nature of Address Indicator */
+	c->presentation_ind = (parm[1] >> 2) & 0x3;
+	c->screening_ind = parm[1] & 0x3;
+
 	return len;
 }
 
@@ -532,8 +537,10 @@
 
 	isup_put_number(&parm[2], c->calling_party_num, &datalen, &oddeven);
 
-	parm[0] = (oddeven << 7) | 0x3;
-	parm[1] = 0x11;
+	parm[0] = (oddeven << 7) | c->calling_nai;      /* Nature of Address Indicator */
+	parm[1] = (1 << 4) |                            /* Assume E.164 ISDN numbering plan, calling number complete */
+	    ((c->presentation_ind & 0x3) << 2) |
+	    (c->screening_ind & 0x3);
 
 	return datalen + 2;
 }
@@ -681,6 +688,8 @@
 	{ISUP_PARM_CIRCUIT_GROUP_SUPERVISION_IND, "Circuit Group Supervision Indicator", circuit_group_supervision_dump, circuit_group_supervision_receive, circuit_group_supervision_transmit},
 	{ISUP_PARM_RANGE_AND_STATUS, "Range and status", range_and_status_dump, range_and_status_receive, range_and_status_transmit},
 	{ISUP_PARM_EVENT_INFO, "Event Information", event_info_dump, event_info_receive, event_info_transmit},
+	{ISUP_PARM_OPT_FORWARD_CALL_INDICATOR, "Optional forward call indicator"},
+	{ISUP_PARM_LOCATION_NUMBER, "Location Number"},
 };
 
 static char * param2str(int parm)
@@ -726,20 +735,32 @@
 	c->dpc = dpc;
 }
 
-void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc, char *calledpartynum, char *callingpartynum)
+void isup_set_called(struct isup_call *c, const char *called, unsigned char called_nai, const struct ss7 *ss7)
+{
+    if (called && called[0]) {
+    	if (ss7->switchtype == SS7_ITU)
+    		snprintf(c->called_party_num, sizeof(c->called_party_num), "%s#", called);
+    	else
+    		snprintf(c->called_party_num, sizeof(c->called_party_num), "%s", called);
+	c->called_nai = called_nai;
+    }
+    
+}
+
+void isup_set_calling(struct isup_call *c, const char *calling, unsigned char calling_nai, unsigned char presentation_ind, unsigned char screening_ind)
+{
+    if (calling && calling[0]) {
+    	strncpy(c->calling_party_num, calling, sizeof(c->calling_party_num));
+	c->calling_nai = calling_nai;
+	c->presentation_ind = presentation_ind;
+	c->screening_ind = screening_ind;
+    }
+}
+
+void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc)
 {
 	c->cic = cic;
 	c->dpc = dpc;
-	if (calledpartynum && calledpartynum[0]) {
-		if (ss7->switchtype == SS7_ITU)
-			snprintf(c->called_party_num, sizeof(c->called_party_num), "%s#", calledpartynum);
-		else
-			snprintf(c->called_party_num, sizeof(c->called_party_num), "%s", calledpartynum);
-	}
-
-	if (callingpartynum && callingpartynum[0])
-		strncpy(c->calling_party_num, callingpartynum, sizeof(c->calling_party_num));
-
 }
 
 static struct isup_call * isup_find_call(struct ss7 *ss7, int cic)
@@ -1262,7 +1283,11 @@
 			e->iam.transcap = c->transcap;
 			e->iam.cot_check_required = c->cot_check_required;
 			strncpy(e->iam.called_party_num, c->called_party_num, sizeof(e->iam.called_party_num));
+			e->iam.called_nai = c->called_nai;
 			strncpy(e->iam.calling_party_num, c->calling_party_num, sizeof(e->iam.calling_party_num));
+			e->iam.calling_nai = c->calling_nai;
+			e->iam.presentation_ind = c->presentation_ind;
+			e->iam.screening_ind = c->screening_ind;
 			e->iam.call = c;
 			return 0;
 		case ISUP_GRS:

Modified: trunk/isup.h
URL: http://svn.digium.com/view/libss7/trunk/isup.h?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- trunk/isup.h (original)
+++ trunk/isup.h Tue Jun 19 09:49:16 2007
@@ -100,6 +100,8 @@
 #define ISUP_PARM_PROPAGATION_DELAY 0x31
 #define ISUP_PARM_EVENT_INFO 0x24
 #define ISUP_PARM_HOP_COUNTER 0x3d
+#define ISUP_PARM_OPT_FORWARD_CALL_INDICATOR 0x08
+#define ISUP_PARM_LOCATION_NUMBER 0x3f
 
 /* ISUP Parameter Pseudo-type */
 struct isup_parm_opt {
@@ -121,10 +123,13 @@
 
 struct isup_call {
 	char called_party_num[ISUP_MAX_NUM];
+	unsigned char called_nai;
 	char calling_party_num[ISUP_MAX_NUM];
+	unsigned char calling_nai;
+	unsigned char presentation_ind;
+	unsigned char screening_ind;
 	int range;
 	unsigned char status[255];
-	int international;
 	int transcap;
 	int l1prot;
 	int cause;

Modified: trunk/libss7.h
URL: http://svn.digium.com/view/libss7/trunk/libss7.h?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- trunk/libss7.h (original)
+++ trunk/libss7.h Tue Jun 19 09:49:16 2007
@@ -56,6 +56,23 @@
 #define SS7_NI_NAT			0x02
 #define SS7_NI_NAT_SPARE		0x03
 
+/* Nature of Address Indicator */
+#define SS7_NAI_SUBSCRIBER             0x01
+#define SS7_NAI_UNKNOWN                0x02
+#define SS7_NAI_NATIONAL               0x03
+#define SS7_NAI_INTERNATIONAL          0x04
+
+/* Address Presentation */
+#define SS7_PRESENTATION_ALLOWED                       0x00
+#define SS7_PRESENTATION_RESTRICTED                    0x01
+#define SS7_PRESENTATION_ADDR_NOT_AVAILABLE            0x02
+
+/* Screening */
+#define SS7_SCREENING_USER_PROVIDED_NOT_VERIFIED       0x00
+#define SS7_SCREENING_USER_PROVIDED                    0x01
+#define SS7_SCREENING_NETWORK_PROVIDED_FAILED          0x02
+#define SS7_SCREENING_NETWORK_PROVIDED                 0x03
+
 /* CPG parameter types */
 #define CPG_EVENT_ALERTING	0x01
 #define CPG_EVENT_PROGRESS	0x02
@@ -73,7 +90,11 @@
 	int transcap;
 	int cot_check_required;
 	char called_party_num[50];
+	unsigned char called_nai;
 	char calling_party_num[50];
+	unsigned char calling_nai;
+	unsigned char presentation_ind;
+	unsigned char screening_ind;
 	struct isup_call *call;
 } ss7_event_iam;
 
@@ -201,6 +222,7 @@
 
 char * ss7_event2str(int event);
 
+
 /* ISUP call related message functions */
 
 /* Send an IAM */
@@ -242,7 +264,12 @@
 
 int isup_rsc(struct ss7 *ss7, int cic, unsigned int dpc);
 
-void isup_init_call(struct ss7 *ss7, struct isup_call *c, int cic, unsigned int dpc, char *calledpartynum, char *callingpartynum);
+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);
+
+void isup_set_called(struct isup_call *c, const char *called, unsigned char called_nai, const struct ss7 *ss7);
+
+void isup_set_calling(struct isup_call *c, const char *calling, unsigned char calling_nai, unsigned char presentation_ind, unsigned char screening_ind);
+
 #endif /* _LIBSS7_H */

Modified: trunk/ss7linktest.c
URL: http://svn.digium.com/view/libss7/trunk/ss7linktest.c?view=diff&rev=88&r1=87&r2=88
==============================================================================
--- trunk/ss7linktest.c (original)
+++ trunk/ss7linktest.c Tue Jun 19 09:49:16 2007
@@ -34,7 +34,9 @@
 	c = isup_new_call(ss7);
 
 	if (c) {
-		isup_init_call(ss7, c, (callcount % 12) + 1, dpc, "12345", "7654321");
+		isup_set_called(c, "12345", SS7_NAI_NATIONAL, ss7);
+		isup_set_calling(c, "7654321", SS7_NAI_NATIONAL, SS7_PRESENTATION_ALLOWED, SS7_SCREENING_USER_PROVIDED);
+		isup_init_call(ss7, c, (callcount % 12) + 1, dpc);
 		isup_iam(ss7, c);
 		printf("Callcount = %d\n ", ++callcount);
 	}




More information about the svn-commits mailing list