<p>Ok, I tested and it is working but I would kindly need an explanation</p>
<p>1- the setup :</p>
<ul>
<li>kamailio 5.1 with three listen (on port 5060, 5063, 5066)</li>
<li>2 UAs using UDP on port 5063</li>
<li>added a log in the script</li>
</ul>
<pre><code>route[WITHINDLG] {
        if (!has_totag()) return;

        # sequential request withing a dialog should
        # take the path determined by record-routing
        if (loose_route()) {
                route(DLGURI);
                if (is_method("BYE")) {
                        setflag(FLT_ACC); # do accounting ...
                        setflag(FLT_ACCFAILED); # ... even if the transaction fails
                } else if ( is_method("ACK") ) {
                        # ACK is forwarded statelessly
                        xlog("forced socket $fs\n");
                        route(NATMANAGE);
                } else if ( is_method("NOTIFY") ) {
                        # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
                        record_route();
                }
                route(RELAY);

</code></pre>
<p>2- parameter for rr module</p>
<pre><code>modparam("rr", "enable_full_lr", 0)
modparam("rr", "enable_double_rr", 1)

</code></pre>
<p>3- result - on K master, ACK gets forwarded  <strong>properly</strong> using source port 5036 with the following traces</p>
<pre><code>Feb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:812]: after_loose(): Topmost route URI: 'sip:172.21.100.108:5063;lr' is me

Feb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: <core> [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header

Feb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:181]: find_next_route(): No next Route HF found
Feb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:842]: after_loose(): No next URI found
Feb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} ERROR: <script>: forced socket <null>`
</code></pre>

<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/1428#issuecomment-365662410">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZSa0AkKM4F7v5fg9cQzoUFFAvaFLks5tUwlygaJpZM4R5l_w">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZREXmTHqYSNzm4gQRY0gRnenk1elks5tUwlygaJpZM4R5l_w.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/1428#issuecomment-365662410"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<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://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@neutrino38 in #1428: Ok, I tested and it is working but I would kindly need an explanation\r\n\r\n1- the setup : \r\n- kamailio 5.1 with three listen (on port 5060, 5063, 5066)\r\n- 2 UAs using UDP on port 5063\r\n- added a log in the script\r\n\r\n\r\n```\r\nroute[WITHINDLG] {\r\n        if (!has_totag()) return;\r\n\r\n        # sequential request withing a dialog should\r\n        # take the path determined by record-routing\r\n        if (loose_route()) {\r\n                route(DLGURI);\r\n                if (is_method(\"BYE\")) {\r\n                        setflag(FLT_ACC); # do accounting ...\r\n                        setflag(FLT_ACCFAILED); # ... even if the transaction fails\r\n                } else if ( is_method(\"ACK\") ) {\r\n                        # ACK is forwarded statelessly\r\n                        xlog(\"forced socket $fs\\n\");\r\n                        route(NATMANAGE);\r\n                } else if ( is_method(\"NOTIFY\") ) {\r\n                        # Add Record-Route for in-dialog NOTIFY as per RFC 6665.\r\n                        record_route();\r\n                }\r\n                route(RELAY);\r\n\r\n```\r\n\r\n2- parameter for rr module\r\n\r\n```\r\nmodparam(\"rr\", \"enable_full_lr\", 0)\r\nmodparam(\"rr\", \"enable_double_rr\", 1)\r\n\r\n```\r\n\r\n3- result - on K master, ACK gets forwarded  **properly** using source port 5036 with the following traces\r\n\r\n```\r\nFeb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:812]: after_loose(): Topmost route URI: 'sip:172.21.100.108:5063;lr' is me\r\n\r\nFeb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: \u003ccore\u003e [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header\r\n\r\nFeb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:181]: find_next_route(): No next Route HF found\r\nFeb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} DEBUG: rr [loose.c:842]: after_loose(): No next URI found\r\nFeb 14 17:13:50 mcudev3 /usr/local/sbin/kamailio[21394]: {1 5765 ACK ffb8d7ca-efae-79ef-6035-dd1043352c55} ERROR: \u003cscript\u003e: forced socket \u003cnull\u003e`\r\n```\r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1428#issuecomment-365662410"}}}</script>