No commercial module helps with this. You could use Dynamic Routes and branch call flow based on area code. To get the area code from the caller ID of a North American number, you would use the Asterisk function like this:
${CALLERID(number):-10,3)
The problem with this approach is that there are many area codes, and you would have to enumerate each in the dynamic route. To do this efficiently you would need an AGI or API that returned the correct destination based on the area code.
in addition to that, its not just the NPA that affects things.
the NXX can also be vastly different geographic regions.
(north American standard, 1-NPA-NXX-XXXX)
In the North America Numbering Plan the NPA is part of the geographic location. The NXX is the Rate Center. The XXXX is the user. 313 NPA means Wayne County Michigan while 734 is both Wayne and Washtenaw county as it was the NPA for the latter and expanded to an overlay in the former.
It should work anywhere in the world, but be aware that US cell phone numbers will return only the state, land lines return the original office from which it was assigned, given number portability it just ābest effortā
I use what the script returns to do a DBget on an asteriskdb family relating that data to endpoint, sometimes the city is useful, sometimes just the state. You can adjust the script to just extract any two digit state from a land line
I believe this has been on a few wish list and is even in my āthings to do eventuallyā pile.
It is probably a day or two work to write but finding a day or two can be challenging.
Basically using libphonenumber convert the number to the state, then you can choose destination by state. Not as fine-grained as per area code but that could get obnoxous
That would depend on what argv[1] was +1NXXNXXXXXX or 1NXXNXXXXXX or NXXNXXXXXX would return the NANP ones, +33.X or 01133.* the French and +44.* or 01144.* the UK ones, , the number must however match what is āpossibleā and āvalidā in that locale, so 011441207778888 would return a null as would 13231501244
The library can do a lot more than this snippet uses, like TimeZone