I was not able to open your script, but it sounds like you might need to play a constant MOH prompt while the call is waiting for an agent, that way the system can detect a digit. If you put the call on hold and the caller presses anything it will not be detected since the call will be parked at the CCM for MOH treatement.
david