[asterisk-commits] dbailey: trunk r168619 - /trunk/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 14 15:19:45 CST 2009


Author: dbailey
Date: Wed Jan 14 15:19:45 2009
New Revision: 168619

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168619
Log:
This fixes a problem where MWI FSK spills were being injected onto off hook fxs lines.
(closes issue #14143)
Reported by: alecdavis
Patches:
      chan_dahdi-14143.patch.txt uploaded by dbailey (license )
Tested by: alecdavis


Modified:
    trunk/channels/chan_dahdi.c

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=168619&r1=168618&r2=168619
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jan 14 15:19:45 2009
@@ -728,6 +728,7 @@
 	struct ast_event_sub *mwi_event_sub;
 	char dialdest[256];
 	int onhooktime;
+	int fxsoffhookstate;
 	int msgstate;
 	int distinctivering;				/*!< Which distinctivering to use */
 	int cidrings;					/*!< Which ring to deliver CID on */
@@ -3433,6 +3434,7 @@
 					tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
 				else
 					tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
+				p->fxsoffhookstate = par.rxisoffhook;
 			}
 			break;
 		case SIG_FXSGS:
@@ -4648,6 +4650,7 @@
 			case SIG_FXOGS:
 			case SIG_FXOKS:
 				p->onhooktime = time(NULL);
+				p->fxsoffhookstate = 0;
 				p->msgstate = -1;
 				/* Check for some special conditions regarding call waiting */
 				if (idx == SUB_REAL) {
@@ -4799,6 +4802,7 @@
 			case SIG_FXOLS:
 			case SIG_FXOGS:
 			case SIG_FXOKS:
+				p->fxsoffhookstate = 1;
 				switch (ast->_state) {
 				case AST_STATE_RINGING:
 					dahdi_enable_ec(p);
@@ -7887,6 +7891,7 @@
 		case SIG_FXOGS:
 		case SIG_FXOKS:
 			res = dahdi_set_hook(i->subs[SUB_REAL].dfd, DAHDI_OFFHOOK);
+			i->fxsoffhookstate = 1;
 			if (res && (errno == EBUSY))
 				break;
 			if (i->cidspill) {
@@ -8040,6 +8045,9 @@
 			res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
 			return -1;
 		}
+		if (i->sig == SIG_FXOLS || i->sig == SIG_FXOGS || i->sig == SIG_FXOKS) {
+			i->fxsoffhookstate = 0;
+		}
 		break;
 	case DAHDI_EVENT_POLARITY:
 		switch (i->sig) {
@@ -8182,7 +8190,10 @@
 				if (!found && ((i == last) || ((i == iflist) && !last))) {
 					last = i;
 					if (last) {
-						if (!last->mwisendactive &&	 last->sig & __DAHDI_SIG_FXO) {
+						/* Only allow MWI to be initiated on a quiescent fxs port */
+						if (!last->mwisendactive &&	last->sig & __DAHDI_SIG_FXO &&
+								!last->fxsoffhookstate && !last->owner &&
+								!ast_strlen_zero(last->mailbox) && (thispass - last->onhooktime > 3)) {
 							res = has_voicemail(last);
 							if (last->msgstate != res) {
 								/* Set driver resources for signalling VMWI */
@@ -8948,6 +8959,14 @@
 				AST_EVENT_IE_END);
 		}
 		tmp->msgstate = -1;
+		if ((chan_sig == SIG_FXOKS) || (chan_sig == SIG_FXOLS) || (chan_sig == SIG_FXOGS)) {
+			memset(&p, 0, sizeof(p));
+			res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
+			if (!res) {
+				tmp->fxsoffhookstate = p.rxisoffhook;
+			}
+		}
+		tmp->onhooktime = time(NULL);
 		tmp->group = conf->chan.group;
 		tmp->callgroup = conf->chan.callgroup;
 		tmp->pickupgroup= conf->chan.pickupgroup;
@@ -8958,7 +8977,6 @@
 		tmp->rxgain = conf->chan.rxgain;
 		tmp->txgain = conf->chan.txgain;
 		tmp->tonezone = conf->chan.tonezone;
-		tmp->onhooktime = time(NULL);
 		if (tmp->subs[SUB_REAL].dfd > -1) {
 			set_actual_gain(tmp->subs[SUB_REAL].dfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
 			if (tmp->dsp)




More information about the asterisk-commits mailing list