InboundCallWebHookController.php
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace NexmoBundle\Controller;
use AppBundle\Entity\Patient;
use AppBundle\Entity\VoiceCall;
use AppBundle\Event\VoiceCallEvent;
use AppBundle\Event\VoiceCallEvents;
use CobrandBundle\CobrandInstance;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\Annotations\Post;
use JMS\DiExtraBundle\Annotation\Inject;
use NexmoBundle\VoiceCall\VoiceCallOrigins;
use NexmoBundle\VoiceCall\VoiceCallStatus;
use NexmoBundle\WebHook\OnAnswerInboundWebHook;
use NexmoBundle\WebHook\OnEventInboundWebHook;
use Sentry\SentryBundle\SentrySymfonyClient;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class InboundCallWebHookController extends NexmoWebHookController
{
/**
* @var OnAnswerInboundWebHook
* @Inject("nexmo.webhooks.answer_inbound")
*/
private $answerHandler;
/**
* @var OnEventInboundWebHook
* @Inject("nexmo.webhooks.event_inbound")
*/
private $eventHookHandler;
/**
* Inbound call answer url
* @Get("/answer-url", name="answer_webhook")
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
* @throws \Doctrine\DBAL\ConnectionException
*/
public function answerUrlAction(Request $request)
{
return $this->answerHandler->handle($request);
}
/**
* @Post("/event-url", name="event_webhook")
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
* @throws \Exception
*/
public function eventUrlAction(Request $request)
{
return $this->eventHookHandler->handle($request);
}
}