[asterisk-commits] moy: branch moy/dahdi-tap-trunk r220626 - /team/moy/dahdi-tap-trunk/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 26 19:17:33 CDT 2009


Author: moy
Date: Sat Sep 26 19:17:27 2009
New Revision: 220626

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=220626
Log:
fix tapping span configuration and put the tap peer channel in audio mode to be able to join the conference

Modified:
    team/moy/dahdi-tap-trunk/channels/chan_dahdi.c
    team/moy/dahdi-tap-trunk/channels/sig_pri.c

Modified: team/moy/dahdi-tap-trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/dahdi-tap-trunk/channels/chan_dahdi.c?view=diff&rev=220626&r1=220625&r2=220626
==============================================================================
--- team/moy/dahdi-tap-trunk/channels/chan_dahdi.c (original)
+++ team/moy/dahdi-tap-trunk/channels/chan_dahdi.c Sat Sep 26 19:17:27 2009
@@ -2319,8 +2319,13 @@
 	struct sig_pri_pri *pri = pchan->pri;
 
 	if (pri->tappingpeer) {
-		p->tappingpeer = pchan->tappingpeer->chan_pvt;
-		((struct dahdi_pvt *)pchan->tappingpeer->chan_pvt)->tappingpeer = p;
+		struct dahdi_pvt *pp = pchan->tappingpeer->chan_pvt;
+		p->tappingpeer = pp;
+		pp->tappingpeer = p;
+		audio = 1;
+		if (ioctl(pp->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &audio) == -1) {
+			ast_log(LOG_WARNING, "Unable to set audio mode on peer PRI channel %d: %s\n", pp->channel, strerror(errno));
+		}
 	}
 
 	/* Set to audio mode at this point */
@@ -5194,6 +5199,36 @@
 
 	idx = dahdi_get_index(ast, p, 1);
 
+	if (p->tappingpeer) {
+		struct dahdi_confinfo pinfo;
+		struct dahdi_pvt *pp = p->tappingpeer;
+
+		/* remove pvt from the conference */
+		memset(&pinfo, 0, sizeof(pinfo));
+		ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF);
+
+		/* remove peer pvt from the conference */
+		memset(&pinfo, 0, sizeof(pinfo));
+		ioctl(pp->subs[SUB_REAL].dfd, DAHDI_SETCONF);
+
+		/* remove the tapping pseudo from the conference */
+		memset(&pinfo, 0, sizeof(pinfo));
+		ioctl(p->tappingfd, DAHDI_SETCONF);
+		dahdi_close(p->tappingfd);
+
+		/* if its PRI reset data mode for the peer channel */
+		if (dahdi_sig_pri_lib_handles(p->sig)) {
+			int paudio = 1;
+			if (ioctl(pp->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &paudio) == -1) {
+				ast_log(LOG_WARNING, "Unable to set data mode on peer channel %d: %s\n", pp->channel, strerror(errno));
+			}
+		}
+		p->tappingfd = -1;
+		p->tappingpeer = NULL;
+		pp->tappingpeer = NULL;
+		pp->owner = NULL;
+	}
+
 #ifdef HAVE_PRI
 	if (dahdi_sig_pri_lib_handles(p->sig)) {
 		int law;
@@ -5224,21 +5259,6 @@
 	if (p->sig == SIG_SS7) {
 		x = 1;
 		ast_channel_setoption(ast,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0);
-	}
-
-	if (p->tappingpeer) {
-		struct dahdi_confinfo pinfo;
-		memset(&pinfo, 0, sizeof(pinfo));
-		ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCONF);
-		memset(&pinfo, 0, sizeof(pinfo));
-		ioctl(p->tappingpeer->subs[SUB_REAL].dfd, DAHDI_SETCONF);
-		memset(&pinfo, 0, sizeof(pinfo));
-		ioctl(p->tappingfd, DAHDI_SETCONF);
-		dahdi_close(p->tappingfd);
-		p->tappingfd = -1;
-		p->tappingpeer->tappingpeer = NULL;
-		p->tappingpeer->owner = NULL;
-		p->tappingpeer = NULL;
 	}
 
 	x = 0;
@@ -15998,9 +16018,9 @@
 			} else if (!strcasecmp(v->name, "facilityenable")) {
 				confp->pri.pri.facilityenable = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "tappingpeerpos")) {
-				if (!strcasecmp(v->name, "prev")) {
+				if (!strcasecmp(v->value, "prev")) {
 					confp->pri.pri.tappingpeerpos = TAP_PEER_PREV;
-				} else if (!strcasecmp(v->name, "next")) {
+				} else if (!strcasecmp(v->value, "next")) {
 					confp->pri.pri.tappingpeerpos = TAP_PEER_NEXT;
 				} else {
 					confp->pri.pri.tappingpeerpos = TAP_PEER_NONE;

Modified: team/moy/dahdi-tap-trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/dahdi-tap-trunk/channels/sig_pri.c?view=diff&rev=220626&r1=220625&r2=220626
==============================================================================
--- team/moy/dahdi-tap-trunk/channels/sig_pri.c (original)
+++ team/moy/dahdi-tap-trunk/channels/sig_pri.c Sat Sep 26 19:17:27 2009
@@ -3248,6 +3248,7 @@
 {
 	int x;
 	int i;
+	int res;
 
 	ast_mutex_init(&pri->lock);
 
@@ -3302,7 +3303,12 @@
 	/* Assume primary is the one we use */
 	pri->pri = pri->dchans[0];
 	pri->resetpos = -1;
-	if (ast_pthread_create_background(&pri->master, NULL, pri->tappingpeer ? pri_tapping_dchannel : pri_dchannel, pri)) {
+	if (pri->tappingpeer) {
+		res = ast_pthread_create_background(&pri->master, NULL, pri_tapping_dchannel, pri);
+	} else {
+		res = ast_pthread_create_background(&pri->master, NULL, pri_dchannel, pri);
+	}
+	if (res) {
 		for (i = 0; i < NUM_DCHANS; i++) {
 			if (!pri->dchans[i])
 				break;




More information about the asterisk-commits mailing list