Can anyone shed some light on "rules" that might make the task of parsing the country code and city codes from a dialed number in the CDRs? I know that there is almost never a case where a concatenated country and city code could overlap with another country code, but what about city codes and local numbers? Is it possible for a concatenated city code and local number to match another city code in the same country? I already have the table of country and city codes built. Are there holes in this theory; 1. Starting after the international dialing code, find the longest match for country code. 2. Starting after the country code from step 1, find the longest match for city code within that countries table of city codes. 3. The rest is the local number. Are there known exceptions? Am I reinventing the wheel rather than finding the right already existing resource?
What you're trying to accomplish can be easily done with an SQL query. You need to create a table of all the prefixes (international dial+country code+city/carrier) and join by that prefix. On 1/27/06, Damon Estep <damon@suburbanbroadband.net> wrote:> > Can anyone shed some light on "rules" that might make the task of > parsing the country code and city codes from a dialed number in the > CDRs? > > I know that there is almost never a case where a concatenated country > and city code could overlap with another country code, but what about > city codes and local numbers? Is it possible for a concatenated city > code and local number to match another city code in the same country? > > I already have the table of country and city codes built. > > Are there holes in this theory; > > 1. Starting after the international dialing code, find the longest match > for country code. > 2. Starting after the country code from step 1, find the longest match > for city code within that countries table of city codes. > 3. The rest is the local number. > > Are there known exceptions? > > Am I reinventing the wheel rather than finding the right already > existing resource? > > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > Asterisk-Users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060127/c388a180/attachment.htm
Agreed, that is what I plan to do, but do you know if the numbering plans are such that a countrycode+citycode+"portion of a local number" could ever be mistaken for a different country/city combination? Since international numbers vary in length, and country and city codes vary in length, there is no way to be sure unless the numbering plan is such that no combination of citycode plus the start of the local number could ever be mistaken for a different city code in the same country. Likewise, there has to be assurance that no combination of countrycode+start of city code could be mistaken for another country code. D ________________________________ From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Script Head Sent: Friday, January 27, 2006 3:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] OT?: International number parsing What you're trying to accomplish can be easily done with an SQL query. You need to create a table of all the prefixes (international dial+country code+city/carrier) and join by that prefix. On 1/27/06, Damon Estep <damon@suburbanbroadband.net> wrote: Can anyone shed some light on "rules" that might make the task of parsing the country code and city codes from a dialed number in the CDRs? I know that there is almost never a case where a concatenated country and city code could overlap with another country code, but what about city codes and local numbers? Is it possible for a concatenated city code and local number to match another city code in the same country? I already have the table of country and city codes built. Are there holes in this theory; 1. Starting after the international dialing code, find the longest match for country code. 2. Starting after the country code from step 1, find the longest match for city code within that countries table of city codes. 3. The rest is the local number. Are there known exceptions? Am I reinventing the wheel rather than finding the right already existing resource? _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060127/b6a3806a/attachment.htm
Have you seen situations where a portion of the local number, when added to the country and city code, result in a longer match then the actual country/city called and therefore an inaccurate match? ________________________________ From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Ron hotmail Sent: Friday, January 27, 2006 8:17 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] OT?: International number parsing It realy is a pain in the *ss. the problem is just how you explained. when trying to match the terminating number, there's no SINGLE fixed pattern for the dialcodes. so how do you know how many digits of the term number to match against the dialcode? you dont. you have to match the dialcodes against the termnumbers then order by lenght of dialcode (matched) and take the first record as the most accurate. (most digits)..... R ----- Original Message ----- From: Damon Estep <mailto:damon@suburbanbroadband.net> To: Asterisk Users Mailing List - Non-Commercial Discussion <mailto:asterisk-users@lists.digium.com> Sent: Friday, January 27, 2006 6:32 PM Subject: RE: [Asterisk-Users] OT?: International number parsing Agreed, that is what I plan to do, but do you know if the numbering plans are such that a countrycode+citycode+"portion of a local number" could ever be mistaken for a different country/city combination? Since international numbers vary in length, and country and city codes vary in length, there is no way to be sure unless the numbering plan is such that no combination of citycode plus the start of the local number could ever be mistaken for a different city code in the same country. Likewise, there has to be assurance that no combination of countrycode+start of city code could be mistaken for another country code. D ________________________________ From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Script Head Sent: Friday, January 27, 2006 3:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [Asterisk-Users] OT?: International number parsing What you're trying to accomplish can be easily done with an SQL query. You need to create a table of all the prefixes (international dial+country code+city/carrier) and join by that prefix. On 1/27/06, Damon Estep <damon@suburbanbroadband.net> wrote: Can anyone shed some light on "rules" that might make the task of parsing the country code and city codes from a dialed number in the CDRs? I know that there is almost never a case where a concatenated country and city code could overlap with another country code, but what about city codes and local numbers? Is it possible for a concatenated city code and local number to match another city code in the same country? I already have the table of country and city codes built. Are there holes in this theory; 1. Starting after the international dialing code, find the longest match for country code. 2. Starting after the country code from step 1, find the longest match for city code within that countries table of city codes. 3. The rest is the local number. Are there known exceptions? Am I reinventing the wheel rather than finding the right already existing resource? _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ________________________________ _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060127/cd312ada/attachment.htm