You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kamailio/modules/geoip
Jon Bonilla e8c7f00561
Merge sipwise and kamailio 3.1.5 branches
14 years ago
..
doc Merge sipwise and kamailio 3.1.5 branches 14 years ago
Makefile Start versioning of kamailio-3.1-sipwise in svn. 14 years ago
README Merge sipwise and kamailio 3.1.5 branches 14 years ago
geoip_mod.c Start versioning of kamailio-3.1-sipwise in svn. 14 years ago
geoip_pv.c Start versioning of kamailio-3.1-sipwise in svn. 14 years ago
geoip_pv.h Start versioning of kamailio-3.1-sipwise in svn. 14 years ago

README

geoip Module

Daniel-Constantin Mierla

   asipto.com

Edited by

Daniel-Constantin Mierla

   <miconda@gmail.com>

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

   Table of Contents

   1. Admin Guide

        1. Overview
        2. Dependencies

              2.1. Kamailio Modules
              2.2. External Libraries or Applications

        3. Exported Parameters

              3.1. path (string)

        4. Exported Functions

              4.1. geoip_match(ipaddr, pvc)

        5. Exported pseudo-variables

   List of Examples

   1.1. Set path parameter
   1.2. geoip_match usage

Chapter 1. Admin Guide

   Table of Contents

   1. Overview
   2. Dependencies

        2.1. Kamailio Modules
        2.2. External Libraries or Applications

   3. Exported Parameters

        3.1. path (string)

   4. Exported Functions

        4.1. geoip_match(ipaddr, pvc)

   5. Exported pseudo-variables

1. Overview

   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.

2. Dependencies

   2.1. Kamailio Modules
   2.2. External Libraries or Applications

2.1. Kamailio Modules

   The following modules must be loaded before this module:
     * none.

2.2. External Libraries or Applications

   The following libraries or applications must be installed before
   running Kamailio with this module loaded:
     * libgeoip - the GeoIP library.

3. Exported Parameters

   3.1. path (string)

3.1. path (string)

   Path to the GeoIP database file.

   Default value is “null”.

   Example 1.1. Set path parameter
...
modparam("geoip", "path", "/usr/local/share/GeoLiteCity.dat")
...

4. Exported Functions

   4.1. geoip_match(ipaddr, pvc)

4.1.  geoip_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: $gip(pvc=>key).

   Example 1.2. geoip_match usage
...
if(geoip_match("$si", "src"))
    xlog("SIP message from: $gip(src=>cc)\n");
...

5. Exported pseudo-variables

     * $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/.