PPCGeeks

PPCGeeks (http://forum.ppcgeeks.com/index.php)
-   Windows Mobile Software (http://forum.ppcgeeks.com/forumdisplay.php?f=23)
-   -   Lookup City based on Caller ID (http://forum.ppcgeeks.com/showthread.php?t=50897)

auto_exec 12-28-2008 10:09 PM

Lookup City based on Caller ID
 
2 Attachment(s)
Hey all,

Let me start by saying that I'm not much of a developer (I deal with old school RPG on as/400s, and have dabbled with VB before, but that doesn't really count)... What I did here was to use some of the source code from this thread:

http://forum.xda-developers.com/showthread.php?t=424923
Original developer is Sveinung Bakken, his app is called CallerUtility.

As I was saying... since I'm not very familiar with WM6 dev and/or the various languages, I used the source code he posted that reacts on incoming calls/SMS and outgoing calls... I then removed all code related to doing the online database lookups (since Sprint won't let us do that during a call -- can't do voice and data simultaneously) and instead coded the app to parse out the area code of the incoming/outgoing communication and do a lookup in our registry (key HKEY_LOCAL_MACHINE\Software\HTC\PHONE\AreaCode).

To summarize: When you make or receive a call (or receive an SMS) from a caller that's not in your contacts, the app will look up the area code and display the state the call is coming from/going to on your screen. Here's a screenshot of how it looks when you have an unknown incoming call:


http://imgburst.com/up/312shot4Xmp.PNG


Please test this out and let me know if it works ok (all my tests so far have been successful)... I'm always open to comments/complaints/etc, so feel free to give any feedback.

Thanks!!

(FYI - This app installs to directory \Program Files\AreaCodeUtility\ and adds shortcuts to \Windows\Start Menu\Programs\ and to \Windows\Startup\)


Edit: Looks like this may require WM6 and .NET 3.5... not 100% sure yet. Would like WM5 users to test, one reports good results. :)

Update : it seems some people may not have the registry key with the area code -> state cross reference.... I've attached to this post so that you can import if you want.

nobrakes 12-28-2008 10:22 PM

Re: Lookup City based on Caller ID
 
i got an unexpeceted error.

auto_exec 12-28-2008 10:36 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by nobrakes (Post 605241)
i got an unexpeceted error.

Sorry, do you have .NET Framework 3.5 installed? I think it's required... Found this link from a post by BigDiesel07 on where you can get it: http://misc.baf.cc/NETCFv35.wm.armv4i.cab

nobrakes 12-28-2008 10:48 PM

Re: Lookup City based on Caller ID
 
i installed net 3.5 and it still didn't work. I'm on a Sprint touch

auto_exec 12-28-2008 10:51 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by nobrakes (Post 605283)
i installed net 3.5 and it still didn't work. I'm on a Sprint touch

Hmm.. are you running WM6? Sorry, I'm not great on what the requirements might be as I'm not really familiar with the various .dll files and system calls used, etc... I installed on a Sprint Touch Pro running WM6 and .NET 3.5.

Can you also check to make sure that your phone has the registry key: HKEY_LOCAL_MACHINE\Software\HTC\PHONE\AreaCode

Not sure if that's a Sprint-only thing, or what. As more people test, I can update the post with full requirements.... anybody's input is welcome.

payback 12-28-2008 11:41 PM

Re: Lookup City based on Caller ID
 
Im running 5.0 and it works just fine. THANKS.....Now this really outweighs the instinct

auto_exec 12-28-2008 11:48 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by payback (Post 605364)
Im running 5.0 and it works just fine. THANKS.....Now this really outweighs the instinct

Thanks for the feedback, let me know if you run into any issues, or have any suggestions on code changes, etc. I'm not an awesome developer, but I can probably get some stuff to work. :)

freeza 12-29-2008 12:37 PM

Re: Lookup City based on Caller ID
 
What about for numbers in your contact list?

dallas contractor 12-29-2008 02:22 PM

Re: Lookup City based on Caller ID
 
If you search this has been in several other post

3boos 12-29-2008 03:54 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by auto_exec (Post 605221)
Hey all,

Let me start by saying that I'm not much of a developer (I deal with old school RPG on as/400s, and have dabbled with VB before, but that doesn't really count)... What I did here was to use some of the source code from this thread:

http://forum.xda-developers.com/showthread.php?t=424923
Original developer is Sveinung Bakken, his app is called CallerUtility.

As I was saying... since I'm not very familiar with WM6 dev and/or the various languages, I used the source code he posted that reacts on incoming calls/SMS and outgoing calls... I then removed all code related to doing the online database lookups (since Sprint won't let us do that during a call -- can't do voice and data simultaneously) and instead coded the app to parse out the area code of the incoming/outgoing communication and do a lookup in our registry (key HKEY_LOCAL_MACHINE\Software\HTC\PHONE\AreaCode).

To summarize: When you make or receive a call (or receive an SMS) from a caller that's not in your contacts, the app will look up the area code and display the state the call is coming from/going to on your screen.

Please test this out and let me know if it works ok (all my tests so far have been successful)... I'm always open to comments/complaints/etc, so feel free to give any feedback.

Thanks!!

(FYI - This app installs to directory \Program Files\AreaCodeUtility\ and adds shortcuts to \Windows\Start Menu\Programs\ and to \Windows\Startup\)



Edit: Looks like this may require WM6 and .NET 3.5... not 100% sure yet. Would like WM5 users to test, one reports good results. :)

Quote:

Originally Posted by auto_exec (Post 605269)
Sorry, do you have .NET Framework 3.5 installed? I think it's required... Found this link from a post by BigDiesel07 on where you can get it: http://misc.baf.cc/NETCFv35.wm.armv4i.cab


Worked for me, I am running WM 6.1 and it in deed do need the .NET to work, thanks.

But any way to fix the original cab, and pull the info online, this way we can have the city too? JUST a suggestion.

nobrakes 12-29-2008 03:59 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by auto_exec (Post 605288)
Hmm.. are you running WM6? Sorry, I'm not great on what the requirements might be as I'm not really familiar with the various .dll files and system calls used, etc... I installed on a Sprint Touch Pro running WM6 and .NET 3.5.

Can you also check to make sure that your phone has the registry key: HKEY_LOCAL_MACHINE\Software\HTC\PHONE\AreaCode

Not sure if that's a Sprint-only thing, or what. As more people test, I can update the post with full requirements.... anybody's input is welcome.

I'm running JD gps2.1 rom. It's a wm6.1 rom. It doesnt have that reg key. I'm using this rom because it's the only wm6.1 rom I've tried that SRS WoW HD will work. Thanks

Hafrust 12-29-2008 04:05 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by dallas contractor (Post 606288)
If you search this has been in several other post

The only other one I remember was one where it required you to disable the HTC dialer. It would be helpful if you post links instead of just mentioning that there are others already out there.

auto_exec 12-29-2008 04:09 PM

Re: Lookup City based on Caller ID
 
1 Attachment(s)
Quote:

Originally Posted by nobrakes (Post 606499)
I'm running JD gps2.1 rom. It's a wm6.1 rom. It doesnt have that reg key. I'm using this rom because it's the only wm6.1 rom I've tried that SRS WoW HD will work. Thanks

Hey.. sorry to hear that this isn't working for you... I've attached the missing reg key here (it's just an area code -> state cross reference)... you should be able to import this into your reg and then the app should work.

I'll also add this to first post in case other people need it ... Let me know if that fixes it for ya.

auto_exec 12-29-2008 04:11 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by freeza (Post 606011)
What about for numbers in your contact list?

People in your contact list will not cause this app to pop up (it's assumed that, since you have them in your contact list, you don't need to know what state their number is from). Would also be pretty annoying to have this pop up every time you make a call (in my opinion).

To clarify, people in your contact list will have their info show up on your caller ID as usual, this app will NOT create a pop-up.

auto_exec 12-29-2008 04:13 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by Tripdub1 (Post 606512)
The only other one I remember was one where it required you to disable the HTC dialer. It would be helpful if you post links instead of just mentioning that there are others already out there.

Agreed... that was the only other solution I'd seen and, even with that, I think there were some people reporting that it still didn't work.... thus I tweaked the CallerUtility by Sveinung Bakken to use the reg key (since Sprint won't allow us a simultaneous data and voice conneciton).

That said, I believe Sveinung Bakken's app DOES work if you ignore the call or let it ring through... that is, it'll do the data lookup after the call finishes, I think. It's pretty cool, but I wanted something that would let me have an idea of who's calling before I decided to answer or not.

cenatix 12-29-2008 10:32 PM

Re: Lookup City based on Caller ID
 
What's the best way to import the registry keys?

auto_exec 12-29-2008 10:50 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by cenatix (Post 607121)
What's the best way to import the registry keys?

You should be able to use PHM registry editor or Resco Registry to Import a key.

cenatix 12-29-2008 11:18 PM

Re: Lookup City based on Caller ID
 
Alright, I'll download Resco in a bit. The "Import" menu is grayed out in PHM so no go with that.

hippity.hoppity 12-30-2008 12:26 AM

Re: Lookup City based on Caller ID
 
Working great on my Mogul. Nice little program.

briggs 12-30-2008 01:46 AM

Re: Lookup City based on Caller ID
 
quick question:

Will this area code database work for canada as well? This would be a nice feature for my diamond.

Also, if I have a dialer skin installed, will they interfer with each other?

Thanks

auto_exec 12-30-2008 02:20 AM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by briggs (Post 607591)
quick question:

Will this area code database work for canada as well? This would be a nice feature for my diamond.

Also, if I have a dialer skin installed, will they interfer with each other?

Thanks


<EDITED>: Didn't realize other area codes were included, see my post below. Canada will work.


This shouldn't interfere with dialer skins at all, as it's a standalone app that gets triggered based on incoming/outgoing communications.

auto_exec 12-30-2008 02:39 AM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by auto_exec (Post 607657)
Hmm.. by default, this won't work for Canada.. it should pop up with "State: Area code not found." for anything not in the reg file I attached in the first post (since the reg file I've attached only has the US area codes/states cross-referenced). That said, if you were to add new String values in that same key (HKLM/Software/HTC/PHONE/AreaCode) with Name = 3-digit area code and String = area, it should read it with no problem.

If you could point me to a website or listing of area codes to areas, I could probably get that set up in a reg file ready for import... I'll do some looking around on my own as well, maybe I can build my own listing of area codes, etc, to cover more places if I have time.

This shouldn't interfere with dialer skins at all, as it's a standalone app that gets triggered based on incoming/outgoing communications.

I was wrong! Looking at the reg file, it DOES have Canadian area codes. Should be all good! :)

edraven 01-15-2009 01:10 AM

Re: Lookup City based on Caller ID
 
It shouldn't be too hard to modify the .reg file to make this a little more specific, instead of just showing the state.

ie. 415 isn't the entire state of California, it's mainly just San Francisco & Marin Counties. (see http://www.bennetyee.org/ucsd-pages/area.html or several other lists)

My question is, how will this app handle all the extra text? Would it be hard to modify the app to show both the state and area descriptions on separate lines?

auto_exec 01-15-2009 01:23 AM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by edraven (Post 641274)
It shouldn't be too hard to modify the .reg file to make this a little more specific, instead of just showing the state.

ie. 415 isn't the entire state of California, it's mainly just San Francisco & Marin Counties. (see http://www.bennetyee.org/ucsd-pages/area.html or several other lists)

My question is, how will this app handle all the extra text? Would it be hard to modify the app to show both the state and area descriptions on separate lines?

I'd actually started researching this a bit after I first posted... looked at the NANPA database, etc... if we could find a good list with reasonable patterned descriptions (i.e. a description that would be easily parse-able), it wouldn't be hard to update the app... I was planning on removing the "Unknown number" line at the top of the form (since it's somewhat redundant as your incoming call screen shows it anyways) and maybe just making it a one-liner with the state/area info.

Eventually I'd like to just have an external database file that the program will read from... I've been looking around for a good source database (ideally one that has city/state info instead of just state), but the only free one with city/state info that I could find online was:

http://www.wcisd.hpc.mil/~phil/npanxx/npanxx99.txt

Problem with the above file is that it's from 1999 (and so it's out-of-date). If anyone has suggestions or finds a good database file to use, feel free to post here or PM me... I'd be more than happy to give it a shot.

edraven 01-15-2009 11:41 AM

Re: Lookup City based on Caller ID
 
Ah, yeah, using Area code + prefix is way better than what I was proposing. From your '99 list, going up one dir, and clicking one of the links on that page led me to this:

http://www.nanpa.com/reports/reports...es_assign.html

Which contains this:
http://www.nanpa.com/nanp1/allutlzd.zip

Which has all states, area code, prefix, *provider*, and city.

Doesn't look too hard to parse either, I may give it a shot if I get some free time today, but of course you'd still have to modify your app to accept it.

auto_exec 01-15-2009 12:04 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by edraven (Post 641834)
Ah, yeah, using Area code + prefix is way better than what I was proposing. From your '99 list, going up one dir, and clicking one of the links on that page led me to this:

http://www.nanpa.com/reports/reports...es_assign.html

Which contains this:
http://www.nanpa.com/nanp1/allutlzd.zip

Which has all states, area code, prefix, *provider*, and city.

Doesn't look too hard to parse either, I may give it a shot if I get some free time today, but of course you'd still have to modify your app to accept it.

Great catch! I was on the NANPA site, but somehow I missed this page... I can probably try to incorporate this file/data when I get home from work today... shouldn't be too hard. Maybe I can even add settings options where you can choose what you want displayed (i.e. state only, city/state, city/state/provider).


Update: I also found a similar file for Canada on this page http://www.cnac.ca/co_codes/co_code_status_map.htm, direct link to file is http://www.cnac.ca/data/NPANXX.zip...

edraven 01-15-2009 05:39 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by edraven (Post 641834)
Doesn't look too hard to parse either

awk gets you most of the way there, this is for a CSV output:

cat allutlzd.txt |awk -F"\t" '{print $1","$2","$4","$5}'

output is like this:

AK ,907-200,"ACS WIRELESS, INC." ,VALDEZ
AK ,907-209,"DOBSON CELLULAR SYSTEMS, INC." ,JUNEAU

but of course you'll want to modify it to output in .reg format...

something like this maybe?

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\]

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5]

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5\343]
"Company"="MCI WORLDCOM COMMUNICATIONS, INC., CA"
"RateCenter"="SNFC CNTRL"
"State"="CA"

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5\344]
"Company"="PACIFIC BELL"
"RateCenter"="SNFC CNTRL"
"State"="CA"

auto_exec 01-15-2009 06:11 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by edraven (Post 642934)
awk gets you most of the way there, this is for a CSV output:

cat allutlzd.txt |awk -F"\t" '{print $1","$2","$4","$5}'

output is like this:

AK ,907-200,"ACS WIRELESS, INC." ,VALDEZ
AK ,907-209,"DOBSON CELLULAR SYSTEMS, INC." ,JUNEAU

but of course you'll want to modify it to output in .reg format...

something like this maybe?

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\]

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5]

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5\343]
"Company"="MCI WORLDCOM COMMUNICATIONS, INC., CA"
"RateCenter"="SNFC CNTRL"
"State"="CA"

[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\PHONE\AreaCode\\41 5\344]
"Company"="PACIFIC BELL"
"RateCenter"="SNFC CNTRL"
"State"="CA"

Actually I was just thinking of leaving it in a physical file that would install in the pgm directory... the program would then parse through the file to find required info... this way people dont have to mess with their registry, and they can update the file if they need to/want to... ;)

edraven 01-15-2009 06:43 PM

Re: Lookup City based on Caller ID
 
That'd probably be better, but if you change your mind, I just finished the script. This uses TCL.

#!/usr/bin/tclsh

set f [open allutlzd.txt r]

puts "Windows Registry Editor Version 5.00"

while {[gets $f line] != -1} {
set field [split $line "\t" ]
set tmp [split [lindex $field 1] -]

set state [string trim [lindex $field 0]]
set areaCode [string trim [lindex $tmp 0]]
set prefix [string trim [lindex $tmp 1]]
set company [string trim [lindex $field 3]]
regsub -all {"} $company {} company
set rateCenter [string trim [lindex $field 4]]

#puts "$areaCode $prefix $company $rateCenter $state"
if {[regexp {[0-9]{3}} $areaCode]} {
puts "
\[HKEY_LOCAL_MACHINE\\SOFTWARE\\HTC\\PHONE\\AreaCode \\\\$areaCode\\$prefix\\]
\"Company\"=\"$company\"
\"RateCenter\"=\"$rateCenter\"
\"State\"=\"$state\"
"
}

}

close $f

joeykrim 01-23-2009 12:44 PM

Re: Lookup City based on Caller ID
 
Quote:

Originally Posted by auto_exec (Post 643016)
Actually I was just thinking of leaving it in a physical file that would install in the pgm directory... the program would then parse through the file to find required info... this way people dont have to mess with their registry, and they can update the file if they need to/want to... ;)

i really like this program. i hope you can make the update to remove the unknown caller line since it is redundant. also one bug ive found is on the touch pro, when i have the keyboard slide out the screen is in landscape mode. when i receive a text or call from an unknown caller in landscape mode it doesnt appear correctly on the screen. it makes a small rectangular box. when i put the keyboard back in, whether during the call or 10 min later, and the screen changes to portrait mode the program then pops up with the information and i have to hit hide.

hopefully that makes sense, it just doesnt appear correctly in landscape mode. let me know if i can help! :)

Chronic Chinito 06-03-2010 08:48 PM

Re: Lookup City based on Caller ID
 
Anyone else having problems with SMS after installing this program? Running it on a TP2

drewcam888 06-04-2010 04:17 PM

Re: Lookup City based on Caller ID
 
The tp2 has a built in database in the dialer for area codes. http://forum.ppcgeeks.com/showthread.php?t=115496


All times are GMT -4. The time now is 04:07 AM.

Powered by vBulletin® ©2000 - 2025, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com


Content Relevant URLs by vBSEO 3.6.0