How to remove Reason HF from branched CANCEL?
Hi Gang I try to remove the Reason Header from a CANCEL message. I use parallel branching on the registrar. The route below is called very soon in request_route. The cancel matches as I get the log entry just before calling remove_hf("Reason") But the Reason HF is still present when the CANCEL is forked to the registered CPE. The INVITE is routed through a branch_route after forking where headers can be altered per branch. But I don't see the CANCEL in the branch route. Is there a way to alter header in a branched cancel message? # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) { route(FILTER_CANCEL); route(RELAY); } exit; } route[FILTER_CANCEL] { # Buggy iPhones send wrong cancel cause code 200. if (is_present_hf("Reason")) { $var(cause) = $(hdr(Reason){param.value,cause}); $var(text) = $(hdr(Reason){param.value,text}); if (($var(cause) == 200) && ($var(text) == "Call Rejected By User")) { if ($avp(debug) > 0) { xlog("L_INFO", "$cfg(route): Remove wrong iPhone Cancel Reason HF\n"); } remove_hf("Reason"); } } } Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Hello, did you played already with - local_cancel_reason - e2e_cancel_reason from the tm module? Cheers, Henning -----Original Message----- From: Benoit Panizzon via sr-users <sr-users@lists.kamailio.org> Sent: Tuesday, May 13, 2025 10:45 AM To: sr-users@lists.kamailio.org Cc: Benoit Panizzon <benoit.panizzon@imp.ch> Subject: [SR-Users] How to remove Reason HF from branched CANCEL? Hi Gang I try to remove the Reason Header from a CANCEL message. I use parallel branching on the registrar. The route below is called very soon in request_route. The cancel matches as I get the log entry just before calling remove_hf("Reason") But the Reason HF is still present when the CANCEL is forked to the registered CPE. The INVITE is routed through a branch_route after forking where headers can be altered per branch. But I don't see the CANCEL in the branch route. Is there a way to alter header in a branched cancel message? # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) { route(FILTER_CANCEL); route(RELAY); } exit; } route[FILTER_CANCEL] { # Buggy iPhones send wrong cancel cause code 200. if (is_present_hf("Reason")) { $var(cause) = $(hdr(Reason){param.value,cause}); $var(text) = $(hdr(Reason){param.value,text}); if (($var(cause) == 200) && ($var(text) == "Call Rejected By User")) { if ($avp(debug) > 0) { xlog("L_INFO", "$cfg(route): Remove wrong iPhone Cancel Reason HF\n"); } remove_hf("Reason"); } } } Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________ __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hi Henning
did you played already with
- local_cancel_reason - e2e_cancel_reason
from the tm module?
No, but thank you for hinting towards the possibilities and documentation on how TM handles cancel. So documenting my findings for the mail archive :-) Cancel is not routed, but always generated locally (as a result of an answered branch or of an inbound CANCEL). In the case of e2e cancel the Reason header is copied from the inbound cancel to the generated outbound branch CANCEL. This is why remove_hf() does not work. I would prefer not to disable copying the reason e2e_cancel_reason => 0 But rather only disable it, when the wrong reason, causing missed calls not to be logged at the destination, sent by iPhones, is encountered. t_set_no_e2e_cancel_reason(1) would require to be set at the start of the transaction (INVITE) when the bogus reason is not yet known. I reverted to call msg_apply_changes() after removing the header in the inbound CANCEL matching the iPhone text and cause. This works. I just hope calling msg_apply_changes() on something as simple as CANCEL will not break anything else. I guess not, as only the Reason header is copied from the original cancel request. Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
participants (2)
-
Benoit Panizzon -
Henning Westerholt