There are two attribute classes that are used in conjunction with the Call.playAndGetInput() method to facilitate this: MenuAttributes and InputAttributes
To record the caller’s speech and store it as a voice segment, you use the Call.record() method.
For more information about speech recognition see Speech Recognition.