“来自电话号码不是有效的”,带有美国号码

时间:2015-03-25 15:10:43

标签: java sms twilio

我是Twilio的新手,并尝试使用JAVA API发送短信。正如我在SoF的其他帖子中看到的那样,我发布了我的本地第一个号码并购买了一个美国号码以获得完整的功能号码。但我总是有错误信息:

com.twilio.sdk.TwilioRestException: The From phone number +14065302461 is not a valid, SMS-capable inbound phone number or short code for your account.

我的代码是:

        SmsFactory messageFactory = mainAccount.getSmsFactory();
        List<NameValuePair> messageParams = new ArrayList<NameValuePair>();
        messageParams.add(new BasicNameValuePair("To", "<myphonenumber>"));
        messageParams.add(new BasicNameValuePair("From", "+14065302461"));
        messageParams.add(new BasicNameValuePair("Body", message));

        try {
            messageFactory.create(messageParams);
            LOGGER.info("SMS sent");
        } catch (TwilioRestException e) {
            LOGGER.error("Unexpected exception during SMS sending : ", e);
        }

我的号码对短信有效,你可以在那个ps中看到:

enter image description here

我的代码使用幻数+15005550006。

有什么建议吗?

谢谢,

1 个答案:

答案 0 :(得分:7)

好了解问题。我使用了我的&#34; Test AccountSID&#34;而不是我的&#34; Live AccountSID&#34;。也许特定的错误消息可能对这种情况有用。

相关问题