File: msilo.cfg

package info (click to toggle)
openser 1.1.0-9etch1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,828 kB
  • ctags: 11,809
  • sloc: ansic: 120,528; sh: 5,249; yacc: 1,716; makefile: 1,261; php: 656; perl: 205; sql: 190
file content (141 lines) | stat: -rw-r--r-- 3,063 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#
# MSILO usage example
#
# $ID: daniel $
#



children=2
check_via=no      # (cmd. line: -v)
dns=off           # (cmd. line: -r)
rev_dns=off       # (cmd. line: -R)


# ------------------ module loading ----------------------------------

loadmodule "../sip_router/modules/print/print.so"
loadmodule "../sip_router/modules/textops/textops.so"

loadmodule "../sip_router/modules/sl/sl.so"
loadmodule "../sip_router/modules/mysql/mysql.so"
loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
loadmodule "../sip_router/modules/msilo/msilo.so"
loadmodule "../sip_router/modules/tm/tm.so"
loadmodule "../sip_router/modules/registrar/registrar.so"
loadmodule "../sip_router/modules/usrloc/usrloc.so"

# ----------------- setting module-specific parameters ---------------

# -- registrar params --

modparam("registrar", "default_expires", 120)

# -- registrar params --

modparam("usrloc", "db_mode", 0)

# -- msilo params --

modparam("msilo","db_url","mysql://user:xxx@127.0.0.1/msilo")
modparam("msilo","registrar","sip:registrar@mydomain.com")

# -- tm params --

modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "wt_timer", 10 )


route{
	if ( !mf_process_maxfwd_header("10") )
	{
		sl_send_reply("483","To Many Hops");
		drop();
	};


	if (uri==myself) {
		# for testing purposes, simply okay all REGISTERs
		if (method=="REGISTER")
		{
			save("location");
			log("REGISTER received -> dumping messages with MSILO\n");

			# MSILO - dumping user's offline messages
			if (m_dump())
			{
				log("MSILO: offline messages dumped - if they were\n");
			}else{
				log("MSILO: no offline messages dumped\n");
			};
			return;
		};

		# domestic SIP destinations are handled using our USRLOC DB
		
		if(!lookup("location")) 
		{
			if (! t_newtran())
   			{
				sl_reply_error();
				return;
   			};
			# we do not care about anything else but MESSAGEs
			if (!method=="MESSAGE")
			{
				if (!t_reply("404", "Not found")) 
				{
					sl_reply_error();
				};
    			return;
			};
			log("MESSAGE received -> storing using MSILO\n");
			# MSILO - storing as offline message
			if (m_store("0"))
			{
				log("MSILO: offline message stored\n");
				if (!t_reply("202", "Accepted")) 
				{
					sl_reply_error();
				};
			}else{
				log("MSILO: offline message NOT stored\n");
				if (!t_reply("503", "Service Unavailable")) 
				{
					sl_reply_error();
				};
			};
			return;
		};
		# if the downstream UA does not support MESSAGE requests
		# go to failure_route[1]
		t_on_failure("1");
		t_relay();
		return;
	};

	# forward anything else
	t_relay();
}

failure_route[1] {
	# forwarding failed -- check if the request was a MESSAGE 
	if (!method=="MESSAGE")
	{
    	return;
	};
	
	log(1,"MSILO: the downstream UA does not support MESSAGE requests ...\n");
	# we have changed the R-URI with the contact address -- ignore it now
	if (m_store("1"))
	{
		log("MSILO: offline message stored\n");
		t_reply("202", "Accepted"); 
	}else{
		log("MSILO: offline message NOT stored\n");
		t_reply("503", "Service Unavailable");
	};
}