-
Notifications
You must be signed in to change notification settings - Fork 10
/
kamailio.cfg
168 lines (129 loc) · 3.34 KB
/
kamailio.cfg
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!KAMAILIO
################################################################
#
# SIP relay server for Bluepackets
# Author: Stanislav Sinyagin <ssinaygin@k-open.com>
#
################################################################
fork=yes
children=4
### Site-specific configuration defines hosts and ports
include_file "/etc/kamailio/kamailio_siteconfig.cfg"
####### Global Parameters #########
#!ifdef WITH_DEBUG
debug=4
log_stderror=no
#!else
debug=2
log_stderror=no
#!endif
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
# This is not part of siteconfig because the routing logic
# depends on these settings
disable_tcp=yes
auto_aliases=no
mhomed=1
####### Modules Section ########
mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules"
loadmodule "mi_fifo.so"
loadmodule "kex.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "mi_rpc.so"
loadmodule "rtpproxy.so"
#!ifdef WITH_DEBUG
loadmodule "debugger.so"
#!endif
# ----------------- setting module-specific parameters ---------------
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:9000")
modparam("rtpproxy", "nortpproxy_str", "")
#!ifdef WITH_DEBUG
# ----- debugger params -----
modparam("debugger", "cfgtrace", 1)
#!endif
####### Routing Logic ########
route {
if (!sanity_check()) {
exit;
}
if ( !mf_process_maxfwd_header("10") )
{
sl_send_reply("483","To Many Hops");
xlog("L_NOTICE", "$si $rm $ru -- too many hops\n");
exit;
}
if( !is_method("OPTIONS") )
{
xlog("L_INFO", "received SIP request: " +
"$si:$sp -> $rm $ru From: $fu To: $tu\n");
}
if( !loose_route() )
{
$var(usr) = "";
if( !strempty($rU) )
{
$var(usr) = $rU + "@";
}
if (src_ip == INTERNAL_HOST && src_port == INTERNAL_PORT)
{
$du = "sip:" + "EXTERNAL_HOST" + ":" + "EXTERNAL_PORT";
$ru = "sip:" + $var(usr) + "EXTERNAL_HOST" + ":" + "EXTERNAL_PORT";
rtpproxy_manage("cwie");
}
else if (src_ip == EXTERNAL_HOST && src_port == EXTERNAL_PORT)
{
$du = "sip:" + "INTERNAL_HOST" + ":" + "INTERNAL_PORT";
$ru = "sip:" + $var(usr) + "INTERNAL_HOST" + ":" + "INTERNAL_PORT";
rtpproxy_manage("cwei");
}
else
{
xlog("L_NOTICE", "Dropping request: $si:$sp $rm $ru\n");
exit;
}
}
record_route();
forward();
if( !is_method("OPTIONS") )
{
xlog("L_INFO", "forwarding SIP request: " +
"$nh(u) <- $rm $ru From: $fu To: $tu\n");
}
}
onreply_route {
if( !is_method("OPTIONS") )
{
xlog("L_INFO", "received SIP reply: " +
"$si:$sp -> $rs $rm From: $fu To: $tu\n");
}
if (src_ip == INTERNAL_HOST && src_port == INTERNAL_PORT)
{
rtpproxy_manage("cwei");
}
else if(src_ip == EXTERNAL_HOST && src_port == EXTERNAL_PORT)
{
rtpproxy_manage("cwie");
}
else
{
exit;
}
return(1);
}
# Local Variables:
# mode: sh
# sh-indent-after-if: 0
# indent-tabs-mode: nil
# tab-width: 4
# End: