[asterisk-commits] file: branch file/dialing_api r49261 - in /team/file/dialing_api: apps/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 2 18:45:56 MST 2007


Author: file
Date: Tue Jan  2 19:45:56 2007
New Revision: 49261

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49261
Log:
Check the correct value from ast_dial_run, rebuild channel structure list each iteration, and free the read frame.

Modified:
    team/file/dialing_api/apps/app_dial2.c
    team/file/dialing_api/main/dial.c

Modified: team/file/dialing_api/apps/app_dial2.c
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/apps/app_dial2.c?view=diff&rev=49261&r1=49260&r2=49261
==============================================================================
--- team/file/dialing_api/apps/app_dial2.c (original)
+++ team/file/dialing_api/apps/app_dial2.c Tue Jan  2 19:45:56 2007
@@ -96,7 +96,7 @@
 	memset(&bridge_config, 0, sizeof(bridge_config));
 
 	/* Attempt to dial all the channels and bridge to the one that answered */
-	if (!ast_dial_run(dial, chan, 0) && (answered = ast_dial_answered(dial)))
+	if ((ast_dial_run(dial, chan, 0) == AST_DIAL_RESULT_ANSWERED) && (answered = ast_dial_answered(dial)))
 		ast_bridge_call(chan, answered, &bridge_config);
 
 	/* Hangup all calls in the dialing structure */

Modified: team/file/dialing_api/main/dial.c
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/main/dial.c?view=diff&rev=49261&r1=49260&r2=49261
==============================================================================
--- team/file/dialing_api/main/dial.c (original)
+++ team/file/dialing_api/main/dial.c Tue Jan  2 19:45:56 2007
@@ -189,8 +189,6 @@
 			ast_hangup(channel->owner);
 			channel->owner = NULL;
 		} else {
-			if (channel->owner->_state == AST_STATE_UP)
-				ast_log(LOG_NOTICE, "eeeeeeep they are up!\n");
 			success++;
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
@@ -220,7 +218,7 @@
  */
 enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int timeout)
 {
-	int to_monitor = 0, old_monitor = 0, single = 0;
+	int to_monitor = 0, single = 0;
 	struct ast_channel *cs[AST_MAX_WATCHERS] = {NULL, };
 	struct ast_dial_channel *channel = NULL;
 	enum ast_dial_result res = AST_DIAL_RESULT_INVALID;
@@ -259,23 +257,17 @@
 			res = AST_DIAL_RESULT_UNANSWERED;
 			break;
 		}
-
-		/*  If the two monitor values do not match, we need to rebuild our watchers */
-		if (to_monitor != old_monitor) {
-			/* Put ourselves into the structure */
-			cs[0] = chan;
-			/* Now everyone else! */
-			pos = 1;
-			AST_LIST_TRAVERSE(&dial->channels, channel, list) {
-				if (!channel->owner)
-					continue;
-				cs[pos++] = channel->owner;
-			}
-			/* Finally record the new monitor count as the old monitor count */
-			old_monitor = to_monitor;
-		}
-
-		/* Monitor the channels */
+		
+		/* Put ourselves into the structure */
+		cs[0] = chan;
+		/* Now everyone else! */
+		pos = 1;
+		AST_LIST_TRAVERSE(&dial->channels, channel, list) {
+			if (!channel->owner)
+				continue;
+			cs[pos++] = channel->owner;
+		}
+
 		if (!(who = ast_waitfor_n(cs, pos, &timeout)))
 			continue;
 
@@ -360,6 +352,9 @@
 				break;
 			}
 		}
+
+		/* Free the frame */
+		ast_frfree(fr);
 	}
 
 	/* Based on the result code we can determine what to do next */



More information about the asterisk-commits mailing list