| 1 |
H350 Module |
| 2 |
|
| 3 |
Christian Schlatter |
| 4 |
|
| 5 |
University of North Carolina |
| 6 |
<[email protected]> |
| 7 |
|
| 8 |
Copyright © 2007 University of North Carolina |
| 9 |
__________________________________________________________________ |
| 10 |
|
| 11 |
Table of Contents |
| 12 |
|
| 13 |
1. Admin Guide |
| 14 |
|
| 15 |
1. Overview |
| 16 |
|
| 17 |
1.1. Example H.350 commObject LDAP Entry |
| 18 |
|
| 19 |
2. Dependencies |
| 20 |
|
| 21 |
2.1. Kamailio Modules |
| 22 |
2.2. External Libraries or Applications |
| 23 |
|
| 24 |
3. Parameters |
| 25 |
|
| 26 |
3.1. ldap_session (string) |
| 27 |
3.2. base_dn (string) |
| 28 |
3.3. search_scope (string) |
| 29 |
|
| 30 |
4. Functions |
| 31 |
|
| 32 |
4.1. h350_sipuri_lookup(sip_uri) |
| 33 |
4.2. h350_auth_lookup(auth_username, |
| 34 |
"username_avp_spec/pwd_avp_spec") |
| 35 |
|
| 36 |
4.3. h350_result_call_preferences(avp_name_prefix) |
| 37 |
4.4. h350_result_service_level(avp_name_prefix) |
| 38 |
|
| 39 |
Resources |
| 40 |
|
| 41 |
List of Examples |
| 42 |
|
| 43 |
1.1. Example H.350 commObject storing SIP account data |
| 44 |
1.2. ldap_session parameter usage |
| 45 |
1.3. base_dn parameter usage |
| 46 |
1.4. search_scope parameter usage |
| 47 |
1.5. Example Usage |
| 48 |
1.6. Example Usage |
| 49 |
1.7. Example H.350 callPreferenceURI simple call forwarding rules |
| 50 |
1.8. Example Usage |
| 51 |
1.9. Example SIPIdentityServiceLevel values and resulting AVPs |
| 52 |
1.10. Example Usage |
| 53 |
|
| 54 |
Chapter 1. Admin Guide |
| 55 |
|
| 56 |
Table of Contents |
| 57 |
|
| 58 |
1. Overview |
| 59 |
|
| 60 |
1.1. Example H.350 commObject LDAP Entry |
| 61 |
|
| 62 |
2. Dependencies |
| 63 |
|
| 64 |
2.1. Kamailio Modules |
| 65 |
2.2. External Libraries or Applications |
| 66 |
|
| 67 |
3. Parameters |
| 68 |
|
| 69 |
3.1. ldap_session (string) |
| 70 |
3.2. base_dn (string) |
| 71 |
3.3. search_scope (string) |
| 72 |
|
| 73 |
4. Functions |
| 74 |
|
| 75 |
4.1. h350_sipuri_lookup(sip_uri) |
| 76 |
4.2. h350_auth_lookup(auth_username, |
| 77 |
"username_avp_spec/pwd_avp_spec") |
| 78 |
|
| 79 |
4.3. h350_result_call_preferences(avp_name_prefix) |
| 80 |
4.4. h350_result_service_level(avp_name_prefix) |
| 81 |
|
| 82 |
1. Overview |
| 83 |
|
| 84 |
1.1. Example H.350 commObject LDAP Entry |
| 85 |
|
| 86 |
The Kamailio H350 module enables a Kamailio SIP proxy server to access |
| 87 |
SIP account data stored in an LDAP [RFC4510] directory containing H.350 |
| 88 |
[H.350] commObjects. ITU-T Recommendation H.350 standardizes LDAP |
| 89 |
object classes to store Real-Time Communication (RTC) account data. In |
| 90 |
particular, H.350.4 [H.350.4] defines an object class called |
| 91 |
sipIdentity that includes attribute specifications for SIP account data |
| 92 |
like SIP URI, SIP digest username/password, or service level. This |
| 93 |
allows to store SIP account data in a vendor neutral way and lets |
| 94 |
different entities, like SIP proxies, provisioning, or billing |
| 95 |
applications, access the data in a standardized format. |
| 96 |
|
| 97 |
The ViDe H.350 Cookbook [vide-h.350-cb] is a good reference for |
| 98 |
deploying an H.350 directory. Besides general information on H.350, |
| 99 |
LDAP, and related standards, this document explains how to set up an |
| 100 |
H.350/LDAP directory and discusses different deployment scenarios. |
| 101 |
|
| 102 |
The H350 module uses the Kamailio LDAP module to import H.350 attribute |
| 103 |
values into the Kamailio routing script variable space. The module |
| 104 |
exports functions to parse and store the H.350 attribute values from |
| 105 |
the Kamailio routing script. It allows a script writer to implement |
| 106 |
H.350 based SIP digest authentication, call forwarding, SIP URI alias |
| 107 |
to AOR rewriting, and service level parsing. |
| 108 |
|
| 109 |
1.1. Example H.350 commObject LDAP Entry |
| 110 |
|
| 111 |
The following example shows a typical H.350 commObject LDAP entry |
| 112 |
storing SIP account data. |
| 113 |
|
| 114 |
Example 1.1. Example H.350 commObject storing SIP account data |
| 115 |
Attribute Name Attribute Value(s) |
| 116 |
-------------- ----------------- |
| 117 |
|
| 118 |
# LDAP URI identifying the owner of this commObject, typically |
| 119 |
# points to an entry in the enterprise directory |
| 120 |
commOwner ldap://dir.example.com/dc=example,dc=com??one?(uid=bob) |
| 121 |
|
| 122 |
# Unique identifier for this commObject, used for referencing |
| 123 |
# this object e.g. from the enterprise directory |
| 124 |
commUniqueId 298217asdjgj213 |
| 125 |
|
| 126 |
# Determines if this commObject should be listed on white pages |
| 127 |
commPrivate false |
| 128 |
|
| 129 |
# Valid SIP URIs for this account (can be used to store alias SIP URIs |
| 130 |
# like DIDs as well) |
| 131 |
SIPIdentitySIPURI sip:[email protected] |
| 132 |
sip:[email protected] |
| 133 |
sip:[email protected] |
| 134 |
# SIP digest username |
| 135 |
SIPIdentityUserName bob |
| 136 |
|
| 137 |
# SIP digest password |
| 138 |
SIPIdentityPassword pwd |
| 139 |
|
| 140 |
# SIP proxy address |
| 141 |
SIPIdentityProxyAddress sip.example.com |
| 142 |
|
| 143 |
# SIP registrar address |
| 144 |
SIPIdentityRegistrarAddress sip.example.com |
| 145 |
|
| 146 |
# Call preferences: Forward to voicemail on no response |
| 147 |
# after 20 seconds and on busy |
| 148 |
callPreferenceURI sip:[email protected] n:20000 |
| 149 |
sip:[email protected] b |
| 150 |
|
| 151 |
# Account service level(s) |
| 152 |
SIPIdentityServiceLevel long_distance |
| 153 |
conferencing |
| 154 |
|
| 155 |
# H.350 object classes |
| 156 |
objectClass top |
| 157 |
commObject |
| 158 |
SIPIdentity |
| 159 |
callPreferenceURIObject |
| 160 |
|
| 161 |
2. Dependencies |
| 162 |
|
| 163 |
2.1. Kamailio Modules |
| 164 |
2.2. External Libraries or Applications |
| 165 |
|
| 166 |
2.1. Kamailio Modules |
| 167 |
|
| 168 |
The module depends on the following modules (the listed modules must be |
| 169 |
loaded before this module): |
| 170 |
* LDAP |
| 171 |
|
| 172 |
2.2. External Libraries or Applications |
| 173 |
|
| 174 |
The following libraries or applications must be installed before |
| 175 |
running Kamailio with this module loaded: |
| 176 |
* OpenLDAP library (libldap), libldap header files (libldap-dev) are |
| 177 |
needed for compilation |
| 178 |
|
| 179 |
3. Parameters |
| 180 |
|
| 181 |
3.1. ldap_session (string) |
| 182 |
3.2. base_dn (string) |
| 183 |
3.3. search_scope (string) |
| 184 |
|
| 185 |
3.1. ldap_session (string) |
| 186 |
|
| 187 |
Name of the LDAP session to be used for H.350 queries, as defined in |
| 188 |
the LDAP module configuration file. |
| 189 |
|
| 190 |
Default value: "" |
| 191 |
|
| 192 |
Example 1.2. ldap_session parameter usage |
| 193 |
modparam("h350", "ldap_session", "h350"); |
| 194 |
|
| 195 |
3.2. base_dn (string) |
| 196 |
|
| 197 |
Base LDAP DN to start LDAP search for H.350 entries. For best |
| 198 |
performance, this should be set to the direct ancestor of the H.350 |
| 199 |
objects. |
| 200 |
|
| 201 |
Default value: "" |
| 202 |
|
| 203 |
Example 1.3. base_dn parameter usage |
| 204 |
modparam("h350", "base_dn", "ou=h350,dc=example,dc=com"); |
| 205 |
|
| 206 |
3.3. search_scope (string) |
| 207 |
|
| 208 |
LDAP search scope for H.350 queries, one of "one", "base", or "sub". |
| 209 |
|
| 210 |
Default value: "one" |
| 211 |
|
| 212 |
Example 1.4. search_scope parameter usage |
| 213 |
modparam("h350", "search_scope", "sub"); |
| 214 |
|
| 215 |
4. Functions |
| 216 |
|
| 217 |
4.1. h350_sipuri_lookup(sip_uri) |
| 218 |
4.2. h350_auth_lookup(auth_username, "username_avp_spec/pwd_avp_spec") |
| 219 |
4.3. h350_result_call_preferences(avp_name_prefix) |
| 220 |
4.4. h350_result_service_level(avp_name_prefix) |
| 221 |
|
| 222 |
4.1. h350_sipuri_lookup(sip_uri) |
| 223 |
|
| 224 |
This function performs an LDAP search query for an H.350 commObject |
| 225 |
with a SIPIdentitySIPURI of sip_uri. The sip_uri parameter first gets |
| 226 |
escaped according the rules for LDAP filter strings. The result of the |
| 227 |
LDAP search is stored internally and can be accessed either by one of |
| 228 |
the h350_result* or one of the ldap_result* functions from the Kamailio |
| 229 |
LDAP module. |
| 230 |
|
| 231 |
The function returns -1 (FALSE) for internal errors, and -2 (FALSE) if |
| 232 |
no H.350 commObject was found with a matching sip_uri. n > 0 (TRUE) is |
| 233 |
returned if n H.350 commObjects were found. |
| 234 |
|
| 235 |
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, |
| 236 |
FAILURE_ROUTE and BRANCH_ROUTE. |
| 237 |
|
| 238 |
Function Parameters: |
| 239 |
|
| 240 |
sip_uri |
| 241 |
H.350 SIPIdentitySIPURI to search for in directory. Included |
| 242 |
Kamailio variables do get expanded. |
| 243 |
|
| 244 |
Return Values: |
| 245 |
|
| 246 |
n > 0 (TRUE): |
| 247 |
|
| 248 |
+ n H.350 commObjects found. |
| 249 |
|
| 250 |
-1 (FALSE): |
| 251 |
|
| 252 |
+ Internal error occurred. |
| 253 |
|
| 254 |
-2 (FALSE): |
| 255 |
|
| 256 |
+ No H.350 commObject found. |
| 257 |
|
| 258 |
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, |
| 259 |
BRANCH_ROUTE, and ONREPLY_ROUTE. |
| 260 |
|
| 261 |
Example 1.5. Example Usage |
| 262 |
# |
| 263 |
# H.350 lookup for callee |
| 264 |
# |
| 265 |
|
| 266 |
if (!h350_sipuri_lookup("sip:$rU@$rd")) |
| 267 |
{ |
| 268 |
switch ($retcode) |
| 269 |
{ |
| 270 |
case -2: |
| 271 |
xlog("L_INFO", |
| 272 |
"h350 callee lookup: no entry found in H.350 directory"); |
| 273 |
exit; |
| 274 |
case -1: |
| 275 |
sl_send_reply("500", "Internal server error"); |
| 276 |
exit; |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
# now h350_result* or ldap_result* functions can be used |
| 281 |
|
| 282 |
4.2. h350_auth_lookup(auth_username, "username_avp_spec/pwd_avp_spec") |
| 283 |
|
| 284 |
This function performs an LDAP search query for SIP digest |
| 285 |
authentication credentials in an H.350 directory. The H.350 directory |
| 286 |
is searched for a commObject with SIPIdentityUserName of auth_username. |
| 287 |
If such a commObject is found, the SIP digest authentication username |
| 288 |
and password are stored in AVPs username_avp_spec and pwd_avp_spec, |
| 289 |
respectively. pv_*_authorize functions from AUTH module can then be |
| 290 |
used to perform SIP digest authentication. |
| 291 |
|
| 292 |
The function returns 1 (TRUE) if an H.350 commObject was found, -1 |
| 293 |
(FALSE) in case of an internal error, and -2 (FALSE) if no matching |
| 294 |
commObject was found. |
| 295 |
|
| 296 |
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, |
| 297 |
FAILURE_ROUTE and BRANCH_ROUTE. |
| 298 |
|
| 299 |
Function Parameters: |
| 300 |
|
| 301 |
auth_username |
| 302 |
H.350 SIPIdentityUserName to search for in directory. Included |
| 303 |
Kamailio variables do get expanded. |
| 304 |
|
| 305 |
username_avp_spec |
| 306 |
Specification for authentication username AVP, e.g. |
| 307 |
$avp(s:username). |
| 308 |
|
| 309 |
pwd_avp_spec |
| 310 |
Specification for authentication password AVP, e.g. $avp(s:pwd). |
| 311 |
|
| 312 |
Return Values: |
| 313 |
|
| 314 |
1 (TRUE): |
| 315 |
|
| 316 |
+ H.350 commObject found and SIP digest authentication |
| 317 |
credentials stored in username_avp_spec and pwd_avp_spec. |
| 318 |
|
| 319 |
-1 (FALSE): |
| 320 |
|
| 321 |
+ Internal error occurred. |
| 322 |
|
| 323 |
-2 (FALSE): |
| 324 |
|
| 325 |
+ No H.350 commObject found. |
| 326 |
|
| 327 |
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, |
| 328 |
BRANCH_ROUTE, and ONREPLY_ROUTE. |
| 329 |
|
| 330 |
Example 1.6. Example Usage |
| 331 |
# -- auth params -- |
| 332 |
modparam("auth", "username_spec", "$avp(s:auth_user)") |
| 333 |
modparam("auth", "password_spec", "$avp(s:auth_pwd)") |
| 334 |
modparam("auth", "calculate_ha1", 1) |
| 335 |
|
| 336 |
# -- h350 params -- |
| 337 |
modparam("h350", "ldap_session", "h350") |
| 338 |
modparam("h350", "base_dn", "ou=h350,dc=example,dc=com") |
| 339 |
modparam("h350", "search_scope", "one") |
| 340 |
|
| 341 |
|
| 342 |
route[1] |
| 343 |
{ |
| 344 |
# |
| 345 |
# H.350 based SIP digest authentication |
| 346 |
# |
| 347 |
|
| 348 |
# challenge all requests not including an Auth header |
| 349 |
if (!(is_present_hf("Authorization") || |
| 350 |
is_present_hf("Proxy-Authorization"))) |
| 351 |
{ |
| 352 |
if (is_method("REGISTER")) |
| 353 |
{ |
| 354 |
www_challenge("example.com", "0"); |
| 355 |
exit; |
| 356 |
} |
| 357 |
proxy_challenge("example.com", "0"); |
| 358 |
exit; |
| 359 |
} |
| 360 |
|
| 361 |
# get digest password from H.350 using auth username ($au) |
| 362 |
if (!h350_auth_lookup("$au", |
| 363 |
"$avp(s:auth_user)/$avp(s:auth_pwd)")) |
| 364 |
{ |
| 365 |
switch ($retcode) |
| 366 |
{ |
| 367 |
case -2: |
| 368 |
sl_send_reply("401", "Unauthorized"); |
| 369 |
exit; |
| 370 |
case -1: |
| 371 |
sl_send_reply("500", "Internal server error"); |
| 372 |
exit; |
| 373 |
} |
| 374 |
} |
| 375 |
|
| 376 |
# REGISTER requests |
| 377 |
if (is_method("REGISTER")) |
| 378 |
{ |
| 379 |
if (!pv_www_authorize("example.com")) |
| 380 |
{ |
| 381 |
if ($retcode == -5) |
| 382 |
{ |
| 383 |
sl_send_reply("500", "Internal server error"); |
| 384 |
exit; |
| 385 |
} |
| 386 |
else { |
| 387 |
www_challenge("example.com", "0"); |
| 388 |
exit; |
| 389 |
} |
| 390 |
} |
| 391 |
|
| 392 |
consume_credentials(); |
| 393 |
xlog("L_INFO", |
| 394 |
"REGISTER request successfully authenticated"); |
| 395 |
return(1); |
| 396 |
} |
| 397 |
|
| 398 |
# non-REGISTER requests |
| 399 |
if (!pv_proxy_authorize("example.com")) |
| 400 |
{ |
| 401 |
if ($retcode == -5) |
| 402 |
{ |
| 403 |
sl_send_reply("500", "Internal server error"); |
| 404 |
exit; |
| 405 |
} |
| 406 |
else { |
| 407 |
proxy_challenge("example.com", "0"); |
| 408 |
exit; |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
consume_credentials(); |
| 413 |
xlog("L_INFO", "$rm request successfully authenticated"); |
| 414 |
return(1); |
| 415 |
} |
| 416 |
|
| 417 |
4.3. h350_result_call_preferences(avp_name_prefix) |
| 418 |
|
| 419 |
This function parses the callPreferenceURI attribute of an H.350 |
| 420 |
commObject, which must have been fetched through h350_*_lookup or |
| 421 |
ldap_search. callPreferenceURI is a multi-valued attribute that stores |
| 422 |
call preference rules like e.g. forward-on-busy or |
| 423 |
forward-unconditionally. Directory services architecture for call |
| 424 |
forwarding and preferences [H.350.6] defines a format for simple call |
| 425 |
forwarding rules: |
| 426 |
|
| 427 |
target_uri type[:argument] |
| 428 |
|
| 429 |
In a SIP environment, target_uri is typically the call forwarding |
| 430 |
rule's target SIP URI, although it could be any type of URI, e.g. an |
| 431 |
HTTP pointer to a CPL script. Four different values are specified for |
| 432 |
type: b for "forward on busy", n for "forward on no answer", u for |
| 433 |
"forward unconditionally", and f for "forward on destination not |
| 434 |
found". The optional argument is a string indicating the time in |
| 435 |
milliseconds after which the call forwarding should occur. |
| 436 |
|
| 437 |
Example 1.7. Example H.350 callPreferenceURI simple call forwarding |
| 438 |
rules |
| 439 |
# Example 1: |
| 440 |
# forward to sip:[email protected] on no answer after 15 seconds: |
| 441 |
|
| 442 |
callPreferenceURI: sip:[email protected] n:15000 |
| 443 |
|
| 444 |
# Example 2: |
| 445 |
# unconditionally forward to sip:[email protected]: |
| 446 |
|
| 447 |
callPreferenceURI: sip:[email protected] u |
| 448 |
|
| 449 |
# Example 3: |
| 450 |
# forward to sip:[email protected] and sip:[email protected] |
| 451 |
# (forking) on destination not found: |
| 452 |
|
| 453 |
callPreferenceURI: sip:[email protected] f |
| 454 |
callPreferenceURI: sip:[email protected] f |
| 455 |
|
| 456 |
h350_result_call_preferences stores these call forwarding rules as AVPs |
| 457 |
according to the following rules: |
| 458 |
|
| 459 |
# |
| 460 |
# AVP storing a forwarding rule's target URI |
| 461 |
# |
| 462 |
|
| 463 |
AVP name = avp_name_prefix + '_' + type |
| 464 |
AVP value = target_uri |
| 465 |
|
| 466 |
# |
| 467 |
# AVP storing a forwarding rule's argument |
| 468 |
# |
| 469 |
|
| 470 |
AVP name = avp_name_prefix + '_' + type + '_t' |
| 471 |
AVP value = argument / 1000 |
| 472 |
|
| 473 |
Example 1 from above would result in two AVPs: $avp("s:prefix_n") = |
| 474 |
"sip:[email protected]" and $avp("s:prefix_n_t") = 15. |
| 475 |
|
| 476 |
Example 2: $avp("s:prefix_u") = "sip:[email protected]". |
| 477 |
|
| 478 |
Example 3: $avp("s:prefix_f[1]") = "sip:[email protected]" and |
| 479 |
$avp("s:prefix_f[2]]") = "sip:[email protected]". |
| 480 |
|
| 481 |
These AVPs can then be used to implement the desired behavior in the |
| 482 |
Kamailio routing script. |
| 483 |
|
| 484 |
This function returns the number of successfully parsed simple call |
| 485 |
forwarding rules (TRUE), in case the H.350 callPreferenceURI attribute |
| 486 |
contained one or multiple values matching the simple call forwarding |
| 487 |
rule syntax described above. It returns -1 (FALSE) for internal errors, |
| 488 |
and -2 (FALSE) if none of the rules matched or if no callPreferenceURI |
| 489 |
attribute was found. |
| 490 |
|
| 491 |
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, |
| 492 |
FAILURE_ROUTE and BRANCH_ROUTE. |
| 493 |
|
| 494 |
Function Parameters: |
| 495 |
|
| 496 |
avp_name_prefix |
| 497 |
Name prefix for call forwarding rule AVPs, as described above. |
| 498 |
|
| 499 |
Return Values: |
| 500 |
|
| 501 |
n > 0 (TRUE): |
| 502 |
|
| 503 |
+ n simple call forwarding rules found. |
| 504 |
|
| 505 |
-1 (FALSE): |
| 506 |
|
| 507 |
+ Internal error occurred. |
| 508 |
|
| 509 |
-2 (FALSE): |
| 510 |
|
| 511 |
+ No simple call forwarding rule found, or callPreferenceURI not |
| 512 |
present. |
| 513 |
|
| 514 |
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, |
| 515 |
BRANCH_ROUTE, and ONREPLY_ROUTE. |
| 516 |
|
| 517 |
Example 1.8. Example Usage |
| 518 |
# |
| 519 |
# H.350 lookup for callee |
| 520 |
# |
| 521 |
|
| 522 |
... h350_sipuri_lookup("sip:$rU@$rd") ... |
| 523 |
|
| 524 |
# |
| 525 |
# store H.350 call preferences in AVP |
| 526 |
# |
| 527 |
|
| 528 |
if (!h350_result_call_preferences("callee_pref_") && ($retcode == -1)) |
| 529 |
{ |
| 530 |
sl_send_reply("500", "Internal server error"); |
| 531 |
exit; |
| 532 |
} |
| 533 |
|
| 534 |
# $avp(s:callee_pref_u) == CFU URI(s) |
| 535 |
# $avp(s:callee_pref_n) == CFNR URI(s) |
| 536 |
# $avp(s:callee_pref_n_t) == CFNR timeout in seconds |
| 537 |
# $avp(s:callee_pref_b) == CFB URI(s) |
| 538 |
# $avp(s:callee_pref_f) == CFOFFLINE URI(s) |
| 539 |
|
| 540 |
# |
| 541 |
# Example for forward-unconditionally (CFU) |
| 542 |
# |
| 543 |
|
| 544 |
if (is_avp_set("$avp(s:callee_pref_u)")) |
| 545 |
{ |
| 546 |
# replace R-URI with CFU URI, g will fetch all CFU URIs |
| 547 |
# --> request can fork |
| 548 |
if (avp_pushto("$ru", "$avp(s:callee_pref_u)/g")) |
| 549 |
{ |
| 550 |
avp_delete("$avp(s:callee_pref_u)"); |
| 551 |
} else |
| 552 |
{ |
| 553 |
sl_send_reply("500", "Internal server error"); |
| 554 |
exit; |
| 555 |
} |
| 556 |
sl_send_reply("181", "Call is being forwarded"); |
| 557 |
t_relay(); |
| 558 |
exit; |
| 559 |
} |
| 560 |
|
| 561 |
4.4. h350_result_service_level(avp_name_prefix) |
| 562 |
|
| 563 |
Directory services architecture for SIP [H.350.4] defines a |
| 564 |
multi-valued LDAP attribute named SIPIdentityServiceLevel, which can be |
| 565 |
used to store SIP account service level values in an LDAP directory. |
| 566 |
This function parses the SIPIdentityServiceLevel attribute and stores |
| 567 |
all service level values as AVPs for later retrieval in the Kamailio |
| 568 |
routing script. The function accesses the H.350 commObject fetched by a |
| 569 |
call to h350_*_lookup or ldap_search. |
| 570 |
|
| 571 |
The resulting AVPs have a name of the form avp_name_prefix + |
| 572 |
SIPIdentityServiceLevel attribute value, and an integer value of 1. |
| 573 |
|
| 574 |
Example 1.9. Example SIPIdentityServiceLevel values and resulting AVPs |
| 575 |
SIPIdentityServiceLevel: longdistance |
| 576 |
SIPIdentityServiceLevel: international |
| 577 |
SIPIdentityServiceLevel: 900 |
| 578 |
|
| 579 |
after calling h350_result_service_level("sl_"), the following AVPs |
| 580 |
will be available in the routing script: |
| 581 |
|
| 582 |
$avp("s:sl_longdistance") = 1 |
| 583 |
$avp("s:sl_international") = 1 |
| 584 |
$avp("s:sl_900") = 1 |
| 585 |
|
| 586 |
This function returns the number of added AVPs (TRUE), -1 (FALSE)for |
| 587 |
internal errors, and -2 (FALSE)if no SIPIdentityServiceLevel attribute |
| 588 |
was found. |
| 589 |
|
| 590 |
The function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, |
| 591 |
FAILURE_ROUTE and BRANCH_ROUTE. |
| 592 |
|
| 593 |
Function Parameters: |
| 594 |
|
| 595 |
avp_name_prefix |
| 596 |
Name prefix for service level AVPs, as described above. |
| 597 |
|
| 598 |
Return Values: |
| 599 |
|
| 600 |
n > 0 (TRUE): |
| 601 |
|
| 602 |
+ n AVPs added. |
| 603 |
|
| 604 |
-1 (FALSE): |
| 605 |
|
| 606 |
+ Internal error occurred. |
| 607 |
|
| 608 |
-2 (FALSE): |
| 609 |
|
| 610 |
+ No SIPIdentityServiceLevel attribute found. |
| 611 |
|
| 612 |
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, |
| 613 |
BRANCH_ROUTE, and ONREPLY_ROUTE. |
| 614 |
|
| 615 |
Example 1.10. Example Usage |
| 616 |
# |
| 617 |
# H.350 SIP digest authentication for caller |
| 618 |
# |
| 619 |
|
| 620 |
... h350_auth_lookup("$au", ...) ... |
| 621 |
|
| 622 |
# |
| 623 |
# store caller's service level as AVP |
| 624 |
# |
| 625 |
|
| 626 |
if (!h350_result_service_level("caller_sl_") && ($retcode == -1)) |
| 627 |
{ |
| 628 |
sl_send_reply("500", "Internal server error"); |
| 629 |
exit; |
| 630 |
} |
| 631 |
|
| 632 |
# |
| 633 |
# make routing decision based on service level AVPs |
| 634 |
# |
| 635 |
|
| 636 |
if (is_avp_set("$avp(s:caller_sl_international)")) |
| 637 |
{ |
| 638 |
t_relay(); |
| 639 |
} |
| 640 |
else { |
| 641 |
sl_send_reply("403", "Forbidden"); |
| 642 |
} |
| 643 |
exit; |
| 644 |
|
| 645 |
Resources |
| 646 |
|
| 647 |
[H.350] Directory Services Architecture for Multimedia Conferencing. |
| 648 |
August 2003. ITU-T. |
| 649 |
|
| 650 |
[H.350.4] Directory services architecture for SIP. August 2003. ITU-T. |
| 651 |
|
| 652 |
[H.350.6] Directory services architecture for call forwarding and |
| 653 |
preferences. March 2004. ITU-T. |
| 654 |
|
| 655 |
[ViDe-H.350-Cookbook] ViDe H.350 Cookbook. 2005. ViDe. |
| 656 |
|
| 657 |
[RFC4510] Lightweight Directory Access Protocol (LDAP): Technical |
| 658 |
Specification Road Map. June 2006. Internet Engineering Task Force. |