使用Twilio Voice时触发PHP致命错误,账户无国际呼叫权限
Hey there, I’ve seen this exact error pop up a bunch when folks first start using Twilio for international calls—let’s break down how to fix it.
What’s Causing This?
The error message spells it out clearly: your Twilio account doesn’t have permission to call the international number you’re targeting (+126878****). Twilio locks down international calling by default for security and billing reasons, so you’ll need to manually enable access for the specific country/region you want to call.
Step-by-Step Fix
- Log into your Twilio account dashboard
- Head to the International Permissions section in your account settings
- Find the country linked to the phone number you’re trying to reach (the
+1268code here corresponds to Antigua and Barbuda) - Toggle on the permission to make calls to that country. Quick note: If you’re on a trial account, you might need to upgrade to a paid plan or verify additional details to unlock this feature.
Your Error & Code Reference
Here’s the fatal error you ran into, formatted for clarity:
PHP Fatal error: Uncaught exception 'Twilio\Exceptions\RestException' with message '[HTTP 400] Unable to create record: Account not authorized to call +126878****. Perhaps you need to enable some international permissions: https://www.twilio.com/user/account/settings/international ' in /home/gwalioro/public_html/swifnix.com/works/call/twilio-php-master/Twilio/Version.php:85
And your code snippet (you’re already set up correctly with the Twilio PHP library):
require __DIR__ . '/twilio-php-master/Twilio/autoload.php'; use Twilio\Rest\Client; // Your Account SID and Auth ...
One quick double-check: Once you’ve enabled the permissions, make sure your Account SID and Auth Token are correctly configured in your code—though this error is 100% permission-related, not an authentication issue.
内容的提问来源于stack exchange,提问作者Kunal Sahu

