SIP Header Manipulation at a Trunk level

I am current running asterisk 1.8.13.0 and freePBX 2.9.0.12 but if I need to upgrade to solve my current problem I will certainly look at that as a solution.

I need to perform a SIP header modification for each trunk, I can currently achive this for a single trunk where I hard code the Pilot AoR and use the macro predial-hook, an example of what I am doing is shown below.

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Adding P-Asserted-Identity for Trunk Pilot User)
exten => s,n,SipAddHeader(P-Asserted-Identity: sip:[email protected] )
exten => s,n(done),MacroExit()

An idea would be if during the call routing logic I could pass the currently hardcoded AoR sections as one or two different variables.
I am open to ideas here for passing on vallues based on the trunk selected for routing.
please note that the From header may not be the Pilot AoR so not simply a case of copying the FROM.
Ideally the solution would be something that is automated or was possible to do using freePBX provisioning frontend.

Ciao

Paul