Initial version
43
dialplan-scripts/in-get-callerid.agi
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/php -q
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define( 'GS_VALID', true ); /// this is a parent file
|
||||||
|
require_once( dirName(__FILE__) .'/../inc/conf.php' );
|
||||||
|
require_once( GS_DIR .'inc/agi-fns.php' );
|
||||||
|
|
||||||
|
ini_set('implicit_flush', 1);
|
||||||
|
ob_implicit_flush(1);
|
||||||
|
|
||||||
|
$number = trim(@$argv[1]);
|
||||||
|
if (empty($number)) die();
|
||||||
|
|
||||||
|
gs_agi_verbose( '### Number identification for ' . $number );
|
||||||
|
|
||||||
|
require_once( GS_DIR . 'inc/CountryCodes/CountryCodes.class.php' );
|
||||||
|
|
||||||
|
$intlnum = $number;
|
||||||
|
if (substr($intlnum, 0, 2) == '00') {
|
||||||
|
// int'l number
|
||||||
|
$intlnum = '+' . substr($intlnum, 2);
|
||||||
|
} elseif ($number{0} == '0') {
|
||||||
|
// local number
|
||||||
|
$intlnum = '+' . GS_CANONIZE_COUNTRY_CODE . substr($intlnum, 1);
|
||||||
|
} else {
|
||||||
|
// plain number
|
||||||
|
$intlnum = '+' . GS_CANONIZE_COUNTRY_CODE . GS_CANONIZE_AREA_CODE . $intlnum;
|
||||||
|
}
|
||||||
|
gs_agi_verbose( '### Number identification for ' . $intlnum );
|
||||||
|
|
||||||
|
$country = CountryCodes::lookupNum($intlnum);
|
||||||
|
// will set:
|
||||||
|
// $country['Calling Code'] = matched part of number, e.g. "+4930"
|
||||||
|
// $country['Country'] = country , e.g. "Deutschland"
|
||||||
|
// $country['CC'] = ISO 2-letter country code, e.g. "DE"
|
||||||
|
// $country['District'] = district of country , e.g. "Berlin"
|
||||||
|
// $country['flag'] = <unused>
|
||||||
|
|
||||||
|
// file_put_contents('/tmp/countrylookup.txt', print_r($country, true) );
|
||||||
|
|
||||||
|
echo 'SET VARIABLE CALLERID(name) ' . gs_agi_str_esc($country['CC'] . ', ' . $country['District']) . "\n";
|
||||||
|
|
||||||
|
?>
|
2
etc/asterisk/e-internal.ael-add
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// add this line:
|
||||||
|
AGI(/opt/gemeinschaft/dialplan-scripts/in-get-callerid.agi,${CALLERID(num)});
|
114
inc/CountryCodes/+1.php
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CSV.class.php');
|
||||||
|
|
||||||
|
$states = array(
|
||||||
|
'AL' => 'Alabama',
|
||||||
|
'AK' => 'Alaska',
|
||||||
|
'AZ' => 'Arizona',
|
||||||
|
'AR' => 'Arkansas',
|
||||||
|
'CA' => 'Kalifornien',
|
||||||
|
'CO' => 'Colorado',
|
||||||
|
'CT' => 'Connecticut',
|
||||||
|
'DC' => 'Washington D.C.',
|
||||||
|
'DE' => 'Delaware',
|
||||||
|
'FL' => 'Florida',
|
||||||
|
'GA' => 'Georgia',
|
||||||
|
'HI' => 'Hawaii',
|
||||||
|
'ID' => 'Idaho',
|
||||||
|
'IL' => 'Illinois',
|
||||||
|
'IN' => 'Indiana',
|
||||||
|
'IA' => 'Iowa',
|
||||||
|
'KS' => 'Kansas',
|
||||||
|
'KY' => 'Kentucky',
|
||||||
|
'LA' => 'Louisiana',
|
||||||
|
'MA' => 'Massachusetts',
|
||||||
|
'MD' => 'Maryland',
|
||||||
|
'ME' => 'Maine',
|
||||||
|
'MI' => 'Michigan',
|
||||||
|
'MN' => 'Minnesota',
|
||||||
|
'MS' => 'Mississippi',
|
||||||
|
'MO' => 'Missouri',
|
||||||
|
'MT' => 'Montana',
|
||||||
|
'NE' => 'Nebraska',
|
||||||
|
'NV' => 'Nevada',
|
||||||
|
'NH' => 'New Hampshire',
|
||||||
|
'NJ' => 'New Jersey',
|
||||||
|
'NM' => 'New Mexiko',
|
||||||
|
'NY' => 'New York',
|
||||||
|
'NC' => 'North Carolina',
|
||||||
|
'ND' => 'North Dakota',
|
||||||
|
'OH' => 'Ohio',
|
||||||
|
'OK' => 'Oklahoma',
|
||||||
|
'OR' => 'Oregon',
|
||||||
|
'PA' => 'Pennsylvania',
|
||||||
|
'RI' => 'Rhode Island',
|
||||||
|
'SC' => 'South Carolina',
|
||||||
|
'SD' => 'South Dakota',
|
||||||
|
'TN' => 'Tennessee',
|
||||||
|
'TX' => 'Texas',
|
||||||
|
'UT' => 'Utah',
|
||||||
|
'VT' => 'Vermont',
|
||||||
|
'VA' => 'Virginia',
|
||||||
|
'WA' => 'Washington',
|
||||||
|
'WV' => 'West Virginia',
|
||||||
|
'WI' => 'Wisconsin',
|
||||||
|
'WY' => 'Wyoming',
|
||||||
|
);
|
||||||
|
|
||||||
|
$nonus = array(
|
||||||
|
array('Amerika', 'UK', array('264', '441', '345', '664', '649')),
|
||||||
|
array('Kanada', 'CA', array('403', '587', '780', '250', '604', '778', '204', '506', '709', '902', '867', '226', '289', '416', '519', '613', '647', '705', '807', '905', '418', '438', '450', '514', '581', '819', '306', '600')),
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($nonus as $i=>$nu) {
|
||||||
|
foreach ($nu[2] as $pre) {
|
||||||
|
$nonus[$pre] = array($nu[0], $nu[1]);
|
||||||
|
}
|
||||||
|
unset($nonus[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
);
|
||||||
|
|
||||||
|
$prefix = '';
|
||||||
|
$cc = '+1';
|
||||||
|
$country = 'USA';
|
||||||
|
$countrycode = 'US';
|
||||||
|
|
||||||
|
foreach ($result as $pre=>$data) {
|
||||||
|
$result[$pre] = array(
|
||||||
|
'Calling Code' => $pre,
|
||||||
|
'District' => $data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = new CSV();
|
||||||
|
$db->setDelimiter(';');
|
||||||
|
if (!$db->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '+1/NpasInSvcByNumRpt.csv', true)) return array();
|
||||||
|
$db->setUseHeaders(true);
|
||||||
|
|
||||||
|
foreach ($db->getTable() as $loc) {
|
||||||
|
$pre = $loc['Npa'];
|
||||||
|
$ort = $loc['Location'];
|
||||||
|
$coc = $countrycode;
|
||||||
|
$cou = $country;
|
||||||
|
if (isset($nonus[$pre])) {
|
||||||
|
$coc = $nonus[$pre][1];
|
||||||
|
$cou = $nonus[$pre][0];
|
||||||
|
}
|
||||||
|
if (substr($pre, 0, strlen($prefix)) == $prefix) $pre = $cc . substr($pre, strlen($prefix));
|
||||||
|
if (isset($states[$ort])) $ort = $states[$ort];
|
||||||
|
$result[$pre] = array(
|
||||||
|
'Calling Code' => $pre,
|
||||||
|
'District' => $ort,
|
||||||
|
'CC' => $coc,
|
||||||
|
'Country' => $cou,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
?>
|
339
inc/CountryCodes/+1/NpasInSvcByNumRpt.csv
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
"Npa";"Location"
|
||||||
|
201;"NJ"
|
||||||
|
202;"DC"
|
||||||
|
203;"CT"
|
||||||
|
204;"Manitoba"
|
||||||
|
205;"AL"
|
||||||
|
206;"WA"
|
||||||
|
207;"ME"
|
||||||
|
208;"ID"
|
||||||
|
209;"CA"
|
||||||
|
210;"TX"
|
||||||
|
212;"NY"
|
||||||
|
213;"CA"
|
||||||
|
214;"TX"
|
||||||
|
215;"PA"
|
||||||
|
216;"OH"
|
||||||
|
217;"IL"
|
||||||
|
218;"MN"
|
||||||
|
219;"IN"
|
||||||
|
224;"IL"
|
||||||
|
225;"LA"
|
||||||
|
226;"Ontario"
|
||||||
|
228;"MS"
|
||||||
|
229;"GA"
|
||||||
|
231;"MI"
|
||||||
|
234;"OH"
|
||||||
|
239;"FL"
|
||||||
|
240;"MD"
|
||||||
|
242;"Bahamas"
|
||||||
|
246;"Barbados"
|
||||||
|
248;"MI"
|
||||||
|
250;"British Columbia"
|
||||||
|
251;"AL"
|
||||||
|
252;"NC"
|
||||||
|
253;"WA"
|
||||||
|
254;"TX"
|
||||||
|
256;"AL"
|
||||||
|
260;"IN"
|
||||||
|
262;"WI"
|
||||||
|
264;"Anguilla"
|
||||||
|
267;"PA"
|
||||||
|
268;"Antigua/Barbuda"
|
||||||
|
269;"MI"
|
||||||
|
270;"KY"
|
||||||
|
276;"VA"
|
||||||
|
281;"TX"
|
||||||
|
284;"British Virgin Islands"
|
||||||
|
289;"Ontario"
|
||||||
|
301;"MD"
|
||||||
|
302;"DE"
|
||||||
|
303;"CO"
|
||||||
|
304;"WV"
|
||||||
|
305;"FL"
|
||||||
|
306;"Saskatchewan"
|
||||||
|
307;"WY"
|
||||||
|
308;"NE"
|
||||||
|
309;"IL"
|
||||||
|
310;"CA"
|
||||||
|
312;"IL"
|
||||||
|
313;"MI"
|
||||||
|
314;"MO"
|
||||||
|
315;"NY"
|
||||||
|
316;"KS"
|
||||||
|
317;"IN"
|
||||||
|
318;"LA"
|
||||||
|
319;"IA"
|
||||||
|
320;"MN"
|
||||||
|
321;"FL"
|
||||||
|
323;"CA"
|
||||||
|
325;"TX"
|
||||||
|
330;"OH"
|
||||||
|
331;"IL"
|
||||||
|
334;"AL"
|
||||||
|
336;"NC"
|
||||||
|
337;"LA"
|
||||||
|
339;"MA"
|
||||||
|
340;"USVI"
|
||||||
|
345;"Cayman Islands"
|
||||||
|
347;"NY"
|
||||||
|
351;"MA"
|
||||||
|
352;"FL"
|
||||||
|
360;"WA"
|
||||||
|
361;"TX"
|
||||||
|
386;"FL"
|
||||||
|
401;"RI"
|
||||||
|
402;"NE"
|
||||||
|
403;"Alberta"
|
||||||
|
404;"GA"
|
||||||
|
405;"OK"
|
||||||
|
406;"MT"
|
||||||
|
407;"FL"
|
||||||
|
408;"CA"
|
||||||
|
409;"TX"
|
||||||
|
410;"MD"
|
||||||
|
412;"PA"
|
||||||
|
413;"MA"
|
||||||
|
414;"WI"
|
||||||
|
415;"CA"
|
||||||
|
416;"Ontario"
|
||||||
|
417;"MO"
|
||||||
|
418;"Quebec"
|
||||||
|
419;"OH"
|
||||||
|
423;"TN"
|
||||||
|
424;"CA"
|
||||||
|
425;"WA"
|
||||||
|
430;"TX"
|
||||||
|
432;"TX"
|
||||||
|
434;"VA"
|
||||||
|
435;"UT"
|
||||||
|
438;"Quebec"
|
||||||
|
440;"OH"
|
||||||
|
441;"Bermuda"
|
||||||
|
443;"MD"
|
||||||
|
450;"Quebec"
|
||||||
|
456;"NANP area"
|
||||||
|
469;"TX"
|
||||||
|
473;"Grenada"
|
||||||
|
478;"GA"
|
||||||
|
479;"AR"
|
||||||
|
480;"AZ"
|
||||||
|
484;"PA"
|
||||||
|
500;"NANP area"
|
||||||
|
501;"AR"
|
||||||
|
502;"KY"
|
||||||
|
503;"OR"
|
||||||
|
504;"LA"
|
||||||
|
505;"NM"
|
||||||
|
506;"New Brunswick"
|
||||||
|
507;"MN"
|
||||||
|
508;"MA"
|
||||||
|
509;"WA"
|
||||||
|
510;"CA"
|
||||||
|
512;"TX"
|
||||||
|
513;"OH"
|
||||||
|
514;"Quebec"
|
||||||
|
515;"IA"
|
||||||
|
516;"NY"
|
||||||
|
517;"MI"
|
||||||
|
518;"NY"
|
||||||
|
519;"Ontario"
|
||||||
|
520;"AZ"
|
||||||
|
530;"CA"
|
||||||
|
540;"VA"
|
||||||
|
541;"OR"
|
||||||
|
551;"NJ"
|
||||||
|
559;"CA"
|
||||||
|
561;"FL"
|
||||||
|
562;"CA"
|
||||||
|
563;"IA"
|
||||||
|
567;"OH"
|
||||||
|
570;"PA"
|
||||||
|
571;"VA"
|
||||||
|
573;"MO"
|
||||||
|
574;"IN"
|
||||||
|
575;"NM"
|
||||||
|
580;"OK"
|
||||||
|
581;"Quebec"
|
||||||
|
585;"NY"
|
||||||
|
586;"MI"
|
||||||
|
587;"Alberta"
|
||||||
|
600;"Canada"
|
||||||
|
601;"MS"
|
||||||
|
602;"AZ"
|
||||||
|
603;"NH"
|
||||||
|
604;"British Columbia"
|
||||||
|
605;"SD"
|
||||||
|
606;"KY"
|
||||||
|
607;"NY"
|
||||||
|
608;"WI"
|
||||||
|
609;"NJ"
|
||||||
|
610;"PA"
|
||||||
|
612;"MN"
|
||||||
|
613;"Ontario"
|
||||||
|
614;"OH"
|
||||||
|
615;"TN"
|
||||||
|
616;"MI"
|
||||||
|
617;"MA"
|
||||||
|
618;"IL"
|
||||||
|
619;"CA"
|
||||||
|
620;"KS"
|
||||||
|
623;"AZ"
|
||||||
|
626;"CA"
|
||||||
|
630;"IL"
|
||||||
|
631;"NY"
|
||||||
|
636;"MO"
|
||||||
|
641;"IA"
|
||||||
|
646;"NY"
|
||||||
|
647;"Ontario"
|
||||||
|
649;"Turks & Caicos Islands"
|
||||||
|
650;"CA"
|
||||||
|
651;"MN"
|
||||||
|
657;"CA"
|
||||||
|
660;"MO"
|
||||||
|
661;"CA"
|
||||||
|
662;"MS"
|
||||||
|
664;"Montserrat"
|
||||||
|
670;"CNMI"
|
||||||
|
671;"GU"
|
||||||
|
678;"GA"
|
||||||
|
682;"TX"
|
||||||
|
684;"AS"
|
||||||
|
700;"NANP area"
|
||||||
|
701;"ND"
|
||||||
|
702;"NV"
|
||||||
|
703;"VA"
|
||||||
|
704;"NC"
|
||||||
|
705;"Ontario"
|
||||||
|
706;"GA"
|
||||||
|
707;"CA"
|
||||||
|
708;"IL"
|
||||||
|
709;"Newfoundland"
|
||||||
|
710;"US"
|
||||||
|
712;"IA"
|
||||||
|
713;"TX"
|
||||||
|
714;"CA"
|
||||||
|
715;"WI"
|
||||||
|
716;"NY"
|
||||||
|
717;"PA"
|
||||||
|
718;"NY"
|
||||||
|
719;"CO"
|
||||||
|
720;"CO"
|
||||||
|
724;"PA"
|
||||||
|
727;"FL"
|
||||||
|
731;"TN"
|
||||||
|
732;"NJ"
|
||||||
|
734;"MI"
|
||||||
|
740;"OH"
|
||||||
|
754;"FL"
|
||||||
|
757;"VA"
|
||||||
|
758;"St. Lucia"
|
||||||
|
760;"CA"
|
||||||
|
762;"GA"
|
||||||
|
763;"MN"
|
||||||
|
765;"IN"
|
||||||
|
767;"Dominica"
|
||||||
|
769;"MS"
|
||||||
|
770;"GA"
|
||||||
|
772;"FL"
|
||||||
|
773;"IL"
|
||||||
|
774;"MA"
|
||||||
|
775;"NV"
|
||||||
|
778;"British Columbia"
|
||||||
|
779;"IL"
|
||||||
|
780;"Alberta"
|
||||||
|
781;"MA"
|
||||||
|
784;"St. Vincent & Grenadines"
|
||||||
|
785;"KS"
|
||||||
|
786;"FL"
|
||||||
|
787;"Puerto Rico"
|
||||||
|
800;"NANP area"
|
||||||
|
801;"UT"
|
||||||
|
802;"VT"
|
||||||
|
803;"SC"
|
||||||
|
804;"VA"
|
||||||
|
805;"CA"
|
||||||
|
806;"TX"
|
||||||
|
807;"Ontario"
|
||||||
|
808;"HI"
|
||||||
|
809;"Dominican Republic"
|
||||||
|
810;"MI"
|
||||||
|
812;"IN"
|
||||||
|
813;"FL"
|
||||||
|
814;"PA"
|
||||||
|
815;"IL"
|
||||||
|
816;"MO"
|
||||||
|
817;"TX"
|
||||||
|
818;"CA"
|
||||||
|
819;"Quebec"
|
||||||
|
828;"NC"
|
||||||
|
829;"Dominican Republic"
|
||||||
|
830;"TX"
|
||||||
|
831;"CA"
|
||||||
|
832;"TX"
|
||||||
|
843;"SC"
|
||||||
|
845;"NY"
|
||||||
|
847;"IL"
|
||||||
|
848;"NJ"
|
||||||
|
850;"FL"
|
||||||
|
856;"NJ"
|
||||||
|
857;"MA"
|
||||||
|
858;"CA"
|
||||||
|
859;"KY"
|
||||||
|
860;"CT"
|
||||||
|
862;"NJ"
|
||||||
|
863;"FL"
|
||||||
|
864;"SC"
|
||||||
|
865;"TN"
|
||||||
|
866;"NANP area"
|
||||||
|
867;"Yukon, NW Terr., Nunavut"
|
||||||
|
868;"Trinidad & Tobago"
|
||||||
|
869;"St. Kitts & Nevis"
|
||||||
|
870;"AR"
|
||||||
|
876;"Jamaica"
|
||||||
|
877;"NANP area"
|
||||||
|
878;"PA"
|
||||||
|
888;"NANP area"
|
||||||
|
900;"NANP area"
|
||||||
|
901;"TN"
|
||||||
|
902;"Nova Scotia, Prince Edward Island"
|
||||||
|
903;"TX"
|
||||||
|
904;"FL"
|
||||||
|
905;"Ontario"
|
||||||
|
906;"MI"
|
||||||
|
907;"AK"
|
||||||
|
908;"NJ"
|
||||||
|
909;"CA"
|
||||||
|
910;"NC"
|
||||||
|
912;"GA"
|
||||||
|
913;"KS"
|
||||||
|
914;"NY"
|
||||||
|
915;"TX"
|
||||||
|
916;"CA"
|
||||||
|
917;"NY"
|
||||||
|
918;"OK"
|
||||||
|
919;"NC"
|
||||||
|
920;"WI"
|
||||||
|
925;"CA"
|
||||||
|
928;"AZ"
|
||||||
|
931;"TN"
|
||||||
|
936;"TX"
|
||||||
|
937;"OH"
|
||||||
|
939;"Puerto Rico"
|
||||||
|
940;"TX"
|
||||||
|
941;"FL"
|
||||||
|
947;"MI"
|
||||||
|
949;"CA"
|
||||||
|
951;"CA"
|
||||||
|
952;"MN"
|
||||||
|
954;"FL"
|
||||||
|
956;"TX"
|
||||||
|
970;"CO"
|
||||||
|
971;"OR"
|
||||||
|
972;"TX"
|
||||||
|
973;"NJ"
|
||||||
|
978;"MA"
|
||||||
|
979;"TX"
|
||||||
|
980;"NC"
|
||||||
|
985;"LA"
|
||||||
|
989;"MI"
|
|
2
inc/CountryCodes/+1/NpasInSvcByNumRpt.url
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[InternetShortcut]
|
||||||
|
URL=http://www.nanpa.com/nas/public/npasInServiceByNumberReport.do?method=displayNpasInServiceByNumberReport
|
19
inc/CountryCodes/+264.csv
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
"Calling Code";"District"
|
||||||
|
61;"Khoma"
|
||||||
|
62;"Süd-Otjozondjupa"
|
||||||
|
6228;"Okahandja"
|
||||||
|
63;"Karas"
|
||||||
|
631;"Keetmanshoop"
|
||||||
|
6331;"Lüderitz"
|
||||||
|
6332;"Oranjemund"
|
||||||
|
64;"Erongo"
|
||||||
|
641;"Swakopmund"
|
||||||
|
642;"Walfischbucht"
|
||||||
|
65;"Oshana"
|
||||||
|
66;"Hardap"
|
||||||
|
661;"Mariental"
|
||||||
|
67;"Oshikoto und Nord-Otjozondjupa"
|
||||||
|
6722;"Tsumeb"
|
||||||
|
6731;"Grootfontein"
|
||||||
|
68;"Omaheke"
|
||||||
|
681;"Gobabis"
|
|
9
inc/CountryCodes/+33.csv
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
"Calling Code";"District"
|
||||||
|
1;"Paris"
|
||||||
|
2;"NW-Frankreich"
|
||||||
|
3;"NO-Frankreich"
|
||||||
|
4;"SO-Frankreich"
|
||||||
|
5;"SW-Frankreich"
|
||||||
|
6;"Mobilfunk"
|
||||||
|
8;"Freephone"
|
||||||
|
9;"ortsunabhängig"
|
|
21
inc/CountryCodes/+385.csv
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
"Calling Code";"District";"CC";"Country"
|
||||||
|
1;"Zagreb"
|
||||||
|
20;"Dubrovnik-Neretva"
|
||||||
|
21;"Split-Dalmatien"
|
||||||
|
22;"Šibenik-Knin"
|
||||||
|
23;"Zadar"
|
||||||
|
31;"Osijek-Baranja"
|
||||||
|
32;"Vukovar-Syrmien"
|
||||||
|
33;"Virovitica-Podravina"
|
||||||
|
34;"Požega-Slawonien"
|
||||||
|
35;"Brod-Posavina"
|
||||||
|
40;"Međimurje"
|
||||||
|
42;"Varaždin"
|
||||||
|
43;"Bjelovar-Bilogora"
|
||||||
|
44;"Sisak-Moslavina"
|
||||||
|
47;"Karlovac"
|
||||||
|
48;"Koprivnica-Križevci"
|
||||||
|
49;"Krapina-Zagorje"
|
||||||
|
51;"Primorje-Gorski kotar"
|
||||||
|
52;"Istrien"
|
||||||
|
53;"Lika-Senj"
|
Can't render this file because it has a wrong number of fields in line 2.
|
50
inc/CountryCodes/+49.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CSV.class.php');
|
||||||
|
|
||||||
|
$result = array(
|
||||||
|
'+4910' => 'Call-by-Call',
|
||||||
|
'+4912' => 'Innovative Dienste',
|
||||||
|
'+49137' => 'Televoting',
|
||||||
|
'+49138' => 'Televoting',
|
||||||
|
'+4915' => 'Mobilfunk',
|
||||||
|
'+4916' => 'Mobilfunk',
|
||||||
|
'+4917' => 'Mobilfunk',
|
||||||
|
'+4918' => 'Shared-Cost-Dienste',
|
||||||
|
'+4919' => 'Premium Rate Dienste',
|
||||||
|
);
|
||||||
|
|
||||||
|
$prefix = '0';
|
||||||
|
$cc = '+49';
|
||||||
|
$country = 'Deutschland';
|
||||||
|
$countrycode = 'DE';
|
||||||
|
|
||||||
|
foreach ($result as $pre=>$data) {
|
||||||
|
$result[$pre] = array(
|
||||||
|
'Calling Code' => $pre,
|
||||||
|
'District' => $data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = new CSV();
|
||||||
|
$db->setDelimiter(';');
|
||||||
|
if (!$db->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '+49/LosgXXXX.TXT', true)) return $result;
|
||||||
|
$db->setUseHeaders(true);
|
||||||
|
|
||||||
|
foreach ($db->getTable() as $loc) {
|
||||||
|
$pre = $loc['Vorwahl'];
|
||||||
|
$ort = $loc['Ortsnetz'];
|
||||||
|
if (substr($pre, 0, strlen($prefix)) == $prefix) $pre = $cc . substr($pre, strlen($prefix));
|
||||||
|
$result[$pre] = array(
|
||||||
|
'Calling Code' => $pre,
|
||||||
|
'District' => $ort,
|
||||||
|
'CC' => $countrycode,
|
||||||
|
'Country' => $country,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
?>
|
5206
inc/CountryCodes/+49/LosgXXXX.TXT
Normal file
2
inc/CountryCodes/+49/LosgXXXX.url
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[InternetShortcut]
|
||||||
|
URL=http://www.bundesnetzagentur.de/enid/Ortsnetze/Verzeichnisse_1gg.html
|
406
inc/CountryCodes/CSV.class.php
Normal file
@ -0,0 +1,406 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CSV class for easy use of CSV files as tables
|
||||||
|
*
|
||||||
|
* @author Markus Birth, mbirth@webwriters.de
|
||||||
|
**/
|
||||||
|
|
||||||
|
ini_set('auto_detect_line_endings', '1');
|
||||||
|
|
||||||
|
class CSV {
|
||||||
|
|
||||||
|
/** CSV formatting variables */
|
||||||
|
protected $csv_delim = ',';
|
||||||
|
protected $csv_stren = '"';
|
||||||
|
protected $csv_decim = '.';
|
||||||
|
protected $csv_escap = '\\';
|
||||||
|
|
||||||
|
/** table-filename, read-only- and headers-flag */
|
||||||
|
protected $file, $readonly;
|
||||||
|
protected $useheaders = false;
|
||||||
|
protected $autoconvert = false;
|
||||||
|
|
||||||
|
/** table contents */
|
||||||
|
protected $data, $headers;
|
||||||
|
|
||||||
|
/** holds allowed characters for numerical values */
|
||||||
|
protected $num_allowed = '0123456789.';
|
||||||
|
|
||||||
|
private static $lfw_staleAge = 5; // staleAge in seconds for locked filewrite
|
||||||
|
private static $lfw_timeLimit = 300000; // time limit in µs to try to gain lock
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDecimal($nd) {
|
||||||
|
if (strlen($nd) != 1) return false;
|
||||||
|
$this->csv_decim = $nd;
|
||||||
|
$this->num_allowed = '0123456789' . $nd;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStringEnclosure($enc) {
|
||||||
|
if (strlen($enc) != 1) return false;
|
||||||
|
$this->csv_stren = $enc;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDelimiter($deli) {
|
||||||
|
if (strlen($deli) != 1) return false;
|
||||||
|
$this->csv_delim = $deli;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* creates a new table; empty or from given array via <code>$init</code>
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $table name of new table
|
||||||
|
* @param $init array with initial table (if omitted or not an array, an empty table is created)
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function create($file, $init = false) {
|
||||||
|
if (isset($this->file) || isset($this->data)) return false;
|
||||||
|
$this->file = $file;
|
||||||
|
$this->readonly = false;
|
||||||
|
$this->data = array();
|
||||||
|
if ($init !== false) {
|
||||||
|
if (!is_array($init)) $init = array($init);
|
||||||
|
foreach ($init as $tmp) {
|
||||||
|
if (!is_array($tmp)) $tmp = array($tmp);
|
||||||
|
array_push($this->data, $tmp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->data = array();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* loads a table from CSV file
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $table name of table to load (without '.csv'!)
|
||||||
|
* @param $readonly if true, loads table for read-only (defaults to false)
|
||||||
|
* @param $delim CSV delimiter (defaults to ',')
|
||||||
|
* @param $stren CSV string encloser (defaults to '"')
|
||||||
|
* @param $decim Decimal separator (defaults to '.')
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function load($file, $readonly = false) {
|
||||||
|
if (isset($this->file) || isset($this->data) || !file_exists($file)) return false;
|
||||||
|
$this->data = array();
|
||||||
|
$this->file = $file;
|
||||||
|
$this->readonly = $readonly;
|
||||||
|
$f = fopen($this->file, 'rt');
|
||||||
|
if ($f === false) return false;
|
||||||
|
$safety = -1;
|
||||||
|
while (($temp = fgetcsv($f, filesize($this->file), $this->csv_delim, $this->csv_stren)) !== false) {
|
||||||
|
$temp = preg_replace('/\\\([^\\\])/', '\\1', $temp);
|
||||||
|
$temp = str_replace('\\\\', '\\', $temp);
|
||||||
|
$this->data[] = $temp;
|
||||||
|
if (ftell($f) == $safety) break; // loop
|
||||||
|
$safety = ftell($f);
|
||||||
|
}
|
||||||
|
fclose($f);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets whether to treat all fields as string or as specific types
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $acflag new boolean value
|
||||||
|
*/
|
||||||
|
function setAutoConvert($acflag) {
|
||||||
|
if (!is_bool($acflag)) return false;
|
||||||
|
$this->autoconvert = $acflag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets whether to use headers in first data row for description of fields
|
||||||
|
* or use 0..n as field descriptors. Doesn't affect the $this->data object.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $hflag new boolean value
|
||||||
|
*/
|
||||||
|
function setUseHeaders($hflag) {
|
||||||
|
if (!is_bool($hflag)) return false;
|
||||||
|
if ($this->useheaders === $hflag) return true;
|
||||||
|
if ($hflag) {
|
||||||
|
// Apply headings from first row to all entries
|
||||||
|
// and remove first row
|
||||||
|
$heads = array_shift($this->data);
|
||||||
|
foreach ($this->data as $i=>$r) {
|
||||||
|
$r2 = array();
|
||||||
|
foreach ($r as $j=>$d) {
|
||||||
|
$r2[$heads[$j]] = $d;
|
||||||
|
}
|
||||||
|
$this->data[$i] = $r2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Extract headings from longest data record
|
||||||
|
// and prepend header line to data array
|
||||||
|
$maxrec = 0;
|
||||||
|
$maxct = 0;
|
||||||
|
foreach ($this->data as $i=>$d) {
|
||||||
|
if (count($d)>$maxct) {
|
||||||
|
$maxct = count($d);
|
||||||
|
$maxrec = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$heads = array();
|
||||||
|
foreach ($this->data[$maxrec] as $h=>$f) {
|
||||||
|
$heads[] = $h;
|
||||||
|
}
|
||||||
|
foreach ($this->data as $i=>$r) {
|
||||||
|
$r2 = array();
|
||||||
|
foreach ($heads as $h) {
|
||||||
|
$r2[] = $r[$h];
|
||||||
|
}
|
||||||
|
$this->data[$i] = $r2;
|
||||||
|
}
|
||||||
|
array_unshift($this->data, $heads);
|
||||||
|
}
|
||||||
|
$this->useheaders = $hflag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* saves currently open table to CSV file
|
||||||
|
* (locked filewrite code from http://de2.php.net/manual/en/function.flock.php#46085)
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function save() {
|
||||||
|
if ($this->readonly === true || !isset($this->file) || !isset($this->data)) return false;
|
||||||
|
$headerstate = $this->useheaders;
|
||||||
|
if ($this->useheaders === true) {
|
||||||
|
// prepend headers if used
|
||||||
|
$this->setUseHeaders(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BEGIN: Gain lock
|
||||||
|
ignore_user_abort(true);
|
||||||
|
$lockdir = $this->file . '.lock';
|
||||||
|
if (is_dir($lockdir)) {
|
||||||
|
if ((time() - filemtime($lockdir)) > self::$lfw_staleAge) {
|
||||||
|
rmdir($lockdir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$locked = @mkdir($lockdir);
|
||||||
|
if ($locked === false) {
|
||||||
|
$timestart = microtime(true);
|
||||||
|
do {
|
||||||
|
if ((microtime(true) - $timestart) > self::$lfw_timeLimit) {
|
||||||
|
ignore_user_abort(false);
|
||||||
|
$this->setUseHeaders($headerstate);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$locked = @mkdir($lockdir);
|
||||||
|
} while ($locked === false);
|
||||||
|
}
|
||||||
|
// END: Gain lock
|
||||||
|
|
||||||
|
$f = fopen($this->file, 'wt');
|
||||||
|
foreach ($this->data as $line) {
|
||||||
|
if (count($line)>0 && strlen(implode('', $line))>0) {
|
||||||
|
$temp = array();
|
||||||
|
foreach ($line as $tmp) {
|
||||||
|
if (!is_numeric($tmp) && !is_bool($tmp)) {
|
||||||
|
if (strlen($this->csv_stren)>0) $tmp = strtr($tmp, array('\\'=>'\\\\', $this->csv_stren=>'\\'.$this->csv_stren));
|
||||||
|
$temp[] = $this->csv_stren . $tmp . $this->csv_stren;
|
||||||
|
} elseif (is_numeric($tmp)) {
|
||||||
|
if (is_float($tmp)) {
|
||||||
|
$temp[] = strtr((string)$tmp, ".", $this->csv_decim);
|
||||||
|
} else {
|
||||||
|
$temp[] = $tmp;
|
||||||
|
}
|
||||||
|
} elseif (is_bool($tmp)) {
|
||||||
|
if ($tmp==true) {
|
||||||
|
$temp[] = 'true';
|
||||||
|
} else {
|
||||||
|
$temp[] = 'false';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!fwrite($f, implode($this->csv_delim, $temp) . "\n")) {
|
||||||
|
$this->setUseHeaders($headerstate); // restore previous state
|
||||||
|
ignore_user_abort(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($f);
|
||||||
|
rmdir($lockdir);
|
||||||
|
ignore_user_abort(false);
|
||||||
|
$this->setUseHeaders($headerstate); // restore previous state
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* closes currently open table
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $save if true, writes table to CSV file before close (defaults to true)
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function close($save = true) {
|
||||||
|
if (!isset($this->file) || !isset($this->data)) return false;
|
||||||
|
if ($save===true && !$this->readonly) {
|
||||||
|
if (!$this->save()) return false;
|
||||||
|
}
|
||||||
|
unset($this->file);
|
||||||
|
unset($this->readonly);
|
||||||
|
unset($this->data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortRows($keycol, $rev = false) {
|
||||||
|
if (is_string($keycol)) {
|
||||||
|
if ($this->useheaders === false) {
|
||||||
|
$keycol = array_search($keycol, $this->data[0]);
|
||||||
|
if (!$keycol) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$sortme = array();
|
||||||
|
foreach ($this->data as $i=>$d) {
|
||||||
|
$sortme[$i] = $d[$keycol];
|
||||||
|
}
|
||||||
|
asort($sortme);
|
||||||
|
$newdata = array();
|
||||||
|
if ($this->useheaders === false) {
|
||||||
|
$newdata[0] = $this->data[0];
|
||||||
|
}
|
||||||
|
foreach ($sortme as $i=>$d) {
|
||||||
|
if ($i==0 && $this->useheaders === false) continue;
|
||||||
|
$newdata[] = $this->data[$i];
|
||||||
|
}
|
||||||
|
if ($rev === true) $newdata = array_reverse($newdata);
|
||||||
|
$this->data = $newdata;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTable() {
|
||||||
|
if (!isset($this->data)) return false;
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTable($tbl) {
|
||||||
|
if (!is_array($tbl) || !is_array(reset($tbl))) return false;
|
||||||
|
$this->data = $tbl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns an array with all elements of a complete row
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $rid id of the row
|
||||||
|
* @return array with elements if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function getRow($rid) {
|
||||||
|
if (!isset($this->data[$rid])) return false;
|
||||||
|
if (!$this->autoconvert) return $this->data[$rid];
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->data[$rid] as $i=>$d) {
|
||||||
|
$result[$i] = $this->guessType($d);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns a single cell value
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $rid id of the row
|
||||||
|
* @param $cid id of the column
|
||||||
|
* @return cell contents if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function getRowCol($rid, $cid) {
|
||||||
|
if (!isset($this->data[$rid][$cid])) return false;
|
||||||
|
if (!$this->autoconvert) return $this->data[$rid][$cid];
|
||||||
|
|
||||||
|
return $this->guessType($this->data[$rid][$cid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guesses type of a value by its content
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $val String to guess type
|
||||||
|
* @return String, (int) or (float)
|
||||||
|
*/
|
||||||
|
function guessType($val) {
|
||||||
|
$commas = 0;
|
||||||
|
for ($i=0;$i<strlen($val);$i++) {
|
||||||
|
$c = $val{$i};
|
||||||
|
if (strpos($this->num_allowed, $c) === false) return $val;
|
||||||
|
if ($c == $this->csv_decim) $commas++;
|
||||||
|
}
|
||||||
|
$val = strtr($val, $this->csv_decim, '.');
|
||||||
|
if ($commas>1) return $val;
|
||||||
|
if ($commas==1) return floatval($val);
|
||||||
|
return intval($val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guesses type for the whole database
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function guessTypeAll() {
|
||||||
|
foreach ($this->data as $i=>$r) {
|
||||||
|
foreach ($r as $j=>$d) {
|
||||||
|
$this->data[$i][$j] = $this->guessType($d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* writes a value to a single cell
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $rid id of the row
|
||||||
|
* @param $cid id of the column
|
||||||
|
* @param $val new value to write to cell
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function setRowCol($rid, $cid, $val) {
|
||||||
|
$this->data[$rid][$cid] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* writes an array to a row
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $rid id of the row
|
||||||
|
* @param $line array with column contents to write to line
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function setRow($rid, $line) {
|
||||||
|
if (!is_array($line)) return false;
|
||||||
|
$this->data[$rid] = $line;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* deletes a row
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param $rid id of the row
|
||||||
|
* @return <code>true</code> if successful; <code>false</code> if failed
|
||||||
|
*/
|
||||||
|
function delRow($rid) {
|
||||||
|
if (!isset($this->data[$rid])) return false;
|
||||||
|
unset($this->data[$rid]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
84
inc/CountryCodes/CountryCodes.class.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'CSV.class.php');
|
||||||
|
|
||||||
|
class CountryCodes {
|
||||||
|
|
||||||
|
protected static $loaded = array();
|
||||||
|
protected static $data = array();
|
||||||
|
protected static $flagdir = 'flags/';
|
||||||
|
|
||||||
|
static function loadData($cc) {
|
||||||
|
if (in_array($cc, self::$loaded)) return false;
|
||||||
|
$fnpre = dirname(__FILE__) . DIRECTORY_SEPARATOR . $cc;
|
||||||
|
if (file_exists($fnpre . '.php')) {
|
||||||
|
self::$data = array_merge(self::$data, include($fnpre . '.php'));
|
||||||
|
array_push(self::$loaded, $cc);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (file_exists($fnpre . '.csv')) {
|
||||||
|
$tbl = new CSV();
|
||||||
|
$tbl->setDelimiter(';');
|
||||||
|
$tbl->load($fnpre . '.csv');
|
||||||
|
$tbl->setUseHeaders(true);
|
||||||
|
foreach ($tbl->getTable() as $tbldata) {
|
||||||
|
$pref = &$tbldata['Calling Code'];
|
||||||
|
if ($cc{0} == '+') $pref = $cc . $pref;
|
||||||
|
// Strip empty fields
|
||||||
|
foreach ($tbldata as $i=>$d) {
|
||||||
|
if (empty($d)) unset($tbldata[$i]);
|
||||||
|
}
|
||||||
|
self::$data[$pref] = $tbldata;
|
||||||
|
}
|
||||||
|
$tbl->close();
|
||||||
|
array_push(self::$loaded, $cc);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function lookupNum($num) {
|
||||||
|
self::loadData('countries');
|
||||||
|
$result = self::findBestMatch($num);
|
||||||
|
if ($result === false) return false;
|
||||||
|
if (self::loadData($result['Calling Code'])) {
|
||||||
|
// new data loaded, find match again
|
||||||
|
$result = self::findBestMatch($num);
|
||||||
|
}
|
||||||
|
$result['flag'] = self::findFlag($result['CC']);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function findFlag($cc) {
|
||||||
|
$cc = strtolower($cc);
|
||||||
|
$filepre = self::$flagdir . $cc;
|
||||||
|
if (file_exists($filepre . '.png')) return $cc . '.png';
|
||||||
|
if (file_exists($filepre . '.gif')) return $cc . '.gif';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function findBestMatch($num) {
|
||||||
|
$result = array();
|
||||||
|
for ($i=strlen($num);$i>1;$i--) {
|
||||||
|
$test = substr($num, 0, $i);
|
||||||
|
if (isset(self::$data[$test])) {
|
||||||
|
$result = array_merge(self::$data[$test], $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($result) == 0) return false;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function getFlagDir() {
|
||||||
|
return self::$flagdir;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function setFlagDir($flagdir) {
|
||||||
|
if (!file_exists($flagdir)) return false;
|
||||||
|
self::$flagdir = $flagdir;
|
||||||
|
if (substr(self::$flagdir, -1) != DIRECTORY_SEPARATOR) self::$flagdir .= DIRECTORY_SEPARATOR;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
211
inc/CountryCodes/countries.csv
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
"Calling Code";"Country";"CC";"District"
|
||||||
|
+93;"Afghanistan";"AF";""
|
||||||
|
+20;"Ägypten,\"EG\"";"";""
|
||||||
|
+355;"Albanien";"AL";""
|
||||||
|
+213;"Algerien";"DZ";""
|
||||||
|
+376;"Andorra";"AD";""
|
||||||
|
+244;"Angola";"AO";""
|
||||||
|
+240;"Äquatorialguinea";"GQ";""
|
||||||
|
+54;"Argentinien";"AR";""
|
||||||
|
+374;"Armenien";"AM";""
|
||||||
|
+297;"Aruba";"AW";""
|
||||||
|
+247;"Ascension";"AC";""
|
||||||
|
+994;"Aserbaidschan";"AZ";""
|
||||||
|
+251;"Äthiopien";"ET";""
|
||||||
|
+61;"Australien, Kokosinseln (CC) und Weihnachtsinsel (CX)";"AU";""
|
||||||
|
+973;"Bahrain";"BH";""
|
||||||
|
+880;"Bangladesch";"BD";""
|
||||||
|
+32;"Belgien";"BE";""
|
||||||
|
+501;"Belize";"BZ";""
|
||||||
|
+229;"Benin";"BJ";""
|
||||||
|
+975;"Bhutan";"BT";""
|
||||||
|
+591;"Bolivien";"BO";""
|
||||||
|
+387;"Bosnien/Herzegowina";"BA";""
|
||||||
|
+267;"Botsuana";"BW";""
|
||||||
|
+55;"Brasilien";"BR";""
|
||||||
|
+673;"Brunei";"BN";""
|
||||||
|
+359;"Bulgarien";"BG";""
|
||||||
|
+226;"Burkina Faso";"BF";""
|
||||||
|
+257;"Burundi";"BI";""
|
||||||
|
+56;"Chile";"CL";""
|
||||||
|
+86;"China";"CN";""
|
||||||
|
+682;"Cookinseln";"CK";""
|
||||||
|
+506;"Costa Rica";"CR";""
|
||||||
|
+225;"Côte d'Ivoire (Elfenbeinküste)";"CI";""
|
||||||
|
+45;"Dänemark";"DK";""
|
||||||
|
+49;"Deutschland";"DE";""
|
||||||
|
+253;"Dschibuti";"DJ";""
|
||||||
|
+593;"Ecuador";"EC";""
|
||||||
|
+503;"El Salvador";"SV";""
|
||||||
|
+291;"Eritrea";"ER";""
|
||||||
|
+372;"Estland";"EE";""
|
||||||
|
+3883;"ETNS";"EU";""
|
||||||
|
+38831;"ETNS";"EU";"PSA"
|
||||||
|
+38833;"ETNS";"EU";"CSA"
|
||||||
|
+38835;"ETNS";"EU";"CN"
|
||||||
|
+38837;"ETNS";"EU";"Personal"
|
||||||
|
+500;"Falklandinseln";"FK";""
|
||||||
|
+298;"Färöer";"FO";""
|
||||||
|
+679;"Fidschi";"FJ";""
|
||||||
|
+358;"Finnland";"FI";""
|
||||||
|
+33;"Frankreich";"FR";""
|
||||||
|
+594;"Französisch-Guayana";"GF";""
|
||||||
|
+689;"Französisch-Polynesien";"PF";""
|
||||||
|
+241;"Gabun";"GA";""
|
||||||
|
+220;"Gambia";"GM";""
|
||||||
|
+995;"Georgien";"GE";""
|
||||||
|
+233;"Ghana";"GH";""
|
||||||
|
+350;"Gibraltar";"GI";""
|
||||||
|
+30;"Griechenland";"GR";""
|
||||||
|
+299;"Grönland";"GL";""
|
||||||
|
+44;"Großbritannien";"UK";""
|
||||||
|
+590;"Guadeloupe";"GP";""
|
||||||
|
+502;"Guatemala";"GT";""
|
||||||
|
+224;"Guinea";"GN";""
|
||||||
|
+245;"Guinea-Bissau";"GW";""
|
||||||
|
+592;"Guyana";"GY";""
|
||||||
|
+509;"Haiti";"HT";""
|
||||||
|
+504;"Honduras";"HN";""
|
||||||
|
+852;"Hongkong";"HK";""
|
||||||
|
+91;"Indien";"IN";""
|
||||||
|
+62;"Indonesien";"ID";""
|
||||||
|
+964;"Irak";"IQ";""
|
||||||
|
+98;"Iran";"IR";""
|
||||||
|
+353;"Irland";"IE";""
|
||||||
|
+354;"Island";"IS";""
|
||||||
|
+972;"Israel";"IL";""
|
||||||
|
+39;"Italien";"IT";""
|
||||||
|
+81;"Japan";"JP";""
|
||||||
|
+967;"Jemen";"YE";""
|
||||||
|
+962;"Jordanien";"JO";""
|
||||||
|
+855;"Kambodscha";"KH";""
|
||||||
|
+237;"Kamerun";"CM";""
|
||||||
|
+238;"Kap Verde";"CV";""
|
||||||
|
+974;"Katar";"QA";""
|
||||||
|
+254;"Kenia";"KE";""
|
||||||
|
+996;"Kirgistan";"KG";""
|
||||||
|
+686;"Kiribati (Gilbert Inseln)";"KI";""
|
||||||
|
+57;"Kolumbien";"CO";""
|
||||||
|
+269;"Komoren und Mayotte (YT)";"KM";""
|
||||||
|
+242;"Republik Kongo (Brazzaville)";"CG";""
|
||||||
|
+243;"Demokratische Republik Kongo (Kinshasa, früheres Zaire)";"CD";""
|
||||||
|
+385;"Kroatien";"HR";""
|
||||||
|
+53;"Kuba";"CU";""
|
||||||
|
+965;"Kuwait";"KW";""
|
||||||
|
+856;"Laos";"LA";""
|
||||||
|
+266;"Lesotho";"LS";""
|
||||||
|
+371;"Lettland";"LV";""
|
||||||
|
+961;"Libanon";"LB";""
|
||||||
|
+231;"Liberia";"LR";""
|
||||||
|
+218;"Libyen";"LY";""
|
||||||
|
+423;"Liechtenstein";"LI";""
|
||||||
|
+370;"Litauen";"LT";""
|
||||||
|
+352;"Luxemburg";"LU";""
|
||||||
|
+853;"Macau";"MO";""
|
||||||
|
+261;"Madagaskar";"MG";""
|
||||||
|
+265;"Malawi";"MW";""
|
||||||
|
+60;"Malaysia";"MY";""
|
||||||
|
+960;"Malediven";"MV";""
|
||||||
|
+223;"Mali";"ML";""
|
||||||
|
+356;"Malta";"MT";""
|
||||||
|
+212;"Marokko";"MA";""
|
||||||
|
+692;"Marshallinseln";"MH";""
|
||||||
|
+596;"Martinique";"MQ";""
|
||||||
|
+222;"Mauretanien";"MR";""
|
||||||
|
+230;"Mauritius";"MU";""
|
||||||
|
+389;"Mazedonien";"MK";""
|
||||||
|
+52;"Mexiko";"MX";""
|
||||||
|
+691;"Mikronesien";"FM";""
|
||||||
|
+373;"Moldawien";"MD";""
|
||||||
|
+377;"Monaco";"MC";""
|
||||||
|
+976;"Mongolei";"MN";""
|
||||||
|
+382;"Montenegro";"ME";""
|
||||||
|
+258;"Mosambik";"MZ";""
|
||||||
|
+95;"Myanmar";"MM";""
|
||||||
|
+264;"Namibia";"NA";""
|
||||||
|
+674;"Nauru";"NR";""
|
||||||
|
+977;"Nepal";"NP";""
|
||||||
|
+687;"Neukaledonien";"NC";""
|
||||||
|
+64;"Neuseeland";"NZ";""
|
||||||
|
+505;"Nicaragua";"NI";""
|
||||||
|
+31;"Niederlande";"NL";""
|
||||||
|
+599;"Niederländische Antillen";"AN";""
|
||||||
|
+227;"Niger";"NE";""
|
||||||
|
+234;"Nigeria";"NG";""
|
||||||
|
+683;"Niue";"NU";""
|
||||||
|
+850;"Nordkorea";"KP";""
|
||||||
|
+6723;"Norfolkinsel";"NF";""
|
||||||
|
+47;"Norwegen";"NO";""
|
||||||
|
+968;"Oman";"OM";""
|
||||||
|
+43;"Österreich";"AT";""
|
||||||
|
+670;"Osttimor";"TL";""
|
||||||
|
+92;"Pakistan";"PK";""
|
||||||
|
+970;"Palästinensische Autonomiegebiete";"PS";""
|
||||||
|
+680;"Palau";"PW";""
|
||||||
|
+507;"Panama";"PA";""
|
||||||
|
+675;"Papua-Neuguinea";"PG";""
|
||||||
|
+595;"Paraguay";"PY";""
|
||||||
|
+51;"Peru";"PE";""
|
||||||
|
+63;"Philippinen";"PH";""
|
||||||
|
+649;"Pitcairninseln";"PN";""
|
||||||
|
+48;"Polen";"PL";""
|
||||||
|
+351;"Portugal";"PT";""
|
||||||
|
+262;"Réunion";"RE";""
|
||||||
|
+250;"Ruanda";"RW";""
|
||||||
|
+40;"Rumänien";"RO";""
|
||||||
|
+7;"Russland und Kasachstan (KZ)";"RU";""
|
||||||
|
+508;"Saint-Pierre und Miquelon";"PM";""
|
||||||
|
+677;"Salomonen";"SB";""
|
||||||
|
+260;"Sambia";"ZM";""
|
||||||
|
+685;"Samoa";"WS";""
|
||||||
|
+378;"San Marino";"SM";""
|
||||||
|
+239;"São Tomé und Principe";"ST";""
|
||||||
|
+966;"Saudi-Arabien";"SA";""
|
||||||
|
+46;"Schweden";"SE";""
|
||||||
|
+41;"Schweiz";"CH";""
|
||||||
|
+221;"Senegal";"SN";""
|
||||||
|
+381;"Serbien (inkl. Republik Kosovo)";"RS";""
|
||||||
|
+248;"Seychellen";"SC";""
|
||||||
|
+232;"Sierra Leone";"SL";""
|
||||||
|
+263;"Simbabwe";"ZW";""
|
||||||
|
+65;"Singapur";"SG";""
|
||||||
|
+421;"Slowakei";"SK";""
|
||||||
|
+386;"Slowenien";"SI";""
|
||||||
|
+252;"Somalia";"SO";""
|
||||||
|
+34;"Spanien";"ES";""
|
||||||
|
+94;"Sri Lanka";"LK";""
|
||||||
|
+290;"St. Helena";"SH";""
|
||||||
|
+27;"Südafrika";"ZA";""
|
||||||
|
+249;"Sudan";"SD";""
|
||||||
|
+82;"Südkorea";"KR";""
|
||||||
|
+597;"Suriname";"SR";""
|
||||||
|
+268;"Swasiland";"SZ";""
|
||||||
|
+963;"Syrien";"SY";""
|
||||||
|
+992;"Tadschikistan";"TJ";""
|
||||||
|
+886;"Taiwan";"TW";""
|
||||||
|
+255;"Tansania";"TZ";""
|
||||||
|
+66;"Thailand";"TH";""
|
||||||
|
+228;"Togo";"TG";""
|
||||||
|
+690;"Tokelau";"TK";""
|
||||||
|
+676;"Tonga";"TO";""
|
||||||
|
+235;"Tschad";"TD";""
|
||||||
|
+420;"Tschechien";"CZ";""
|
||||||
|
+216;"Tunesien";"TN";""
|
||||||
|
+90;"Türkei (inkl. Türk. Rep. Nordzypern)";"TR";""
|
||||||
|
+993;"Turkmenistan";"TM";""
|
||||||
|
+688;"Tuvalu, Ellice Islands";"TV";""
|
||||||
|
+256;"Uganda";"UG";""
|
||||||
|
+380;"Ukraine";"UA";""
|
||||||
|
+36;"Ungarn";"HU";""
|
||||||
|
+598;"Uruguay";"UY";""
|
||||||
|
+1;"USA";"US";""
|
||||||
|
+998;"Usbekistan";"UZ";""
|
||||||
|
+678;"Vanuatu";"VU";""
|
||||||
|
+379;"Vatikanstadt";"VA";""
|
||||||
|
+58;"Venezuela";"VE";""
|
||||||
|
+971;"Vereinigte Arabische Emirate";"AE";""
|
||||||
|
+84;"Vietnam";"VN";""
|
||||||
|
+681;"Wallis und Futuna";"WF";""
|
||||||
|
+375;"Weißrussland/Belarus";"BY";""
|
||||||
|
+236;"Zentralafrikanische Republik";"CF";""
|
||||||
|
+357;"Republik Zypern";"CY";""
|
Can't render this file because it contains an unexpected character in line 3 and column 16.
|
BIN
inc/CountryCodes/flags/ad.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
inc/CountryCodes/flags/ae.png
Normal file
After Width: | Height: | Size: 408 B |
BIN
inc/CountryCodes/flags/af.png
Normal file
After Width: | Height: | Size: 604 B |
BIN
inc/CountryCodes/flags/ag.png
Normal file
After Width: | Height: | Size: 591 B |
BIN
inc/CountryCodes/flags/ai.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
inc/CountryCodes/flags/al.png
Normal file
After Width: | Height: | Size: 600 B |
BIN
inc/CountryCodes/flags/am.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
inc/CountryCodes/flags/an.png
Normal file
After Width: | Height: | Size: 488 B |
BIN
inc/CountryCodes/flags/ao.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
inc/CountryCodes/flags/ar.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
inc/CountryCodes/flags/as.png
Normal file
After Width: | Height: | Size: 647 B |
BIN
inc/CountryCodes/flags/at.png
Normal file
After Width: | Height: | Size: 403 B |
BIN
inc/CountryCodes/flags/au.png
Normal file
After Width: | Height: | Size: 673 B |
BIN
inc/CountryCodes/flags/aw.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
inc/CountryCodes/flags/ax.png
Normal file
After Width: | Height: | Size: 663 B |
BIN
inc/CountryCodes/flags/az.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
inc/CountryCodes/flags/ba.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
inc/CountryCodes/flags/bb.png
Normal file
After Width: | Height: | Size: 585 B |
BIN
inc/CountryCodes/flags/bd.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
inc/CountryCodes/flags/be.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
inc/CountryCodes/flags/bf.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
inc/CountryCodes/flags/bg.png
Normal file
After Width: | Height: | Size: 462 B |
BIN
inc/CountryCodes/flags/bh.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
inc/CountryCodes/flags/bi.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
inc/CountryCodes/flags/bj.png
Normal file
After Width: | Height: | Size: 486 B |
BIN
inc/CountryCodes/flags/bm.png
Normal file
After Width: | Height: | Size: 611 B |
BIN
inc/CountryCodes/flags/bn.png
Normal file
After Width: | Height: | Size: 639 B |
BIN
inc/CountryCodes/flags/bo.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
inc/CountryCodes/flags/br.png
Normal file
After Width: | Height: | Size: 593 B |
BIN
inc/CountryCodes/flags/bs.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
inc/CountryCodes/flags/bt.png
Normal file
After Width: | Height: | Size: 631 B |
BIN
inc/CountryCodes/flags/bv.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
inc/CountryCodes/flags/bw.png
Normal file
After Width: | Height: | Size: 443 B |
BIN
inc/CountryCodes/flags/by.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
inc/CountryCodes/flags/bz.png
Normal file
After Width: | Height: | Size: 600 B |
BIN
inc/CountryCodes/flags/ca.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
inc/CountryCodes/flags/catalonia.png
Normal file
After Width: | Height: | Size: 398 B |
BIN
inc/CountryCodes/flags/cc.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
inc/CountryCodes/flags/cd.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
inc/CountryCodes/flags/cf.png
Normal file
After Width: | Height: | Size: 614 B |
BIN
inc/CountryCodes/flags/cg.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
inc/CountryCodes/flags/ch.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
inc/CountryCodes/flags/ci.png
Normal file
After Width: | Height: | Size: 453 B |
BIN
inc/CountryCodes/flags/ck.png
Normal file
After Width: | Height: | Size: 586 B |
BIN
inc/CountryCodes/flags/cl.png
Normal file
After Width: | Height: | Size: 450 B |
BIN
inc/CountryCodes/flags/cm.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
inc/CountryCodes/flags/cn.png
Normal file
After Width: | Height: | Size: 472 B |
BIN
inc/CountryCodes/flags/co.png
Normal file
After Width: | Height: | Size: 483 B |
BIN
inc/CountryCodes/flags/cr.png
Normal file
After Width: | Height: | Size: 477 B |
BIN
inc/CountryCodes/flags/cs.png
Normal file
After Width: | Height: | Size: 439 B |
BIN
inc/CountryCodes/flags/cu.png
Normal file
After Width: | Height: | Size: 563 B |
BIN
inc/CountryCodes/flags/cv.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
inc/CountryCodes/flags/cx.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
inc/CountryCodes/flags/cy.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
inc/CountryCodes/flags/cz.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
inc/CountryCodes/flags/de.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
inc/CountryCodes/flags/dj.png
Normal file
After Width: | Height: | Size: 572 B |
BIN
inc/CountryCodes/flags/dk.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
inc/CountryCodes/flags/dm.png
Normal file
After Width: | Height: | Size: 620 B |
BIN
inc/CountryCodes/flags/do.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
inc/CountryCodes/flags/dz.png
Normal file
After Width: | Height: | Size: 582 B |
BIN
inc/CountryCodes/flags/ec.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
inc/CountryCodes/flags/ee.png
Normal file
After Width: | Height: | Size: 429 B |
BIN
inc/CountryCodes/flags/eg.png
Normal file
After Width: | Height: | Size: 465 B |
BIN
inc/CountryCodes/flags/eh.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
inc/CountryCodes/flags/england.png
Normal file
After Width: | Height: | Size: 496 B |
BIN
inc/CountryCodes/flags/er.png
Normal file
After Width: | Height: | Size: 653 B |
BIN
inc/CountryCodes/flags/es.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
inc/CountryCodes/flags/et.png
Normal file
After Width: | Height: | Size: 592 B |
BIN
inc/CountryCodes/flags/eu.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
inc/CountryCodes/flags/fam.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
inc/CountryCodes/flags/fi.png
Normal file
After Width: | Height: | Size: 489 B |
BIN
inc/CountryCodes/flags/fj.png
Normal file
After Width: | Height: | Size: 610 B |
BIN
inc/CountryCodes/flags/fk.png
Normal file
After Width: | Height: | Size: 648 B |
BIN
inc/CountryCodes/flags/fm.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
inc/CountryCodes/flags/fo.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
inc/CountryCodes/flags/fr.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
inc/CountryCodes/flags/ga.png
Normal file
After Width: | Height: | Size: 489 B |
BIN
inc/CountryCodes/flags/gb.png
Normal file
After Width: | Height: | Size: 599 B |
BIN
inc/CountryCodes/flags/gd.png
Normal file
After Width: | Height: | Size: 637 B |
BIN
inc/CountryCodes/flags/ge.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
inc/CountryCodes/flags/gf.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
inc/CountryCodes/flags/gh.png
Normal file
After Width: | Height: | Size: 490 B |
BIN
inc/CountryCodes/flags/gi.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
inc/CountryCodes/flags/gl.png
Normal file
After Width: | Height: | Size: 470 B |
BIN
inc/CountryCodes/flags/gm.png
Normal file
After Width: | Height: | Size: 493 B |