opensips/modules/enum/README

Wed, 10 Feb 2010 21:25:01 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 10 Feb 2010 21:25:01 +0100
changeset 18
8ec65b8f6e2c
parent 13
b63f281afe6b
permissions
-rw-r--r--

Extend uac_auth() of the UAC module to workaround CSEQ problems.
This logic is meant to complement that of changeset 17, which
added rich authentication credentials to the gw table and its
associated logic in the LCR module.

michael@12 1 Enum Module
michael@12 2
michael@12 3 Juha Heinanen
michael@12 4
michael@12 5 <jh@song.fi>
michael@12 6
michael@12 7 Otmar Lendl
michael@12 8
michael@12 9 <lendl@nic.at>
michael@12 10
michael@12 11 Copyright © 2002, 2003 Juha Heinanen
michael@12 12 Revision History
michael@13 13 Revision $Revision: 5907 $ $Date: 2010-01-18 10:45:05 +0100
michael@13 14 (Mon, 18 Jan 2010) $
michael@12 15 __________________________________________________________
michael@12 16
michael@12 17 Table of Contents
michael@12 18
michael@12 19 1. Admin Guide
michael@12 20
michael@12 21 1.1. Overview
michael@12 22 1.2. Dependencies
michael@12 23 1.3. Exported Parameters
michael@12 24
michael@12 25 1.3.1. domain_suffix (string)
michael@12 26 1.3.2. tel_uri_params (string)
michael@12 27 1.3.3. i_enum_suffix (string)
michael@13 28 1.3.4. isn_suffix (string)
michael@13 29 1.3.5. branchlabel (string)
michael@13 30 1.3.6. bl_algorithm (string)
michael@12 31
michael@12 32 1.4. Exported Functions
michael@12 33
michael@12 34 1.4.1. enum_query(["suffix"[,"service"]])
michael@12 35 1.4.2. enum_pv_query("pvar"[,"suffix"[,"service"]])
michael@12 36 1.4.3. i_enum_query(["suffix"[,"service"]])
michael@13 37 1.4.4. isn_query(["suffix"[,"service"]])
michael@13 38 1.4.5. is_from_user_enum()
michael@12 39
michael@12 40 List of Examples
michael@12 41
michael@12 42 1.1. Setting domain_suffix module parameter
michael@12 43 1.2. Setting tel_uri_params module parameter
michael@12 44 1.3. Setting i_enum_suffix module parameter
michael@13 45 1.4. Setting isn_query usage module parameter
michael@13 46 1.5. Setting branchlabel module parameter
michael@12 47 1.6. Zone file example
michael@13 48 1.7. Zone file example
michael@13 49 1.8. Setting the bl_algorithm module parameter
michael@13 50 1.9. enum_query usage
michael@13 51 1.10. enum_pv_query usage
michael@13 52 1.11. isn_query usage
michael@13 53 1.12. is_from_user_enum usage
michael@12 54
michael@12 55 Chapter 1. Admin Guide
michael@12 56
michael@12 57 1.1. Overview
michael@12 58
michael@12 59 Enum module implements [i_]enum_query functions that make an
michael@12 60 enum query based on the user part of the current Request-URI.
michael@12 61 These functions assume that the user part consists of an
michael@12 62 international phone number of the form +decimal-digits, where
michael@12 63 the number of digits is at least 2 and at most 15. Out of this
michael@12 64 number enum_query forms a domain name, where the digits are in
michael@12 65 reverse order and separated by dots followed by domain suffix
michael@12 66 that by default is "e164.arpa.". For example, if the user part
michael@12 67 is +35831234567, the domain name will be
michael@12 68 "7.6.5.4.3.2.1.3.8.5.3.e164.arpa.". i_enum_query operates in a
michael@12 69 similar fashion. The only difference is that it adds a label
michael@12 70 (default "i") to branch off from the default, user-ENUM tree to
michael@12 71 an infrastructure ENUM tree.
michael@12 72
michael@12 73 After forming the domain name, enum_query queries DNS for its
michael@12 74 NAPTR records. From the possible response enum_query chooses
michael@12 75 those records, whose flags field has string value "u", and
michael@12 76 whose services field has string value "e2u+[service:]sip" or
michael@12 77 "e2u+type[:subtype][+type[:subtype]...]" (case is ignored in
michael@12 78 both cases), and whose regexp field is of the form
michael@12 79 !pattern!replacement!.
michael@12 80
michael@12 81 Then enum_query sorts the chosen NAPTR records based on their
michael@12 82 <order, preference>. After sorting, enum_query replaces the
michael@12 83 current Request URI by applying regexp of the most preferred
michael@12 84 NAPTR record its user part and appends to the request new
michael@12 85 branches by applying regexp of each remaining NAPTR record to
michael@12 86 the user part of the current Request URI. If a new URI is a tel
michael@12 87 URI, enum_query appends to it as tel URI parameters the value
michael@12 88 of tel_uri_params module parameter. Finally, enum_query
michael@12 89 associates a q value with each new URI based on the <order,
michael@12 90 preference> of the corresponding NAPTR record.
michael@12 91
michael@12 92 When using enum_query without any parameters, it searches for
michael@12 93 NAPTRs with service type "e2u+sip" in the default enum tree.
michael@12 94 When using enum_query with a single parameter, this parameter
michael@12 95 will be used as enum tree. When using enum_query with two
michael@12 96 parameters, the functionality depends on the first letter in
michael@12 97 the second parameter. When the first letter is not a '+' sign,
michael@12 98 the second parameter will be used to search for NAPTRs with
michael@12 99 service type "e2u+parameter:sip". When the second parameter
michael@12 100 starts with a '+' sign, the ENUM lookup also supports compound
michael@12 101 NAPTRs (e.g. "e2u+voice:sip+video:sip") and searching for
michael@12 102 multiple service types within one lookup. Multiple service
michael@12 103 types must be separeted by a '+' sign.
michael@12 104
michael@12 105 Most of the time you want to route based on the RURI. On rare
michael@12 106 occasions you may wish to route based on something else. The
michael@12 107 function enum_pv_query mimics the behavior of the enum_query
michael@12 108 function except the E.164 number in its pseudo variable
michael@12 109 argument is used for the enum lookup instead of the user part
michael@12 110 of the RURI. Obviously the user part of the RURI is still used
michael@12 111 in the NAPTR regexp.
michael@12 112
michael@12 113 Enum query returns 1 if the current Request URI was replaced
michael@12 114 and -1 if not.
michael@12 115
michael@12 116 Enum module also implements is_from_user_enum function. This
michael@12 117 function does an enum lookup on the from user and returns true
michael@12 118 if found, false otherwise.
michael@12 119
michael@13 120 In addition to standard ENUM, support for ISN (ITAD Subscriber
michael@13 121 Numbers) is provided as well. To allow ISN lookups to resolve,
michael@13 122 a different formatting algorithm is expected by the DNS server.
michael@13 123 Whereas a ENUM NAPTR record expects a DNS query of the form
michael@13 124 9.8.7.6.5.4.3.2.1.<suffix>, ISN method expects a DNS query of
michael@13 125 the form 6.5.1212.<suffix>. That is, a valid ISN number includes
michael@13 126 a prefix of '56' in the example. The rest of the number is a
michael@13 127 ITAD (Internet Telephony Administrative Domain) as defined
michael@13 128 in RFCs 3872 and 2871, and as allocated by the IANA in
michael@13 129 http://www.iana.org/assignments/trip-parameters. The ITAD is
michael@13 130 left intact and not refersed as ENUM requires. To learn more
michael@13 131 about ISN please refer to documents at www.freenum.org.
michael@13 132
michael@13 133 To complete a ISN lookup on the user part of the Request-URI,
michael@13 134 isn_query() is used instead of enum_query().
michael@13 135
michael@12 136 1.2. Dependencies
michael@12 137
michael@12 138 The module depends on the following modules (in the other words
michael@12 139 the listed modules must be loaded before this module):
michael@12 140 * No dependencies.
michael@12 141
michael@12 142 1.3. Exported Parameters
michael@12 143
michael@12 144 1.3.1. domain_suffix (string)
michael@12 145
michael@12 146 The domain suffix to be added to the domain name obtained from
michael@12 147 the digits of an E164 number. Can be overridden by a parameter
michael@12 148 to enum_query.
michael@12 149
michael@12 150 Default value is "e164.arpa."
michael@12 151
michael@12 152 Example 1.1. Setting domain_suffix module parameter
michael@12 153 modparam("enum", "domain_suffix", "e1234.arpa.")
michael@12 154
michael@12 155 1.3.2. tel_uri_params (string)
michael@12 156
michael@12 157 A string whose contents is appended to each new tel URI in the
michael@12 158 request as tel URI parameters.
michael@12 159
michael@12 160 Note
michael@12 161
michael@12 162 Currently OpenSIPS does not support tel URIs. This means that
michael@12 163 at present tel_uri_params is appended as URI parameters to
michael@12 164 every URI.
michael@12 165
michael@12 166 Default value is ""
michael@12 167
michael@12 168 Example 1.2. Setting tel_uri_params module parameter
michael@12 169 modparam("enum", "tel_uri_params", ";npdi")
michael@12 170
michael@12 171 1.3.3. i_enum_suffix (string)
michael@12 172
michael@12 173 The domain suffix to be used for i_enum_query() lookups. Can be
michael@12 174 overridden by a parameter to i_enum_query.
michael@12 175
michael@12 176 Default value is "e164.arpa."
michael@12 177
michael@12 178 Example 1.3. Setting i_enum_suffix module parameter
michael@12 179 modparam("enum", "i_enum_suffix", "e1234.arpa.")
michael@12 180
michael@13 181 1.3.4. isn_suffix (string)
michael@13 182
michael@13 183 The domain suffix to be used for isn_query() lookups. Can be
michael@13 184 overridden by a parameter to isn_query.
michael@13 185
michael@13 186 Default value is "freenum.org."
michael@13 187
michael@13 188 Example 1.4. Setting isn_suffix module parameter
michael@13 189 modparam("enum", "isn_suffix", "freenum.org.")
michael@13 190
michael@13 191 1.3.5. branchlabel (string)
michael@12 192
michael@12 193 This parameter determines which label i_enum_query() will use
michael@12 194 to branch off to the infrastructure ENUM tree.
michael@12 195
michael@12 196 Default value is ""i""
michael@12 197
michael@13 198 Example 1.5. Setting branchlabel module parameter
michael@12 199 modparam("enum", "branchlabel", "i")
michael@12 200
michael@13 201 1.3.6. bl_algorithm (string)
michael@12 202
michael@12 203 This parameter determines which algorithm i_enum_query() will
michael@12 204 use to select the position in the DNS tree where the
michael@12 205 infrastructure tree branches off the user ENUM tree.
michael@12 206
michael@12 207 If set to "cc", i_enum_query() will always inserts the label at
michael@12 208 the country-code level. Examples: i.1.e164.arpa,
michael@12 209 i.3.4.e164.arpa, i.2.5.3.e164.arpa
michael@12 210
michael@12 211 If set to "txt", i_enum_query() will look for a TXT record at
michael@12 212 [branchlabel].[reverse-country-code].[i_enum_suffix] to
michael@12 213 indicate after how many digits the label should in inserted.
michael@12 214
michael@13 215 Example 1.6. Zone file example
michael@12 216 i.1.e164.arpa. IN TXT "4"
michael@12 217 9.9.9.8.7.6.5.i.4.3.2.1.e164.arpa. IN NAPTR "NAPTR content for +1 234 5
michael@12 218 678 999"
michael@12 219
michael@12 220 If set to "ebl", i_enum_query() will look for an EBL (ENUM
michael@12 221 Branch Label) record at
michael@12 222 [branchlabel].[reverse-country-code].[i_enum_suffix]. See
michael@12 223 http://www.ietf.org/internet-drafts/draft-lendl-enum-branch-loc
michael@12 224 ation-record-00.txt for a description of that record and the
michael@12 225 meaning of the fields. The RR type for the EBL has not been
michael@12 226 allocated yet. This version of the code uses 65300. See
michael@12 227 resolve.h.
michael@12 228
michael@13 229 Example 1.7. Zone file example
michael@12 230 i.1.e164.arpa. TYPE65300 \# 14 (
michael@12 231 04 ; position
michael@12 232 01 69 ; separator
michael@12 233 04 65 31 36 34 04 61 72 70 61 00 ; e164.ar
michael@12 234 pa
michael@12 235 ; )
michael@12 236 9.9.9.8.7.6.5.i.4.3.2.1.e164.arpa. IN NAPTR "NAPTR content for +1 234 5
michael@12 237 678 999"
michael@12 238
michael@12 239 Default value is "cc"
michael@12 240
michael@13 241 Example 1.8. Setting the bl_algorithm module parameter
michael@12 242 modparam("enum", "bl_algorithm", "txt")
michael@12 243
michael@12 244 1.4. Exported Functions
michael@12 245
michael@12 246 1.4.1. enum_query(["suffix"[,"service"]])
michael@12 247
michael@12 248 The function performs an enum query and rewrites the
michael@12 249 Request-URI with the result of the query. See Section 1.1,
michael@12 250 "Overview" for more information.
michael@12 251
michael@12 252 Meaning of the parameters is as follows:
michael@12 253 * suffix - Suffix to be appended to the domain name.
michael@12 254 * service - Service string to be used in the service field.
michael@12 255
michael@12 256 This function can be used from REQUEST_ROUTE.
michael@12 257
michael@13 258 Example 1.9. enum_query usage
michael@12 259 ...
michael@12 260 # search for "e2u+sip" in freenum.org
michael@12 261 enum_query("freenum.org.");
michael@12 262 ...
michael@12 263 # search for "e2u+sip" in default tree (configured as parameter)
michael@12 264 enum_query();
michael@12 265 ...
michael@12 266 # search for "e2u+voice:sip" in e164.arpa
michael@12 267 enum_query("e164.arpa.","voice");
michael@12 268 ...
michael@12 269 # search for service type "sip" or "voice:sip" or "video:sip"
michael@12 270 # note the '+' sign in front of the second parameter
michael@12 271 enum_query("e164.arpa.","+sip+voice:sip+video:sip");
michael@12 272 ...
michael@12 273 # quering for service sip and voice:sip
michael@12 274 enum_query("e164.arpa.");
michael@12 275 enum_query("e164.arpa.","voice");
michael@12 276 # or use instead
michael@12 277 enum_query("e164.arpa.","+sip+voice:sip");
michael@12 278 ...
michael@12 279
michael@12 280 1.4.2. enum_pv_query("pvar"[,"suffix"[,"service"]])
michael@12 281
michael@12 282 The function performs an enum query on E.164 number stored in
michael@12 283 its pseudo variable argument and rewrites the Request-URI with
michael@12 284 the result of the query. See Section 1.1, "Overview" for more
michael@12 285 information.
michael@12 286
michael@12 287 Meaning of the parameters is as follows:
michael@12 288 * pvar - Pseudo variable that holds an E.164 number on which
michael@12 289 enum query is performed.
michael@12 290 * suffix - Suffix to be appended to the domain name.
michael@12 291 * service - Service string to be used in the service field.
michael@12 292
michael@12 293 This function can be used from REQUEST_ROUTE.
michael@12 294
michael@13 295 Example 1.10. enum_pv_query usage
michael@12 296 ...
michael@12 297 # search for "e2u+sip" in freenum.org
michael@12 298 enum_pv_query("$avp(i:100)", "freenum.org.");
michael@12 299 ...
michael@12 300 # search for "e2u+sip" in default tree (configured as parameter)
michael@12 301 enum_pv_query("$fU");
michael@12 302 ...
michael@12 303 # search for "e2u+voice:sip" in e164.arpa
michael@12 304 enum_pv_query("$avp(i:100)","e164.arpa.","voice");
michael@12 305 ...
michael@12 306 # search for service type "sip" or "voice:sip" or "video:sip"
michael@12 307 # note the '+' sign in front of the second parameter
michael@12 308 enum_pv_query("$fU","e164.arpa.","+sip+voice:sip+video:sip");
michael@12 309 ...
michael@12 310 # quering for service sip and voice:sip
michael@12 311 enum_pv_query("$avp(i:100)","e164.arpa.");
michael@12 312 enum_pv_query("$avp(i:100)","e164.arpa.","voice");
michael@12 313 # or use instead
michael@12 314 enum_pv_query("$avp(i:100)","e164.arpa.","+sip+voice:sip");
michael@12 315 ...
michael@12 316
michael@12 317 1.4.3. i_enum_query(["suffix"[,"service"]])
michael@12 318
michael@12 319 The function performs an enum query and rewrites the
michael@12 320 Request-URI with the result of the query. This the
michael@12 321 Infrastructure-ENUM version of enum_query(). The only
michael@12 322 difference to enum_query() is in the calculation of the FQDN
michael@12 323 where NAPTR records are looked for.
michael@12 324
michael@12 325 See
michael@12 326 ftp://ftp.rfc-editor.org/in-notes/internet-drafts/draft-haberle
michael@12 327 r-carrier-enum-01.txt for the rationale behind this function.
michael@12 328
michael@13 329 1.4.4. isn_query(["suffix"[,"service"]])
michael@13 330
michael@13 331 The function performs a ISN query and rewrites the
michael@13 332 Request-URI with the result of the query. See Section 1.1,
michael@13 333 "Overview" for more information.
michael@13 334
michael@13 335 Meaning of the parameters is as follows:
michael@13 336 * suffix - Suffix to be appended to the domain name.
michael@13 337 * service - Service string to be used in the service field.
michael@13 338
michael@13 339 This function can be used from REQUEST_ROUTE.
michael@13 340
michael@15 341 See ftp://ftp.ietf.org/rfc/rfc3872.txt and
michael@15 342 ftp://ftp.ietf.org/rfc/rfc2871.txt for information
michael@13 343 regarding the ITAD part of the ISN string.
michael@13 344
michael@13 345 Example 1.11. isn_query usage
michael@13 346 ...
michael@13 347 # search for "e2u+sip" in freenum.org
michael@13 348 isn_query("freenum.org.");
michael@13 349 ...
michael@13 350 # search for "e2u+sip" in default tree (configured as parameter)
michael@13 351 enum_query();
michael@13 352 ...
michael@13 353 # search for "e2u+voice:sip" in freenum.org
michael@13 354 enum_query("freenum.org.","voice");
michael@13 355 ...
michael@13 356
michael@13 357 1.4.5. is_from_user_enum()
michael@12 358
michael@12 359 Checks if the user part of from URI is found in an enum lookup.
michael@12 360 Returns 1 if yes and -1 if not.
michael@12 361
michael@12 362 This function can be used from REQUEST_ROUTE.
michael@12 363
michael@13 364 Example 1.12. is_from_user_enum usage
michael@12 365 ...
michael@12 366 if (is_from_user_enum()) {
michael@12 367 ....
michael@12 368 };
michael@12 369 ...

mercurial