cdrs: Check for applications to lock onto during dial begin handling
authorMatthew Jordan <mjordan@digium.com>
Mon, 3 Feb 2014 01:31:53 +0000 (01:31 +0000)
committerMatthew Jordan <mjordan@digium.com>
Mon, 3 Feb 2014 01:31:53 +0000 (01:31 +0000)
This patch brings CDR processing further in line with r407085. During some dial
operations, the application would not be locked to the Dial application and
would instead continue to show the previously known application. In particular,
this would occur when a Parked call would time out. This was due to a previous
snapshot already locking the application to Park - processing this in a Dial
Begin allows the Dial application to reassert its rightful place.

(CDRs. Ugh.)

But hooray for the Parked Call tests for catching this in the Asterisk Test
Suite.
........

Merged revisions 407166 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407169 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/cdr.c

index 2b67ba9..c15da10 100644 (file)
@@ -1351,13 +1351,13 @@ static int base_process_party_a(struct cdr_object *cdr, struct ast_channel_snaps
 
        ast_assert(strcasecmp(snapshot->name, cdr->party_a.snapshot->name) == 0);
 
-       cdr_object_swap_snapshot(&cdr->party_a, snapshot);
        /* Ignore any snapshots from a dead or dying channel */
        if (ast_test_flag(&snapshot->softhangup_flags, AST_SOFTHANGUP_HANGUP_EXEC)
                        && ast_test_flag(&mod_cfg->general->settings, CDR_END_BEFORE_H_EXTEN)) {
                cdr_object_check_party_a_hangup(cdr);
                return 0;
        }
+       cdr_object_swap_snapshot(&cdr->party_a, snapshot);
 
        /* When Party A is originated to an application and the application exits, the stack
         * will attempt to clear the application and restore the dummy originate application
@@ -1447,7 +1447,7 @@ static int single_state_process_dial_begin(struct cdr_object *cdr, struct ast_ch
        RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
 
        if (caller && !strcasecmp(cdr->party_a.snapshot->name, caller->name)) {
-               cdr_object_swap_snapshot(&cdr->party_a, caller);
+               base_process_party_a(cdr, caller);
                CDR_DEBUG(mod_cfg, "%p - Updated Party A %s snapshot\n", cdr,
                                cdr->party_a.snapshot->name);
                cdr_object_swap_snapshot(&cdr->party_b, peer);
@@ -1461,7 +1461,7 @@ static int single_state_process_dial_begin(struct cdr_object *cdr, struct ast_ch
                ast_set_flag(&cdr->flags, AST_CDR_LOCK_APP);
        } else if (!strcasecmp(cdr->party_a.snapshot->name, peer->name)) {
                /* We're the entity being dialed, i.e., outbound origination */
-               cdr_object_swap_snapshot(&cdr->party_a, peer);
+               base_process_party_a(cdr, peer);
                CDR_DEBUG(mod_cfg, "%p - Updated Party A %s snapshot\n", cdr,
                                cdr->party_a.snapshot->name);
        }