[asterisk-commits] file: branch file/dialing_api r49336 - in /team/file/dialing_api: apps/ inclu...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 3 11:18:52 MST 2007


Author: file
Date: Wed Jan  3 12:18:51 2007
New Revision: 49336

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49336
Log:
Get rid of timeout to the run function, make async run function better match sync one, and return proper result.

Modified:
    team/file/dialing_api/apps/app_dial2.c
    team/file/dialing_api/include/asterisk/dial.h
    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=49336&r1=49335&r2=49336
==============================================================================
--- team/file/dialing_api/apps/app_dial2.c (original)
+++ team/file/dialing_api/apps/app_dial2.c Wed Jan  3 12:18:51 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) == AST_DIAL_RESULT_ANSWERED) && (answered = ast_dial_answered(dial)))
+	if ((ast_dial_run(dial, chan) == 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/include/asterisk/dial.h
URL: http://svn.digium.com/view/asterisk/team/file/dialing_api/include/asterisk/dial.h?view=diff&rev=49336&r1=49335&r2=49336
==============================================================================
--- team/file/dialing_api/include/asterisk/dial.h (original)
+++ team/file/dialing_api/include/asterisk/dial.h Wed Jan  3 12:18:51 2007
@@ -69,13 +69,13 @@
  * \note Dials channels in a dial structure and does not return until one is answered or timeout is reached. Will also forward progress/ringing.
  * \return Returns 0 on success, -1 on failure
  */
-enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int timeout);
+enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan);
 
 /*! \brief Execute dialing asynchronously
  * \note Dials channels in a dial structure in a separate thread, returns almost immediately
  * \return Returns 0 on success, -1 on failure
  */
-int ast_dial_run_async(struct ast_dial *dial);
+enum ast_dial_result ast_dial_run_async(struct ast_dial *dial, struct ast_channel *chan);
 
 /*! \brief Return channel that answered
  * \note Returns the Asterisk channel that answered

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=49336&r1=49335&r2=49336
==============================================================================
--- team/file/dialing_api/main/dial.c (original)
+++ team/file/dialing_api/main/dial.c Wed Jan  3 12:18:51 2007
@@ -217,9 +217,9 @@
  * \note Dials channels in a dial structure and does not return until one is answered or timeout is reached. Will also forward progress/ringing.
  * \return Returns 0 on success, -1 on failure
  */
-enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int timeout)
-{
-	int to_monitor = 0, single = 0;
+enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan)
+{
+	int to_monitor = 0, single = 0, timeout = 0;
 	struct ast_channel *cs[AST_MAX_WATCHERS] = {NULL, }, *who = NULL;
 	struct ast_dial_channel *channel = NULL;
 
@@ -394,13 +394,17 @@
  * \note Dials channels in a dial structure in a separate thread, returns almost immediately
  * \return Returns 0 on success, -1 on failure
  */
-int ast_dial_run_async(struct ast_dial *dial)
+enum ast_dial_result ast_dial_run_async(struct ast_dial *dial, struct ast_channel *chan)
 {
 	/* If there are no channels to dial we can't very well try to dial them */
 	if (AST_LIST_EMPTY(&dial->channels))
-		return -1;
+		return AST_DIAL_RESULT_INVALID;
 	
-        return 0;
+	/* If we failed to dial any channels, then return a failed result */
+	if (!begin_dial(dial, chan))
+		return AST_DIAL_RESULT_FAILED;
+
+        return AST_DIAL_RESULT_TRYING;
 }
 
 /*! \brief Return channel that answered



More information about the asterisk-commits mailing list