How to route inbound calls based on the calling number's state code

I have altered the numbers, abbreviations of states according to how I had it previously in the old gateway (Sonus), I know not all of these are states but this is to make it easier for me to maintain them.

Does this look good?

Thank you

[[email protected] asterisk]# while IFS=, read -r NPA STATENAME STATE; do echo “rasterisk -x ‘database put NPA $NPA $STATE’”; done < area_codes_by_state.csv
'asterisk -x 'database put NPA NPA STATE
'asterisk -x 'database put NPA 207 DT
'asterisk -x 'database put NPA 216 DT
'asterisk -x 'database put NPA 231 DT
'asterisk -x 'database put NPA 234 DT
'asterisk -x 'database put NPA 248 DT
'asterisk -x 'database put NPA 269 DT
'asterisk -x 'database put NPA 270 DT
'asterisk -x 'database put NPA 303 DT
'asterisk -x 'database put NPA 313 DT
'asterisk -x 'database put NPA 330 DT
'asterisk -x 'database put NPA 339 DT
'asterisk -x 'database put NPA 351 DT
'asterisk -x 'database put NPA 364 DT
'asterisk -x 'database put NPA 401 DT
'asterisk -x 'database put NPA 413 DT
'asterisk -x 'database put NPA 419 DT
'asterisk -x 'database put NPA 423 DT
'asterisk -x 'database put NPA 440 DT
'asterisk -x 'database put NPA 502 DT
'asterisk -x 'database put NPA 508 DT
'asterisk -x 'database put NPA 513 DT
'asterisk -x 'database put NPA 517 DT
'asterisk -x 'database put NPA 567 DT
'asterisk -x 'database put NPA 586 DT
'asterisk -x 'database put NPA 603 DT
'asterisk -x 'database put NPA 606 DT
'asterisk -x 'database put NPA 614 DT
'asterisk -x 'database put NPA 615 DT
'asterisk -x 'database put NPA 616 DT
'asterisk -x 'database put NPA 617 DT
'asterisk -x 'database put NPA 719 DT
'asterisk -x 'database put NPA 720 DT
'asterisk -x 'database put NPA 731 DT
'asterisk -x 'database put NPA 734 DT
'asterisk -x 'database put NPA 740 DT
'asterisk -x 'database put NPA 774 DT
'asterisk -x 'database put NPA 781 DT
'asterisk -x 'database put NPA 802 DT
'asterisk -x 'database put NPA 810 DT
'asterisk -x 'database put NPA 857 DT
'asterisk -x 'database put NPA 859 DT
'asterisk -x 'database put NPA 865 DT
'asterisk -x 'database put NPA 901 DT
'asterisk -x 'database put NPA 906 DT
'asterisk -x 'database put NPA 931 DT
'asterisk -x 'database put NPA 937 DT
'asterisk -x 'database put NPA 947 DT
'asterisk -x 'database put NPA 970 DT
'asterisk -x 'database put NPA 978 DT
'asterisk -x 'database put NPA 989 DT
'asterisk -x 'database put NPA 239 FL
'asterisk -x 'database put NPA 305 FL
'asterisk -x 'database put NPA 321 FL
'asterisk -x 'database put NPA 352 FL
'asterisk -x 'database put NPA 386 FL
'asterisk -x 'database put NPA 407 FL
'asterisk -x 'database put NPA 561 FL
'asterisk -x 'database put NPA 727 FL
'asterisk -x 'database put NPA 754 FL
'asterisk -x 'database put NPA 772 FL
'asterisk -x 'database put NPA 786 FL
'asterisk -x 'database put NPA 813 FL
'asterisk -x 'database put NPA 850 FL
'asterisk -x 'database put NPA 863 FL
'asterisk -x 'database put NPA 904 FL
'asterisk -x 'database put NPA 941 FL
'asterisk -x 'database put NPA 954 FL
'asterisk -x 'database put NPA 208 CHI
'asterisk -x 'database put NPA 217 CHI
'asterisk -x 'database put NPA 218 CHI
'asterisk -x 'database put NPA 219 CHI
'asterisk -x 'database put NPA 224 CHI
'asterisk -x 'database put NPA 260 CHI
'asterisk -x 'database put NPA 262 CHI
'asterisk -x 'database put NPA 308 CHI
'asterisk -x 'database put NPA 309 CHI
'asterisk -x 'database put NPA 312 CHI
'asterisk -x 'database put NPA 314 CHI
'asterisk -x 'database put NPA 316 CHI
'asterisk -x 'database put NPA 317 CHI
'asterisk -x 'database put NPA 319 CHI
'asterisk -x 'database put NPA 320 CHI
'asterisk -x 'database put NPA 331 CHI
'asterisk -x 'database put NPA 402 CHI
'asterisk -x 'database put NPA 414 CHI
'asterisk -x 'database put NPA 417 CHI
'asterisk -x 'database put NPA 479 CHI
'asterisk -x 'database put NPA 501 CHI
'asterisk -x 'database put NPA 507 CHI
'asterisk -x 'database put NPA 515 CHI
'asterisk -x 'database put NPA 531 CHI
'asterisk -x 'database put NPA 534 CHI
'asterisk -x 'database put NPA 563 CHI
'asterisk -x 'database put NPA 573 CHI
'asterisk -x 'database put NPA 574 CHI
'asterisk -x 'database put NPA 605 CHI
'asterisk -x 'database put NPA 608 CHI
'asterisk -x 'database put NPA 612 CHI
'asterisk -x 'database put NPA 618 CHI
'asterisk -x 'database put NPA 620 CHI
'asterisk -x 'database put NPA 630 CHI
'asterisk -x 'database put NPA 636 CHI
'asterisk -x 'database put NPA 641 CHI
'asterisk -x 'database put NPA 651 CHI
'asterisk -x 'database put NPA 660 CHI
'asterisk -x 'database put NPA 701 CHI
'asterisk -x 'database put NPA 708 CHI
'asterisk -x 'database put NPA 712 CHI
'asterisk -x 'database put NPA 715 CHI
'asterisk -x 'database put NPA 763 CHI
'asterisk -x 'database put NPA 765 CHI
'asterisk -x 'database put NPA 773 CHI
'asterisk -x 'database put NPA 779 CHI
'asterisk -x 'database put NPA 785 CHI
'asterisk -x 'database put NPA 812 CHI
'asterisk -x 'database put NPA 815 CHI
'asterisk -x 'database put NPA 816 CHI
'asterisk -x 'database put NPA 847 CHI
'asterisk -x 'database put NPA 870 CHI
'asterisk -x 'database put NPA 872 CHI
'asterisk -x 'database put NPA 913 CHI
'asterisk -x 'database put NPA 920 CHI
'asterisk -x 'database put NPA 952 CHI
'asterisk -x 'database put NPA 213 LA
'asterisk -x 'database put NPA 310 LA
'asterisk -x 'database put NPA 323 LA
'asterisk -x 'database put NPA 385 LA
'asterisk -x 'database put NPA 424 LA
'asterisk -x 'database put NPA 435 LA
'asterisk -x 'database put NPA 442 LA
'asterisk -x 'database put NPA 458 LA
'asterisk -x 'database put NPA 503 LA
'asterisk -x 'database put NPA 509 LA
'asterisk -x 'database put NPA 541 LA
'asterisk -x 'database put NPA 562 LA
'asterisk -x 'database put NPA 619 LA
'asterisk -x 'database put NPA 626 LA
'asterisk -x 'database put NPA 657 LA
'asterisk -x 'database put NPA 702 LA
'asterisk -x 'database put NPA 714 LA
'asterisk -x 'database put NPA 725 LA
'asterisk -x 'database put NPA 747 LA
'asterisk -x 'database put NPA 775 LA
'asterisk -x 'database put NPA 801 LA
'asterisk -x 'database put NPA 808 LA
'asterisk -x 'database put NPA 818 LA
'asterisk -x 'database put NPA 858 LA
'asterisk -x 'database put NPA 909 LA
'asterisk -x 'database put NPA 949 LA
'asterisk -x 'database put NPA 951 LA
'asterisk -x 'database put NPA 971 LA
'asterisk -x 'database put NPA 209 SF
'asterisk -x 'database put NPA 530 SF
'asterisk -x 'database put NPA 559 SF
'asterisk -x 'database put NPA 650 SF
'asterisk -x 'database put NPA 661 SF
'asterisk -x 'database put NPA 669 SF
'asterisk -x 'database put NPA 707 SF
'asterisk -x 'database put NPA 760 SF
'asterisk -x 'database put NPA 805 SF
'asterisk -x 'database put NPA 831 SF
'asterisk -x 'database put NPA 916 SF
'asterisk -x 'database put NPA 925 SF
'asterisk -x 'database put NPA 208 SF
'asterisk -x 'database put NPA 406 SF
'asterisk -x 'database put NPA 480 SF
'asterisk -x 'database put NPA 623 SF
'asterisk -x 'database put NPA 928 SF
'asterisk -x 'database put NPA 602 SF
'asterisk -x 'database put NPA 520 SF
'asterisk -x 'database put NPA 902 SF
'asterisk -x 'database put NPA 905 SF
'asterisk -x 'database put NPA 907 SF
'asterisk -x 'database put NPA 202 DC",DC
'asterisk -x 'database put NPA 205 DC",DC
'asterisk -x 'database put NPA 215 DC",DC
'asterisk -x 'database put NPA 240 DC",DC
'asterisk -x 'database put NPA 251 DC",DC
'asterisk -x 'database put NPA 252 DC",DC
'asterisk -x 'database put NPA 256 DC",DC
'asterisk -x 'database put NPA 267 DC",DC
'asterisk -x 'database put NPA 272 DC",DC
'asterisk -x 'database put NPA 276 DC",DC
'asterisk -x 'database put NPA 301 DC",DC
'asterisk -x 'database put NPA 304 DC",DC
'asterisk -x 'database put NPA 334 DC",DC
'asterisk -x 'database put NPA 336 DC",DC
'asterisk -x 'database put NPA 410 DC",DC
'asterisk -x 'database put NPA 412 DC",DC
'asterisk -x 'database put NPA 434 DC",DC
'asterisk -x 'database put NPA 443 DC",DC
'asterisk -x 'database put NPA 484 DC",DC
'asterisk -x 'database put NPA 540 DC",DC
'asterisk -x 'database put NPA 570 DC",DC
'asterisk -x 'database put NPA 571 DC",DC
'asterisk -x 'database put NPA 610 DC",DC
'asterisk -x 'database put NPA 667 DC",DC
'asterisk -x 'database put NPA 703 DC",DC
'asterisk -x 'database put NPA 704 DC",DC
'asterisk -x 'database put NPA 717 DC",DC
'asterisk -x 'database put NPA 724 DC",DC
'asterisk -x 'database put NPA 757 DC",DC
'asterisk -x 'database put NPA 804 DC",DC
'asterisk -x 'database put NPA 814 DC",DC
'asterisk -x 'database put NPA 828 DC",DC
'asterisk -x 'database put NPA 878 DC",DC
'asterisk -x 'database put NPA 910 DC",DC
'asterisk -x 'database put NPA 919 DC",DC
'asterisk -x 'database put NPA 938 DC",DC
'asterisk -x 'database put NPA 980 DC",DC
'asterisk -x 'database put NPA 984 DC",DC
'asterisk -x 'database put NPA 229 ATL
'asterisk -x 'database put NPA 423 ATL
'asterisk -x 'database put NPA 470 ATL
'asterisk -x 'database put NPA 478 ATL
'asterisk -x 'database put NPA 615 ATL
'asterisk -x 'database put NPA 678 ATL
'asterisk -x 'database put NPA 706 ATL
'asterisk -x 'database put NPA 731 ATL
'asterisk -x 'database put NPA 770 ATL
'asterisk -x 'database put NPA 803 ATL
'asterisk -x 'database put NPA 843 ATL
'asterisk -x 'database put NPA 864 ATL
'asterisk -x 'database put NPA 865 ATL
'asterisk -x 'database put NPA 901 ATL
'asterisk -x 'database put NPA 912 ATL
'asterisk -x 'database put NPA 931 ATL
'asterisk -x 'database put NPA 210 HOU
'asterisk -x 'database put NPA 225 HOU
'asterisk -x 'database put NPA 228 HOU
'asterisk -x 'database put NPA 254 HOU
'asterisk -x 'database put NPA 281 HOU
'asterisk -x 'database put NPA 307 HOU
'asterisk -x 'database put NPA 318 HOU
'asterisk -x 'database put NPA 325 HOU
'asterisk -x 'database put NPA 337 HOU
'asterisk -x 'database put NPA 346 HOU
'asterisk -x 'database put NPA 361 HOU
'asterisk -x 'database put NPA 405 HOU
'asterisk -x 'database put NPA 409 HOU
'asterisk -x 'database put NPA 430 HOU
'asterisk -x 'database put NPA 432 HOU
'asterisk -x 'database put NPA 504 HOU
'asterisk -x 'database put NPA 505 HOU
'asterisk -x 'database put NPA 512 HOU
'asterisk -x 'database put NPA 539 HOU
'asterisk -x 'database put NPA 575 HOU
'asterisk -x 'database put NPA 580 HOU
'asterisk -x 'database put NPA 601 HOU
'asterisk -x 'database put NPA 662 HOU
'asterisk -x 'database put NPA 682 HOU
'asterisk -x 'database put NPA 713 HOU
'asterisk -x 'database put NPA 769 HOU
'asterisk -x 'database put NPA 806 HOU
'asterisk -x 'database put NPA 817 HOU
'asterisk -x 'database put NPA 830 HOU
'asterisk -x 'database put NPA 832 HOU
'asterisk -x 'database put NPA 903 HOU
'asterisk -x 'database put NPA 915 HOU
'asterisk -x 'database put NPA 918 HOU
'asterisk -x 'database put NPA 936 HOU
'asterisk -x 'database put NPA 940 HOU
'asterisk -x 'database put NPA 956 HOU
'asterisk -x 'database put NPA 979 HOU
'asterisk -x 'database put NPA 985 HOU
'asterisk -x 'database put NPA 201 NY
'asterisk -x 'database put NPA 203 NY
'asterisk -x 'database put NPA 212 NY
'asterisk -x 'database put NPA 302 NY
'asterisk -x 'database put NPA 315 NY
'asterisk -x 'database put NPA 347 NY
'asterisk -x 'database put NPA 475 NY
'asterisk -x 'database put NPA 516 NY
'asterisk -x 'database put NPA 518 NY
'asterisk -x 'database put NPA 551 NY
'asterisk -x 'database put NPA 585 NY
'asterisk -x 'database put NPA 607 NY
'asterisk -x 'database put NPA 609 NY
'asterisk -x 'database put NPA 631 NY
'asterisk -x 'database put NPA 646 NY
'asterisk -x 'database put NPA 716 NY
'asterisk -x 'database put NPA 718 NY
'asterisk -x 'database put NPA 732 NY
'asterisk -x 'database put NPA 845 NY
'asterisk -x 'database put NPA 848 NY
'asterisk -x 'database put NPA 856 NY
'asterisk -x 'database put NPA 860 NY
'asterisk -x 'database put NPA 862 NY
'asterisk -x 'database put NPA 908 NY
'asterisk -x 'database put NPA 914 NY
'asterisk -x 'database put NPA 917 NY
'asterisk -x 'database put NPA 929 NY
'asterisk -x 'database put NPA 959 NY
'asterisk -x 'database put NPA 973 NY
'asterisk -x 'database put NPA 226 CA
'asterisk -x 'database put NPA 249 CA
'asterisk -x 'database put NPA 343 CA
'asterisk -x 'database put NPA 365 CA
'asterisk -x 'database put NPA 416 CA
'asterisk -x 'database put NPA 437 CA
'asterisk -x 'database put NPA 438 CA
'asterisk -x 'database put NPA 581 CA
'asterisk -x 'database put NPA 873 CA
'asterisk -x 'database put NPA 236 CA
'asterisk -x 'database put NPA 587 CA
'asterisk -x 'database put NPA 431 CA
'asterisk -x 'database put NPA 204 CA
'asterisk -x 'database put NPA 250 CA
'asterisk -x 'database put NPA 289 CA
'asterisk -x 'database put NPA 306 CA
'asterisk -x 'database put NPA 403 CA
'asterisk -x 'database put NPA 416 CA
'asterisk -x 'database put NPA 418 CA
'asterisk -x 'database put NPA 450 CA
'asterisk -x 'database put NPA 506 CA
'asterisk -x 'database put NPA 514 CA
'asterisk -x 'database put NPA 519 CA
'asterisk -x 'database put NPA 604 CA
'asterisk -x 'database put NPA 613 CA
'asterisk -x 'database put NPA 647 CA
'asterisk -x 'database put NPA 705 CA
'asterisk -x 'database put NPA 709 CA
'asterisk -x 'database put NPA 778 CA
'asterisk -x 'database put NPA 780 CA
'asterisk -x 'database put NPA 807 CA
'asterisk -x 'database put NPA 819 CA
'asterisk -x 'database put NPA 867 CA
'asterisk -x 'database put NPA 902 CA
'asterisk -x 'database put NPA 905 CA
'asterisk -x 'database put NPA 214 DS
'asterisk -x 'database put NPA 404 DS
'asterisk -x 'database put NPA 469 DS
'asterisk -x 'database put NPA 972 DS
'asterisk -x 'database put NPA 206 SL
'asterisk -x 'database put NPA 253 SL
'asterisk -x 'database put NPA 360 SL
'asterisk -x 'database put NPA 425 SL
'asterisk -x 'database put NPA 503 SL
'asterisk -x 'database put NPA 509 SL

====

[[email protected] asterisk]# for i in $(cat area_codes_by_state.csv |cut -d ‘,’ -f3|sort -u);do echo “rasterisk -x ‘database put STATE $i ${EXTEN}’”;done
${EXTEN}’-x ‘database put STATE ATL
${EXTEN}’-x ‘database put STATE CA
${EXTEN}’-x ‘database put STATE CHI
rasterisk -x ‘database put STATE DC" ${EXTEN}’
${EXTEN}’-x ‘database put STATE DS
${EXTEN}’-x ‘database put STATE DT
${EXTEN}’-x ‘database put STATE FL
${EXTEN}’-x ‘database put STATE HOU
${EXTEN}’-x ‘database put STATE LA
${EXTEN}’-x ‘database put STATE NY
${EXTEN}’-x ‘database put STATE SF
${EXTEN}’-x ‘database put STATE SL
${EXTEN}’-x 'database put STATE STATE
[[email protected] asterisk]#

No, it doesn’t.

The first few lines of the areacode file should be

201,New Jersey,NJ
202,Washington,DC,DC
203,Connecticut,CT
205,Alabama,AL
206,Washington,WA
207,Maine,ME
208,Idaho,ID

And that should translate to lines like

asterisk -x ‘database put NPA 201 NJ’
.
.
asterisk -x ‘database put NPA 207 ME’

(Note the line breaks and quote placements)

As 207 is in Maine ‘ME’ not 'DT"

You’ve done this wrong. Your output should be rasterisk -x 'database put NPA $NPA $STATE' in everyone of these you have rasterisk -x 'database put NPA $NPA $STATE <-- Notice you’re closing ' is right after the normal command.

Then when you get to DC you have this 'asterisk -x 'database put NPA 202 DC",DC not only do you have the issue with the closing ' being in the wrong spot you also have a ", in there which is not going to work either.

And then the state stuff is just all wrong too. Looking at what @dicko gave you for this, it is 100% escaped and correct for those things not to happen. So you must have borked something setting this up on your end.

At a guess you saved the .csv file with text enclosed by quotes. Don’t do that.
If

I am scratching my head around this, should there be only space between those?

image

I would start over, last time I looked Detroit was not a state and I can confirm that area code 207 is not in that non-state

To get over the Washington,DC anomaly , from bash

wget http://media.juiceanalytics.com/downloads/area_codes_by_state.xls

make a ‘tab’ seperated value file .tsv without quote delimited text and for grins and giggles delete the header line at the top

and use

while IFS=$'\t'  read -r NPA STATENAME STATE;
do echo "rasterisk -x 'database put NPA $NPA $STATE'";
echo "rasterisk -x 'database put STATE $STATE \${EXTEN}'";
done < area_codes_by_state.tsv

for generating both tables

I know, the company I am doing this for have formatted this according to the clients calling them, the codes are based on where the calling number is going to be directed to which of their offices. So I would rather leave it as it is but I appreciate your note.

After running the command it looks totally different now

[[email protected] asterisk]# while IFS=$’\t’ read -r NPA STATENAME STATE;

do echo “rasterisk -x ‘database put NPA $NPA $STATE’”;
echo “rasterisk -x ‘database put STATE $STATE ${EXTEN}’”;
done < area_codes_by_state.tsv
'sterisk -x 'database put NPA 207 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 216 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 231 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 234 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 248 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 269 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 270 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 303 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 313 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 330 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 339 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 351 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 364 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 401 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 413 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 419 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 423 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 440 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 502 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 508 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 513 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 517 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 567 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 586 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 603 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 606 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 614 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 615 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 616 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 617 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 719 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 720 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 731 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 734 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 740 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 774 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 781 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 802 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 810 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 857 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 859 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 865 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 901 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 906 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 931 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 937 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 947 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 970 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 978 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 989 Detroit DT
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 239 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 305 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 321 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 352 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 386 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 407 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 561 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 727 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 754 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 772 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 786 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 813 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 850 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 863 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 904 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 941 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 954 Florida FL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 208 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 217 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 218 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 219 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 224 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 260 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 262 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 308 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 309 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 312 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 314 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 316 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 317 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 319 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 320 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 331 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 402 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 414 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 417 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 479 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 501 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 507 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 515 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 531 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 534 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 563 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 573 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 574 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 605 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 608 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 612 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 618 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 620 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 630 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 636 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 641 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 651 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 660 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 701 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 708 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 712 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 715 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 763 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 765 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 773 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 779 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 785 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 812 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 815 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 816 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 847 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 870 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 872 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 913 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 920 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 952 Chicago CHI
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 213 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 310 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 323 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 385 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 424 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 435 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 442 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 458 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 503 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 509 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 541 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 562 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 619 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 626 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 657 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 702 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 714 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 725 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 747 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 775 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 801 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 808 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 818 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 858 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 909 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 949 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 951 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 971 LosAngeles LA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 209 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 530 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 559 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 650 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 661 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 669 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 707 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 760 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 805 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 831 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 916 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 925 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 208 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 406 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 480 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 623 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 928 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 602 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 520 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 902 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 905 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 907 SanFrancisco SF
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 202 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 205 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 215 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 240 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 251 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 252 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 256 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 267 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 272 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 276 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 301 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 304 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 334 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 336 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 410 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 412 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 434 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 443 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 484 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 540 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 570 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 571 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 610 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 667 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 703 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 704 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 717 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 724 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 757 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 804 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 814 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 828 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 878 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 910 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 919 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 938 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 980 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 984 WashingtonDC DC
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 229 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 423 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 470 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 478 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 615 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 678 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 706 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 731 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 770 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 803 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 843 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 864 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 865 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 901 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 912 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 931 Atlanta ATL
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 210 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 225 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 228 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 254 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 281 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 307 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 318 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 325 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 337 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 346 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 361 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 405 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 409 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 430 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 432 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 504 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 505 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 512 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 539 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 575 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 580 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 601 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 662 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 682 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 713 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 769 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 806 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 817 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 830 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 832 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 903 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 915 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 918 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 936 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 940 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 956 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 979 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 985 Houston HOU
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 201 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 203 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 212 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 302 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 315 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 347 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 475 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 516 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 518 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 551 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 585 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 607 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 609 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 631 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 646 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 716 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 718 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 732 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 845 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 848 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 856 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 860 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 862 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 908 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 914 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 917 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 929 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 959 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 973 NewYork NY
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 226 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 249 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 343 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 365 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 416 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 437 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 438 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 581 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 873 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 236 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 587 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 431 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 204 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 250 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 289 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 306 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 403 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 416 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 418 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 450 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 506 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 514 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 519 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 604 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 613 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’
'sterisk -x 'database put NPA 647 Canada CA
rasterisk -x ‘database put STATE ${EXTEN}’

Sorry, your doing something wrong, please try it exactly as posted at each step “show your work” start of with

head area_code_by_state.csv

I saved the file in excel as tab delimited in txt format then changed the extension to tsv as you have mentioned. Do you think the file is not tab formatted?

image

hard to say but it definitely isn’t generated from

http://media.juiceanalytics.com/downloads/area_codes_by_state.xls

Could it be the encoding of the file? I am using UTF8! I am going to change it to ANSI and see if that would work. I also used notepad++ to make sure I have tabs not spaces between columns.

Will let you know. Thank you

No not the encoding but yes it needs to be ascii but surely even M$ should know that csv file need to be ascii, its just the wrong .xls

Try and install libreoffice on any linux box (even your asterisk box itself) and you can script it very easily with

rm area_codes_by_state.xls
wget http://media.juiceanalytics.com/downloads/area_codes_by_state.xls
libreoffice --headless --convert-to csv area_codes_by_state.xls  --outdir . 
sed -i  's/".*"/WashingtonDC/' area_codes_by_state.csv
sed -i  's/,/\t/g' area_codes_by_state.csv 
sed -i 's/ //g' area_codes_by_state.csv
sed -n -e '2,$p' area_codes_by_state.csv|awk '{print "rasterisk -x \"database put NPA "$1" "$3"\"\nrasterisk -x \"database put STATE "$3" \\${EXTEN}\""}' |tee bashstuff

copy bashstuff to your asterisk box and from bash

cat bashstuff|bash

Seems like it worked, I had to alter the libreoffice command to the following though
libreoffice --headless --convert-to csv --outdir /home/asterisk/ *.xls

So at least now we know the cause was the file format. How do I proceed with creating Internal routes for each of these states?

Thank you

[[email protected] asterisk]# sed -i ‘s/".*"/Washington/’ area_codes_by_state.csv
[[email protected] asterisk]# sed -i ‘s/,/\t/g’ area_codes_by_state.csv
[[email protected] asterisk]# sed -i ‘s/ //g’ area_codes_by_state.csv;sed -n -e ‘2,$p’ area_codes_by_state.csv|awk ‘{print "rasterisk -x “database put NPA “$1” “$3"”\nrasterisk -x “database put STATE “$3” \${EXTEN}””}’ |tee bashstuff
rasterisk -x “database put NPA 201 NJ”
rasterisk -x “database put STATE NJ ${EXTEN}”
rasterisk -x “database put NPA 202 DC”
rasterisk -x “database put STATE DC ${EXTEN}”
rasterisk -x “database put NPA 203 CT”
rasterisk -x “database put STATE CT ${EXTEN}”
rasterisk -x “database put NPA 205 AL”
rasterisk -x “database put STATE AL ${EXTEN}”
rasterisk -x “database put NPA 206 WA”
rasterisk -x “database put STATE WA ${EXTEN}”
rasterisk -x “database put NPA 207 ME”
rasterisk -x “database put STATE ME ${EXTEN}”
rasterisk -x “database put NPA 208 ID”
rasterisk -x “database put STATE ID ${EXTEN}”
rasterisk -x “database put NPA 209 CA”
rasterisk -x “database put STATE CA ${EXTEN}”
rasterisk -x “database put NPA 210 TX”
rasterisk -x “database put STATE TX ${EXTEN}”
rasterisk -x “database put NPA 212 NY”
rasterisk -x “database put STATE NY ${EXTEN}”
rasterisk -x “database put NPA 213 CA”
rasterisk -x “database put STATE CA ${EXTEN}”
rasterisk -x “database put NPA 214 TX”
rasterisk -x “database put STATE TX ${EXTEN}”
rasterisk -x “database put NPA 215 PA”
rasterisk -x “database put STATE PA ${EXTEN}”
rasterisk -x “database put NPA 216 OH”
rasterisk -x “database put STATE OH ${EXTEN}”
rasterisk -x “database put NPA 217 IL”
rasterisk -x “database put STATE IL ${EXTEN}”
rasterisk -x “database put NPA 218 MN”
rasterisk -x “database put STATE MN ${EXTEN}”
rasterisk -x “database put NPA 219 IN”
rasterisk -x “database put STATE IN ${EXTEN}”
rasterisk -x “database put NPA 224 IL”
rasterisk -x “database put STATE IL ${EXTEN}”
rasterisk -x “database put NPA 225 LA”
rasterisk -x “database put STATE LA ${EXTEN}”
rasterisk -x “database put NPA 227 MD”
rasterisk -x “database put STATE MD ${EXTEN}”

Again NOT file format just the wrong file. As to the rest, can but repost
.
.
I gave you the basics on making the NPA and STATE families , you run those from bash. Detroit is in Michigan (MI) which has area codes (NPA) 231,248,269,313,517,586,616,734,810,906,947 and 989

rasterisk -x 'database show NPA'|grep MI

You need to extract the NPA from with ${CALLERID(number):0:3} then lookup the state for that , when you have the sate you look up the destination and ‘goto’ there.

rasterisk -x ‘database show NPA’|grep MI

Being new is always a problem, but reading through

http://asterisk-service.com/downloads/Asterisk-%20The%20Definitive%20Guide,%204th%20Edition.pdf

will get you familiar, when familiar you can hone-in on ‘contexts’ (for call control) ‘substrings’ (to extract the NPA from ${CallerID(Number)} and database usage (for the ‘puts’ and ‘gets’)
.
.
.

.
.
update ${EXTEN} to the destination for any states you cover for example:-

rasterisk -x 'database put STATE 4566'
Then something like (pseudo code)

[custom-inbound-context]
Exten => _NXXNXXXXXX,1,DBGET state from CID
Exten => _NXXNXXXXXX,n.Goto(DBGETdestination from state
.
.

I guess you missed that bit :wink:

I don’t have extensions at all on my FreePBX, I am routing all inbound calls to DID numbers which are assigned in Skype for Business or Exchange (I have integrated FreePBX With both already and calls are working fine)

So Instead of the extension 4566 can I type any of those DIDs ?
rasterisk -x ‘database put STATE 888-xxx-xxx’

That would depend on

rasterisk -x "dialplan show [email protected]"

including a context that that allowed outbound dialing it could be ‘[email protected]’ but that’s a little lax when it comes to inbound calls

Please spend some time with the asterisk book, so you start knowing what you have got yourself into :wink:

1 Like

Seems its not an easy task like I thought it would be. And I thought Sonus was pain in the butt. lol
Thank you so much for your time and comments. I 'll try to walk myself through the book and see if I can get this done.
Regards

But given your apparent business plan, FreePBX is likely the wrong platform for you it is unnecessarily a back-to-back so all traffic needs to go through it twice look to a SIP proxy which does exactly what you want

I’ve had Sonus Lite which is a VM but it’s almost useless, plus you need to buy SIP licenses, SDP licenses and other hidden licenses as well. Plus depending on which hyper-visor you host it on its sometimes not stable.

Thank you again

rasterisk -x ‘database put STATE TX 800555212’

[trythis-inbound-context]
exten => _NXXNXXXXXX,1,Goto(from-internal,${DB(STATE/${DB(NPA/${CALLERID(num):-10:3})})},1)
;matched 10 digit CID destination
exten => _1NXXNXXXXXX,1,Goto(from-internal,${DB(STATE/${DB(NPA/${CALLERID(num):-10:3})})},1)
; matched 11 digit CID destination
exten => _.,1,Goto(from-internal,18885551212,1)
; unmatched destination for Canadian, Caribbean or anonymous calls

replace ${EXTEN} with your catchall DID in the earlier scripts.