This program provides an example (on Apple's iOS) for how to get audio data from the microphone and reroute it to be heard through the speaker. Should work on iOS 9.1 and higher.
This is based on:
http://atastypixel.com/blog/using-remoteio-audio-unit/
If you don't know anything about digital audio or the core audio framework, I advice you read Apple's "Core Audio overview" to get some idea of what you're doing. Last located at: http://developer.apple.com/library/ios/#documentation/MusicAudio/Conceptual/CoreAudioOverview/Introduction/Introduction.html
Simply open the project in xcode, and press "Build and Run".