main/cdr: Copy context/exten on chained CDRs for parallel dials in subroutines

When a parallel dial occurs, a new CDR will be created for each dial
attempt that is made. In most circumstances, the act of creating each
CDR in the chain will include a step that updates the Party A snapshot,
which causes the context/extension of the Party A to be copied onto the
CDR object.

However, when the Party A is in a subroutine, we explicitly do *not*
copy the context/extension onto the CDR. This prevents the Macro or
GoSub routine name from blowing away the context/extension that the
channel was originally executing in. For the original CDR, this is not a
problem: the original CDR already recorded the last known 'good' state
of the channel just prior to it going into the subroutine. However, for
newly generated CDRs in a chain, there is no context/extension set on
them. Since we are in a subroutine, we will never set the Party A's
context/extension on the CDR, and we end up with a CDR with no
destination recorded on it.

This patch updates the creation of a chained CDR such that it copies
over the original CDR's context/extension. This is the last known "good"
state of the CDR, and is a reasonable starting point for the newly
generated CDR. In the case where we are not in a subroutine, subsequent
code will update the location of the CDR from the Party A information;
in the case where we are in a subroutine, the context/extension on the
original CDR is the correct information.

ASTERISK-24443 #close

Change-Id: I6a3ef0d6e458d3b9b30572feaec70f2964f3bc2a
This commit is contained in:
Matt Jordan 2015-06-12 14:28:47 -05:00
parent 56d6b52a3f
commit b8bc15286f
1 changed files with 2 additions and 0 deletions

View File

@ -912,6 +912,8 @@ static struct cdr_object *cdr_object_create_and_append(struct cdr_object *cdr)
ast_string_field_set(new_cdr, linkedid, cdr_last->linkedid);
ast_string_field_set(new_cdr, appl, cdr_last->appl);
ast_string_field_set(new_cdr, data, cdr_last->data);
ast_string_field_set(new_cdr, context, cdr_last->context);
ast_string_field_set(new_cdr, exten, cdr_last->exten);
/* Copy over other Party A information */
cdr_object_snapshot_copy(&new_cdr->party_a, &cdr_last->party_a);