presence.cfg 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # simple quick-start config script - Stand-alone presence server
  3. #
  4. # ----------- global configuration parameters ------------------------
  5. debug=3 # debug level (cmd line: -dddddddddd)
  6. fork=yes
  7. log_stderror=no # (cmd line: -E)
  8. children=4
  9. listen=127.0.0.1
  10. port=5059
  11. dns=no
  12. rev_dns=no
  13. # ------------------ module loading ----------------------------------
  14. loadmodule "db_mysql/db_mysql.so"
  15. loadmodule "maxfwd/maxfwd.so"
  16. loadmodule "textops/textops.so"
  17. loadmodule "tm/tm.so"
  18. loadmodule "sl/sl.so"
  19. loadmodule "rr/rr.so"
  20. loadmodule "presence/presence.so"
  21. loadmodule "presence_xml/presence_xml.so"
  22. loadmodule "avpops/avpops.so"
  23. loadmodule "jsonrpcs/jsonrpcs.so"
  24. # ----------------- setting module-specific parameters ---------------
  25. # -- rr params --
  26. # add value to ;lr param to make some broken UAs happy
  27. modparam("rr", "enable_full_lr", 1)
  28. # -- presence params --
  29. modparam("presence|presence_xml", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
  30. modparam("presence_xml", "force_active", 1)
  31. modparam("presence", "server_address", "sip:10.10.10.10:5060")
  32. #odparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo_presence")
  33. modparam("jsonrpcs", "transport", 2)
  34. modparam("jsonrpcs", "fifo_name", "kamailio_rpc.fifo")
  35. # ------------------------- request routing logic -------------------
  36. # main routing logic
  37. request_route{
  38. # initial sanity checks -- messages with
  39. # max_forwards==0, or excessively long requests
  40. if (!mf_process_maxfwd_header("10")) {
  41. sl_send_reply("483", "Too Many Hops");
  42. exit;
  43. }
  44. if (!is_method("SUBSCRIBE|PUBLISH")) {
  45. sl_send_reply("488", "Not Acceptable Here");
  46. exit;
  47. }
  48. # presence handling
  49. if (! t_newtran()) {
  50. sl_reply_error();
  51. exit;
  52. }
  53. if(is_method("PUBLISH")) {
  54. handle_publish();
  55. t_release();
  56. } else if( is_method("SUBSCRIBE")) {
  57. handle_subscribe();
  58. t_release();
  59. }
  60. exit;
  61. }