[asterisk-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r206275 - /team/jpeeler/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 13 16:25:56 CDT 2009


Author: jpeeler
Date: Mon Jul 13 16:25:52 2009
New Revision: 206275

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206275
Log:
move onhooktime, fxshookstate, and msgstate from the dahdi_pvt to sig_analog

Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c?view=diff&rev=206275&r1=206274&r2=206275
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Mon Jul 13 16:25:52 2009
@@ -1153,12 +1153,6 @@
 	struct ast_event_sub *mwi_event_sub;
 	/*! \brief Delayed dialing for E911.  Overlap digits for ISDN. */
 	char dialdest[256];
-	/*! \brief Time the interface went on-hook. */
-	int onhooktime;
-	/*! \brief TRUE if the FXS port is off-hook */
-	int fxsoffhookstate;
-	/*! \brief -1 = unknown, 0 = no messages, 1 = new messages available */
-	int msgstate;
 #ifdef HAVE_DAHDI_LINEREVERSE_VMWI
 	struct dahdi_vmwi_info mwisend_setting;				/*!< Which VMWI methods to use */
 	unsigned int mwisend_fsk: 1;		/*! Variable for enabling FSK MWI handling in chan_dahdi */
@@ -5058,7 +5052,6 @@
 		p->digital = 0;
 		p->faxhandled = 0;
 		p->pulsedial = 0;
-		p->onhooktime = time(NULL);
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 		p->proceeding = 0;
 		p->dialing = 0;
@@ -6516,9 +6509,6 @@
 		case SIG_FXOLS:
 		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) {
 				/* The normal line was hung up */
@@ -6669,7 +6659,6 @@
 		case SIG_FXOLS:
 		case SIG_FXOGS:
 		case SIG_FXOKS:
-			p->fxsoffhookstate = 1;
 			switch (ast->_state) {
 			case AST_STATE_RINGING:
 				dahdi_enable_ec(p);
@@ -9646,7 +9635,6 @@
 		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) {
@@ -9794,9 +9782,6 @@
 			res = tone_zone_play_tone(i->subs[SUB_REAL].dfd, -1);
 			return -1;
 		}
-		if (i->sig & __DAHDI_SIG_FXO) {
-			i->fxsoffhookstate = 0;
-		}
 		break;
 	case DAHDI_EVENT_POLARITY:
 		switch (i->sig) {
@@ -9959,12 +9944,13 @@
 				if (!found && ((i == last) || ((i == iflist) && !last))) {
 					last = i;
 					if (last) {
+						struct analog_pvt *analog_p = last->sig_pvt;
 						/* 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)) {
+								!analog_p->fxsoffhookstate && !last->owner &&
+								!ast_strlen_zero(last->mailbox) && (thispass - analog_p->onhooktime > 3)) {
 							res = has_voicemail(last);
-							if (last->msgstate != res) {
+							if (analog_p->msgstate != res) {
 								/* Set driver resources for signalling VMWI */
 								res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_VMWI, &res);
 								if (res2) {
@@ -9975,7 +9961,7 @@
 								if (mwi_send_init(last)) {
 									ast_log(LOG_WARNING, "Unable to initiate mwi send sequence on channel %d\n", last->channel);
 								}
-								last->msgstate = res;
+								analog_p->msgstate = res;
 								found ++;
 							}
 						}
@@ -10904,23 +10890,12 @@
 				AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
 				AST_EVENT_IE_END);
 		}
-		tmp->msgstate = -1;
 #ifdef HAVE_DAHDI_LINEREVERSE_VMWI
 		tmp->mwisend_setting = conf->chan.mwisend_setting;
 		tmp->mwisend_fsk  = conf->chan.mwisend_fsk;
 		tmp->mwisend_rpas = conf->chan.mwisend_rpas;
 #endif
-		if (chan_sig & __DAHDI_SIG_FXO) {
-			memset(&p, 0, sizeof(p));
-			res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
-			if (!res) {
-				tmp->fxsoffhookstate = p.rxisoffhook;
-			}
-#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
-			res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_VMWI_CONFIG, &tmp->mwisend_setting);
-#endif
-		}
-		tmp->onhooktime = time(NULL);
+		
 		tmp->group = conf->chan.group;
 		tmp->callgroup = conf->chan.callgroup;
 		tmp->pickupgroup= conf->chan.pickupgroup;
@@ -11022,7 +10997,19 @@
 				analog_p->ringt = conf->chan.ringt;
 				analog_p->ringt_base = ringt_base;
 				analog_p->chan_tech = &dahdi_tech;
-	
+				analog_p->onhooktime = time(NULL);
+				if (chan_sig & __DAHDI_SIG_FXO) {
+					memset(&p, 0, sizeof(p));
+					res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
+					if (!res) {
+						analog_p->fxsoffhookstate = p.rxisoffhook;
+					}
+#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
+					res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_VMWI_CONFIG, &tmp->mwisend_setting);
+#endif
+				}
+				analog_p->msgstate = -1;
+
 				ast_copy_string(analog_p->mohsuggest, conf->chan.mohsuggest, sizeof(analog_p->mohsuggest));
 				ast_copy_string(analog_p->cid_num, conf->chan.cid_num, sizeof(analog_p->cid_num));
 				ast_copy_string(analog_p->cid_name, conf->chan.cid_name, sizeof(analog_p->cid_name));

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=206275&r1=206274&r2=206275
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Mon Jul 13 16:25:52 2009
@@ -1055,6 +1055,7 @@
 		p->owner = NULL;
 		p->ringt = 0;
 		p->outgoing = 0;
+		p->onhooktime = time(NULL);
 
 		/* Perform low level hangup if no owner left */
 		res = analog_on_hook(p);
@@ -2208,6 +2209,9 @@
 		case ANALOG_SIG_FXOLS:
 		case ANALOG_SIG_FXOGS:
 		case ANALOG_SIG_FXOKS:
+			p->fxsoffhookstate = 0;
+			p->onhooktime = time(NULL);
+			p->msgstate = -1;
 			/* Check for some special conditions regarding call waiting */
 			if (index == ANALOG_SUB_REAL) {
 				/* The normal line was hung up */
@@ -2339,6 +2343,7 @@
 		case ANALOG_SIG_FXOLS:
 		case ANALOG_SIG_FXOGS:
 		case ANALOG_SIG_FXOKS:
+			p->fxsoffhookstate = 1;
 			switch (ast->_state) {
 			case AST_STATE_RINGING:
 				analog_set_echocanceller(p, 1);
@@ -2952,6 +2957,7 @@
 		case ANALOG_SIG_FXOGS:
 		case ANALOG_SIG_FXOKS:
 			res = analog_off_hook(i);
+			i->fxsoffhookstate = 1;
 			if (res && (errno == EBUSY))
 				break;
 			if (i->immediate) {
@@ -3052,6 +3058,7 @@
 		switch (i->sig) {
 		case ANALOG_SIG_FXOLS:
 		case ANALOG_SIG_FXOGS:
+			i->fxsoffhookstate = 0;
 		case ANALOG_SIG_FEATD:
 		case ANALOG_SIG_FEATDMF:
 		case ANALOG_SIG_FEATDMF_TA:
@@ -3075,6 +3082,7 @@
 			analog_on_hook(i);
 			break;
 		case ANALOG_SIG_FXOKS:
+			i->fxsoffhookstate = 0;
 			analog_set_echocanceller(i, 0);
 			/* Diddle the battery for the zhone */
 #ifdef ZHONE_HACK

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h?view=diff&rev=206275&r1=206274&r2=206275
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Mon Jul 13 16:25:52 2009
@@ -216,8 +216,12 @@
 	/* All members after this are giong to be transient, and most will probably change */
 	struct ast_channel *owner;			/*!< Our current active owner (if applicable) */
 
-	struct analog_subchannel subs[3];			/*!< Sub-channels */
+	struct analog_subchannel subs[3];		/*!< Sub-channels */
 	struct analog_dialoperation dop;
+	int onhooktime;							/*< Time the interface went on-hook. */
+	int fxsoffhookstate;					/*< TRUE if the FXS port is off-hook */
+	/*! \brief -1 = unknown, 0 = no messages, 1 = new messages available */
+	int msgstate;
 
 	/* XXX: Option Variables - Set by allocator of private structure */
 	unsigned int answeronpolarityswitch:1;




More information about the asterisk-commits mailing list