Problem
A suspended Twilio account "can't make or receive phone calls or send and receive SMS messages", and a closed one can't either (https://www.twilio.com/docs/iam/api/subaccounts). Twilio reports this as error 20005, "Account not active": "An inactive account can't place calls, send messages, purchase or provision phone numbers, or perform other API operations" (https://www.twilio.com/docs/api/errors/20005). The emulator lets an account whose Status is suspended or closed keep sending messages and placing calls, so a test that suspends an account and expects its traffic to stop cannot represent it.
Proposal
- Refuse message and call creation for an account whose status is
suspendedorclosedwith error20005and messageAccount not active, and restore it when the status is set back toactive. - Twilio does not document the HTTP status for
20005; return401, the status Twilio lists for missing or invalid credentials (https://www.twilio.com/docs/usage/twilios-response), whose error20003lists "The account is suspended or closed" among its causes (https://www.twilio.com/docs/api/errors/20003).
Implementation
A working version with tests and docs is on a fork branch: https://github.com/Unchallenged-com/emulate/tree/twilio-inactive-accounts. Happy to open a pull request for it.
Activity
0No activity yet.