[asterisk-commits] rmudgett: branch rmudgett/align_analog r295989 - /team/rmudgett/align_analog/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 23 14:02:02 CST 2010


Author: rmudgett
Date: Tue Nov 23 14:01:57 2010
New Revision: 295989

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=295989
Log:
Allow native bridging to be used if call waiting is not enabled.

* Some struct analog_pvt.callwaitcas optimizations.

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

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=295989&r1=295988&r2=295989
==============================================================================
--- team/rmudgett/align_analog/channels/chan_dahdi.c (original)
+++ team/rmudgett/align_analog/channels/chan_dahdi.c Tue Nov 23 14:01:57 2010
@@ -2241,6 +2241,13 @@
 	return 0;
 }
 
+static void my_set_callwaiting(void *pvt, int callwaiting_enable)
+{
+	struct dahdi_pvt *p = pvt;
+
+	p->callwaiting = callwaiting_enable;
+}
+
 static void my_cancel_cidspill(void *pvt)
 {
 	struct dahdi_pvt *p = pvt;
@@ -3548,6 +3555,7 @@
 	.check_waitingfordt = my_check_waitingfordt,
 	.set_confirmanswer = my_set_confirmanswer,
 	.check_confirmanswer = my_check_confirmanswer,
+	.set_callwaiting = my_set_callwaiting,
 	.cancel_cidspill = my_cancel_cidspill,
 	.confmute = my_confmute,
 	.set_pulsedial = my_set_pulsedial,
@@ -7053,7 +7061,8 @@
 		return AST_BRIDGE_RETRY;
 	}
 
-	if (p0->callwaitingcallerid || p1->callwaitingcallerid) {
+	if ((p0->callwaiting && p0->callwaitingcallerid)
+		|| (p1->callwaiting && p1->callwaitingcallerid)) {
 		/*
 		 * Call Waiting Caller ID requires DTMF detection to know if it
 		 * can send the CID spill.

Modified: team/rmudgett/align_analog/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/sig_analog.c?view=diff&rev=295989&r1=295988&r2=295989
==============================================================================
--- team/rmudgett/align_analog/channels/sig_analog.c (original)
+++ team/rmudgett/align_analog/channels/sig_analog.c Tue Nov 23 14:01:57 2010
@@ -859,10 +859,7 @@
 
 static int analog_stop_callwait(struct analog_pvt *p)
 {
-	if (p->callwaitingcallerid) {
-		p->callwaitcas = 0;
-	}
-
+	p->callwaitcas = 0;
 	if (p->calls->stop_callwait) {
 		return p->calls->stop_callwait(p->chan_pvt);
 	}
@@ -871,13 +868,19 @@
 
 static int analog_callwait(struct analog_pvt *p)
 {
-	if (p->callwaitingcallerid) {
-		p->callwaitcas = 1;
-	}
+	p->callwaitcas = p->callwaitingcallerid;
 	if (p->calls->callwait) {
 		return p->calls->callwait(p->chan_pvt);
 	}
 	return 0;
+}
+
+static void analog_set_callwaiting(struct analog_pvt *p, int callwaiting_enable)
+{
+	p->callwaiting = callwaiting_enable;
+	if (p->calls->set_callwaiting) {
+		p->calls->set_callwaiting(p->chan_pvt, callwaiting_enable);
+	}
 }
 
 static void analog_set_cadence(struct analog_pvt *p, struct ast_channel *chan)
@@ -1456,7 +1459,7 @@
 		ast_channel_setoption(ast,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0);
 		ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
 		p->callwaitcas = 0;
-		p->callwaiting = p->permcallwaiting;
+		analog_set_callwaiting(p, p->permcallwaiting);
 		p->hidecallerid = p->permhidecallerid;
 		analog_set_dialing(p, 0);
 		analog_update_conf(p);
@@ -2132,7 +2135,7 @@
 			} else if (p->callwaiting && !strcmp(exten, "*70")) {
 				ast_verb(3, "Disabling call waiting on %s\n", chan->name);
 				/* Disable call waiting if enabled */
-				p->callwaiting = 0;
+				analog_set_callwaiting(p, 0);
 				res = analog_play_tone(p, idx, ANALOG_TONE_DIALRECALL);
 				if (res) {
 					ast_log(LOG_WARNING, "Unable to do dial recall on channel %s: %s\n",
@@ -3845,7 +3848,7 @@
 		p->permcallwaiting = 0;
 	}
 
-	p->callwaiting = p->permcallwaiting;
+	analog_set_callwaiting(p, p->permcallwaiting);
 
 	return 0;
 }

Modified: team/rmudgett/align_analog/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/align_analog/channels/sig_analog.h?view=diff&rev=295989&r1=295988&r2=295989
==============================================================================
--- team/rmudgett/align_analog/channels/sig_analog.h (original)
+++ team/rmudgett/align_analog/channels/sig_analog.h Tue Nov 23 14:01:57 2010
@@ -228,6 +228,7 @@
 	int (* const check_waitingfordt)(void *pvt);
 	void (* const set_confirmanswer)(void *pvt, int flag);
 	int (* const check_confirmanswer)(void *pvt);
+	void (* const set_callwaiting)(void *pvt, int callwaiting_enable);
 	void (* const cancel_cidspill)(void *pvt);
 	int (* const confmute)(void *pvt, int mute);	
 	void (* const set_pulsedial)(void *pvt, int flag);
@@ -271,14 +272,14 @@
 	unsigned int dahditrcallerid:1;			/*!< should we use the callerid from incoming call on dahdi transfer or not */
 	unsigned int hanguponpolarityswitch:1;
 	unsigned int immediate:1;
-	unsigned int permcallwaiting:1;
+	unsigned int permcallwaiting:1;			/*!< TRUE if call waiting is enabled. (Configured option) */
 	unsigned int permhidecallerid:1;		/*!< Whether to hide our outgoing caller ID or not */
 	unsigned int pulse:1;
 	unsigned int threewaycalling:1;
 	unsigned int transfer:1;
 	unsigned int transfertobusy:1;			/*!< allow flash-transfers to busy channels */
 	unsigned int use_callerid:1;			/*!< Whether or not to use caller id on this channel */
-	unsigned int callwaitingcallerid:1;
+	unsigned int callwaitingcallerid:1;		/*!< TRUE if send caller ID for Call Waiting */
 	/*!
 	 * \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
 	 */
@@ -289,6 +290,7 @@
 
 	/* Not used for anything but log messages.  Could be just the TCID */
 	int channel;					/*!< Channel Number */
+
 	enum analog_sigtype outsigmod;
 	int echotraining;
 	int cid_signalling;				/*!< Asterisk callerid type we're using */
@@ -301,13 +303,21 @@
 
 
 	/* XXX: All variables after this are internal */
-	unsigned int callwaiting:1;
+	unsigned int callwaiting:1;		/*!< TRUE if call waiting is enabled. (Active option) */
 	unsigned int dialednone:1;
 	unsigned int dialing:1;			/*!< TRUE if in the process of dialing digits or sending something */
 	unsigned int dnd:1;				/*!< TRUE if Do-Not-Disturb is enabled. */
 	unsigned int echobreak:1;
 	unsigned int hidecallerid:1;
 	unsigned int outgoing:1;
+	unsigned int inalarm:1;
+	/*!
+	 * \brief TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
+	 * \note
+	 * After CAS is sent, the call waiting caller id will be sent if the phone
+	 * gives a positive reply.
+	 */
+	unsigned int callwaitcas:1;
 
 	char callwait_num[AST_MAX_EXTENSION];
 	char callwait_name[AST_MAX_EXTENSION];
@@ -331,10 +341,6 @@
 	struct ast_channel *ss_astchan;
 
 	/* All variables after this are definitely going to be audited */
-	unsigned int inalarm:1;
-
-	int callwaitcas;
-
 	int ringt;
 	int ringt_base;
 };




More information about the asterisk-commits mailing list