/demo-conference-php

WIP: PHP Tutorial Code demonstrating creating and using a Conference

Primary LanguagePHP

Telnyx PHP Conferencing

Telnyx

A small sample app that covers basic conferences with Telnyx's Call Control API.

Documentation & Tutorial

The full documentation and tutorial is available on developers.telnyx.com

Pre-Reqs

You will need to set up:

Usage

The following environmental variables need to be set

Variable Description
TELNYX_API_KEY Your Telnyx API Key
TELNYX_PUBLIC_KEY Your Telnyx Public Key

.env file

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 URLs For Telnyx Call Control Applications

Callback Type URL
Inbound Voice Callback {ngrok-url}/Callbacks/Voice/Inbound

Install

Run the following commands to get started

git clone https://github.com/team-telnyx/demo-conference-php.git
composer install

Ngrok

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

Run the app with the PHP servering on port 8000

php -S localhost:8000 -t public

Call your number

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.