[asterisk-commits] jpeeler: trunk r187491 - in /trunk: ./ apps/ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 9 14:10:08 CDT 2009
Author: jpeeler
Date: Thu Apr 9 14:10:02 2009
New Revision: 187491
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187491
Log:
Add ability for dialplan execution to continue when caller hangs up.
The F option to app_dial has been modified to accept no parameters and perform
the above functionality. I don't see anywhere else that is doing function
overloading, but this really is the best place for this operation because:
- It makes it close to the 'g' option in the argument list which provides
similar functionality.
- The existing code to support the current F option provides a very
convienient location to add this new feature.
(closes issue #12381)
Reported by: michael-fig
Modified:
trunk/CHANGES
trunk/apps/app_dial.c
trunk/include/asterisk/pbx.h
trunk/main/pbx.c
Modified: trunk/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/trunk/CHANGES?view=diff&rev=187491&r1=187490&r2=187491
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Apr 9 14:10:02 2009
@@ -24,6 +24,8 @@
* Added progress option to the app_dial D() option. When progress DTMF is
present, those values are sent immediatly upon receiving a PROGRESS message
regardless if the call has been answered or not.
+ * Added functionality to the app_dial F() option to continue with execution
+ at the current location when no parameters are provided.
Dialplan Functions
------------------
Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_dial.c?view=diff&rev=187491&r1=187490&r2=187491
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Thu Apr 9 14:10:02 2009
@@ -132,6 +132,10 @@
<argument name="priority" required="true" />
<para>When the caller hangs up, transfer the called party
to the specified destination and continue execution at that location.</para>
+ </option>
+ <option name="F">
+ <para>Proceed with dialplan execution at the next priority in the current extension if the
+ source channel hangs up.</para>
</option>
<option name="g">
<para>Proceed with dialplan execution at the next priority in the current extension if the
@@ -2332,9 +2336,18 @@
}
ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
}
- if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
- replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
- ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+ if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) {
+ if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
+ replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+ ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+ } else { /* F() */
+ int res;
+ res = ast_goto_if_exists(peer, chan->context, chan->exten, (chan->priority) + 1);
+ if (res == AST_PBX_GOTO_FAILED) {
+ ast_hangup(peer);
+ goto out;
+ }
+ }
ast_pbx_start(peer);
} else {
if (!ast_check_hangup(chan))
Modified: trunk/include/asterisk/pbx.h
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/pbx.h?view=diff&rev=187491&r1=187490&r2=187491
==============================================================================
--- trunk/include/asterisk/pbx.h (original)
+++ trunk/include/asterisk/pbx.h Thu Apr 9 14:10:02 2009
@@ -34,6 +34,7 @@
#define AST_MAX_APP 32 /*!< Max length of an application */
+#define AST_PBX_GOTO_FAILED -3
#define AST_PBX_KEEP 0
#define AST_PBX_REPLACE 1
Modified: trunk/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/pbx.c?view=diff&rev=187491&r1=187490&r2=187491
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Thu Apr 9 14:10:02 2009
@@ -9461,8 +9461,9 @@
goto_func = (async) ? ast_async_goto : ast_explicit_goto;
if (ast_exists_extension(chan, context, exten, priority, chan->cid.cid_num))
return goto_func(chan, context, exten, priority);
- else
- return -3;
+ else {
+ return AST_PBX_GOTO_FAILED;
+ }
}
int ast_goto_if_exists(struct ast_channel *chan, const char* context, const char *exten, int priority)
More information about the asterisk-commits
mailing list