<p>As guessed before, you are using forward() in your config, which does stateless forwarding, next is the part of the config showing it:</p>
<pre><code>...
request_route {

        # per request initial checks
        route(REQINIT);

        # NAT detection
        route(NATDETECT);
        t_check_trans();
        
        if ( method=="INVITE" ) {
                ds_select_dst("1","4");
                sl_send_reply("100","Trying");
                forward();
                exit();
        }
...
</code></pre>
<p>You have to use t_relay() instead of forward() for stateful routing, if you want to work on top of default kamailio.cfg. Otherwise, you have to add a logic to ensure that CANCEL is sent to the same destination as INVITE.</p>
<p>Also, the place in config where you do the routing for INVITE is not really a good one, re-INVITEs being misrouted.</p>
<p>Anyhow, this is not an issue of kamailio code, but the configuration file. You have to use <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a> mailing list for sorting out issue with kamailio.cfg.</p>
<p>Closing this one.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1841#issuecomment-462670811">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZcR3TzLTd2879Gt_iw-s-sh7wQKYks5vMn-6gaJpZM4anCmc">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZUGGH9L06yd_HlAQL63JB4QfhmDQks5vMn-6gaJpZM4anCmc.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1841: As guessed before, you are using forward() in your config, which does stateless forwarding, next is the part of the config showing it:\r\n\r\n```\r\n...\r\nrequest_route {\r\n\r\n\t# per request initial checks\r\n\troute(REQINIT);\r\n\r\n\t# NAT detection\r\n\troute(NATDETECT);\r\n\tt_check_trans();\r\n\t\r\n\tif ( method==\"INVITE\" ) {\r\n\t\tds_select_dst(\"1\",\"4\");\r\n\t\tsl_send_reply(\"100\",\"Trying\");\r\n\t\tforward();\r\n\t\texit();\r\n\t}\r\n...\r\n```\r\n\r\nYou have to use t_relay() instead of forward() for stateful routing, if you want to work on top of default kamailio.cfg. Otherwise, you have to add a logic to ensure that CANCEL is sent to the same destination as INVITE.\r\n\r\nAlso, the place in config where you do the routing for INVITE is not really a good one, re-INVITEs being misrouted.\r\n\r\nAnyhow, this is not an issue of kamailio code, but the configuration file. You have to use sr-users@lists.kamailio.org mailing list for sorting out issue with kamailio.cfg.\r\n\r\nClosing this one."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1841#issuecomment-462670811"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1841#issuecomment-462670811",
"url": "https://github.com/kamailio/kamailio/issues/1841#issuecomment-462670811",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>