From 92caab3647f7006f67af8bf835e84dbb94e735b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zvonimir=20Bu=C5=BEani=C4=87?= Date: Wed, 26 Oct 2022 19:53:01 +0200 Subject: [PATCH] [core] Fix wrong reason code for group call --- src/switch_ivr_originate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c4f4bfa2b2..63a0911929 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1795,7 +1795,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess if (cancel_cause && *cancel_cause > 0) { handles[i].cancel_cause = *cancel_cause; } else { - handles[i].cancel_cause = SWITCH_CAUSE_LOSE_RACE; + /* Was this call taken by another destination? */ + if (hp != NULL && hp->cause == SWITCH_CAUSE_SUCCESS) { + /* Yes, the race was lost */ + handles[i].cancel_cause = SWITCH_CAUSE_LOSE_RACE; + } else { + /* No, something else happened, probably Originator Cancel */ + handles[i].cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL; + } } }