Sinch PHP wrapper example for Voice API making a text to speech phone call with application signing.
Covers Sinch Callout API
https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callouts/
Download php for your platform with curl support enabled
8.1
To read your configuration from the .env file Composer requires the following PHP packages:
$ composer require vlucas/phpdotenv
Configure the .env
file with your application credentials as well as your Sinch phone number assigned to your Voice app from your dashboard and the number you want to call:
KEY="YOUR_application_key"
SECRET="YOUR_application_secret"
Run your PHP script by executing one of the following commands:
php callout.php
php conference.php
The call-id will be returned.
{"callId":"8259ba9c-a7c7-464c-b63b-c9388addd0f2"}
Setting endpoints is possible via the client using setRegion
method after initialising a new client and before making the callout. Learn more about endpoints
$client = new client();
$client->setRegion("Europe 1");
$call = $client->call($callout_request)