Table of Contents
List of Examples
path
parametergeoip_match
usageTable of Contents
This module allows real-time queries against the Max Mind GeoIP database to be performed from the config script.
The Max Mind GeoIP database is a map of IP network address assignments to geographical locales that can be useful -- though approximate -- in identifying the physical location with which an IP host address is associated on a relatively granular level.
This database itself can be obtained on a free or commercial basis from http://www.maxmind.com/app/ip-location. The library that interfaces with the Max Mind API, as well as scripts to automate downloading of the on-disk version of the open-source database is also packaged by the Debian Linux distribution and its derivatives as libgeoip, and probably by other distributions as well.
Debian Linux squeeze includes already a database as dependency, but as this contain the wrong data, it will not work correctly with the module. More acurate, the module expect the GeoIP City Edition, and will not work with the GeoIP Country Edition. In newer Debian Linux releases the package geoip-database-contrib should contain the necessary database. You can download the Lite edition of the DB from http://www.maxmind.com/app/geolitecity.
This module exports a new class of pseudo-variables - $gip(pvc=>key) - to enable access to the results of a query to the database.
Many queries can be done and store results in different containers to be able to use in parallel. Database is loaded at startup in cache.
$gip(pvc=>key) - pvc is an identifier for this query result; it is designated by the second parameter of geoip_match(). The key can be one of the following:
cc - country code
tz - time zone
zip - postal code
lat - latitude
lon - longitude
dma - dma code
ips - ip start
ipe - ip end
city - city
area - area code
regc - region
regn - region name
metro - metro code
Exported pseudo-variables are documented at http://www.kamailio.org/dokuwiki/.