[libss7-commits] mattf: trunk r42 - /trunk/isup.c

libss7-commits at lists.digium.com libss7-commits at lists.digium.com
Sat Sep 9 12:42:16 MST 2006


Author: mattf
Date: Sat Sep  9 14:42:15 2006
New Revision: 42

URL: http://svn.digium.com/view/libss7?rev=3D42&view=3Drev
Log:
We have to use User Service Info in ANSI IAMs instead of transmission mediu=
m requirements.

Modified:
    trunk/isup.c

Modified: trunk/isup.c
URL: http://svn.digium.com/view/libss7/trunk/isup.c?rev=3D42&r1=3D41&r2=3D4=
2&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/isup.c (original)
+++ trunk/isup.c Sat Sep  9 14:42:15 2006
@@ -44,6 +44,9 @@
 =

 static int iam_params[] =3D {ISUP_PARM_NATURE_OF_CONNECTION_IND, ISUP_PARM=
_FORWARD_CALL_IND, ISUP_PARM_CALLING_PARTY_CAT,
 	ISUP_PARM_TRANSMISSION_MEDIUM_REQS, ISUP_PARM_CALLED_PARTY_NUM, ISUP_PARM=
_CALLING_PARTY_NUM, -1}; /* Don't have optional IEs */
+
+static int ansi_iam_params[] =3D {ISUP_PARM_NATURE_OF_CONNECTION_IND, ISUP=
_PARM_FORWARD_CALL_IND, ISUP_PARM_CALLING_PARTY_CAT,
+	ISUP_PARM_USER_SERVICE_INFO, ISUP_PARM_CALLED_PARTY_NUM, ISUP_PARM_CALLIN=
G_PARTY_NUM, -1}; /* Don't have optional IEs */
 =

 static int acm_params[] =3D {ISUP_PARM_BACKWARD_CALL_IND, -1};
 =

@@ -133,6 +136,8 @@
 			return "CGUA";
 		case ISUP_RSC:
 			return "RSC";
+		case ISUP_CPG:
+			return "CPG";
 		default:
 			return "Unknown";
 	}
@@ -321,28 +326,26 @@
 =

 static FUNC_RECV(user_service_info_receive)
 {
-	return 3;
-}
-
-static FUNC_SEND(user_service_info_transmit)
-{
-	/* Don't include if it's an ITU style network */
 	if (ss7->switchtype !=3D SS7_ANSI)
 		return 0;
 =

-	parm[0] =3D 0x80; /* Default to ITU standardized coding */
-	parm[0] |=3D c->transcap;
-
-	parm[1] =3D 0x90; /* Assume 64kbps, circuit mode */
-
-	parm[2] =3D 0xa0; /* Layer 1 ID */
-	parm[2] |=3D c->l1prot;
+	return len;
+}
+
+static FUNC_SEND(user_service_info_transmit)
+{
+	/* Default to Coding standard CCITT / 3.1 khz Audio */
+	parm[0] =3D 0x90;
+	/* Default to Circuit mode / 64kbps */
+	parm[1] =3D 0x90;
+	/* User Layer 1 set to ulaw */
+	parm[2] =3D 0xa2;
+
 	return 3;
 }
 =

 static FUNC_SEND(transmission_medium_reqs_transmit)
 {
-	/* Don't include transmission medium requirements in an ANSI environment =
*/
 	if (ss7->switchtype !=3D SS7_ITU)
 		return 0;
 	/* Speech */
@@ -789,7 +792,7 @@
 	int ourmessage =3D -1;
 	int rlsize;
 	unsigned char *varoffsets =3D NULL, *opt_ptr;
-	int varparams =3D 0;
+	int fixedparams =3D 0, varparams =3D 0;
 	int len =3D sizeof(struct ss7_msg);
 	struct routing_label rl;
 	int res =3D 0;
@@ -833,8 +836,23 @@
 		return -1;
 	}
 =

+	/* Again, the ANSI exception */
+	if (messages[ourmessage].messagetype =3D=3D ISUP_IAM) {
+		if (ss7->switchtype =3D=3D SS7_ITU) {
+			fixedparams =3D messages[ourmessage].mand_fixed_params;
+			varparams =3D messages[ourmessage].mand_var_params;
+		} else {
+			/* Stupid ANSI SS7, they just had to be different, didn't they? */
+			fixedparams =3D 3;
+			varparams =3D 2;
+		}
+	} else {
+		fixedparams =3D messages[ourmessage].mand_fixed_params;
+		varparams =3D messages[ourmessage].mand_var_params;
+	}
+
 	/* Add fixed params */
-	for (x =3D 0; x < messages[ourmessage].mand_fixed_params; x++) {
+	for (x =3D 0; x < fixedparams; x++) {
 		res =3D do_parm(ss7, c, mh->type, parms[x], (void *)(mh->data + offset),=
 len, PARM_TYPE_FIXED, 1);
 =

 		if (res < 0) {
@@ -846,7 +864,6 @@
 		offset +=3D res;
 	}
 =

-	varparams =3D messages[ourmessage].mand_var_params;
 	varoffsets =3D &mh->data[offset];
 	/* Make sure we grab our opional parameters */
 	if (messages[ourmessage].opt_params) {
@@ -860,7 +877,7 @@
 	i =3D 0;
 =

 	/* Whew, some complicated math for all of these offsets and different sec=
tions */
-	for (; (x - messages[ourmessage].mand_fixed_params) < varparams; x++) {
+	for (; (x - fixedparams) < varparams; x++) {
 		varoffsets[i] =3D &mh->data[offset] - &varoffsets[i];
 		i++;
 		res =3D do_parm(ss7, c, mh->type, parms[x], (void *)(mh->data + offset),=
 len, PARM_TYPE_VARIABLE, 1); /* Find out what else we need to add */
@@ -946,7 +963,7 @@
 	int *parms =3D NULL;
 	int offset =3D 0;
 	int ourmessage =3D -1;
-	int varparams =3D 0;
+	int fixedparams =3D 0, varparams =3D 0;
 	int res, x;
 	unsigned char *opt_ptr =3D NULL;
 	ss7_event *e;
@@ -971,10 +988,26 @@
 =

 	c =3D isup_find_call(ss7, cic);
 =

-	parms =3D messages[ourmessage].param_list;
+	/* Check for the ANSI IAM exception */
+	if (messages[ourmessage].messagetype =3D=3D ISUP_IAM) {
+		if (ss7->switchtype =3D=3D SS7_ITU) {
+			fixedparams =3D messages[ourmessage].mand_fixed_params;
+			varparams =3D messages[ourmessage].mand_var_params;
+			parms =3D messages[ourmessage].param_list;
+		} else {
+			/* Stupid ANSI SS7, they just had to be different, didn't they? */
+			fixedparams =3D 3;
+			varparams =3D 2;
+			parms =3D ansi_iam_params;
+		}
+	} else {
+		fixedparams =3D messages[ourmessage].mand_fixed_params;
+		varparams =3D messages[ourmessage].mand_var_params;
+		parms =3D messages[ourmessage].param_list;
+	}
 =

 	/* Parse fixed parms */
-	for (x =3D 0; x < messages[ourmessage].mand_fixed_params; x++) {
+	for (x =3D 0; x < fixedparams; x++) {
 		res =3D do_parm(ss7, c, mh->type, parms[x], (void *)(mh->data + offset),=
 len, PARM_TYPE_FIXED, 0);
 =

 		if (res < 0) {
@@ -986,8 +1019,6 @@
 		offset +=3D res;
 	}
 =

-	varparams =3D messages[ourmessage].mand_var_params;
-
 	if (varparams) {
 		offset +=3D varparams; /* add one for the optionals */
 		res -=3D varparams;
@@ -998,7 +1029,7 @@
 =

 	i =3D 0;
 =

-	for (; (x - messages[ourmessage].mand_fixed_params) < varparams; x++) {
+	for (; (x - fixedparams) < varparams; x++) {
 		res =3D do_parm(ss7, c, mh->type, parms[x], (void *)(mh->data + offset),=
 len, PARM_TYPE_VARIABLE, 0); /* Find out what else we need to add */
 =

 		if (res < 0) {
@@ -1201,7 +1232,10 @@
 =

 int isup_iam(struct ss7 *ss7, struct isup_call *c)
 {
-	return isup_send_message(ss7, c, ISUP_IAM, iam_params);
+	if (ss7->switchtype =3D=3D SS7_ITU)
+		return isup_send_message(ss7, c, ISUP_IAM, iam_params);
+	else
+		return isup_send_message(ss7, c, ISUP_IAM, ansi_iam_params);
 }
 =

 int isup_acm(struct ss7 *ss7, struct isup_call *c)



More information about the libss7-commits mailing list