exec_s5.cfg 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # $Id$
  3. #
  4. # simple quick-start config script
  5. #
  6. fork=no
  7. log_stderror=yes
  8. # ----------- global configuration parameters ------------------------
  9. loadmodule "modules/sl/sl.so"
  10. loadmodule "modules/tm/tm.so"
  11. loadmodule "modules/usrloc/usrloc.so"
  12. loadmodule "modules/registrar/registrar.so"
  13. loadmodule "modules/exec/exec.so"
  14. # ----------------- setting module-specific parameters ---------------
  15. route{
  16. # uri for my domain ?
  17. if (uri==myself) {
  18. if (method=="REGISTER") {
  19. save("location");
  20. break;
  21. };
  22. # native SIP destinations are handled using our USRLOC DB
  23. if (!lookup("location")) {
  24. # proceed to email notification
  25. if (method=="INVITE") route(1)
  26. else sl_send_reply("404", "Not Found");
  27. break;
  28. };
  29. };
  30. # user found, forward to his current uri now
  31. if (!t_relay()) {
  32. sl_reply_error();
  33. };
  34. }
  35. /* handling of missed calls */
  36. route[1] {
  37. # don't continue if it is a retransmission
  38. if ( !t_newtran()) {
  39. sl_reply_error();
  40. break;
  41. };
  42. # external script: lookup user, if user exists, send
  43. # an email notification to him
  44. if (!exec_msg('
  45. QUERY="select email_address from subscriber
  46. where user=\"$SIP_OUSER\"";
  47. EMAIL=`mysql -Bsuser -pheslo -e "$QUERY" ser`;
  48. if [ -z "$EMAIL" ] ; then exit 1; fi ;
  49. echo "SIP request received from $SIP_HF_FROM for $SIP_OUSER" |
  50. mail -s "request for you" $EMAIL '))
  51. {
  52. # exec returned error ... user does not exist
  53. # send a stateful reply
  54. t_reply("404", "User does not exist");
  55. } else {
  56. t_reply("600", "No messages for this user");
  57. };
  58. break;
  59. }