From fd833f14ed76d736ab2e7800e64863e276baf869 Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Wed, 15 Apr 2009 15:24:50 +0000 Subject: [PATCH] Make the cancellation of the dial timeout on a call forward optional. This introduces the 'z' option to app_dial. With it set, a call forward will cancel any timeout originally set for this instance of the Dial application. AST-207 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@188544 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_dial.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/app_dial.c b/apps/app_dial.c index 573e4c5..ea4c5ba 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -370,6 +370,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") Allow the calling party to enable recording of the call by sending the DTMF sequence defined for one-touch automixmonitor in features.conf. + @@ -502,6 +505,7 @@ enum { #define OPT_CANCEL_ELSEWHERE ((uint64_t)1 << 34) #define OPT_PEER_H ((uint64_t)1 << 35) #define OPT_CALLEE_GO_ON ((uint64_t)1 << 36) +#define OPT_CANCEL_TIMEOUT ((uint64_t)1 << 37) enum { OPT_ARG_ANNOUNCE = 0, @@ -554,6 +558,7 @@ AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS AST_APP_OPTION('W', OPT_CALLER_MONITOR), AST_APP_OPTION('x', OPT_CALLEE_MIXMONITOR), AST_APP_OPTION('X', OPT_CALLER_MIXMONITOR), + AST_APP_OPTION('z', OPT_CANCEL_TIMEOUT), END_OPTIONS ); #define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \ @@ -712,7 +717,7 @@ static void senddialendevent(const struct ast_channel *src, const char *dialstat * the outgoing channel without properly deleting it. */ static void do_forward(struct chanlist *o, - struct cause_args *num, struct ast_flags64 *peerflags, int single) + struct cause_args *num, struct ast_flags64 *peerflags, int single, int *to) { char tmpchan[256]; struct ast_channel *original = o->chan; @@ -789,6 +794,9 @@ static void do_forward(struct chanlist *o, ast_channel_update_redirecting(in, apr); ast_clear_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE); + if (ast_test_flag64(peerflags, OPT_CANCEL_TIMEOUT)) { + *to = -1; + } ast_channel_unlock(in); ast_channel_unlock(c); @@ -942,7 +950,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, continue; /* here, o->chan == c == winner */ if (!ast_strlen_zero(c->call_forward)) { - do_forward(o, &num, peerflags, single); + do_forward(o, &num, peerflags, single, to); continue; } f = ast_read(winner); @@ -1735,7 +1743,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags outbound_group = ast_strdupa(outbound_group); } ast_channel_unlock(chan); - ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE); + ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE | OPT_CANCEL_TIMEOUT); /* loop through the list of dial destinations */ rest = args.peers; -- 1.7.9.5