问题
Hi I am on trial with twilio.
I have seen this link: https://www.twilio.com/help/faq/twilio-basics/how-does-twilios-free-trial-work
It says "You must verify a phone number before you can send SMS messages to it from your trial phone number." And also restricts on the outgoing text
But what if I just want to verfiy the number, using:
var twilio = new TwilioRestClient(
Keys.TwilioSid,
Keys.TwilioToken
);
var result = twilio.SendMessage(
Keys.FromPhone,
message.Destination, message.Body);
// Status is one of Queued, Sending, Sent, Failed or null if the number is not valid
Trace.TraceInformation(result.Status);
// Plug in your SMS service here to send a text message.
return Task.FromResult(0);
I get null when I try to verify the number that are not in the dashboard(web twilio) whereas those with verified from dashboard gets the verification from above code.
Is it intended? I think we need to be able to register at least from web interface?
Error: Account not authorized to call . Perhaps you need to enable some international permissions: twilio.com/user/account/settings/international For Message The number XX is unverified. Trial accounts cannot send messages to unverified numbers; verify xxx at twilio.com/user/account/phone-numbers/verified, or purchase a Twilio number to send messages to unverified numbers
回答1:
I don't think you can verify a number in the way that you are attempting to do it. Verifying a number adds it to your outgoing numbers. you can look at this page, which provides the full details. https://www.twilio.com/docs/api/rest/outgoing-caller-ids#list-post-example-1
A snippet from the page using the C# Api,
// Find your Account Sid and Auth Token at twilio.com/user/account
string AccountSid = "{{ sid }}";
string AuthToken = "{{ auth_token }}";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var callerId = twilio.AddOutgoingCallerId("+14158675309", "My Home Phone Number", null, null);
Console.WriteLine(callerId.ValidationCode);
The first argument is the number you would like to verify, and the second argument is simply a friendly name for the number. The above process will initiate a call to the number and ask you to provide the validation code. You will then use the value that is printed to the console and enter that during the validation process, provided that all goes well, once the above process is complete, the number would be verified and you will be able to send an Sms to that number.
回答2:
Twilio evangelist here.
A trial account has a number of restrictions placed on it, including you can only send SMS messages to verified phone numbers. A verified phone number will show up in your Twilio dashboard under Numbers > Verified Caller IDs:
https://www.twilio.com/user/account/phone-numbers/verified
To verify a number using the .NET helper library, call the AddOutgoingCallerId method like Lewis showed.
Calling this method returns to you a six digit verification code. Twilio will then call the number that you want to verify and ask the person who answers to enter that 6 digit code. If the code entered matches, Twilio adds that phone number as a Verified Caller ID and you an send text messages to it.
Note that while using a Trial account, messages will also be prefixed with the message "Sent from a Twilio Trial account".
If the request to the Twilio REST API made by the AddOutgoingCallerId method fails (wrong credentials, invalid method parameters, etc), you determine this by checking the RestException property:
var result = twilio.AddOutgoingCallerId("+15555555555","Verified Number",null,null);
if (result.RestException!=null) {
Debug.Writeline(result.RestException.Message);
}
Hope that helps.
来源:https://stackoverflow.com/questions/27147762/no-verification-code-while-registering-number-via-message-using-twilio-trial