[svn-commits] rmudgett: branch rmudgett/align_analog r295995 - /team/rmudgett/align_analog/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 23 16:05:42 CST 2010


Author: rmudgett
Date: Tue Nov 23 16:05:37 2010
New Revision: 295995

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295995
Log:
Suppress received audio when sending CW/CID spills.

Modified:
    team/rmudgett/align_analog/channels/chan_dahdi.c

Modified: team/rmudgett/align_analog/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/chan_dahdi.c?view=diff&rev=295995&r1=295994&r2=295995
==============================================================================
--- team/rmudgett/align_analog/channels/chan_dahdi.c (original)
+++ team/rmudgett/align_analog/channels/chan_dahdi.c Tue Nov 23 16:05:37 2010
@@ -492,11 +492,12 @@
 #define MASK_AVAIL		(1 << 0)	/*!< Channel available for PRI use */
 #define MASK_INUSE		(1 << 1)	/*!< Channel currently in use */
 
-#define CALLWAITING_SILENT_SAMPLES	( (300 * 8) / READ_SIZE) /*!< 300 ms */
-#define CALLWAITING_REPEAT_SAMPLES	( (10000 * 8) / READ_SIZE) /*!< 10,000 ms */
-#define CIDCW_EXPIRE_SAMPLES		( (500 * 8) / READ_SIZE) /*!< 500 ms */
-#define MIN_MS_SINCE_FLASH			( (2000) )	/*!< 2000 ms */
-#define DEFAULT_RINGT 				( (8000 * 8) / READ_SIZE) /*!< 8,000 ms */
+#define CALLWAITING_SILENT_SAMPLES		((300 * 8) / READ_SIZE) /*!< 300 ms */
+#define CALLWAITING_REPEAT_SAMPLES		((10000 * 8) / READ_SIZE) /*!< 10,000 ms */
+#define CALLWAITING_SUPPRESS_SAMPLES	((100 * 8) / READ_SIZE) /*!< 100 ms */
+#define CIDCW_EXPIRE_SAMPLES			((500 * 8) / READ_SIZE) /*!< 500 ms */
+#define MIN_MS_SINCE_FLASH				((2000) )	/*!< 2000 ms */
+#define DEFAULT_RINGT 					((8000 * 8) / READ_SIZE) /*!< 8,000 ms */
 
 struct dahdi_pvt;
 
@@ -1054,6 +1055,7 @@
 	int callingpres;				/*!< The value of calling presentation that we're going to use when placing a PRI call */
 	int callwaitingrepeat;				/*!< How many samples to wait before repeating call waiting */
 	int cidcwexpire;				/*!< When to stop waiting for CID/CW CAS response (In samples) */
+	int cid_suppress_expire;		/*!< How many samples to suppress after a CID spill. */
 	/*! \brief Analog caller ID waveform sample buffer */
 	unsigned char *cidspill;
 	/*! \brief Position in the cidspill buffer to send out next. */
@@ -1849,6 +1851,7 @@
 	struct dahdi_pvt *p = pvt;
 	p->callwaitingrepeat = 0;
 	p->cidcwexpire = 0;
+	p->cid_suppress_expire = 0;
 
 	return 0;
 }
@@ -1919,6 +1922,7 @@
 			p->cidlen += READ_SIZE * 4;
 		}
 		p->cidpos = 0;
+		p->cid_suppress_expire = 0;
 		send_callerid(p);
 	}
 	return 0;
@@ -5082,6 +5086,7 @@
 {
 	p->callwaitcas = 0;
 	p->cidcwexpire = 0;
+	p->cid_suppress_expire = 0;
 	if (!(p->cidspill = ast_malloc(MAX_CALLERID_SIZE)))
 		return -1;
 	p->cidlen = ast_callerid_callwaiting_generate(p->cidspill, p->callwait_name, p->callwait_num, AST_LAW(p));
@@ -5144,11 +5149,13 @@
 			return 0;
 		p->cidpos += res;
 	}
+	p->cid_suppress_expire = CALLWAITING_SUPPRESS_SAMPLES;
 	ast_free(p->cidspill);
 	p->cidspill = NULL;
 	if (p->callwaitcas) {
 		/* Wait for CID/CW to expire */
 		p->cidcwexpire = CIDCW_EXPIRE_SAMPLES;
+		p->cid_suppress_expire = p->cidcwexpire;
 	} else
 		restore_conference(p);
 	return 0;
@@ -6364,6 +6371,7 @@
 
 	p->callwaitingrepeat = 0;
 	p->cidcwexpire = 0;
+	p->cid_suppress_expire = 0;
 	p->oprmode = 0;
 	ast->tech_pvt = NULL;
 hangup_out:
@@ -7867,6 +7875,7 @@
 #endif
 					p->callwaitingrepeat = 0;
 					p->cidcwexpire = 0;
+					p->cid_suppress_expire = 0;
 					p->owner = NULL;
 					/* Don't start streaming audio yet if the incoming call isn't up yet */
 					if (p->subs[SUB_REAL].owner->_state != AST_STATE_UP)
@@ -8207,6 +8216,7 @@
 				}
 				p->callwaitingrepeat = 0;
 				p->cidcwexpire = 0;
+				p->cid_suppress_expire = 0;
 				/* Start music on hold if appropriate */
 				if (!p->subs[SUB_CALLWAIT].inthreeway && ast_bridged_channel(p->subs[SUB_CALLWAIT].owner)) {
 					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
@@ -8539,6 +8549,7 @@
 				dahdi_ring_phone(p);
 				p->callwaitingrepeat = 0;
 				p->cidcwexpire = 0;
+				p->cid_suppress_expire = 0;
 			} else
 				ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
 			update_conf(p);
@@ -8570,6 +8581,7 @@
 				}
 				p->callwaitingrepeat = 0;
 				p->cidcwexpire = 0;
+				p->cid_suppress_expire = 0;
 				if (ast_bridged_channel(p->owner))
 					ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 				p->subs[SUB_REAL].needunhold = 1;
@@ -8849,6 +8861,9 @@
 				ast_verb(3, "CPE does not support Call Waiting Caller*ID.\n");
 				restore_conference(p);
 			}
+		}
+		if (p->cid_suppress_expire) {
+			--p->cid_suppress_expire;
 		}
 		if (p->callwaitingrepeat) {
 			if (!--p->callwaitingrepeat) {
@@ -8968,6 +8983,18 @@
 				analog_handle_dtmf(p->sig_pvt, ast, idx, &f);
 			} else {
 				dahdi_handle_dtmf(ast, idx, &f);
+			}
+			break;
+		case AST_FRAME_VOICE:
+			if (p->cidspill || p->cid_suppress_expire) {
+				/* We are/were sending a caller id spill.  Suppress any echo. */
+				p->subs[idx].f.frametype = AST_FRAME_NULL;
+				p->subs[idx].f.subclass.integer = 0;
+				p->subs[idx].f.samples = 0;
+				p->subs[idx].f.mallocd = 0;
+				p->subs[idx].f.offset = 0;
+				p->subs[idx].f.data.ptr = NULL;
+				p->subs[idx].f.datalen= 0;
 			}
 			break;
 		default:




More information about the svn-commits mailing list