MMGEOIP module
Admin Guide
Section titled “Admin Guide”Overview
Section titled “Overview”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.
Dependencies
Section titled “Dependencies”OpenSIPS Modules
Section titled “OpenSIPS Modules”The following modules must be loaded before this module:
- No dependencies on other OpenSIPS modules.
External Libraries or Applications
Section titled “External Libraries or Applications”The following libraries or applications must be installed before running OpenSIPS with this module loaded:
- libGeoIP.
Exported Parameters
Section titled “Exported Parameters”mmgeoip_city_db_path (string)
Section titled “mmgeoip_city_db_path (string)”Path to either a GeoLite or GeoIP City database file.
Mandatory parameter.
...modparam("mmgeoip", "mmgeoip_city_db_path", "/usr/share/GeoIP/GeoLiteCity.dat")...Exported Functions
Section titled “Exported Functions”mmg_lookup([fields,]src,dst)
Section titled “mmg_lookup([fields,]src,dst)”Looks up specified fields 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:
latLatitudelonLongitudeccCountry CoderegRegioncityCitypcPostal CodedmaDMA CodeacArea CodeTZTime Zone
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE,ERROR_ROUTE, and LOCAL_ROUTE.
...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");};...Known Issues
Section titled “Known Issues”It is not currently possible to load an updated location database without first stalling the server.
Contributors
Section titled “Contributors”By Commit Statistics
Section titled “By Commit Statistics”Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
| # | Name | DevScore | Commits | Lines++ | Lines— |
|---|---|---|---|---|---|
| 1. | Kobi Eshun (@ekobi) | 8 | 2 | 479 | 3 |
| 2. | Stefan Darius (@dariusstefan) | 7 | 4 | 142 | 20 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | 4 | 2 | 20 | 18 |
| 4. | Sergio Gutierrez | 4 | 2 | 5 | 3 |
| 5. | Razvan Crainea (@razvancrainea) | 3 | 1 | 2 | 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
(3) ignoring whitespace edits, renamed files and auto-generated files
By Commit Activity
Section titled “By Commit Activity”| # | Name | Commit Activity |
|---|---|---|
| 1. | Stefan Darius (@dariusstefan) | Jun 2026 - Jul 2026 |
| 2. | Razvan Crainea (@razvancrainea) | Jun 2026 - Jun 2026 |
| 3. | Bogdan-Andrei Iancu (@bogdan-iancu) | Jul 2009 - Jan 2010 |
| 4. | Sergio Gutierrez | Nov 2008 - Nov 2008 |
| 5. | Kobi Eshun (@ekobi) | Nov 2008 - Nov 2008 |
(1) including any documentation-related commits, excluding merge commits
Documentation
Section titled “Documentation”Contributors
Section titled “Contributors”Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Kobi Eshun (@ekobi).
License
Section titled “License”All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0