首先,我有一个顺序拨号应用程序,它将按顺序呼叫一系列电话号码,直到其中一个号码接听。
现在我需要做但我坚持的是,当某人使用 SMS 的 Twilio 时,应该将 SMS 正文中的数据或信息读给使用 Say 动词接听电话的人。我不确定如何获取 SMS 正文并在我的应用程序中读取它。有什么想法吗?
<?php
print_r(error_reporting(-1));
session_start();
require 'Services/Twilio.php';
$version = "2010-04-01";
$arr = array('416..','647...');
$sid = '...';
$token = '..';
$from = '..';
$callback = 'site.com/Twilio/twilio-twilio-php-a0e9f92/dial.php';
$client = new Services_Twilio($sid, $token, $version);
if (isset($_REQUEST['index'])) {
$index = $_REQUEST['index'];
} else {
$index = 0;
}
$next = $index + 1;
if ($index==0 && $_REQUEST['CallStatus']=='completed')
{
//Read SMS to the called party
}
else
{
if ($index>=1 && $_REQUEST['CallStatus']=='completed')
{
//Read SMS
}
else
{
try {
$call = $client->account->calls->create(
$from,
$arr[$index],
'http://site.com/Twilio/twilio-twilio-php-a0e9f92/dial.php?index=' . $next,
array('Timeout' => 5,'StatusCallback' => $callback)
);
} catch (Exception $e) {
var_dump($e);
}
}
}