<div><div dir="auto">The SIP code 503 is tricky in the sense that i can indicate either server maintenance or server overload. In both cases it can send Retry-After header and any subsequent requests from same source are ignored for the duration of Retry-After interval. [1].</div></div><div dir="auto"><br></div><div dir="auto">Additionally RFC3261 and RFC3263 define that transport failures (generally due to fatal ICMP errors in UDP and connection failures in TCP) should be treated as 503 response. [2].</div><div dir="auto"><br></div><div dir="auto">So in all above cases, it is most likely that dialog does not establishes at all and 503 response is treated similar to stateless response. Therefore, a to-tag can be added/replaced before sending it to UAC.</div><div dir="auto"><br></div><div dir="auto">Theoretically, kamailio should check and use to-tag from 503 response when converting it to 500 response and only create new to-tag if it is absent.</div><div dir="auto"><br></div><div dir="auto">References:</div><div dir="auto"><br></div><div dir="auto"><div>[1] <a href="https://tools.ietf.org/html/rfc3261#section-21.5.4">https://tools.ietf.org/html/rfc3261#section-21.5.4</a></div><div dir="auto"><br></div><div>[2] <a href="https://tools.ietf.org/html/draft-hilt-sip-correction-503-01#section-4">https://tools.ietf.org/html/draft-hilt-sip-correction-503-01#section-4</a></div><br></div><div dir="auto"><br></div><div dir="auto">Hope this helps.</div><div dir="auto"><br></div><div dir="auto"><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 22 Jul 2020 at 21:08, Henning Westerholt <<a href="mailto:hw@skalatan.de">hw@skalatan.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="DE" link="blue" vlink="purple">
<div class="m_-5300728039720019352WordSection1">
<p class="MsoNormal"><span>Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Apparently, this is the way the code works:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">t_reply.c:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">                        if (relayed_code==503 && tm_remap_503_500){<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">                                /* replace a final 503 with a 500:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">                                 * generate a "FAKE" reply and a new to_tag (for easier<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">                                 *  debugging)*/<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Lets see if maybe others can comment as well. Otherwise you could just open an issue on our tracker, it is probably not that hard to change this.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Cheers,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">-- <u></u>
<u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Henning Westerholt –
</span><span><a href="https://skalatan.de/blog/" target="_blank"><span lang="EN-GB" style="color:#0563c1">https://skalatan.de/blog/</span></a></span><span lang="EN-GB"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-GB">Kamailio services –
</span><span><a href="https://gilawa.com/" target="_blank"><span lang="EN-GB" style="color:#0563c1">https://gilawa.com</span></a></span><span>
<span lang="EN-GB"><u></u><u></u></span></span></p>
</div>
<p class="MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>>
<b>On Behalf Of </b>Gerry | Rigatta<br>
<b>Sent:</b> Wednesday, July 22, 2020 8:58 PM<br>
<b>To:</b> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
<b>Subject:</b> [SR-Users] bug ? remap_503_500 breaks dialogs<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:35.4pt">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">I am using Kamailio 5.2. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Apparently the remapping of 503 to 500 codes in the tm module does also change the to-tag. This behaviour breaks dialogs with yate and therefore calls hang and the 503 remains unacknowledged. After disabling the
 503 to 500 remapping with modparam("tm", "remap_503_500", 0) all works fine again.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Changing the to-tag in a dialog seems to contradict RFC3261, or do I see this wrongly?<u></u><u></u></p>
</div>
<div>
<h2 style="margin-left:35.4pt"><a name="m_-5300728039720019352_section-12"></a><a href="https://tools.ietf.org/html/rfc3261#section-12" target="_blank"><span><span style="font-family:"Arial",sans-serif">12</span></span><span></span></a><span></span><span style="font-family:"Arial",sans-serif">
 Dialogs<u></u><u></u></span></h2>
<h2 style="margin-left:35.4pt"><span style="font-family:"Arial",sans-serif">A dialog is identified at each UA with a dialog ID, which consists of a Call-ID value, a local tag and a remote tag…"<u></u><u></u></span></h2>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Thanks for looking into this.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt">Gerry<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:35.4pt"><u></u> <u></u></p>
</div>
</div>
</div>

_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div></div>