Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function searchDestinationUser(CallEventInterface $ce)
 {
     /** @var Call $call */
     $call = $ce->getCall();
     $qb = $this->em->createQueryBuilder();
     $query = $qb->select('u')->from('UserBundle:User', 'u')->leftJoin('u.groups', 'g')->leftJoin('u.contacts', 'c')->where('g.account = :account')->setParameter('account', $call->getAccount())->andWhere('c.sip LIKE :sip')->setParameter('sip', '%' . $ce->getDstNumber() . '%')->setMaxResults(1)->getQuery();
     return $query->getOneOrNullResult();
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function searchDestinationClient(CallEventInterface $ce)
 {
     /** @var Call $call */
     $call = $ce->getCall();
     $number = $this->clearNumber($ce->getDstNumber());
     $qb = $this->em->createQueryBuilder();
     $query = $qb->select('c')->from('CoreBundle:Client', 'c')->leftJoin('c.phones', 'p')->where('c.account = :account')->setParameter('account', $call->getAccount())->andWhere('p.number LIKE :number')->setParameter('number', '%' . $number . '%')->setMaxResults(1)->getQuery();
     return $query->getOneOrNullResult();
 }
 /**
  * {@inheritdoc}
  */
 public function hydration(CallEventInterface $event, Request $request)
 {
     $event->setCallExtId($request->get('call_id'))->setType($request->get('event'))->setSrcNumber(trim($request->get('src_num')))->setSrcType($request->get('src_type'))->setDstNumber(trim($request->get('dst_num')))->setDstType($request->get('dst_type'))->setTreeName($request->get('treeName'))->setTreeNumber($request->get('treeNumber'));
     if ($request->get('timestamp')) {
         $date = new \DateTime();
         $date->setTimestamp($request->get('timestamp'));
         $event->setEventDate($date);
     }
 }
Beispiel #4
0
 /**
  * @param CallEventInterface $ce
  * @return TelephonyManager
  * @throws CallSystemDetermineException
  */
 public function getCalledSystem(CallEventInterface $ce)
 {
     /** @var TelephonyManager $manager */
     foreach ($this->managers as $manager) {
         if ($manager->checkFormat($ce->getDstNumber())) {
             return $manager;
         }
     }
     throw new CallSystemDetermineException();
 }
Beispiel #5
0
 /**
  * @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);
         }
     }
 }
Beispiel #6
0
 /**
  * @param CallEventInterface $callEvent
  * @return Call
  */
 public function search(CallEventInterface $callEvent)
 {
     return $this->repository->findOneBy(['callExtId' => $callEvent->getCallExtId()]);
 }