[OpenSIPS-Users] t_reply() with Reason header

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Apr 16 10:06:53 EST 2021


Hi,

use the append_to_reply() function

https://opensips.org/html/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Bootcamp 2021 online
   https://opensips.org/training/OpenSIPS_eBootcamp_2021/

On 4/16/21 12:22 PM, solarmon wrote:
> Hi,
>
> 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.
>
> 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?
>
> Thank you!
>
> failure_route[call_failover]
> {
>         xlog("[$ci] call failed to established with $T_reply_code 
> code\n");
>
>         rtpproxy_unforce("$avp(rtpp_set)");
>
>         if (t_was_cancelled()) {
>                 t_reply("487","Request cancelled");
>                 exit;
>         }
>
>         # any failure indication ?
>         if ( t_check_status("[56][0-9][0-9]")
>         || (t_check_status("408") && t_local_replied("all"))
>         ) {
>                 xlog("[$ci] destination $rd failed  with $T_reply_code 
> -> retry\n ");
>
>                 ###ds_mark_dst("p");
>
>                 if ( ds_next_domain() ) {
>                         xlog("[$ci] using new destination <$rd>\n ");
>
>                         # send it out again
>                         t_on_failure("call_failover");
>                         t_relay();
>                         exit;
>                 } else {
>                         xlog("[$ci] no other destination to retry\n ");
>                         t_reply("503","Service not available");
>                         exit;
>                 }
>         }
>
>         # if call failure, allow the reply to propagate to caller
>         exit;
> }
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210416/85217e3e/attachment.html>


More information about the Users mailing list