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

Getting directions


Let's expand our IVR menu options a little. We're going to add a new option to let our callers request directions.

This will also demonstrate how to make the menu do more.

This example will set up the IVR menu so that if the caller presses 3, they will be informed of our main office; it will also prompt them to press another key for directions from different locations.

Getting Ready

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

How to do it...

Let's expand our IVR app to include some more options, such as business directions. We'll also add an option to make our phones quack like a duck just to make it interesting.

  1. Update listener.php as follows:

    <?php
      include("config.php");
      include("pdo.class.php");
      $pdo = Db::singleton();
    
      require_once("Services/HighriseAPI.class.php");
    
      $highrise = new HighriseAPI();
      $highrise->debug = false;
      $highrise->setAccount( $highrise_account );
      $highrise->setToken( $highrise_apikey...