From: Matt Jordan Date: Fri, 12 Jun 2015 19:28:47 +0000 (-0500) Subject: main/cdr: Copy context/exten on chained CDRs for parallel dials in subroutines X-Git-Tag: 13.5.0-rc1~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78ea356e78a4dc7c88b2212d1c4bf700bc5c5701;p=thirdparty%2Fasterisk.git 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 --- diff --git a/main/cdr.c b/main/cdr.c index 96d055ca09..f43d3cba8c 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -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);