/** * Start listening for key presses * * @param string|null $promptType * @return boolean */ protected function _listenForKeyPresses($promptType = null) { $this->_dtmfHandler->reset(); $this->_dtmfHandler->setContextParams(array('promptType' => $promptType)); $this->_dtmfHandler->addEventListener(Streamwide_Engine_Events_Event::KEY, array('callback' => array($this, 'onKeyPressed'))); $listening = $this->_dtmfHandler->startListening(); if (!$listening) { $this->_dtmfHandler->flushEventListeners(); } return $listening; }
/** * Decrement the counter and give the user another try * * @param boolean $decrement * @return boolean */ protected function _retry($decrement = true) { if (true === $decrement) { $this->_counter->decrement(); } if ($this->_counter->hasMoreTries()) { $this->_timer->reset(); $this->_dtmfHandler->reset(); $this->_mediaPlayer->reset(); $this->dispatchErrorEvent(self::BAD_TRY_ERR_CODE); return $this->enter(); } else { $this->dispatchErrorEvent(self::NO_TRIES_LEFT_ERR_CODE); return false; } }