| 1 |
Resource List Server |
| 2 |
|
| 3 |
Anca-Maria Vamanu |
| 4 |
|
| 5 |
Voice Sistem SRL |
| 6 |
|
| 7 |
Edited by |
| 8 |
|
| 9 |
Anca-Maria Vamanu |
| 10 |
|
| 11 |
Copyright © 2007 Voice Sistem SRL |
| 12 |
__________________________________________________________________ |
| 13 |
|
| 14 |
Table of Contents |
| 15 |
|
| 16 |
1. Admin Guide |
| 17 |
|
| 18 |
1. Overview |
| 19 |
2. Dependencies |
| 20 |
|
| 21 |
2.1. Kamailio Modules |
| 22 |
2.2. External Libraries or Applications |
| 23 |
|
| 24 |
3. Parameters |
| 25 |
|
| 26 |
3.1. db_url(str) |
| 27 |
3.2. rlpres_db_url(str) |
| 28 |
3.3. xcap_db_url(str) |
| 29 |
3.4. db_mode(int) |
| 30 |
3.5. xcap_table(str) |
| 31 |
3.6. rlsubs_table(str) |
| 32 |
3.7. rlpres_table(str) |
| 33 |
3.8. clean_period (int) |
| 34 |
3.9. rlpres_clean_period (int) |
| 35 |
3.10. waitn_time (int) |
| 36 |
3.11. notifier_poll_rate (int) |
| 37 |
3.12. notifier_processes (int) |
| 38 |
3.13. max_expires (int) |
| 39 |
3.14. expires_offset (int) |
| 40 |
3.15. hash_size (int) |
| 41 |
3.16. xcap_root (str) |
| 42 |
3.17. integrated_xcap_server (int) |
| 43 |
3.18. to_presence_code (int) |
| 44 |
3.19. rls_event (str) |
| 45 |
3.20. outbound_proxy (str) |
| 46 |
3.21. server_address (str) |
| 47 |
3.22. max_notify_body_length (int) |
| 48 |
3.23. reload_db_subs (integer) |
| 49 |
3.24. fetch_rows (integer) |
| 50 |
3.25. disable_remote_presence (integer) |
| 51 |
3.26. max_backend_subs (integer) |
| 52 |
|
| 53 |
4. Functions |
| 54 |
|
| 55 |
4.1. rls_handle_subscribe([watcher_uri]) |
| 56 |
4.2. rls_handle_notify() |
| 57 |
4.3. rls_update_subs(uri, event) |
| 58 |
|
| 59 |
5. RPC Commands |
| 60 |
|
| 61 |
5.1. rls.cleanup |
| 62 |
5.2. rls.update_subs |
| 63 |
|
| 64 |
6. Installation |
| 65 |
|
| 66 |
2. Developer Guide |
| 67 |
|
| 68 |
List of Examples |
| 69 |
|
| 70 |
1.1. Set db_url parameter |
| 71 |
1.2. Set rlpres_db_url parameter |
| 72 |
1.3. Set xcap_db_url parameter |
| 73 |
1.4. Set db_mode parameter |
| 74 |
1.5. Set xcap_table parameter |
| 75 |
1.6. Set rlsubs_table parameter |
| 76 |
1.7. Set rlpres_table parameter |
| 77 |
1.8. Set clean_period parameter |
| 78 |
1.9. Set rlpres_clean_period parameter |
| 79 |
1.10. Set waitn_time parameter |
| 80 |
1.11. Set notifier_poll_rate parameter |
| 81 |
1.12. Set notifier_processes parameter |
| 82 |
1.13. Set max_expires parameter |
| 83 |
1.14. Set expires_offset parameter |
| 84 |
1.15. Set hash_size parameter |
| 85 |
1.16. Set hash_size parameter |
| 86 |
1.17. Set integrated_xcap_server parameter |
| 87 |
1.18. Set to_presence_code parameter |
| 88 |
1.19. Set rls_event parameter |
| 89 |
1.20. Set outbound_proxy parameter |
| 90 |
1.21. Set server_address parameter |
| 91 |
1.22. Set max_notify_body_length parameter |
| 92 |
1.23. Set reload_db_subs parameter |
| 93 |
1.24. Set fetch_rows parameter |
| 94 |
1.25. Set disable_remote_presence parameter |
| 95 |
1.26. Set max_backend_subs parameter |
| 96 |
1.27. rls_handle_subscribe usage |
| 97 |
1.28. rls_handle_notify usage |
| 98 |
1.29. rls_update_subs usage |
| 99 |
|
| 100 |
Chapter 1. Admin Guide |
| 101 |
|
| 102 |
Table of Contents |
| 103 |
|
| 104 |
1. Overview |
| 105 |
2. Dependencies |
| 106 |
|
| 107 |
2.1. Kamailio Modules |
| 108 |
2.2. External Libraries or Applications |
| 109 |
|
| 110 |
3. Parameters |
| 111 |
|
| 112 |
3.1. db_url(str) |
| 113 |
3.2. rlpres_db_url(str) |
| 114 |
3.3. xcap_db_url(str) |
| 115 |
3.4. db_mode(int) |
| 116 |
3.5. xcap_table(str) |
| 117 |
3.6. rlsubs_table(str) |
| 118 |
3.7. rlpres_table(str) |
| 119 |
3.8. clean_period (int) |
| 120 |
3.9. rlpres_clean_period (int) |
| 121 |
3.10. waitn_time (int) |
| 122 |
3.11. notifier_poll_rate (int) |
| 123 |
3.12. notifier_processes (int) |
| 124 |
3.13. max_expires (int) |
| 125 |
3.14. expires_offset (int) |
| 126 |
3.15. hash_size (int) |
| 127 |
3.16. xcap_root (str) |
| 128 |
3.17. integrated_xcap_server (int) |
| 129 |
3.18. to_presence_code (int) |
| 130 |
3.19. rls_event (str) |
| 131 |
3.20. outbound_proxy (str) |
| 132 |
3.21. server_address (str) |
| 133 |
3.22. max_notify_body_length (int) |
| 134 |
3.23. reload_db_subs (integer) |
| 135 |
3.24. fetch_rows (integer) |
| 136 |
3.25. disable_remote_presence (integer) |
| 137 |
3.26. max_backend_subs (integer) |
| 138 |
|
| 139 |
4. Functions |
| 140 |
|
| 141 |
4.1. rls_handle_subscribe([watcher_uri]) |
| 142 |
4.2. rls_handle_notify() |
| 143 |
4.3. rls_update_subs(uri, event) |
| 144 |
|
| 145 |
5. RPC Commands |
| 146 |
|
| 147 |
5.1. rls.cleanup |
| 148 |
5.2. rls.update_subs |
| 149 |
|
| 150 |
6. Installation |
| 151 |
|
| 152 |
1. Overview |
| 153 |
|
| 154 |
The module is a Resource List Server implementation following the |
| 155 |
specification in RFC 4662 and RFC 4826. |
| 156 |
|
| 157 |
The server is independent from local presence servers, retrieving |
| 158 |
presence information with Subscribe-Notify messages. |
| 159 |
|
| 160 |
The module uses the presence module as a library, as it requires a |
| 161 |
resembling mechanism for handling Subscribe. Therefore, in case the |
| 162 |
local presence server is not collocated on the same machine with the RL |
| 163 |
server, the presence module should be loaded in a library mode only |
| 164 |
(see doc for presence module). |
| 165 |
|
| 166 |
It handles subscription to lists in an event independent way. The |
| 167 |
default event is presence, but if some other events are to be handled |
| 168 |
by the server, they should be added using the module parameter |
| 169 |
"rls_events". |
| 170 |
|
| 171 |
It works with XCAP server for storage. There is also the possibility to |
| 172 |
configure it to work in an integrated_xcap server mode, when it only |
| 173 |
queries database for the resource lists documents. This is useful in a |
| 174 |
small architecture when all the clients use an integrated server and |
| 175 |
there are no references to exterior documents in their lists. |
| 176 |
|
| 177 |
The same as presence module, it has a caching mode with periodical |
| 178 |
update in database for subscribe information. The information retrieved |
| 179 |
with Notify messages is stored in database only. |
| 180 |
|
| 181 |
2. Dependencies |
| 182 |
|
| 183 |
2.1. Kamailio Modules |
| 184 |
2.2. External Libraries or Applications |
| 185 |
|
| 186 |
2.1. Kamailio Modules |
| 187 |
|
| 188 |
The following modules must be loaded before this module: |
| 189 |
* a database module. |
| 190 |
* sl. |
| 191 |
* tm. |
| 192 |
* presence- in a library mode. |
| 193 |
* pua. |
| 194 |
|
| 195 |
2.2. External Libraries or Applications |
| 196 |
|
| 197 |
* libxml. |
| 198 |
|
| 199 |
3. Parameters |
| 200 |
|
| 201 |
3.1. db_url(str) |
| 202 |
3.2. rlpres_db_url(str) |
| 203 |
3.3. xcap_db_url(str) |
| 204 |
3.4. db_mode(int) |
| 205 |
3.5. xcap_table(str) |
| 206 |
3.6. rlsubs_table(str) |
| 207 |
3.7. rlpres_table(str) |
| 208 |
3.8. clean_period (int) |
| 209 |
3.9. rlpres_clean_period (int) |
| 210 |
3.10. waitn_time (int) |
| 211 |
3.11. notifier_poll_rate (int) |
| 212 |
3.12. notifier_processes (int) |
| 213 |
3.13. max_expires (int) |
| 214 |
3.14. expires_offset (int) |
| 215 |
3.15. hash_size (int) |
| 216 |
3.16. xcap_root (str) |
| 217 |
3.17. integrated_xcap_server (int) |
| 218 |
3.18. to_presence_code (int) |
| 219 |
3.19. rls_event (str) |
| 220 |
3.20. outbound_proxy (str) |
| 221 |
3.21. server_address (str) |
| 222 |
3.22. max_notify_body_length (int) |
| 223 |
3.23. reload_db_subs (integer) |
| 224 |
3.24. fetch_rows (integer) |
| 225 |
3.25. disable_remote_presence (integer) |
| 226 |
3.26. max_backend_subs (integer) |
| 227 |
|
| 228 |
3.1. db_url(str) |
| 229 |
|
| 230 |
The database url. |
| 231 |
|
| 232 |
Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”. |
| 233 |
|
| 234 |
Example 1.1. Set db_url parameter |
| 235 |
... |
| 236 |
modparam("rls", "db_url", "dbdriver://username:password@dbhost/dbname") |
| 237 |
... |
| 238 |
|
| 239 |
3.2. rlpres_db_url(str) |
| 240 |
|
| 241 |
The rlpres (rls_presentity table) database url. This parameter only |
| 242 |
needs to be specified if the rls_watchers table and rls_presentity |
| 243 |
tables are in different databases. rls_presentity is used to cache the |
| 244 |
bodies of back-end NOTIFY requests until an RLS NOTIFY can be sent. On |
| 245 |
a multi-server system having a single cache for all active servers can |
| 246 |
cause issues if both servers try to send RLS NOTIFY requests at the |
| 247 |
same time. This parameter enables each server to have its own (possibly |
| 248 |
local) rls_presentity table. |
| 249 |
|
| 250 |
Default value is a mirror of the “db_url” setting. |
| 251 |
|
| 252 |
Example 1.2. Set rlpres_db_url parameter |
| 253 |
... |
| 254 |
modparam("rls", "rlpres_db_url", "dbdriver://username:password@dbhost/dbname") |
| 255 |
... |
| 256 |
|
| 257 |
3.3. xcap_db_url(str) |
| 258 |
|
| 259 |
The xcap database url. This parameter only needs to be specified if the |
| 260 |
rls db and integrated xcap server db have different urls. |
| 261 |
|
| 262 |
Default value is a mirror of the “db_url” setting. |
| 263 |
|
| 264 |
Example 1.3. Set xcap_db_url parameter |
| 265 |
... |
| 266 |
modparam("rls", "xcap_db_url", "dbdriver://username:password@dbhost/dbname") |
| 267 |
... |
| 268 |
|
| 269 |
3.4. db_mode(int) |
| 270 |
|
| 271 |
The module supports 2 modes of operation, high speed memory based |
| 272 |
storage (mode 0), and database only (mode 2) where all data is stored |
| 273 |
in a database, allowing scalability at the expense of speed. Mode 1 is |
| 274 |
reserved. |
| 275 |
|
| 276 |
Default value is “0” |
| 277 |
|
| 278 |
Example 1.4. Set db_mode parameter |
| 279 |
... |
| 280 |
modparam("rls", "db_mode", 2) |
| 281 |
... |
| 282 |
|
| 283 |
3.5. xcap_table(str) |
| 284 |
|
| 285 |
The name of the xcap table in which the integrated server or the |
| 286 |
xcap_client module writes. If integrated_xcap_server parameter not set, |
| 287 |
the name of the table must be the same as the one set for the |
| 288 |
xcap_client module. |
| 289 |
|
| 290 |
Default value is “xcap”. |
| 291 |
|
| 292 |
Example 1.5. Set xcap_table parameter |
| 293 |
... |
| 294 |
modparam("rls", "xcap_table", "xcaps"); |
| 295 |
... |
| 296 |
|
| 297 |
3.6. rlsubs_table(str) |
| 298 |
|
| 299 |
The name of the db table where resource lists subscription information |
| 300 |
is stored. |
| 301 |
|
| 302 |
Default value is “rls_watchers”. |
| 303 |
|
| 304 |
Example 1.6. Set rlsubs_table parameter |
| 305 |
... |
| 306 |
modparam("rls", "rlsubs_table", "rls_subscriptions") |
| 307 |
... |
| 308 |
|
| 309 |
3.7. rlpres_table(str) |
| 310 |
|
| 311 |
The name of the db table where notified event specific information is |
| 312 |
stored. |
| 313 |
|
| 314 |
Default value is “rls_presentity”. |
| 315 |
|
| 316 |
Example 1.7. Set rlpres_table parameter |
| 317 |
... |
| 318 |
modparam("rls", "rlpres_table", "rls_notify") |
| 319 |
... |
| 320 |
|
| 321 |
3.8. clean_period (int) |
| 322 |
|
| 323 |
The period at which to check for expired information. 0 means do not |
| 324 |
check. |
| 325 |
|
| 326 |
Default value is “100”. |
| 327 |
|
| 328 |
Example 1.8. Set clean_period parameter |
| 329 |
... |
| 330 |
modparam("rls", "clean_period", 100) |
| 331 |
... |
| 332 |
|
| 333 |
3.9. rlpres_clean_period (int) |
| 334 |
|
| 335 |
The period at which to check for expired rls_presentity information. -1 |
| 336 |
means do not use (clean_period) is used instead. 0 means do not check. |
| 337 |
This option can be used when you want to check rls_presentity and |
| 338 |
rls_watchers on different timeouts. This is useful when they are in |
| 339 |
different databases. |
| 340 |
|
| 341 |
Default value is “-1”. |
| 342 |
|
| 343 |
Example 1.9. Set rlpres_clean_period parameter |
| 344 |
... |
| 345 |
modparam("rls", "rlpres_clean_period", 100) |
| 346 |
... |
| 347 |
|
| 348 |
3.10. waitn_time (int) |
| 349 |
|
| 350 |
The maximum time period that RLS NOTIFY requests will be buffered for. |
| 351 |
The server will attempt to send NOTIFY requests with the updated |
| 352 |
presence state of the subscribed list or watcher information within |
| 353 |
this many seconds of a change occurring. |
| 354 |
|
| 355 |
Default value is “5”. |
| 356 |
|
| 357 |
Example 1.10. Set waitn_time parameter |
| 358 |
... |
| 359 |
modparam("rls", "waitn_time", 10) |
| 360 |
... |
| 361 |
|
| 362 |
3.11. notifier_poll_rate (int) |
| 363 |
|
| 364 |
The number of times per second that the notifier processes should check |
| 365 |
for work. Approximately 1/(waitn_time * notifier_poll_rate * |
| 366 |
notifier_processes) of the pending updates will be sent each time a |
| 367 |
notifier process runs. |
| 368 |
|
| 369 |
Separate notifier processes are only run when db_mode is 2 (DB only |
| 370 |
mode). |
| 371 |
|
| 372 |
Default value is “10”. |
| 373 |
|
| 374 |
Example 1.11. Set notifier_poll_rate parameter |
| 375 |
... |
| 376 |
modparam("rls", "notifier_poll_rate", 20) |
| 377 |
... |
| 378 |
|
| 379 |
3.12. notifier_processes (int) |
| 380 |
|
| 381 |
The number of notifier processes that should be started. |
| 382 |
|
| 383 |
Separate notifier processes are only run when db_mode is 2 (DB only |
| 384 |
mode). |
| 385 |
|
| 386 |
Default value is “1”. |
| 387 |
|
| 388 |
Example 1.12. Set notifier_processes parameter |
| 389 |
... |
| 390 |
modparam("rls", "notifier_processes", 2) |
| 391 |
... |
| 392 |
|
| 393 |
3.13. max_expires (int) |
| 394 |
|
| 395 |
The maximum accepted expires for a subscription to a list. |
| 396 |
|
| 397 |
Default value is “7200”. |
| 398 |
|
| 399 |
Example 1.13. Set max_expires parameter |
| 400 |
... |
| 401 |
modparam("rls", "max_expires", 10800) |
| 402 |
... |
| 403 |
|
| 404 |
3.14. expires_offset (int) |
| 405 |
|
| 406 |
This parameter only has an effect when the db_mode is DB_ONLY (mode 2). |
| 407 |
When expired subscribers are checked for deletion from the database, |
| 408 |
those that have a value in the expires column which is less than |
| 409 |
current_time - expires_offset are matched. Hence when an offset of zero |
| 410 |
is used, all those that expire prior the current time will be deleted. |
| 411 |
If an offset of 't' is used, only those that expired more than t |
| 412 |
seconds ago are deleted from the database. Negative offsets are treated |
| 413 |
as though an offset of zero was specified. |
| 414 |
|
| 415 |
Default value is “0”. |
| 416 |
|
| 417 |
Example 1.14. Set expires_offset parameter |
| 418 |
... |
| 419 |
modparam("rls", "expires_offset", 0) |
| 420 |
... |
| 421 |
|
| 422 |
3.15. hash_size (int) |
| 423 |
|
| 424 |
The dimension of the hash table used to store subscription to a list. |
| 425 |
This parameter will be used as the power of 2 when computing table |
| 426 |
size. |
| 427 |
|
| 428 |
Default value is “9 (512)”. |
| 429 |
|
| 430 |
Example 1.15. Set hash_size parameter |
| 431 |
... |
| 432 |
modparam("rls", "hash_size", 11) |
| 433 |
... |
| 434 |
|
| 435 |
3.16. xcap_root (str) |
| 436 |
|
| 437 |
The address of the xcap server. |
| 438 |
|
| 439 |
Default value is “NULL”. |
| 440 |
|
| 441 |
Example 1.16. Set hash_size parameter |
| 442 |
... |
| 443 |
modparam("rls", "xcap_root", "http://192.168.2.132/xcap-root:800") |
| 444 |
... |
| 445 |
|
| 446 |
3.17. integrated_xcap_server (int) |
| 447 |
|
| 448 |
This parameter should be set if only integrated xcap servers are used |
| 449 |
to store resource lists. |
| 450 |
|
| 451 |
Default value is “0”. |
| 452 |
|
| 453 |
Example 1.17. Set integrated_xcap_server parameter |
| 454 |
... |
| 455 |
modparam("rls", "integrated_xcap_server", 1) |
| 456 |
... |
| 457 |
|
| 458 |
3.18. to_presence_code (int) |
| 459 |
|
| 460 |
The code to be returned by rls_handle_subscribe function if the |
| 461 |
processed Subscribe is not a resource list Subscribe. This code can be |
| 462 |
used in an architecture with presence and rls servers collocated on the |
| 463 |
same machine, to call handle_subscribe on the message causing this |
| 464 |
code. |
| 465 |
|
| 466 |
Default value is “0”. |
| 467 |
|
| 468 |
Example 1.18. Set to_presence_code parameter |
| 469 |
... |
| 470 |
modparam("rls", "to_presence_code", 10) |
| 471 |
... |
| 472 |
|
| 473 |
3.19. rls_event (str) |
| 474 |
|
| 475 |
The default event that RLS handles is presence. If some other events |
| 476 |
should also be handled by RLS they should be added using this |
| 477 |
parameter. It can be set more than once. |
| 478 |
|
| 479 |
Default value is “"presence"”. |
| 480 |
|
| 481 |
Example 1.19. Set rls_event parameter |
| 482 |
... |
| 483 |
modparam("rls", "rls_event", "dialog;sla") |
| 484 |
... |
| 485 |
|
| 486 |
3.20. outbound_proxy (str) |
| 487 |
|
| 488 |
The SIP address where to send RLS subscriptions (outbound proxy address |
| 489 |
as SIP URI). |
| 490 |
|
| 491 |
Default value is “NULL”. |
| 492 |
|
| 493 |
Example 1.20. Set outbound_proxy parameter |
| 494 |
... |
| 495 |
modparam("rls", "outbound_proxy", "sip:presence.kamailio.org") |
| 496 |
... |
| 497 |
|
| 498 |
3.21. server_address (str) |
| 499 |
|
| 500 |
The address of the server that will be used as a contact in sent |
| 501 |
Subscribe requests and 200 OK replies for Subscribe requests for RLS. |
| 502 |
It is a mandatory parameter. |
| 503 |
|
| 504 |
Example 1.21. Set server_address parameter |
| 505 |
... |
| 506 |
modparam("rls", "server_address", "sip:[email protected]:5060") |
| 507 |
... |
| 508 |
|
| 509 |
3.22. max_notify_body_length (int) |
| 510 |
|
| 511 |
The maximum size that the body of a NOTIFY message may be. If set to 0 |
| 512 |
(the default), no size limit is applied. Note that this refers only to |
| 513 |
the body, not the complete NOTIFY message. |
| 514 |
|
| 515 |
Example 1.22. Set max_notify_body_length parameter |
| 516 |
... |
| 517 |
modparam("rls", "max_notify_body_length", 32000) |
| 518 |
... |
| 519 |
|
| 520 |
3.23. reload_db_subs (integer) |
| 521 |
|
| 522 |
Reload subscriptions on module initialization (requires db_mode 0 |
| 523 |
(memory only mode)). |
| 524 |
|
| 525 |
Default value is 0 (do not load rows from db). |
| 526 |
|
| 527 |
Example 1.23. Set reload_db_subs parameter |
| 528 |
... |
| 529 |
modparam("rls", "reload_db_subs", 1) |
| 530 |
... |
| 531 |
|
| 532 |
3.24. fetch_rows (integer) |
| 533 |
|
| 534 |
Number of rows to be loaded in one step from database. |
| 535 |
|
| 536 |
Default value is 500. |
| 537 |
|
| 538 |
Example 1.24. Set fetch_rows parameter |
| 539 |
... |
| 540 |
modparam("rls", "fetch_rows", 1000) |
| 541 |
... |
| 542 |
|
| 543 |
3.25. disable_remote_presence (integer) |
| 544 |
|
| 545 |
When set to a non-zero value RLS will not perform back-end SUBSCRIBEs |
| 546 |
to non-local presentities. When people have large contact lists RLS |
| 547 |
will make lots of back-end subscriptions for each local subscriber. |
| 548 |
This can be a lot of traffic, and if the contact lists contain |
| 549 |
non-local (as in not on this Kamailio server or cluster) contacts this |
| 550 |
can result in a lot of Internet traffic. Setting this option to a |
| 551 |
non-zero value prevents RLS from performing back-end SUBSCRIBEs for |
| 552 |
remote presentities. |
| 553 |
|
| 554 |
Default value is 0 |
| 555 |
|
| 556 |
Example 1.25. Set disable_remote_presence parameter |
| 557 |
... |
| 558 |
modparam("rls", "disable_remote_presence", 1) |
| 559 |
... |
| 560 |
|
| 561 |
3.26. max_backend_subs (integer) |
| 562 |
|
| 563 |
When set to a non-zero value RLS will limit the number of back-end |
| 564 |
SUBSCRIBEs for each RLS SUBSCRIBE to this value. Leaving this at the |
| 565 |
default of zero means no limit. When people have large contact lists |
| 566 |
RLS will make lots of back-end subscriptions. This can easily overload |
| 567 |
a system. This option allows you to limit the number of back-end |
| 568 |
SUBSCRIBEs to help prevent overload. |
| 569 |
|
| 570 |
Default value is 0 |
| 571 |
|
| 572 |
Example 1.26. Set max_backend_subs parameter |
| 573 |
... |
| 574 |
modparam("rls", "max_backend_subs", 30) |
| 575 |
... |
| 576 |
|
| 577 |
4. Functions |
| 578 |
|
| 579 |
4.1. rls_handle_subscribe([watcher_uri]) |
| 580 |
4.2. rls_handle_notify() |
| 581 |
4.3. rls_update_subs(uri, event) |
| 582 |
|
| 583 |
4.1. rls_handle_subscribe([watcher_uri]) |
| 584 |
|
| 585 |
This function detects if a Subscribe message should be handled by RLS. |
| 586 |
If not it replies with the configured to_presence_code. If it is, it |
| 587 |
extracts the dialog info and sends aggregate Notify requests with |
| 588 |
information for the list. |
| 589 |
|
| 590 |
By default this function uses the From: URI from the SUBSCRIBE request |
| 591 |
as the Watcher URI. The optional watcher_uri parameter can be used to |
| 592 |
specify a different Watcher URI, possibly taken from a SIP header like |
| 593 |
P-Asserted-Identity:. |
| 594 |
|
| 595 |
This function can be used from REQUEST_ROUTE. |
| 596 |
|
| 597 |
Example 1.27. rls_handle_subscribe usage |
| 598 |
... |
| 599 |
For presence and rls on the same machine: |
| 600 |
modparam("rls", "to_presence_code", 10) |
| 601 |
|
| 602 |
if(is_method("SUBSCRIBE")) |
| 603 |
{ |
| 604 |
$var(ret_code)= rls_handle_subscribe(); |
| 605 |
|
| 606 |
if($var(ret_code)== 10) |
| 607 |
handle_subscribe(); |
| 608 |
|
| 609 |
t_release(); |
| 610 |
} |
| 611 |
|
| 612 |
For rls only: |
| 613 |
if(is_method("SUBSCRIBE")) |
| 614 |
{ |
| 615 |
rls_handle_subscribe(); |
| 616 |
t_release(); |
| 617 |
} |
| 618 |
|
| 619 |
... |
| 620 |
|
| 621 |
4.2. rls_handle_notify() |
| 622 |
|
| 623 |
Handle NOTIFY requests. |
| 624 |
|
| 625 |
This function can be used from REQUEST_ROUTE. |
| 626 |
|
| 627 |
Example 1.28. rls_handle_notify usage |
| 628 |
... |
| 629 |
if(method=="NOTIFY") |
| 630 |
rls_handle_notify(); |
| 631 |
... |
| 632 |
|
| 633 |
4.3. rls_update_subs(uri, event) |
| 634 |
|
| 635 |
This function can be used in configuration to trigger updates to |
| 636 |
resource list subscriptions (for example, after the contents of a |
| 637 |
resource list has changes). |
| 638 |
|
| 639 |
Parameters: |
| 640 |
* uri - the uri of the user who made the change and whose resource |
| 641 |
list subscriptions should be updated |
| 642 |
* event - the event package (e.g. presence). |
| 643 |
|
| 644 |
This function can be used from ANY_ROUTE. |
| 645 |
|
| 646 |
Example 1.29. rls_update_subs usage |
| 647 |
... |
| 648 |
Within event_route[xhttp:request]: |
| 649 |
case "PUT": |
| 650 |
xcaps_put("$var(uri)", "$var(doc_uri)", "$rb"); |
| 651 |
if($xcapuri(u=>auid)=~"pres-rules") { |
| 652 |
pres_update_watchers("$var(uri)", "presence"); |
| 653 |
pres_refresh_watchers("$var(uri)", "presence", 1); |
| 654 |
} else if ($xcapuri(u=>auid)=~"resource-lists" |
| 655 |
|| $xcapuri(u=>auid)=~"rls-services") { |
| 656 |
rls_update_subs("$var(uri)", "presence"); |
| 657 |
} |
| 658 |
exit; |
| 659 |
break; |
| 660 |
... |
| 661 |
|
| 662 |
5. RPC Commands |
| 663 |
|
| 664 |
5.1. rls.cleanup |
| 665 |
5.2. rls.update_subs |
| 666 |
|
| 667 |
5.1. rls.cleanup |
| 668 |
|
| 669 |
Manually triggers the cleanup functions for the rls_watchers and |
| 670 |
rls_presentity tables. Useful if you have set clean_period to zero or |
| 671 |
less. |
| 672 |
|
| 673 |
Name: rls.cleanup |
| 674 |
|
| 675 |
Parameters: none |
| 676 |
|
| 677 |
RPC Command Format: |
| 678 |
... |
| 679 |
kamctl rpc rls.cleanup |
| 680 |
... |
| 681 |
|
| 682 |
5.2. rls.update_subs |
| 683 |
|
| 684 |
Manually triggers updates to resource list subscriptions (for example, |
| 685 |
after the contents of a resource list has changes). |
| 686 |
|
| 687 |
Name: rls.cleanup |
| 688 |
|
| 689 |
Parameters: |
| 690 |
* uri - the uri of the user who made the change and whose resource |
| 691 |
list subscriptions should be updated |
| 692 |
* event - the event package (e.g. presence). |
| 693 |
|
| 694 |
RPC Command Format: |
| 695 |
... |
| 696 |
kamctl rpc rls.update_subs sip:[email protected] presence |
| 697 |
... |
| 698 |
|
| 699 |
6. Installation |
| 700 |
|
| 701 |
The module requires 2 tables in Kamailio database: rls_presentity and |
| 702 |
rls_watchers. The SQL syntax to create them can be found in |
| 703 |
rls-create.sql script in the database directories in the |
| 704 |
kamailio/scripts folder. You can also find the complete database |
| 705 |
documentation on the project webpage, |
| 706 |
https://www.kamailio.org/docs/db-tables/kamailio-db-devel.html. |
| 707 |
|
| 708 |
Chapter 2. Developer Guide |
| 709 |
|
| 710 |
The module provides no functions to be used in other Kamailio modules. |