Browse code

geoip2: log errors for cases where the container could not evaluated and add docs

- log errors for cases where the container could not evaluated due to missing
initialization of the pvc container because no actual access is done in the cfg
- add documentation describing that at least one access to the container is necessary
for the match function to work correctly

Henning Westerholt authored on 09/05/2022 16:43:22
Showing 1 changed files
... ...
@@ -112,6 +112,8 @@ modparam("geoip2", "path", "/usr/local/share/GeoIP/GeoLite2-City.mmdb")
112 112
 	    <para>
113 113
 			Match ipaddr against the GeoIP database and set the pvc container. The
114 114
 			function has to be called before accessing a key via: $gip2(pvc=&gt;key).
115
+			At least one function needs to be present that access the pvc container,
116
+			otherwise this function will not work.
115 117
 	    </para>
116 118
 		<example>
117 119
 		<title><function>geoip2_match</function> usage</title>
Browse code

geoip2: docs - fixed the rpc command geoip2.reload title

Daniel-Constantin Mierla authored on 13/04/2022 09:58:01
Showing 1 changed files
... ...
@@ -128,9 +128,9 @@ if(geoip2_match("$si", "src"))
128 128
 
129 129
     <section>
130 130
 	<title>RPC Commands</title>
131
-	<section id="userblocklist.r.reload_blocklist">
131
+	<section id="geoip2.r.reload">
132 132
 	   <title>
133
-		<function moreinfo="none">userblocklist.reload_blocklist</function>
133
+		<function moreinfo="none">geoip2.reload</function>
134 134
 	   </title>
135 135
 	   <para>
136 136
 			Reload the internal GeoIP database. This is necessary after
Browse code

geoip2: add a note about db replacement recommendations

Henning Westerholt authored on 13/04/2022 09:04:31
Showing 1 changed files
... ...
@@ -44,6 +44,9 @@
44 44
 	<para>
45 45
 		Many queries can be done and store results in different containers to
46 46
 		be able to use in parallel. Database is loaded at startup in cache.
47
+		The cache can be reloaded with an RPC command. In this case make sure
48
+		that you do not overwrite the file in place, but replace it, e.g. with
49
+		a <quote>move</quote> command.
47 50
 	</para>
48 51
     </section>
49 52
     <section>
Browse code

geoip2: add reload RCP command fuctionality (related to GH #2029)

Henning Westerholt authored on 13/04/2022 06:34:02
Showing 1 changed files
... ...
@@ -121,6 +121,27 @@ if(geoip2_match("$si", "src"))
121 121
 	    </example>
122 122
 	</section>
123 123
 	
124
+    </section>
125
+
126
+    <section>
127
+	<title>RPC Commands</title>
128
+	<section id="userblocklist.r.reload_blocklist">
129
+	   <title>
130
+		<function moreinfo="none">userblocklist.reload_blocklist</function>
131
+	   </title>
132
+	   <para>
133
+			Reload the internal GeoIP database. This is necessary after
134
+			the database file has been changed on the disk.
135
+	   </para>
136
+		<example>
137
+		<title><function>geoip2.reload</function> usage</title>
138
+		<programlisting format="linespecific">
139
+...
140
+&kamcmd; geoip2.reload
141
+...
142
+		</programlisting>
143
+		</example>
144
+	</section>
124 145
     </section>
125 146
 	
126 147
 	<section>
Browse code

doc, modules: updated the path to docbook entities and spec files

Daniel-Constantin Mierla authored on 07/12/2016 14:24:32
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4 4
 
5 5
 <!-- Include general documentation entities -->
6
-<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
6
+<!ENTITY % docentities SYSTEM "../../../../doc/docbook/entities.xml">
7 7
 %docentities;
8 8
 
9 9
 ]>
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,178 @@
1
+<?xml version="1.0" encoding='ISO-8859-1'?>
2
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3
+"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
4
+
5
+<!-- Include general documentation entities -->
6
+<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
7
+%docentities;
8
+
9
+]>
10
+
11
+<!-- Module User's Guide -->
12
+
13
+<chapter>
14
+    
15
+    <title>&adminguide;</title>
16
+    
17
+    <section>
18
+	<title>Overview</title>
19
+	<para>
20
+		This module allows real-time queries against the Max Mind GeoIP2 
21
+		database to be performed from the config script.  
22
+	</para>
23
+	<para>
24
+		The Max Mind GeoIP2 database is a map of IP network address assignments 
25
+		to geographical locales that can be useful -- though approximate --
26
+		in identifying the physical location with which an IP host address
27
+		is associated on a relatively granular level.
28
+	</para>
29
+	<para>
30
+		This database itself can be obtained on a free or commercial basis 
31
+		from <ulink url="http://dev.maxmind.com/geoip/">
32
+		http://dev.maxmind.com/geoip/</ulink>. The 
33
+		library libmaxminddb
34
+		that interfaces with the Max Mind API, as well as scripts to
35
+		automate downloading of the on-disk version are available at
36
+		<ulink url="http://dev.maxmind.com/geoip/geoip2/downloadable/">
37
+		http://dev.maxmind.com/geoip/geoip2/downloadable/</ulink>.
38
+	</para>
39
+	<para>
40
+		This module exports a new class of pseudo-variables -
41
+		$gip2(pvc=&gt;key) - to enable access to the results of a query to the
42
+		database.
43
+	</para>
44
+	<para>
45
+		Many queries can be done and store results in different containers to
46
+		be able to use in parallel. Database is loaded at startup in cache.
47
+	</para>
48
+    </section>
49
+    <section>
50
+	<title>Dependencies</title>
51
+	<section>
52
+	    <title>&kamailio; Modules</title>
53
+	    <para>
54
+		The following modules must be loaded before this module:
55
+	    	<itemizedlist>
56
+		    <listitem>
57
+			<para>
58
+			    <emphasis>none</emphasis>.
59
+			</para>
60
+		    </listitem>
61
+	    	</itemizedlist>
62
+	    </para>
63
+	</section>
64
+	<section>
65
+	    <title>External Libraries or Applications</title>
66
+	    <para>
67
+		The following libraries or applications must be installed before running
68
+		&kamailio; with this module loaded:
69
+	    	<itemizedlist>
70
+		    <listitem>
71
+			<para>
72
+			    <emphasis>libmaxminddb</emphasis> - the GeoIP2 library.
73
+			</para>
74
+		    </listitem>
75
+	    	</itemizedlist>
76
+	    </para>
77
+	</section>
78
+    </section>
79
+    <section>
80
+	<title>Parameters</title>
81
+	<section>
82
+	    <title><varname>path</varname> (string)</title>
83
+	    <para>
84
+		Path to the GeoIP2 database file.
85
+	    </para>
86
+	    <para>
87
+		<emphasis>
88
+		    Default value is <quote>null</quote>.
89
+		</emphasis>
90
+	    </para>
91
+	    <example>
92
+		<title>Set <varname>path</varname> parameter</title>
93
+		<programlisting format="linespecific">
94
+...
95
+modparam("geoip2", "path", "/usr/local/share/GeoIP/GeoLite2-City.mmdb")
96
+...
97
+</programlisting>
98
+	    </example>
99
+	</section>
100
+
101
+	</section>
102
+	
103
+    <section>
104
+	<title>Functions</title>
105
+ 	<section>
106
+	    <title>
107
+		<function moreinfo="none">geoip2_match(ipaddr, pvc)</function>
108
+	    </title>
109
+	    <para>
110
+			Match ipaddr against the GeoIP database and set the pvc container. The
111
+			function has to be called before accessing a key via: $gip2(pvc=&gt;key).
112
+	    </para>
113
+		<example>
114
+		<title><function>geoip2_match</function> usage</title>
115
+		<programlisting format="linespecific">
116
+...
117
+if(geoip2_match("$si", "src"))
118
+    xlog("SIP message from: $gip2(src=&gt;cc)\n");
119
+...
120
+</programlisting>
121
+	    </example>
122
+	</section>
123
+	
124
+    </section>
125
+	
126
+	<section>
127
+		<title>Exported pseudo-variables</title>
128
+		<itemizedlist>
129
+			<listitem><para>
130
+				<emphasis>$gip2(pvc=&gt;key)</emphasis> - <emphasis>pvc</emphasis> is an 
131
+				identifier for this query result;  it is designated by the second 
132
+				parameter of geoip2_match(). The <emphasis>key</emphasis> can be one of
133
+				the following:
134
+				</para>
135
+			<itemizedlist>
136
+				<listitem><para>
137
+					<emphasis>cc</emphasis> - country code
138
+				</para></listitem>
139
+				<listitem><para>
140
+					<emphasis>tz</emphasis> - time zone
141
+				</para></listitem>
142
+				<listitem><para>
143
+					<emphasis>zip</emphasis> - postal code
144
+				</para></listitem>
145
+				<listitem><para>
146
+					<emphasis>lat</emphasis> - latitude
147
+				</para></listitem>
148
+				<listitem><para>
149
+					<emphasis>lon</emphasis> - longitude
150
+				</para></listitem>
151
+				<listitem><para>
152
+					<emphasis>nmask</emphasis> - network mask (CIDR format)
153
+				</para></listitem>
154
+				<listitem><para>
155
+					<emphasis>city</emphasis> - city
156
+				</para></listitem>
157
+				<listitem><para>
158
+					<emphasis>regc</emphasis> - region
159
+				</para></listitem>
160
+				<listitem><para>
161
+					<emphasis>regn</emphasis> - region name
162
+				</para></listitem>
163
+				<listitem><para>
164
+					<emphasis>metro</emphasis> - metro code
165
+				</para></listitem>
166
+				<listitem><para>
167
+					<emphasis>contc</emphasis> - continent code
168
+				</para></listitem>
169
+			</itemizedlist>
170
+			</listitem>
171
+		</itemizedlist>
172
+		<para>
173
+		Exported pseudo-variables are documented at &kamwikilink;.
174
+		</para>
175
+	</section>
176
+
177
+</chapter>
178
+