| 1 |
Presence Module |
| 2 |
|
| 3 |
Anca-Maria Vamanu |
| 4 |
|
| 5 |
Voice Sistem SRL |
| 6 |
|
| 7 |
Juha Heinanen |
| 8 |
|
| 9 |
TutPro Inc. |
| 10 |
|
| 11 |
Edited by |
| 12 |
|
| 13 |
Anca-Maria Vamanu |
| 14 |
|
| 15 |
Juha Heinanen |
| 16 |
|
| 17 |
Copyright © 2006 Voice Sistem SRL |
| 18 |
|
| 19 |
Copyright © 2009 Juha Heinanen |
| 20 |
__________________________________________________________________ |
| 21 |
|
| 22 |
Table of Contents |
| 23 |
|
| 24 |
1. Admin Guide |
| 25 |
|
| 26 |
1. Overview |
| 27 |
2. Dependencies |
| 28 |
|
| 29 |
2.1. Kamailio Modules |
| 30 |
2.2. External Libraries or Applications |
| 31 |
|
| 32 |
3. Parameters |
| 33 |
|
| 34 |
3.1. db_url(str) |
| 35 |
3.2. presentity_table(str) |
| 36 |
3.3. active_watchers_table(str) |
| 37 |
3.4. watchers_table(str) |
| 38 |
3.5. clean_period (int) |
| 39 |
3.6. cseq_offset (int) |
| 40 |
3.7. db_update_period (int) |
| 41 |
3.8. waitn_time (int) |
| 42 |
3.9. notifier_poll_rate (int) |
| 43 |
3.10. notifier_processes (int) |
| 44 |
3.11. force_delete (int) |
| 45 |
3.12. startup_mode (int) |
| 46 |
3.13. expires_offset (int) |
| 47 |
3.14. max_expires (int) |
| 48 |
3.15. min_expires (int) |
| 49 |
3.16. min_expires_action (int) |
| 50 |
3.17. server_address (str) |
| 51 |
3.18. subs_db_mode (int) |
| 52 |
3.19. publ_cache (int) |
| 53 |
3.20. subs_htable_size (int) |
| 54 |
3.21. pres_htable_size (int) |
| 55 |
3.22. send_fast_notify (int) |
| 56 |
3.23. enable_sphere_check (int) |
| 57 |
3.24. timeout_rm_subs (int) |
| 58 |
3.25. fetch_rows (integer) |
| 59 |
3.26. db_table_lock_type (integer) |
| 60 |
3.27. local_log_level (int) |
| 61 |
3.28. local_log_facility (int) |
| 62 |
3.29. subs_remove_match (int) |
| 63 |
3.30. xavp_cfg (str) |
| 64 |
3.31. retrieve_order (int) |
| 65 |
3.32. retrieve_order_by (str) |
| 66 |
3.33. sip_uri_match (int) |
| 67 |
3.34. enable_dmq (integer) |
| 68 |
3.35. enable_pres_dmq (integer) |
| 69 |
3.36. enable_pres_sync_dmq (integer) |
| 70 |
3.37. enable_subs_dmq (integer) |
| 71 |
3.38. enable_subs_sync_dmq (integer) |
| 72 |
3.39. skip_notify_dmq (integer) |
| 73 |
3.40. default_socket (str) |
| 74 |
3.41. pres_subs_mode (integer) |
| 75 |
3.42. delete_same_subs (integer) |
| 76 |
3.43. timer_mode (integer) |
| 77 |
3.44. subs_respond_200 (integer) |
| 78 |
|
| 79 |
4. Functions |
| 80 |
|
| 81 |
4.1. handle_publish([sender_uri]) |
| 82 |
4.2. handle_subscribe([watcher_uri]) |
| 83 |
4.3. pres_auth_status(watcher_uri, presentity_uri) |
| 84 |
4.4. pres_has_subscribers(presentity_uri, event) |
| 85 |
4.5. pres_refresh_watchers(uri, event, type[, file_uri, |
| 86 |
filename]) |
| 87 |
|
| 88 |
4.6. pres_update_watchers(uri, event) |
| 89 |
|
| 90 |
5. RPC Commands |
| 91 |
|
| 92 |
5.1. presence.cleanup |
| 93 |
5.2. presence.publish_cache_sync |
| 94 |
5.3. presence.refreshWatchers |
| 95 |
5.4. presence.updateWatchers |
| 96 |
5.5. presence.presentity_list |
| 97 |
5.6. presence.presentity_show |
| 98 |
5.7. presence.watcher_list |
| 99 |
|
| 100 |
6. Exported Variables |
| 101 |
|
| 102 |
6.1. $subs(attr) |
| 103 |
6.2. $notify_reply(attr) |
| 104 |
|
| 105 |
7. Events |
| 106 |
|
| 107 |
7.1. presence:notify-reply |
| 108 |
|
| 109 |
8. Installation |
| 110 |
|
| 111 |
2. Developer Guide |
| 112 |
|
| 113 |
1. bind_presence(presence_api_t* api) |
| 114 |
2. add_event |
| 115 |
3. get_rules_doc |
| 116 |
4. get_auth_status |
| 117 |
5. apply_auth_nbody |
| 118 |
6. agg_nbody |
| 119 |
7. free_body |
| 120 |
8. aux_body_processing |
| 121 |
9. aux_free_body |
| 122 |
10. evs_publ_handl |
| 123 |
11. evs_subs_handl |
| 124 |
12. contains_event |
| 125 |
13. get_event_list |
| 126 |
14. update_watchers_status |
| 127 |
15. get_sphere |
| 128 |
16. get_presentity |
| 129 |
17. free_presentity |
| 130 |
|
| 131 |
List of Examples |
| 132 |
|
| 133 |
1.1. Set db_url parameter |
| 134 |
1.2. Set presentity_table parameter |
| 135 |
1.3. Set active_watchers_table parameter |
| 136 |
1.4. Set watchers_table parameter |
| 137 |
1.5. Set clean_period parameter |
| 138 |
1.6. Set cseq_offset parameter |
| 139 |
1.7. Set db_update_period parameter |
| 140 |
1.8. Set waitn_time parameter |
| 141 |
1.9. Set notifier_poll_rate parameter |
| 142 |
1.10. Set notifier_processes parameter |
| 143 |
1.11. Set force_delete parameter |
| 144 |
1.12. Set startup_mode parameter |
| 145 |
1.13. Set expires_offset parameter |
| 146 |
1.14. Set max_expires parameter |
| 147 |
1.15. Set min_expires parameter |
| 148 |
1.16. Set min_expires parameter |
| 149 |
1.17. Set server_address parameter |
| 150 |
1.18. Set subs_db_mode parameter |
| 151 |
1.19. Set publ_cache parameter |
| 152 |
1.20. Set subs_htable_size parameter |
| 153 |
1.21. Set pres_htable_size parameter |
| 154 |
1.22. Set send_fast_notify parameter |
| 155 |
1.23. Set enable_sphere_check parameter |
| 156 |
1.24. Set timeout_rm_subs parameter |
| 157 |
1.25. Set fetch_rows parameter |
| 158 |
1.26. Set db_table_lock_type parameter |
| 159 |
1.27. Set local_log_level parameter |
| 160 |
1.28. Set local_log_facility parameter |
| 161 |
1.29. Set subs_remove_match parameter |
| 162 |
1.30. Set xavp_cfg parameter |
| 163 |
1.31. Set retrieve_order parameter |
| 164 |
1.32. Set retrieve_order_by parameter |
| 165 |
1.33. Set sip_uri_match parameter |
| 166 |
1.34. Set enable_dmq parameter |
| 167 |
1.35. Set enable_pres_dmq parameter |
| 168 |
1.36. Set enable_pres_sync_dmq parameter |
| 169 |
1.37. Set enable_subs_dmq parameter |
| 170 |
1.38. Set enable_subs_sync_dmq parameter |
| 171 |
1.39. Set skip_notify_dmq parameter |
| 172 |
1.40. Set default_socket parameter |
| 173 |
1.41. Set pres_subs_mode parameter |
| 174 |
1.42. Set delete_same_subs parameter |
| 175 |
1.43. Set timer_mode parameter |
| 176 |
1.44. Set subs_respond_200 parameter |
| 177 |
1.45. handle_publish usage |
| 178 |
1.46. handle_subscribe usage |
| 179 |
1.47. pres_auth_status usage |
| 180 |
1.48. pres_has_subscribers usage |
| 181 |
1.49. pres_refresh_watchers usage |
| 182 |
1.50. pres_update_watchers usage |
| 183 |
1.51. $subs(name) usage |
| 184 |
1.52. $notify_reply(name) usage |
| 185 |
1.53. $notify_reply(name) usage |
| 186 |
2.1. presence_api_t structure |
| 187 |
|
| 188 |
Chapter 1. Admin Guide |
| 189 |
|
| 190 |
Table of Contents |
| 191 |
|
| 192 |
1. Overview |
| 193 |
2. Dependencies |
| 194 |
|
| 195 |
2.1. Kamailio Modules |
| 196 |
2.2. External Libraries or Applications |
| 197 |
|
| 198 |
3. Parameters |
| 199 |
|
| 200 |
3.1. db_url(str) |
| 201 |
3.2. presentity_table(str) |
| 202 |
3.3. active_watchers_table(str) |
| 203 |
3.4. watchers_table(str) |
| 204 |
3.5. clean_period (int) |
| 205 |
3.6. cseq_offset (int) |
| 206 |
3.7. db_update_period (int) |
| 207 |
3.8. waitn_time (int) |
| 208 |
3.9. notifier_poll_rate (int) |
| 209 |
3.10. notifier_processes (int) |
| 210 |
3.11. force_delete (int) |
| 211 |
3.12. startup_mode (int) |
| 212 |
3.13. expires_offset (int) |
| 213 |
3.14. max_expires (int) |
| 214 |
3.15. min_expires (int) |
| 215 |
3.16. min_expires_action (int) |
| 216 |
3.17. server_address (str) |
| 217 |
3.18. subs_db_mode (int) |
| 218 |
3.19. publ_cache (int) |
| 219 |
3.20. subs_htable_size (int) |
| 220 |
3.21. pres_htable_size (int) |
| 221 |
3.22. send_fast_notify (int) |
| 222 |
3.23. enable_sphere_check (int) |
| 223 |
3.24. timeout_rm_subs (int) |
| 224 |
3.25. fetch_rows (integer) |
| 225 |
3.26. db_table_lock_type (integer) |
| 226 |
3.27. local_log_level (int) |
| 227 |
3.28. local_log_facility (int) |
| 228 |
3.29. subs_remove_match (int) |
| 229 |
3.30. xavp_cfg (str) |
| 230 |
3.31. retrieve_order (int) |
| 231 |
3.32. retrieve_order_by (str) |
| 232 |
3.33. sip_uri_match (int) |
| 233 |
3.34. enable_dmq (integer) |
| 234 |
3.35. enable_pres_dmq (integer) |
| 235 |
3.36. enable_pres_sync_dmq (integer) |
| 236 |
3.37. enable_subs_dmq (integer) |
| 237 |
3.38. enable_subs_sync_dmq (integer) |
| 238 |
3.39. skip_notify_dmq (integer) |
| 239 |
3.40. default_socket (str) |
| 240 |
3.41. pres_subs_mode (integer) |
| 241 |
3.42. delete_same_subs (integer) |
| 242 |
3.43. timer_mode (integer) |
| 243 |
3.44. subs_respond_200 (integer) |
| 244 |
|
| 245 |
4. Functions |
| 246 |
|
| 247 |
4.1. handle_publish([sender_uri]) |
| 248 |
4.2. handle_subscribe([watcher_uri]) |
| 249 |
4.3. pres_auth_status(watcher_uri, presentity_uri) |
| 250 |
4.4. pres_has_subscribers(presentity_uri, event) |
| 251 |
4.5. pres_refresh_watchers(uri, event, type[, file_uri, filename]) |
| 252 |
|
| 253 |
4.6. pres_update_watchers(uri, event) |
| 254 |
|
| 255 |
5. RPC Commands |
| 256 |
|
| 257 |
5.1. presence.cleanup |
| 258 |
5.2. presence.publish_cache_sync |
| 259 |
5.3. presence.refreshWatchers |
| 260 |
5.4. presence.updateWatchers |
| 261 |
5.5. presence.presentity_list |
| 262 |
5.6. presence.presentity_show |
| 263 |
5.7. presence.watcher_list |
| 264 |
|
| 265 |
6. Exported Variables |
| 266 |
|
| 267 |
6.1. $subs(attr) |
| 268 |
6.2. $notify_reply(attr) |
| 269 |
|
| 270 |
7. Events |
| 271 |
|
| 272 |
7.1. presence:notify-reply |
| 273 |
|
| 274 |
8. Installation |
| 275 |
|
| 276 |
1. Overview |
| 277 |
|
| 278 |
The Presence module implements the core functionality of SIP event |
| 279 |
notification. It handles PUBLISH and SUBSCRIBE messages and generates |
| 280 |
NOTIFY messages in a general, event independent way. It is extensible |
| 281 |
and allows registering events to it from other Kamailio modules. |
| 282 |
Supported SIP event packages are presence, presence.winfo, dialog;sla |
| 283 |
from the presence_xml module and message-summary from the presence_mwi |
| 284 |
module. |
| 285 |
|
| 286 |
The module can use database and memory storage (to improve |
| 287 |
performance). For subscriptions it supports the 4 storage modes: Memory |
| 288 |
Only, Write Back, Write Through and DB Only. For publishes, it stores |
| 289 |
the state documents in database only (because of the large size) and it |
| 290 |
can store a publish cache in memory to avoid unnecessary database |
| 291 |
queries. Read the subs_db_mode and publ_cache parameter sections to |
| 292 |
decide which is the best storage configuration for you. |
| 293 |
|
| 294 |
The module implements several API functions, that can be used by other |
| 295 |
modules. In fact, it can be used only as a resource module, or |
| 296 |
"library". This mode of operation is enabled if the db_url parameter is |
| 297 |
not set to any value. |
| 298 |
|
| 299 |
The Kamailio Presence module implements the specifications in: RFC3265, |
| 300 |
RFC3856, RFC3857, RFC3858. |
| 301 |
|
| 302 |
2. Dependencies |
| 303 |
|
| 304 |
2.1. Kamailio Modules |
| 305 |
2.2. External Libraries or Applications |
| 306 |
|
| 307 |
2.1. Kamailio Modules |
| 308 |
|
| 309 |
The following modules must be loaded before this module: |
| 310 |
* a database module. |
| 311 |
* sl. |
| 312 |
* tm. |
| 313 |
* dmq (only if replication is enabled). |
| 314 |
|
| 315 |
2.2. External Libraries or Applications |
| 316 |
|
| 317 |
* libxml. |
| 318 |
|
| 319 |
3. Parameters |
| 320 |
|
| 321 |
3.1. db_url(str) |
| 322 |
3.2. presentity_table(str) |
| 323 |
3.3. active_watchers_table(str) |
| 324 |
3.4. watchers_table(str) |
| 325 |
3.5. clean_period (int) |
| 326 |
3.6. cseq_offset (int) |
| 327 |
3.7. db_update_period (int) |
| 328 |
3.8. waitn_time (int) |
| 329 |
3.9. notifier_poll_rate (int) |
| 330 |
3.10. notifier_processes (int) |
| 331 |
3.11. force_delete (int) |
| 332 |
3.12. startup_mode (int) |
| 333 |
3.13. expires_offset (int) |
| 334 |
3.14. max_expires (int) |
| 335 |
3.15. min_expires (int) |
| 336 |
3.16. min_expires_action (int) |
| 337 |
3.17. server_address (str) |
| 338 |
3.18. subs_db_mode (int) |
| 339 |
3.19. publ_cache (int) |
| 340 |
3.20. subs_htable_size (int) |
| 341 |
3.21. pres_htable_size (int) |
| 342 |
3.22. send_fast_notify (int) |
| 343 |
3.23. enable_sphere_check (int) |
| 344 |
3.24. timeout_rm_subs (int) |
| 345 |
3.25. fetch_rows (integer) |
| 346 |
3.26. db_table_lock_type (integer) |
| 347 |
3.27. local_log_level (int) |
| 348 |
3.28. local_log_facility (int) |
| 349 |
3.29. subs_remove_match (int) |
| 350 |
3.30. xavp_cfg (str) |
| 351 |
3.31. retrieve_order (int) |
| 352 |
3.32. retrieve_order_by (str) |
| 353 |
3.33. sip_uri_match (int) |
| 354 |
3.34. enable_dmq (integer) |
| 355 |
3.35. enable_pres_dmq (integer) |
| 356 |
3.36. enable_pres_sync_dmq (integer) |
| 357 |
3.37. enable_subs_dmq (integer) |
| 358 |
3.38. enable_subs_sync_dmq (integer) |
| 359 |
3.39. skip_notify_dmq (integer) |
| 360 |
3.40. default_socket (str) |
| 361 |
3.41. pres_subs_mode (integer) |
| 362 |
3.42. delete_same_subs (integer) |
| 363 |
3.43. timer_mode (integer) |
| 364 |
3.44. subs_respond_200 (integer) |
| 365 |
|
| 366 |
3.1. db_url(str) |
| 367 |
|
| 368 |
The database url. |
| 369 |
|
| 370 |
If set, the module is a fully operational presence server. Otherwise, |
| 371 |
it is used as a 'library', for its exported functions. |
| 372 |
|
| 373 |
Default value is “NULL”. |
| 374 |
|
| 375 |
Example 1.1. Set db_url parameter |
| 376 |
... |
| 377 |
modparam("presence", "db_url", |
| 378 |
"mysql://kamailio:kamailiorw@localhost/kamailio") |
| 379 |
... |
| 380 |
|
| 381 |
3.2. presentity_table(str) |
| 382 |
|
| 383 |
The name of the db table where PUBLISH presence information is stored. |
| 384 |
|
| 385 |
Default value is “presentity”. |
| 386 |
|
| 387 |
Example 1.2. Set presentity_table parameter |
| 388 |
... |
| 389 |
modparam("presence", "presentity_table", "presentity") |
| 390 |
... |
| 391 |
|
| 392 |
3.3. active_watchers_table(str) |
| 393 |
|
| 394 |
The name of the db table where active subscription information is |
| 395 |
stored. |
| 396 |
|
| 397 |
Default value is “active_watchers”. |
| 398 |
|
| 399 |
Example 1.3. Set active_watchers_table parameter |
| 400 |
... |
| 401 |
modparam("presence", "active_watchers_table", "active_watchers") |
| 402 |
... |
| 403 |
|
| 404 |
3.4. watchers_table(str) |
| 405 |
|
| 406 |
The name of the db table where subscription states are stored. |
| 407 |
|
| 408 |
Default value is “watchers”. |
| 409 |
|
| 410 |
Example 1.4. Set watchers_table parameter |
| 411 |
... |
| 412 |
modparam("presence", "watchers_table", "watchers") |
| 413 |
... |
| 414 |
|
| 415 |
3.5. clean_period (int) |
| 416 |
|
| 417 |
The period in seconds between checks if there are expired messages |
| 418 |
stored in the database. |
| 419 |
|
| 420 |
Default value is “100”. A zero or negative value disables this |
| 421 |
activity. |
| 422 |
|
| 423 |
Example 1.5. Set clean_period parameter |
| 424 |
... |
| 425 |
modparam("presence", "clean_period", 100) |
| 426 |
... |
| 427 |
|
| 428 |
3.6. cseq_offset (int) |
| 429 |
|
| 430 |
The allowed offset between server and client cseq. |
| 431 |
|
| 432 |
Default value is “0”. |
| 433 |
|
| 434 |
Example 1.6. Set cseq_offset parameter |
| 435 |
... |
| 436 |
modparam("presence", "cseq_offset", 1) |
| 437 |
... |
| 438 |
|
| 439 |
3.7. db_update_period (int) |
| 440 |
|
| 441 |
The period at which to synchronize cached subscriber info with the |
| 442 |
database. |
| 443 |
|
| 444 |
Default value is “100”. A zero or negative value disables |
| 445 |
synchronization. |
| 446 |
|
| 447 |
Example 1.7. Set db_update_period parameter |
| 448 |
... |
| 449 |
modparam("presence", "db_update_period", 100) |
| 450 |
... |
| 451 |
|
| 452 |
3.8. waitn_time (int) |
| 453 |
|
| 454 |
The maximum time period that NOTIFY requests will be buffered for. The |
| 455 |
server will attempt to send NOTIFY requests within many seconds of a |
| 456 |
change occurring. |
| 457 |
|
| 458 |
Note: this parameter is only used when notifier_processes is greater |
| 459 |
than 0. When notifier_processes is less than or equal to 0 NOTIFY |
| 460 |
requests are sent immediately. |
| 461 |
|
| 462 |
Default value is “5”. |
| 463 |
|
| 464 |
Example 1.8. Set waitn_time parameter |
| 465 |
... |
| 466 |
modparam("presence", "waitn_time", 10) |
| 467 |
... |
| 468 |
|
| 469 |
3.9. notifier_poll_rate (int) |
| 470 |
|
| 471 |
The number of times per second that the notifier processes should check |
| 472 |
for work. Approximately 1/(waitn_time * notifier_poll_rate * |
| 473 |
notifier_processes) of the pending updates will be sent each time a |
| 474 |
notifier process runs. |
| 475 |
|
| 476 |
Separate notifier processes are only run when subs_db_mode is 3 (DB |
| 477 |
only mode). |
| 478 |
|
| 479 |
Default value is “10”. |
| 480 |
|
| 481 |
Example 1.9. Set notifier_poll_rate parameter |
| 482 |
... |
| 483 |
modparam("presence", "notifier_poll_rate", 20) |
| 484 |
... |
| 485 |
|
| 486 |
3.10. notifier_processes (int) |
| 487 |
|
| 488 |
The number of notifier processes that should be started. |
| 489 |
|
| 490 |
Separate notifier processes are only run when subs_db_mode is 3 (DB |
| 491 |
only mode). |
| 492 |
|
| 493 |
Note: setting this parameter to 0 when subs_db_mode is 3 keeps the old |
| 494 |
behaviour (sending NOTIFY requests immediately). This (old) behaviour |
| 495 |
is disabled by default in DB only mode because under load, when lots of |
| 496 |
NOTIFY requests can be sent on a dialog at the same time, there are |
| 497 |
race conditions which result in CSeq re-use. |
| 498 |
|
| 499 |
Default value is “1”. |
| 500 |
|
| 501 |
Example 1.10. Set notifier_processes parameter |
| 502 |
... |
| 503 |
modparam("presence", "notifier_processes", 2) |
| 504 |
... |
| 505 |
|
| 506 |
3.11. force_delete (int) |
| 507 |
|
| 508 |
Enabling this parameter will delete expired presentity records without |
| 509 |
updating watchers. |
| 510 |
|
| 511 |
Set this parameter to “1” to enable. |
| 512 |
|
| 513 |
Default value is “0”. |
| 514 |
|
| 515 |
Example 1.11. Set force_delete parameter |
| 516 |
... |
| 517 |
modparam("presence", "force_delete", 1) |
| 518 |
... |
| 519 |
|
| 520 |
3.12. startup_mode (int) |
| 521 |
|
| 522 |
Setting this parameter to 0 will provide startup related backward |
| 523 |
compatibility for some modules. Setting to 0 fixes presentity requests |
| 524 |
with low expires (e.g. time() + 1) |
| 525 |
|
| 526 |
Set this parameter to “0” to enable backward compatibility. |
| 527 |
|
| 528 |
Default value is “1”. |
| 529 |
|
| 530 |
Example 1.12. Set startup_mode parameter |
| 531 |
... |
| 532 |
modparam("presence", "startup_mode", 0) |
| 533 |
... |
| 534 |
|
| 535 |
3.13. expires_offset (int) |
| 536 |
|
| 537 |
The value in seconds that should be subtracted from the expires value |
| 538 |
when sending a 200OK for a publish. It is used for forcing the client |
| 539 |
to send an update before the old publish expires. |
| 540 |
|
| 541 |
Default value is “0”. |
| 542 |
|
| 543 |
Example 1.13. Set expires_offset parameter |
| 544 |
... |
| 545 |
modparam("presence", "expires_offset", 10) |
| 546 |
... |
| 547 |
|
| 548 |
3.14. max_expires (int) |
| 549 |
|
| 550 |
The maximum admissible expires value for PUBLISH/SUBSCRIBE message (in |
| 551 |
seconds). |
| 552 |
|
| 553 |
Default value is “3600”. |
| 554 |
|
| 555 |
Example 1.14. Set max_expires parameter |
| 556 |
... |
| 557 |
modparam("presence", "max_expires", 3600) |
| 558 |
... |
| 559 |
|
| 560 |
3.15. min_expires (int) |
| 561 |
|
| 562 |
The minimum admissible expires value for PUBLISH/SUBSCRIBE message (in |
| 563 |
seconds). |
| 564 |
|
| 565 |
If > 0 then min_expires_action parameter determines the response. |
| 566 |
|
| 567 |
Default value is “0”. |
| 568 |
|
| 569 |
Example 1.15. Set min_expires parameter |
| 570 |
... |
| 571 |
modparam("presence", "min_expires", 1800) |
| 572 |
... |
| 573 |
|
| 574 |
3.16. min_expires_action (int) |
| 575 |
|
| 576 |
The action to take when UA sends an expires value less than |
| 577 |
min_expires. |
| 578 |
|
| 579 |
Possible Values |
| 580 |
* 1 : RFC Compliant, returns “423 Interval Too Brief” |
| 581 |
* 2 : forces the min_expires value in the subscription |
| 582 |
|
| 583 |
If > 0 then min_expires_action parameter determines the response. |
| 584 |
|
| 585 |
Default value is “1”. |
| 586 |
|
| 587 |
Example 1.16. Set min_expires parameter |
| 588 |
... |
| 589 |
modparam("presence", "min_expires", 1800) |
| 590 |
... |
| 591 |
|
| 592 |
3.17. server_address (str) |
| 593 |
|
| 594 |
The presence server address which will become the value of Contact |
| 595 |
header filed for 200 OK replies to SUBSCRIBE and PUBLISH and in NOTIFY |
| 596 |
messages. |
| 597 |
|
| 598 |
Example 1.17. Set server_address parameter |
| 599 |
... |
| 600 |
modparam("presence", "server_address", "sip:10.10.10.10:5060") |
| 601 |
... |
| 602 |
|
| 603 |
3.18. subs_db_mode (int) |
| 604 |
|
| 605 |
The presence module can utilize database for persistent subscription |
| 606 |
storage. If you use database, your subscriptions will survive machine |
| 607 |
restarts or SW crashes. The disadvantage is that accessing the database |
| 608 |
can be time consuming. Therefore, presence module implements four |
| 609 |
database accessing modes: |
| 610 |
* 0 - This disables database completely. Only memory will be used. |
| 611 |
Subscriptions will not survive restart. Use this value if you need |
| 612 |
a really fast presence module and subscription persistence is not |
| 613 |
necessary or is provided by other means. |
| 614 |
* 1 - Write-Through scheme. Subscriptions are updated synchronously |
| 615 |
in database and in memory(used for read operations). Use this |
| 616 |
scheme if speed is not top priority, but it's important that no |
| 617 |
subscriptions will be lost during crash or reboot or if you have an |
| 618 |
external application that reads the state of the subscriptions from |
| 619 |
database and they need to be updated synchronously. |
| 620 |
* 2 - Write-Back scheme. This is a combination of previous two |
| 621 |
schemes. All changes are made to memory and database |
| 622 |
synchronization is done in the timer. The timer deletes all expired |
| 623 |
contacts and flushes all modified or new subscriptions to database. |
| 624 |
Use this scheme if you encounter high-load peaks and want them to |
| 625 |
process as fast as possible. Latency of this mode is much lower |
| 626 |
than latency of mode 1, but slightly higher than latency of mode 0. |
| 627 |
To control the interval at which data is flushed to database, set |
| 628 |
the db_update_period parameter. |
| 629 |
* 3 - DB-Only scheme. No memory cache is kept, all operations being |
| 630 |
directly performed with the database. The timer deletes all expired |
| 631 |
subscriptions from database. The mode is useful if you configure |
| 632 |
more servers sharing the same DB without any replication at SIP |
| 633 |
level. The mode may be slower due the high number of DB operation. |
| 634 |
|
| 635 |
Default value is 2 (Write-Back scheme). |
| 636 |
|
| 637 |
Example 1.18. Set subs_db_mode parameter |
| 638 |
... |
| 639 |
modparam("presence", "subs_db_mode", 1) |
| 640 |
... |
| 641 |
|
| 642 |
3.19. publ_cache (int) |
| 643 |
|
| 644 |
To improve performance, the presence module can operate in a couple of |
| 645 |
modes related to how PUBLISH data is stored. If publ_cache is 0, then |
| 646 |
no information is stored in memory. |
| 647 |
|
| 648 |
If publ_cache is 1, then the module keeps in memory an index of the |
| 649 |
records stored in database, In this mode it keeps only the list of URIs |
| 650 |
and events, so it does not use much memory. The cache is used when a |
| 651 |
Subscription is received to check if there is any published state in |
| 652 |
database. This way unnecessary queries in presentity table are avoided. |
| 653 |
|
| 654 |
If publ_cache is 2, then the module keeps everything related to PUBLISH |
| 655 |
requests in memory, not storing anything in the database. |
| 656 |
|
| 657 |
Setting this parameter to 0 will disable the usage of the publish |
| 658 |
cache. This is desirable when you have more servers sharing the same |
| 659 |
database or there are other external entities inserting data into the |
| 660 |
presentity table. |
| 661 |
|
| 662 |
Default value is “1”. |
| 663 |
|
| 664 |
Example 1.19. Set publ_cache parameter |
| 665 |
... |
| 666 |
modparam("presence", "publ_cache", 0) |
| 667 |
... |
| 668 |
|
| 669 |
3.20. subs_htable_size (int) |
| 670 |
|
| 671 |
The size of the in-memory hash table to store subscription dialogs. |
| 672 |
This parameter will be used as the power of 2 when computing table |
| 673 |
size. |
| 674 |
|
| 675 |
Default value is “9 (512)”. |
| 676 |
|
| 677 |
Example 1.20. Set subs_htable_size parameter |
| 678 |
... |
| 679 |
modparam("presence", "subs_htable_size", 11) |
| 680 |
... |
| 681 |
|
| 682 |
3.21. pres_htable_size (int) |
| 683 |
|
| 684 |
The size of the in-memory hash table to store publish records. This |
| 685 |
parameter will be used as the power of 2 when computing table size. |
| 686 |
|
| 687 |
Default value is “9 (512)”. |
| 688 |
|
| 689 |
Example 1.21. Set pres_htable_size parameter |
| 690 |
... |
| 691 |
modparam("presence", "pres_htable_size", 11) |
| 692 |
... |
| 693 |
|
| 694 |
3.22. send_fast_notify (int) |
| 695 |
|
| 696 |
This parameter enables or disables the sending of an initial empty |
| 697 |
NOTIFY after a SUBSCRIBE/reSUBSCRIBE. This caused problems for MWI |
| 698 |
application, because some CPEs (like Samsung) fail to understand an |
| 699 |
empty NOTIFY to a message-summary event. This parameter is enabled by |
| 700 |
default, thus adhering to the standard. |
| 701 |
|
| 702 |
Default value is “1 ”. |
| 703 |
|
| 704 |
Example 1.22. Set send_fast_notify parameter |
| 705 |
... |
| 706 |
modparam("presence", "send_fast_notify", 0) |
| 707 |
... |
| 708 |
|
| 709 |
3.23. enable_sphere_check (int) |
| 710 |
|
| 711 |
This parameter is a flag that should be set if permission rules include |
| 712 |
sphere checking. The sphere information is expected to be present in |
| 713 |
the RPID body published by the presentity. The flag is introduced as |
| 714 |
this check requires extra processing that should be avoided if this |
| 715 |
feature is not supported by the clients. |
| 716 |
|
| 717 |
Default value is “0 ”. |
| 718 |
|
| 719 |
Example 1.23. Set enable_sphere_check parameter |
| 720 |
... |
| 721 |
modparam("presence", "enable_sphere_check", 1) |
| 722 |
... |
| 723 |
|
| 724 |
3.24. timeout_rm_subs (int) |
| 725 |
|
| 726 |
This parameter is a flag that should be set if subscriptions should be |
| 727 |
removed from the active_watchers when a NOTIFY times out. RFC3265 |
| 728 |
section 3.2.2 defines this behaviour as a SHOULD, so by default it is |
| 729 |
on. Disabling this will keep subscriptions active on unreliable |
| 730 |
networks. |
| 731 |
|
| 732 |
Default value is “1”. |
| 733 |
|
| 734 |
Example 1.24. Set timeout_rm_subs parameter |
| 735 |
... |
| 736 |
modparam("presence", "timeout_rm_subs", 0) |
| 737 |
... |
| 738 |
|
| 739 |
3.25. fetch_rows (integer) |
| 740 |
|
| 741 |
Number of rows to be loaded in one step from database. |
| 742 |
|
| 743 |
Default value is 500. |
| 744 |
|
| 745 |
Example 1.25. Set fetch_rows parameter |
| 746 |
... |
| 747 |
modparam("presence", "fetch_rows", 1000) |
| 748 |
... |
| 749 |
|
| 750 |
3.26. db_table_lock_type (integer) |
| 751 |
|
| 752 |
Enable (=1) or disable (=0) the Locks for table during a transaction. |
| 753 |
Locking only the "current" table causes problems with a MySQL-Databases |
| 754 |
in "DB-Only" mode. |
| 755 |
|
| 756 |
In order to use the Presence-Module in "DB_ONLY"-mode with a |
| 757 |
MySQL-Backend, set this parameter to "0", otherwise the |
| 758 |
MySQL-Operations will fail. The Presence-Module will generate a "500 |
| 759 |
Server error" due to the failed MySQL-queries. |
| 760 |
|
| 761 |
Default value is 1 (Write Lock for the Tables). |
| 762 |
|
| 763 |
Example 1.26. Set db_table_lock_type parameter |
| 764 |
... |
| 765 |
modparam("presence", "db_table_lock_type", 0) |
| 766 |
... |
| 767 |
|
| 768 |
3.27. local_log_level (int) |
| 769 |
|
| 770 |
Control log level for some debug messages inside the module. |
| 771 |
|
| 772 |
Default value is 2 (L_INFO). |
| 773 |
|
| 774 |
Example 1.27. Set local_log_level parameter |
| 775 |
... |
| 776 |
modparam("presence", "local_log_level", 3) |
| 777 |
... |
| 778 |
|
| 779 |
3.28. local_log_facility (int) |
| 780 |
|
| 781 |
Control syslog facility for some debug messages inside the module. |
| 782 |
|
| 783 |
Default value is taken from the core log_facility configuration |
| 784 |
parameter. |
| 785 |
|
| 786 |
Example 1.28. Set local_log_facility parameter |
| 787 |
... |
| 788 |
modparam("presence", "local_log_facility", "LOG_LOCAL3") |
| 789 |
... |
| 790 |
|
| 791 |
3.29. subs_remove_match (int) |
| 792 |
|
| 793 |
Control how to match the subscriptions to remove from memory. If set to |
| 794 |
0, then the match is done on To-Tag (local generated), if set to 1, |
| 795 |
then the match is done on all dialog attributes (Call-Id, From-Tag, |
| 796 |
To-Tag). |
| 797 |
|
| 798 |
Default value is 0. |
| 799 |
|
| 800 |
Example 1.29. Set subs_remove_match parameter |
| 801 |
... |
| 802 |
modparam("presence", "subs_remove_match", 1) |
| 803 |
... |
| 804 |
|
| 805 |
3.30. xavp_cfg (str) |
| 806 |
|
| 807 |
The name of the xavp to be used to specify attributes for internal |
| 808 |
processing of presence module. |
| 809 |
|
| 810 |
Inner attributes inside xavp can be: |
| 811 |
* priority - integer value to set the priority of the presence |
| 812 |
document (higher value, higher priority). It can set the order of |
| 813 |
the aggregated presence documents sent by NOTIFY (first the |
| 814 |
document with higher priority). If xavp_cfg parameter is set but |
| 815 |
this attribute is not in the avp, the priority of the presence |
| 816 |
document is based on timestamp, so newer documents have higher |
| 817 |
priority. |
| 818 |
* delete_subscription - integer value to give extra control of |
| 819 |
deleting the subscription after processing of |
| 820 |
event_route[presence:notify-reply]. If value = 1, it deletes the |
| 821 |
subscription. If xavp_cfg parameter is set but this attribute is |
| 822 |
not in the avp, the subscription is not deleted. This does not |
| 823 |
apply for codes 404, 481 and 408 (when timeout_rm_subs = 1) where |
| 824 |
subscription is deleted. |
| 825 |
|
| 826 |
Default value is empty (not set). |
| 827 |
|
| 828 |
Example 1.30. Set xavp_cfg parameter |
| 829 |
... |
| 830 |
modparam("presence", "xavp_cfg", "pres") |
| 831 |
... |
| 832 |
if(is_method("PUBLISH")) { |
| 833 |
$xavp(pres=>priority) = 100; |
| 834 |
} |
| 835 |
... |
| 836 |
|
| 837 |
3.31. retrieve_order (int) |
| 838 |
|
| 839 |
If set to 0, presentity records are retrieved by received_time order. |
| 840 |
If set to 1, presentity records are retrieved by the value of |
| 841 |
retrieve_order_by parameter. |
| 842 |
|
| 843 |
Default value is 0. |
| 844 |
|
| 845 |
Example 1.31. Set retrieve_order parameter |
| 846 |
... |
| 847 |
modparam("presence", "retrieve_order", 1) |
| 848 |
... |
| 849 |
|
| 850 |
3.32. retrieve_order_by (str) |
| 851 |
|
| 852 |
Used to set the order-by of the db query for fetching the presence |
| 853 |
records when retrieve_order is set to 1. |
| 854 |
|
| 855 |
Default value is “priority”. |
| 856 |
|
| 857 |
Example 1.32. Set retrieve_order_by parameter |
| 858 |
... |
| 859 |
modparam("presence", "retrieve_order_by", "priority, received_time") |
| 860 |
... |
| 861 |
|
| 862 |
3.33. sip_uri_match (int) |
| 863 |
|
| 864 |
The mode used when comparing uris. |
| 865 |
|
| 866 |
Possible Values |
| 867 |
* 0 : case sensitive |
| 868 |
* 1 : case insensitive |
| 869 |
|
| 870 |
Default value is “0”. |
| 871 |
|
| 872 |
Example 1.33. Set sip_uri_match parameter |
| 873 |
... |
| 874 |
modparam("presence", "sip_uri_match", 1) |
| 875 |
... |
| 876 |
|
| 877 |
3.34. enable_dmq (integer) |
| 878 |
|
| 879 |
If set to 1, will enable DMQ replication of presence data between |
| 880 |
nodes. Use this instead of a shared DB to share state across a cluster |
| 881 |
and update local watchers in realtime (subs_db_mode < 3) or on next |
| 882 |
notifier run (subs_db_mode = 3). |
| 883 |
|
| 884 |
If this parameter is enabled, the DMQ module must be loaded first - |
| 885 |
otherwise, startup will fail. |
| 886 |
|
| 887 |
Default value is 0. |
| 888 |
|
| 889 |
Example 1.34. Set enable_dmq parameter |
| 890 |
... |
| 891 |
modparam("presence", "enable_dmq", 1) |
| 892 |
... |
| 893 |
|
| 894 |
3.35. enable_pres_dmq (integer) |
| 895 |
|
| 896 |
If set to 1, will enable DMQ replication of presentities. |
| 897 |
|
| 898 |
Make sure that enable_dmq is set to 1. |
| 899 |
|
| 900 |
Default value is 1. |
| 901 |
|
| 902 |
Example 1.35. Set enable_pres_dmq parameter |
| 903 |
... |
| 904 |
modparam("presence", "enable_pres_dmq", 1) |
| 905 |
... |
| 906 |
|
| 907 |
3.36. enable_pres_sync_dmq (integer) |
| 908 |
|
| 909 |
If set to 1, will enable initial synchronization of presentities state. |
| 910 |
|
| 911 |
Make sure that enable_dmq and enable_pres_dmq are set to 1. |
| 912 |
|
| 913 |
Default value is 1. |
| 914 |
|
| 915 |
Example 1.36. Set enable_pres_sync_dmq parameter |
| 916 |
... |
| 917 |
modparam("presence", "enable_pres_sync_dmq", 1) |
| 918 |
... |
| 919 |
|
| 920 |
3.37. enable_subs_dmq (integer) |
| 921 |
|
| 922 |
If set to 1, will enable DMQ replication of subscriptions. |
| 923 |
|
| 924 |
Make sure that enable_dmq is set to 1. |
| 925 |
|
| 926 |
Default value is 0. |
| 927 |
|
| 928 |
Example 1.37. Set enable_subs_dmq parameter |
| 929 |
... |
| 930 |
modparam("presence", "enable_subs_dmq", 1) |
| 931 |
... |
| 932 |
|
| 933 |
3.38. enable_subs_sync_dmq (integer) |
| 934 |
|
| 935 |
If set to 1, will enable initial synchronization of subscriptions |
| 936 |
state. |
| 937 |
|
| 938 |
Make sure that enable_dmq and enable_subs_dmq are set to 1. |
| 939 |
|
| 940 |
Default value is 1. |
| 941 |
|
| 942 |
Example 1.38. Set enable_subs_sync_dmq parameter |
| 943 |
... |
| 944 |
modparam("presence", "enable_subs_sync_dmq", 1) |
| 945 |
... |
| 946 |
|
| 947 |
3.39. skip_notify_dmq (integer) |
| 948 |
|
| 949 |
Skip sending Notify messages if presentity was received by DMQ. |
| 950 |
|
| 951 |
Default value is 0. |
| 952 |
|
| 953 |
Example 1.39. Set skip_notify_dmq parameter |
| 954 |
... |
| 955 |
modparam("presence", "skip_notify_dmq", 1) |
| 956 |
... |
| 957 |
|
| 958 |
3.40. default_socket (str) |
| 959 |
|
| 960 |
Default socket name to rewrite socket info in subcription that was |
| 961 |
received by DMQ. |
| 962 |
|
| 963 |
By default is not defined. Socket info will be original value from DMQ |
| 964 |
message. |
| 965 |
|
| 966 |
Example 1.40. Set default_socket parameter |
| 967 |
... |
| 968 |
modparam("presence", "default_socket", "udp:192.168.0.125:5060") |
| 969 |
... |
| 970 |
|
| 971 |
3.41. pres_subs_mode (integer) |
| 972 |
|
| 973 |
Allow disabling cloning subscription structure for pv $subs(...), |
| 974 |
saving the pkg memory and copy operations for all its fields. If 1 the |
| 975 |
cloning is done; if 0, no cloning and $subs(...) returns $null. |
| 976 |
|
| 977 |
Default value is 1. |
| 978 |
|
| 979 |
Example 1.41. Set pres_subs_mode parameter |
| 980 |
... |
| 981 |
modparam("presence", "pres_subs_mode", 0) |
| 982 |
... |
| 983 |
|
| 984 |
3.42. delete_same_subs (integer) |
| 985 |
|
| 986 |
Enable deleting of subscriptions with the same presence uri and callid. |
| 987 |
|
| 988 |
Default value is 0 (disabled behavior). |
| 989 |
|
| 990 |
Example 1.42. Set delete_same_subs parameter |
| 991 |
... |
| 992 |
modparam("presence", "delete_same_subs", 1) |
| 993 |
... |
| 994 |
|
| 995 |
3.43. timer_mode (integer) |
| 996 |
|
| 997 |
Specify what timer process to be used. If set to 0, the core main timer |
| 998 |
is used. If set to 1, the core secondary timer is used. |
| 999 |
|
| 1000 |
Default value is 1. |
| 1001 |
|
| 1002 |
Example 1.43. Set timer_mode parameter |
| 1003 |
... |
| 1004 |
modparam("presence", "timer_mode", 0) |
| 1005 |
... |
| 1006 |
|
| 1007 |
3.44. subs_respond_200 (integer) |
| 1008 |
|
| 1009 |
Specify the response code for accepted SUBSCRIBE requests. If set to 0, |
| 1010 |
"202 Accepted" will be returned (default behaviour till version 5.5). |
| 1011 |
If set to 1, "200 OK" will be returned instead, in conformance to |
| 1012 |
RFC6665, which prohibits 202 responses. |
| 1013 |
|
| 1014 |
Default value is 1. |
| 1015 |
|
| 1016 |
Example 1.44. Set subs_respond_200 parameter |
| 1017 |
... |
| 1018 |
modparam("presence", "subs_respond_200", 0) |
| 1019 |
... |
| 1020 |
|
| 1021 |
4. Functions |
| 1022 |
|
| 1023 |
4.1. handle_publish([sender_uri]) |
| 1024 |
4.2. handle_subscribe([watcher_uri]) |
| 1025 |
4.3. pres_auth_status(watcher_uri, presentity_uri) |
| 1026 |
4.4. pres_has_subscribers(presentity_uri, event) |
| 1027 |
4.5. pres_refresh_watchers(uri, event, type[, file_uri, filename]) |
| 1028 |
4.6. pres_update_watchers(uri, event) |
| 1029 |
|
| 1030 |
4.1. handle_publish([sender_uri]) |
| 1031 |
|
| 1032 |
Handles PUBLISH requests by storing and updating published information |
| 1033 |
in memory cache and database, then calls functions to send NOTIFY |
| 1034 |
messages when changes in the published information occur. It takes one |
| 1035 |
argument -> sender_uri. The parameter was added for enabling BLA |
| 1036 |
implementation. If present, notification of a change in published state |
| 1037 |
is not sent to the respective uri even though a subscription exists. It |
| 1038 |
should be taken from the Sender header. It was left at the decision of |
| 1039 |
the administrator whether or not to transmit the content of this header |
| 1040 |
as parameter for handle_publish, to prevent security problems. |
| 1041 |
|
| 1042 |
This function can be used from REQUEST_ROUTE. |
| 1043 |
|
| 1044 |
Return code: |
| 1045 |
* 1 - if success. |
| 1046 |
* -1 - if error. |
| 1047 |
|
| 1048 |
The module sends an appropriate stateless reply in all cases. |
| 1049 |
|
| 1050 |
Example 1.45. handle_publish usage |
| 1051 |
... |
| 1052 |
if(is_method("PUBLISH")) |
| 1053 |
{ |
| 1054 |
if($hdr(Sender)!= NULL) |
| 1055 |
handle_publish("$hdr(Sender)"); |
| 1056 |
else |
| 1057 |
handle_publish(); |
| 1058 |
t_release(); |
| 1059 |
} |
| 1060 |
... |
| 1061 |
|
| 1062 |
4.2. handle_subscribe([watcher_uri]) |
| 1063 |
|
| 1064 |
The function which handles SUBSCRIBE requests. It stores or updates |
| 1065 |
information in memory and database and calls functions to send NOTIFY |
| 1066 |
messages when a SUBSCRIBE which initiate a dialog is received. |
| 1067 |
|
| 1068 |
By default this function uses the From: URI from the SUBSCRIBE request |
| 1069 |
as the Watcher URI. The optional watcher_uri parameter can be used to |
| 1070 |
specify a different Watcher URI, possibly taken from a SIP header like |
| 1071 |
P-Asserted-Identity:. |
| 1072 |
|
| 1073 |
This function can be used from REQUEST_ROUTE. |
| 1074 |
|
| 1075 |
Return code: |
| 1076 |
* 1 - if success. |
| 1077 |
* -1 - if error. |
| 1078 |
|
| 1079 |
The module sends an appropriate stateless reply in all cases. |
| 1080 |
|
| 1081 |
Example 1.46. handle_subscribe usage |
| 1082 |
... |
| 1083 |
if(method=="SUBSCRIBE") |
| 1084 |
handle_subscribe(); |
| 1085 |
... |
| 1086 |
|
| 1087 |
4.3. pres_auth_status(watcher_uri, presentity_uri) |
| 1088 |
|
| 1089 |
The function checks if watcher URI is authorized to subscribe event |
| 1090 |
'presence' of presentity URI. Both watcher_uri and presentity_uri can |
| 1091 |
be static strings or contain pseudo variables. |
| 1092 |
|
| 1093 |
The function returns ACTIVE_STATUS, if subscription is allowed, and |
| 1094 |
PENDING_STATUS, TERMINATED_STATUS, or WAITING_STATUS otherwise. See |
| 1095 |
presence/subscribe.h for the corresponding integer codes. In case of |
| 1096 |
error, function returns -1. |
| 1097 |
|
| 1098 |
This function can be used from REQUEST_ROUTE. |
| 1099 |
|
| 1100 |
Example 1.47. pres_auth_status usage |
| 1101 |
... |
| 1102 |
if (method=="MESSAGE") { |
| 1103 |
pres_auth_status("$fu", $ru"); |
| 1104 |
if ($retcode == 1) { |
| 1105 |
t_relay(); |
| 1106 |
} else { |
| 1107 |
send_reply("403", "Forbidden"); |
| 1108 |
} |
| 1109 |
} |
| 1110 |
... |
| 1111 |
|
| 1112 |
4.4. pres_has_subscribers(presentity_uri, event) |
| 1113 |
|
| 1114 |
Allows to check if presentity has any subscribers of event. |
| 1115 |
|
| 1116 |
This function can be used from ANY_ROUTE. |
| 1117 |
|
| 1118 |
Example 1.48. pres_has_subscribers usage |
| 1119 |
... |
| 1120 |
if(pres_has_subscribers($var(uri), "message-summary")) |
| 1121 |
# do something...; |
| 1122 |
... |
| 1123 |
|
| 1124 |
4.5. pres_refresh_watchers(uri, event, type[, file_uri, filename]) |
| 1125 |
|
| 1126 |
The function can be used in configuration to trigger notifies to |
| 1127 |
watchers if a change in watchers authorization or in published state |
| 1128 |
occurred (i.e., updates of xcap documents). |
| 1129 |
|
| 1130 |
Parameters: |
| 1131 |
* uri - the uri of the user who made the change and whose watchers |
| 1132 |
should be informed. |
| 1133 |
* event - the event package. |
| 1134 |
* type - it distinguishes between the three different types of events |
| 1135 |
that can trigger the refresh, depending on its value: |
| 1136 |
+ 0 - a change in watchers authentication. |
| 1137 |
+ 1 - a statical update in published state through direct update |
| 1138 |
in db table. |
| 1139 |
+ 2 - a statical update in published state by modifying the pidf |
| 1140 |
manipulation document. |
| 1141 |
* file_uri - the uri of the pidf-manipulation file on the XCAP server |
| 1142 |
(only used for type 2). |
| 1143 |
* filename - the name of the pidf-manipulation file on the XCAP |
| 1144 |
server (only used for type 2). |
| 1145 |
|
| 1146 |
This function can be used from ANY_ROUTE. |
| 1147 |
|
| 1148 |
Example 1.49. pres_refresh_watchers usage |
| 1149 |
... |
| 1150 |
pres_refresh_watchers("sip:[email protected]", "presence", 1); |
| 1151 |
... |
| 1152 |
|
| 1153 |
4.6. pres_update_watchers(uri, event) |
| 1154 |
|
| 1155 |
The function can be used in configuration to trigger updates to |
| 1156 |
watchers status if a change in watchers authorization state occurred |
| 1157 |
(i.e., updates of xcap documents change state from pending to active). |
| 1158 |
|
| 1159 |
Parameters: |
| 1160 |
* uri - the uri of the user who made the change and whose watchers |
| 1161 |
should be informed. Can be PV. |
| 1162 |
* event - the event package (e.g., presence). |
| 1163 |
|
| 1164 |
This function can be used from ANY_ROUTE. |
| 1165 |
|
| 1166 |
Example 1.50. pres_update_watchers usage |
| 1167 |
... |
| 1168 |
pres_update_watchers("sip:[email protected]", "presence"); |
| 1169 |
... |
| 1170 |
|
| 1171 |
5. RPC Commands |
| 1172 |
|
| 1173 |
5.1. presence.cleanup |
| 1174 |
5.2. presence.publish_cache_sync |
| 1175 |
5.3. presence.refreshWatchers |
| 1176 |
5.4. presence.updateWatchers |
| 1177 |
5.5. presence.presentity_list |
| 1178 |
5.6. presence.presentity_show |
| 1179 |
5.7. presence.watcher_list |
| 1180 |
|
| 1181 |
5.1. presence.cleanup |
| 1182 |
|
| 1183 |
Manually triggers the cleanup functions for the active_watchers, |
| 1184 |
presentity, and watchers tables. Useful if you have set clean_period |
| 1185 |
and/or db_update_period to zero or less. |
| 1186 |
|
| 1187 |
Name: presence.cleanup |
| 1188 |
|
| 1189 |
Parameters: none |
| 1190 |
|
| 1191 |
RPC Command Format: |
| 1192 |
... |
| 1193 |
kamctl rpc presence.cleanup |
| 1194 |
... |
| 1195 |
|
| 1196 |
5.2. presence.publish_cache_sync |
| 1197 |
|
| 1198 |
Synchronize changes made to the presentity table with the publish |
| 1199 |
cache. |
| 1200 |
|
| 1201 |
Name: presence.publish_cache_sync |
| 1202 |
|
| 1203 |
Parameters: none |
| 1204 |
|
| 1205 |
RPC Command Format: |
| 1206 |
... |
| 1207 |
kamctl rpc presence.publish_cache_sync |
| 1208 |
... |
| 1209 |
|
| 1210 |
5.3. presence.refreshWatchers |
| 1211 |
|
| 1212 |
Triggers sending Notify messages to watchers if a change in watchers |
| 1213 |
authorization or in published state occurred. |
| 1214 |
|
| 1215 |
Name: presence.refreshWatchers |
| 1216 |
|
| 1217 |
Parameters: |
| 1218 |
* uri - the uri of the user who made the change and whose watchers |
| 1219 |
should be informed |
| 1220 |
* event - the event package. |
| 1221 |
* type - it distinguishes between the three different types of events |
| 1222 |
that can trigger the refresh, depending on its value: |
| 1223 |
+ 0 - a change in watchers authentication. |
| 1224 |
+ 1 - a statical update in published state through direct update |
| 1225 |
in db table. |
| 1226 |
+ 2 - a statical update in published state by modifying the pidf |
| 1227 |
manipulation document. |
| 1228 |
* file_uri - the uri of the pidf-manipulation file on the XCAP server |
| 1229 |
(only used for type 2). |
| 1230 |
* filename - the name of the pidf-manipulation file on the XCAP |
| 1231 |
server (only used for type 2). |
| 1232 |
|
| 1233 |
RPC Command Format: |
| 1234 |
... |
| 1235 |
kamctl rpc presence.refreshWatchers sip:[email protected] presence 1 |
| 1236 |
... |
| 1237 |
|
| 1238 |
5.4. presence.updateWatchers |
| 1239 |
|
| 1240 |
Manually triggers updates to watchers (for example, after the contents |
| 1241 |
of XCAP docs has been updated). |
| 1242 |
|
| 1243 |
Name: presence.updateWatchers |
| 1244 |
|
| 1245 |
Parameters: |
| 1246 |
* uri - the uri of the user who made the changes and whose watchers |
| 1247 |
should be updated. |
| 1248 |
* event - the event package (e.g. presence). |
| 1249 |
|
| 1250 |
RPC Command Format: |
| 1251 |
... |
| 1252 |
kamctl rpc presence.updateWatchers sip:[email protected] presence |
| 1253 |
... |
| 1254 |
|
| 1255 |
5.5. presence.presentity_list |
| 1256 |
|
| 1257 |
List the presentity records stored in memory. |
| 1258 |
|
| 1259 |
Name: presence.presentity_list |
| 1260 |
|
| 1261 |
Parameters: |
| 1262 |
* mode - (optional) it can be 'full' to print all the fields of |
| 1263 |
presentity record. If missing, only a selected set of fields are |
| 1264 |
printed in the response. |
| 1265 |
|
| 1266 |
RPC Command Format: |
| 1267 |
... |
| 1268 |
kamctl rpc presence.presentity_list |
| 1269 |
kamctl rpc presence.presentity_list full |
| 1270 |
... |
| 1271 |
|
| 1272 |
5.6. presence.presentity_show |
| 1273 |
|
| 1274 |
Return the presentity records stored in memory by filtering with |
| 1275 |
username and/or domain. |
| 1276 |
|
| 1277 |
Name: presence.presentity_show |
| 1278 |
|
| 1279 |
Parameters: |
| 1280 |
* mode - it can be 'basic' or 'full' to print a selection or all the |
| 1281 |
fields of presentity record. |
| 1282 |
* user - username to match presentity records, use '*' to match any |
| 1283 |
username. |
| 1284 |
* domain - the value to match the domain of the presentity records, |
| 1285 |
use '*' to match any domain. |
| 1286 |
|
| 1287 |
RPC Command Format: |
| 1288 |
... |
| 1289 |
kamctl rpc presence.presentity_show basic alice sipserver.com |
| 1290 |
kamctl rpc presence.presentity_show full * sipserver.com |
| 1291 |
... |
| 1292 |
|
| 1293 |
5.7. presence.watcher_list |
| 1294 |
|
| 1295 |
Return the watcher records for a specific presentity uri. |
| 1296 |
|
| 1297 |
Name: presence.watcher_list |
| 1298 |
|
| 1299 |
Parameters: |
| 1300 |
* mode - it can be 'basic' or 'full' to print a selection or all the |
| 1301 |
fields of watcher record. |
| 1302 |
* uri - the presentity uri. |
| 1303 |
|
| 1304 |
RPC Command Format: |
| 1305 |
... |
| 1306 |
kamctl rpc presence.watcher_list basic sip:[email protected] |
| 1307 |
... |
| 1308 |
|
| 1309 |
6. Exported Variables |
| 1310 |
|
| 1311 |
6.1. $subs(attr) |
| 1312 |
6.2. $notify_reply(attr) |
| 1313 |
|
| 1314 |
6.1. $subs(attr) |
| 1315 |
|
| 1316 |
Access the attributes of handled subscription. It must be used after a |
| 1317 |
successful call of “handle_subscription()” or in the following events. |
| 1318 |
* tm:local-request - before notify is sent |
| 1319 |
* presence:notify-reply - after notify is sent |
| 1320 |
|
| 1321 |
The “attr” can be: |
| 1322 |
* uri - subscription presentity uri |
| 1323 |
* pres_uri - alias for presentity uri |
| 1324 |
* to_user |
| 1325 |
* to_domain |
| 1326 |
* from_user |
| 1327 |
* from_domain |
| 1328 |
* watcher_username |
| 1329 |
* watcher_domain |
| 1330 |
* event |
| 1331 |
* event_id |
| 1332 |
* to_tag |
| 1333 |
* from_tag |
| 1334 |
* callid |
| 1335 |
* remote_cseq |
| 1336 |
* local_cseq |
| 1337 |
* contact |
| 1338 |
* local_contact |
| 1339 |
* record_route |
| 1340 |
* expires |
| 1341 |
* status |
| 1342 |
* reason |
| 1343 |
* version |
| 1344 |
* flags |
| 1345 |
* user_agent |
| 1346 |
|
| 1347 |
Example 1.51. $subs(name) usage |
| 1348 |
... |
| 1349 |
if(handle_subscription()) |
| 1350 |
{ |
| 1351 |
xlog("presentity=$subs(uri)\n"); |
| 1352 |
} |
| 1353 |
... |
| 1354 |
|
| 1355 |
6.2. $notify_reply(attr) |
| 1356 |
|
| 1357 |
Access the reply message received when notifying subscriber. It must be |
| 1358 |
used in the following events. |
| 1359 |
* presence:notify-reply - after notify is sent |
| 1360 |
|
| 1361 |
The “attr” can be any pseudo var that accesses attributes of msg |
| 1362 |
|
| 1363 |
Example 1.52. $notify_reply(name) usage |
| 1364 |
... |
| 1365 |
event_route[presence:notify-reply] |
| 1366 |
{ |
| 1367 |
xlog("received message = $notify_reply($mb)\n"); |
| 1368 |
} |
| 1369 |
... |
| 1370 |
|
| 1371 |
7. Events |
| 1372 |
|
| 1373 |
7.1. presence:notify-reply |
| 1374 |
|
| 1375 |
7.1. presence:notify-reply |
| 1376 |
|
| 1377 |
Fired after notify reply is received or timeout. |
| 1378 |
|
| 1379 |
Example 1.53. $notify_reply(name) usage |
| 1380 |
... |
| 1381 |
event_route[presence:notify-reply] |
| 1382 |
{ |
| 1383 |
xlog("received message = $notify_reply($mb)\n"); |
| 1384 |
} |
| 1385 |
... |
| 1386 |
|
| 1387 |
8. Installation |
| 1388 |
|
| 1389 |
The module requires 3 tables in the Kamailio database: "presentity", |
| 1390 |
"active_watchers" and "watchers". The SQL syntax to create them can be |
| 1391 |
found in presence-create.sql script in the database directories in the |
| 1392 |
kamailio/scripts folder. You can also find the complete database |
| 1393 |
documentation on the project webpage, |
| 1394 |
https://www.kamailio.org/docs/db-tables/kamailio-db-devel.html. |
| 1395 |
|
| 1396 |
Chapter 2. Developer Guide |
| 1397 |
|
| 1398 |
Table of Contents |
| 1399 |
|
| 1400 |
1. bind_presence(presence_api_t* api) |
| 1401 |
2. add_event |
| 1402 |
3. get_rules_doc |
| 1403 |
4. get_auth_status |
| 1404 |
5. apply_auth_nbody |
| 1405 |
6. agg_nbody |
| 1406 |
7. free_body |
| 1407 |
8. aux_body_processing |
| 1408 |
9. aux_free_body |
| 1409 |
10. evs_publ_handl |
| 1410 |
11. evs_subs_handl |
| 1411 |
12. contains_event |
| 1412 |
13. get_event_list |
| 1413 |
14. update_watchers_status |
| 1414 |
15. get_sphere |
| 1415 |
16. get_presentity |
| 1416 |
17. free_presentity |
| 1417 |
|
| 1418 |
The module provides the following functions that can be used in other |
| 1419 |
Kamailio modules. |
| 1420 |
|
| 1421 |
1. bind_presence(presence_api_t* api) |
| 1422 |
|
| 1423 |
This function binds the presence modules and fills the structure with |
| 1424 |
one exported function -> add_event, which when called adds a new event |
| 1425 |
to be handled by presence. |
| 1426 |
|
| 1427 |
Example 2.1. presence_api_t structure |
| 1428 |
... |
| 1429 |
typedef struct presence_api { |
| 1430 |
add_event_t add_event; |
| 1431 |
contains_event_t contains_event; |
| 1432 |
search_event_t search_event; |
| 1433 |
get_event_list_t get_event_list; |
| 1434 |
|
| 1435 |
update_watchers_t update_watchers_status; |
| 1436 |
|
| 1437 |
/* subs hash table handling functions */ |
| 1438 |
new_shtable_t new_shtable; |
| 1439 |
destroy_shtable_t destroy_shtable; |
| 1440 |
insert_shtable_t insert_shtable; |
| 1441 |
search_shtable_t search_shtable; |
| 1442 |
delete_shtable_t delete_shtable; |
| 1443 |
update_shtable_t update_shtable; |
| 1444 |
/* function to duplicate a subs structure*/ |
| 1445 |
mem_copy_subs_t mem_copy_subs; |
| 1446 |
/* function used for update in database*/ |
| 1447 |
update_db_subs_t update_db_subs_timer; |
| 1448 |
/* function to extract dialog information from a |
| 1449 |
SUBSCRIBE message */ |
| 1450 |
extract_sdialog_info_t extract_sdialog_info; |
| 1451 |
/* function to request sphere definition for a presentity */ |
| 1452 |
pres_get_sphere_t get_sphere; |
| 1453 |
|
| 1454 |
}presence_api_t; |
| 1455 |
... |
| 1456 |
|
| 1457 |
2. add_event |
| 1458 |
|
| 1459 |
Field type: |
| 1460 |
... |
| 1461 |
typedef int (*add_event_t)(pres_ev_t* event); |
| 1462 |
... |
| 1463 |
|
| 1464 |
This function receives as a parameter a structure with event specific |
| 1465 |
information and adds it to presence event list. |
| 1466 |
|
| 1467 |
The structure received as a parameter: |
| 1468 |
... |
| 1469 |
typedef struct pres_ev |
| 1470 |
{ |
| 1471 |
str name; |
| 1472 |
event_t* evp; |
| 1473 |
str content_type; |
| 1474 |
int default_expires; |
| 1475 |
int type; |
| 1476 |
int etag_not_new; |
| 1477 |
/* |
| 1478 |
* 0 - the standard mechanism (allocating new etag |
| 1479 |
for each Publish) |
| 1480 |
* 1 - allocating an etag only |
| 1481 |
for an initial Publish |
| 1482 |
*/ |
| 1483 |
int req_auth; |
| 1484 |
get_rules_doc_t* get_rules_doc; |
| 1485 |
apply_auth_t* apply_auth_nbody; |
| 1486 |
is_allowed_t* get_auth_status; |
| 1487 |
|
| 1488 |
/* an agg_body_t function should be registered |
| 1489 |
* if the event permits having multiple published |
| 1490 |
* states and requires an aggregation of the information |
| 1491 |
* otherwise, this field should be NULL and the last |
| 1492 |
* published state is taken when constructing Notify msg |
| 1493 |
*/ |
| 1494 |
agg_nbody_t* agg_nbody; |
| 1495 |
publ_handling_t * evs_publ_handl; |
| 1496 |
subs_handling_t * evs_subs_handl; |
| 1497 |
free_body_t* free_body; |
| 1498 |
/* sometimes it is necessary that a module make changes for a body for each |
| 1499 |
* active watcher (e.g. setting the "version" parameter in an XML document. |
| 1500 |
* If a module registers the aux_body_processing callback, it gets called fo |
| 1501 |
r |
| 1502 |
* each watcher. It either gets the body received by the PUBLISH, or the bod |
| 1503 |
y |
| 1504 |
* generated by the agg_nbody function. |
| 1505 |
* The module can decide if it makes a copy of the original body, which is t |
| 1506 |
hen |
| 1507 |
* manipulated, or if it works directly in the original body. If the module |
| 1508 |
makes a |
| 1509 |
* copy of the original body, it also has to register the aux_free_body() to |
| 1510 |
* free this "per watcher" body. |
| 1511 |
*/ |
| 1512 |
aux_body_processing_t* aux_body_processing; |
| 1513 |
free_body_t* aux_free_body; |
| 1514 |
struct pres_ev* wipeer; |
| 1515 |
struct pres_ev* next; |
| 1516 |
|
| 1517 |
}pres_ev_t; |
| 1518 |
... |
| 1519 |
|
| 1520 |
3. get_rules_doc |
| 1521 |
|
| 1522 |
Filed type: |
| 1523 |
... |
| 1524 |
typedef int (get_rules_doc_t)(str* user, str* domain, str** rules_doc); |
| 1525 |
... |
| 1526 |
|
| 1527 |
This function returns the authorization rules document that will be |
| 1528 |
used in obtaining the status of the subscription and processing the |
| 1529 |
notified body. A reference to the document should be put in the |
| 1530 |
auth_rules_doc of the subs_t structure given as a parameter to the |
| 1531 |
functions described below. |
| 1532 |
|
| 1533 |
4. get_auth_status |
| 1534 |
|
| 1535 |
This filed is a function to be called for a subscription request to |
| 1536 |
return the state for that subscription according to authorization |
| 1537 |
rules. In the auth_rules_doc field of the subs_t structure received as |
| 1538 |
a parameter should contain the rules document of the presentity in |
| 1539 |
case, if it exists. |
| 1540 |
|
| 1541 |
It is called only if the req_auth field is not 0. |
| 1542 |
|
| 1543 |
Filed type: |
| 1544 |
... |
| 1545 |
typedef int (is_allowed_t)(struct subscription* subs); |
| 1546 |
... |
| 1547 |
|
| 1548 |
5. apply_auth_nbody |
| 1549 |
|
| 1550 |
This parameter should be a function to be called for an event that |
| 1551 |
requires authorization, when constructing final body. The authorization |
| 1552 |
document is taken from the auth_rules_doc field of the subs_t structure |
| 1553 |
given as a parameter. It is called only if the req_auth field is not 0. |
| 1554 |
|
| 1555 |
Filed type: |
| 1556 |
... |
| 1557 |
typedef int (apply_auth_t)(str* , struct subscription*, str** ); |
| 1558 |
... |
| 1559 |
|
| 1560 |
6. agg_nbody |
| 1561 |
|
| 1562 |
If present, this field marks that the events requires aggregation of |
| 1563 |
states. This function receives a body array and should return the final |
| 1564 |
body. If not present, it is considered that the event does not require |
| 1565 |
aggregation and the most recent published information is used when |
| 1566 |
constructing Notifies. |
| 1567 |
|
| 1568 |
Filed type: |
| 1569 |
... |
| 1570 |
typedef str* (agg_nbody_t)(str* pres_user, str* pres_domain, |
| 1571 |
str** body_array, int n, int off_index); |
| 1572 |
.. |
| 1573 |
|
| 1574 |
7. free_body |
| 1575 |
|
| 1576 |
This field must be field in if subsequent processing is performed on |
| 1577 |
the info from database before being inserted in Notify message body(if |
| 1578 |
agg_nbody or apply_auth_nbody fields are filled in). It should match |
| 1579 |
the allocation function used when processing the body. |
| 1580 |
|
| 1581 |
Filed type: |
| 1582 |
... |
| 1583 |
typedef void(free_body_t)(char* body); |
| 1584 |
.. |
| 1585 |
|
| 1586 |
8. aux_body_processing |
| 1587 |
|
| 1588 |
This field must be set if the module needs to manipulate the NOTIFY |
| 1589 |
body for each watcher. E.g. if the XML body includes a 'version' |
| 1590 |
parameter which will be increased for each NOTIFY, on a "per watcher" |
| 1591 |
basis. The module can either allocate a new buffer for the new body and |
| 1592 |
return it (aux_free_body function must be set too) or it manipulates |
| 1593 |
the original body directly and returns NULL. |
| 1594 |
|
| 1595 |
Filed type: |
| 1596 |
... |
| 1597 |
typedef str* (aux_body_processing_t)(struct subscription *subs, str* body); |
| 1598 |
.. |
| 1599 |
|
| 1600 |
9. aux_free_body |
| 1601 |
|
| 1602 |
This field must be set if the module registers the aux_body_processing |
| 1603 |
function and allocates memory for the new modified body. Then, this |
| 1604 |
function will be used to free the pointer returned by the |
| 1605 |
aux_body_processing function. If the module does use the |
| 1606 |
aux_body_processing, but does not allocate new memory, but manipulates |
| 1607 |
directly the original body buffer, then the aux_body_processing must |
| 1608 |
return NULL and this field should not be set. |
| 1609 |
|
| 1610 |
Filed type: |
| 1611 |
... |
| 1612 |
typedef void(free_body_t)(char* body); |
| 1613 |
.. |
| 1614 |
|
| 1615 |
10. evs_publ_handl |
| 1616 |
|
| 1617 |
This function is called when handling Publish requests. Most contain |
| 1618 |
body correctness check. |
| 1619 |
|
| 1620 |
... |
| 1621 |
typedef int (publ_handling_t)(struct sip_msg*); |
| 1622 |
.. |
| 1623 |
|
| 1624 |
11. evs_subs_handl |
| 1625 |
|
| 1626 |
It is not compulsory. Should contain event specific handling for |
| 1627 |
Subscription requests. |
| 1628 |
|
| 1629 |
Filed type: |
| 1630 |
... |
| 1631 |
typedef int (subs_handling_t)(struct sip_msg*); |
| 1632 |
.. |
| 1633 |
|
| 1634 |
12. contains_event |
| 1635 |
|
| 1636 |
Field type: |
| 1637 |
.. |
| 1638 |
typedef pres_ev_t* (*contains_event_t)(str* name, |
| 1639 |
event_t* parsed_event); |
| 1640 |
... |
| 1641 |
|
| 1642 |
The function parses the event name received as a parameter and searches |
| 1643 |
the result in the list. It returns the found event or NULL, if not |
| 1644 |
found. If the second argument is an allocated event_t* structure it |
| 1645 |
fills it with the result of the parsing. |
| 1646 |
|
| 1647 |
13. get_event_list |
| 1648 |
|
| 1649 |
Field type: |
| 1650 |
... |
| 1651 |
typedef int (*get_event_list_t) (str** ev_list); |
| 1652 |
... |
| 1653 |
|
| 1654 |
This function returns a string representation of the events registered |
| 1655 |
in presence module (used for Allowed-Events header). |
| 1656 |
|
| 1657 |
14. update_watchers_status |
| 1658 |
|
| 1659 |
Field type: |
| 1660 |
... |
| 1661 |
typedef int (*update_watchers_t)(str pres_uri, pres_ev_t* ev, |
| 1662 |
str* rules_doc); |
| 1663 |
... |
| 1664 |
|
| 1665 |
This function is an external command that can be used to announce a |
| 1666 |
change in authorization rules for a presentity. It updates the stored |
| 1667 |
status and sends a Notify to the watchers whose status has changes. |
| 1668 |
(used by presence_xml module when notified through an RPC command of a |
| 1669 |
change in an xcap document). |
| 1670 |
|
| 1671 |
15. get_sphere |
| 1672 |
|
| 1673 |
Field type: |
| 1674 |
... |
| 1675 |
typedef char* (*pres_get_sphere_t)(str* pres_uri); |
| 1676 |
... |
| 1677 |
|
| 1678 |
This function searches for a sphere definition in the published |
| 1679 |
information if this has type RPID. If not found returns NULL. (the |
| 1680 |
return value is allocated in private memory and should be freed) |
| 1681 |
|
| 1682 |
16. get_presentity |
| 1683 |
|
| 1684 |
Field type: |
| 1685 |
... |
| 1686 |
typedef str* (*pres_get_presentity_t)(str pres_uri, pres_ev_t *ev, str *etag, st |
| 1687 |
r *contact); |
| 1688 |
... |
| 1689 |
|
| 1690 |
This function returns a pointer to a str containing an XML document |
| 1691 |
with all of the matching presentities. If no matching presentities are |
| 1692 |
found the function returns NULL. |
| 1693 |
|
| 1694 |
The etag and contact parameters are optional and may be set to NULL. |
| 1695 |
Once you are finished with the presentity document you must call |
| 1696 |
free_presentity to free the allocated memory. |
| 1697 |
|
| 1698 |
17. free_presentity |
| 1699 |
|
| 1700 |
Field type: |
| 1701 |
... |
| 1702 |
typedef void (*pres_free_presentity_t)(str *presentity, pres_ev_t *ev); |
| 1703 |
... |
| 1704 |
|
| 1705 |
This function frees memory allocated by a call to get_presentity. The |
| 1706 |
ev parameter MUST point to the same pres_ev_t data-structure that was |
| 1707 |
used in the call to get_presentity. |