summaryrefslogtreecommitdiff
path: root/main/cdr.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2016-01-02 10:26:04 -0600
committerMatt Jordan <mjordan@digium.com>2016-01-02 10:38:08 -0600
commite9dd16364e30a477ed5240b55932620a5af68cc3 (patch)
tree1f5ace84fbac028ec412570f506db35b5b31cf22 /main/cdr.c
parent11d99e0809058841b3f0db4771b212c683ff92a9 (diff)
main/cdr: Allow setting properties on a finalized CDR if it is the last one
Prior to this patch, we explicitly disallowed setting any properties on a finalized CDR. This seemed like a good idea at the time; in practice, it was more restrictive. There are weird and strange scenarios where setting a property on a finalized CDR is definitely wrong. For example, we may Fork a CDR, finalizing the previous one, then change a property. In said case, the old CDR is supposed to now be 'immutable' (so to speak), and should not be updated. From the perspective of the code, a forked CDR that is finalized is just finalized. Hence why we decided these should not be updated. In practice, it is much more common to want to set a property on a CDR in the h extension or in a hangup handler. Disallowing a common scenario to make an esoteric behaviour work isn't good. This patch fixes this by allowing callers to set a property IF we are the last CDR in the chain. This preserves the finalized CDR if it was forked, while allowing the more common case to function. ASTERISK-25458 #close Change-Id: Icf3553c607b9f561152a41e6d8381d594ccdf4b9
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 5e2407502..547177962 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -2976,7 +2976,7 @@ int ast_cdr_setvar(const char *channel_name, const char *name, const char *value
for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
struct varshead *headp = NULL;
- if (it_cdr->fn_table == &finalized_state_fn_table) {
+ if (it_cdr->fn_table == &finalized_state_fn_table && it_cdr->next != NULL) {
continue;
}
if (!strcasecmp(channel_name, it_cdr->party_a.snapshot->name)) {