File: 4to6.cfg

package info (click to toggle)
kamailio 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 56,100 kB
  • sloc: ansic: 552,832; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (114 lines) | stat: -rw-r--r-- 2,893 bytes parent folder | download | duplicates (4)
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
# $Id$
#
# Simple application level gateway config script.
#
# Assumes that SER/rtpproxy run on a machine, which connected to
# both IPv4 and IPv6 networks.
#
# Correspondingly, this machine has two IP addresses: one IPv4
# and the second one IPv6
#
# For example:
#
# 192.168.0.1 - "internal" IPv4 address
# 2002:1234:5678::1 - "external" IPv6 address
#
# rtpproxy started with `-l 192.168.0.1 -6 /2002:1234:5678::1' option.
# ser started with `-l 192.168.0.1 -l [2002:1234:5678::1] option.
#

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

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/rtpproxy.so"

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

# -- nathelper params --

modparam("nathelper", "natping_interval", 15)

# ------------------ main fun below ----------------------------------

route {
	# initial sanity checks -- messages with
	# max_forwars == 0, or excessively long requests,
	# or those that don't addressed to us
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483", "Too Many Hops");
		break;
	};
	if (msg:len > max_len) {
		sl_send_reply("513", "Message too big");
		break;
	};
	if (!(uri == myself) && method == "INVITE") {
		sl_send_reply("403", "Call cannot be served here");
		break;
	};

	if (method == "REGISTER") {
		if (af == inet) {
			save("location-inet4");
		} else if (af == inet6) {
			save("location-inet6");
		} else {
			sl_send_reply("403", "Call cannot be served here");
		};
		break;
	};

	if (method == "INVITE") {
		if (lookup("location-inet4")) {
			# Comment out three lines below if you want
			# RTP for IPv4->IPv4 calls to go directly
			# between UAs
			if (af == inet)
				if (rtpproxy_offer("FAII"))
					t_on_reply("1");
			if (af == inet6)
				if (rtpproxy_offer("FAEI"))
					t_on_reply("1");
		} else if (lookup("location-inet6")) {
			if (af == inet)
				if (rtpproxy_offer("FAIE"))
					t_on_reply("1");
			# Comment out three lines below if you want
			# RTP for IPv6->IPv6 calls to go directly
			# between UAs
			if (af == inet6)
				if (rtpproxy_offer("FAEE"))
					t_on_reply("1");
		} else {
			sl_send_reply("403", "Call cannot be served here");
			break;
		};
	}

	if (method == "BYE" || method == "CANCEL")
		unforce_rtp_proxy();

	# Do strict routing if pre-loaded route headers present
	if (loose_route()) {
		t_relay();
		break;
	};

	if (method == "INVITE")
		record_route();

        if (!t_relay())
        	sl_reply_error();
}

onreply_route[1] {
	if (!(status=~"183" || status=~"200"))
		break;
	rtpproxy_answer("FA");
}