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

Setting up IVRs


In this first section, we will set up our basic IVR with a simple phone tree.

When a caller calls in, we'll give them a list of options. Pressing 1 will give them the store hours, and pressing 2 will prompt them to enter the extension of an agent.

Getting ready

The complete source code for this recipe can be found in the Chapter8/Recipe1/ folder

How to do it…

Let's set up the basic IVR system. The basic system will consist of a simple company directory, which would display the incoming calls.

When a user calls in, it will greet them and then prompt them to make a choice.

  1. Upload config.php on your website and make sure your phone tree variables are set:

    <?php
      $directory = array(
        '1'=> array(
          'phone'=>'415-555-2222',
          'firstname' => 'Joe',
          'lastname' => 'Doe'
        ),
        '2'=> array(
          'phone'=>'415-555-3333',
          'firstname' => 'Eric',
          'lastname' => 'Anderson'
        ),
        '3'=> array(
          'phone'=>'415-555-4444',...