A small sample app that covers basic conferences with Telnyx's Call Control API.
The full documentation and tutorial is available on developers.telnyx.com
You will need to set up:
- Telnyx Account
- Telnyx Phone Number enabled with:
- PHP installed with Composer
- Ability to receive webhooks (with something like ngrok)
The following environmental variables need to be set
Variable | Description |
---|---|
TELNYX_API_KEY |
Your Telnyx API Key |
TELNYX_PUBLIC_KEY |
Your Telnyx Public Key |
This app uses the excellent phpenv package to manage environment variables.
Make a copy of .env.sample
and save as .env
and update the variables to match your creds.
TELNYX_API_KEY=
TELNYX_PUBLIC_KEY=
Callback Type | URL |
---|---|
Inbound Voice Callback | {ngrok-url}/Callbacks/Voice/Inbound |
Run the following commands to get started
git clone https://github.com/team-telnyx/demo-conference-php.git
composer install
This application uses PHP's built in server serving on port 8000. Be sure to route inbound requests to port 8000
./ngrok http 8000
Terminal should look something like
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Little Bobby Tables (Plan: Free)
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://your-url.ngrok.io -> http://localhost:8000
Forwarding https://your-url.ngrok.io -> http://localhost:8000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
At this point you can point your call control application to generated ngrok URL + path (Example: http://{your-url}.ngrok.io/Callbacks/Voice/Inbound
).
Run the app with the PHP servering on port 8000
php -S localhost:8000 -t public
You can now call your Telnyx phone number and get dropped into a conference. Any subsequent calls will be added to the existing conference. When the final member leaves the conference, the conference is ended and the next inbound caller will be dropped into a new conference.