/** * @param CallEventInterface $callEvent * @return Call */ public function create(CallEventInterface $callEvent) { /** @var Call $call */ $call = new $this->class(); $call->setCallExtId($callEvent->getCallExtId()); switch ($callEvent->getType()) { case CallEventInterface::TYPE_ANSWER: $call->setAnswerEvent($callEvent); break; case CallEventInterface::TYPE_HANGUP: $call->setHangupEvent($callEvent); break; } $this->objectManager->persist($call); return $call; }
/** * @param CallEventInterface $callEvent * @throws CallTypeException */ protected function processingChain(CallEventInterface $callEvent) { $call = $callEvent->getCall(); if ($callEvent->getType() == CallEventInterface::TYPE_ANSWER) { $call->setAnswerEvent($callEvent); $event = $this->createEvent($callEvent); $this->dispatcher->dispatch(PerficoSipuniEvents::ANSWER, $event); } else { if ($callEvent->getType() == CallEventInterface::TYPE_HANGUP) { $call->setHangupEvent($callEvent); $event = $this->createEvent($callEvent); $this->dispatcher->dispatch(PerficoSipuniEvents::HANGUP, $event); } else { throw new CallTypeException($callEvent); } } }