You’ll need access to a geocoding database that includes phone numbers for Land Lines. For cell calls, you’ll need access to the companies’ proprietary databases and APIs, assuming the phone allows location pinpointing. If the phone’s location is not turned on, you’ll end up having to look up the phone’s city from the geocoding database.
Most of this information is available at $0.05 per lookup from several sources.
So, now you want us to help you write the application too?
PHP-AGI is probably a good choice, that will require you to use a PHP script on the server, which then will have to access the geocoding databases through the Internet.
Almost all of the program you are writing is outside the scope of Asterisk - the only thing that will happen on the Asterisk/FreePBX side is the instantiation of the PHP program. After that, you’re on your own as far as how you want the pop-up to work.
Any of the methods you described will work. I’d start from the programming language of choice and go with the “API” that is most appropriate. I’m a PHP guy so the PHP-AGI makes sense to me, but once you get into it, you’ll see they all provide (more or less) the same level of control. Almost all of them let you interface through the AMI interface, which can give you all the active call information you could want.