<div dir="ltr"><div>Benoît,</div><div><br></div><div>When you make t_relay for the packet for the first time, it's content "freezes" and would be unchanged for next failure -> t_relay.</div><div>In short words, every time you will go to failure_route, you'll get the original contents of the packet was on the very first t_relay.</div><div>At least, this is how I do understand this logic, maybe developers can correct me here, but I've never experienced other behavior. <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пн, 28 февр. 2022 г. в 13:55, Benoît Panizzon <<a href="mailto:benoit.panizzon@imp.ch">benoit.panizzon@imp.ch</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Igor<br>
<br>
> On which route do you send those variables?<br>
<br>
Trying to shorten a bit.<br>
<br>
Example, call is being sent to a customer device and is getting busy,<br>
this is sent to an asterisk to play the 'busy' tone. But this<br>
is also done with all other kinds of announcements.<br>
<br>
        if t_check_status("(486)|(600)") {<br>
                # BUSY<br>
                $avp(announcecode) = "BUSY";<br>
                route(DISPATCHMEDIA);<br>
                exit;<br>
        }<br>
<br>
DISPMEDIA contains the ID of a dispatcher group consisting of<br>
two sip URI towards our two asterisk media server.<br>
<br>
Extra Header are the used by asterisk to play the desired<br>
announcement in the desired language.<br>
<br>
route[DISPATCHMEDIA]<br>
        $avp(dispgroup) = DISPMEDIA;<br>
        append_hf("IMP-annc: $avp(announcecode)\r\n");<br>
        append_hf("IMP-mandate: $avp(mandate)\r\n");<br>
        append_hf("IMP-language: $avp(callerlang)\r\n");<br>
        if (ds_select_dst("$avp(dispgroup)", "6")) {<br>
                # we have a list of servers and a selection in $du<br>
                if ($avp(debug) > 0) {<br>
                        xlog("L_INFO", "     --> DISPMEDIA targeting request to $ru to location $du \n");<br>
                }<br>
                # Trigger failure route<br>
                t_on_failure("DISPATCH_MEDIA_FAILURE");<br>
                t_on_reply("DISPMEDIA_MANAGE_REPLY");<br>
                route(RELAY);<br>
                exit;<br>
        }<br>
        route(ANNOUNCEREPLY);<br>
        exit;<br>
}<br>
<br>
See part below commented by XXXX where I already 'fixed' it by adding the header<br>
again and I also had to set $rU again as this was reset to $rU of orininal incomming<br>
call containing a ported number routing prefix, which we strip as one of the first<br>
things to get the e164 number.<br>
<br>
failure_route[DISPATCH_MEDIA_FAILURE]<br>
{<br>
        if (t_is_canceled()) {<br>
                exit;<br>
        }<br>
        if (t_check_status("(500)|(503)") or (t_branch_timeout() and !t_branch_replied())) {<br>
                if (ds_next_dst()) {<br>
                        # XXXX SETTING HEADER AGAIN!?!<br>
                        append_hf("IMP-annc: $avp(announcecode)\r\n");<br>
                        append_hf("IMP-mandate: $avp(mandate)\r\n");<br>
                        append_hf("IMP-language: $avp(callerlang)\r\n");<br>
                        if ($avp(debug) > 0) {<br>
                                xlog("L_INFO", "     --> $cfg(route): retargeting request to $ru to location $du \n");<br>
                        }<br>
                        # Trigger failure route again<br>
                        t_on_failure("DISPATCH_MEDIA_FAILURE");<br>
                        t_on_reply("DISPMEDIA_MANAGE_REPLY");<br>
                        route(RELAY);<br>
                        exit;<br>
                }<br>
                route(ANNOUNCEREPLY);<br>
                exit;<br>
        }<br>
}<br>
<br>
I know about how Kamailio works by reading header from an 'input buffer'<br>
and writing to an 'output buffer'.<br>
<br>
I guess in case of t_on_failure the complete output buffer with corrected<br>
$ru and additional header is being discarded so I have to do all changes again?<br>
<br>
-- <br>
Mit freundlichen Grüssen<br>
<br>
-Benoît Panizzon- @ HomeOffice und normal erreichbar<br>
-- <br>
I m p r o W a r e   A G    -    Leiter Commerce Kunden<br>
______________________________________________________<br>
<br>
Zurlindenstrasse 29             Tel  +41 61 826 93 00<br>
CH-4133 Pratteln                Fax  +41 61 826 93 01<br>
Schweiz                         Web  <a href="http://www.imp.ch" rel="noreferrer" target="_blank">http://www.imp.ch</a><br>
______________________________________________________<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Best regards,<div>Igor</div></div></div>