Well there’s a couple problems I see here. First, in the working system your custom transfer context is not being used. It never hits it. Second, in the calls that fail it is due to you sending the call to some other non-existent context when it’s processing the dial-trunk part.
[2025-01-30 16:55:10] VERBOSE[2862764][C-000000f4] pbx.c: Executing [s@macro-dialout-trunk:28] Gosub("Local/external_replaces@from-internal-00000096;2", "trunk-dial-with-exten,external_replaces,1()") in new stack
[2025-01-30 16:55:10] ERROR[2862764][C-000000f4] app_stack.c: Gosub attempted to reach non-existent destination 'trunk-dial-with-exten,external_replaces,1' from 'macro-dialout-trunk,s,28'
Because you sent the call to a bad non-existent destination it causes the call to hangup because it can’t process any further.