/** * Handle the OK signal. The call leg was created successfully. Mark the * call leg as alive and set its params. Dispatch a CALL_LEG_CREATED event * * @param Streamwide_Engine_Signal $signal * @return void */ protected function _handleOkSignal(Streamwide_Engine_Signal $signal) { $this->_unsubscribeFromEngineEvents(); $this->_callLeg->setAlive(); $this->_callLeg->hasSentOrReceivedOk(); $this->_callLeg->setParams(array_merge($signal->getParams(), $this->_creationParams)); $event = new Streamwide_Engine_Events_Event(Streamwide_Engine_Events_Event::CALL_LEG_CREATED); $event->setParam('callLeg', $this->_callLeg); $this->dispatchEvent($event); }
/** * Set the call leg to be put on hold. * * @param Streamwide_Engine_Call_Leg_Abstract $callLeg * @return void */ public function setCallLeg(Streamwide_Engine_Call_Leg_Abstract $callLeg) { if (!$callLeg instanceof Streamwide_Engine_Sip_Call_Leg) { throw new InvalidArgumentException(__METHOD__ . ' expects parameter 1 to be an instanceof Streamwide_Engine_Sip_Call_Leg'); } if (!$callLeg->isAlive()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an alive call leg'); } if (!$callLeg->hasSentOrReceivedOk()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be a call leg that has sent or received the OK signal'); } $this->_callLeg = $callLeg; }
/** * Set the left call leg * * @param Streamwide_Engine_Call_Leg_Abstract $leftCallLeg * @return void * @throws InvalidArgumentException */ public function setLeftCallLeg(Streamwide_Engine_Call_Leg_Abstract $leftCallLeg) { if (!$leftCallLeg instanceof Streamwide_Engine_Sip_Call_Leg) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an instance of Streamwide_Engine_Sip_Call_Leg'); } if (!$leftCallLeg->isAlive()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an alive SIP call leg'); } if ($leftCallLeg->hasSentOrReceivedOk()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an alive SIP call leg that has not received the OK signal'); } parent::setLeftCallLeg($leftCallLeg); }
/** * Set the right call leg * * @param Streamwide_Engine_Call_Leg_Abstract $rightCallLeg * @return void */ public function setRightCallLeg(Streamwide_Engine_Call_Leg_Abstract $rightCallLeg) { if (!$rightCallLeg instanceof Streamwide_Engine_Media_Server_Call_Leg) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an instance of Streamwide_Engine_Media_Server_Call_Leg'); } if (!$rightCallLeg->isAlive()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an alive MS call leg'); } if (!$rightCallLeg->hasSentOrReceivedOk()) { throw new InvalidArgumentException(__METHOD__ . ' requires parameter 1 to be an alive MS call leg that has sent or received the OK signal'); } parent::setRightCallLeg($rightCallLeg); }