[Asterisk-cvs] libpri-matt pri_internal.h,1.8,1.9 q931.c,1.7,1.8

mattf at lists.digium.com mattf at lists.digium.com
Wed Dec 29 14:32:03 CST 2004


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

Modified Files:
	pri_internal.h q931.c 
Log Message:
Added nuances for building the message with multiple facility IEs


Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri-matt/pri_internal.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pri_internal.h	29 Dec 2004 18:09:45 -0000	1.8
+++ pri_internal.h	29 Dec 2004 19:26:49 -0000	1.9
@@ -142,12 +142,13 @@
 
 /* For scheduling the sending and receiving of invokes, etc */
 struct adpu_event {
-	int message;
-	void (*callback)(void *data);
-	void *data;
-	void *adpu;
-	int adpu_len;
-	struct adpu_event *next;
+	int message;			/* What message to send the ADPU in */
+	void (*callback)(void *data);	/* Callback function for when response is received */
+	void *data;			/* Data to callback */
+	void *adpu;			/* ADPU to send */
+	int adpu_len; 			/* Length of ADPU */
+	int sent;  			/* Have we been sent already? */
+	struct adpu_event *next;	/* Linked list pointer */
 };
 
 /* q931_call datastructure */

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri-matt/q931.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- q931.c	23 Dec 2004 18:02:00 -0000	1.7
+++ q931.c	29 Dec 2004 19:26:49 -0000	1.8
@@ -2071,6 +2071,8 @@
 	int offset=0;
 	int x;
 	int codeset;
+	struct adpu_event *facevent = c->adpus;
+
 	memset(buf, 0, sizeof(buf));
 	len = sizeof(buf);
 	init_header(pri, c, buf, &h, &mh, &len);
@@ -2078,11 +2080,30 @@
 	x=0;
 	codeset = 0;
 	while(ies[x] > -1) {
-		res = add_ie(pri, c, mh->msg, ies[x], (q931_ie *)(mh->data + offset), len, &codeset);
+		if (x == Q931_IE_FACILITY) {
+			res = 0;
+			while (facevent) {
+				if (!facevent->sent && (facevent->message == msgtype)) { 
+					int tmpres;
+					tmpres = add_ie(pri, c, mh->msg, ies[x], (q931_ie *)(mh->data + offset), len, &codeset);
+					if (tmpres < 0) {
+						pri_error("!! Unable to add IE '%s'\n", ie2str(ies[x]));
+						return -1;
+					}
+					res += tmpres;
+					facevent->sent = 1;
+				}
+				facevent = facevent->next;
+			}
+		} else {
+			res = add_ie(pri, c, mh->msg, ies[x], (q931_ie *)(mh->data + offset), len, &codeset);
+		}
+
 		if (res < 0) {
 			pri_error("!! Unable to add IE '%s'\n", ie2str(ies[x]));
 			return -1;
 		}
+
 		offset += res;
 		len -= res;
 		x++;




More information about the svn-commits mailing list