Kamailio-开源SIP软交换平台

中国第一个专注Kamailio SIP 软交换技术分享平台

用户工具

站点工具


geoip2_geoip_api_to_config_file_using_the_new_library_with_ipv6_support_released

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

geoip2_geoip_api_to_config_file_using_the_new_library_with_ipv6_support_released [2017/09/11 11:27] (当前版本)
james_zhu 创建
行 1: 行 1:
 +====== geoip2 Module ======
  
 +==== Sergey Okhapkin ====
 +
 +callwithus.com\\ ​
 +
 +=== Edited by ===
 +
 +==== Daniel-Constantin Mierla ====
 +
 +''<​[[miconda@gmail.com|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. Parameters** ​
 +      * **3.1. path (string)** ​
 +    * **4. Functions** ​
 +      * **4.1. geoip2_match(ipaddr,​ pvc)** ​
 +    * **5. Exported pseudo-variables** ​
 +
 +**List of Examples**
 +
 +  * **1.1. Set path parameter** ​
 +  * **1.2. geoip2_match usage** ​
 +
 +====== Chapter 1. Admin Guide ======
 +
 +**Table of Contents**
 +
 +  * **1. Overview** ​
 +  * **2. Dependencies** ​
 +    * **2.1. Kamailio Modules** ​
 +    * **2.2. External Libraries or Applications** ​
 +  * **3. Parameters** ​
 +    * **3.1. path (string)** ​
 +  * **4. Functions** ​
 +    * **4.1. geoip2_match(ipaddr,​ pvc)** ​
 +  * **5. Exported pseudo-variables** ​
 +
 +===== 1. Overview =====
 +
 +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/​|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/​|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.
 +
 +===== 2. Dependencies =====
 +
 +==== 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:
 +
 +  * libmaxminddb - the GeoIP2 library. ​
 +
 +===== 3. Parameters =====
 +
 +==== 3.1. path (string) ====
 +
 +Path to the GeoIP2 database file.
 +
 +Default value is “null”.
 +
 +**Example 1.1. Set ''​path''​ parameter**
 +
 +<​code>​
 +...
 +modparam("​geoip2",​ "​path",​ "/​usr/​local/​share/​GeoIP/​GeoLite2-City.mmdb"​)
 +...
 +</​code>​
 +
 +\\ ===== 4. Functions =====
 +
 +==== 4.1. 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).
 +
 +**Example 1.2. ''​geoip2_match''​ usage**
 +
 +<​code>​
 +...
 +if(geoip2_match("​$si",​ "​src"​))
 +    xlog("​SIP message from: $gip2(src=>​cc)\n"​);​
 +...
 +</​code>​
 +
 +\\ ===== 5. Exported pseudo-variables =====
 +
 +  * $gip2(pvc=>​key) - pvc is an identifier for this query result; it is designated by the second parameter of geoip2_match(). The key can be one of the following: cc - country code tz - time zone zip - postal code lat - latitude lon - longitude nmask - network mask (CIDR format) city - city regc - region regn - region name metro - metro code contc - continent code 
 +
 +Exported pseudo-variables are documented at [[https://​www.kamailio.org/​wiki/​|https://​www.kamailio.org/​wiki/​]].
geoip2_geoip_api_to_config_file_using_the_new_library_with_ipv6_support_released.txt · 最后更改: 2017/09/11 11:27 由 james_zhu