Exit the macro without hanging up the channel.
The codecs are irrelevant to this. Your macro will always call Hangup on the outgoing channel, once it is answered. You’ve got past the point where the channel driver would issue BYE because of unacceptable codec or encryption offer, in the response; you are now in user space and that user space code is closing the session.
I haven’t used macro since I converted them to subroutines, when they were deprecated in one of the 1.6.x versions, so I’d have to look up the correct way of terminating a macro, in case my recollection was faulty.