From f68e0a16eaf09fc2d9eac4dd76a2f485eddf55bd Mon Sep 17 00:00:00 2001 From: Evgeniy Kravtsov Date: Fri, 25 Sep 2026 22:05:01 +0500 Subject: [PATCH] cdr: Preserve ANSWERED disposition with ignoredialchanges When ignoredialchanges is enabled, Dial End events update the disposition of the single CDR. With calls that dial multiple destinations, such as Queue(), one destination can answer while other dialed channels are subsequently cancelled. Those later Dial End events currently overwrite ANSWERED with a non-answer disposition even though the call was answered. Once the CDR reaches AST_CDR_ANSWERED, retain that disposition while dial changes are ignored. Fixes: #2181 UserNote: With ignoredialchanges enabled, answered calls retain an ANSWERED disposition when later dial attempts end without answer. --- main/cdr.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/cdr.c b/main/cdr.c index 1b936ea630..390817fb51 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -2283,9 +2283,14 @@ static void handle_dial_message(void *data, struct stasis_subscription *sub, str continue; } if (dial_changes_ignored) { - /* Set the disposition, and do nothing else. */ - it_cdr->disposition = dial_status_to_disposition(dial_status); - CDR_DEBUG("%p - Setting disposition and that's it (%s)\n", it_cdr, dial_status); + /* + * Once a dial has been answered, later non-answer Dial End events + * must not downgrade the CDR disposition. + */ + if (it_cdr->disposition != AST_CDR_ANSWERED) { + it_cdr->disposition = dial_status_to_disposition(dial_status); + } + CDR_DEBUG("%p - Handling disposition only (%s)\n", it_cdr, dial_status); continue; } CDR_DEBUG("%p - Processing Dial End message for channel %s, peer %s\n",