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

Obtaining the average wait time for call queues


We're going to set up a page that we'll use to display a list of call queues. We will also find out the number of callers in each queue and the average wait time to connect to an agent.

Getting started

The complete code for this recipe can be found in the Code/Recipe2/ folder.

How to do it…

In this section, we're going to set up a page that will show us our call queues and how many callers are on hold, as well as how long they are estimated to wait for before they speak to an agent. Perform the following steps:

  1. Download the Twilio Helper Library available at https://github.com/twilio/twilio-php/zipball/master and unzip it.

  2. Upload the Services/ folder to your website.

  3. Upload config.php to your web server using the following code:

      <?php
        $accountsid = '';  //  YOUR TWILIO ACCOUNT SID
        $authtoken = '';  //  YOUR TWILIO AUTH TOKEN
      ?>
  4. Upload wait-times.php to your web server using the following code:

    <?php
      include("config.php");
      # Include...