← Volver al índice de módulos

geoip2

This module allows real-time queries against the Max Mind GeoIP2 database to be performed from the config script. The Max Mind GeoIP2 database is a map of IP network address assignments to geographica
🛠️ Utilidades y Varios Kamailio 6.1 4 parámetros 4 funciones

Descripción general

This module allows real-time queries against the Max Mind GeoIP2 database to be performed from the config script. The Max Mind GeoIP2 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://dev.maxmind.com/geoip/. The library libmaxminddb that interfaces with the Max Mind API, as well as scripts to automate downloading of the on-disk version are available at http://dev.maxmind.com/geoip/geoip2/downloadable/. This module exports a new class of pseudo-variables - $gip2(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. The cache can be reloaded with an RPC command. In this case make sure that you do not overwrite the file in place, but replace it, e.g. with a “move” command.

Documentación oficial: https://www.kamailio.org/docs/modules/stable/modules/geoip2.html
Código fuente: https://github.com/kamailio/kamailio/tree/master/src/modules/geoip2

Parámetros de configuración

ParámetroTipoDescripción
path string 3.2. resid (str)
resid str 3.1. path (string)
path string Path to the GeoIP2 database file.
resid str Preregister result container id during initialization, enabling the use of the module in KEMI scripts. In native kamailio.cfg file, registration is done when parsing config and finding variables.

Funciones exportadas

geoip2_match(ipaddr, pvc)

4.2. geoip2_distance(ip_addr, latitude, longitude)

geoip2_distance(ip_addr, latitude, longitude)

4.1. geoip2_match(ipaddr, pvc)

geoip2_match(ipaddr, pvc)

Match ipaddr against the GeoIP database and set the pvc container. The function has to be called before accessing a key via: $gip2(pvc=>key). At least one function needs to be present that access the pvc container, otherwise this function will not wo

geoip2_distance(ip_addr, latitude, longitude)

The function calculates the distance in miles between the geocoordinates of the IP address passed as parameter (the coordinates are calculated inside the function) and the geocoordinates latitude and longitude

Autores y contribuidores

Sergey OkhapkinDaniel-Constantin Mierla <miconda@gmail.com>Henning Westerholt

Copyright © 2010 Daniel-Constantin Mierla (asipto.com)

Módulos relacionados

auth_web3 auth_xkeys avp avpops benchmark blst call_control call_obj