I made a few changes to the code today.
- MAXWORDS - Created a variable to set the maximum number of words a caller will be asked for. I had a couple of friends provide more than 40 which is more than the total word count.
- error_reporting(0) - On rare occasion, the next script would be called before the recording of the previous word was available. This would result in a PHP warning which would display to TwiML as garbage and say to the caller "We're sorry. An application error has occurred" and hang up on them. By disabling error reporting, I'll still get the rare zero byte recording, but the caller can keep going.
- Last, I changed the intro message to invite the user to hang up at any time but that the code would hang up after MAXWORDS.