首页 > 解决方案 > 您尝试向您帐户上未启用的电话号码发起外拨电话

问题描述

我已经使用 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;
 }

谢谢

标签: twiliotwilio-apitwilio-phptwilio-twiml

解决方案


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

让我知道这是否有帮助。


推荐阅读