Trying to manually add a PAI on specific trunk

Finally got it to work.

Thanks for your help @Stewart1 and for pointing me in right direction.

This was the last bit missing : Gosub error in macro-dial-one - #3 by tootai

the GoSub call would work by itself, but as soon as I entered it as a result of a successfull “ExecIf”, it would not run. The solution was to replace ExecIf by GoSubIf and everything works perfectly

[macro-dialout-trunk-predial-hook]
exten => s,1,Set(the_trunk_raw=${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX})
same => n,Set(the_trunk=${CUT(the_trunk_raw,@,2)})
same => n,GoSubIf($["${the_trunk}"="Trunk123"]?func-set-sipheader,s,1(P-Asserted-Identity,<sip:[email protected]\;user=phone>))
same => n,MacroExit()