<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    there are two ways:<br>
    <br>
    - handle the response code for t_relay() together with setting the
    flag for not sending responses internally<br>
    - set
<a class="moz-txt-link-freetext" href="http://kamailio.org/docs/modules/stable/modules/tm.html#tm.p.failure_exec_mode">http://kamailio.org/docs/modules/stable/modules/tm.html#tm.p.failure_exec_mode</a><br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 01/05/14 19:54, Waite, Hugh wrote:<br>
    </div>
    <blockquote
cite="mid:A125E59206A9104F81AB3874E34FEF792B520BC3B4@cz-nag-mbx01.intinfra.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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]-->
      <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 color="Gray" face="Arial" 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">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>