【发布时间】:2021-06-09 13:11:40
【问题描述】:
我已经使用 PHP 实现了 twilio 客户端调用未来。但有时电话在响铃后断开。当我查看 twilio 中的错误日志时,我可以看到消息“您尝试向未在您的帐户中启用的电话号码发起出站电话呼叫。”。我正在从浏览器到浏览器以及从浏览器到移动应用程序调用,那么为什么会显示此消息?.
我不确定这是调用方还是接收方的问题。
Twiml 代码 例如:$to = 'CLIENT3150'
function get_voice_response($to,$from,$name,$image, $group) {
$response = new VoiceResponse();
if (!empty($to) && strlen($to) > 0) {
$number = htmlspecialchars($to);
$dial = $response->dial('', ['callerId' => $from]);
// wrap the phone number or client name in the appropriate TwiML verb
// by checking if the number given has only digits and format symbols
if (preg_match("/^[\d\+\-\(\) ]+$/", $number)) {
$dial->number($number);
} else {
$client = $dial->client($number);
$client->parameter(['name' => 'FirstName', 'value' => $name]);
$client->parameter(['name' => 'Image', 'value' => $image]);
$client->parameter(['name' => 'Group', 'value' => $group]);
}
} else {
$response->say("Thanks for calling!");
}
return (string)$response;
}
谢谢
【问题讨论】:
-
这两个数字都是你的 twilio 数字?
-
我没有拨打电话号码。我正在从浏览器到浏览器以及从浏览器到移动应用程序调用
-
问题说你不是在浏览器之间调用。
-
抱歉现在编辑了
-
您能否分享您在 TwiML 应用程序中使用的代码来拨打电话?
标签: twilio twilio-api twilio-php twilio-twiml