Exemplo n.º 1
0
 /**
  * Starts the relayer if it is not started
  *
  * @return boolean
  */
 protected function _startRelayer()
 {
     // Notify filter that is satisfied by an event object that has an OKMOVED signal
     // and that has a "from" parameter that is an instance of Streamwide_Engine_Media_Server_Call_Leg.
     // The OKMOVED signal has to have a "direction" parameter with a value that is present in the
     // _allowedNewDirections property
     $notifyFilter = Streamwide_Engine_NotifyFilter_Factory::factory(Streamwide_Engine_NotifyFilter_Factory::T_EVT_SIG_PARAM_NAME, Streamwide_Engine_NotifyFilter_Factory::FILTER_EQUAL_TO, Streamwide_Engine_Signal::OKMOVED)->logicalAnd(Streamwide_Engine_NotifyFilter_Factory::factory(Streamwide_Engine_NotifyFilter_Factory::T_EVT_PARAM, Streamwide_Engine_NotifyFilter_Factory::FILTER_INSTANCE_OF, array('from', 'Streamwide_Engine_Media_Server_Call_Leg')))->logicalAnd(Streamwide_Engine_NotifyFilter_Factory::factory(Streamwide_Engine_NotifyFilter_Factory::T_EVT_SIG_PARAM_PARAM, Streamwide_Engine_NotifyFilter_Factory::FILTER_IN_ARRAY, array('direction', $this->_allowedNewDirections)));
     $this->_relayer->addEventListener(Streamwide_Engine_Events_Event::SIGNAL_RELAYED, array('callback' => array($this, 'onSignalRelayed'), 'options' => array('notifyFilter' => $notifyFilter, 'autoRemove' => 'before')));
     if (!$this->_relayer->isRunning()) {
         $started = $this->_relayer->start();
         if (!$started) {
             $this->_relayer->removeEventListener(Streamwide_Engine_Events_Event::SIGNAL_RELAYED, array('callback' => array($this, 'onSignalRelayed')));
             return false;
         }
     }
     return true;
 }