[asterisk-commits] rmudgett: trunk r169910 - /trunk/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 21 18:23:30 CST 2009


Author: rmudgett
Date: Wed Jan 21 18:23:30 2009
New Revision: 169910

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=169910
Log:
Whitespace changes only

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=169910&r1=169909&r2=169910
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jan 21 18:23:30 2009
@@ -21,8 +21,8 @@
  * \brief DAHDI for Pseudo TDM
  *
  * \author Mark Spencer <markster at digium.com>
- * 
- * Connects to the DAHDI telephony library as well as 
+ *
+ * Connects to the DAHDI telephony library as well as
  * libpri. Libpri is optional and needed only if you are
  * going to use ISDN connections.
  *
@@ -120,7 +120,7 @@
 		</synopsis>
 		<syntax argsep=",">
 			<parameter name="destination" required="true">
-				<para>Destination number.</para>	
+				<para>Destination number.</para>
 			</parameter>
 			<parameter name="original">
 				<para>Original called number.</para>
@@ -162,7 +162,7 @@
 /* define this to send PRI user-user information elements */
 #undef SUPPORT_USERUSER
 
-/*! 
+/*!
  * \note Define ZHONE_HACK to cause us to go off hook and then back on hook when
  * the user hangs up to reset the state machine so ring works properly.
  * This is used to be able to support kewlstart by putting the zhone in
@@ -189,14 +189,14 @@
 
 
 /*! \brief Signaling types that need to use MF detection should be placed in this macro */
-#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB)) 
+#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB))
 
 static const char tdesc[] = "DAHDI Telephony Driver"
 #ifdef HAVE_PRI
-               " w/PRI"
+	" w/PRI"
 #endif
 #ifdef HAVE_SS7
-	       " w/SS7"
+	" w/SS7"
 #endif
 ;
 
@@ -543,7 +543,7 @@
 #define MAX_SLAVES	4
 
 /* States for sending MWI message
- * First three states are required for send Ring Pulse Alert Signal 
+ * First three states are required for send Ring Pulse Alert Signal
  */
 typedef enum {
  MWI_SEND_NULL = 0,
@@ -564,7 +564,7 @@
 	ast_mutex_t lock;
 	struct ast_channel *owner;			/*!< Our current active owner (if applicable) */
 							/*!< Up to three channels can be associated with this call */
-		
+
 	struct dahdi_subchannel sub_unused;		/*!< Just a safety precaution */
 	struct dahdi_subchannel subs[3];			/*!< Sub-channels */
 	struct dahdi_confinfo saveconf;			/*!< Saved conference info */
@@ -572,7 +572,7 @@
 	struct dahdi_pvt *slaves[MAX_SLAVES];		/*!< Slave to us (follows our conferencing) */
 	struct dahdi_pvt *master;				/*!< Master to us (we follow their conferencing) */
 	int inconference;				/*!< If our real should be in the conference */
-	
+
 	int buf_no;					/*!< Number of buffers */
 	int buf_policy;				/*!< Buffer policy */
 	int sig;					/*!< Signalling style */
@@ -643,7 +643,7 @@
 	unsigned int locallyblocked:1;
 	unsigned int remotelyblocked:1;
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
-	unsigned int rlt:1;	
+	unsigned int rlt:1;
 	unsigned int alerting:1;
 	unsigned int alreadyhungup:1;
 	unsigned int isidlecall:1;
@@ -747,7 +747,7 @@
 	q931_call *call;
 	int prioffset;
 	int logicalspan;
-#endif	
+#endif
 	int polarity;
 	int dsp_features;
 #ifdef HAVE_SS7
@@ -787,7 +787,7 @@
  * Generally there is a field here for every possible configuration item.
  *
  * The state of fields is saved along the parsing and whenever a 'channel'
- * statement is reached, the current dahdi_chan_conf is used to configure the 
+ * statement is reached, the current dahdi_chan_conf is used to configure the
  * channel (struct dahdi_pvt)
  *
  * \see dahdi_chan_init for the default values.
@@ -808,7 +808,8 @@
 };
 
 /*! returns a new dahdi_chan_conf with default values (by-value) */
-static struct dahdi_chan_conf dahdi_chan_conf_default(void) {
+static struct dahdi_chan_conf dahdi_chan_conf_default(void)
+{
 	/* recall that if a field is not included here it is initialized
 	 * to 0 or equivalent
 	 */
@@ -877,7 +878,7 @@
 			.polarityonanswerdelay = 600,
 
 			.sendcalleridafter = DEFAULT_CIDRINGS,
-		
+
 			.buf_policy = DAHDI_POLICY_IMMEDIATE,
 			.buf_no = numbufs
 		},
@@ -1041,7 +1042,7 @@
 #ifdef HAVE_PRI
 	if (pri)
 		ast_mutex_unlock(&pri->lock);
-#endif			
+#endif
 	for (;;) {
 		if (p->subs[a].owner) {
 			if (ast_channel_trylock(p->subs[a].owner)) {
@@ -1057,7 +1058,7 @@
 #ifdef HAVE_PRI
 	if (pri)
 		ast_mutex_lock(&pri->lock);
-#endif			
+#endif
 }
 
 static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f, void *data)
@@ -1088,7 +1089,7 @@
 			break;
 		}
 	}
-#endif		
+#endif
 	for (;;) {
 		if (p->owner) {
 			if (ast_channel_trylock(p->owner)) {
@@ -1120,8 +1121,7 @@
 			break;
 		}
 	}
-
-#endif		
+#endif
 }
 
 static int restore_gains(struct dahdi_pvt *p);
@@ -1146,9 +1146,9 @@
 	p->subs[b].owner = towner;
 	p->subs[b].inthreeway = tinthreeway;
 
-	if (p->subs[a].owner) 
+	if (p->subs[a].owner)
 		ast_channel_set_fd(p->subs[a].owner, 0, p->subs[a].dfd);
-	if (p->subs[b].owner) 
+	if (p->subs[b].owner)
 		ast_channel_set_fd(p->subs[b].owner, 0, p->subs[b].dfd);
 	wakeup_sub(p, a, NULL);
 	wakeup_sub(p, b, NULL);
@@ -1263,7 +1263,7 @@
 		if (res < 0) {
 			ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d: %s\n", x, strerror(errno));
 		}
-	} else 
+	} else
 		ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d: %s\n", x, strerror(errno));
 
 	if (ioctl(p->subs[x].dfd, DAHDI_CHANNO, &p->subs[x].chan) == 1) {
@@ -1314,7 +1314,7 @@
 	struct dahdi_pvt *pvt;
 	int idx;
 	int dtmf = -1;
-	
+
 	pvt = chan->tech_pvt;
 
 	ast_mutex_lock(&pvt->lock);
@@ -1325,7 +1325,7 @@
 		goto out;
 
 #ifdef HAVE_PRI
-	if (((pvt->sig == SIG_PRI) || (pvt->sig == SIG_BRI) || (pvt->sig == SIG_BRI_PTMP)) 
+	if (((pvt->sig == SIG_PRI) || (pvt->sig == SIG_BRI) || (pvt->sig == SIG_BRI_PTMP))
 			&& (chan->_state == AST_STATE_DIALING) && !pvt->proceeding) {
 		if (pvt->setup_ack) {
 			if (!pri_grab(pvt, pvt->pri)) {
@@ -1377,11 +1377,11 @@
 	int res = 0;
 	int idx;
 	int x;
-	
+
 	pvt = chan->tech_pvt;
 
 	ast_mutex_lock(&pvt->lock);
-	
+
 	idx = dahdi_get_index(chan, pvt, 0);
 
 	if ((idx != SUB_REAL) || !pvt->owner || pvt->pulse)
@@ -1545,7 +1545,7 @@
 	/* If the conference already exists, and we're already in it
 	   don't bother doing anything */
 	struct dahdi_confinfo zi;
-	
+
 	memset(&zi, 0, sizeof(zi));
 	zi.chan = 0;
 
@@ -1580,7 +1580,7 @@
 
 static int isourconf(struct dahdi_pvt *p, struct dahdi_subchannel *c)
 {
-	/* If they're listening to our channel, they're ours */	
+	/* If they're listening to our channel, they're ours */
 	if ((p->channel == c->curconf.confno) && (c->curconf.confmode == DAHDI_CONF_DIGITALMON))
 		return 1;
 	/* If they're a talker on our (allocated) conference, they're ours */
@@ -1631,7 +1631,7 @@
 		for (x = 0; x < MAX_SLAVES; x++) {
 			if (p->slaves[x]) {
 				if (slave) {
-					/* Whoops already have a slave!  No 
+					/* Whoops already have a slave!  No
 					   slave native and stop right away */
 					slave = NULL;
 					useslavenative = 0;
@@ -1746,7 +1746,7 @@
 				ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
 		}
 		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
-		if (res)  {
+		if (res) {
 			ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
 		} else {
 			p->echocanon = 1;
@@ -1760,7 +1760,7 @@
 {
 	int x;
 	int res;
-	
+
 	if (p && p->echocanon && p->echotraining) {
 		x = p->echotraining;
 		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOTRAIN, &x);
@@ -2152,7 +2152,7 @@
 	}
 	p->cidpos = 0;
 	send_callerid(p);
-	
+
 	return 0;
 }
 
@@ -2195,7 +2195,7 @@
 	if ((p->radio || (p->oprmode < 0)))  /* if a radio channel, up immediately */
 	{
 		/* Special pseudo -- automatically up */
-		ast_setstate(ast, AST_STATE_UP); 
+		ast_setstate(ast, AST_STATE_UP);
 		ast_mutex_unlock(&p->lock);
 		return 0;
 	}
@@ -2217,7 +2217,7 @@
 	case SIG_FXOKS:
 		if (p->owner == ast) {
 			/* Normal ring, on hook */
-			
+
 			/* Don't send audio while on hook, until the call is answered */
 			p->dialing = 1;
 			if (p->use_callerid) {
@@ -2285,7 +2285,6 @@
 			/* Make ring-back */
 			if (tone_zone_play_tone(p->subs[SUB_CALLWAIT].dfd, DAHDI_TONE_RINGTONE))
 				ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
-				
 		}
 		n = ast->cid.cid_name;
 		l = ast->cid.cid_num;
@@ -2355,14 +2354,14 @@
 		switch (mysig) {
 		case SIG_FEATD:
 			l = ast->cid.cid_num;
-			if (l) 
+			if (l)
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c);
 			else
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T**%s*", c);
 			break;
 		case SIG_FEATDMF:
 			l = ast->cid.cid_num;
-			if (l) 
+			if (l)
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
 			else
 				snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*02#*%s#", c);
@@ -2449,7 +2448,7 @@
 	case 0:
 		/* Special pseudo -- automatically up*/
 		ast_setstate(ast, AST_STATE_UP);
-		break;		
+		break;
 	case SIG_PRI:
 	case SIG_BRI:
 	case SIG_BRI_PTMP:
@@ -2548,17 +2547,17 @@
 		charge_str = pbx_builtin_getvar_helper(ast, "SS7_CHARGE_NUMBER");
 		if (charge_str)
 			isup_set_charge(p->ss7call, charge_str, SS7_ANI_CALLING_PARTY_SUB_NUMBER, 0x10);
-		
+
 		gen_address = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_ADDRESS");
 		if (gen_address)
 			isup_set_gen_address(p->ss7call, gen_address, p->gen_add_nai,p->gen_add_pres_ind, p->gen_add_num_plan,p->gen_add_type); /* need to add some types here for NAI,PRES,TYPE */
-		
+
 		gen_digits = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGITS");
 		gen_dig_type = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGTYPE");
 		gen_dig_scheme = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_DIGSCHEME");
 		if (gen_digits)
-			isup_set_gen_digits(p->ss7call, gen_digits, atoi(gen_dig_type), atoi(gen_dig_scheme)); 
-		
+			isup_set_gen_digits(p->ss7call, gen_digits, atoi(gen_dig_type), atoi(gen_dig_scheme));
+
 		gen_name = pbx_builtin_getvar_helper(ast, "SS7_GENERIC_NAME");
 		if (gen_name)
 			isup_set_generic_name(p->ss7call, gen_name, GEN_NAME_TYPE_CALLING_NAME, GEN_NAME_AVAIL_AVAILABLE, GEN_NAME_PRES_ALLOWED);
@@ -2566,27 +2565,27 @@
 		jip_digits = pbx_builtin_getvar_helper(ast, "SS7_JIP");
 		if (jip_digits)
 			isup_set_jip_digits(p->ss7call, jip_digits);
-		
+
 		lspi_ident = pbx_builtin_getvar_helper(ast, "SS7_LSPI_IDENT");
 		if (lspi_ident)
-			isup_set_lspi(p->ss7call, lspi_ident, 0x18, 0x7, 0x00); 
-		
+			isup_set_lspi(p->ss7call, lspi_ident, 0x18, 0x7, 0x00);
+
 		rlt_flag = pbx_builtin_getvar_helper(ast, "SS7_RLT_ON");
 		if ((rlt_flag) && ((strncmp("NO", rlt_flag, strlen(rlt_flag))) != 0 )) {
 			isup_set_lspi(p->ss7call, rlt_flag, 0x18, 0x7, 0x00); /* Setting for Nortel DMS-250/500 */
 		}
-		
+
 		call_ref_id = pbx_builtin_getvar_helper(ast, "SS7_CALLREF_IDENT");
 		call_ref_pc = pbx_builtin_getvar_helper(ast, "SS7_CALLREF_PC");
 		if (call_ref_id && call_ref_pc) {
 			isup_set_callref(p->ss7call, atoi(call_ref_id),
 					 call_ref_pc ? atoi(call_ref_pc) : 0);
 		}
-		
+
 		send_far = pbx_builtin_getvar_helper(ast, "SS7_SEND_FAR");
 		if ((send_far) && ((strncmp("NO", send_far, strlen(send_far))) != 0 ))
 			(isup_far(p->ss7->ss7, p->ss7call));
-		
+
 		ast_channel_unlock(ast);
 
 		isup_iam(p->ss7->ss7, p->ss7call);
@@ -2678,15 +2677,16 @@
 			else
 				exclusive = 1;
 		}
-		
+
 		pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
-		pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability, 
-					(p->digital ? -1 : 
-						((p->law == DAHDI_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
+		pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
+			(p->digital ? -1 :
+				((p->law == DAHDI_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
 		if (p->pri->facilityenable)
 			pri_facility_enable(p->pri->pri);
 
 		ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", ast->transfercapability, ast_transfercapability2str(ast->transfercapability));
+
 		dp_strip = 0;
  		pridialplan = p->pri->dialplan - 1;
 		if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */
@@ -2845,13 +2845,12 @@
 #ifdef SUPPORT_USERUSER
 		/* User-user info */
 		useruser = pbx_builtin_getvar_helper(p->owner, "USERUSERINFO");
-
 		if (useruser)
 			pri_sr_set_useruser(sr, useruser);
 #endif
 
 		if (pri_setup(p->pri->pri, p->call, sr)) {
- 			ast_log(LOG_WARNING, "Unable to setup call to %s (using %s)\n", 
+ 			ast_log(LOG_WARNING, "Unable to setup call to %s (using %s)\n",
  				c + p->stripmsd + dp_strip, dialplan2str(p->pri->dialplan));
 			pri_rel(p->pri);
 			ast_mutex_unlock(&p->lock);
@@ -2862,7 +2861,7 @@
 		ast_setstate(ast, AST_STATE_DIALING);
 		pri_rel(p->pri);
 	}
-#endif		
+#endif
 	ast_mutex_unlock(&p->lock);
 	return 0;
 }
@@ -2961,7 +2960,7 @@
 		/* Free associated memory */
 		if (pl)
 			destroy_dahdi_pvt(&pl);
-		if (option_verbose > 2) 
+		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_2 "Unregistered channel %d\n", x);
 	}
 	iflist = NULL;
@@ -3124,7 +3123,7 @@
 		return "Quaternary";
 	default:
 		return "<Unknown>";
-	}		
+	}
 }
 
 /* Returns fd of the active dchan */
@@ -3182,9 +3181,9 @@
 		ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
 		return 0;
 	}
-	
+
 	ast_mutex_lock(&p->lock);
-	
+
 	idx = dahdi_get_index(ast, p, 1);
 
 	if ((p->sig == SIG_PRI) || (p->sig == SIG_SS7) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) {
@@ -3200,12 +3199,12 @@
 		ast_copy_string(p->cid_num, p->origcid_num, sizeof(p->cid_num));
 		ast_free(p->origcid_num);
 		p->origcid_num = NULL;
-	}	
+	}
 	if (p->origcid_name) {
 		ast_copy_string(p->cid_name, p->origcid_name, sizeof(p->cid_name));
 		ast_free(p->origcid_name);
 		p->origcid_name = NULL;
-	}	
+	}
 	if (p->dsp)
 		ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_DTMF | p->dtmfrelax);
 	if (p->exten)
@@ -3214,7 +3213,7 @@
 	ast_debug(1, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
 		p->channel, idx, p->subs[SUB_REAL].dfd, p->subs[SUB_CALLWAIT].dfd, p->subs[SUB_THREEWAY].dfd);
 	p->ignoredtmf = 0;
-	
+
 	if (idx > -1) {
 		/* Real channel, do some fixup */
 		p->subs[idx].owner = NULL;
@@ -3284,7 +3283,7 @@
 				/* This is actually part of a three way, placed on hold.  Place the third part
 				   on music on hold now */
 				if (p->subs[SUB_THREEWAY].owner && ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
-					ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD, 
+					ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
 						S_OR(p->mohsuggest, NULL),
 						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 				}
@@ -3299,7 +3298,7 @@
 				/* The other party of the three way call is currently in a call-wait state.
 				   Start music on hold for them, and take the main guy out of the third call */
 				if (p->subs[SUB_CALLWAIT].owner && ast_bridged_channel(p->subs[SUB_CALLWAIT].owner)) {
-					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD, 
+					ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
 						S_OR(p->mohsuggest, NULL),
 						!ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
 				}
@@ -3332,7 +3331,7 @@
 		p->alerting = 0;
 		p->setup_ack = 0;
 		p->rlt = 0;
-#endif		
+#endif
 		if (p->dsp) {
 			ast_dsp_free(p->dsp);
 			p->dsp = NULL;
@@ -3340,7 +3339,7 @@
 
 		law = DAHDI_LAW_DEFAULT;
 		res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
-		if (res < 0) 
+		if (res < 0)
 			ast_log(LOG_WARNING, "Unable to set law on channel %d to default: %s\n", p->channel, strerror(errno));
 		/* Perform low level hangup if no owner left */
 #ifdef HAVE_SS7
@@ -3385,7 +3384,7 @@
 
 						pri_hangup(p->pri->pri, p->call, -1);
 						p->call = NULL;
-						if (p->bearer) 
+						if (p->bearer)
 							p->bearer->call = NULL;
 					} else {
 						const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
@@ -3405,9 +3404,9 @@
 						}
 						pri_hangup(p->pri->pri, p->call, icause);
 					}
-					if (res < 0) 
+					if (res < 0)
 						ast_log(LOG_WARNING, "pri_disconnect failed\n");
-					pri_rel(p->pri);			
+					pri_rel(p->pri);
 				} else {
 					ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
 					res = -1;
@@ -3633,7 +3632,7 @@
 	int idx;
 	struct dahdi_pvt *p = chan->tech_pvt, *pp;
 	struct oprmode *oprmode;
-	
+
 
 	/* all supported options require data */
 	if (!data || (datalen < 1)) {
@@ -3739,7 +3738,7 @@
 				len -= size;
 				buf += size;
 			}
-			p->didtdd = 1; /* set to have done it now */		
+			p->didtdd = 1; /* set to have done it now */
 		}
 		if (*cp == 2) { /* Mate mode */
 			if (p->tdd)
@@ -3747,10 +3746,10 @@
 			p->tdd = 0;
 			p->mate = 1;
 			break;
-		}		
+		}
 		if (!p->tdd) { /* if we dont have one yet */
 			p->tdd = tdd_new(); /* allocate one */
-		}		
+		}
 		break;
 	case AST_OPTION_RELAXDTMF:  /* Relax DTMF decoding (or not) */
 		if (!p->dsp)
@@ -3762,11 +3761,11 @@
 		break;
 	case AST_OPTION_AUDIO_MODE:  /* Set AUDIO mode (or not) */
 		cp = (char *) data;
-		if (!*cp) {		
+		if (!*cp) {
 			ast_debug(1, "Set option AUDIO MODE, value: OFF(0) on %s\n", chan->name);
 			x = 0;
 			dahdi_disable_ec(p);
-		} else {		
+		} else {
 			ast_debug(1, "Set option AUDIO MODE, value: ON(1) on %s\n", chan->name);
 			x = 1;
 		}
@@ -3788,7 +3787,7 @@
 		p->oprpeer = pp;
 		pp->oprpeer = p;
 		/* setup modes, if any */
-		if (oprmode->mode) 
+		if (oprmode->mode)
 		{
 			pp->oprmode = oprmode->mode;
 			p->oprmode = -oprmode->mode;
@@ -3815,15 +3814,15 @@
 static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
 {
 	struct dahdi_pvt *p = chan->tech_pvt;
-	
+
 	if (!strcasecmp(data, "rxgain")) {
 		ast_mutex_lock(&p->lock);
 		snprintf(buf, len, "%f", p->rxgain);
-		ast_mutex_unlock(&p->lock);	
+		ast_mutex_unlock(&p->lock);
 	} else if (!strcasecmp(data, "txgain")) {
 		ast_mutex_lock(&p->lock);
 		snprintf(buf, len, "%f", p->txgain);
-		ast_mutex_unlock(&p->lock);	
+		ast_mutex_unlock(&p->lock);
 	} else {
 		ast_copy_string(buf, "", len);
 	}
@@ -3903,10 +3902,10 @@
 		ast_log(LOG_WARNING, "Replacing slave %d with new slave, %d\n", master->slaves[MAX_SLAVES - 1]->channel, slave->channel);
 		master->slaves[MAX_SLAVES - 1] = slave;
 	}
-	if (slave->master) 
+	if (slave->master)
 		ast_log(LOG_WARNING, "Replacing master %d with new master, %d\n", slave->master->channel, master->channel);
 	slave->master = master;
-	
+
 	ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
 }
 
@@ -4051,7 +4050,7 @@
 			nothingok = 0;
 		}
 	} else if ((oi0 == SUB_REAL) && (oi1 == SUB_CALLWAIT)) {
-		/* We have a real and a call wait.  If we're in a three way call, put us in it, otherwise, 
+		/* We have a real and a call wait.  If we're in a three way call, put us in it, otherwise,
 		   don't put us in anything */
 		if (p1->subs[SUB_CALLWAIT].inthreeway) {
 			master = p1;
@@ -4072,11 +4071,11 @@
 		/* Stop any tones, or play ringtone as appropriate.  If they're bridged
 		   in an active threeway call with a channel that is ringing, we should
 		   indicate ringing. */
-		if ((oi1 == SUB_THREEWAY) && 
-		    p1->subs[SUB_THREEWAY].inthreeway && 
-		    p1->subs[SUB_REAL].owner && 
-		    p1->subs[SUB_REAL].inthreeway && 
-		    (p1->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
+		if ((oi1 == SUB_THREEWAY) &&
+			p1->subs[SUB_THREEWAY].inthreeway &&
+			p1->subs[SUB_REAL].owner &&
+			p1->subs[SUB_REAL].inthreeway &&
+			(p1->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
 			ast_debug(1, "Playing ringback on %s since %s is in a ringing three-way\n", c0->name, c1->name);
 			tone_zone_play_tone(p0->subs[oi0].dfd, DAHDI_TONE_RINGTONE);
 			os1 = p1->subs[SUB_REAL].owner->_state;
@@ -4084,11 +4083,11 @@
 			ast_debug(1, "Stopping tones on %d/%d talking to %d/%d\n", p0->channel, oi0, p1->channel, oi1);
 			tone_zone_play_tone(p0->subs[oi0].dfd, -1);
 		}
-		if ((oi0 == SUB_THREEWAY) && 
-		    p0->subs[SUB_THREEWAY].inthreeway && 
-		    p0->subs[SUB_REAL].owner && 
-		    p0->subs[SUB_REAL].inthreeway && 
-		    (p0->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
+		if ((oi0 == SUB_THREEWAY) &&
+			p0->subs[SUB_THREEWAY].inthreeway &&
+			p0->subs[SUB_REAL].owner &&
+			p0->subs[SUB_REAL].inthreeway &&
+			(p0->subs[SUB_REAL].owner->_state == AST_STATE_RINGING)) {
 			ast_debug(1, "Playing ringback on %s since %s is in a ringing three-way\n", c1->name, c0->name);
 			tone_zone_play_tone(p1->subs[oi1].dfd, DAHDI_TONE_RINGTONE);
 			os0 = p0->subs[SUB_REAL].owner->_state;
@@ -4125,7 +4124,7 @@
 		dahdi_enable_ec(p1);
 		return AST_BRIDGE_FAILED;
 	}
-	
+
 	ast_verb(3, "Native bridging %s and %s\n", c0->name, c1->name);
 
 	if (!(flags & AST_BRIDGE_DTMF_CHANNEL_0) && (oi0 == SUB_REAL))
@@ -4138,9 +4137,9 @@
 		struct ast_channel *c0_priority[2] = {c0, c1};
 		struct ast_channel *c1_priority[2] = {c1, c0};
 
-		/* Here's our main loop...  Start by locking things, looking for private parts, 
+		/* Here's our main loop...  Start by locking things, looking for private parts,
 		   and then balking if anything is wrong */
-		
+
 		ast_channel_lock(c0);
 		while (ast_channel_trylock(c1)) {
 			CHANNEL_DEADLOCK_AVOIDANCE(c0);
@@ -4157,19 +4156,19 @@
 		ast_channel_unlock(c0);
 		ast_channel_unlock(c1);
 
-		if (!timeoutms || 
-		    (op0 != p0) ||
-		    (op1 != p1) || 
-		    (ofd0 != c0->fds[0]) || 
-		    (ofd1 != c1->fds[0]) ||
-		    (p0->subs[SUB_REAL].owner && (os0 > -1) && (os0 != p0->subs[SUB_REAL].owner->_state)) || 
-		    (p1->subs[SUB_REAL].owner && (os1 > -1) && (os1 != p1->subs[SUB_REAL].owner->_state)) || 
-		    (oc0 != p0->owner) || 
-		    (oc1 != p1->owner) ||
-		    (t0 != p0->subs[SUB_REAL].inthreeway) ||
-		    (t1 != p1->subs[SUB_REAL].inthreeway) ||
-		    (oi0 != i0) ||
-		    (oi1 != i1)) {
+		if (!timeoutms ||
+			(op0 != p0) ||
+			(op1 != p1) ||
+			(ofd0 != c0->fds[0]) ||
+			(ofd1 != c1->fds[0]) ||
+			(p0->subs[SUB_REAL].owner && (os0 > -1) && (os0 != p0->subs[SUB_REAL].owner->_state)) ||
+			(p1->subs[SUB_REAL].owner && (os1 > -1) && (os1 != p1->subs[SUB_REAL].owner->_state)) ||
+			(oc0 != p0->owner) ||
+			(oc1 != p1->owner) ||
+			(t0 != p0->subs[SUB_REAL].inthreeway) ||
+			(t1 != p1->subs[SUB_REAL].inthreeway) ||
+			(oi0 != i0) ||
+			(oi1 != i1)) {
 			ast_debug(1, "Something changed out on %d/%d to %d/%d, returning -3 to restart\n",
 				op0->channel, oi0, op1->channel, oi1);
 			res = AST_BRIDGE_RETRY;
@@ -4179,9 +4178,9 @@
 #ifdef PRI_2BCT
 		q931c0 = p0->call;
 		q931c1 = p1->call;
-		if (p0->transfer && p1->transfer 
-		    && q931c0 && q931c1 
-		    && !triedtopribridge) {
+		if (p0->transfer && p1->transfer
+			&& q931c0 && q931c1
+			&& !triedtopribridge) {
 			pri_channel_bridge(q931c0, q931c1);
 			triedtopribridge = 1;
 		}
@@ -4212,7 +4211,7 @@
 			}
 		}
 		ast_frfree(f);
-		
+
 		/* Swap who gets priority */
 		priority = !priority;
 	}
@@ -4250,7 +4249,7 @@
 				dahdi_unlink(NULL, p, 0);
 			p->subs[x].owner = newchan;
 		}
-	if (newchan->_state == AST_STATE_RINGING) 
+	if (newchan->_state == AST_STATE_RINGING)
 		dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
 	update_conf(p);
 	ast_mutex_unlock(&p->lock);
@@ -4354,7 +4353,7 @@
 		ast_log(LOG_WARNING, "Failed to get conference info on channel %d: %s\n", p->channel, strerror(errno));
 		return 0;
 	}
-	/* If we have no master and don't have a confno, then 
+	/* If we have no master and don't have a confno, then
 	   if we're in a conference, it's probably a MeetMe room or
 	   some such, so don't let us 3-way out! */
 	if ((p->subs[SUB_REAL].curconf.confno != ci.confno) || (p->subs[SUB_REAL].curconf.confmode != ci.confmode)) {
@@ -4460,16 +4459,16 @@
 		*dest = &p->subs[idx].f;
 	}
 }
-			
+
 static void handle_alarms(struct dahdi_pvt *p, int alms)
 {
 	const char *alarm_str = alarm2str(alms);
 
 	ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm_str);
 	manager_event(EVENT_FLAG_SYSTEM, "Alarm",
-		      "Alarm: %s\r\n"
-		      "Channel: %d\r\n",
-		      alarm_str, p->channel);
+		"Alarm: %s\r\n"
+		"Channel: %d\r\n",
+		alarm_str, p->channel);
 }
 
 static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
@@ -4507,7 +4506,7 @@
 	ast_debug(1, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, idx);
 
 	if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
-		p->pulsedial =  (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
+		p->pulsedial = (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
 		ast_debug(1, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
 #ifdef HAVE_PRI
 		if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) {
@@ -4543,7 +4542,7 @@
 			/* Stop tone if there's a pulse start and the PBX isn't started */
 			if (!ast->pbx)
 				tone_zone_play_tone(p->subs[idx].dfd, -1);
-			break;	
+			break;
 		case DAHDI_EVENT_DIALCOMPLETE:
 			if (p->inalarm) break;
 			if ((p->radio || (p->oprmode < 0))) break;
@@ -4576,7 +4575,15 @@
 					if (ast->_state == AST_STATE_DIALING) {
 						if ((p->callprogress & CALLPROGRESS_PROGRESS) && CANPROGRESSDETECT(p) && p->dsp && p->outgoing) {
 							ast_debug(1, "Done dialing, but waiting for progress detection before doing more...\n");
-						} else if (p->confirmanswer || (!p->dialednone && ((mysig == SIG_EM) || (mysig == SIG_EM_E1) ||  (mysig == SIG_EMWINK) || (mysig == SIG_FEATD) || (mysig == SIG_FEATDMF_TA) || (mysig == SIG_FEATDMF) || (mysig == SIG_E911) || (mysig == SIG_FGC_CAMA) || (mysig == SIG_FGC_CAMAMF) || (mysig == SIG_FEATB) || (mysig == SIG_SF) || (mysig == SIG_SFWINK) || (mysig == SIG_SF_FEATD) || (mysig == SIG_SF_FEATDMF) || (mysig == SIG_SF_FEATB)))) {
+						} else if (p->confirmanswer || (!p->dialednone
+							&& ((mysig == SIG_EM) || (mysig == SIG_EM_E1)
+								|| (mysig == SIG_EMWINK) || (mysig == SIG_FEATD)
+								|| (mysig == SIG_FEATDMF_TA) || (mysig == SIG_FEATDMF)
+								|| (mysig == SIG_E911) || (mysig == SIG_FGC_CAMA)
+								|| (mysig == SIG_FGC_CAMAMF) || (mysig == SIG_FEATB)
+								|| (mysig == SIG_SF) || (mysig == SIG_SFWINK)
+								|| (mysig == SIG_SF_FEATD) || (mysig == SIG_SF_FEATDMF)
+								|| (mysig == SIG_SF_FEATB)))) {
 							ast_setstate(ast, AST_STATE_RINGING);
 						} else if (!p->answeronpolarityswitch) {
 							ast_setstate(ast, AST_STATE_UP);
@@ -4664,11 +4671,11 @@
 						/* There's a call waiting call, so ring the phone, but make it unowned in the mean time */
 						swap_subs(p, SUB_CALLWAIT, SUB_REAL);
 						ast_verb(3, "Channel %d still has (callwait) call, ringing phone\n", p->channel);
-						unalloc_sub(p, SUB_CALLWAIT);	
+						unalloc_sub(p, SUB_CALLWAIT);
 #if 0
 						p->subs[idx].needanswer = 0;
 						p->subs[idx].needringing = 0;
-#endif						
+#endif
 						p->callwaitingrepeat = 0;
 						p->cidcwexpire = 0;
 						p->owner = NULL;
@@ -4700,7 +4707,7 @@
 						mssinceflash = ast_tvdiff_ms(ast_tvnow(), p->flashtime);
 						ast_debug(1, "Last flash was %d ms ago\n", mssinceflash);
 						if (mssinceflash < MIN_MS_SINCE_FLASH) {
-							/* It hasn't been long enough since the last flashook.  This is probably a bounce on 
+							/* It hasn't been long enough since the last flashook.  This is probably a bounce on
 							   hanging up.  Hangup both channels now */
 							if (p->subs[SUB_THREEWAY].owner)
 								ast_queue_hangup_with_cause(p->subs[SUB_THREEWAY].owner, AST_CAUSE_NO_ANSWER);
@@ -4879,10 +4886,10 @@
 					p->ringt = p->ringt_base;
 				}
 
-				/* If we get a ring then we cannot be in 
+				/* If we get a ring then we cannot be in
 				 * reversed polarity. So we reset to idle */
 				ast_debug(1, "Setting IDLE polarity due "
-					"to ring. Old polarity was %d\n", 
+					"to ring. Old polarity was %d\n",
 					p->polarity);
 				p->polarity = POLARITY_IDLE;
 
@@ -4957,7 +4964,7 @@
 			/* Extremely unlikely but just in case */
 			if (p->bearer)
 				p->bearer->inalarm = 0;
-#endif				
+#endif
 			ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
 			manager_event(EVENT_FLAG_SYSTEM, "AlarmClear",
 								"Channel: %d\r\n", p->channel);
@@ -4997,7 +5004,7 @@
 					ast_log(LOG_WARNING, "Got flash hook with index %d on channel %d?!?\n", idx, p->channel);
 					goto winkflashdone;
 				}
-				
+
 				if (p->subs[SUB_CALLWAIT].owner) {
 					/* Swap to call-wait */
 					swap_subs(p, SUB_REAL, SUB_CALLWAIT);
@@ -5041,8 +5048,8 @@
 						/* XXX This section needs much more error checking!!! XXX */
 						/* Start a 3-way call if feasible */
 						if (!((ast->pbx) ||
-						      (ast->_state == AST_STATE_UP) ||
-						      (ast->_state == AST_STATE_RING))) {
+							(ast->_state == AST_STATE_UP) ||
+							(ast->_state == AST_STATE_RING))) {
 							ast_debug(1, "Flash when call not up or ringing\n");
 							goto winkflashdone;
 						}
@@ -5078,15 +5085,15 @@
 						} else {
  							struct ast_channel *other = ast_bridged_channel(p->subs[SUB_THREEWAY].owner);
  							int way3bridge = 0, cdr3way = 0;
- 							
+
  							if (!other) {
  								other = ast_bridged_channel(p->subs[SUB_REAL].owner);
  							} else
  								way3bridge = 1;
- 							
+
  							if (p->subs[SUB_THREEWAY].owner->cdr)
  								cdr3way = 1;
- 							
+
 							ast_verb(3, "Started three way call on channel %d\n", p->channel);
 
 							/* Start music on hold if appropriate */
@@ -5116,17 +5123,17 @@
 						p->subs[SUB_THREEWAY].inthreeway = 0;
 					} else {
 						/* Lets see what we're up to */
-						if (((ast->pbx) || (ast->_state == AST_STATE_UP)) && 
-						    (p->transfertobusy || (ast->_state != AST_STATE_BUSY))) {
+						if (((ast->pbx) || (ast->_state == AST_STATE_UP)) &&
+							(p->transfertobusy || (ast->_state != AST_STATE_BUSY))) {
 							int otherindex = SUB_THREEWAY;
 							struct ast_channel *other = ast_bridged_channel(p->subs[SUB_THREEWAY].owner);
 							int way3bridge = 0, cdr3way = 0;
-							
+
 							if (!other) {
 								other = ast_bridged_channel(p->subs[SUB_REAL].owner);
 							} else
 								way3bridge = 1;
-							
+
 							if (p->subs[SUB_THREEWAY].owner->cdr)
 								cdr3way = 1;
 
@@ -5157,10 +5164,9 @@
 							p->subs[SUB_REAL].needunhold = 1;
 							dahdi_enable_ec(p);
 						}
-							
 					}
 				}
-			winkflashdone:			       
+winkflashdone:
 				update_conf(p);
 				break;
 			case SIG_EM:
@@ -5208,7 +5214,7 @@
 						ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d: %s\n", p->channel, strerror(errno));
 						p->dop.dialstr[0] = '\0';
 						return NULL;
-					} else 
+					} else
 						ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr);
 				}
 				p->dop.dialstr[0] = '\0';
@@ -5238,7 +5244,7 @@
 						ast_log(LOG_WARNING, "Unable to initiate dialing on trunk channel %d: %s\n", p->channel, strerror(errno));
 						p->dop.dialstr[0] = '\0';
 						return NULL;
-					} else 
+					} else
 						ast_debug(1, "Sent deferred digit string: %s\n", p->dop.dialstr);
 				}
 				p->dop.dialstr[0] = '\0';
@@ -5268,8 +5274,8 @@
 			if (p->polarity == POLARITY_IDLE) {
 				p->polarity = POLARITY_REV;
 				if (p->answeronpolarityswitch &&
-				    ((ast->_state == AST_STATE_DIALING) ||
-					 (ast->_state == AST_STATE_RINGING))) {
+					((ast->_state == AST_STATE_DIALING) ||
+					(ast->_state == AST_STATE_RINGING))) {
 					ast_debug(1, "Answering on polarity switch!\n");
 					ast_setstate(p->owner, AST_STATE_UP);
 					if (p->hanguponpolarityswitch) {
@@ -5277,17 +5283,16 @@
 					}
 				} else
 					ast_debug(1, "Ignore switch to REVERSED Polarity on channel %d, state %d\n", p->channel, ast->_state);
-
-			} 
+			}
 			/* Removed else statement from here as it was preventing hangups from ever happening*/
 			/* Added AST_STATE_RING in if statement below to deal with calling party hangups that take place when ringing */
 			if (p->hanguponpolarityswitch &&
 				(p->polarityonanswerdelay > 0) &&
-			       (p->polarity == POLARITY_REV) &&
+				(p->polarity == POLARITY_REV) &&
 				((ast->_state == AST_STATE_UP) || (ast->_state == AST_STATE_RING)) ) {
-                                /* Added log_debug information below to provide a better indication of what is going on */
+				/* Added log_debug information below to provide a better indication of what is going on */
 				ast_debug(1, "Polarity Reversal event occured - DEBUG 1: channel %d, state %d, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %d\n", p->channel, ast->_state, p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) );
-			
+
 				if (ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) > p->polarityonanswerdelay) {
 					ast_debug(1, "Polarity Reversal detected and now Hanging up on channel %d\n", p->channel);
 					ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
@@ -5299,7 +5304,7 @@
 				p->polarity = POLARITY_IDLE;
 				ast_debug(1, "Ignoring Polarity switch to IDLE on channel %d, state %d\n", p->channel, ast->_state);
 			}
-                     	/* Added more log_debug information below to provide a better indication of what is going on */
+			/* Added more log_debug information below to provide a better indication of what is going on */
 			ast_debug(1, "Polarity Reversal event occured - DEBUG 2: channel %d, state %d, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %d\n", p->channel, ast->_state, p->polarity, p->answeronpolarityswitch, p->hanguponpolarityswitch, p->polarityonanswerdelay, ast_tvdiff_ms(ast_tvnow(), p->polaritydelaytv) );
 			break;
 		default:
@@ -5318,7 +5323,7 @@
 
 
 	idx = dahdi_get_index(ast, p, 1);
-	
+
 	p->subs[idx].f.frametype = AST_FRAME_NULL;
 	p->subs[idx].f.datalen = 0;
 	p->subs[idx].f.samples = 0;
@@ -5328,8 +5333,8 @@
 	p->subs[idx].f.delivery = ast_tv(0,0);
 	p->subs[idx].f.src = "dahdi_exception";
 	p->subs[idx].f.data.ptr = NULL;
-	
-	
+
+
 	if ((!p->owner) && (!(p->radio || (p->oprmode < 0)))) {
 		/* If nobody owns us, absorb the event appropriately, otherwise
 		   we loop indefinitely.  This occurs when, during call waiting, the
@@ -5402,7 +5407,7 @@
 		f = &p->subs[idx].f;
 		return f;
 	}
-	if (!(p->radio || (p->oprmode < 0))) 
+	if (!(p->radio || (p->oprmode < 0)))
 		ast_debug(1, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
 	/* If it's not us, return NULL immediately */
 	if (ast != p->owner) {
@@ -5424,7 +5429,7 @@
 	return f;
 }
 
-static struct ast_frame  *dahdi_read(struct ast_channel *ast)
+static struct ast_frame *dahdi_read(struct ast_channel *ast)
 {
 	struct dahdi_pvt *p = ast->tech_pvt;
 	int res;
@@ -5437,14 +5442,14 @@
 	}
 
 	idx = dahdi_get_index(ast, p, 0);
-	
+
 	/* Hang up if we don't really exist */
 	if (idx < 0)	{
 		ast_log(LOG_WARNING, "We dont exist?\n");
 		ast_mutex_unlock(&p->lock);
 		return NULL;
 	}
-	
+
 	if ((p->radio || (p->oprmode < 0)) && p->inalarm) return NULL;
 
 	p->subs[idx].f.frametype = AST_FRAME_NULL;
@@ -5456,7 +5461,7 @@
 	p->subs[idx].f.delivery = ast_tv(0,0);
 	p->subs[idx].f.src = "dahdi_read";
 	p->subs[idx].f.data.ptr = NULL;
-	
+
 	/* make sure it sends initial key state as first frame */
 	if ((p->radio || (p->oprmode < 0)) && (!p->firstradio))
 	{
@@ -5484,7 +5489,7 @@
 		ast_mutex_unlock(&p->lock);
 		return NULL;
 	}
-	else if (p->ringt > 0) 
+	else if (p->ringt > 0)
 		p->ringt--;
 
 	if (p->subs[idx].needringing) {
@@ -5522,7 +5527,7 @@
 							);
 		p->subs[idx].needcallerid = 0;
 	}
-	
+
 	if (p->subs[idx].needanswer) {
 		/* Send answer frame if requested */
 		p->subs[idx].needanswer = 0;
@@ -5530,8 +5535,8 @@
 		p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
 		ast_mutex_unlock(&p->lock);
 		return &p->subs[idx].f;
-	}	
-	
+	}
+
 	if (p->subs[idx].needflash) {
 		/* Send answer frame if requested */
 		p->subs[idx].needflash = 0;
@@ -5539,8 +5544,8 @@
 		p->subs[idx].f.subclass = AST_CONTROL_FLASH;
 		ast_mutex_unlock(&p->lock);
 		return &p->subs[idx].f;
-	}	
-	
+	}
+
 	if (p->subs[idx].needhold) {
 		/* Send answer frame if requested */
 		p->subs[idx].needhold = 0;
@@ -5549,8 +5554,8 @@
 		ast_mutex_unlock(&p->lock);
 		ast_debug(1, "Sending hold on '%s'\n", ast->name);
 		return &p->subs[idx].f;
-	}	
-	
+	}
+
 	if (p->subs[idx].needunhold) {
 		/* Send answer frame if requested */
 		p->subs[idx].needunhold = 0;
@@ -5559,21 +5564,21 @@
 		ast_mutex_unlock(&p->lock);
 		ast_debug(1, "Sending unhold on '%s'\n", ast->name);
 		return &p->subs[idx].f;
-	}	
-	
+	}
+
 	if (ast->rawreadformat == AST_FORMAT_SLINEAR) {
 		if (!p->subs[idx].linear) {
 			p->subs[idx].linear = 1;
 			res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
-			if (res) 
+			if (res)
 				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to linear mode.\n", p->channel, idx);
 		}
 	} else if ((ast->rawreadformat == AST_FORMAT_ULAW) ||
-		   (ast->rawreadformat == AST_FORMAT_ALAW)) {
+		(ast->rawreadformat == AST_FORMAT_ALAW)) {
 		if (p->subs[idx].linear) {
 			p->subs[idx].linear = 0;
 			res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
-			if (res) 
+			if (res)
 				ast_log(LOG_WARNING, "Unable to set channel %d (index %d) to companded mode.\n", p->channel, idx);
 		}
 	} else {
@@ -5588,7 +5593,7 @@
 	/* Check for hangup */
 	if (res < 0) {
 		f = NULL;
-		if (res == -1)  {
+		if (res == -1) {
 			if (errno == EAGAIN) {
 				/* Return "NULL" frame if there is nobody there */
 				ast_mutex_unlock(&p->lock);
@@ -5646,7 +5651,7 @@
 	}
 	if (p->subs[idx].linear) {
 		p->subs[idx].f.datalen = READ_SIZE * 2;
-	} else 
+	} else
 		p->subs[idx].f.datalen = READ_SIZE;
 
 	/* Handle CallerID Transmission */
@@ -5662,11 +5667,11 @@
 	p->subs[idx].f.data.ptr = p->subs[idx].buffer + AST_FRIENDLY_OFFSET / sizeof(p->subs[idx].buffer[0]);
 #if 0
 	ast_debug(1, "Read %d of voice on %s\n", p->subs[idx].f.datalen, ast->name);
-#endif	
+#endif
 	if (p->dialing || /* Transmitting something */
-	   (idx && (ast->_state != AST_STATE_UP)) || /* Three-way or callwait that isn't up */
-	   ((idx == SUB_CALLWAIT) && !p->subs[SUB_CALLWAIT].inthreeway) /* Inactive and non-confed call-wait */
-	   ) {
+		(idx && (ast->_state != AST_STATE_UP)) || /* Three-way or callwait that isn't up */
+		((idx == SUB_CALLWAIT) && !p->subs[SUB_CALLWAIT].inthreeway) /* Inactive and non-confed call-wait */
+		) {
 		/* Whoops, we're still dialing, or in a state where we shouldn't transmit....
 		   don't send anything */
 		p->subs[idx].f.frametype = AST_FRAME_NULL;
@@ -5694,19 +5699,19 @@
 			if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_BUSY)) {
 				if ((ast->_state == AST_STATE_UP) && !p->outgoing) {
 					/* Treat this as a "hangup" instead of a "busy" on the assumption that
-					   a busy  */
+					   a busy */
 					f = NULL;
 				}
 			} else if (f->frametype == AST_FRAME_DTMF) {
 #ifdef HAVE_PRI
-				if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri && 
-				    ((!p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)) ||
-				     (p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)))) {
+				if (!p->proceeding && ((p->sig == SIG_PRI) || (p->sig == SIG_BRI) || (p->sig == SIG_BRI_PTMP)) && p->pri &&

[... 3015 lines stripped ...]



More information about the asterisk-commits mailing list