protected function doInput()
{
/* @var $result IReadResult */
$this->resetInput();
$this->inputAttemptsUsed++;
$result = $this->playPrePromptMessages();
if (!$this->acceptPrePromptInputAsInput) {
$result = $this->playPromptMessages();
if ($result !== null && !$result->isTimeout()) {
$this->acceptInput($result->getDigits());
}
} elseif ($result !== null && !$result->isTimeout()) {
$this->acceptInput($result->getDigits());
} else {
$result = $this->playPromptMessages();
if ($result !== null) {
$this->acceptInput($result->getDigits());
}
}
if ($this->inputLengthIsAtLeast($this->maxInput) || $this->wasCancelled() || $this->isComplete() && !$this->hasInput()) {
return;
}
$len = strlen($this->input);
$start = time();
for ($i = $len; $i < $this->maxInput; $i++) {
if ($this->totalTimeForInput != -1) {
$totalElapsedTime = (time() - $start) * 1000;
if ($totalElapsedTime >= $this->totalTimeForInput) {
$this->logDebug("Expired total available time for input");
break;
}
}
$this->logDebug($this->name . ": Reading Digit #: " . ($i + 1));
$result = $this->callClientMethods(array(array('waitDigit' => array($this->timeBetweenDigits))));
if ($result->isTimeout()) {
$this->logDebug("Expired available time per digit");
break;
}
$input = $result->getDigits();
$this->acceptInput($input);
if ($this->inputIsEnd($input) || $this->wasCancelled()) {
break;
}
}
}