If you need to buy a licence, the Digium g.729 codec will not work without one. I believe Monitor will record without transcoding, but MixMonitor has to convert to linear to do the mixing. Media pass through, whether direct media or via the Asterisk core, does not require codecs (g.729 won’t work with inband DTMF, so that is not an issue). However, you will not be able to send any asterisk generated tones, only recorded announcements
You will have to ask Digium sales about whether free licences are available, for their codec.
Commercial use in terms of the sample code does not mean providing services to third parties. Any use by a business would be commercial, as would be use by an educational institution for administrative purpose. The only valid use I could see of the sample code with Asterisk would be to evaluate how the codec performs, but you still have the problem that the Asterisk module that uses that is in breach of the GPL, and has no other licence.