[Asterisk-cvs] libpri q931.c,1.26,1.27

martinp at lists.digium.com martinp at lists.digium.com
Mon Oct 13 17:08:03 CDT 2003


Update of /usr/cvsroot/libpri
In directory mongoose.digium.com:/tmp/cvs-serv10131

Modified Files:
	q931.c 
Log Message:
Allow the reception of 1 byte Call Reference value


Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- q931.c	10 Oct 2003 07:04:19 -0000	1.26
+++ q931.c	13 Oct 2003 22:34:05 -0000	1.27
@@ -1251,9 +1251,21 @@
 		pri_error("Call Reference Length Too long: %d\n", h->crlen);
 		return -1;
 	}
-	for (x=0;x<h->crlen;x++) {
-		cr <<= 8;
-		cr |= h->crv[x];
+	switch (h->crlen) {
+		case 2: 
+			for (x=0;x<h->crlen;x++) {
+				cr <<= 8;
+				cr |= h->crv[x];
+			}
+			break;
+		case 1:
+			cr = h->crv[0];
+			if (cr & 0x80) {
+				cr &= ~0x80;
+				cr |= 0x8000;
+			}
+		default:
+			pri_error("Call Reference Length not supported: %d\n", h->crlen);
 	}
 	return cr;
 }




More information about the svn-commits mailing list