README 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. Resource List Server
  2. Anca-Maria Vamanu
  3. Voice Sistem SRL
  4. Edited by
  5. Anca-Maria Vamanu
  6. Copyright © 2007 Voice Sistem SRL
  7. __________________________________________________________________
  8. Table of Contents
  9. 1. Admin Guide
  10. 1. Overview
  11. 2. Dependencies
  12. 2.1. Kamailio Modules
  13. 2.2. External Libraries or Applications
  14. 3. Parameters
  15. 3.1. db_url(str)
  16. 3.2. xcap_table(str)
  17. 3.3. rlsubs_table(str)
  18. 3.4. rlpres_table(str)
  19. 3.5. clean_period (int)
  20. 3.6. waitn_time (int)
  21. 3.7. max_expires (int)
  22. 3.8. hash_size (int)
  23. 3.9. xcap_root (str)
  24. 3.10. integrated_xcap_server (int)
  25. 3.11. to_presence_code (int)
  26. 3.12. rls_event (str)
  27. 3.13. outbound_proxy (str)
  28. 3.14. server_address (str)
  29. 3.15. max_notify_body_length (int)
  30. 4. Functions
  31. 4.1. rls_handle_subscribe()
  32. 4.2. rls_handle_notify()
  33. 4.3. rls_update_subs(uri, event)
  34. 5. Installation
  35. 2. Developer Guide
  36. List of Examples
  37. 1.1. Set db_url parameter
  38. 1.2. Set xcap_table parameter
  39. 1.3. Set rlsubs_table parameter
  40. 1.4. Set rlpres_table parameter
  41. 1.5. Set clean_period parameter
  42. 1.6. Set waitn_time parameter
  43. 1.7. Set max_expires parameter
  44. 1.8. Set hash_size parameter
  45. 1.9. Set hash_size parameter
  46. 1.10. Set integrated_xcap_server parameter
  47. 1.11. Set to_presence_code parameter
  48. 1.12. Set rls_event parameter
  49. 1.13. Set outbound_proxy parameter
  50. 1.14. Set server_address parameter
  51. 1.15. Set max_notify_body_length parameter
  52. 1.16. rls_handle_subscribe usage
  53. 1.17. rls_handle_notify usage
  54. 1.18. rls_update_subs usage
  55. Chapter 1. Admin Guide
  56. Table of Contents
  57. 1. Overview
  58. 2. Dependencies
  59. 2.1. Kamailio Modules
  60. 2.2. External Libraries or Applications
  61. 3. Parameters
  62. 3.1. db_url(str)
  63. 3.2. xcap_table(str)
  64. 3.3. rlsubs_table(str)
  65. 3.4. rlpres_table(str)
  66. 3.5. clean_period (int)
  67. 3.6. waitn_time (int)
  68. 3.7. max_expires (int)
  69. 3.8. hash_size (int)
  70. 3.9. xcap_root (str)
  71. 3.10. integrated_xcap_server (int)
  72. 3.11. to_presence_code (int)
  73. 3.12. rls_event (str)
  74. 3.13. outbound_proxy (str)
  75. 3.14. server_address (str)
  76. 3.15. max_notify_body_length (int)
  77. 4. Functions
  78. 4.1. rls_handle_subscribe()
  79. 4.2. rls_handle_notify()
  80. 4.3. rls_update_subs(uri, event)
  81. 5. Installation
  82. 1. Overview
  83. The modules is a Resource List Server implementation following the
  84. specification in RFC 4662 and RFC 4826.
  85. The server is independent from local presence servers, retrieving
  86. presence information with Subscribe-Notify messages.
  87. The module uses the presence module as a library, as it requires a
  88. resembling mechanism for handling Subscribe. Therefore, in case the
  89. local presence server is not collocated on the same machine with the RL
  90. server, the presence module should be loaded in a library mode only
  91. (see doc for presence module).
  92. It handles subscription to lists in an event independent way.The
  93. default event is presence, but if some other events are to be handled
  94. by the server, they should be added using the module parameter
  95. "rls_events".
  96. It works with XCAP server for storage. There is also the possibility to
  97. configure it to work in an integrated_xcap server mode, when it only
  98. queries database for the resource lists documents. This is useful in a
  99. small architecture when all the clients use an integrated server and
  100. there are no references to exterior documents in their lists.
  101. The same as presence module, it has a caching mode with periodical
  102. update in database for subscribe information. The information retrieved
  103. with Notify messages is stored in database only.
  104. 2. Dependencies
  105. 2.1. Kamailio Modules
  106. 2.2. External Libraries or Applications
  107. 2.1. Kamailio Modules
  108. The following modules must be loaded before this module:
  109. * a database module.
  110. * sl.
  111. * tm.
  112. * presence- in a library mode.
  113. * pua.
  114. 2.2. External Libraries or Applications
  115. * libxml.
  116. 3. Parameters
  117. 3.1. db_url(str)
  118. 3.2. xcap_table(str)
  119. 3.3. rlsubs_table(str)
  120. 3.4. rlpres_table(str)
  121. 3.5. clean_period (int)
  122. 3.6. waitn_time (int)
  123. 3.7. max_expires (int)
  124. 3.8. hash_size (int)
  125. 3.9. xcap_root (str)
  126. 3.10. integrated_xcap_server (int)
  127. 3.11. to_presence_code (int)
  128. 3.12. rls_event (str)
  129. 3.13. outbound_proxy (str)
  130. 3.14. server_address (str)
  131. 3.15. max_notify_body_length (int)
  132. 3.1. db_url(str)
  133. The database url.
  134. Default value is “mysql://openser:openserrw@localhost/openser”.
  135. Example 1.1. Set db_url parameter
  136. ...
  137. modparam("rls", "db_url", "dbdriver://username:password@dbhost/dbname")
  138. ...
  139. 3.2. xcap_table(str)
  140. The name of the xcap table in which the integrated server or the
  141. xcap_client module writes. If integrated_xcap_server parameter not set,
  142. the name of the table must be the same as the one set for the
  143. xcap_client module.
  144. Default value is “xcap”.
  145. Example 1.2. Set xcap_table parameter
  146. ...
  147. modparam("rls", "xcap_table", "xcaps");
  148. ...
  149. 3.3. rlsubs_table(str)
  150. The name of the db table where resource lists subscription information
  151. is stored.
  152. Default value is “rls_watchers”.
  153. Example 1.3. Set rlsubs_table parameter
  154. ...
  155. modparam("rls", "rlsubs_table", "rls_subscriptions")
  156. ...
  157. 3.4. rlpres_table(str)
  158. The name of the db table where notified event specific information is
  159. stored.
  160. Default value is “rls_presentity”.
  161. Example 1.4. Set rlpres_table parameter
  162. ...
  163. modparam("rls", "rlpres_table", "rls_notify")
  164. ...
  165. 3.5. clean_period (int)
  166. The period at which to check for expired information.
  167. Default value is “100”.
  168. Example 1.5. Set clean_period parameter
  169. ...
  170. modparam("rls", "clean_period", 100)
  171. ...
  172. 3.6. waitn_time (int)
  173. The timer period at which the server should attempt to send Notifies
  174. with the updated presence state of the subscribed list or watcher
  175. information.
  176. Default value is “50”.
  177. Example 1.6. Set waitn_time parameter
  178. ...
  179. modparam("rls", "waitn_time", 10)
  180. ...
  181. 3.7. max_expires (int)
  182. The maximum accepted expires for a subscription to a list.
  183. Default value is “7200”.
  184. Example 1.7. Set max_expires parameter
  185. ...
  186. modparam("rls", "max_expires", 10800)
  187. ...
  188. 3.8. hash_size (int)
  189. The dimension of the hash table used to store subscription to a list.
  190. This parameter will be used as the power of 2 when computing table
  191. size.
  192. Default value is “9 (512)”.
  193. Example 1.8. Set hash_size parameter
  194. ...
  195. modparam("rls", "hash_size", 11)
  196. ...
  197. 3.9. xcap_root (str)
  198. The address of the xcap server.
  199. Default value is “NULL”.
  200. Example 1.9. Set hash_size parameter
  201. ...
  202. modparam("rls", "xcap_root", "http://192.168.2.132/xcap-root:800")
  203. ...
  204. 3.10. integrated_xcap_server (int)
  205. This parameter should be set if only integrated xcap servers are used
  206. to store resource lists.
  207. Default value is “0”.
  208. Example 1.10. Set integrated_xcap_server parameter
  209. ...
  210. modparam("rls", "integrated_xcap_server", 1)
  211. ...
  212. 3.11. to_presence_code (int)
  213. The code to be returned by rls_handle_subscribe function if the
  214. processed Subscribe is not a resource list Subscribe. This code can be
  215. used in an architecture with presence and rls servers collocated on the
  216. same machine, to call handle_subscribe on the message causing this
  217. code.
  218. Default value is “0”.
  219. Example 1.11. Set to_presence_code parameter
  220. ...
  221. modparam("rls", "to_presence_code", 10)
  222. ...
  223. 3.12. rls_event (str)
  224. The default event that RLS handles is presence. If some other events
  225. should also be handled by RLS they should be added using this
  226. parameter. It can be set more than once.
  227. Default value is “"presence"”.
  228. Example 1.12. Set rls_event parameter
  229. ...
  230. modparam("rls", "rls_event", "dialog;sla")
  231. ...
  232. 3.13. outbound_proxy (str)
  233. The SIP address where to send RLS subscriptions (outbound proxy address
  234. as SIP URI).
  235. Default value is “NULL”.
  236. Example 1.13. Set outbound_proxy parameter
  237. ...
  238. modparam("rls", "outbound_proxy", "sip:presence.kamailio.org")
  239. ...
  240. 3.14. server_address (str)
  241. The address of the server that will be used as a contact in sent
  242. Subscribe requests and 200 OK replies for Subscribe requests for RLS.
  243. It is a mandatory parameter.
  244. Example 1.14. Set server_address parameter
  245. ...
  246. modparam("rls", "server_address", "sip:[email protected]:5060")
  247. ...
  248. 3.15. max_notify_body_length (int)
  249. The maximum size that the body of a NOTIFY message may be. If set to 0
  250. (the default), no size limit is applied. Note that this refers only to
  251. the body, not the complete NOTIFY message.
  252. Example 1.15. Set max_notify_body_length parameter
  253. ...
  254. modparam("rls", "max_notify_body_length", 32000)
  255. ...
  256. 4. Functions
  257. 4.1. rls_handle_subscribe()
  258. 4.2. rls_handle_notify()
  259. 4.3. rls_update_subs(uri, event)
  260. 4.1. rls_handle_subscribe()
  261. This function detects if a Subscribe message should be handled by RLS.
  262. If not it replies with the configured to_presence_code. If it is, it
  263. extracts the dialog info and sends aggregate Notify requests with
  264. information for the list.
  265. This function can be used from REQUEST_ROUTE.
  266. Example 1.16. rls_handle_subscribe usage
  267. ...
  268. For presence and rls on the same machine:
  269. modparam("rls", "to_presence_code", 10)
  270. if(is_method("SUBSCRIBE"))
  271. {
  272. $var(ret_code)= rls_handle_subscribe();
  273. if($var(ret_code)== 10)
  274. handle_subscribe();
  275. t_release();
  276. }
  277. For rls only:
  278. if(is_method("SUBSCRIBE"))
  279. {
  280. rls_handle_subscribe();
  281. t_release();
  282. }
  283. ...
  284. 4.2. rls_handle_notify()
  285. This function can be used from REQUEST_ROUTE.
  286. Example 1.17. rls_handle_notify usage
  287. ...
  288. if(method=="NOTIFY")
  289. rls_handle_notify();
  290. ...
  291. 4.3. rls_update_subs(uri, event)
  292. This function can be used in configuration to trigger updates to
  293. resource list subscriptions (for example, after the contents of a
  294. resource list has changes).
  295. Parameters:
  296. * uri - the uri of the user who made the change and whose resource
  297. list subscriptions should be updated
  298. * event - the event package (e.g. presence).
  299. This function can be used from ANY_ROUTE.
  300. Example 1.18. rls_update_subs usage
  301. ...
  302. Within event_route[xhttp:request]:
  303. case "PUT":
  304. xcaps_put("$var(uri)", "$var(doc_uri)", "$rb");
  305. if($xcapuri(u=>auid)=~"pres-rules") {
  306. pres_update_watchers("$var(uri)", "presence");
  307. pres_refresh_watchers("$var(uri)", "presence", 1);
  308. } else if ($xcapuri(u=>auid)=~"resource-lists"
  309. || $xcapuri(u=>auid)=~"rls-services") {
  310. rls_update_subs("$var(uri)", "presence");
  311. }
  312. exit;
  313. break;
  314. ...
  315. 5. Installation
  316. The module requires 2 tables in Kamailio database: rls_presentity and
  317. rls_watchers.The SQL syntax to create them can be found in
  318. rls-create.sql script in the database directories in the
  319. kamailio/scripts folder. You can also find the complete database
  320. documentation on the project webpage,
  321. http://www.kamailio.org/docs/db-tables/kamailio-db-devel.html.
  322. Chapter 2. Developer Guide
  323. The module provides no functions to be used in other Kamailio modules.