Salut Patrick
Thank you for your help.
I ended up with this:
if (t_check_status("(301)|(302)") or (t_branch_timeout() and !t_branch_replied())) { $avp(destination) = $(T_rpl($ct){tobody.user}); xlog("L_ERR", "$cfg(route): Got: $avp(rstatus) $avp(rtext) towards $T_rpl($ct) => $avp(destination)"); append_hf("IMP-cust-profile-code: $var(cust_profile_code)\r\n"); $var(newai) = "<sip:" + $rU + "@" + $(ai{uri.host}) + ">"; append_hf("P-Asserted-Identity: $var(newai)\r\n"); $var(newdi) = "<sip:" + $rU + "@" + $(fu{uri.host}) + ">;reason=unknown"; append_hf("IMP-screening: no\r\n" ); append_hf("Diversion: $var(newdi)\r\n"); route(IMP_TRANSLATE_INBOUND); route(IMP_ROUTE_TO_CORE); exit; }
It sort of starts working, but I'm not there yet :-)
The next issue I am right now bumping into is that I translated some 'write is append' header towards the CPE ($tU and $fU) and now I am translating them again (as if they were sent from the CPE) and writing to them again so I end up with the original destination and new destination concatenated.
Is there a way to 'reset' the $tU and $fU after setting them once, so that they can be set again?