I assume you're using the ear buds with the built-in microphone which come in the box with a new iPhone. Is that correct?
Step 1 is to find out if you have a hardware problem. Try it in another app. Does the mic work when you make a call? Maybe you need a new set of ear buds.
If that works, step 2 is to check out your settings. You may be muting yourself.