Chosen Solution
When I switch my phone to speaker phone it only works for a second does anyone know what I can do? Already restored the phone and replaced the mic Update (06/19/2016) Just so every one knows, the iPhone uses the rear microphone for speaker phone. Verified via Apple diagnostics.
so check audio ic/multimedia ic
The loud speaker module is actually different from the mic. That may need to be replaced. If that doesn’t work as suggested above try checking for an indication that the device thinks something is plugged into the headphone jack.