summaryrefslogtreecommitdiff
path: root/apps/app_disa.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-12-19 00:50:01 +0000
committerMatthew Jordan <mjordan@digium.com>2013-12-19 00:50:01 +0000
commit7e9febbf86f7a9aa0cc1d9852d1ed1b77f25b3ce (patch)
treefafe2c3b45211d267449024e44dd10f65ac77e9d /apps/app_disa.c
parentaf723c6572e988753c24cbb911d6b521600f4a3f (diff)
app_cdr,app_forkcdr,func_cdr: Synchronize with engine when manipulating state
When doing the rework of the CDR engine that pushed all of the logic into cdr.c and made it respond to changes in channel state over Stasis, we knew that accessing the CDR engine from the dialplan would be "slightly" non-deterministic. Dialplan threads would be accessing CDRs while Stasis threads would be updating the state of said CDRs - whereas in the past, everything happened on the dialplan threads. Tests have shown that "slightly" is in reality "very". This patch synchronizes things by making the dialplan applications/functions that manipulate CDRs do so over Stasis. ForkCDR, NoCDR, ResetCDR, CDR, and CDR_PROP now all use Stasis to send their requests over to the CDR engine, and synchronize on the channel Stasis topic via a subscription so that they return their values/control to the dialplan at the appropriate time. While going through this, the following changes were also made: * DISA, which can reset the CDR when a user successfully authenticates, now just uses the ResetCDR app to do this. This prevents having to duplicate the same Stasis synchronization logic in that application. * Answer no longer disables CDRs. It actually didn't work anyway - calling DISABLE on the channel's CDR doesn't stop the CDR from getting the Answer time - it just kills all CDRs on that channel, which isn't what the caller would intend. (closes issue ASTERISK-22884) (closes issue ASTERISK-22886) Review: https://reviewboard.asterisk.org/r/3057/ ........ Merged revisions 404294 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_disa.c')
-rw-r--r--apps/app_disa.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 9e7412717..824e8fe55 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -27,6 +27,7 @@
*/
/*** MODULEINFO
+ <use type="module">app_cdr</use>
<support_level>core</support_level>
***/
@@ -362,7 +363,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
if (k == 3) {
int recheck = 0;
- struct ast_flags cdr_flags = { AST_CDR_FLAG_DISABLE, };
+ struct ast_app *app_reset_cdr;
if (!ast_exists_extension(chan, args.context, exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
@@ -387,10 +388,12 @@ static int disa_exec(struct ast_channel *chan, const char *data)
ast_channel_unlock(chan);
}
- if (special_noanswer) {
- ast_clear_flag(&cdr_flags, AST_CDR_FLAG_DISABLE);
+ app_reset_cdr = pbx_findapp("ResetCDR");
+ if (app_reset_cdr) {
+ pbx_exec(chan, app_reset_cdr, special_noanswer ? "" : "e");
+ } else {
+ ast_log(AST_LOG_NOTICE, "ResetCDR application not found; CDR will not be reset\n");
}
- ast_cdr_reset(ast_channel_name(chan), &cdr_flags);
ast_explicit_goto(chan, args.context, exten, 1);
return 0;
}