Skip to content

Commit 17b7503

Browse files
committed
Add Outbound Call with NCCO example
1 parent 31cf972 commit 17b7503

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
require_once __DIR__ . '/../../config.php';
3+
require_once __DIR__ . '/../../vendor/autoload.php';
4+
5+
$keypair = new \Nexmo\Client\Credentials\Keypair(
6+
file_get_contents(NEXMO_APPLICATION_PRIVATE_KEY_PATH),
7+
NEXMO_APPLICATION_ID
8+
);
9+
$client = new \Nexmo\Client($keypair);
10+
11+
$call = $client->calls()->create([
12+
'to' => [[
13+
'type' => 'phone',
14+
'number' => TO_NUMBER
15+
]],
16+
'from' => [
17+
'type' => 'phone',
18+
'number' => NEXMO_NUMBER
19+
],
20+
'ncco' => [
21+
[
22+
'action' => 'talk',
23+
'text' => 'This is a text to speech call from Nexmo'
24+
]
25+
]
26+
]);
27+
28+
print_r($call);

0 commit comments

Comments
 (0)