Book Image

Twilio Cookbook: Second Edition

By : Roger Stringer
Book Image

Twilio Cookbook: Second Edition

By: Roger Stringer

Overview of this book

Table of Contents (20 chapters)
Twilio Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Starting and recording a conference


It's time to start the conference. We've notified everyone about it; now we have to handle what happens when they actually call in.

This conference system has multiple rooms, each with a unique ID. So when people call in, they'll enter a room number, which will add them to that conference room.

Getting ready

The complete source code for this recipe can be found in the Chapter4/ folder.

How to do it...

Ok, this is the big one. This recipe will help us actually start the conference and record the conference as soon as it starts. By recording it, we can go back to it at another time.

We're going to create four files in this recipe.

  1. Create a file called start.php and add the following code to it:

    <?php
    session_start();
    include("config.php");
    include("pdo.class.php");
    include 'Services/Twilio.php';
    
    $pdo = Db::singleton();
    $client = new Services_Twilio($accountsid, $authtoken);
    
    if( strlen($_REQUEST['Digits']) ){
      $_SESSION['room'] = $room = $_REQUEST['Digits'...