Your trunk config is right. Hover over the (?) to see where $OUTNUM$ comes from. It’s just a placeholder FreePBX uses where it substitutes the number to be sent out to the trunk.
Outbound route is fine.
Transports are fine.
Remove the global section from the custom file… you don’t need it.
No application ‘Macro’ ? Guess you didn’t build it. (in make menuselect
it’s under Applications - Deprecated)
It worked before because you were bypassing FreePBX dialplan.
in your custom file change context=from-external in the type=endpoint section to context=from-pstn
which aligns with FreePBX inbound dialplan.