phone number standards
phone number standards
Timor-Leste (+670) Phone Numbers: Complete Format, Validation & Integration Guide
Comprehensive Timor-Leste phone number guide for developers. Master +670 country code formatting, E.164 validation, mobile/landline patterns, operator identification, and SMS integration with code examples.
Timor-Leste Phone Numbers: Format, Area Code & Validation Guide
Understanding Timor-Leste (East Timor) Phone Numbers
This comprehensive guide covers everything developers need to handle Timor-Leste phone numbers (also known as East Timor phone numbers) in applications and SMS systems. Learn +670 country code formatting, phone number validation patterns, E.164 format implementation, operator identification, and regulatory compliance. Whether you're building authentication systems, SMS notification services, or customer databases, this guide provides practical code examples for robust phone number validation and formatting.
Quick Overview of the Timor-Leste Numbering System
Key components of Timor-Leste's phone number structure:
- Country: Timor-Leste (East Timor, officially the Democratic Republic of Timor-Leste)
- Country Code: +670 (replaced previous code +62 after independence)
- ISO Code: TL
- International Prefix: 00
- National Prefix: None
Timor-Leste's telecommunications infrastructure evolved rapidly since independence in 2002. The numbering plan remains modern and streamlined:
Historical Context:
- 2002: Independence brought new telecommunications infrastructure
- 2012: Liberalization licensed two new operators (Telemor and Telkomcel)
- Ongoing: Timor Digital 2032 program enhances digital services and ICT sector
- Recent: Development of first international submarine cable link
Stay current with ANC regulations as the telecommunications landscape continues to evolve.
Deep Dive into Timor-Leste's Numbering Plan
Timor-Leste uses a streamlined 7-digit numbering system, making it straightforward to work with compared to some Southeast Asian neighbors. This simplified structure reflects the country's modern telecommunications infrastructure. Understanding the nuances of number categories and validation is essential for robust application development.
Core Number Structure and Categories
All Timor-Leste numbers use a consistent 7-digit format after the country code. This predictable structure simplifies parsing and validation. Use this TypeScript interface to represent Timor-Leste phone numbers:
const COUNTRY_CODE = '+670';
const SUBSCRIBER_LENGTH = 7;
interface TimorLesteNumber {
type: 'geographic' | 'mobile' | 'tollFree' | 'premiumRate';
format: string;
pattern: RegExp;
}This interface defines four number types: geographic, mobile, tollFree, and premiumRate. Each type has a specific format and validation pattern.
Number Categories and Validation
Geographic Number Assignments by Region:
| Prefix | Region/Service Area |
|---|---|
| 21 | Dili (capital) |
| 22-25 | Other regions |
Number Categories and Validation:
| Service Type | Format | Example | Validation Regex |
|---|---|---|---|
| Geographic | 2[1-5]\d{5} | 2112345 | /^2[1-5]\d{5}$/ |
| Mobile | 7[2-8]\d{5} | 7721234 | /^7[2-8]\d{5}$/ |
| Toll-Free | 800\d{4} | 8001234 | /^800\d{4}$/ |
| Premium Rate | 900\d{4} | 9001234 | /^900\d{4}$/ |
Use these regular expressions to validate user input and ensure data integrity. Always validate numbers before processing them.
Implementing Best Practices for Validation
Here's a JavaScript utility function that demonstrates number validation using the regular expressions from the table above:
// Utility function for number validation
function validateTimorLesteNumber(number: string, type: string): boolean {
const patterns = {
geographic: /^2[1-5]\d{5}$/,
mobile: /^7[2-8]\d{5}$/,
tollFree: /^800\d{4}$/,
premiumRate: /^900\d{4}$/
};
// Remove any non-digit characters
const cleanNumber = number.replace(/\D/g, '');
// Check if the type exists in our patterns
if (!patterns[type]) {
console.error(`Unknown number type: ${type}`);
return false;
}
return patterns[type].test(cleanNumber);
}
// Example usage
const mobileNumber = '7721234';
console.log(validateTimorLesteNumber(mobileNumber, 'mobile')); // true
const invalidNumber = '+670-771-1234'; // Example of a common formatting error
console.log(validateTimorLesteNumber(invalidNumber, 'mobile')); // false
// Example with an unknown type
console.log(validateTimorLesteNumber(mobileNumber, 'unknown')); // logs error and returns falseThis function cleans the input by removing non-digit characters, then validates using the appropriate regular expression. The error handling for unknown types prevents unexpected behavior. Robust validation is essential for reliable applications.
Practical Implementation Guide
Now that you understand the structure and validation rules, implement these practical solutions for formatting, error handling, and integration.
1. Number Formatting for International and Local Contexts
Formatting for Different UI Contexts:
- Storage: Always use E.164 format (
+670XXXXXXX) for database storage - Forms: Display as
+670 XXX XXXXwith input masking for user entry - Display: Show as
XXX XXXXfor local context or+670 XXX XXXXfor international - SMS/API Integration: Use E.164 format for SMS messaging and API calls
- Exports (CSV, APIs): Use E.164 format for consistency and interoperability
Consistent number formatting ensures interoperability across telecommunications systems.
Here's a JavaScript function that formats numbers for both international and local contexts:
function formatTimorLesteNumber(number: string, international: boolean = false): string {
const cleaned = number.replace(/\D/g, '');
if (international) {
return `+670 ${cleaned}`;
}
return cleaned.replace(/(\d{3})(\d{4})/, '$1 $2'); // Local format: XXX XXXX
}
// Example usage
const number = '7721234';
console.log(formatTimorLesteNumber(number, true)); // +670 7721234
console.log(formatTimorLesteNumber(number)); // 772 1234This function displays numbers in different contexts while maintaining a consistent internal representation. E.164 storage ensures compatibility with telecommunications systems worldwide.
2. Robust Error Handling
Implement Robust Error Handling
Anticipate potential issues and provide clear user feedback:
Here's an example of how to incorporate error handling into your validation and formatting logic:
function validateAndFormat(number: string): string | null {
try {
if (!number) {
throw new Error('Phone number is required.');
}
const cleaned = number.replace(/\D/g, '');
if (cleaned.length !== 7) {
throw new Error('Phone number must be 7 digits.');
}
// Perform type-specific validation (e.g., using validateTimorLesteNumber)
if (!validateTimorLesteNumber(cleaned, 'mobile')) { // Assuming it's a mobile number for this example
throw new Error('Invalid mobile number format.');
}
return formatTimorLesteNumber(cleaned);
} catch (error) {
console.error(`Validation error: ${error.message}`);
return null; // Or handle the error differently based on your application's needs
}
}
// Example usage
console.log(validateAndFormat('7721234')); // 772 1234
console.log(validateAndFormat('123')); // Validation error: Phone number must be 7 digits. null
console.log(validateAndFormat('')); // Validation error: Phone number is required. null
console.log(validateAndFormat('2111234')); // 211 1234 (Geographic number)User-Facing Error Messages:
- "Enter a phone number" (instead of "Phone number is required")
- "Phone number must be 7 digits" (with example: 772 1234)
- "Invalid mobile number format. Check your number and try again."
Tailor error handling to your application needs, balancing user clarity with debugging information.
Technical Considerations and Integration Checklist
Integration Checklist:
- E.164 Formatting: Store all numbers in E.164 format (+670XXXXXXX)
- Library Integration: Use libphonenumber for production-grade validation and formatting
- Carrier Detection: Implement operator identification using 3-digit prefixes (772=Timor Telecom, 773=Telkomcel, 784=Telemor)
- Comprehensive Validation: Validate all number types (geographic, mobile, toll-free, premium rate)
- Error Handling: Provide clear error messages with examples and recovery steps
- International Dialing: Configure +670 country code for outbound calls and SMS
Testing Strategy:
-
Valid Input Tests:
- Geographic: 2112345, 2234567, 2512345
- Mobile: 7721234, 7731234, 7841234
- Toll-free: 8001234
- Premium: 9001234
-
Invalid Input Tests:
- Wrong length: 123, 12345678
- Invalid prefixes: 1234567, 6721234
- Non-numeric: abc1234, 772-1234
- Empty/null values
-
Edge Cases:
- Leading/trailing whitespace
- Country code variations: +670, 670, 00670
- Formatted input: +670 772 1234, (670) 772-1234
Run these tests in your CI/CD pipeline to ensure reliable phone number handling.
Common Pitfalls and How to Avoid Them
Avoid these common mistakes when handling Timor-Leste phone numbers:
1. Invalid Formatting
Always store numbers in E.164 format (+670XXXXXXX) and only format them for display. Never store hyphens or spaces within the subscriber number.
2. Missing Validation
Never assume user input is valid. Always validate numbers before storing or processing them. Validation prevents data corruption and unexpected behavior.
3. Ignoring Edge Cases
Handle Edge Cases:
// Example: Handling common edge cases
function cleanAndValidate(input: string): string | null {
if (!input) return null;
// Handle leading/trailing spaces
const trimmed = input.trim();
// Handle country code variations
let cleaned = trimmed.replace(/^(\+670|670|00670)/, '');
// Remove formatting characters
cleaned = cleaned.replace(/[\s()-]/g, '');
// Validate length
if (cleaned.length !== 7) return null;
return cleaned;
}
// Test edge cases
console.log(cleanAndValidate(' 7721234 ')); // 7721234
console.log(cleanAndValidate('+670 772 1234')); // 7721234
console.log(cleanAndValidate('(670) 772-1234')); // 7721234
console.log(cleanAndValidate('00670-772-1234')); // 7721234Test your code with various inputs to ensure robustness.
Regulatory Compliance with the ANC
The Autoridade Nacional de Comunicações (ANC) regulates telecommunications in Timor-Leste. Stay informed about ANC regulations to ensure compliance.
Compliance Requirements:
- Number Formatting: Use ANC-approved E.164 format for all storage and transmission
- Data Protection: Implement encryption for stored phone numbers
- User Consent: Obtain explicit consent before storing or processing phone numbers
- Data Retention: Follow local data retention policies (consult legal counsel)
- Operator Licensing: Verify your telecom service provider holds valid ANC licenses
Actionable Compliance Steps:
- Review ANC guidelines at https://www.anc.gov.tl
- Implement audit logging for phone number access
- Document your data protection measures
- Establish data breach notification procedures
- Consult local legal counsel for data privacy requirements
Penalties for Non-Compliance:
- Service disruptions or license suspension
- Financial penalties (amounts vary by violation)
- Reputational damage
Infrastructure Developments:
Timor-Leste's telecommunications sector continues to modernize:
- Timor Digital 2032: Government program enhancing digital services
- Submarine Cable: First international link improves connectivity
- Operator Competition: Three licensed operators drive innovation
These developments may affect numbering plans and service offerings. Monitor ANC announcements for changes.
Network Operator Integration and Identification
Identify the network operator for routing calls or applying operator-specific logic. Note: Mobile Number Portability (MNP) is not currently implemented in Timor-Leste, so prefix-based identification remains reliable.
Complete Operator Prefix Mapping:
function identifyOperator(phoneNumber: string): string {
const cleanedNumber = phoneNumber.replace(/\D/g, ''); // Clean the input
if (cleanedNumber.length !== 7) { // Check for valid length
return 'Invalid Number';
}
const prefixMap = {
// Timor Telecom
'772': 'Timor Telecom',
'775': 'Timor Telecom',
'776': 'Timor Telecom',
'777': 'Timor Telecom',
// Telkomcel
'773': 'Telkomcel',
'774': 'Telkomcel',
'778': 'Telkomcel',
// Telemor
'784': 'Telemor',
'785': 'Telemor'
};
const prefix = cleanedNumber.substring(0, 3);
return prefixMap[prefix] || 'Unknown Operator';
}
// Example usage
console.log(identifyOperator('+6707721234')); // Timor Telecom
console.log(identifyOperator('7731234')); // Telkomcel
console.log(identifyOperator('7841234')); // Telemor
console.log(identifyOperator('123456789')); // Invalid Number
console.log(identifyOperator('7701234')); // Unknown OperatorThis function cleans the input, validates length, and returns a default value for unknown operators. Update prefixMap when operators add new prefixes.
Mobile Number Portability (MNP) Considerations:
Timor-Leste has not implemented MNP. Prefix-based operator identification remains accurate. If MNP is introduced, you'll need to:
- Integrate with an MNP lookup service
- Cache results to minimize API calls
- Handle lookup failures gracefully
- Update documentation when MNP launches
Future Considerations
Stay Prepared for Telecommunications Evolution:
Numbering Plan Changes:
- Monitor ANC announcements for new prefixes or number ranges
- Design validation patterns that accept future prefixes
- Use configuration files for prefix mapping (avoid hardcoding)
Technology Developments:
- 5G Rollout: Expected in major cities by 2025–2027 (no numbering impact anticipated)
- VoIP Services: Increasing adoption may introduce virtual number ranges
- IoT Numbering: Machine-to-machine services may require new number categories
Recommended Architecture:
// Use configurable validation instead of hardcoded patterns
const config = {
mobileRanges: ['72-78'], // Can be updated without code changes
validationVersion: '2024-01'
};Implement flexible validation patterns and version your numbering rules to maintain compatibility.
Frequently Asked Questions
What is the country code for Timor-Leste (East Timor)?
The country code for Timor-Leste (also called East Timor) is +670. All Timor-Leste phone numbers follow the format +670 followed by 7 digits. The international dialing prefix is 00, and there is no national prefix. When calling from the US, dial 011-670 followed by the 7-digit number. Always store numbers in E.164 format (+670XXXXXXX) for international compatibility and system interoperability.
How do I validate Timor-Leste phone numbers programmatically?
Use regex patterns specific to each number type: geographic (landline) numbers use ^2[1-5]\d{5}$, mobile numbers use ^7[2-8]\d{5}$, toll-free numbers use ^800\d{4}$, and premium rate numbers use ^900\d{4}$. For production applications, use the libphonenumber library for comprehensive phone number validation. Always validate before processing to ensure data integrity. Clean input by removing non-digit characters first.
What mobile operators and carriers serve Timor-Leste?
Timor-Leste has three main mobile network operators: Timor Telecom (prefixes 772, 775-777), Telkomcel (prefixes 773-774, 778), and Telemor (prefixes 784-785). These carriers were licensed following telecommunications sector liberalization in 2012. Identify operators programmatically using the first three digits of the 7-digit subscriber number for SMS routing, call routing, or carrier-specific logic in your applications.
What is E.164 format for Timor-Leste numbers?
E.164 is the international phone numbering standard. For Timor-Leste, E.164 format is +670 followed by the 7-digit subscriber number (e.g., +670 7721234). Always store numbers in E.164 format for consistency. Format for display purposes only, never for storage. This ensures compatibility with telecommunications systems worldwide.
How do geographic and mobile numbers differ in Timor-Leste?
Geographic numbers start with 2 followed by 1–5 (format: 2[1-5]XXXXX), while mobile numbers start with 7 followed by 2–8 (format: 7[2-8]XXXXX). Both are 7 digits long. Mobile numbers are more common due to Timor-Leste's telecommunications infrastructure development since independence in 2002. Validate each type with specific regex patterns.
What are toll-free and premium rate numbers in Timor-Leste?
Toll-free numbers use the 800 prefix (format: 800XXXX), while premium rate numbers use the 900 prefix (format: 900XXXX). Both are 7 digits total. Toll-free numbers are free for callers, with charges paid by the recipient. Premium rate numbers charge higher rates, typically for information or entertainment services.
Who regulates telecommunications in Timor-Leste?
The Autoridade Nacional de Comunicações (ANC) regulates telecommunications in Timor-Leste. ANC oversees number formatting standards, data protection requirements, operator licensing, and service quality guidelines. Stay informed about ANC regulations to ensure compliance. Visit https://www.anc.gov.tl for official documentation and regulatory updates affecting developers and telecommunications providers.
What common errors should I avoid with Timor-Leste phone numbers?
Avoid storing numbers with hyphens or spaces (use E.164 instead), skipping validation of user input, ignoring edge cases like leading/trailing spaces, assuming all 7-digit numbers are valid without regex validation, and neglecting to handle different number types (geographic, mobile, toll-free, premium). Always clean input, validate against proper patterns, and implement comprehensive error handling.
Conclusion
You now have the tools to handle Timor-Leste phone numbers effectively. Implement E.164 formatting, validate all input, and stay current with ANC regulations.
Next Steps:
- Implement Validation: Start with the provided regex patterns and test cases
- Integrate libphonenumber: Use libphonenumber-js for production applications
- Set Up Monitoring: Track validation failures to identify integration issues
- Review Compliance: Consult local legal counsel about data protection requirements
Recommended Resources:
Related Guides:
- Phone Number Lookup and Validation API
- E.164 Phone Number Format Standard
- International SMS Registration and Best Practices
- Indonesia Phone Numbers (+62) - Neighboring country guide
- Australia Phone Numbers (+61) - Former administrative connection
- Telecommunications Compliance Guide