I have a trial twilio phone number 1XXXXXXXXXXXX:
I am able to receive a call, record, voicemail, But when tried to make an outbound call , i am getting the below exception.
Exception in thread "main" com.twilio.sdk.TwilioRestException: 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.
Here is the code:
public class 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());
}
}
Thanks in advance,