Skip to content

Commit 0170226

Browse files
committed
Updated DTMF input example
1 parent eaf2ef9 commit 0170226

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

voice/user-input-dtmf-slim/index.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,7 @@
66

77
$app = new \Slim\App;
88

9-
$app->add(function (Request $request, Response $response, $next) {
10-
// Nexmo may send a GET or a POST request, depending on your account
11-
// settings. Reject anything that isn't a GET/POST
12-
if (!in_array($request->getMethod(), ['GET', 'POST'])) {
13-
return $response->withStatus(404);
14-
}
15-
16-
return $next($request, $response);
17-
});
18-
19-
$app->any('/webhooks/answer', function (Request $request, Response $response) {
9+
$app->get('/webhooks/answer', function (Request $request, Response $response) {
2010
$uri = $request->getUri();
2111
$ncco = [
2212
[
@@ -34,14 +24,9 @@
3424
return $response->withJson($ncco);
3525
});
3626

37-
$app->any('/webhooks/dtmf', function (Request $request, Response $response) {
27+
$app->post('/webhooks/dtmf', function (Request $request, Response $response) {
3828
$params = $request->getParsedBody();
3929

40-
// Fall back to reading the query string if the body is empty
41-
if (!isset($params['dtmf'])) {
42-
$params = $request->getQueryParams();
43-
}
44-
4530
$ncco = [
4631
[
4732
'action' => 'talk',

0 commit comments

Comments
 (0)