[Asterisk-cvs] libpri-matt pri_facility.c, 1.13, 1.14 q931.c, 1.14, 1.15

mattf at lists.digium.com mattf at lists.digium.com
Thu Jan 13 17:57:32 CST 2005


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

Modified Files:
	pri_facility.c q931.c 
Log Message:
More changes, adding NFE component


Index: pri_facility.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_facility.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pri_facility.c	13 Jan 2005 20:49:04 -0000	1.13
+++ pri_facility.c	14 Jan 2005 00:01:26 -0000	1.14
@@ -44,28 +44,26 @@
 
 void mwi_activate_encode_cb(void *data)
 {
-	free(data);
 	return;
 }
 
 int mwi_activate_encode_and_queue(q931_call *call, struct pri_sr *req)
 {
 	int res = 0, i = 0;
-	unsigned char * buffer = NULL;
+	unsigned char buffer[255];
 	int destlen = strlen(req->called);
 	int istr = 0;
 	/* TODO:1 */
 
-	buffer = malloc(255);
-	if (!buffer)
-		return -1;
-
 	if (destlen <= 0) {
-		free(buffer);
 		return -1;
 	} else if (destlen > 20)
 		destlen = 20;  /* Destination number cannot be greater then 20 digits */
 
+	buffer[i++] = ASN1_INTEGER; /* Invoke ID -- TODO: universal method for assigning these */
+	buffer[i++] = 0x01;
+	buffer[i++] = 0x10; /* Id of 1 */
+
 	buffer[i++] = 0x30; /* Sequence */
 	buffer[i++] = 5 /* All fixed length necessary parts */
 		+ destlen;
@@ -83,7 +81,7 @@
 	buffer[i++] = 0x1; /* contents: Voice */
 	
 	
-	res = pri_call_adpu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, buffer);
+	res = pri_call_adpu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, NULL);
 
 	return res;
 }

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- q931.c	13 Jan 2005 20:49:04 -0000	1.14
+++ q931.c	14 Jan 2005 00:01:26 -0000	1.15
@@ -1437,19 +1437,32 @@
 			break;
 	}
 
-	if (tmp->adpu_len > 255) {
+	if (tmp->adpu_len > 235) { /* TODO: find out how much sapce we can use */
 		pri_message("Requested ADPU (%d bytes) is too long\n", tmp->adpu_len);
+
+
 		return 0;
 	}
 	
 	ie->data[i++] = ROSE_NETWORK_EXTENSION | 0x80;
+
 	comp = (struct rose_component*)&ie->data[i];
+	comp->type = COMP_TYPE_NFE;
+	comp->len = 0x6;
+	i+=2;
+	ie->data[i++] = 0x80;
+	ie->data[i++] = 0x01;
+	ie->data[i++] = 0x00;
+	ie->data[i++] = 0x82;
+	ie->data[i++] = 0x01;
+	ie->data[i++] = 0x00;
 
+	comp = (struct rose_component*)&ie->data[i];
 	comp->type = COMP_TYPE_INTERPRETATION;
 	comp->len = 0x01;
 	comp->data[0] = 0x00;
 	i += 3;
-
+	
 	comp = (struct rose_component*)&ie->data[i];
 	comp->type = COMP_TYPE_INVOKE;
 	comp->len = tmp->adpu_len;




More information about the svn-commits mailing list