Leaving a message
OK, instead of hanging up the call when an agent doesn't answer, let's forward them to a company voice mailbox.
Getting Ready
The complete source code for this recipe can be found in the Chapter8/Recipe6/
folder.
How to do it...
We're going to set this up so that, if a caller can't reach an agent, or just generally wants to leave a message, they can do so by pressing 5.
Download the Twilio Helper Library from https://github.com/twilio/twilio-php/zipball/master and unzip it.
Upload the
Services/
folder to your website.Update
config.php
to your website and make sure the following variables are set:<?php $dbhost = '';//YOUR DATABASE HOST $dbname = '';//YOUR DATABASE NAME $dbuser = '';//YOUR DATABASE USER $dbpass = '';//YOUR DATABASE PASS $highrise_account = ''; $highrise_apikey = ''; $accountsid = '';//YOUR TWILIO ACCOUNT SID $authtoken = '';//YOUR TWILIO AUTH TOKEN $fromNumber = '';// PHONE NUMBER CALLS WILL COME FROM $directory = array( '1'=> array( ...