[Asterisk-cvs] libpri libpri.h,1.25,1.26 pri.c,1.19,1.20 pri_internal.h,1.8,1.9 q931.c,1.62,1.63

markster at lists.digium.com markster at lists.digium.com
Sun Jun 6 22:31:24 CDT 2004


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

Modified Files:
	libpri.h pri.c pri_internal.h q931.c 
Log Message:
Add the ability to slave one PRI to another with respect to calls


Index: libpri.h
===================================================================
RCS file: /usr/cvsroot/libpri/libpri.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- libpri.h	5 Jun 2004 06:50:55 -0000	1.25
+++ libpri.h	7 Jun 2004 03:33:51 -0000	1.26
@@ -405,5 +405,10 @@
 /* Send call proceeding */
 extern int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
 
+/* Enslave a PRI to another, so they share the same call list
+   (and maybe some timers) */
+extern void pri_enslave(struct pri *master, struct pri *slave);
+
 #define PRI_GR303_SUPPORT
+#define PRI_ENSLAVE_SUPPORT
 #endif

Index: pri.c
===================================================================
RCS file: /usr/cvsroot/libpri/pri.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- pri.c	5 Jun 2004 06:50:55 -0000	1.19
+++ pri.c	7 Jun 2004 03:33:51 -0000	1.20
@@ -76,6 +76,7 @@
 		p->tei = 0;
 		p->protodisc = Q931_PROTOCOL_DISCRIMINATOR;
 		p->master = master;
+		p->callpool = &p->localpool;
 #ifdef LIBPRI_COUNTERS
 		p->q921_rxcount = 0;
 		p->q921_txcount = 0;
@@ -444,3 +445,9 @@
 {
 	return q931_call_setcrv(pri, call, crv, callmode);
 }
+
+void pri_enslave(struct pri *master, struct pri *slave)
+{
+	if (master && slave)
+		slave->callpool = &master->localpool;
+}

Index: pri_internal.h
===================================================================
RCS file: /usr/cvsroot/libpri/pri_internal.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pri_internal.h	5 Jun 2004 06:50:55 -0000	1.8
+++ pri_internal.h	7 Jun 2004 03:33:51 -0000	1.9
@@ -85,7 +85,8 @@
 	struct q921_frame *txqueue;
 	
 	/* Q.931 calls */
-	q931_call *calls;
+	q931_call **callpool;
+	q931_call *localpool;
 
 	/* do we do overlap dialing */
 	int overlapdial;

Index: q931.c
===================================================================
RCS file: /usr/cvsroot/libpri/q931.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- q931.c	6 Jun 2004 23:26:43 -0000	1.62
+++ q931.c	7 Jun 2004 03:33:51 -0000	1.63
@@ -1310,7 +1310,7 @@
 static q931_call *q931_getcall(struct pri *pri, int cr)
 {
 	q931_call *cur, *prev;
-	cur = pri->calls;
+	cur = *pri->callpool;
 	prev = NULL;
 	while(cur) {
 		if (cur->cr == cr)
@@ -1331,7 +1331,7 @@
 		if (prev)
 			prev->next = cur;
 		else
-			pri->calls = cur;
+			*pri->callpool = cur;
 	}
 	return cur;
 }
@@ -1340,7 +1340,7 @@
 {
 	q931_call *cur;
 	do {
-		cur = pri->calls;
+		cur = *pri->callpool;
 		pri->cref++;
 		if (pri->cref > 32767)
 			pri->cref = 1;
@@ -1357,13 +1357,13 @@
 {
 	q931_call *cur, *prev;
 	prev = NULL;
-	cur = pri->calls;
+	cur = *pri->callpool;
 	while(cur) {
 		if ((c && (cur == c)) || (!c && (cur->cr == cr))) {
 			if (prev)
 				prev->next = cur->next;
 			else
-				pri->calls = cur->next;
+				*pri->callpool = cur->next;
 			if (pri->debug & PRI_DEBUG_Q931_STATE)
 				pri_message("NEW_HANGUP DEBUG: Destroying the call, ourstate %s, peerstate %s\n",callstate2str(cur->ourcallstate),callstate2str(cur->peercallstate));
 			if (cur->retranstimer)
@@ -1550,7 +1550,7 @@
 	if (!cause)
 		cause = PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY;
 	if (c->cr > -1)
-		cur = pri->calls;
+		cur = *pri->callpool;
 	while(cur) {
 		if (cur->cr == c->cr) {
 			cur->cause=cause;




More information about the svn-commits mailing list