[asterisk-commits] file: branch file/dialing_api r49347 - in /team/file/dialing_api: include/ast...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 3 15:02:19 MST 2007


Author: file
Date: Wed Jan  3 16:02:19 2007
New Revision: 49347

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49347
Log:
Add first 'real' option, which is basically the 'r' option of Dial. As evil as it is, it was the easiest thing to implement to try this out.

Modified:
    team/file/dialing_api/include/asterisk/dial.h
    team/file/dialing_api/main/dial.c

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=49347&r1=49346&r2=49347
==============================================================================
--- team/file/dialing_api/include/asterisk/dial.h (original)
+++ team/file/dialing_api/include/asterisk/dial.h Wed Jan  3 16:02:19 2007
@@ -35,7 +35,7 @@
 
 /*! \brief List of options that are applicable either globally or per dialed channel */
 enum ast_dial_option {
-	AST_DIAL_OPTION_DUMMY = 0, /*! Test option */
+	AST_DIAL_OPTION_RINGING,   /*! Always indicate ringing to caller */
 	AST_DIAL_OPTION_MAX,       /*! End terminator -- must always remain last */
 };
 

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=49347&r1=49346&r2=49347
==============================================================================
--- team/file/dialing_api/main/dial.c (original)
+++ team/file/dialing_api/main/dial.c Wed Jan  3 16:02:19 2007
@@ -75,8 +75,8 @@
 	ast_dial_option_cb_enable enable;
 	ast_dial_option_cb_disable disable;
 } option_types[] = {
-	{ AST_DIAL_OPTION_DUMMY, NULL, NULL }, /*! Dummy option for testing */
-	{ AST_DIAL_OPTION_MAX, NULL, NULL },   /*! Terminator of list */
+	{ AST_DIAL_OPTION_RINGING, NULL, NULL }, /*! Always indicate ringing to caller */
+	{ AST_DIAL_OPTION_MAX, NULL, NULL },     /*! Terminator of list */
 };
 
 /* free the buffer if allocated, and set the pointer to the second arg */
@@ -344,8 +344,15 @@
 	/* Switch dialing status to trying */
 	dial->status = AST_DIAL_RESULT_TRYING;
 
+	/* If the "always indicate ringing" option is set, change status to ringing and indicate to the owner if present */
+	if (dial->options[AST_DIAL_OPTION_RINGING]) {
+		dial->status = AST_DIAL_RESULT_RINGING;
+		if (chan)
+			ast_indicate(chan, AST_CONTROL_RINGING);
+	}
+
 	/* Go into an infinite loop while we are trying */
-	while (dial->status == AST_DIAL_RESULT_TRYING) {
+	while ((dial->status != AST_DIAL_RESULT_UNANSWERED) && (dial->status != AST_DIAL_RESULT_ANSWERED) && (dial->status != AST_DIAL_RESULT_HANGUP) && (dial->status != AST_DIAL_RESULT_TIMEOUT)) {
 		int pos = 0;
 		struct ast_frame *fr = NULL;
 		



More information about the asterisk-commits mailing list