forked from sippy/voiptests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensips.cfg.in
116 lines (96 loc) · 2.54 KB
/
opensips.cfg.in
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
mpath="dist/opensips/modules/"
#if (OPENSIPS_VER >= 21) || (OPENSIPS_VER_FULL == master)
loadmodule "proto_udp.so"
## dialog is now required by the rtpproxy, not sure why, but OK
loadmodule "dialog/dialog.so"
#endif
#if (OPENSIPS_VER >= 24) || (OPENSIPS_VER_FULL == master)
loadmodule "sipmsgops/sipmsgops.so"
#endif
#define RTPP_UNFORCE() rtpproxy_unforce()
loadmodule "sl/sl.so"
loadmodule "tm/tm.so"
loadmodule "rr/rr.so"
loadmodule "maxfwd/maxfwd.so"
loadmodule "rtpproxy/rtpproxy.so"
loadmodule "textops/textops.so"
loadmodule "uri/uri.so"
#if (OPENSIPS_VER >= 23) || (OPENSIPS_VER_FULL == master)
# define XLOG xlog
#else
# define XLOG(a)
#endif
#if (OPENSIPS_VER >= 24) || (OPENSIPS_VER_FULL == master)
#define IS_METHOD is_method
#define SRC_PORT $sp
#define STATUS $rs
#else
#define IS_METHOD(m) method == m
#define SRC_PORT src_port
#define STATUS status
#endif
modparam("rtpproxy", "rtpproxy_sock", RTPP_SOCK_TEST)
listen=udp:127.0.0.1:5060
listen=udp:[::1]:5060
route {
XLOG("OpenSIPS received a request $rm from $si\n");
## initial sanity checks -- messages with
## max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
#if (OPENSIPS_VER < 24) && (OPENSIPS_VER_FULL != master)
if (msg:len >= max_len) {
sl_send_reply("513", "Message too big");
exit;
};
#endif
## shield us against retransmits
if (!t_newtran()) {
sl_reply_error();
exit;
};
if (IS_METHOD("INVITE")) {
t_reply("100", "Trying");
if (rtpproxy_offer("r")) {
t_on_reply("1");
if (!has_totag()) {
/* Get rid of session when INVITE fails unless it's re-INVITE */
t_on_failure("1");
}
};
};
if (IS_METHOD("BYE")) {
RTPP_UNFORCE();
};
record_route();
if (loose_route()) {
t_relay();
exit;
};
if (SRC_PORT == 5061) {
rewriteport("5062");
} else {
rewriteport("5061");
};
t_relay();
##rtpproxy_stream2uac("ringback", "10");
exit;
}
onreply_route[1]
{
XLOG("OpenSIPS received a reply $rs/$rm from $si\n");
if (STATUS =~ "(183)|2[0-9][0-9]") {
XLOG(" calling search()\n");
if(!search("^Content-Length:[ ]*0")) {
XLOG(" calling rtpproxy_answer()\n");
rtpproxy_answer("r");
##rtpproxy_stream2uas("ringback", "10");
};
};
}
failure_route[1]
{
RTPP_UNFORCE();
}