[asterisk-commits] moy: branch moy/dahdi-tap-1.6.2 r247899 - /team/moy/dahdi-tap-1.6.2/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 19 10:09:20 CST 2010


Author: moy
Date: Fri Feb 19 10:09:16 2010
New Revision: 247899

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=247899
Log:
fix call to enable audio mode and set gains, it was done in the wrong order before

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

Modified: team/moy/dahdi-tap-1.6.2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/dahdi-tap-1.6.2/channels/chan_dahdi.c?view=diff&rev=247899&r1=247898&r2=247899
==============================================================================
--- team/moy/dahdi-tap-1.6.2/channels/chan_dahdi.c (original)
+++ team/moy/dahdi-tap-1.6.2/channels/chan_dahdi.c Fri Feb 19 10:09:16 2010
@@ -12449,6 +12449,7 @@
 	int chanpos, peerpos, law, layer1, transcap, res, fd;
 	int crv = 0;
 	int eventcrv = 0;
+	int enableaudio = 1;
 	struct dahdi_pcall *pcall = NULL;
 	struct ast_channel *c = NULL;
 	struct dahdi_pvt *peerpvt = NULL;
@@ -12598,7 +12599,12 @@
 			ast_mutex_unlock(&masterpvt->lock);
 			break;
 		}
-
+		enableaudio = 1;
+		/* set both master and peer in AUDIO MODE first and then set the gains (otherwise EINVAL will be returned when setting the gains) */
+		res = ioctl(masterpvt->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &enableaudio);
+		if (res < 0) {
+			ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d: %s\n", masterpvt->channel, law, strerror(errno));
+		}
 		res = dahdi_setlaw(masterpvt->subs[SUB_REAL].dfd, law);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set law on channel %d: %s\n", masterpvt->channel, strerror(errno));
@@ -12607,11 +12613,12 @@
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set gains on channel %d: %s\n", masterpvt->channel, strerror(errno));
 		}
-		res = ioctl(masterpvt->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &law);
+
+		enableaudio = 1;
+		res = ioctl(peerpvt->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &enableaudio);
 		if (res < 0) {
-			ast_log(LOG_WARNING, "Unable to set audio mode on channel %d to %d: %s\n", masterpvt->channel, law, strerror(errno));
-		}
-
+			ast_log(LOG_WARNING, "Unable to set audio mode on peer channel %d to %d: %s\n", peerpvt->channel, law, strerror(errno));
+		}
 		res = dahdi_setlaw(peerpvt->subs[SUB_REAL].dfd, law);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set law on peer channel %d: %s\n", peerpvt->channel, strerror(errno));
@@ -12619,10 +12626,6 @@
 		res = set_actual_gain(peerpvt->subs[SUB_REAL].dfd, 0, peerpvt->rxgain, peerpvt->txgain, law);
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set gains on peer channel %d: %s\n", peerpvt->channel, strerror(errno));
-		}
-		res = ioctl(peerpvt->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &law);
-		if (res < 0) {
-			ast_log(LOG_WARNING, "Unable to set audio mode on peer channel %d to %d: %s\n", peerpvt->channel, law, strerror(errno));
 		}
 
 		/* the owner for the peer channel will be the same, both dahdi pvt structures will share the owner,




More information about the asterisk-commits mailing list