RE: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx,

2005-09-21 Thread Damon Estep
 
  On a related note, I wanted our phones to display city, st for the
  caller-ID name in the event that none was provided.
 
 Interesting code.  What sort of memory does * take up when you load up
 all those CLID values?
 
 Nathan
 
I am a little late to this thread, but the answer is WAY TO MUCH.

With 150,000 pattern match extensions * takes a very long time to
reload, during which time calls do not proceed.

If you use Realtime MySQL it pulls in ALL patter match extensions in the
context on every call (150,000 rows per query).

There are two ways to fix this;

The one we did, use the application command realtime() to pull the
record from a database based on napnxx and then use gotoif to route to
the lowest cost provider in that records (realtime must be used on a
unique index so ONLY 1 row is retruned). We are testing upgrading this
to mysql 5 where a view could be used to eliminate the gotoif. With the
gotoif and 2 carriers per npa nxx it is fast. Realtime() can only do
simple queries as of right now, so views would be a huge plus.

The other option I know others are using is to get the route via an agi
script.

Bottom line, YOU CAN NOT load all 150,000 NPA/NXX pattern matches in
asterisk via text file or realtime and expect acceptable performance,
YOU MUST use a database query solution to get only info you need to *

BTW - for $5/mo you can have access to a reasonably well maintained
complete listing of NPA/NXX/OCN/CLLI/ADDRESS, ETC.

https://www.telcodata.us/secure/account/signup (no affiliation)

___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx,

2005-09-21 Thread Joe Greco
   On a related note, I wanted our phones to display city, st for the
   caller-ID name in the event that none was provided.
  
  Interesting code.  What sort of memory does * take up when you load up
  all those CLID values?
 
 I am a little late to this thread, but the answer is WAY TO MUCH.
 
 With 150,000 pattern match extensions * takes a very long time to
 reload, during which time calls do not proceed.

pbx*CLI !date
Thu Sep 22 00:33:50 CDT 2005
pbx*CLI reload
[snip lots of junk]
pbx*CLI !date
Thu Sep 22 00:33:54 CDT 2005

Ohhhkay, then, the entire four seconds it took this ancient Pentium Pro 200
to reload is... _maybe_ ... a second longer than it did before, and that's
really giving it the benefit of the doubt.

 If you use Realtime MySQL it pulls in ALL patter match extensions in the
 context on every call (150,000 rows per query).

Using pattern matching would be a bit retarded.  Databases work so much
better when you give them a key and they only need to do a single lookup.
I'm not sure what better key you could have than the npa-nxx itself, so
that's what I used...

 There are two ways to fix this;
 
 The one we did, use the application command realtime() to pull the
 record from a database based on napnxx and then use gotoif to route to
 the lowest cost provider in that records (realtime must be used on a
 unique index so ONLY 1 row is retruned). We are testing upgrading this
 to mysql 5 where a view could be used to eliminate the gotoif. With the
 gotoif and 2 carriers per npa nxx it is fast. Realtime() can only do
 simple queries as of right now, so views would be a huge plus.
 
 The other option I know others are using is to get the route via an agi
 script.
 
 Bottom line, YOU CAN NOT load all 150,000 NPA/NXX pattern matches in
 asterisk via text file or realtime and expect acceptable performance,
 YOU MUST use a database query solution to get only info you need to *

Then perhaps you should inspect the code that we were discussing, eh.
It's a quick, simple hack, to be sure, but it certainly seems to offer
acceptable performance using the built-in database (and Berkeley DB v1
ain't the most wonderful thing around, but it definitely *works*).

... JG
-- 
Joe Greco - sol.net Network Services - Milwaukee, WI - http://www.sol.net
We call it the 'one bite at the apple' rule. Give me one chance [and] then I
won't contact you again. - Direct Marketing Ass'n position on e-mail spam(CNN)
With 24 million small businesses in the US alone, that's way too many apples.
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx, ratecenters, etc (attached)

2005-09-19 Thread Kurth Bemis

Since we are all trading secrets, check this site out

http://members.dandy.net/~czg/lca_index.php

I used to use this site DAILY when I owned an ISP.  Now we have mostly 
moved away from dialup, but I still use it once and a while.


Enjoy!
~kurth

___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx, ratecenters, etc (attached)

2005-09-19 Thread Joel Vandal

Hi,

- Original Message - 

Since we are all trading secrets, check this site out

http://members.dandy.net/~czg/lca_index.php



You can get this Perl scripts that extract NPA-NXX directly from 
dandy.net...


http://www.voip-info.org/tiki-index.php?page=ScopServ%20LCA%20Map

--
Joel Vandal
ScopServ Inc.

___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx,

2005-09-19 Thread Joe Greco
 - Original Message - 
  Since we are all trading secrets, check this site out
 
  http://members.dandy.net/~czg/lca_index.php
 
 
 You can get this Perl scripts that extract NPA-NXX directly from 
 dandy.net...
 
 http://www.voip-info.org/tiki-index.php?page=ScopServ%20LCA%20Map

On a related note, I wanted our phones to display city, st for the
caller-ID name in the event that none was provided.

% cat jg-npanxx-loader.sh
#! /bin/sh -
#
# NPA-NXX data is at http://www.nanpa.com/reports/reports_cocodes_assign.html
# specifically http://www.nanpa.com/nanp1/allutlzd.zip
#
# It would be nice if our phones could show NPA-NXX in the event CallerID
# Name was empty.
#
(awk -F'' '{print $2, $5, $1}'  allutlzd.txt | tail +2 | sed 
's:^\([0-9]*\)-\([0-9]*\):\1\2:;s:^\([0-9]*\)  :\1 UNKNOWN:;s: * \(..\) $:, 
\1:g; s:^\([0-9]*\) \(.*\):database put znpanxx \1 \2:' )| (
while read line; do
/pbx/usr/sbin/asterisk -rx ${line}
done
)

That'll load up the database with entries like

/znpanxx/201863   : UNION CITY, NJ
/znpanxx/201864   : UNION CITY, NJ
/znpanxx/201865   : UNION CITY, NJ
/znpanxx/201866   : UNION CITY, NJ
/znpanxx/201867   : UNION CITY, NJ
/znpanxx/201868   : UNION CITY, NJ
/znpanxx/201869   : UNION CITY, NJ

Then you merely have something like

% cat extensions.conf
[...]

[macro-set-cidn-npanxx]
exten=s,1,SetVar(npanxxsearch=unknown)
exten=s,2,GotoIf($[${LEN(${ARG1})} = 10]?3:5)
exten=s,3,SetVar(npanxxsearch=${ARG1:0:5})
exten=s,4,Goto(7)
exten=s,5,GotoIf($[${LEN(${ARG1})} = 11]?6:7)
exten=s,6,SetVar(npanxxsearch=${ARG1:1:6})
exten=s,7,GotoIf($[${LEN(${CALLERIDNAME})} = 0]?10:8)
exten=s,8,DBget(npanxx=znpanxx/${npanxxsearch}) ; Get NPA-NXX.  If none, go to 
109.
exten=s,9,SetCIDName(${npanxx})
exten=s,10,NoOp(CALLERID=${CALLERID} LEN ARG1 = ${LEN(${ARG1})})
exten=s,109,SetVar(npanxx=Unknown ${ARG1});
exten=s,110,Goto(9)

[...]

[an-incoming-context]
[...]
exten = s,4,Macro(set-cidn-npanxx, ${CALLERIDNUM}) ; Set NPANXX CID
exten = s,5,LookupCIDName  ; Look up Caller-ID name in database
[...]

so that LookupCIDName will still override this.

Yeah, it bloats the built-in database by quite a bit, but it was cheap and
easy, and seems to work for the small number of cases where we don't have
a caller's name in the cidname database.  It is not particularly rigorous
and there are obviously other ways to do it.

It is also worth noting that some of the city names show up as other stuff,
like this:

/znpanxx/414973   : MILWAUKZN4, WI
/znpanxx/414974   : MILWAUKZN3, WI
/znpanxx/414975   : MILWAUKZN1, WI
/znpanxx/414976   : MILWAUKZN5, WI

which is mildly confusing to non-telephony folks, but still better than
not getting anything at all, IMHO.

... JG
-- 
Joe Greco - sol.net Network Services - Milwaukee, WI - http://www.sol.net
We call it the 'one bite at the apple' rule. Give me one chance [and] then I
won't contact you again. - Direct Marketing Ass'n position on e-mail spam(CNN)
With 24 million small businesses in the US alone, that's way too many apples.
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx,

2005-09-19 Thread Nathan Pralle

On a related note, I wanted our phones to display city, st for the
caller-ID name in the event that none was provided.


Interesting code.  What sort of memory does * take up when you load up 
all those CLID values?


Nathan

___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Complete NPA-NXX list for USA/Canada npanxx,

2005-09-19 Thread Joe Greco
  On a related note, I wanted our phones to display city, st for the
  caller-ID name in the event that none was provided.
 
 Interesting code.  What sort of memory does * take up when you load up 
 all those CLID values?

I would think they'd be stored in the database, not in memory.  However,
it isn't exactly a huge amount of data.  It amounted to maybe ~10MB of
space in the database.

... JG
-- 
Joe Greco - sol.net Network Services - Milwaukee, WI - http://www.sol.net
We call it the 'one bite at the apple' rule. Give me one chance [and] then I
won't contact you again. - Direct Marketing Ass'n position on e-mail spam(CNN)
With 24 million small businesses in the US alone, that's way too many apples.
___
--Bandwidth and Colocation sponsored by Easynews.com --

Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users