- some defines for table_version function
[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("voicemail", "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 (uri=~"sip:as_welcome@.*" || uri=~"sip:as_nomoney@.*") {
74                                 if (!vm("/tmp/am_fifo", "announcement")) {
75                                         log("couldn't contact announcement server\n");
76                                         t_reply("500", "couldn not contact announcement server");
77                                 };
78                         } else {
79                                 if(!vm("/tmp/am_fifo","voicemail")){
80                                         log("could not contact the answer machine\n");
81                                         t_reply("500","could not contact the answer machine");
82                                 };
83                         };
84                         log("**************** vm start - end ******************\n");
85                 } else if(method=="BYE"){
86                         log("**************** vm end - begin ******************\n");
87                         if(!vm("/tmp/am_fifo","bye")){
88                                 log("could not contact the answer machine\n");
89                                 t_reply("500","could not contact the answer machine");
90                         };
91                         log("**************** vm end - end ******************\n");
92                 };
93                 break;
94         };
95         if (method=="CANCEL") {
96                 sl_send_reply("200", "cancels are junked here");
97                 break;
98         };
99         sl_send_reply("501", "method not understood here");
100 }