I am in process of migrating from 1.11 to 2.2. We have a situation
where we have a routing opensips that can make multiple attempts to
complete a call. The information specific to each attempt is passed
to the SBC opensips through headers. In order to not double up on
headers, I moved the code that calls append_hf to a branch. As the
call progresses, I update various AVP's and print them into the log
(so I can see that they are being updated correctly). Below is an
example scenario of what I am doing.

initial call setup logic
set the t_on_failure
setup for first carrier
branch
setup headers with carrier information used by the SBC
$avp(test) := "Step 1;";
t_relay
on_failure (for example 480 - timeout)
setup for the next carrier
branch
setup header for next carrier information used by the SBC