voicemail.cfg 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #
  2. # $Id$
  3. #
  4. # this script is configured for use as voicemail UAS; it processes
  5. # INVITEs and BYEs and asks SEMS to record media via "vm"; in this
  6. # script, all record-routing and other constructs known from proxy
  7. # scripts are not present -- it is a simple UAS
  8. #
  9. # ----------- global configuration parameters ------------------------
  10. #debug= # debug level (cmd line: -dddddddddd)
  11. #fork=no
  12. #log_stderror=yes # (cmd line: -E)
  13. check_via=no # (cmd. line: -v)
  14. dns=no # (cmd. line: -r)
  15. rev_dns=no # (cmd. line: -R)
  16. port=5090
  17. children=4
  18. fifo="/tmp/vm_ser_fifo"
  19. # ------------------ module loading ----------------------------------
  20. loadmodule "/home/srouter/sip_router/modules/sl/sl.so"
  21. loadmodule "/home/srouter/sip_router/modules/tm/tm.so"
  22. loadmodule "/home/srouter/sip_router/modules/maxfwd/maxfwd.so"
  23. loadmodule "/home/srouter/sip_router/modules/mysql/mysql.so"
  24. loadmodule "/home/srouter/sip_router/modules/vm/vm.so"
  25. # ----------------- setting module-specific parameters ---------------
  26. modparam("vm", "db_url","mysql://ser:heslo@dbhost/ser")
  27. # ------------------------- request routing logic -------------------
  28. # main routing logic
  29. route{
  30. # initial sanity checks -- messages with
  31. # max_forwars==0, or excessively long requests
  32. if (!mf_process_maxfwd_header("10")) {
  33. sl_send_reply("483","Too Many Hops");
  34. break;
  35. };
  36. if (len_gt( max_len )) {
  37. sl_send_reply("513", "Message too big");
  38. break;
  39. };
  40. if (!uri==myself) {
  41. sl_send_reply("404", "not reponsible for host in r-uri");
  42. break;
  43. };
  44. # Voicemail specific configuration - begin
  45. if(method=="ACK" || method=="INVITE" || method=="BYE"){
  46. if (!t_newtran()) {
  47. log("could not create new transaction\n");
  48. sl_send_reply("500","could not create new transaction");
  49. break;
  50. };
  51. t_reply("100","Trying -- just wait a minute !");
  52. if(method=="INVITE"){
  53. log("**************** vm start - begin ******************\n");
  54. if(!vm("/tmp/am_fifo","voicemail")){
  55. log("could not contact the answer machine\n");
  56. t_reply("500","could not contact the answer machine");
  57. };
  58. log("**************** vm start - end ******************\n");
  59. } else if(method=="BYE"){
  60. log("**************** vm end - begin ******************\n");
  61. if(!vm("/tmp/am_fifo","bye")){
  62. log("could not contact the answer machine\n");
  63. t_reply("500","could not contact the answer machine");
  64. };
  65. log("**************** vm end - end ******************\n");
  66. };
  67. break;
  68. };
  69. if (method=="CANCEL") {
  70. sl_send_reply("200", "cancels are junked here");
  71. break;
  72. };
  73. sl_send_reply("501", "method not understood here");
  74. }