Skip to content

Commit 4385513

Browse files
committed
Fix inbound call example (GET only)
1 parent 829a26f commit 4385513

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

voice/inbound-calls-slim/index.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,8 @@
55
require 'vendor/autoload.php';
66

77
$app = new \Slim\App;
8-
$app->any('/webhooks/answer', function (Request $request, Response $response) {
9-
// Nexmo may send a GET or a POST request, depending on your account
10-
// settings. Reject anything that isn't a GET/POST
11-
if (!in_array($request->getMethod(), ['GET', 'POST'])) {
12-
return $response->withStatus(404);
13-
}
14-
15-
$params = $request->getParsedBody();
16-
17-
// Fall back to reading the query string if the body is empty
18-
if (!isset($params['from'])) {
19-
$params = $request->getQueryParams();
20-
}
21-
8+
$app->get('/webhooks/answer', function (Request $request, Response $response) {
9+
$params = $request->getQueryParams();
2210
$fromSplitIntoCharacters = implode(" ", str_split($params['from']));
2311

2412
$ncco = [

0 commit comments

Comments
 (0)