Apple recently announced a new service program for owners of the iPhone 12 and iPhone 12 Pro who are having problems with sound playback. Phones made between October 2020 and April 2021 could have a receiver module that fails during phone calls. Apple will fix these phones, free of charge.
According to an Apple support document, users must have their phone examined first to determine eligibility for the service. You may bring your iPhone to an Apple Authorized Service Provider, visit an Apple Retail Store, or contact Apple Support for mail-in service via the Apple Repair Center.
Apple advises users to back up their phone before having the service performed. Also, if a phone has damage that hinders the service (such as a cracked screen), that damage will need to be fixed before the sound service can be done.
The iPhone 12 mini and iPhone 12 Pro Max models are not part of this program.