changed vm module name from 'voicemail' to 'vm' to avoid confusion.
[sip-router] / examples / voicemail.cfg
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
10 # ----------- global configuration parameters ------------------------
11
12 #debug=                 # debug level (cmd line: -dddddddddd)
13 #fork=no
14 #log_stderror=yes       # (cmd line: -E)
15
16
17 check_via=no            # (cmd. line: -v)
18 dns=no                  # (cmd. line: -r)
19 rev_dns=no              # (cmd. line: -R)
20 port=5090
21 children=4
22 fifo="/tmp/vm_ser_fifo"
23
24 # ------------------ module loading ----------------------------------
25
26 loadmodule "/home/srouter/sip_router/modules/sl/sl.so"
27 loadmodule "/home/srouter/sip_router/modules/tm/tm.so"
28 loadmodule "/home/srouter/sip_router/modules/maxfwd/maxfwd.so"
29 loadmodule "/home/srouter/sip_router/modules/mysql/mysql.so"
30 loadmodule "/home/srouter/sip_router/modules/vm/vm.so"
31             
32 # ----------------- setting module-specific parameters ---------------
33
34 modparam("vm", "db_url","mysql://ser:heslo@dbhost/ser")
35
36 # -------------------------  request routing logic -------------------
37
38 # main routing logic
39
40 route{
41
42
43         # initial sanity checks -- messages with
44         # max_forwars==0, or excessively long requests
45         if (!mf_process_maxfwd_header("10")) {
46                 sl_send_reply("483","Too Many Hops");
47                 break;
48         };
49         if (len_gt( max_len )) {
50                 sl_send_reply("513", "Message too big");
51                 break;
52         };
53
54         if (!uri==myself) {
55                 sl_send_reply("404", "not reponsible for host in r-uri");
56                 break;
57         };
58
59
60         # Voicemail specific configuration - begin
61
62         if(method=="ACK" || method=="INVITE" || method=="BYE"){
63
64                 if (!t_newtran()) {
65                         log("could not create new transaction\n");
66                         sl_send_reply("500","could not create new transaction");
67                         break;
68                 };
69
70                 t_reply("100","Trying -- just wait a minute !");
71                 if(method=="INVITE"){
72                         log("**************** vm start - begin ******************\n");
73                         if(!vm("/tmp/am_fifo","voicemail")){
74                                 log("could not contact the answer machine\n");
75                                 t_reply("500","could not contact the answer machine");
76                         };
77                         log("**************** vm start - end ******************\n");
78                 } else if(method=="BYE"){
79                         log("**************** vm end - begin ******************\n");
80                         if(!vm("/tmp/am_fifo","bye")){
81                                 log("could not contact the answer machine\n");
82                                 t_reply("500","could not contact the answer machine");
83                         };
84                         log("**************** vm end - end ******************\n");
85                 };
86                 break;
87         };
88         if (method=="CANCEL") {
89                 sl_send_reply("200", "cancels are junked here");
90                 break;
91         };
92         sl_send_reply("501", "method not understood here");
93 }