[svn-commits] rmudgett: branch rmudgett/call_waiting r251584 - /team/rmudgett/call_waiting/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 10 09:44:05 CST 2010


Author: rmudgett
Date: Wed Mar 10 09:44:00 2010
New Revision: 251584

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251584
Log:
Complete simplifying channel selection failed reason/cause code.

Also avoid potential crash because cause could be NULL.

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

Modified: team/rmudgett/call_waiting/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/chan_dahdi.c?view=diff&rev=251584&r1=251583&r2=251584
==============================================================================
--- team/rmudgett/call_waiting/channels/chan_dahdi.c (original)
+++ team/rmudgett/call_waiting/channels/chan_dahdi.c Wed Mar 10 09:44:00 2010
@@ -12199,7 +12199,7 @@
 	return 1;
 }
 
-static int available(struct dahdi_pvt **pvt, int *reason, int is_specific_channel)
+static int available(struct dahdi_pvt **pvt, int is_specific_channel)
 {
 	struct dahdi_pvt *p = *pvt;
 
@@ -12207,7 +12207,7 @@
 		return 0;
 
 	if (analog_lib_handles(p->sig, p->radio, p->oprmode))
-		return analog_available(p->sig_pvt, reason);
+		return analog_available(p->sig_pvt);
 
 #ifdef HAVE_PRI
 	switch (p->sig) {
@@ -12559,7 +12559,6 @@
 static struct ast_channel *dahdi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 {
 	int callwait = 0;
-	int unavailreason = 0;
 	struct dahdi_pvt *p;
 	struct ast_channel *tmp = NULL;
 	struct dahdi_pvt *exitpvt;
@@ -12582,7 +12581,7 @@
 			round_robin[start.rr_starting_point] = p;
 
 		if (is_group_or_channel_match(p, start.span, start.groupmatch, &groupmatched, start.channelmatch, &channelmatched)
-			&& available(&p, &unavailreason, channelmatched)) {
+			&& available(&p, channelmatched)) {
 			ast_debug(1, "Using channel %d\n", p->channel);
 
 #ifdef HAVE_OPENR2
@@ -12682,10 +12681,16 @@
 	}
 	ast_mutex_unlock(&iflock);
 	restart_monitor();
-	if (!tmp) {
-		*cause = AST_CAUSE_BUSY;
-		if (!callwait && groupmatched) {
+	if (cause && !tmp) {
+		if (callwait || channelmatched) {
+			*cause = AST_CAUSE_BUSY;
+		} else if (groupmatched) {
 			*cause = AST_CAUSE_CONGESTION;
+		} else {
+			/*
+			 * We did not match any channel requested.
+			 * Dialplan error requesting non-existant channel?
+			 */
 		}
 	}
 

Modified: team/rmudgett/call_waiting/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/sig_analog.c?view=diff&rev=251584&r1=251583&r2=251584
==============================================================================
--- team/rmudgett/call_waiting/channels/sig_analog.c (original)
+++ team/rmudgett/call_waiting/channels/sig_analog.c Wed Mar 10 09:44:00 2010
@@ -657,17 +657,11 @@
 	return analog_new_ast_channel(p, AST_STATE_RESERVED, 0, p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor);
 }
 
-int analog_available(struct analog_pvt *p, int *busy)
+int analog_available(struct analog_pvt *p)
 {
 	int offhook;
 
 	ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
-	/* We're at least busy at this point */
-	if (busy) {
-		if ((p->sig == ANALOG_SIG_FXOKS) || (p->sig == ANALOG_SIG_FXOLS) || (p->sig == ANALOG_SIG_FXOGS)) {
-			*busy = 1;
-		}
-	}
 	/* If do not disturb, definitely not */
 	if (p->dnd) {
 		return 0;

Modified: team/rmudgett/call_waiting/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/call_waiting/channels/sig_analog.h?view=diff&rev=251584&r1=251583&r2=251584
==============================================================================
--- team/rmudgett/call_waiting/channels/sig_analog.h (original)
+++ team/rmudgett/call_waiting/channels/sig_analog.h Wed Mar 10 09:44:00 2010
@@ -338,7 +338,7 @@
 
 struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor);
 
-int analog_available(struct analog_pvt *p, int *busy);
+int analog_available(struct analog_pvt *p);
 
 void *analog_handle_init_event(struct analog_pvt *i, int event);
 




More information about the svn-commits mailing list