<div dir="ltr">Hi Bogdan,<div><br></div><div>Thanks for the response amd link to append_to_reply()</div><div><br></div><div>What is the best function to use to extract the Reason header to feed in to append_to_reply()?</div><div><br></div><div>Thank you.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 16 Apr 2021 at 11:07, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <tt>Hi,<br>
      <br>
      use the append_to_reply() function<br>
      <br>
<a href="https://opensips.org/html/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply" target="_blank">https://opensips.org/html/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply</a><br>
      <br>
      Regards,<br>
    </tt>
    <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2021 online
  <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" target="_blank">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a></pre>
    <div>On 4/16/21 12:22 PM, solarmon wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi,<br>
        <div><br>
        </div>
        <div>We have a code that response back with a "503 Service not
          available" if it has exhausted all the dispatcher endpoints -
          see end of email.</div>
        <div><br>
        </div>
        <div>It would be useful if we casn send back the Reason header
          of the last rejection. Could this be done and what should I
          look at?</div>
        <div><br>
        </div>
        <div>Thank you!</div>
        <div><br>
        </div>
        <div>failure_route[call_failover]<br>
          {<br>
                  xlog("[$ci] call failed to established with
          $T_reply_code code\n");<br>
          <br>
                  rtpproxy_unforce("$avp(rtpp_set)");<br>
          <br>
                  if (t_was_cancelled()) {<br>
                          t_reply("487","Request cancelled");<br>
                          exit;<br>
                  }<br>
          <br>
                  # any failure indication ?<br>
                  if ( t_check_status("[56][0-9][0-9]")<br>
                  || (t_check_status("408") &&
          t_local_replied("all"))<br>
                  ) {<br>
                          xlog("[$ci] destination $rd failed  with
          $T_reply_code -> retry\n ");<br>
          <br>
                          ###ds_mark_dst("p");<br>
          <br>
                          if ( ds_next_domain() ) {<br>
                                  xlog("[$ci] using new destination
          <$rd>\n ");<br>
          <br>
                                  # send it out again<br>
                                  t_on_failure("call_failover");<br>
                                  t_relay();<br>
                                  exit;<br>
                          } else {<br>
                                  xlog("[$ci] no other destination to
          retry\n ");<br>
                                  t_reply("503","Service not
          available");<br>
                                  exit;<br>
                          }<br>
                  }<br>
          <br>
                  # if call failure, allow the reply to propagate to
          caller<br>
                  exit;<br>
          }<br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div>