Asterisk/11int

From My Notepad
Revision as of 20:32, 1 November 2010 by Admin (talk | contribs) (11 digit International)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

11 digit International

The following methods can be used to detect if an 11 digit phone number is an international number.

asterisk database method

exten => s,1,GotoIf($["${DB_EXISTS(system/11int/${ARG1:1:3})}" = "1"]?s|international)

exten => _1NXXNXXXXXX,n,GotoIf($["${DB_EXISTS(system/11int/${EXTEN:1:3})}" = "1"]?s|international)

asterisk -rx "database put system/11int 242 1"
asterisk -rx "database put system/11int 246 1"
asterisk -rx "database put system/11int 264 1"
asterisk -rx "database put system/11int 268 1"
asterisk -rx "database put system/11int 284 1"
asterisk -rx "database put system/11int 340 1"
asterisk -rx "database put system/11int 345 1"
asterisk -rx "database put system/11int 441 1"
asterisk -rx "database put system/11int 473 1"
asterisk -rx "database put system/11int 649 1"
asterisk -rx "database put system/11int 664 1"
asterisk -rx "database put system/11int 670 1"
asterisk -rx "database put system/11int 671 1"
asterisk -rx "database put system/11int 684 1"
asterisk -rx "database put system/11int 758 1"
asterisk -rx "database put system/11int 767 1"
asterisk -rx "database put system/11int 784 1"
asterisk -rx "database put system/11int 787 1"
asterisk -rx "database put system/11int 808 1"
asterisk -rx "database put system/11int 809 1"
asterisk -rx "database put system/11int 829 1"
asterisk -rx "database put system/11int 849 1"
asterisk -rx "database put system/11int 868 1"
asterisk -rx "database put system/11int 869 1"
asterisk -rx "database put system/11int 876 1"
asterisk -rx "database put system/11int 907 1"
asterisk -rx "database put system/11int 939 1"

asterisk dial plan method

The VALID_EXTEN and DIALPLAN_EXISTS functions are builtin to 1.6.X and 1.8. If you want to use this method with 1.2 or 1.4, you will need to compile the appropriate module below:

http://files.bluecrow.net/asterisk/backports/1.2/func_validexten.c

http://files.bluecrow.net/asterisk/backports/1.4/func_validexten.c

[11int]
;
; This context is used along with the VALID_EXTEN or DIALPLAN_EXISTS functions
; to determine if an 11 digit number is actually an international number.
;
; Example:
; exten => _1NXXNXXXXXX,n,GotoIf($["${VALID_EXTEN(dundi-e164-customers,${EXTEN},1)}" = "1"]?handle-international)
; exten => _1NXXNXXXXXX,n,GotoIf($["${DIALPLAN_EXISTS(dundi-e164-customers,${EXTEN},1)}" = "1"]?handle-international)
;
exten => _1242NXXXXXX,1,NoOp() ; Bahamas
exten => _1246NXXXXXX,1,NoOp() ; Barbados
exten => _1264NXXXXXX,1,NoOp() ; Anguilla
exten => _1268NXXXXXX,1,NoOp() ; Antigua/Barbuda
exten => _1284NXXXXXX,1,NoOp() ; British Virgin Islands
exten => _1340NXXXXXX,1,NoOp() ; US Virgin Islands
exten => _1345NXXXXXX,1,NoOp() ; Cayman Islands
exten => _1441NXXXXXX,1,NoOp() ; Bermuda
exten => _1473NXXXXXX,1,NoOp() ; Grenada
exten => _1649NXXXXXX,1,NoOp() ; Turks & Caicos Islands
exten => _1664NXXXXXX,1,NoOp() ; Montserrat
exten => _1670NXXXXXX,1,NoOp() ; CNMI (Northern Marianas, Saipan Proper)
exten => _1671NXXXXXX,1,NoOp() ; GU (Guam)
exten => _1684NXXXXXX,1,NoOp() ; AS (American Samoa)
exten => _1758NXXXXXX,1,NoOp() ; St. Lucia
exten => _1767NXXXXXX,1,NoOp() ; Dominica
exten => _1784NXXXXXX,1,NoOp() ; St. Vincent & Grenadines
exten => _1787NXXXXXX,1,NoOp() ; Puerto Rico
exten => _1808NXXXXXX,1,NoOp() ; HI (Hawaii)
exten => _1809NXXXXXX,1,NoOp() ; Dominican Republic
exten => _1829NXXXXXX,1,NoOp() ; Dominican Republic
exten => _1849NXXXXXX,1,NoOp() ; Dominican Republic
exten => _1868NXXXXXX,1,NoOp() ; Trinidad & Tobago
exten => _1869NXXXXXX,1,NoOp() ; St. Kitts & Nevis
exten => _1876NXXXXXX,1,NoOp() ; Jamaica
exten => _1907NXXXXXX,1,NoOp() ; AK (Alaska)
exten => _1939NXXXXXX,1,NoOp() ; Puerto Rico