I am trying to change/re-write From URI username and From display name ($fU and $fn respectively) to avposp values

I tried:

$fU = $avp(s:somevariable);
avp_write("$fU","$avp(s:somevariable)");
append_hf("From-username: $avp(s:somevariable)\r\n");


but none of them works, any ideas on how to re-write those variables in SIP messages? Thank you