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

Building an emergency calling system


I'm a type-2, insulin-dependent diabetic. I also drive two hours every day—to my office and back. So, after I spent a week in the hospital last year, I decided to set up an In Case Of Emergency (ICE) system so that I could call one number and have it try multiple numbers at once.

Getting ready

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

How to do it...

This emergency calling system will try a group of numbers at the same time; the first number to answer will get connected.

  1. Download the Twilio Helper Library from 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 website and make sure the following variables are set:

    <?php
      $accountsid = '';  //  YOUR TWILIO ACCOUNT SID
      $authtoken = '';  //	  YOUR TWILIO AUTH TOKEN
      $fromNumber = '';  //  PHONE NUMBER CALLS WILL COME FROM
    ?>
  4. Create a file on your website called ice.php, with...