/** * Disarm the internal timer * * @return boolean */ protected function _disarmTimer() { if ($this->_timer->isArmed()) { return $this->_timer->disarm(); } return true; }
/** * Rearm the timer * * @return boolean */ protected function _rearmTimer() { $delay = $this->_options[self::OPT_INTER_DIGIT_TIMEOUT]; $this->_timer->setContextParams(array('timeoutType' => self::TIMEOUT_INTERDIGIT)); if ($this->_timer->isArmed()) { return $this->_timer->rearm($delay); } else { $this->_timer->setOptions(array(Streamwide_Engine_Timer_Timeout::OPT_DELAY => $delay)); $this->_timer->addEventListener(Streamwide_Engine_Events_Event::TIMEOUT, array('callback' => array($this, 'onTimeout'), 'options' => array('autoRemove' => 'before'))); return $this->_timer->arm(); } }
/** * Handles a key press * * @param string|null $promptType * @return void */ protected function _handleKeyPress($promptType = null) { if (null === $promptType) { if ($this->_timer->isArmed()) { $this->_timer->disarm(); } } else { switch ($promptType) { case self::PROMPT_NO_KEY: case self::PROMPT_WRONG_KEY: $this->_mediaPlayer->stop(); break; case self::PROMPT_INVITE: if ($this->_shouldStopPromptingOnDtmf()) { $this->_mediaPlayer->stop(); } break; } } }