Skip to content

A sample PHP wrapper that uses the Voice API to make a text-to-speech phone call.

License

Notifications You must be signed in to change notification settings

sinch/voice-api-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinch Voice API PHP License

Sinch PHP wrapper example for Voice API making a text to speech phone call with application signing.

Overview

Covers Sinch Callout API

https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callouts/

Project setup

PHP with CURL support

Download php for your platform with curl support enabled

Supported PHP versions

8.1

Use composer to install phpdotenv

To read your configuration from the .env file Composer requires the following PHP packages:

$ composer require vlucas/phpdotenv

Configuring with your own application

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"

Running the script

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"}

Client options

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)

About

A sample PHP wrapper that uses the Voice API to make a text-to-speech phone call.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages