[svn-commits] jpeeler: trunk r208267 - in /trunk/channels: chan_dahdi.c sig_pri.c sig_pri.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 23 10:59:48 CDT 2009


Author: jpeeler
Date: Thu Jul 23 10:59:44 2009
New Revision: 208267

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=208267
Log:
Fix sending of interface identifier unconditionally in sig_pri

The wrong logic was being used in chan_dahdi to convert a sig_pri_chan
to the proper libpri channel number. The most significant bit must only
be set only when trunk groups are being used.

(closes issue #15452)
Reported by: alecdavis
Patches:
      bug15452.patch uploaded by jpeeler (license 325)
Tested by: alecdavis


Modified:
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=208267&r1=208266&r2=208267
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Jul 23 10:59:44 2009
@@ -10655,7 +10655,7 @@
 						}
 
 						ast_debug(4, "Adding callbacks %p to chan %d\n", &dahdi_pri_callbacks, tmp->channel);
-						pchan = sig_pri_chan_new(tmp, &dahdi_pri_callbacks, &pris[span].pri, tmp->logicalspan, p.chanpos);
+						pchan = sig_pri_chan_new(tmp, &dahdi_pri_callbacks, &pris[span].pri, tmp->logicalspan, p.chanpos, pris[span].mastertrunkgroup);
 						if (!pchan) {
 							destroy_dahdi_pvt(&tmp);
 							return NULL;

Modified: trunk/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.c?view=diff&rev=208267&r1=208266&r2=208267
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Thu Jul 23 10:59:44 2009
@@ -78,14 +78,11 @@
 
 static unsigned int PVT_TO_CHANNEL(struct sig_pri_chan *p)
 {
-	int explicit;
-
-	if (p->pri->dchan_logical_span[pri_active_dchan_index(p->pri)] == p->logicalspan)
-		explicit = 1;
-	else
-		explicit = 0;
-
-	return (((p)->prioffset) | ((p)->logicalspan << 8) | (explicit ? 0x10000 : 0));
+	int res = (((p)->prioffset) | ((p)->logicalspan << 8) | (p->mastertrunkgroup ? 0x10000 : 0));
+	ast_debug(5, "prioffset: %d mastertrunkgroup: %d logicalspan: %d result: %d\n",
+		p->prioffset, p->mastertrunkgroup, p->logicalspan, res);
+
+	return res;
 }
 
 static void sig_pri_handle_dchan_exception(struct sig_pri_pri *pri, int index)
@@ -202,14 +199,15 @@
 /* Returns index of the active dchan */
 static int pri_active_dchan_index(struct sig_pri_pri *pri)
 {
-	int x = -1;
+	int x;
 
 	for (x = 0; x < NUM_DCHANS; x++) {
 		if ((pri->dchans[x] == pri->pri))
-			break;
-	}
-
-	return x;
+			return x;
+	}
+
+	ast_log(LOG_WARNING, "No active dchan found!\n");
+	return -1;
 }
 
 static int pri_find_dchan(struct sig_pri_pri *pri)
@@ -2330,7 +2328,7 @@
 	}
 }
 
-struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_pri *pri, int logicalspan, int channo)
+struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_pri *pri, int logicalspan, int channo, int trunkgroup)
 {
 	struct sig_pri_chan *p;
 
@@ -2341,6 +2339,7 @@
 
 	p->logicalspan = logicalspan;
 	p->prioffset = channo;
+	p->mastertrunkgroup = trunkgroup;
 
 	p->calls = callback;
 	p->chan_pvt = pvt_data;

Modified: trunk/channels/sig_pri.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.h?view=diff&rev=208267&r1=208266&r2=208267
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Thu Jul 23 10:59:44 2009
@@ -139,7 +139,6 @@
 	/* Internal variables -- Don't touch */
 	/* Probably will need DS0 number, DS1 number, and a few other things */
 	char dialdest[256];				/* Queued up digits for overlap dialing.  They will be sent out as information messages when setup ACK is received */
-	int mastertrunkgroup;
 
 	unsigned int alerting:1;		/*!< TRUE if channel is alerting/ringing */
 	unsigned int alreadyhungup:1;	/*!< TRUE if the call has already gone/hungup */
@@ -159,6 +158,7 @@
 
 	int prioffset;					/*!< channel number in span */
 	int logicalspan;				/*!< logical span number within trunk group */
+	int mastertrunkgroup;			/*!< what trunk group is our master */
 
 	struct sig_pri_callback *calls;
 	void *chan_pvt;
@@ -245,7 +245,7 @@
 
 struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor);
 
-struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_pri *pri, int logicalspan, int channo);
+struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_pri *pri, int logicalspan, int channo, int trunkgroup);
 
 int pri_is_up(struct sig_pri_pri *pri);
 




More information about the svn-commits mailing list