/** * Handle the PROK signal * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleProkSignal(Streamwide_Engine_Signal $signal) { if (false === $signal->relay($this->_leftCallLeg->getName())) { $this->_unsubscribeFromEngineEvents(); return $this->dispatchErrorEvent(self::PROK_SIGNAL_RELAY_ERR_CODE); } }
/** * We have received the FAILSDP signal from the SIP call leg we need to * relay it to the MS call leg and dispatch an error event * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleFailSdpSignal(Streamwide_Engine_Signal $signal) { $this->_unsubscribeFromEngineEvents(); if (false === $signal->relay($this->_rightCallLeg->getName())) { return $this->dispatchErrorEvent(self::FAILSDP_SIGNAL_RELAY_ERR_CODE); } $params = $signal->getParams(); $failureCode = isset($params['code']) ? $params['code'] : null; return $this->dispatchErrorEvent(self::MS_NOT_CREATED_ERR_CODE, array('failureCode' => $failureCode, 'signal' => $signal)); }
/** * We received PROGRESS signal from the callee SIP call leg. We need to relay it to * the caller SIP call leg and dispatch a PROGRESS event * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleProgressSignal(Streamwide_Engine_Signal $signal) { if (false === $signal->relay($this->_leftCallLeg->getName())) { $this->_unsubscribeFromEngineEvents(); return $this->dispatchErrorEvent(self::PROGRESS_SIGNAL_RELAY_ERR_CODE); } $event = new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::PROGRESS); $event->setParam('signal', $signal); return $this->dispatchEvent($event); }
/** * We have received OKMOVED, we need see who its from. If it came from * the SIP call leg we need to send an OKSDP signal to MS call leg, if it * came from MS call leg we need to relay it to the SIP call leg and * dispatch the FAX_ENV_CREATED event * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleOkMovedSignal(Streamwide_Engine_Signal $signal) { $remote = $signal->getRemote(); if ($remote === $this->_leftCallLeg->getName()) { $this->_leftCallLeg->getParams($signal->getParams()); $oksdpSignal = Streamwide_Engine_Signal::factory(Streamwide_Engine_Signal::OKSDP, $this->_rightCallLeg->getName(), $signal->getParams()); if (false === $oksdpSignal->send()) { $this->_unsubscribeFromEngineEvents(); return $this->dispatchErrorEvent(self::OKSDP_SIGNAL_SEND_ERR_CODE); } return null; } if ($remote === $this->_rightCallLeg->getName()) { $this->_rightCallLeg->setParams($signal->getParams()); if (false === $signal->relay($this->_leftCallLeg->getName())) { $this->_unsubscribeFromEngineEvents(); return $this->dispatchErrorEvent(self::OKMOVED_SIGNAL_RELAY_ERR_CODE); } $event = new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::CONNECTED); $event->setParam('signal', $signal); return $this->dispatchEvent($event); } }
/** * We have received the FAIL signal from the SW Engine, we need to unsubscribe * from the other signals, relay the FAIL signal to the SIP call leg and dispatch * an error event signaling that the MS call leg has not been created * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleFailSignal(Streamwide_Engine_Signal $signal) { // unsubscribe from OK, FAIL and CHILD signals $this->_unsubscribeFromEngineEvents(); // relay the FAIL signal to the SIP call leg if (false === $signal->relay($this->_leftCallLeg->getName())) { return $this->dispatchErrorEvent(self::FAIL_SIGNAL_RELAY_ERR_CODE); } // dispatch an error event signaling that the MS call leg // could not be created $params = $signal->getParams(); $failureCode = isset($params['code']) ? $params['code'] : null; return $this->dispatchErrorEvent(self::MS_NOT_CREATED_ERR_CODE, array('failureCode' => $failureCode, 'signal' => $signal)); }