Table of Contents
List of Tables
List of Examples
This module is a lightweight wrapper for the MaxMind GeoIP API. It adds IP address-to-location lookup capability to OpenSIPS scripts.
Lookups are executed against the freely-available GeoLite City database; and the non-free GeoIP City database is drop-in compatible. All lookup fields provided by the API are accessible by the script. Visit the MaxMind website for more information on the location databases.
The following modules must be loaded before this module:
No dependencies on other OpenSIPS modules.
Path to either a GeoLite or GeoIP City database file.
Mandatory parameter.
Example 1.1. Set “mmgeoip_city_db_path” parameter
... modparam("mmgeoip", "mmgeoip_city_db_path", "/usr/share/GeoIP/GeoLiteCity.dat") ...
Databse memory caching options. The following options are available:
STANDARD - Read database from file system; least memory used;
MMAP_CACHE - Load database into mmap allocated memory;
WARNING: this option will cause a segmentation fault if database file is changed at runtime!
MEM_CACHE_CHECK - Load database into memory; this mode checks for database updates; if database was modified, the file will be reloaded after 60 seconds; it will be slower than MMAP_CACHE but it will allow reloads;
Default value for this parameter is MMAP_CACHE.
Looks up specified field
s associated with IP address
specified by the src
. The resulting data are
loaded in reverse order into
the dst
AVP.
src
can be a pseudo-variable or AVP;
and dst
must be an AVP.
fields
defaults to "lon:lat," and is a
colon-delimited list of these elements:
lat
Latitude
lon
Longitude
cont
Continent
cc
Country Code
reg
Region
city
City
pc
Postal Code
dma
DMA Code
ac
Area Code
TZ
Time Zone
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE,ERROR_ROUTE, and LOCAL_ROUTE.
Example 1.3. mmg_lookup
usage
... if(mmg_lookup("lon:lat","$si","$avp(lat_lon)")) { xlog("L_INFO","Source IP latitude:$(avp(lat_lon)[0])\n"); xlog("L_INFO","Source IP longitude:$(avp(lat_lon)[1])\n"); }; ...
Table 2.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
Name | DevScore | Commits | Lines ++ | Lines -- | |
---|---|---|---|---|---|
1. | Bogdan-Andrei Iancu (@bogdan-iancu) | 10 | 8 | 31 | 24 |
2. | Kobi Eshun (@ekobi) | 8 | 3 | 480 | 4 |
3. | Razvan Crainea (@razvancrainea) | 6 | 4 | 12 | 6 |
4. | Liviu Chircu (@liviuchircu) | 6 | 4 | 7 | 28 |
5. | Sergio Gutierrez | 4 | 2 | 5 | 3 |
6. | Ionut Ionita (@ionutrazvanionita) | 3 | 1 | 84 | 1 |
7. | Anca Vamanu | 3 | 1 | 6 | 2 |
(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)
(2) including any documentation-related commits, excluding merge commits. Regarding imported patches/code, we do our best to count the work on behalf of the proper owner, as per the "fix_authors" and "mod_renames" arrays in opensips/doc/build-contrib.sh. If you identify any patches/commits which do not get properly attributed to you, please submit a pull request which extends "fix_authors" and/or "mod_renames".
(3) ignoring whitespace edits, renamed files and auto-generated files
Table 2.2. Most recently active contributors(1) to this module
Name | Commit Activity | |
---|---|---|
1. | Bogdan-Andrei Iancu (@bogdan-iancu) | Jul 2009 - Jun 2018 |
2. | Liviu Chircu (@liviuchircu) | Mar 2014 - Jun 2018 |
3. | Razvan Crainea (@razvancrainea) | Jun 2011 - Apr 2017 |
4. | Ionut Ionita (@ionutrazvanionita) | May 2016 - May 2016 |
5. | Kobi Eshun (@ekobi) | Nov 2008 - Dec 2009 |
6. | Anca Vamanu | Sep 2009 - Sep 2009 |
7. | Sergio Gutierrez | Nov 2008 - Nov 2008 |
(1) including any documentation-related commits, excluding merge commits
Last edited by: Bogdan-Andrei Iancu (@bogdan-iancu), Liviu Chircu (@liviuchircu), Ionut Ionita (@ionutrazvanionita), Kobi Eshun (@ekobi).
doc copyrights:
Copyright © 2008 SightSpeed, Inc.