예제 #1
0
파일: Reader.php 프로젝트: cwcw/cms
 /**
  * Deal with a key press from the user
  *
  * @param Streamwide_Engine_Events_Event $event
  * @return void
  */
 public function onKeyPressed(Streamwide_Engine_Events_Event $event)
 {
     $key = $event->getParam('receivedKey');
     $promptType = $event->getContextParam('promptType');
     if ($this->_isEndKey($key)) {
         $this->_timer->reset();
         $this->_mediaPlayer->reset();
         $this->_dtmfHandler->reset();
         $event = new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::FINISHED);
         $event->setParam('number', $this->_number);
         $this->dispatchEvent($event);
     } else {
         $this->_number .= $key;
         $this->_rearmTimer();
         if (null !== $promptType) {
             if (self::PROMPT_INVITE === $promptType) {
                 if ($this->_shouldStopPromptingOnDtmf()) {
                     $this->_mediaPlayer->stop();
                 }
             } else {
                 $this->_mediaPlayer->stop();
             }
         }
     }
 }
예제 #2
0
파일: Menu.php 프로젝트: cwcw/cms
 /**
  * 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;
         }
     }
 }