Capabilities List filters for AvailablePhoneNumbers resource don't work AT ALL
Problem
Note: These issues are for bugs and feature requests for the helper libraries. If you need help or support, please email help@twilio.com and one of our experts will assist you! 3.17.0 Code Snippet [code block] [code block] [code block] Exception/Log [code block] Steps to Reproduce 1. Request a list of available phone numbers for purchase using either the voiceEnabled, smsEnabled, or mmsEnabled list filters. 2. Observe that the list of phone numbers returns phone numbers with capabilities.voice, capabilities.SMS, or capabilities.MMS return true when they should return false depending on which code snippet you run.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix AvailablePhoneNumbers Capabilities List Filters Issue
The AvailablePhoneNumbers resource is not correctly filtering phone numbers based on the specified capabilities due to an issue in the query parameters being sent to the Twilio API. The filters for voiceEnabled, smsEnabled, and mmsEnabled are not being applied properly, resulting in incorrect phone numbers being returned.
Awaiting Verification
Be the first to verify this fix
- 1
Review API Request Parameters
Ensure that the API request for available phone numbers includes the correct parameters for filtering based on capabilities. Check that the parameters are being set correctly in your code.
javascriptconst availableNumbers = await client.availablePhoneNumbers('US').list({ voiceEnabled: true }); - 2
Update Helper Library
Check if you are using the latest version of the Twilio helper library. If not, update to the latest version to ensure all bug fixes and improvements are included.
bashnpm install twilio@latest - 3
Test with Different Filters
Run tests using different combinations of the filters (voiceEnabled, smsEnabled, mmsEnabled) to verify that the filtering works as expected. Document the results for each test case.
javascriptconst numbers = await client.availablePhoneNumbers('US').list({ smsEnabled: false }); - 4
Check API Response Structure
Inspect the API response structure to ensure that the capabilities are being returned as expected. Look for discrepancies in the capabilities returned versus the filters applied.
javascriptconsole.log(numbers); - 5
Contact Twilio Support if Issue Persists
If the issue is still not resolved after following the above steps, contact Twilio support with detailed information about your request and the unexpected results.
textEmail: help@twilio.com
Validation
Confirm that the returned list of phone numbers matches the expected capabilities based on the filters applied. Each phone number should reflect the correct boolean values for voice, SMS, and MMS capabilities according to the filters used.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep