<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I have an edge-proxy which accepts TCP connections from clients. When I know that the clients are behind NATs (for example), I use the set_forward_no_connect() function to force connection reuse and avoid timeouts. In the case where the
 connection has already gone, the system sends a “477 Unfortunately error on sending to next hop occurred (477/TM)” response back to the registrar.<o:p></o:p></p>
<p class="MsoNormal">These connections are using outbound, so I would like to convert this into a “430 Flow Failed” response to the registrar, but the 477 response doesn’t seem to trigger the onreply_route or failure_route.<o:p></o:p></p>
<p class="MsoNormal">Is there a way of trapping and handling this failure? If not, do we need more flexibility in handling this particular tcp_send error (or other similar ones)? Other systems may wish to try additional destinations from the failure route.<o:p></o:p></p>
<p class="MsoNormal">Snippets of my cfg and logs are below. The con_reuse flag is checked in tcp_send at tcp_main.c:1846<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Hugh<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">route[RELAY] {<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt">xlog("L_INFO", "$rm: route[RELAY]\n");<o:p></o:p></p>
<p class="MsoNormal">                loose_route();<o:p></o:p></p>
<p class="MsoNormal">                $var(lr_ret) = $rc;<o:p></o:p></p>
<p class="MsoNormal">                if ($var(lr_ret) == 2) {<o:p></o:p></p>
<p class="MsoNormal">                        xlog("L_INFO", "$rm:  loose route with outbound\n");<o:p></o:p></p>
<p class="MsoNormal">                        t_on_failure("FAIL_OUTBOUND");<o:p></o:p></p>
<p class="MsoNormal">                        set_forward_no_connect();<o:p></o:p></p>
<p class="MsoNormal">                        if (t_relay() < 0) {<o:p></o:p></p>
<p class="MsoNormal">                                xlog("L_WARN", "$rm:  loose route with outbound failed\n");<o:p></o:p></p>
<p class="MsoNormal">                                sl_send_reply("500", "Something bad happened");<o:p></o:p></p>
<p class="MsoNormal">                        }<o:p></o:p></p>
<p class="MsoNormal">                        exit;<o:p></o:p></p>
<p class="MsoNormal">                }<o:p></o:p></p>
<p class="MsoNormal">                . . .<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE: Routing logic starts here<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE: route[REQINIT]<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE: route[INITIAL_REQUEST]<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE: route[RECORD_ROUTE]<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE: route[RELAY]<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: INVITE:  loose route with outbound<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: ERROR: tm [../../forward.h:219]: msg_send(): msg_send: ERROR: tcp_send failed<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: ERROR: tm [t_fwd.c:1609]: t_send_branch(): ERROR: t_send_branch: sending request on branch 0 failed<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: ACK: Routing logic starts here<o:p></o:p></p>
<p class="MsoNormal">May  1 17:01:08 kamailio-cep[28226]: INFO: <script>: ACK: route[REQINIT]<o:p></o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed
 to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you for understanding.<br>
</font>
<br clear=all> 
</body>
</html>