Hello,

the CANCEL to be sent is generated locally by tm module from the INVITE that was sent on the branch, so the errors is actually about a duplicate To header in that INVITE. Check it on the network to see if that's the case.

Cheers,
Daniel

On 05.05.21 16:25, Ilie Soltanici wrote:
Hello,

We are having an issue here where Kamailio is complaining about duplicate To header, while in the SIP Packet there is just one. See below the log message:

DEBUG: tm [t_msgbuilder.c:391]: build_local_reparse(): duplicate To header
ERROR: tm [t_msgbuilder.c:531]: build_local_reparse(): cannot build CANCEL request
ERROR: tm [t_cancel.c:297]: cancel_branch(): attempt to build a CANCEL failed
ERROR: tm [t_fwd.c:1434]: e2e_cancel(): cancel error

And this is the sip message:

CANCEL sip:123456789@1.2.3.4:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.1:19373;branch=z9hG4bK-524287-1---7774073fad1a3264;rport
Max-Forwards: 70
To: <sip:123456789@1.2.3.4:5060>
From: "101"<sip:101@1.2.3.4:5060>;tag=6f373b66
Call-ID: hC2O6zx8ZaUJ1di046
CSeq: 2 CANCEL
Proxy-Authorization: Digest username="101",realm="1.2.3.4",nonce="YJKbfWCSmlFTHxdJfKmySydF9L7FzfaqcgyOo4A=",uri="sip:123456789@1.2.3.4:5060",response="2bf2ba8ef2374d6aa8c39d650613077d",algorithm=MD5
User-Agent: TEST
Content-Length: 0

version: kamailio 5.5.0 (x86_64/linux) d4c1a1

The route itself, is like in the standard documentation:

# CANCEL processing
          if KSR.is_CANCEL() :
              KSR.info(RANDOM_LOG + 'KSR.is_CANCEL')
              if KSR.tm.t_check_trans()>0 :
                  self.ksr_route_relay(msg)
              return 1


   def ksr_route_relay(self, msg):
        if KSR.is_method_in("IBSU") :
            if KSR.tm.t_is_set("branch_route")<0 :
                KSR.tm.t_on_branch("ksr_branch_manage")

        if KSR.is_method_in("ISU") :
            if KSR.tm.t_is_set("onreply_route")<0 :
                KSR.tm.t_on_reply("ksr_onreply_manage")

        if KSR.is_INVITE() :
            if KSR.tm.t_is_set("failure_route")<0 :
                KSR.tm.t_on_failure("ksr_failure_manage")

        if KSR.tm.t_relay()<0 :
            KSR.sl.sl_reply_error()

        return -255

Thanks

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
May 17-20, 2021 (Europe Timezone) - June 7-10, 2021 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/