Frequently Asked Questions
Sri Lankan phone numbers follow the E.164 international standard, which includes the +94 country code followed by a 9-digit national number. For example, a valid number would look like +94771234567. Always store numbers in this format for consistency and international compatibility.
Use regular expressions for robust validation. In JavaScript, an example regex is /^(?:0|94|\+94)?([0-9]{9})$/. This checks for a valid 9-digit number, optionally preceded by 0, 94, or +94. Server-side validation is crucial for security.
You can identify the type by the prefix. Mobile numbers typically start with 07[0-8], landlines with 0 followed by a 2-digit area code, and shortcodes are usually 3 or 4 digits. Use this to customize handling in your application.
Storing numbers in E.164 format (+94XXXXXXXXX) ensures consistency and simplifies internationalization. It facilitates compatibility with various telecommunication systems and streamlines processing.
MNP lets users switch operators while keeping their number. Developers should integrate with an MNP lookup service (if available) to determine the current operator and route calls/messages correctly.
Integrate with an MNP lookup service to dynamically identify the current operator for a given number. This is important for accurate routing and billing, especially with number portability.
Common emergency numbers like police (119), ambulance (110), and disaster management (1919) should be dialed directly without prefixes. Implement logic to detect these numbers and handle them appropriately in your application.
Area codes range from 11 for Colombo to 91 for Ampara. They are two digits and precede the 7-digit subscriber number in landline phone numbers. Mobile numbers do not use area codes.
Sri Lanka's network infrastructure varies. Implement network quality detection and fallback mechanisms for areas with limited connectivity. Design features like caching and adaptive bitrate streaming for optimal performance.
The Telecommunications Regulatory Commission of Sri Lanka (TRC) website (http://www.trc.gov.lk) provides the latest regulations, updates, device approval requirements, and licensing information for telecommunications operations.
The international prefix for calling Sri Lanka is 00. Dial 00 followed by 94 (the country code) and then the 9-digit phone number.
Client-side validation enhances user experience by immediately alerting users to formatting errors. It should be used in conjunction with server-side validation for data integrity and security.
Yes, you can identify shortcodes by checking for numbers that are typically 3 or 4 digits long. In your code, use regular expressions or other pattern matching techniques to distinguish them from regular phone numbers.
Loading...
Sri Lanka Phone Numbers: Format, Area Code & Validation Guide
This guide provides a comprehensive overview of Sri Lanka's phone number system, offering developers essential information for building robust and compliant telecommunications applications. We'll cover number formatting, validation, carrier identification, Mobile Number Portability (MNP), emergency number handling, and best practices for implementation.
Quick Reference
Number Format and Validation
Sri Lankan phone numbers adhere to the ITU-T E.164 international standard. This standard defines a consistent format for international telephone numbers, ensuring global interoperability.
E.164 Format
The E.164 format consists of:
Example: +94771234567
Number Types
Sri Lankan numbers can be categorized into the following types:
070
,071
,072
,075
,076
,077
, or078
followed by 7 digits.0
followed by a 2-digit area code and a 7-digit subscriber number. Area codes range from 11 (Colombo) to 91 (Ampara).Validation Best Practices
Mobile Number Portability (MNP)
MNP allows subscribers to switch operators while keeping their existing number. This requires developers to implement lookup mechanisms to determine the current operator for a given number.
Emergency Numbers
Handle emergency numbers with care. Directly dial these numbers without any prefixes.
Network Considerations
Sri Lanka's network infrastructure is a mix of modern urban and developing rural networks. Consider these factors when designing your application:
Compliance and Regulations
Adhere to the regulations set by the TRC. Key aspects include:
Error Handling
Implement comprehensive error handling to manage various scenarios, such as invalid number formats, MNP lookup failures, and network issues. Provide informative error messages and logging for debugging and monitoring.
Additional Resources
By following these guidelines, you can develop telecommunications applications that are robust, compliant, and optimized for the Sri Lankan market. Remember to consult the TRC website for the latest regulations and updates.