The "sleep" command is, as you figured out, part of the FS API and
therefore out of Liverpie's control. The good news is that I was just
using it as a no-op, so you can feel free to replace it with any
other kind of costless command, like setting a dummy variable or
something.
Regarding "read", there's really nothing for recognize, since DTMF
recognition is performed strictly inside FS. The "read" command
handles DTMF recognition and then populates an FS variable with the
DTMF digits that were read; all Liverpie does then is to forward this
variable (together with everything else) towards your webapp as an
HTTP parameter.
Therefore it follows that if in your webapp you get the wrong DTMF
response, it's because that's how FS had set it in the corresponding
variable (Liverpie really doesn't interfere and has no hand in
detecting the actual DTMF codes).
Perhaps you're having a hardware or drivers problem? Try using "read"
within a dialplan IVR and see how it behaves there. Or perhaps from
the CLI if that's possible.
As a sidenote, I've had huge problems with Asterisk and DTMF
recognition, and it turned out it was because of my PSTN-to-VoIP
provider. Are you calling directly into FS with a softphone? Try that
first.
Good luck,
Alex