Skip to content

Commit 1b41572

Browse files
committed
Add Create NCCO example to README
1 parent 08d01cd commit 1b41572

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,27 @@ $client->calls()->create([
321321
]);
322322
```
323323

324+
Or you can provide an NCCO directly in the POST request
325+
326+
```
327+
$call = $client->calls()->create([
328+
'to' => [[
329+
'type' => 'phone',
330+
'number' => '14843331234'
331+
]],
332+
'from' => [
333+
'type' => 'phone',
334+
'number' => '14843335555'
335+
],
336+
'ncco' => [
337+
[
338+
'action' => 'talk',
339+
'text' => 'This is a text to speech call from Nexmo'
340+
]
341+
]
342+
]);
343+
```
344+
324345
Or you can create a `Nexmo\Call\Call` object, and use that:
325346

326347
```php
@@ -334,6 +355,23 @@ $call->setTo('14843331234')
334355
$client->calls()->create($call);
335356
```
336357

358+
The same example, providing an NCCO directly:
359+
360+
```php
361+
use Nexmo\Call\Call;
362+
$call = new Call();
363+
$call->setTo('14843331234')
364+
->setFrom('14843335555')
365+
->setNcco([
366+
[
367+
'action' => 'talk',
368+
'text' => 'This is a text to speech call from Nexmo'
369+
]
370+
]);
371+
372+
$client->calls()->create($call);
373+
```
374+
337375
### Fetching a Call
338376

339377
You can fetch a call using a `Nexmo\Call\Call` object, or the call's UUID as a string:
@@ -594,6 +632,7 @@ API Coverage
594632
* [X] Campaign Subscription Management
595633
* Voice
596634
* [X] Outbound Call
635+
* [X] Outbound Call with an NCCO
597636
* [X] Inbound Call
598637
* [X] Text-To-Speech Call
599638
* [X] Text-To-Speech Prompt

0 commit comments

Comments
 (0)