This action lets you play back an audio file that is located anywhere on the web.

    <Play url=""/>

The Play element can take these attributes:

Attribute Description
A valid URL that contains a link to the file to be played. Note that we will cache the content after the first playback request, and will check for request header information that indicates the need to re-download the file later on.

Sample PHP Implementation

Assuming that you have configured the callback URL for your Africa's Talking Phone Number to point to voicemail.php. Below is an example of how you would handle an incoming call and play back the content of a file that contains your voice mail (most likely recorded using our Record element...)

// Save this code in voicemail.php. Configure the callback URL for your phone number
// to point to the location of this script on the web
// e.g

// First read in a couple of POST variables passed in with the request

// This is a unique ID generated for this call
$sessionId = $_POST['sessionId'];

// Check to see whether this call is active
$isActive  = $_POST['isActive'];

if ($isActive == 1)  {
  // Get the location of previously recorded voicemail and play back the file. Make 
  // sure its a valid web address that starts with http
  $response  = '<?xml version="1.0" encoding="UTF-8"?>';
  $response .= '<Response>';
  $response .= '<Say>Please listen to our awesome record</Say>';
  $response .= '<Play url=""/>';
  $response .= '</Response>';
  // Print the response onto the page so that our gateway can read it
  header('Content-type: apllication/xml');
  echo $response;

} else {
  // Read in call details (duration, cost). This flag is set once the call is completed.
  // Note that the gateway does not expect a response in thie case
  $duration     = $_POST['durationInSeconds'];
  $currencyCode = $_POST['currencyCode'];
  $amount       = $_POST['amount'];
  // You can then store this information in the database for your records