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

It is doable. You would have to code this because there is nothing for this. You are looking at 100s of NPAs (area codes)

1 Like

If I understand, you want to route the call based on the caller ID? You should be able to do that with Inbound routes. Look at CID routing and CID Priority Routing.

https://wiki.freepbx.org/display/FPG/Inbound+Route+User+Guide

1 Like

These two answers from @comtech and @BlazeStudios are proof of how awesome the system is.

They are completely different and both completely true.

You can write a custom context for your 800 number inbound route that looks up all of the 1000 (theoretically) possible NPAs and routes the call based on those. If, on the other hand, you only have a handful of “agent” phone numbers (as destinations) you can do it using inbound routes and CID Priority routing.

I’d start with CID Priority Routing. When that gets too painful, write a database based context that you can manage more easily.

1 Like

Well here is the issue with using Inbound Routes. All the calls are going to 1 DID, a toll free DID, which means it would require a Inbound Route for each NPA (area code) to route the calls to the proper destination. That would mean upwards of 800+ routes to one DID just so it could go to 10 different internal destinations. There is also the case of the 10 states limit. What if someone calls from a state where there is no local office? Where do those go? What about those that do not present a CallerID?

Basically you can write something that checks the CallerID via a script to a backend. What type of backend is your choice. Or you can maintain a large csv file and use the Bulk Handler to add/update/remote Inbound Routes if you go with using individual inbound routes.

1 Like

A list such as https://simple.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes could be easily parsed by a script and converted to a .csv for import by Bulk Handler.

However, you may want to include time-of-day and other inputs, especially if your demographic is young professionals. A growing trend is to keep (on your mobile) the number from your college town. For example, an MIT graduate who took a job with Google in Mountain View calls in at 4 pm PST and gets routed to your Boston office. He hears the ‘sorry, we’re closed’ message and calls a competitor instead.

2 Likes

https://www.google.com/url?sa=t&source=web&rct=j&url=http://media.juiceanalytics.com/downloads/area_codes_by_state.xls&ved=2ahUKEwiugbez0vLfAhWJwMQHHZCJA_kQFjAAegQIAxAB&usg=AOvVaw3xPwQBSxfXDIqjnq6etEWn&cshid=1547653563018

just download at:-

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

convert by whatever means to .csv

Create a database key on NPA with value = state

while IFS=, read -r NPA STATENAME STATE; do echo "rasterisk -x 'database put NPA $NPA $STATE'"; done < area_codes_by_state.csv|bash

Create a database key on state with value = destination

for i in $(cat area_codes_by_state.csv |cut -d ',' -f3|sort -u);do echo "rasterisk -x 'database put STATE $i \${EXTEN}'";done|bash

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

2 Likes

Hi Blaze, I have got the NPAs already. I would appreciate if you have an example of how can I route these based on the following criteria

I have Toll free number e.g. 888-xxx-xxx along with another 10 other toll free numbers for the states where I have offices in, I want that whoever dials the main toll free number to be routed to their own state office’s toll free number.

thank you

You shouldn’t be wanting that. Not only does it degrade latency and possibly introduce quality issues, you’d be paying per minute for both inbound legs. Whoever dials the main number should be routed to wherever their own office’s toll free number would be routed. If the offices all have IP PBXes, intracompany trunks (SIP or IAX) are what’s wanted.

I have all the DIDs from on the same SIP Trunk provider, I am not worried about that.
All what concerns me is the dial plan and how to route inbound calls
Thank you

Not knowing who the provider is, I can’t dispute that, but in my experience it’s not typical.

You could test this by calling the toll free number of one office from another. Then look at the CDRs on the provider’s portal and confirm that both the outgoing and incoming calls were billed at zero. Even if that is the case, there is still a possible issue with channel limitations (if your plan is limited to a specific number of concurrent calls).

But if that’s what you really want to do, create a Misc Destination for each office and point each Inbound Route for the ‘main’ toll free number to the appropriate one.

What phone systems do you have in the branch offices?

Thank you for your comment Stewart, This is a hosted system we are using Skype for Business and all offices are using the Skypefb Client to make/receive calls.

I have big number of codes for each state, and I think instead of creating inbound routes which will take a lot of time and routes, I guess going with Dicko’s solution will be most convenient for me however I am new to FreePBX (Yes I did some integrations before) but still I never did this kind of complicated routing.

Could you or Dicko please assist me with this in more detail, I downloaded the XLS file and converted it to csv already. I replaced codes for Detroit with the ones that I have which I want to route to Detroit’s office from the Toll Free Number.

After I have the file ready, where do I place the file in the server and where do I type these commands that Dicko wrote? In SSH?

How do I create a database key on NXX and state?
Is there any article that write these in detail?

Thank you so much

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’)

I didn’t withdraw anything. how can I keep this post?
I would like to ask if when I create new inbound routes, do I have to write the toll free Inbound in the DID number section or leave it empty?

I have done a test and created two routes with the same DID number, it worked but I am getting a warning saying the following:

DEST STATUS: CUSTOM
Inbound Route: +1248number (1248number/_320NXXXXXX)

I would appreciate any comments

I withdrew my post because it appeared that my suggestion had already been made and rejected.

Hi Dicko,

I have uploaded the csv file after I edited it with the codes that I have previously however, I can’t see the codes when I write type “rasterisk -x ‘database show’” I get state abbreviations with no codes on the left.

What are the columns headers that is expected from the script that you given me? I would appreciate if you could walk me through this step by step.

Thank you

image

I don’t think you did anything like what I suggested. I certainly never suggested editing anything

Show each step you did

(and explain what you mean by ‘UPLOADED’ )

I placed the csv document in home/asterisk/ and then ran the scripts you have mentioned earlier:

I didn’t change the columns header, Kept them as they are in the xls document but after I got the result I noticed its not showing state code so I replaced column headers with NPA,STATENAME,STATE.

Then re-run the commands and it said its updated them.

Create a database key on NPA with value = state

while IFS=, read -r NPA STATENAME STATE; do echo "rasterisk -x 'database put NPA $NPA $STATE'"; done < area_codes_by_state.csv|bash

Create a database key on state with value = destination

for i in $(cat area_codes_by_state.csv |cut -d ',' -f3|sort -u);do echo "rasterisk -x 'database put STATE $i \${EXTEN}'";done|bashCreate a database key on NPA with value = state

I have no idea about this, but I have the same cell number I had in 90’s when I lived in St. Louis. Now I live in Chicago. This will break your entire thing unless Missouri and Illinois gonto the same place.

On top of that fully half of the parents of my chidren’s friends have non-Chicago area codes on their cell phones.

Oh and my children just got phones. I got St. Louis numbers for them for the hell of it.

As @Stewart1 and others have said, you can certainly make this work like you want, it is increasingly pointless.

Show the output of each without the pipe through bash at the end

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]#