我正在使用twilio帐户将电话转接到电子邮件'功能,根据twilio网站创建了一个bin。当我收到电话录音到我的电子邮件地址时,它不会显示录音所针对的twilio号码。因为我有很多twilio号码,而且我在一天内收到很多电子邮件,所以很难弄清楚录制的是哪个twilio号码?
这是垃圾箱:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record action="mail.php" />
</Response>
答案 0 :(得分:0)
Twilio开发者传道者在这里。
我假设您正在讨论forwarding call recordings to your email的指南。
要包含拨打电话的号码,您只需更新mail.php
中的代码即可包含Twilio's request中的To
参数。我已经加入了
$message .= "The call came from {$_REQUEST['To']}.\n";
在下面的代码中:
<?php
/**
* This section ensures that Twilio gets a response.
*/
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; // Place the desired response (if any) here.
/**
* This section actually sends the email.
*/
/* Your email address. */
$to = "your-email@example.com";
$subject = "Message from {$_REQUEST['From']}";
$message = "You have received a message from {$_REQUEST['From']}.\n";
$message .= "The call came from {$_REQUEST['To']}.\n";
$message .= "To listen to this message, please visit this URL: {$_REQUEST['RecordingUrl']}";
$headers = "From: webmaster@example.com"; // Who should it come from?
mail($to, $subject, $message, $headers);
让我知道这是否有帮助。