Simply dial one of the numbers, call someone, and use the speakerphone during the call.
To do this, press and hold the lock button, and slide to power off. When the device is on, check the speaker, because there is a chance it will work completely normal.
Play some music on your device, and plug and unplug your headphones several times. Many iPhone 4s users solved the issue with this simple, but a handy trick.
Connect your iPhone 4s to your computer. The iTunes software will recognize your device, and when that happens, choose the option to restore. With a bit of luck, when you perform the restore, the speaker issues won’t be a problem anymore, because they will be gone.
Back up the files you have on your device. Next, navigate to Settings > General > Reset > Reset all Settings. When the iPhone 4s is back to the factory settings, check out the speaker.