Screening calls
Call screening is a useful ability to have on your calling systems. For example, let's say you have three people on call in your support department and you want to call the first available agent.
This recipe will try and connect to each phone number available in a given array and check to see if a person answers or not; if a person does, it connects the call.
Getting ready
The complete source code for this recipe can be found in the Chapter2/Recipe2
folder.
How to do it...
We're going to build a call-handling system that will forward calls to our list of agents; the first agent who accepts the call by pushing a button will get the call.
Download the Twilio Helper Library from https://github.com/twilio/twilio-php/zipball/master and unzip it.
Upload the
Services/
folder to your website.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...