Index: libss7.h
===================================================================
--- libss7.h	(revision 85)
+++ libss7.h	(working copy)
@@ -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 */
Index: isup.c
===================================================================
--- isup.c	(revision 85)
+++ isup.c	(working copy)
@@ -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)
@@ -716,20 +725,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)
@@ -1231,7 +1253,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:
Index: isup.h
===================================================================
--- isup.h	(revision 85)
+++ isup.h	(working copy)
@@ -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;
Index: ss7linktest.c
===================================================================
--- ss7linktest.c	(revision 85)
+++ ss7linktest.c	(working copy)
@@ -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);
 	}
