Usually, one would not need a hook to send PAI – on a pjsip trunk, set Send RPID/PAI appropriately; for chan_sip use sendrpid=pai . Then, the Outbound CID for the extension (or the Outbound Route) will be sent on that trunk.
If you add a second trunk that requires the outbound caller ID to be sent differently, configure that trunk accordingly. If the new trunk does not allow control over caller ID at all, ensure that the only calls sent over that trunk are those for which the fixed CID is suitable.
There’s dialplan here you can use to set a sip header that can be applied to a specific trunk name and is channel agnostic. Your diaplan will only work for chan_sip trunks: Custom SIP header on outgoing calls
Even in the first case, you are just sending calller ID, so you should be setting that, and using sendrpid=pai, rather than explicitly adding a standard header. I’m not sure why the second provider needs it, unless they are misusing it for the account name, which some do. If they don’t need it, just set sendrpid=no for that provider. If they do, use the same tactics as suggested for setting the value of the header explicitly, to set the caller ID.
So i am using this for follow me to send the dialed number’s CID through and for some reason it’s not sending the matched PAI along with the dialed number
Also no match and insert into the header of the PAI on standard calls either.