phony 2.20.13 → 2.20.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phony/config.rb +25 -26
- data/lib/phony/countries/argentina.rb +311 -314
- data/lib/phony/countries/austria.rb +71 -72
- data/lib/phony/countries/bangladesh.rb +27 -28
- data/lib/phony/countries/belarus.rb +110 -111
- data/lib/phony/countries/brazil.rb +92 -92
- data/lib/phony/countries/cambodia.rb +9 -9
- data/lib/phony/countries/china.rb +22 -21
- data/lib/phony/countries/croatia.rb +6 -5
- data/lib/phony/countries/georgia.rb +84 -84
- data/lib/phony/countries/germany.rb +4067 -4068
- data/lib/phony/countries/guinea.rb +8 -8
- data/lib/phony/countries/india.rb +31 -34
- data/lib/phony/countries/indonesia.rb +57 -46
- data/lib/phony/countries/ireland.rb +4 -5
- data/lib/phony/countries/italy.rb +54 -53
- data/lib/phony/countries/japan.rb +456 -456
- data/lib/phony/countries/kyrgyzstan.rb +109 -109
- data/lib/phony/countries/latvia.rb +34 -34
- data/lib/phony/countries/libya.rb +106 -106
- data/lib/phony/countries/malaysia.rb +12 -12
- data/lib/phony/countries/moldova.rb +42 -42
- data/lib/phony/countries/montenegro.rb +24 -20
- data/lib/phony/countries/myanmar.rb +39 -39
- data/lib/phony/countries/namibia.rb +35 -29
- data/lib/phony/countries/nepal.rb +60 -62
- data/lib/phony/countries/netherlands.rb +13 -13
- data/lib/phony/countries/pakistan.rb +135 -111
- data/lib/phony/countries/paraguay.rb +135 -135
- data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +125 -128
- data/lib/phony/countries/saudi_arabia.rb +5 -5
- data/lib/phony/countries/serbia.rb +47 -39
- data/lib/phony/countries/somalia.rb +18 -18
- data/lib/phony/countries/south_korea.rb +16 -13
- data/lib/phony/countries/sweden.rb +28 -28
- data/lib/phony/countries/taiwan.rb +20 -19
- data/lib/phony/countries/tajikistan.rb +70 -70
- data/lib/phony/countries/turkmenistan.rb +65 -65
- data/lib/phony/countries/ukraine.rb +607 -607
- data/lib/phony/countries/united_kingdom.rb +66 -66
- data/lib/phony/countries/uruguay.rb +40 -41
- data/lib/phony/countries/vietnam.rb +18 -17
- data/lib/phony/countries/zimbabwe.rb +31 -31
- data/lib/phony/countries.rb +440 -443
- data/lib/phony/country.rb +42 -44
- data/lib/phony/country_codes.rb +61 -60
- data/lib/phony/dsl.rb +23 -26
- data/lib/phony/local_splitters/fixed.rb +20 -29
- data/lib/phony/local_splitters/regex.rb +28 -31
- data/lib/phony/national_code.rb +7 -10
- data/lib/phony/national_splitters/default.rb +9 -11
- data/lib/phony/national_splitters/dsl.rb +8 -18
- data/lib/phony/national_splitters/fixed.rb +11 -14
- data/lib/phony/national_splitters/none.rb +7 -11
- data/lib/phony/national_splitters/regex.rb +13 -17
- data/lib/phony/national_splitters/variable.rb +36 -38
- data/lib/phony/trunk_code.rb +16 -18
- data/lib/phony/vanity.rb +12 -13
- data/lib/phony.rb +84 -84
- metadata +5 -39
- data/spec/functional/config_spec.rb +0 -44
- data/spec/functional/plausibility_spec.rb +0 -689
- data/spec/lib/phony/countries_spec.rb +0 -1459
- data/spec/lib/phony/country_codes_spec.rb +0 -227
- data/spec/lib/phony/country_spec.rb +0 -104
- data/spec/lib/phony/dsl_spec.rb +0 -28
- data/spec/lib/phony/local_splitters/fixed_spec.rb +0 -56
- data/spec/lib/phony/local_splitters/regex_spec.rb +0 -94
- data/spec/lib/phony/national_code_spec.rb +0 -61
- data/spec/lib/phony/national_splitters/default_spec.rb +0 -34
- data/spec/lib/phony/national_splitters/fixed_spec.rb +0 -45
- data/spec/lib/phony/national_splitters/none_spec.rb +0 -28
- data/spec/lib/phony/national_splitters/regex_spec.rb +0 -23
- data/spec/lib/phony/national_splitters/variable_spec.rb +0 -35
- data/spec/lib/phony/trunk_code_spec.rb +0 -85
- data/spec/lib/phony/vanity_spec.rb +0 -30
- data/spec/lib/phony_spec.rb +0 -70
data/lib/phony/countries.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
# All countries, ordered by country code.
|
@@ -44,7 +43,6 @@
|
|
44
43
|
# )
|
45
44
|
#
|
46
45
|
Phony.define do
|
47
|
-
|
48
46
|
# Reserved.
|
49
47
|
#
|
50
48
|
reserved '0'
|
@@ -52,16 +50,16 @@ Phony.define do
|
|
52
50
|
# USA, Canada, etc.
|
53
51
|
#
|
54
52
|
country '1',
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
# The US has a delimiter between NDC and local number.
|
54
|
+
trunk('1%s', normalize: true, format: false) | # http://en.wikipedia.org/wiki/Trunk_prefix
|
55
|
+
fixed(3) >> split(3, 4),
|
56
|
+
invalid_ndcs: /[0-1]\d{2}|[3-9]11/,
|
57
|
+
parentheses: true,
|
58
|
+
local_space: :-
|
61
59
|
|
62
60
|
# Kazakhstan (Republic of) & Russsian Federation.
|
63
61
|
# also Abhasia and South Osetia autonomous regions / recognized by some states as independent countries
|
64
|
-
#country '7', fixed(3) >> split(3,2,2)
|
62
|
+
# country '7', fixed(3) >> split(3,2,2)
|
65
63
|
# see special file
|
66
64
|
|
67
65
|
# Egypt.
|
@@ -70,26 +68,26 @@ Phony.define do
|
|
70
68
|
one_of('3') >> split(7..7) | # Alexandria
|
71
69
|
one_of('2') >> split(8..8) | # Cairo/Giza
|
72
70
|
one_of('10', '11', '12', '15') >> split(8..8) | # the 4 mobile operators
|
73
|
-
fixed(2)
|
71
|
+
fixed(2) >> split(7..7) # all the other 24 provinces
|
74
72
|
|
75
73
|
# South Africa.
|
76
74
|
#
|
77
|
-
country '27', fixed(2) >> split(3,4)
|
75
|
+
country '27', fixed(2) >> split(3, 4)
|
78
76
|
|
79
77
|
# Greece. http://www.numberingplans.com/?page=dialling&sub=areacodes
|
80
78
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GR
|
81
79
|
country '30',
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
80
|
+
trunk('0') |
|
81
|
+
one_of(%w[231 241 251 261 271 281]) >> split(3, 4) |
|
82
|
+
one_of('800') >> split(3, 4) | # freephone
|
83
|
+
one_of(%w[801 807]) >> split(3, 4) | # shared cost, premium rate
|
84
|
+
one_of('896') >> split(3, 4) | # ISP
|
85
|
+
one_of(%w[901 909]) >> split(3, 4) | # premium rate
|
86
|
+
one_of(%w[21 22 23 24 25 26 27 28]) >> split(4, 4) |
|
87
|
+
one_of('50') >> split(4, 4) | # VPN
|
88
|
+
match(/^(69\d)\d+$/) >> split(3, 4) | # mobile, pager
|
89
|
+
one_of('70') >> split(4, 4) | # universal access
|
90
|
+
fixed(4) >> split(6) # 3-digit NDCs
|
93
91
|
|
94
92
|
# country '31' # Netherlands, see special file.
|
95
93
|
|
@@ -99,46 +97,46 @@ Phony.define do
|
|
99
97
|
# https://www.bipt.be/operators/publication/national-numbering-plan
|
100
98
|
#
|
101
99
|
country '32', trunk('0') |
|
102
|
-
match(/^(7[08])\d+$/) >> split(3,3) | # Premium and national rate Services
|
103
|
-
match(/^(800|90\d)\d+$/) >> split(2,3) | # Toll free service and premium numbers
|
104
|
-
match(/^(46[056789])\d{6}$/) >> split(2,2,2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
|
105
|
-
match(/^(4[789]\d)\d{6}$/) >> split(2,2,2) | # Mobile
|
106
|
-
match(/^(45[56])\d{6}$/) >> split(2,2,2) | # Mobile Vikings and Voo
|
107
|
-
one_of('2','3','4','9')
|
108
|
-
fixed(2)
|
100
|
+
match(/^(7[08])\d+$/) >> split(3, 3) | # Premium and national rate Services
|
101
|
+
match(/^(800|90\d)\d+$/) >> split(2, 3) | # Toll free service and premium numbers
|
102
|
+
match(/^(46[056789])\d{6}$/) >> split(2, 2, 2) | # Mobile (Lycamobile, Telenet, Join Experience, Proximus 0460)
|
103
|
+
match(/^(4[789]\d)\d{6}$/) >> split(2, 2, 2) | # Mobile
|
104
|
+
match(/^(45[56])\d{6}$/) >> split(2, 2, 2) | # Mobile Vikings and Voo
|
105
|
+
one_of('2', '3', '4', '9') >> split(3, 2, 2) | # Short NDCs
|
106
|
+
fixed(2) >> split(2, 2, 2) # 2-digit NDCs
|
109
107
|
|
110
108
|
# France.
|
111
109
|
#
|
112
110
|
country '33',
|
113
|
-
|
114
|
-
|
111
|
+
trunk('0') |
|
112
|
+
fixed(1) >> split(2, 2, 2, 2) # :service? => /^8.*$/, :mobile? => /^[67].*$/
|
115
113
|
|
116
114
|
# Spain.
|
117
115
|
#
|
118
116
|
# http://www.minetur.gob.es/telecomunicaciones/es-es/servicios/numeracion/paginas/plan.aspx
|
119
117
|
#
|
120
118
|
country '34',
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
119
|
+
match(/^([67]\d{2})\d+$/) >> split(3, 3) | # Mobile
|
120
|
+
match(/^([89]0\d)\d+$/) >> split(3, 3) | # Special 80X & 90X numbers
|
121
|
+
one_of(%w[91 93]) >> split(3, 2, 2) | # Landline large regions
|
122
|
+
match(/^(9\d{2})\d+$/) >> split(2, 2, 2) | # Landline
|
123
|
+
fixed(3, zero: false) >> split(3, 3)
|
126
124
|
|
127
125
|
# Hungary.
|
128
126
|
#
|
129
127
|
# http://webpub-ext.nmhh.hu/aga/foldr/DoIndexAction.do
|
130
128
|
#
|
131
129
|
country '36',
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
130
|
+
trunk('06', normalize: false) |
|
131
|
+
one_of('104', '105', '107', '112') >> split(3, 3) | # Service
|
132
|
+
one_of('1') >> split(3, 4) | # Budapest
|
133
|
+
one_of('20', '30', '31', '50', '70') >> split(3, 4) | # Mobile
|
134
|
+
one_of('21') >> split(3, 4) | # VOIP
|
135
|
+
one_of('40', '80', '90', '91') >> split(3, 3) | # Special charged numbers
|
136
|
+
one_of('51') >> split(3, 3) | # Corporate network, M2M
|
137
|
+
one_of('38') >> split(3, 4) | # Corporate network, M2M
|
138
|
+
one_of('71') >> split(5, 5) | # M2M Numbers
|
139
|
+
fixed(2) >> split(3, 3) # Geographic numbers
|
142
140
|
|
143
141
|
# country '39' # Italy, see special file.
|
144
142
|
|
@@ -146,19 +144,19 @@ Phony.define do
|
|
146
144
|
#
|
147
145
|
country '40',
|
148
146
|
trunk('0') |
|
149
|
-
match(/^(112|800|90[036])\d+$/) >> split(3,3) | # Service
|
150
|
-
match(/^(7[1-9])\d+$/) >> split(3,4) | # Mobile
|
151
|
-
one_of('21', '31') >> split(3,4) | # Bucureşti
|
152
|
-
fixed(3) >> split(3,3) # 3-digit NDCs
|
147
|
+
match(/^(112|800|90[036])\d+$/) >> split(3, 3) | # Service
|
148
|
+
match(/^(7[1-9])\d+$/) >> split(3, 4) | # Mobile
|
149
|
+
one_of('21', '31') >> split(3, 4) | # Bucureşti
|
150
|
+
fixed(3) >> split(3, 3) # 3-digit NDCs
|
153
151
|
|
154
152
|
# Switzerland.
|
155
153
|
#
|
156
154
|
country '41',
|
157
155
|
trunk('0', normalize: true) |
|
158
156
|
match(/^(860)\d+$/) >> split(2, 3, 2, 2) | # Voice Mail access
|
159
|
-
match(/^(8(?:00|4[0248]))\d+$/) >> split(3,3) |
|
160
|
-
match(/^(90[016])\d+$/) >> split(3,3) |
|
161
|
-
fixed(2) >> split(3,2,2)
|
157
|
+
match(/^(8(?:00|4[0248]))\d+$/) >> split(3, 3) | # Freecall/Shared Cost
|
158
|
+
match(/^(90[016])\d+$/) >> split(3, 3) | # Business
|
159
|
+
fixed(2) >> split(3, 2, 2)
|
162
160
|
|
163
161
|
# country '43' # Austria, see special file.
|
164
162
|
# country '44' # UnitedKingdom, see special file.
|
@@ -166,24 +164,24 @@ Phony.define do
|
|
166
164
|
# Denmark.
|
167
165
|
#
|
168
166
|
country '45',
|
169
|
-
none >> split(2,2,2,2..2)
|
167
|
+
none >> split(2, 2, 2, 2..2)
|
170
168
|
|
171
169
|
# country '46' # Sweden, see special file.
|
172
170
|
|
173
171
|
# Norway.
|
174
172
|
#
|
175
173
|
country '47',
|
176
|
-
none >> matched_split(/^[1].*$/
|
177
|
-
/^[489].*$/ => [3,2,3],
|
178
|
-
:fallback
|
174
|
+
none >> matched_split(/^[1].*$/ => [3],
|
175
|
+
/^[489].*$/ => [3, 2, 3],
|
176
|
+
:fallback => [2, 2, 2, 2])
|
179
177
|
|
180
178
|
# Poland (Republic of)
|
181
179
|
# Although the NDCs are 2 digits, the representation is 3 digits.
|
182
180
|
# Note: http://wapedia.mobi/en/Telephone_numbers_in_Poland, mobile not yet correct
|
183
181
|
#
|
184
182
|
country '48',
|
185
|
-
match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3,3) |
|
186
|
-
fixed(2)
|
183
|
+
match(/^(45\d|5[0137]\d|6[069]\d|7[02389]\d|80[01]|88\d)/) >> split(3, 3) |
|
184
|
+
fixed(2) >> split(3, 2, 2)
|
187
185
|
|
188
186
|
# country '49' # Germany, see special file.
|
189
187
|
|
@@ -191,21 +189,21 @@ Phony.define do
|
|
191
189
|
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Peru
|
192
190
|
# Note: https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PE
|
193
191
|
country '51',
|
194
|
-
one_of('103', '105') >> split(3,3) | # Service.
|
195
|
-
one_of('9') >> split(4,4) | # Mobile.
|
196
|
-
one_of('1') >> split(3,4) | # Lima.
|
197
|
-
fixed(2) >> split(3,3) # 2-digit NDCs.
|
192
|
+
one_of('103', '105') >> split(3, 3) | # Service.
|
193
|
+
one_of('9') >> split(4, 4) | # Mobile.
|
194
|
+
one_of('1') >> split(3, 4) | # Lima.
|
195
|
+
fixed(2) >> split(3, 3) # 2-digit NDCs.
|
198
196
|
|
199
197
|
# Mexico.
|
200
198
|
#
|
201
199
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
|
202
200
|
# http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers#Mexico
|
203
201
|
country '52',
|
204
|
-
match(/^(0\d{1,2})\d{10}$/) >> split(3,3,4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
|
205
|
-
match(/^(1)(33|55|81)\d{8}$/) >> split(2,4,4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
|
206
|
-
match(/^(33|55|81)\d{8}$/) >> split(4,4)
|
207
|
-
match(/^(1)(\d{3})\d{7}$/) >> split(3,3,4)
|
208
|
-
match(/^(\d{3})\d{7}$/) >> split(3,4)
|
202
|
+
match(/^(0\d{1,2})\d{10}$/) >> split(3, 3, 4) | # prefixed numbers from within Mexico (e.g. 045 + 10 digits or 02 + 10 digits)
|
203
|
+
match(/^(1)(33|55|81)\d{8}$/) >> split(2, 4, 4) | # Mexico D.F, Guadalajara, Monterrey cell phone from abroad (e.g. 52 1 55 xxxx xxxx)
|
204
|
+
match(/^(33|55|81)\d{8}$/) >> split(4, 4) | # Mexico D.F, Guadalajara, Monterrey from within Mexico
|
205
|
+
match(/^(1)(\d{3})\d{7}$/) >> split(3, 3, 4) | # cell phone from abroad
|
206
|
+
match(/^(\d{3})\d{7}$/) >> split(3, 4) # catchall.
|
209
207
|
|
210
208
|
# Cuba.
|
211
209
|
#
|
@@ -224,76 +222,75 @@ Phony.define do
|
|
224
222
|
# Chile.
|
225
223
|
#
|
226
224
|
country '56',
|
227
|
-
|
228
|
-
|
229
|
-
|
225
|
+
match(/^(13[0-79]|14[79])\d+$/) >> split(3, 3) | # Service
|
226
|
+
one_of('2', '9') >> split(8) | # Santiago, Mobile
|
227
|
+
fixed(2) >> split(8) # 2-digit NDCs
|
230
228
|
|
231
229
|
# Colombia.
|
232
230
|
# http://www.itu.int/oth/T020200002C/en
|
233
231
|
country '57',
|
234
|
-
|
235
|
-
|
236
|
-
|
232
|
+
match(/\A(3\d\d)\d+\z/) >> split(3, 4) | # mobile (300 310 311 312 313 315 316)
|
233
|
+
match(/\A(60\d)\d+\z/) >> split(3, 4) |
|
234
|
+
fixed(1) >> split(3, 4)
|
237
235
|
|
238
236
|
# Venezuela (Bolivarian Republic of)
|
239
237
|
#
|
240
238
|
country '58',
|
241
|
-
|
239
|
+
fixed(3) >> split(7)
|
242
240
|
|
243
241
|
# country '60' # Malaysia, see special file.
|
244
242
|
|
245
243
|
# Australia.
|
246
244
|
#
|
247
245
|
country '61',
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
246
|
+
trunk('0', format: false) |
|
247
|
+
match(/^(4\d\d)\d+$/) >> split(3, 3) | # Mobile
|
248
|
+
match(/^(1800)\d+$/) >> split(3, 3) | # 1800 free call
|
249
|
+
match(/^(1300)\d+$/) >> split(3, 3) | # 1300 local rate
|
250
|
+
match(/^(13)\d+$/) >> split(2, 2) | # 13 local rate
|
251
|
+
fixed(1) >> split(4, 4) # Rest
|
254
252
|
|
255
|
-
|
253
|
+
# country '62' # Indonesia (Republic of), see special file
|
256
254
|
|
257
255
|
# Philippines (Republic of the)
|
258
256
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PH
|
259
257
|
country '63',
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
fixed(2) >> split(7)
|
258
|
+
trunk('0') |
|
259
|
+
# 7/10 digits for area code '2'.
|
260
|
+
match(/\A(2)\d{10}\z/) >> split(10) |
|
261
|
+
match(/\A(2)\d{8}\z/) >> split(8) |
|
262
|
+
one_of('2') >> split(7) |
|
263
|
+
# mobile
|
264
|
+
match(/\A([89]\d\d)\d{7}\z/) >> split(7) |
|
265
|
+
match(/\A(9\d\d)\d+\z/) >> split(6) |
|
266
|
+
fixed(2) >> split(7)
|
270
267
|
|
271
268
|
# New Zealand.
|
272
269
|
#
|
273
270
|
country '64',
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
271
|
+
trunk('0') |
|
272
|
+
match(/^(2\d)\d{7}$/) >> split(3, 4) | # Mobile
|
273
|
+
match(/^(2\d)\d{6}$/) >> split(3, 3) |
|
274
|
+
match(/^(2\d)\d{8}$/) >> split(2, 3, 3) |
|
275
|
+
match(/^(800)\d{6}$/) >> split(3, 3) | # International 800 service where agreed
|
276
|
+
match(/^(800)\d{7}$/) >> split(3, 4) | # International 800 service where agreed
|
277
|
+
fixed(1) >> split(3, 4) # Rest
|
281
278
|
|
282
279
|
# Singapore (Republic of).
|
283
280
|
#
|
284
281
|
country '65',
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
282
|
+
none >> matched_split(
|
283
|
+
/^(800)\d{7}$/ => [3, 3, 4], # International Toll Free Service (ITFS) and Home Country Direct Service (HCDS) Numbers
|
284
|
+
/^\d{8}$/ => [4, 4] # TODO: Short Codes
|
285
|
+
)
|
289
286
|
|
290
287
|
# Thailand.
|
291
288
|
#
|
292
289
|
country '66',
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
290
|
+
trunk('0') |
|
291
|
+
match(/\A([689]\d\d)\d+\z/) >> split(3, 3) | # mobile
|
292
|
+
one_of('2') >> split(3, 4) | # Bangkok
|
293
|
+
fixed(2) >> split(3, 3) # Rest
|
297
294
|
|
298
295
|
# country '81' # Japan, see special file.
|
299
296
|
|
@@ -306,8 +303,8 @@ Phony.define do
|
|
306
303
|
# Turkey.
|
307
304
|
#
|
308
305
|
country '90',
|
309
|
-
|
310
|
-
|
306
|
+
trunk('0') |
|
307
|
+
fixed(3) >> split(3, 4) # Wiki says 7, but the examples say 3, 4.
|
311
308
|
|
312
309
|
# country '91' # India (Republic of) see special file
|
313
310
|
|
@@ -317,39 +314,39 @@ Phony.define do
|
|
317
314
|
#
|
318
315
|
# From http://www.wtng.info/wtng-93-af.html
|
319
316
|
#
|
320
|
-
country '93', fixed(2) >> split(7) #
|
317
|
+
country '93', fixed(2) >> split(7) # NOTE: the document says 6, but the examples use 7.
|
321
318
|
|
322
|
-
country '94', # TODO Sri Lanka (Democratic Socialist Republic of)
|
323
|
-
|
319
|
+
country '94', # TODO: Sri Lanka (Democratic Socialist Republic of)
|
320
|
+
fixed(2) >> split(3, 2, 2)
|
324
321
|
|
325
|
-
#country '95' # Myanmar, see special file.
|
322
|
+
# country '95' # Myanmar, see special file.
|
326
323
|
|
327
324
|
country '98', # Iran (Islamic Republic of)
|
328
|
-
|
329
|
-
|
325
|
+
one_of('21') >> split(4, 4) | # Teheran
|
326
|
+
fixed(3) >> split(3, 4)
|
330
327
|
|
331
328
|
country '210', todo # -
|
332
|
-
country '211', fixed(3) >> split(3,3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
|
329
|
+
country '211', fixed(3) >> split(3, 3) # South Sudan, http://www.wtng.info/wtng-211-ss.html
|
333
330
|
|
334
331
|
country '212', # Morocco
|
335
|
-
|
336
|
-
|
337
|
-
|
332
|
+
trunk('0') |
|
333
|
+
one_of('6') >> split(2, 2, 2, 2) | # mobile
|
334
|
+
fixed(2) >> split(4, 3)
|
338
335
|
|
339
|
-
country '213', fixed(2) >> split(3,4) # Algeria
|
336
|
+
country '213', fixed(2) >> split(3, 4) # Algeria
|
340
337
|
country '214', todo # -
|
341
338
|
country '215', todo # -
|
342
|
-
country '216', fixed(1) >> split(3,4) # Tunisia
|
339
|
+
country '216', fixed(1) >> split(3, 4) # Tunisia
|
343
340
|
country '217', todo # -
|
344
341
|
|
345
342
|
# country '218' # Lybia, see special file
|
346
343
|
|
347
344
|
country '219', todo # -
|
348
345
|
|
349
|
-
country '220', none >> split(3,4) # Gambia http://www.wtng.info/wtng-220-gm.html
|
350
|
-
country '221', none >> split(4,5) # Senegal http://www.wtng.info/wtng-221-sn.html
|
351
|
-
country '222', none >> split(4,4) # Mauritania http://www.wtng.info/wtng-222-mr.html
|
352
|
-
country '223', none >> split(4,4) # Mali http://www.wtng.info/wtng-223-ml.html
|
346
|
+
country '220', none >> split(3, 4) # Gambia http://www.wtng.info/wtng-220-gm.html
|
347
|
+
country '221', none >> split(4, 5) # Senegal http://www.wtng.info/wtng-221-sn.html
|
348
|
+
country '222', none >> split(4, 4) # Mauritania http://www.wtng.info/wtng-222-mr.html
|
349
|
+
country '223', none >> split(4, 4) # Mali http://www.wtng.info/wtng-223-ml.html
|
353
350
|
|
354
351
|
# country '224' # Guinea, see special file
|
355
352
|
|
@@ -360,8 +357,8 @@ Phony.define do
|
|
360
357
|
#
|
361
358
|
# There is no trunk code for this country and several of the mobile prefixes start with 0
|
362
359
|
country '225',
|
363
|
-
|
364
|
-
|
360
|
+
trunk('', normalize: false) |
|
361
|
+
fixed(2) >> split(2, 2, 2, 2)
|
365
362
|
|
366
363
|
# Burkina Faso
|
367
364
|
# http://www.wtng.info/wtng-226-bf.html
|
@@ -369,12 +366,12 @@ Phony.define do
|
|
369
366
|
#
|
370
367
|
# There is no trunk code for this country and several of the mobile prefixes start with 0
|
371
368
|
country '226',
|
372
|
-
|
373
|
-
|
369
|
+
trunk('', normalize: false) |
|
370
|
+
none >> split(2, 2, 2, 2)
|
374
371
|
|
375
|
-
country '227', none >> split(4,4) # Niger http://www.wtng.info/wtng-227-ne.html
|
376
|
-
country '228', none >> split(4,4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
|
377
|
-
country '229', none >> split(4,4) # Benin http://www.itu.int/oth/T0202000017/en
|
372
|
+
country '227', none >> split(4, 4) # Niger http://www.wtng.info/wtng-227-ne.html
|
373
|
+
country '228', none >> split(4, 4) # Togolese Republic http://www.wtng.info/wtng-228-tg.html
|
374
|
+
country '229', none >> split(4, 4) # Benin http://www.itu.int/oth/T0202000017/en
|
378
375
|
|
379
376
|
# Mauritius
|
380
377
|
# http://www.wtng.info/wtng-230-mu.html
|
@@ -382,21 +379,21 @@ Phony.define do
|
|
382
379
|
#
|
383
380
|
# There is no trunk code for this country.
|
384
381
|
country '230',
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
382
|
+
none >> matched_split(
|
383
|
+
/^5\d{7}$/ => [1, 3, 4], # Mobile
|
384
|
+
/^[246]\d{6}$/ => [3, 4] # Landline
|
385
|
+
)
|
389
386
|
|
390
387
|
# Liberia
|
391
388
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LR
|
392
389
|
country '231',
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
390
|
+
none >> matched_split(
|
391
|
+
/\A[23]\d+\z/ => [4, 4], # LIBTELCO, TEMAS
|
392
|
+
/\A[4568]\d+\z/ => [4, 3], # mobile Lonestar, Libercell, Comium Liberia Inc.
|
393
|
+
/\A77\d+\z/ => [2, 3, 4], # http://monrovia.usembassy.gov/contact.html
|
394
|
+
/\A7\d+\z/ => [4, 4], # mobile Cellcom
|
395
|
+
/\A9\d+\z/ => [4, 4] # premium rate Telelinks International SAL, Interactive Media Corporation
|
396
|
+
)
|
400
397
|
|
401
398
|
country '232', fixed(2) >> split(3, 3) # Sierra Leone http://www.wtng.info/wtng-232-sl.html
|
402
399
|
|
@@ -405,7 +402,7 @@ Phony.define do
|
|
405
402
|
# From http://www.itu.int/oth/T0202000052/en
|
406
403
|
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Ghana
|
407
404
|
#
|
408
|
-
country '233', trunk('0') | fixed(2) >> split(3,4)
|
405
|
+
country '233', trunk('0') | fixed(2) >> split(3, 4)
|
409
406
|
|
410
407
|
# Nigeria
|
411
408
|
# 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
|
@@ -415,46 +412,46 @@ Phony.define do
|
|
415
412
|
# https://www.ncc.gov.ng/technical-regulation/standards/numbering and
|
416
413
|
# https://www.itu.int/oth/T020200009C/en
|
417
414
|
country '234',
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
|
427
|
-
country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
|
428
|
-
country '237', none >> split(3,2,2,2) # Cameroon http://www.wtng.info/wtng-237-cm.html
|
429
|
-
country '238', none >> split(3,4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
|
430
|
-
country '239', fixed(1) >> split(3,3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
|
431
|
-
|
432
|
-
country '240', none >> split(3,3,3) # Equatorial Guinea
|
415
|
+
match(/^([7-9]0\d)\d+$/) >> split(3, 4) | # Mobile
|
416
|
+
match(/^(81\d)\d+$/) >> split(3, 4) | # Mobile
|
417
|
+
match(/^(91\d)\d+$/) >> split(3, 4) | # Mobile
|
418
|
+
one_of('1', '2') >> split(3, 3..4) | # Lagos, Ibadan
|
419
|
+
one_of('9') >> split(3, 4) | # Abuja
|
420
|
+
one_of((30..79).map(&:to_s)) >> split(3, 2..3) | # 2-digit NDC
|
421
|
+
one_of(%w[82 83 84 85 86 87 88 89]) >> split(3, 3) # 2-digit NDC
|
422
|
+
|
423
|
+
country '235', none >> split(4, 4) # Chad http://www.wtng.info/wtng-235-td.html
|
424
|
+
country '236', none >> split(4, 4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
|
425
|
+
country '237', none >> split(3, 2, 2, 2) # Cameroon http://www.wtng.info/wtng-237-cm.html
|
426
|
+
country '238', none >> split(3, 4) # Cape Verde http://www.wtng.info/wtng-238-cv.html
|
427
|
+
country '239', fixed(1) >> split(3, 3) # Sao Tome and Principe, http://www.wtng.info/wtng-239-st.html
|
428
|
+
|
429
|
+
country '240', none >> split(3, 3, 3) # Equatorial Guinea
|
433
430
|
country '241',
|
434
|
-
|
435
|
-
|
431
|
+
match(/^(\d)\d{6}$/) >> split(3, 3) | # Gabonese Republic http://www.wtng.info/wtng-241-ga.html
|
432
|
+
match(/^(\d\d)\d{6}$/) >> split(2, 2, 2) # 2019 update https://en.wikipedia.org/wiki/Telephone_numbers_in_Gabon
|
436
433
|
country '242', # Congo http://www.wtng.info/wtng-242-cg.html
|
437
|
-
|
438
|
-
|
439
|
-
country '243', fixed(2) >> split(3,4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
|
440
|
-
country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3,3) | # Angola
|
441
|
-
fixed(2) >> split(3,4)
|
442
|
-
country '245', none >> split(2,3,4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
|
443
|
-
country '246', none >> split(3,4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
|
434
|
+
trunk('', normalize: false) |
|
435
|
+
none >> split(4, 5)
|
436
|
+
country '243', fixed(2) >> split(3, 4) # Democratic Republic of the Congo http://www.wtng.info/wtng-243-cd.html
|
437
|
+
country '244', one_of('321', '348', '358', '363', '364', '485', '526', '535', '546', '612', '643', '652', '655', '722', '726', '728', '729', '777') >> split(3, 3) | # Angola
|
438
|
+
fixed(2) >> split(3, 4)
|
439
|
+
country '245', none >> split(2, 3, 4) # Guinea-Bissau http://www.wtng.info/wtng-245-gw.html
|
440
|
+
country '246', none >> split(3, 4) # Diego Garcia http://www.wtng.info/wtng-246-io.html
|
444
441
|
country '247', none >> split(4) # Ascension
|
445
442
|
|
446
|
-
country '248',
|
447
|
-
|
443
|
+
country '248', # Seychelles
|
444
|
+
fixed(1) >> split(2, 2, 2)
|
448
445
|
|
449
|
-
country '249', fixed(2) >> split(3,4) # Sudan
|
446
|
+
country '249', fixed(2) >> split(3, 4) # Sudan
|
450
447
|
|
451
448
|
# Rwanda
|
452
449
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Rwanda
|
453
450
|
country '250',
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
451
|
+
trunk('0') |
|
452
|
+
one_of('25') >> split(7) | # Geographic, fixed
|
453
|
+
match(/^(7[2389])/) >> split(7) | # Non-geographic, mobile
|
454
|
+
one_of('06') >> split(6) # Satellite
|
458
455
|
|
459
456
|
country '251', fixed(2) >> split(3, 4) # Ethiopia http://www.wtng.info/wtng-251-et.html
|
460
457
|
|
@@ -465,40 +462,40 @@ Phony.define do
|
|
465
462
|
# Kenya
|
466
463
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
|
467
464
|
country '254',
|
468
|
-
|
469
|
-
|
470
|
-
|
465
|
+
trunk('0') |
|
466
|
+
match(/^(7\d\d)/) >> split(6) | # mobile
|
467
|
+
fixed(2) >> split(7) # landline
|
471
468
|
|
472
469
|
# Tanzania.
|
473
470
|
#
|
474
471
|
country '255',
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
472
|
+
trunk('0') |
|
473
|
+
match(/^([89]\d\d)/) >> split(3, 3) | # Special/Premium.
|
474
|
+
one_of('112', '118') >> split(3, 3) | # Short Codes.
|
475
|
+
fixed(2) >> split(3, 4) # Geographic.
|
479
476
|
|
480
477
|
# Uganda.
|
481
478
|
#
|
482
479
|
country '256',
|
483
|
-
|
484
|
-
|
480
|
+
match(/^(46[45]|4[78]\d)/) >> split(6) | # Geo 1.
|
481
|
+
fixed(2) >> split(7) # Geo 2.
|
485
482
|
|
486
|
-
country '257', none >> split(4,4) # Burundi http://www.wtng.info/wtng-257-bi.html
|
483
|
+
country '257', none >> split(4, 4) # Burundi http://www.wtng.info/wtng-257-bi.html
|
487
484
|
|
488
485
|
# Mozambique, https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MZ
|
489
486
|
country '258',
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
487
|
+
one_of('600') >> split(3, 3) | # audiotext
|
488
|
+
one_of('610') >> split(3, 3) | # ISP
|
489
|
+
one_of('800') >> split(3, 3) | # freephone
|
490
|
+
one_of('801') >> split(3, 3) | # local rate
|
491
|
+
one_of('802') >> split(3, 3) | # national rate
|
492
|
+
one_of(%w[251 252 271 272 281 282 293]) >> split(3, 2) |
|
493
|
+
one_of(%w[21 23 24 26]) >> split(3, 3) |
|
494
|
+
one_of(%w[82 83 84 85 86 87]) >> split(4, 3) | # mobile
|
495
|
+
one_of('89') >> split(4, 3) | # satellite GMPCS
|
496
|
+
one_of('7') >> split(4, 4) | # universal access
|
497
|
+
one_of('9') >> split(4, 4) | # premium rate
|
498
|
+
fixed(2) >> split(3, 3)
|
502
499
|
|
503
500
|
country '259', todo # -
|
504
501
|
|
@@ -508,26 +505,26 @@ Phony.define do
|
|
508
505
|
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Zambia
|
509
506
|
|
510
507
|
country '260',
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
508
|
+
trunk('0') |
|
509
|
+
match(/^(75|76|77|94|95|96|97)/) >> split(3, 4) | # Mobile
|
510
|
+
match(/^(800)/) >> split(3, 3) | # Toll free
|
511
|
+
match(/^(21[1-8])/) >> split(6) # Fixed
|
515
512
|
|
516
513
|
# Madagascar
|
517
514
|
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Madagascar
|
518
515
|
# http://www.itu.int/oth/T020200007F/en
|
519
516
|
country '261',
|
520
|
-
match(/\A(20)\d+\z/) >> split(2,3,2) | # fix Telecom Malagasy (Telma)
|
521
|
-
match(/\A(32)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
|
522
|
-
match(/\A(33)\d+\z/) >> split(2,3,2) | # mobile Airtel Madagascar
|
523
|
-
match(/\A(34)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
|
524
|
-
match(/\A(37)\d+\z/) >> split(2,3,2) | # mobile Orange Madagascar
|
525
|
-
match(/\A(38)\d+\z/) >> split(2,3,2) | # mobile Telecom Malagasy (Telma)
|
526
|
-
match(/\A(39)\d+\z/) >> split(2,3,2) # mobile Blueline Madagascar
|
517
|
+
match(/\A(20)\d+\z/) >> split(2, 3, 2) | # fix Telecom Malagasy (Telma)
|
518
|
+
match(/\A(32)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
|
519
|
+
match(/\A(33)\d+\z/) >> split(2, 3, 2) | # mobile Airtel Madagascar
|
520
|
+
match(/\A(34)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
|
521
|
+
match(/\A(37)\d+\z/) >> split(2, 3, 2) | # mobile Orange Madagascar
|
522
|
+
match(/\A(38)\d+\z/) >> split(2, 3, 2) | # mobile Telecom Malagasy (Telma)
|
523
|
+
match(/\A(39)\d+\z/) >> split(2, 3, 2) # mobile Blueline Madagascar
|
527
524
|
|
528
525
|
country '262', # Reunion / Mayotte (new) http://www.wtng.info/wtng-262-fr.html
|
529
|
-
|
530
|
-
|
526
|
+
trunk('0') |
|
527
|
+
fixed(3) >> split(2, 2, 2)
|
531
528
|
|
532
529
|
# country '263' # Zimbabwe, see special file
|
533
530
|
|
@@ -537,10 +534,10 @@ Phony.define do
|
|
537
534
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MW
|
538
535
|
country '265',
|
539
536
|
none >> matched_split(
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
537
|
+
/\A(21|77)\d+\z/ => [3, 3, 3], # geographic, mobile
|
538
|
+
/\A(88|99)\d{7}\z/ => [3, 3, 3], # mobile
|
539
|
+
/\A18(00|11|18|20)\z/ => [4], # ISP
|
540
|
+
/\A\d+\z/ => [4, 3]
|
544
541
|
)
|
545
542
|
|
546
543
|
country '266', none >> split(4, 4) # Lesotho http://www.wtng.info/wtng-266-ls.html
|
@@ -549,39 +546,39 @@ Phony.define do
|
|
549
546
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
550
547
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=BW
|
551
548
|
country '267',
|
552
|
-
one_of(%w
|
553
|
-
one_of(%w
|
554
|
-
one_of('79') >> split(3,3) | # VoIP telephony
|
555
|
-
one_of('80') >> split(3,3) | # freephone
|
556
|
-
one_of('90') >> split(3,3) | # premium rate
|
557
|
-
one_of('7') >> split(4,3) | # moblie
|
558
|
-
one_of('8') >> split(4,3) | # shared cost
|
559
|
-
one_of('3') >> split(3,3) |
|
560
|
-
fixed(2) >> split(3,2)
|
549
|
+
one_of(%w[463 495 499 590]) >> split(4) |
|
550
|
+
one_of(%w[24 26 29 31 46 47 49 53 54 57 58 59 62 65 68]) >> split(3, 2) |
|
551
|
+
one_of('79') >> split(3, 3) | # VoIP telephony
|
552
|
+
one_of('80') >> split(3, 3) | # freephone
|
553
|
+
one_of('90') >> split(3, 3) | # premium rate
|
554
|
+
one_of('7') >> split(4, 3) | # moblie
|
555
|
+
one_of('8') >> split(4, 3) | # shared cost
|
556
|
+
one_of('3') >> split(3, 3) |
|
557
|
+
fixed(2) >> split(3, 2)
|
561
558
|
|
562
559
|
# Swaziland http://www.wtng.info/wtng-268-sz.html
|
563
560
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SZ
|
564
561
|
country '268',
|
565
562
|
none >> matched_split(
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
563
|
+
/\A08\d+\z/ => [4, 3], # freephone
|
564
|
+
/\A(2200|2300|2538|2548)\d+\z/ => [4, 4], # VoIP telephony Swaziland Posts and Telecommunications Corporation (SPTC)
|
565
|
+
/\A(2400|76)\d+\z/ => [4, 4], # mobile Swazi MTN Ltd
|
566
|
+
/\A(2550|2551)\d+\z/ => [4, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
|
567
|
+
/\A(550|551)\d+\z/ => [3, 4], # wireless geographic Swaziland Posts and Telecommunications Corporation (SPTC)
|
568
|
+
/\A(22|23|24|25)\d+\z/ => [4, 4], # geographic SPTC
|
569
|
+
/\A77\d+\z/ => [4, 4], # mobile Swaziland Posts and Telecommunications Corporation (SPTC) (CDMA)
|
570
|
+
/\A78\d+\z/ => [4, 4] # mobile Swazi MTN Ltd
|
574
571
|
)
|
575
572
|
|
576
573
|
# Comoros http://www.wtng.info/wtng-269-km.html
|
577
574
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KM
|
578
575
|
country '269',
|
579
576
|
none >> matched_split(
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
577
|
+
/\A800\d+\z/ => [4, 3, 3], # freephone Toll-free Global269
|
578
|
+
/\A(763|77)\d+\z/ => [4, 3], # geographic Comores Télécom
|
579
|
+
/\A(32|33|34)\d+\z/ => [4, 3], # mobile Comores Télécom (HURI)
|
580
|
+
/\A(390|391|900|910)\d+\z/ => [4, 3], # premium rate WIAIR SARL
|
581
|
+
/\A(76)\d+\z/ => [4, 3] # wireless geographic Comores Télécom
|
585
582
|
)
|
586
583
|
|
587
584
|
country '280', todo # -
|
@@ -611,20 +608,20 @@ Phony.define do
|
|
611
608
|
# Faroe Islands http://www.wtng.info/wtng-298-fo.html
|
612
609
|
country '298',
|
613
610
|
none >> matched_split(
|
614
|
-
|
615
|
-
|
611
|
+
/\A1\d+\z/ => [4], # universal access: Føroya Tele; ISP: Kall, Føroya Tele
|
612
|
+
/\A\d+\z/ => [3, 3]
|
616
613
|
)
|
617
614
|
|
618
615
|
# Greenland http://www.wtng.info/wtng-299-gl.html
|
619
616
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
620
617
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=GL
|
621
618
|
country '299',
|
622
|
-
one_of(%w
|
623
|
-
one_of(%w
|
624
|
-
one_of(%w
|
625
|
-
one_of(%w
|
626
|
-
match(/\A(50)\d{4}\z/) >> split(4) |
|
627
|
-
match(/\A(50)\d{6}\z/) >> split(3,3) |
|
619
|
+
one_of(%w[199 691]) >> split(3) | # satellite; geographic: Ivittuut
|
620
|
+
one_of(%w[31 32 33 34 35 36 61 64 66 68 81 84 85 86 87 89 91 92 94 95 96 97 98 99]) >> split(4) | # geographic
|
621
|
+
one_of(%w[22 23 24 25 26 27 28 29 42 43 44 45 46 47 48 49 52 53 54 55 56 57 58 59]) >> split(4) | # mobile: Tele Greenland A/S
|
622
|
+
one_of(%w[38 39]) >> split(4) | # VoIP telephony
|
623
|
+
match(/\A(50)\d{4}\z/) >> split(4) | # | voicemail (mobile) Tele Greenland A/S
|
624
|
+
match(/\A(50)\d{6}\z/) >> split(3, 3) | # |
|
628
625
|
fixed(2) >> split(4)
|
629
626
|
|
630
627
|
# Gibraltar
|
@@ -636,36 +633,36 @@ Phony.define do
|
|
636
633
|
# Portugal.
|
637
634
|
#
|
638
635
|
country '351',
|
639
|
-
match(/^([78]\d\d)\d+$/) >> split(3,3) | # Service.
|
640
|
-
match(/^(9\d)\d+$/) >> split(3,4) | # Mobile.
|
641
|
-
one_of('21', '22') >> split(3,4) | # Lisboa & Porto
|
642
|
-
fixed(3) >> split(3,3) # 3-digit NDCs
|
636
|
+
match(/^([78]\d\d)\d+$/) >> split(3, 3) | # Service.
|
637
|
+
match(/^(9\d)\d+$/) >> split(3, 4) | # Mobile.
|
638
|
+
one_of('21', '22') >> split(3, 4) | # Lisboa & Porto
|
639
|
+
fixed(3) >> split(3, 3) # 3-digit NDCs
|
643
640
|
|
644
641
|
# Luxembourg
|
645
642
|
#
|
646
643
|
country '352',
|
647
|
-
match(/^(2[467]\d{2})\d{4}$/) >> split(2,2) | # 4-digit NDC
|
648
|
-
match(/^(6\d[18])\d+$/) >> split(3,3) | # mobile
|
649
|
-
match(/^(60\d{2})\d{8}$/) >> split(2,2,2,2) | # mobile machine to machine
|
650
|
-
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
651
|
-
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2,2) | # 2-digit NDC Regular 6 digits number
|
652
|
-
match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2,2,1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
|
653
|
-
match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2,2,2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
|
654
|
-
match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2,2,3) | # 2-digit NDC Regular 6 digits with 4 digits extension
|
655
|
-
match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2,2,4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
|
656
|
-
match(/^(\d{2})\d{3}$/) >> split(2,2,1) # fallback for 5 digit number
|
644
|
+
match(/^(2[467]\d{2})\d{4}$/) >> split(2, 2) | # 4-digit NDC
|
645
|
+
match(/^(6\d[18])\d+$/) >> split(3, 3) | # mobile
|
646
|
+
match(/^(60\d{2})\d{8}$/) >> split(2, 2, 2, 2) | # mobile machine to machine
|
647
|
+
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
|
648
|
+
match(/^((2[^467]|[2-9]\d))\d{4}$/) >> split(2, 2) | # 2-digit NDC Regular 6 digits number
|
649
|
+
match(/^((2[^467]|[2-9]\d))\d{5}$/) >> split(2, 2, 1) | # 2-digit NDC Regular 6 digits number w/ 1 digit extension
|
650
|
+
match(/^((2[^467]|[2-9]\d))\d{6}$/) >> split(2, 2, 2) | # 2-digit NDC Regular 8 digits number or 6 digits with 2 digits extension
|
651
|
+
match(/^((2[^467]|[2-9]\d))\d{7}$/) >> split(2, 2, 3) | # 2-digit NDC Regular 6 digits with 4 digits extension
|
652
|
+
match(/^((2[^467]|[2-9]\d))\d{8}$/) >> split(2, 2, 4) | # 2-digit NDC Regular 6 digits number with 4 digits extension
|
653
|
+
match(/^(\d{2})\d{3}$/) >> split(2, 2, 1) # fallback for 5 digit number
|
657
654
|
|
658
655
|
# country '353' # Republic of Ireland, see special file.
|
659
656
|
|
660
|
-
country '354', none >> split(3,4) # Iceland
|
657
|
+
country '354', none >> split(3, 4) # Iceland
|
661
658
|
|
662
659
|
# Albania
|
663
660
|
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Albania
|
664
661
|
country '355', trunk('0') |
|
665
|
-
one_of('4') >> split(3,4) | # Tirana
|
666
|
-
match(/\A(6[6-9])\d*\z/) >> split(3,4) | # mobile
|
667
|
-
match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3,3) |
|
668
|
-
fixed(3) >> split(3,2)
|
662
|
+
one_of('4') >> split(3, 4) | # Tirana
|
663
|
+
match(/\A(6[6-9])\d*\z/) >> split(3, 4) | # mobile
|
664
|
+
match(/\A(2[24]|3[2-5]|47|5[2-5]|6[6-9]|8[2-5])\d*\z/) >> split(3, 3) |
|
665
|
+
fixed(3) >> split(3, 2)
|
669
666
|
|
670
667
|
# Malta
|
671
668
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Malta
|
@@ -677,8 +674,8 @@ Phony.define do
|
|
677
674
|
# Cyprus
|
678
675
|
# http://www.cytaglobal.com/cytaglobal/userfiles/NewNumberingPlan.pdf
|
679
676
|
country '357', trunk('0') |
|
680
|
-
one_of('121','122','123') >> split(2,6) | # voicemail
|
681
|
-
fixed(2) >> split(6)
|
677
|
+
one_of('121', '122', '123') >> split(2, 6) | # voicemail
|
678
|
+
fixed(2) >> split(6) # fixed & mobile
|
682
679
|
|
683
680
|
# Finland
|
684
681
|
#
|
@@ -689,9 +686,9 @@ Phony.define do
|
|
689
686
|
match(/^(73[0-4]\d\d)\d{5}$/) >> split(5) | # national subscriber numbers, 5-digit NDC (starting with 073)
|
690
687
|
match(/^(202[023]|209[8-9]|600[0126-9]|700[0126]|7099|800\d)\d{4,5}$/) >> split(2, 2..3) | # national service numbers, 4-digit NDCs
|
691
688
|
match(/^(606\d|70[78]\d)\d{6}$/) >> split(3, 3) | # national service numbers, 4-digit NDCs (starting with 0606/0707/0708)
|
692
|
-
match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) |
|
689
|
+
match(/^(202[14-9]|209[0-7])\d{4,6}$/) >> split(3, 1..3) | # national subscriber numbers, 4-digit NDCs
|
693
690
|
match(/^(45[45789]\d)\d{2,6}$/) >> split(2, 0..4) | # mobile numbers, 4-digit NDCs
|
694
|
-
match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) |
|
691
|
+
match(/^([123]00|602)\d{5,6}$/) >> split(3, 2..3) | # national service numbers, 3-digit NDCs
|
695
692
|
match(/^(10[1-9]|20[13-8]|30[1-9]|73[5-9])\d{5,7}$/) >> split(3, 2..4) | # national subscriber numbers, 3-digit NDCs
|
696
693
|
match(/^(71\d)\d{6}$/) >> split(3, 3) | # national subscriber numbers, 3-digit NDCs (starting with 071)
|
697
694
|
match(/^(73[5-9])\d{7}$/) >> split(3, 4) | # national subscriber numbers, 3-digit NDCs (starting with 073)
|
@@ -699,8 +696,8 @@ Phony.define do
|
|
699
696
|
match(/^(49\d)\d{8}$/) >> split(3, 3, 2) | # mobile numbers, 3-digit NDCs (starting with 049)
|
700
697
|
match(/^([235]9)\d{6,8}$/) >> split(3, 3, 0..2) | # national subscriber numbers, 2-digit NDCs
|
701
698
|
match(/^(4[0124678]|50)\d{4,8}$/) >> split(3, 1..5) | # mobile numbers, 2-digit NDCs
|
702
|
-
one_of('2','3','5','6','8','9') >> split(3,1..5)
|
703
|
-
fixed(2)
|
699
|
+
one_of('2', '3', '5', '6', '8', '9') >> split(3, 1..5) | # Short NDCs
|
700
|
+
fixed(2) >> split(3, 0..4) # 2-digit NDCs
|
704
701
|
|
705
702
|
# Bulgaria
|
706
703
|
#
|
@@ -708,34 +705,30 @@ Phony.define do
|
|
708
705
|
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Bulgaria
|
709
706
|
country '359',
|
710
707
|
trunk('0') |
|
711
|
-
match(/^(2)\d{6}$/) >> split(3,3) | # Landline Sofia (optional last digit)
|
712
|
-
match(/^(2)\d{7}$/) >> split(3,4) | # Landline Sofia (optional last digit)
|
708
|
+
match(/^(2)\d{6}$/) >> split(3, 3) | # Landline Sofia (optional last digit)
|
709
|
+
match(/^(2)\d{7}$/) >> split(3, 4) | # Landline Sofia (optional last digit)
|
713
710
|
match(/^(30|31|33|36|37|39|41|43\d|45|47|51|53|55|57|59)\d{5}$/) >> split(5) |
|
714
|
-
match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2,4) |
|
715
|
-
|
711
|
+
match(/^(30|31|32|33|34|35|36|37|38|39|41|42|44|45|46|47|51|52|53|54|55|56|57|58|59)\d{6}$/) >> split(2, 4) |
|
716
712
|
match(/^(60|61|63|65|66|69)\d{5}$/) >> split(5) |
|
717
713
|
match(/^(60|61|62|63|64|65|66|68|69)\d{6}$/) >> split(6) |
|
718
|
-
|
719
714
|
match(/^(700|701|703|704|705|706|707|708|709)\d{5}$/) >> split(5) |
|
720
715
|
match(/^(701|702|703|704|705|706|707|708|709)\d{4}$/) >> split(4) |
|
721
|
-
|
722
716
|
match(/^(71|72|74|75|77)\d{5}$/) >> split(5) |
|
723
717
|
match(/^(71|72|73|74|75|76|77|78|79)\d{6}$/) >> split(6) |
|
724
|
-
|
725
718
|
match(/^(80\d|81|91|93|95|97)\d{5}$/) >> split(5) |
|
726
719
|
match(/^(81|82|84|86)\d{6}$/) >> split(6) |
|
727
|
-
match(/^(87|88|89)\d{7}$/) >> split(4,3) |
|
720
|
+
match(/^(87|88|89)\d{7}$/) >> split(4, 3) |
|
728
721
|
match(/^(90|91|92|93|94|95|96|97|98\d|99\d)\d{6}$/) >> split(6)
|
729
722
|
|
730
723
|
# Lithuania
|
731
724
|
#
|
732
725
|
country '370',
|
733
726
|
trunk('8', normalize: false) |
|
734
|
-
one_of('700', '800') >> split(2,3) | # Service
|
735
|
-
match(/^(6\d\d)\d+$/) >> split(2,3) | # Mobile
|
736
|
-
one_of('5') >> split(3,2,2) | # Vilnius
|
737
|
-
one_of('37','41')
|
738
|
-
fixed(3)
|
727
|
+
one_of('700', '800') >> split(2, 3) | # Service
|
728
|
+
match(/^(6\d\d)\d+$/) >> split(2, 3) | # Mobile
|
729
|
+
one_of('5') >> split(3, 2, 2) | # Vilnius
|
730
|
+
one_of('37', '41') >> split(2, 2, 2) | # Kaunas, Šiauliai
|
731
|
+
fixed(3) >> split(1, 2, 2) # 3-digit NDCs.
|
739
732
|
|
740
733
|
# country '371' # Latvia, see special file
|
741
734
|
|
@@ -744,7 +737,7 @@ Phony.define do
|
|
744
737
|
country '372',
|
745
738
|
match(/^(5\d\d\d)\d+$/) >> split(3..4) | # Mobile
|
746
739
|
match(/^((?:70|8[12])\d\d)\d+$/) >> split(4) | # Mobile
|
747
|
-
fixed(3) >> split(4)
|
740
|
+
fixed(3) >> split(4) # 3-digit NDCs
|
748
741
|
|
749
742
|
# country '373' # Moldova, see special file
|
750
743
|
|
@@ -759,15 +752,15 @@ Phony.define do
|
|
759
752
|
# Monaco
|
760
753
|
#
|
761
754
|
country '377',
|
762
|
-
one_of('6') >> split(2,2,2,2) | # mobile
|
763
|
-
fixed(2) >> split(2,2,2)
|
755
|
+
one_of('6') >> split(2, 2, 2, 2) | # mobile
|
756
|
+
fixed(2) >> split(2, 2, 2)
|
764
757
|
|
765
758
|
# San Marino
|
766
759
|
country '378',
|
767
|
-
trunk('', :
|
760
|
+
trunk('', normalize: false) |
|
768
761
|
none >> matched_split(
|
769
|
-
|
770
|
-
|
762
|
+
/\A\d{6}\z/ => [3, 3],
|
763
|
+
/\A\d+\z/ => [3, 3, 4]
|
771
764
|
)
|
772
765
|
|
773
766
|
country '379', todo # Vatican City State
|
@@ -783,7 +776,7 @@ Phony.define do
|
|
783
776
|
# Note: https://en.wikipedia.org/wiki/Telephone_numbers_in_Kosovo
|
784
777
|
country '383',
|
785
778
|
trunk('0') |
|
786
|
-
fixed(2) >> split(3,3)
|
779
|
+
fixed(2) >> split(3, 3)
|
787
780
|
|
788
781
|
country '384', todo # -
|
789
782
|
|
@@ -794,19 +787,19 @@ Phony.define do
|
|
794
787
|
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Slovenia
|
795
788
|
country '386',
|
796
789
|
trunk('0') |
|
797
|
-
one_of('30','31','40','41','51','64','65','66','67','68','69','70','71')
|
798
|
-
one_of('1','2','3','4','5','7')
|
799
|
-
fixed(3)
|
790
|
+
one_of('30', '31', '40', '41', '51', '64', '65', '66', '67', '68', '69', '70', '71') >> split(3, 3) | # Mobile
|
791
|
+
one_of('1', '2', '3', '4', '5', '7') >> split(3, 4) | # Ljubljana, Maribor, Celje, Kranj, Nova Gorica, Novo mesto
|
792
|
+
fixed(3) >> split(2, 3) # catchall
|
800
793
|
|
801
|
-
country '387', trunk('0') | fixed(2) >> split(3,3) # Bosnia and Herzegovina
|
802
|
-
country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
|
794
|
+
country '387', trunk('0') | fixed(2) >> split(3, 3) # Bosnia and Herzegovina
|
795
|
+
country '388', trunk('0') | fixed(2) >> split(3, 2, 2) # Group of countries, shared code
|
803
796
|
|
804
797
|
# The Former Yugoslav Republic of Macedonia
|
805
798
|
country '389',
|
806
|
-
|
807
|
-
|
799
|
+
trunk('0') |
|
800
|
+
one_of('2', '3', '4', '5', '6', '7', '8') >> split(3, 4)
|
808
801
|
|
809
|
-
country '420', fixed(3) >> split(3,3) # Czech Republic
|
802
|
+
country '420', fixed(3) >> split(3, 3) # Czech Republic
|
810
803
|
|
811
804
|
# Slovak Republic.
|
812
805
|
#
|
@@ -817,7 +810,7 @@ Phony.define do
|
|
817
810
|
fixed(2) >> split(7) # 2-digit NDCs
|
818
811
|
|
819
812
|
country '422', todo # Spare code
|
820
|
-
country '423', none >> split(3,2,2) # Liechtenstein (Principality of)
|
813
|
+
country '423', none >> split(3, 2, 2) # Liechtenstein (Principality of)
|
821
814
|
country '424', todo # -
|
822
815
|
country '425', todo # -
|
823
816
|
country '426', todo # -
|
@@ -825,74 +818,74 @@ Phony.define do
|
|
825
818
|
country '428', todo # -
|
826
819
|
country '429', todo # -
|
827
820
|
|
828
|
-
country '500', none >> split(2,3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
|
821
|
+
country '500', none >> split(2, 3) # Falkland Islands (Malvinas) http://www.wtng.info/wtng-500-fk.html
|
829
822
|
country '501', fixed(3) >> split(4) # Belize
|
830
823
|
|
831
824
|
# Guatemala (Republic of) http://www.wtng.info/wtng-502-gt.html
|
832
825
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
833
826
|
#
|
834
827
|
country '502',
|
835
|
-
one_of('19') >> split(3,3,3) | # premium rate
|
836
|
-
fixed(1) >> split(3,4)
|
828
|
+
one_of('19') >> split(3, 3, 3) | # premium rate
|
829
|
+
fixed(1) >> split(3, 4)
|
837
830
|
|
838
|
-
|
831
|
+
# El Salvador (Republic of)
|
839
832
|
country '503', fixed(4) >> split(4)
|
840
833
|
|
841
834
|
# Honduras (Republic of) http://www.wtng.info/wtng-504-hn.html
|
842
835
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
843
836
|
country '504',
|
844
|
-
one_of('800') >> split(3,4) | # freephone
|
845
|
-
fixed(2) >> split(3,3) # geographic, mobile
|
837
|
+
one_of('800') >> split(3, 4) | # freephone
|
838
|
+
fixed(2) >> split(3, 3) # geographic, mobile
|
846
839
|
|
847
840
|
# Nicaragua http://www.wtng.info/wtng-505-ni.html
|
848
841
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
849
842
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=NI
|
850
843
|
country '505',
|
851
|
-
one_of('9') >> split(3,3) | # premium rate
|
852
|
-
fixed(2) >> split(3,3) # geographic, mobile
|
844
|
+
one_of('9') >> split(3, 3) | # premium rate
|
845
|
+
fixed(2) >> split(3, 3) # geographic, mobile
|
853
846
|
|
854
847
|
# Costa Rica http://www.wtng.info/wtng-506-cr.html
|
855
848
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
856
849
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=CR
|
857
850
|
country '506',
|
858
|
-
one_of('800') >> split(3,4) | # freephone
|
859
|
-
one_of(%w
|
860
|
-
fixed(1) >> split(3,4) # geographic
|
851
|
+
one_of('800') >> split(3, 4) | # freephone
|
852
|
+
one_of(%w[905 909]) >> split(3, 4) | # premium rate
|
853
|
+
fixed(1) >> split(3, 4) # geographic
|
861
854
|
|
862
855
|
# Panama (Republic of) http://www.wtng.info/wtng-507-pa.html
|
863
856
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
864
857
|
country '507',
|
865
|
-
one_of(%w
|
866
|
-
one_of('6') >> split(3,4) | # mobile
|
867
|
-
fixed(1) >> split(3,3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
|
858
|
+
one_of(%w[800 809]) >> split(4) | # freephone
|
859
|
+
one_of('6') >> split(3, 4) | # mobile
|
860
|
+
fixed(1) >> split(3, 3) # geographic, VoIP telephony, mobile, premium rate, shared cost, pager
|
868
861
|
|
869
862
|
country '508', none >> split(3, 3) # Saint Pierre and Miquelon (Collectivité territoriale de la République française) http://www.wtng.info/wtng-508-pm.html
|
870
863
|
|
871
864
|
country '509', # Haiti (Republic of)
|
872
|
-
|
865
|
+
fixed(2) >> split(2, 4)
|
873
866
|
|
874
867
|
# Guadeloupe (French Department of) http://www.wtng.info/wtng-590-fr.html
|
875
868
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
876
869
|
country '590', trunk('0') |
|
877
|
-
|
870
|
+
fixed(3) >> split(2, 2, 2)
|
878
871
|
|
879
872
|
country '591', # Bolivia (Republic of) http://www.itu.int/oth/T020200001A/en
|
880
|
-
|
873
|
+
fixed(1) >> split(3, 4)
|
881
874
|
|
882
875
|
# Guyana http://www.wtng.info/wtng-592-gy.html
|
883
876
|
# https://www.numberingplans.com
|
884
877
|
country '592',
|
885
878
|
one_of('10') >> split(2) | # audiotext
|
886
|
-
one_of(%w
|
879
|
+
one_of(%w[11 16 17 18 19]) >> split(3) | # audiotext
|
887
880
|
fixed(3) >> split(4) # geographic, audiotext
|
888
881
|
|
889
882
|
# Ecuador http://www.wtng.info/wtng-593-ec.html
|
890
883
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=EC¤t_page=1
|
891
884
|
# https://en.wikipedia.org/wiki/Telephone_numbers_in_Ecuador
|
892
885
|
country '593',
|
893
|
-
|
894
|
-
|
895
|
-
|
886
|
+
one_of('9') >> split(4, 4) |
|
887
|
+
match(/\A([\d]{2})\d{7}\z/) >> split(3, 4) |
|
888
|
+
fixed(1) >> split(3, 4)
|
896
889
|
|
897
890
|
country '594', fixed(3) >> split(3, 3) # French Guiana (French Department of) http://www.wtng.info/wtng-594-fr.html
|
898
891
|
|
@@ -900,25 +893,25 @@ Phony.define do
|
|
900
893
|
|
901
894
|
# Martinique (French Department of) http://www.wtng.info/wtng-596-mq.html, https://www.numberingplans.com
|
902
895
|
country '596', trunk('0') |
|
903
|
-
|
896
|
+
fixed(3) >> split(2, 2, 2)
|
904
897
|
|
905
898
|
# Suriname (Republic of) http://www.wtng.info/wtng-597-sr.html, https://www.numberingplans.com
|
906
899
|
country '597',
|
907
900
|
none >> matched_split(
|
908
|
-
|
909
|
-
|
901
|
+
/\A[6789]\d+\z/ => [3, 4], # freephone, mobile
|
902
|
+
/\A[2345]\d+\z/ => [3, 3] # geographic, VoIP telephony
|
910
903
|
)
|
911
904
|
|
912
905
|
# country '598' # Uruguay (Eastern Republic of), see special file
|
913
906
|
|
914
|
-
country '599', one_of('9') >> split(3,4) | # Netherlands Antilles (Curacao)
|
915
|
-
fixed(3) >> split(4)
|
907
|
+
country '599', one_of('9') >> split(3, 4) | # Netherlands Antilles (Curacao)
|
908
|
+
fixed(3) >> split(4) # (other)
|
916
909
|
|
917
910
|
# Democratic Republic of Timor-Leste http://www.wtng.info/wtng-670-tl.html
|
918
911
|
country '670',
|
919
912
|
none >> matched_split(
|
920
|
-
|
921
|
-
|
913
|
+
/\A7\d+\z/ => [4, 4], # mobile
|
914
|
+
/\A\d+\z/ => [3, 4]
|
922
915
|
)
|
923
916
|
|
924
917
|
country '671', todo # Spare code
|
@@ -926,7 +919,7 @@ Phony.define do
|
|
926
919
|
# Australian External Territories https://en.wikipedia.org/wiki/Telephone_numbers_in_Norfolk_Island
|
927
920
|
# Norfolk Island
|
928
921
|
country '672',
|
929
|
-
fixed(1) >> split(2,3) |
|
922
|
+
fixed(1) >> split(2, 3) |
|
930
923
|
match(/^(2\d+)$/) >> split(3) | # Fixed
|
931
924
|
match(/^(5\d+)$/) >> split(3) # Mobile
|
932
925
|
|
@@ -936,56 +929,56 @@ Phony.define do
|
|
936
929
|
# Papua New Guinea
|
937
930
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=PG
|
938
931
|
country '675',
|
939
|
-
one_of(%w
|
932
|
+
one_of(%w[180 181 182 183]) >> split(4) | # freephone
|
940
933
|
one_of('170') >> split(2) | # mobile
|
941
934
|
one_of('189') >> split(1) | # mobile
|
942
|
-
one_of('184') >> split(4,4) | # ISP, PSDN X.28
|
943
|
-
one_of(%w
|
944
|
-
one_of(%w
|
945
|
-
one_of(%w
|
946
|
-
one_of('115') >> split(4,4) | # voicemail (mobile)
|
947
|
-
one_of(%w
|
948
|
-
one_of(%w
|
949
|
-
one_of(%w
|
950
|
-
one_of(%w
|
951
|
-
one_of(%w
|
952
|
-
one_of(%w
|
953
|
-
one_of(%w
|
954
|
-
one_of(%w
|
955
|
-
one_of(%w
|
956
|
-
one_of(%w
|
957
|
-
one_of(%w
|
958
|
-
one_of(%w
|
959
|
-
one_of(%w
|
960
|
-
|
935
|
+
one_of('184') >> split(4, 4) | # ISP, PSDN X.28
|
936
|
+
one_of(%w[185 270 271]) >> split(4) | # pager
|
937
|
+
one_of(%w[275 276]) >> split(4) | # satellite
|
938
|
+
one_of(%w[278 279]) >> split(2) | # satellite
|
939
|
+
one_of('115') >> split(4, 4) | # voicemail (mobile)
|
940
|
+
one_of(%w[28 29]) >> split(3, 2) | # pager
|
941
|
+
one_of(%w[16 18]) >> split(3, 2) | # ISP
|
942
|
+
one_of(%w[70 71 72 74 75 76 78 79]) >> split(3, 3) | # mobile
|
943
|
+
one_of(%w[731 732 733 734 735 736 738 739]) >> split(2, 3) | # mobile
|
944
|
+
one_of(%w[770]) >> split(2, 3) | # wireless geographic; Port Moresby, National Capital District
|
945
|
+
one_of(%w[771]) >> split(2, 3) | # wireless geographic; Momase region
|
946
|
+
one_of(%w[772]) >> split(2, 3) | # wireless geographic; Highlands region
|
947
|
+
one_of(%w[7730]) >> split(1, 3) | # wireless geographic; Southern region
|
948
|
+
one_of(%w[774]) >> split(2, 3) | # wireless geographic; Islands region
|
949
|
+
one_of(%w[775]) >> split(2, 3) | # mobile
|
950
|
+
one_of(%w[80 81 82 83]) >> split(3, 3) | # freephone
|
951
|
+
one_of(%w[90 91 92 93]) >> split(3, 3) | # geographic, ISDN
|
952
|
+
one_of(%w[3 4 5 6 7 8 9]) >> split(3, 3) # geographic
|
953
|
+
fixed(1) >> split(3, 3) # geographic
|
961
954
|
|
962
955
|
# Tonga (Kingdom of)
|
963
956
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=TO
|
964
957
|
country '676',
|
965
958
|
none >> matched_split(
|
966
|
-
|
967
|
-
|
959
|
+
/\A(77|78|87|88|89)\d+\z/ => [2, 3, 2],
|
960
|
+
/\A\d+\z/ => [2, 3]
|
968
961
|
)
|
969
962
|
|
970
963
|
# Solomon Islands http://www.wtng.info/wtng-677-sb.html, https://www.numberingplans.com
|
971
964
|
country '677',
|
972
965
|
none >> matched_split(
|
973
|
-
|
974
|
-
|
966
|
+
/\A7\d+\z/ => [4, 3], # mobile
|
967
|
+
/\A\d+\z/ => [2, 3] # freephone, geographic, mobile, VoIP telephony
|
975
968
|
)
|
976
969
|
|
977
970
|
# Vanuatu (Republic of) http://www.wtng.info/wtng-678-vu.html, https://www.numberingplans.com
|
978
971
|
country '678',
|
979
972
|
none >> matched_split(
|
980
|
-
|
981
|
-
|
973
|
+
/\A[579]\d+\z/ => [4, 3], # mobile
|
974
|
+
/\A\d+\z/ => [2, 3] # geographic, VoIP telephony
|
982
975
|
)
|
983
976
|
|
984
977
|
country '679', none >> split(3, 4) # Fiji (Republic of) http://www.wtng.info/wtng-679-fj.html
|
985
978
|
|
986
979
|
country '680', none >> split(3, 4) # Palau (Republic of) http://www.wtng.info/wtng-680-pw.html
|
987
980
|
country '681', todo # Wallis and Futuna (Territoire français d'outre-mer)
|
988
|
-
country '682', none >> split(2,3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
|
981
|
+
country '682', none >> split(2, 3) # Cook Islands http://www.wtng.info/wtng-682-ck.html
|
989
982
|
country '683', none >> split(4) # Niue http://www.wtng.info/wtng-683-nu.html
|
990
983
|
country '684', todo # -
|
991
984
|
|
@@ -993,18 +986,18 @@ Phony.define do
|
|
993
986
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=WS
|
994
987
|
country '685',
|
995
988
|
none >> matched_split(
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
989
|
+
/\A800\d+\z/ => [3, 3], # freephone
|
990
|
+
/\A830\d+\z/ => [3, 3], # shared cost
|
991
|
+
/\A60\d+\z/ => [3, 3], # wireless geographic
|
992
|
+
/\A(71|72|75|76|77)\d+\z/ => [3, 4], # mobile
|
993
|
+
/\A84\d+\z/ => [3, 4], # wireless geographic
|
994
|
+
/\A\d+\z/ => [2, 3] # geographic
|
1002
995
|
)
|
1003
996
|
|
1004
997
|
country '686', none >> split(8) # Kiribati (Republic of) https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KI
|
1005
|
-
country '687', none >> split(3,3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
|
998
|
+
country '687', none >> split(3, 3) # New Caledonia (Territoire français d'outre-mer) http://www.wtng.info/wtng-687-nc.html
|
1006
999
|
country '688', none >> split(5) # Tuvalu http://www.wtng.info/wtng-688-tv.html
|
1007
|
-
country '689', none >> split(2,2,2,2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
|
1000
|
+
country '689', none >> split(2, 2, 2, 2) # French Polynesia (Territoire français d'outre-mer) http://www.wtng.info/wtng-689-pf.html
|
1008
1001
|
|
1009
1002
|
country '690', fixed(1) >> split(3) # Tokelau http://www.wtng.info/wtng-690-tk.html
|
1010
1003
|
country '691', none >> split(3, 4) # Micronesia (Federated States of) http://www.wtng.info/wtng-691-fm.html
|
@@ -1045,14 +1038,15 @@ Phony.define do
|
|
1045
1038
|
# Democratic People's Republic of Korea
|
1046
1039
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=KP
|
1047
1040
|
country '850',
|
1048
|
-
one_of(%w
|
1041
|
+
one_of(%w[191 192 193]) >> split(3, 4) | # mobile
|
1049
1042
|
one_of('2') >> matched_split(
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1043
|
+
/\A\d{5}\z/ => [3, 2],
|
1044
|
+
/\A\d{7}\z/ => [3, 4],
|
1045
|
+
# /\A(880|881|882|883|885)\d+\z/ => [4,4,4,4],
|
1046
|
+
/\A\d+\z/ => [3, 3, 3]
|
1047
|
+
) |
|
1048
|
+
one_of(%w[31 39 41 45 53 57 61 67 73 79]) >> split(3, 3) |
|
1049
|
+
fixed(2) >> split(3, 3)
|
1056
1050
|
|
1057
1051
|
country '851', todo # Spare code
|
1058
1052
|
|
@@ -1060,22 +1054,22 @@ Phony.define do
|
|
1060
1054
|
|
1061
1055
|
country '852',
|
1062
1056
|
match(/^(800)\d+$/) >> split(2, 4) |
|
1063
|
-
none >> split(4,4)
|
1057
|
+
none >> split(4, 4)
|
1064
1058
|
|
1065
1059
|
# Macao, China
|
1066
1060
|
country '853', # Macao, China
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1061
|
+
match(/^(28)\d+$/) >> split(2, 4) | # Landline.
|
1062
|
+
match(/^(8)\d+$/) >> split(3, 4) | # Landline.
|
1063
|
+
match(/^(6)\d+$/) >> split(3, 4) # Mobile.
|
1070
1064
|
|
1071
1065
|
country '854', todo # Spare code
|
1072
1066
|
|
1073
1067
|
# Lao People's Democratic Republic http://www.wtng.info/wtng-856-la.html, https://www.numberingplans.com
|
1074
1068
|
country '856',
|
1075
1069
|
trunk('0') |
|
1076
|
-
one_of('30') >> split(3,4) | # geographic
|
1077
|
-
one_of('20') >> split(4,4) | # mobile
|
1078
|
-
fixed(2) >> split(3,3) # geographic
|
1070
|
+
one_of('30') >> split(3, 4) | # geographic
|
1071
|
+
one_of('20') >> split(4, 4) | # mobile
|
1072
|
+
fixed(2) >> split(3, 3) # geographic
|
1079
1073
|
|
1080
1074
|
country '857', todo # Spare code
|
1081
1075
|
country '858', todo # Spare code
|
@@ -1097,7 +1091,7 @@ Phony.define do
|
|
1097
1091
|
|
1098
1092
|
# Global Mobile Satellite System (i.e. Iridium, Globalstar, etc)
|
1099
1093
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QM
|
1100
|
-
country '881', fixed(1) >> split(3,5)
|
1094
|
+
country '881', fixed(1) >> split(3, 5)
|
1101
1095
|
|
1102
1096
|
country '882', todo # International Networks, shared code
|
1103
1097
|
country '883', todo # -
|
@@ -1123,58 +1117,58 @@ Phony.define do
|
|
1123
1117
|
|
1124
1118
|
# Maldives (Republic of) http://www.wtng.info/wtng-960-mv.html, https://www.numberingplans.com
|
1125
1119
|
country '960',
|
1126
|
-
one_of(%w
|
1120
|
+
one_of(%w[800 900]) >> split(3, 4) | # freephone, premium rate
|
1127
1121
|
fixed(3) >> split(4) # geographic, mobile
|
1128
1122
|
|
1129
1123
|
# Lebanon
|
1130
1124
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
1131
1125
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=LB
|
1132
1126
|
country '961',
|
1133
|
-
one_of(%w
|
1134
|
-
one_of(%w
|
1135
|
-
one_of(%w
|
1136
|
-
one_of(%w
|
1137
|
-
one_of('3') >> split(3,3) | # mobile
|
1138
|
-
fixed(1) >> split(3,3)
|
1127
|
+
one_of(%w[70 71 76 78 79]) >> split(3, 3) | # mobile
|
1128
|
+
one_of(%w[90 91]) >> split(3, 3) | # premium rate
|
1129
|
+
one_of(%w[80 81]) >> split(3, 3) | # shared cost
|
1130
|
+
one_of(%w[1 4 5 6 7 8 9]) >> split(3, 3) | # geographic
|
1131
|
+
one_of('3') >> split(3, 3) | # mobile
|
1132
|
+
fixed(1) >> split(3, 3)
|
1139
1133
|
|
1140
1134
|
# Jordan (Hashemite Kingdom of)
|
1141
1135
|
country '962',
|
1142
|
-
one_of(%w
|
1143
|
-
one_of(%w
|
1144
|
-
one_of('810') >> split(3,2) | # ISP
|
1145
|
-
one_of('900') >> split(3,2) | # premium rate
|
1146
|
-
one_of('70') >> split(3,3) | # universal access
|
1147
|
-
one_of(%w
|
1148
|
-
one_of(%w
|
1149
|
-
one_of('7') >> split(4,4) | # mobile, pager
|
1150
|
-
fixed(1) >> split(3,4)
|
1136
|
+
one_of(%w[6250 8790]) >> split(4) | # wireless geographic
|
1137
|
+
one_of(%w[800 801 802 803 804 805 806 807 808 809]) >> split(3, 2) | # freephone
|
1138
|
+
one_of('810') >> split(3, 2) | # ISP
|
1139
|
+
one_of('900') >> split(3, 2) | # premium rate
|
1140
|
+
one_of('70') >> split(3, 3) | # universal access
|
1141
|
+
one_of(%w[85 87]) >> split(3, 3) | # shared cost
|
1142
|
+
one_of(%w[2 3 5 6]) >> split(3, 4) | # geographic
|
1143
|
+
one_of('7') >> split(4, 4) | # mobile, pager
|
1144
|
+
fixed(1) >> split(3, 4)
|
1151
1145
|
|
1152
1146
|
# Syrian Arab Republic
|
1153
1147
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=SY
|
1154
1148
|
country '963',
|
1155
|
-
one_of(%w
|
1156
|
-
one_of(%w
|
1157
|
-
one_of('4') >> split(3,4) |
|
1158
|
-
one_of('9') >> split(4,4) | # mobile
|
1159
|
-
fixed(2) >> split(3,3)
|
1149
|
+
one_of(%w[11 14 31 33]) >> split(3, 4) |
|
1150
|
+
one_of(%w[12 13 15 16 21 22 23 25 34 41 43 51 52 53]) >> split(3, 3) |
|
1151
|
+
one_of('4') >> split(3, 4) |
|
1152
|
+
one_of('9') >> split(4, 4) | # mobile
|
1153
|
+
fixed(2) >> split(3, 3)
|
1160
1154
|
|
1161
1155
|
# Iraq (Republic of)
|
1162
1156
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
1163
1157
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=IQ
|
1164
1158
|
country '964',
|
1165
|
-
one_of(%w
|
1166
|
-
one_of(%w
|
1167
|
-
one_of('1') >> split(3,4) |
|
1168
|
-
fixed(2) >> split(3,3)
|
1159
|
+
one_of(%w[21 23 24 25 30 32 33 36 37 40 42 43 50 53 60 62 66]) >> split(3, 3) |
|
1160
|
+
one_of(%w[71 72 73 74 75 76 77 78 79]) >> split(4, 4) | # mobile
|
1161
|
+
one_of('1') >> split(3, 4) |
|
1162
|
+
fixed(2) >> split(3, 3)
|
1169
1163
|
|
1170
1164
|
# Kuwait (State of) http://www.wtng.info/wtng-965-kw.html
|
1171
1165
|
country '965',
|
1172
1166
|
none >> matched_split(
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1167
|
+
/\A65816\d+\z/ => [4, 4, 4], # voicemail (mobile), Wataniya Telecom
|
1168
|
+
/\A1\d+\z/ => [3, 4], # geographic
|
1169
|
+
/\A2\d+\z/ => [4, 4], # geographic
|
1170
|
+
/\A[569]\d+\z/ => [4, 4], # mobile
|
1171
|
+
/\A8\d+\z/ => [3, 3] # geographic
|
1178
1172
|
)
|
1179
1173
|
|
1180
1174
|
# country '966' # Saudi Arabia (Kingdom of), see special file.
|
@@ -1182,70 +1176,73 @@ Phony.define do
|
|
1182
1176
|
# Yemen (Republic of)
|
1183
1177
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
1184
1178
|
country '967',
|
1185
|
-
one_of(%w
|
1179
|
+
one_of(%w[70 71 73 77]) >> split(3, 4) | # mobile
|
1186
1180
|
one_of('58') >> split(4) | # pager
|
1187
1181
|
one_of('1') >> matched_split(
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1182
|
+
/\A\d{6}\z/ => [3, 3],
|
1183
|
+
/\A\d+\z/ => [3, 4]
|
1184
|
+
) |
|
1185
|
+
one_of(%w[2 3 4 5 6 7]) >> split(3, 3) |
|
1186
|
+
fixed(1) >> split(3, 3)
|
1192
1187
|
|
1193
1188
|
# Oman (Sultanate of), https://www.numberingplans.com/?page=dialling&sub=areacodes
|
1194
|
-
country '968', fixed(2) >> split(3,3)
|
1189
|
+
country '968', fixed(2) >> split(3, 3)
|
1195
1190
|
|
1196
1191
|
reserved '969' # Reserved - reservation currently under investigation
|
1197
1192
|
|
1198
1193
|
country '970', # 970 is used in those countries that block access to 972 (Israel)
|
1199
|
-
one_of('1') >> split(3,3,3) | # special numbers
|
1200
|
-
one_of('2', '3', '4', '8', '9') >> split(3,4)
|
1201
|
-
match(/^(5[023456789]|7[23467])\d+$/) >> split(3,4)
|
1194
|
+
one_of('1') >> split(3, 3, 3) | # special numbers
|
1195
|
+
one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
|
1196
|
+
match(/^(5[023456789]|7[23467])\d+$/) >> split(3, 4) # 2 digit ndc
|
1202
1197
|
|
1203
1198
|
# United Arab Emirates
|
1204
1199
|
# https://www.numberingplans.com/?page=dialling&sub=areacodes
|
1205
1200
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=AE
|
1206
1201
|
country '971',
|
1207
|
-
one_of(%w
|
1208
|
-
one_of('600') >> split(3,3) | # national rate
|
1209
|
-
one_of(%w
|
1202
|
+
one_of(%w[200 300]) >> split(3, 3) | # shared cost
|
1203
|
+
one_of('600') >> split(3, 3) | # national rate
|
1204
|
+
one_of(%w[500 700 900]) >> split(3, 3) | # premium rate
|
1210
1205
|
one_of('800') >> matched_split(
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
one_of(%w
|
1216
|
-
|
1206
|
+
/\A\d{2}\z/ => [2],
|
1207
|
+
/\A\d{7}\z/ => [2, 3, 2],
|
1208
|
+
/\A\d+\z/ => [2, 3, 4]
|
1209
|
+
) | # freephone
|
1210
|
+
one_of(%w[50 52 54 55 56 58]) >> split(3, 4) | # mobile
|
1211
|
+
one_of(%w[2 3 4 6 7 9]) >> split(3, 4) |
|
1212
|
+
fixed(1) >> split(3, 4)
|
1217
1213
|
|
1218
1214
|
# Israel (State of) (also works for numbers in Palestinian territories)
|
1219
1215
|
country '972',
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1216
|
+
trunk('0') |
|
1217
|
+
one_of('1') >> split(3, 3, 3) | # special numbers
|
1218
|
+
one_of('2', '3', '4', '8', '9') >> split(3, 4) | # 1 digit ndc
|
1219
|
+
match(/^(5[012345689]|7[234679])\d+$/) >> split(3, 4) # 2 digit ndc
|
1224
1220
|
|
1225
|
-
country '973', none >> split(4,4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
|
1221
|
+
country '973', none >> split(4, 4..4) # Bahrain (Kingdom of) http://www.itu.int/oth/T0202000011/en
|
1226
1222
|
|
1227
1223
|
# Qatar (State of)
|
1228
1224
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=QA
|
1229
1225
|
country '974',
|
1230
|
-
one_of(%w
|
1231
|
-
one_of(%w
|
1232
|
-
one_of(%w
|
1233
|
-
one_of(%w
|
1234
|
-
fixed(2) >> split(3,3)
|
1226
|
+
one_of(%w[1245 1744]) >> split(3, 3) | # voicemail
|
1227
|
+
one_of(%w[800 900]) >> split(2, 2) | # freephone, audiotext
|
1228
|
+
one_of(%w[20 21 22 26]) >> split(3, 2) | # pager
|
1229
|
+
one_of(%w[92 97]) >> split(3) | # mobile
|
1230
|
+
fixed(2) >> split(3, 3)
|
1235
1231
|
|
1236
1232
|
country '975', fixed(1) >> split(3, 3) # Bhutan (Kingdom of) http://www.wtng.info/wtng-975-bt.html
|
1237
1233
|
|
1238
1234
|
# Mongolia
|
1239
1235
|
# https://www.numberingplans.com/?page=plans&sub=phonenr&alpha_2_input=MN
|
1240
1236
|
country '976',
|
1241
|
-
one_of(%w
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
one_of(%w
|
1246
|
-
one_of(%w
|
1247
|
-
one_of(%w
|
1248
|
-
|
1237
|
+
one_of(%w[121 122 123 221 222 223]) >> matched_split(
|
1238
|
+
/\A\d{4}\z/ => [2, 2],
|
1239
|
+
/\A\d+\z/ => [2, 3]
|
1240
|
+
) |
|
1241
|
+
one_of(%w[11 12 13 14 15 21 22 23 24 25]) >> split(3, 2) |
|
1242
|
+
one_of(%w[70 75 76 77 78 79]) >> split(3, 3) | # VoIP telephony
|
1243
|
+
one_of(%w[88 89 90 91 94 95 96 99]) >> split(3, 3) | # mobile
|
1244
|
+
one_of(%w[50 55 56 58 92]) >> split(3, 3) | # wireless geographic
|
1245
|
+
fixed(2) >> split(3, 3)
|
1249
1246
|
|
1250
1247
|
# country '977' # Nepal, see special file
|
1251
1248
|
|