Debian Codegraph @

src/modules/pdb/README

raw
1 pdb Module
2
3 Edited by
4
5 Henning Westerholt
6
7 1&1 Internet AG
8 <[email protected]>
9
10 Pawel Kuzak
11
12 1&1 Internet AG
13 <[email protected]>
14
15 Muhammad Shahzad Shafi
16
17 1&1 Internet AG
18 <[email protected]>
19
20 Copyright © 2009 1&1 Internet AG
21 __________________________________________________________________
22
23 Table of Contents
24
25 1. Admin Guide
26
27 1. Overview
28 2. Dependencies
29
30 2.1. Kamailio Modules
31 2.2. External Libraries or Applications
32
33 3. Parameters
34
35 3.1. timeout (integer)
36 3.2. server (string)
37 3.3. ll_info (int)
38
39 4. Functions
40
41 4.1. pdb_query (string query, string dstpv)
42
43 5. RPC Commands
44
45 5.1. pdb.status
46 5.2. pdb.timeout
47 5.3. pdb.activate
48 5.4. pdb.deactivate
49
50 List of Examples
51
52 1.1. Set timeout parameter
53 1.2. Set server parameter
54 1.3. Set ll_info parameter
55 1.4. pdb_query usage
56 1.5. pdb.status usage
57 1.6. pdb.timeout usage
58 1.7. pdb.activate usage
59 1.8. pdb.deactivate usage
60
61 Chapter 1. Admin Guide
62
63 Table of Contents
64
65 1. Overview
66 2. Dependencies
67
68 2.1. Kamailio Modules
69 2.2. External Libraries or Applications
70
71 3. Parameters
72
73 3.1. timeout (integer)
74 3.2. server (string)
75 3.3. ll_info (int)
76
77 4. Functions
78
79 4.1. pdb_query (string query, string dstpv)
80
81 5. RPC Commands
82
83 5.1. pdb.status
84 5.2. pdb.timeout
85 5.3. pdb.activate
86 5.4. pdb.deactivate
87
88 1. Overview
89
90 This is a module for fast number portability handling. The client is
91 this module and the server exists in the /utils/pdbt directory. The PDB
92 module and server supports load-balancing and aggressive timeouts.
93 Normally it does not need more than a few ms to query the remote server
94 and return the reply to the configuration script.
95
96 The pdb module allows Kamailio to send queries to a list of servers and
97 store the answer in an AVP. The idea is to ask all servers in parallel
98 and use the first answer, that comes back. A timeout for the query can
99 be defined in milliseconds. The querying can be activated and
100 deactivated using FIFO commands.
101
102 More about the new communication protocol between this module and
103 pdb_server can be found in utils/pdbt/docs/network_protocol.txt. The
104 current version is 1.
105
106 2. Dependencies
107
108 2.1. Kamailio Modules
109 2.2. External Libraries or Applications
110
111 2.1. Kamailio Modules
112
113 The module depends on the following modules (in other words the listed
114 modules must be loaded before this module):
115 * none
116
117 2.2. External Libraries or Applications
118
119 The following libraries or applications must be installed before
120 running Kamailio with this module loaded:
121 * The PDB server
122
123 3. Parameters
124
125 3.1. timeout (integer)
126 3.2. server (string)
127 3.3. ll_info (int)
128
129 3.1. timeout (integer)
130
131 This is the timeout in milliseconds for the pdb_query function.
132
133 Default value is “50”.
134
135 Example 1.1. Set timeout parameter
136 ...
137 modparam("pdb", "timeout", 10)
138 ...
139
140 3.2. server (string)
141
142 This is the list of servers to be used by the pdb_query function.
143 Queries will be sent in parallel to all servers configured in this
144 list. This parameter is mandatory.
145
146 Example 1.2. Set server parameter
147 ...
148 modparam("pdb", "server", "localhost:10001,host.name:10001,192.168.1.7:10002")
149 ...
150
151 3.3. ll_info (int)
152
153 Local log level (per module) for specific INFO messages. It has to be a
154 valid log level value (see xlog() function from xlog module for more
155 details).
156
157 Default value is “2”.
158
159 Example 1.3. Set ll_info parameter
160 ...
161 modparam("pdb", "ll_info", 3)
162 ...
163
164 4. Functions
165
166 4.1. pdb_query (string query, string dstpv)
167
168 4.1. pdb_query (string query, string dstpv)
169
170 Sends the query string to all configured servers and stores the answer
171 in dstvp. If it takes more than the configured timeout, false is
172 returned. In addition to a string, any pseudo-variable can be used as
173 query. The answer must consist of the null terminated query string
174 followed by a two byte integer value in network byte order. The integer
175 value will be stored in the given pseudo-variable dstvp.
176
177 Example 1.4. pdb_query usage
178 ...
179 # query external service for routing information
180 if (!pdb_query("$rU", "$avp(routing)"))
181 $avp(routing) = 0; # default routing
182 }
183 cr_route("$avp(routing)", "$rd", "$rU", "$rU", "call_id");
184 ...
185
186 5. RPC Commands
187
188 5.1. pdb.status
189 5.2. pdb.timeout
190 5.3. pdb.activate
191 5.4. pdb.deactivate
192
193 5.1. pdb.status
194
195 Prints the status of the module. This can either be "active" or
196 "deactivated".
197
198 Example 1.5. pdb.status usage
199 ...
200 kamctl rpc pdb.status
201 ...
202
203 5.2. pdb.timeout
204
205 Prints the current PDB query timeout value. This can also be used to
206 set the PDB query timeout.
207
208 Example 1.6. pdb.timeout usage
209 ...
210 # get the PDB query timeout
211 kamctl rpc pdb.timeout
212 # set the PDB query timeout to 10ms
213 kamctl rpc pdb.timeout 10
214 ...
215
216 5.3. pdb.activate
217
218 Activates the module. This is the default after loading the module.
219
220 Example 1.7. pdb.activate usage
221 ...
222 kamctl rpc pdb.activate
223 ...
224
225 5.4. pdb.deactivate
226
227 Deactivates the module. No more queries are performed until it is
228 activated again. As long as the module is deactivated, the pdb_query
229 function will return -1.
230
231 Example 1.8. pdb.deactivate usage
232 ...
233 kamctl rpc pdb.deactivate
234 ...