<div dir="ltr">Hello,<br><div><br></div><div>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:</div><div><br></div><div>DEBUG: tm [t_msgbuilder.c:391]: build_local_reparse(): duplicate To header</div><div>ERROR: tm [t_msgbuilder.c:531]: build_local_reparse(): cannot build CANCEL request<br>ERROR: tm [t_cancel.c:297]: cancel_branch(): attempt to build a CANCEL failed<br>ERROR: tm [t_fwd.c:1434]: e2e_cancel(): cancel error<br></div><div><br></div><div>And this is the sip message:</div><div><br></div><div>CANCEL <a href="http://sip:123456789@1.2.3.4:5060">sip:123456789@1.2.3.4:5060</a> SIP/2.0<br>Via: SIP/2.0/UDP 192.168.1.1:19373;branch=z9hG4bK-524287-1---7774073fad1a3264;rport<br>Max-Forwards: 70<br>To: <<a href="http://sip:123456789@1.2.3.4:5060">sip:123456789@1.2.3.4:5060</a>><br>From: "101"<<a href="http://sip:101@1.2.3.4:5060">sip:101@1.2.3.4:5060</a>>;tag=6f373b66<br>Call-ID: hC2O6zx8ZaUJ1di046<br>CSeq: 2 CANCEL<br>Proxy-Authorization: Digest username="101",realm="1.2.3.4",nonce="YJKbfWCSmlFTHxdJfKmySydF9L7FzfaqcgyOo4A=",uri="<a href="http://sip:123456789@1.2.3.4:5060">sip:123456789@1.2.3.4:5060</a>",response="2bf2ba8ef2374d6aa8c39d650613077d",algorithm=MD5<br>User-Agent: TEST<br>Content-Length: 0<br></div><div><br></div><div>version: kamailio 5.5.0 (x86_64/linux) d4c1a1</div><div><br></div><div>The route itself, is like in the standard documentation:</div><div><br></div><div># CANCEL processing<br>          if KSR.is_CANCEL() :<br>              KSR.info(RANDOM_LOG + 'KSR.is_CANCEL')<br>              if KSR.tm.t_check_trans()>0 :<br>                  self.ksr_route_relay(msg)<br>              return 1<br></div><div><br></div><div><br></div><div>   def ksr_route_relay(self, msg):<br>        if KSR.is_method_in("IBSU") :<br>            if KSR.tm.t_is_set("branch_route")<0 :<br>                KSR.tm.t_on_branch("ksr_branch_manage")<br><br>        if KSR.is_method_in("ISU") :<br>            if KSR.tm.t_is_set("onreply_route")<0 :<br>                KSR.tm.t_on_reply("ksr_onreply_manage")<br><br>        if KSR.is_INVITE() :<br>            if KSR.tm.t_is_set("failure_route")<0 :<br>                KSR.tm.t_on_failure("ksr_failure_manage")<br><br>        if KSR.tm.t_relay()<0 :<br>            KSR.sl.sl_reply_error()<br><br>        return -255<br></div><div><br></div><div>Thanks</div></div>