There is no public iOS API that allows you to record all the internal sound that an application or device can make. Only certain types of internal sound can be recorded, for example, sounds created by the application using audio queues or RemoteIO audio devices.
An Apple SpeakHere sample code can be used to record external sound.
hotpaw2
source share