【问题标题】:You attempted to initiate an outbound phone call to a phone number that is not enabled on your account您尝试向您帐户上未启用的电话号码发起外拨电话
【发布时间】: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


【解决方案1】:

这里是 Twilio 开发者宣传员。

看起来你是making a call to another client and trying to pass parameters along with the call。执行此操作时,您需要将客户端名称作为<Identity> 元素与<Parameter> 元素一起传递到<Client> 中。

在 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]);

让我知道这是否有帮助。

【讨论】:

  • @philansh 没有任何改变。接听电话后,电话立即断开
  • 这种情况并非一直都在发生。有时我可以接听电话并讲话
  • 可以接听的电话和不能接听的电话有什么区别吗?不同的客户端、来自不同地方的呼叫、您接听电话的设备、开发者工具中的错误消息?有什么吗?
  • 不,这是随机发生的,我无法弄清楚。当我从浏览器调用浏览器或有时从浏览器调用手机时,它甚至会发生。我在 twilio dashbord 错误日志中找不到任何错误
  • 如果它是随机的,那么可能还有其他事情发生。我会尝试获取一些发生这种情况的呼叫 SID 示例,并将它们与此描述一起提交给Twilio support
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多