我有一个试用twilio电话号码1XXXXXXXXXXXX:
我能够接听电话,录音,语音邮件,但是当我尝试拨打电话时,我会收到以下异常。
线程“main”中的异常com.twilio.sdk.TwilioRestException:提供的源电话号码+ 1XXXXXXXXXXX尚未针对您的帐户进行验证。您只能通过已经验证或从Twilio购买的电话号码拨打电话。
以下是代码:
公共类MakeCall {
public static final String ACCOUNT_SID = "My account sid";
public static final String AUTH_TOKEN = "my auth token";
public static void main(String[] args) throws TwilioRestException {
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
Account mainAccount = client.getAccount();
CallFactory callFactory = mainAccount.getCallFactory();
Map<String, String> callParams = new HashMap<String, String>();
callParams.put("To", "+917406097660"); // Replace with your phone number
callParams.put("From", "571-206-3804"); // Replace with a Twilio number
callParams.put("Url", "http://demo.twilio.com/welcome/voice/");
// Make the call
Call call = callFactory.create(callParams);
// Print the call SID (a 32 digit hex like CA123..)
System.out.println(call.getSid());
}
}
提前致谢,
答案 0 :(得分:1)
您收到的错误如下:
The source phone number provided, +1XXXXXXXXXXXX, is not yet verified for your account. You may only make calls from phone numbers that you've verified or purchased from Twilio.
您应该检查以确保From
号码是Twilio号码或您已验证的号码。看起来你提供的From
号码,571-206-3804,不是Twilio号码 - 仔细检查它是否正确。