示例#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();
 }
示例#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();
 }
示例#3
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);
         }
     }
 }