-
Notifications
You must be signed in to change notification settings - Fork 1
/
callout.php
37 lines (26 loc) · 954 Bytes
/
callout.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
require_once("lib/client.php");
// The from number is your purhcased or test Sinch number.
// https://developers.sinch.com/docs/voice/getting-started/#getting-started
$from = $_ENV["CLI"];
// The to number is the destination you are calling.
// Please ensure both numbers are in E164 format.
// https://community.sinch.com/t5/Glossary/E-164/ta-p/7537
$to = $_ENV["TO"];
// Text to Speech Callout
// https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callouts/#tag/Callouts/operation/Callouts!path=ttsCallout&t=request
$callout_request = [
"method" => "ttsCallout",
"ttsCallout" => [
"cli" => $from,
"destination" => [
"type" => "number",
"endpoint" => $to
],
"locale" => "en-US",
"text" => "Hello, this is a call from Sinch. Congratulations! You made your first call."
]
];
$client = new client;
$call = $client->call($callout_request);
print("Callout request response: {$call} \n");