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

Adding incoming callers to a call queue


In this recipe, we're going to set up a simple call queue. We're going to have this work with two separate numbers: one number is the number that the callers will call on and a second number will handle the agents who call in.

Callers will get placed in a queue, and when an agent calls the agent number, they will be connected to the first caller who is waiting to speak to someone.

Getting started

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

How to do it…

OK, let's set up our listener.php file to place all incoming calls in a queue and agent.php to connect our agents to callers by performing 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...