<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:st1 =
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><o:SmartTagType downloadurl="http://www.microsoft.com"
name="PersonName"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if !mso]>
<STYLE>
st1\:*{behavior:url(#default#ieooui) }
</STYLE>
<![endif]-->
<STYLE>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=blue link=blue bgColor=#ffffff>
<DIV><FONT face=Arial size=2>It realy is a pain in the *ss.</FONT></DIV>
<DIV><FONT face=Arial size=2>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).....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>R</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=damon@suburbanbroadband.net
href="mailto:damon@suburbanbroadband.net">Damon Estep</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=asterisk-users@lists.digium.com
href="mailto:asterisk-users@lists.digium.com">Asterisk Users Mailing List -
Non-Commercial Discussion</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, January 27, 2006 6:32
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Asterisk-Users] OT?:
International number parsing</DIV>
<DIV><BR></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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?<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">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.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Likewise, there has
to be assurance that no combination of countrycode+start of city code could be
mistaken for another country code.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">D<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT
face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Script Head<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 27, 2006 3:47
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> <st1:PersonName
w:st="on">Asterisk Users Mailing List - Non-Commercial
Discussion</st1:PersonName><BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [Asterisk-Users] OT?:
International number parsing</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt">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.<BR><BR><BR><BR><o:p></o:p></SPAN></FONT></P>
<DIV>
<P class=MsoNormal><SPAN class=gmailquote><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt">On 1/27/06, <st1:PersonName
w:st="on"><B><SPAN style="FONT-WEIGHT: bold">Damon
Estep</SPAN></B></st1:PersonName> <<A
href="mailto:damon@suburbanbroadband.net">damon@suburbanbroadband.net</A>>
wrote:</SPAN></FONT></SPAN><o:p></o:p></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Can anyone shed some light on "rules" that might make
the task of<BR>parsing the country code and city codes from a dialed number in
the<BR>CDRs?<BR><BR>I know that there is almost never a case where a
concatenated country <BR>and city code could overlap with another country
code, but what about<BR>city codes and local numbers? Is it possible for a
concatenated city<BR>code and local number to match another city code in the
same country?<BR><BR>I already have the table of country and city codes
built.<BR><BR>Are there holes in this theory;<BR><BR>1. Starting after the
international dialing code, find the longest match<BR>for country code.<BR>2.
Starting after the country code from step 1, find the longest match <BR>for
city code within that countries table of city codes.<BR>3. The rest is the
local number.<BR><BR>Are there known exceptions?<BR><BR>Am I reinventing the
wheel rather than finding the right already<BR>existing resource?
<BR><BR><BR>_______________________________________________<BR>--Bandwidth and
Colocation provided by <A href="http://Easynews.com">Easynews.com</A>
--<BR><BR>Asterisk-Users mailing list<BR>To UNSUBSCRIBE or update options
visit: <BR> <A
href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A><o:p></o:p></SPAN></FONT></P></DIV>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P></DIV></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>--Bandwidth and
Colocation provided by Easynews.com --<BR><BR>Asterisk-Users mailing
list<BR>To UNSUBSCRIBE or update options visit:<BR>
http://lists.digium.com/mailman/listinfo/asterisk-users<BR></BLOCKQUOTE></BODY></HTML>