Skip to content

Commit

Permalink
Add Create NCCO example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
mheap committed Apr 13, 2019
1 parent 08d01cd commit 1b41572
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,27 @@ $client->calls()->create([
]);
```

Or you can provide an NCCO directly in the POST request

```
$call = $client->calls()->create([
'to' => [[
'type' => 'phone',
'number' => '14843331234'
]],
'from' => [
'type' => 'phone',
'number' => '14843335555'
],
'ncco' => [
[
'action' => 'talk',
'text' => 'This is a text to speech call from Nexmo'
]
]
]);
```

Or you can create a `Nexmo\Call\Call` object, and use that:

```php
Expand All @@ -334,6 +355,23 @@ $call->setTo('14843331234')
$client->calls()->create($call);
```

The same example, providing an NCCO directly:

```php
use Nexmo\Call\Call;
$call = new Call();
$call->setTo('14843331234')
->setFrom('14843335555')
->setNcco([
[
'action' => 'talk',
'text' => 'This is a text to speech call from Nexmo'
]
]);

$client->calls()->create($call);
```

### Fetching a Call

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

0 comments on commit 1b41572

Please sign in to comment.