twilio - 您尝试向您帐户上未启用的电话号码发起外拨电话
问题描述
我已经使用 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 开发人员布道者在这里。
看起来您正在调用另一个客户端并尝试将参数与调用一起传递。执行此操作时,您需要将客户端名称作为 中的<Identity>
元素<Client>
与<Parameter>
元素一起传递。
在 PHP 中,这看起来像:
$client = $dial->client();
$client->identity($number);
$client->parameter(['name' => 'FirstName', 'value' => $name]);
$client->parameter(['name' => 'Image', 'value' => $image]);
$client->parameter(['name' => 'Group', 'value' => $group]);
让我知道这是否有帮助。
推荐阅读
- reactjs - What is the best way to reuse form components in React?
- shell - 使用 shell 脚本拆分具有多个分隔符的字符串
- python - 有条件地合并文本文件中的行
- python - 无法测试 rest_framework.utils.serializer_helpers.ReturnList 的相等性
- python - 将dataFrame的多列转换为字典并存储在新列中
- reactjs - React.js:如何使用 react-admin 的 ImageField 显示 base64 图像
- response - 在 Deno/Oak 的 HTTP 响应中使用 FormData
- node.js - 如何使用节点在mongodb中根据集合(1)中的匹配值从集合(2)中获取匹配数据
- html - 如何使用 React Quill 调整图像大小?
- javascript - NodeJS + Got - 共享会话 Cookie