diff options
author | Matthew Jordan <mjordan@digium.com> | 2014-01-31 23:40:51 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2014-01-31 23:40:51 +0000 |
commit | 66c46fba24ccfa782339e3ef2722ea53b5573d17 (patch) | |
tree | 56d84cc24f7774de8860069e32124ed0a91b9b4d /apps/app_dial.c | |
parent | f9229127311cdd6880d8d5b0c506a1f843b8ae28 (diff) |
CDRs: fix a variety of dial status problems, h/hangup handler creating CDRs
This patch fixes a number of small-ish problems that were noticed when
witnessing the records that the FreePBX dialplan produces:
(1) Mid-call events (as well as privacy options) have the ability to change the
overall state of the Dial operation after the called party answers. This
means that publishing the DialEnd event when the called party is premature;
we have to wait for the execution of these subroutines to complete before
we can signal the overall status of the DialEnd. This patch moves that
publication and adds handlers for the mid-call events.
(2) The AST_FLAG_OUTGOING channel flag is cleared if an after bridge goto
datastore is detected. This flag was preventing CDRs from being recorded
for all outbound channels that had a 'continue' option enabled on them by
the Dial application.
(3) The CDR engine now locks the 'Dial' application as being the CDR
application if it detects that the current CDR has entered that app. This
is similar to the logic that is done for Parking. In general, if we entered
into Dial, then we want that CDR to record the application as such - this
prevents pre-dial handlers, mid-call handlers, and other shenaniganry
from changing the application value.
(4) The CDR engine now checks for the AST_SOFTHANGUP_HANGUP_EXEC in more places
to determine if the channel is in hangup logic or dead. In either case, we
don't want to record changes in the channel.
(5) The default option for "endbeforehexten" has been changed to "yes". In
general, you don't want to see CDRs in the 'h' exten or in hangup logic.
Since the semantics of that option changed in 12, it made sense to update
the default value as well.
(6) Finally, because we now have the ability to synchronize on the messages
published to the CDR topic, on shutdown the CDR engine will now synchronize
to the messages currently in flight. This helps to ensure that all
in-flight CDRs are written before shutting down.
(closes issue ASTERISK-23164)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3154
........
Merged revisions 407084 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r-- | apps/app_dial.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index 6d2437ad3..ce73e9a19 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1285,7 +1285,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, } } peer = c; - ast_channel_publish_dial(in, peer, NULL, "ANSWER"); + /* Inform everyone else that they've been canceled. + * The dial end event for the peer will be sent out after + * other Dial options have been handled. + */ publish_dial_end_event(in, out_chans, peer, "CANCEL"); ast_copy_flags64(peerflags, o, OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | @@ -2739,6 +2742,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } if ( (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) { if (do_privacy(chan, peer, &opts, opt_args, &pa)) { + ast_channel_publish_dial(chan, peer, NULL, pa.status); res = 0; goto out; } @@ -2836,6 +2840,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (continue_exec) *continue_exec = 1; res = 0; + ast_channel_publish_dial(chan, peer, NULL, "ANSWER"); goto done; } @@ -2848,7 +2853,6 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_exten_set(peer, ast_channel_exten(chan)); ast_channel_unlock(peer); ast_channel_unlock(chan); - ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]); res = ast_app_exec_macro(chan, peer, opt_args[OPT_ARG_CALLEE_MACRO]); @@ -2889,6 +2893,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_set_flag64(peerflags, OPT_GO_ON); } } + ast_channel_publish_dial(chan, peer, NULL, macro_result); } else { ast_channel_unlock(peer); } @@ -2971,6 +2976,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_set_flag64(peerflags, OPT_GO_ON); } } + ast_channel_publish_dial(chan, peer, NULL, gosub_result); } else { ast_channel_unlock(peer); ast_channel_unlock(chan); @@ -2978,6 +2984,12 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } if (!res) { + + /* None of the Dial options changed our status; inform + * everyone that this channel answered + */ + ast_channel_publish_dial(chan, peer, NULL, "ANSWER"); + if (!ast_tvzero(calldurationlimit)) { struct timeval whentohangup = ast_tvadd(ast_tvnow(), calldurationlimit); ast_channel_lock(peer); |