Browse code

Initial revision

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2 689a6050-402a-0410-94f2-e92a70836424

Bogdan-Andrei Iancu authored on 13/06/2005 16:47:24
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,71 @@
1
+#
2
+# $Id$
3
+#
4
+# SIP RADIUS attributes
5
+#
6
+# Schulzrinne indicates attributes according to
7
+# draft-schulzrinne-sipping-radius-accounting-00
8
+#
9
+# Sterman indicates attributes according to
10
+# draft-sterman-aaa-sip-00
11
+#
12
+# Proprietary indicates an attribute that hasn't
13
+# been standardized
14
+#
15
+# Check out http://www.iana.org/assignments/radius-types
16
+# for up-to-date list of standard RADIUS attributes
17
+# and values
18
+#
19
+
20
+#
21
+# NOTE: All standard (IANA registered) attributes are 
22
+#       commented out except those that are missing in 
23
+#       the default dictionary of the radiusclient-ng 
24
+#       library.
25
+#
26
+
27
+
28
+#### Attributes ###
29
+#ATTRIBUTE User-Name		         1  string     # RFC2865, acc, auth_radius, avp_radius, group_radius, uri_radius
30
+#ATTRIBUTE Service-Type		         6  integer    # RFC2865, acc, auth_radius, avp_radius, group_radius, uri_radius
31
+#ATTRIBUTE Called-Station-Id             30  string     # RFC2865, acc
32
+#ATTRIBUTE Calling-Station-Id            31  string     # RFC2865, acc
33
+#ATTRIBUTE Acct-Status-Type              40  integer    # RFC2865, acc
34
+#ATTRIBUTE Acct-Session-Id               44  string     # RFC2865, acc
35
+ATTRIBUTE Sip-Method                   101  integer    # Schulzrinne, acc
36
+ATTRIBUTE Sip-Response-Code            102  integer    # Schulzrinne, acc
37
+ATTRIBUTE Sip-Cseq                     103  string     # Schulzrinne, acc
38
+ATTRIBUTE Sip-To-Tag                   104  string     # Schulzrinne, acc
39
+ATTRIBUTE Sip-From-Tag                 105  string     # Schulzrinne, acc
40
+ATTRIBUTE Sip-Translated-Request-URI   107  string     # Proprietary, acc
41
+ATTRIBUTE Digest-Response              206  string     # Sterman, auth_radius
42
+ATTRIBUTE Sip-Uri-User                 208  string     # Proprietary, auth_radius
43
+ATTRIBUTE Sip-Group                    211  string     # Proprietary, group_radius
44
+ATTRIBUTE Sip-Rpid                     213  string     # Proprietary, auth_radius
45
+ATTRIBUTE SIP-AVP                      225  string     # Proprietary, avp_radius
46
+ATTRIBUTE Digest-Realm                1063  string     # Sterman, auth_radius
47
+ATTRIBUTE Digest-Nonce                1064  string     # Sterman, auth_radius
48
+ATTRIBUTE Digest-Method               1065  string     # Sterman, auth_radius
49
+ATTRIBUTE Digest-URI                  1066  string     # Sterman, auth_radius
50
+ATTRIBUTE Digest-QOP                  1067  string     # Sterman, auth_radius
51
+ATTRIBUTE Digest-Algorithm            1068  string     # Sterman, auth_radius
52
+ATTRIBUTE Digest-Body-Digest          1069  string     # Sterman, auth_radius
53
+ATTRIBUTE Digest-CNonce               1070  string     # Sterman, auth_radius
54
+ATTRIBUTE Digest-Nonce-Count          1071  string     # Sterman, auth_radius
55
+ATTRIBUTE Digest-User-Name            1072  string     # Sterman, auth_radius
56
+
57
+### CISCO Vendor Specific Attributes ###
58
+#VENDOR Cisco              9
59
+#ATTRIBUTE Cisco-AVPair    1   string   Cisco           # VSA, auth_radius
60
+
61
+### Acct-Status-Type Values ###
62
+#VALUE Acct-Status-Type     Start             1         # RFC2866, acc
63
+#VALUE Acct-Status-Type     Stop              2         # RFC2866, acc
64
+VALUE Acct-Status-Type     Failed           15         # RFC2866, acc
65
+
66
+### Service-Type Values ###
67
+VALUE Service-Type         Call-Check       10         # RFC2865, uri_radius
68
+VALUE Service-Type         Group-Check      12         # Proprietary, group_radius
69
+VALUE Service-Type         Sip-Session      15         # Schulzrinne, acc, auth_radius
70
+VALUE Service-Type         SIP-Caller-AVPs  30         # Proprietary, avp_radius
71
+VALUE Service-Type         SIP-Callee-AVPs  31         # Proprietary, avp_radius
0 72
new file mode 100644
... ...
@@ -0,0 +1,149 @@
1
+#
2
+# $Id$
3
+#
4
+# simple quick-start config script
5
+#
6
+
7
+# ----------- global configuration parameters ------------------------
8
+
9
+#debug=3         # debug level (cmd line: -dddddddddd)
10
+#fork=yes
11
+#log_stderror=no	# (cmd line: -E)
12
+
13
+/* Uncomment these lines to enter debugging mode 
14
+fork=no
15
+log_stderror=yes
16
+*/
17
+
18
+check_via=no	# (cmd. line: -v)
19
+dns=no           # (cmd. line: -r)
20
+rev_dns=no      # (cmd. line: -R)
21
+#port=5060
22
+#children=4
23
+fifo="/tmp/openser_fifo"
24
+
25
+# ------------------ module loading ----------------------------------
26
+
27
+# Uncomment this if you want to use SQL database
28
+#loadmodule "/usr/local/lib/ser/modules/mysql.so"
29
+
30
+loadmodule "/usr/local/lib/openser/modules/sl.so"
31
+loadmodule "/usr/local/lib/openser/modules/tm.so"
32
+loadmodule "/usr/local/lib/openser/modules/rr.so"
33
+loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
34
+loadmodule "/usr/local/lib/openser/modules/usrloc.so"
35
+loadmodule "/usr/local/lib/openser/modules/registrar.so"
36
+loadmodule "/usr/local/lib/openser/modules/textops.so"
37
+
38
+# Uncomment this if you want digest authentication
39
+# mysql.so must be loaded !
40
+#loadmodule "/usr/local/lib/openser/modules/auth.so"
41
+#loadmodule "/usr/local/lib/openser/modules/auth_db.so"
42
+
43
+# ----------------- setting module-specific parameters ---------------
44
+
45
+# -- usrloc params --
46
+
47
+modparam("usrloc", "db_mode",   0)
48
+
49
+# Uncomment this if you want to use SQL database 
50
+# for persistent storage and comment the previous line
51
+#modparam("usrloc", "db_mode", 2)
52
+
53
+# -- auth params --
54
+# Uncomment if you are using auth module
55
+#
56
+#modparam("auth_db", "calculate_ha1", yes)
57
+#
58
+# If you set "calculate_ha1" parameter to yes (which true in this config), 
59
+# uncomment also the following parameter)
60
+#
61
+#modparam("auth_db", "password_column", "password")
62
+
63
+# -- rr params --
64
+# add value to ;lr param to make some broken UAs happy
65
+modparam("rr", "enable_full_lr", 1)
66
+
67
+# -------------------------  request routing logic -------------------
68
+
69
+# main routing logic
70
+
71
+route{
72
+
73
+	# initial sanity checks -- messages with
74
+	# max_forwards==0, or excessively long requests
75
+	if (!mf_process_maxfwd_header("10")) {
76
+		sl_send_reply("483","Too Many Hops");
77
+		break;
78
+	};
79
+	if (msg:len >=  2048 ) {
80
+		sl_send_reply("513", "Message too big");
81
+		break;
82
+	};
83
+	
84
+
85
+	# we record-route all messages -- to make sure that
86
+	# subsequent messages will go through our proxy; that's
87
+	# particularly good if upstream and downstream entities
88
+	# use different transport protocol
89
+	if (!method=="REGISTER") record_route();	
90
+
91
+	# subsequent messages withing a dialog should take the
92
+	# path determined by record-routing
93
+	if (loose_route()) {
94
+		# mark routing logic in request
95
+		append_hf("P-hint: rr-enforced\r\n"); 
96
+		route(1);
97
+		break;
98
+	};
99
+
100
+	if (!uri==myself) {
101
+		# mark routing logic in request
102
+		append_hf("P-hint: outbound\r\n"); 
103
+		route(1);
104
+		break;
105
+	};
106
+
107
+	# if the request is for other domain use UsrLoc
108
+	# (in case, it does not work, use the following command
109
+	# with proper names and addresses in it)
110
+	if (uri==myself) {
111
+
112
+		if (method=="REGISTER") {
113
+
114
+# Uncomment this if you want to use digest authentication
115
+#			if (!www_authorize("openser.org", "subscriber")) {
116
+#				www_challenge("openser.org", "0");
117
+#				break;
118
+#			};
119
+
120
+			save("location");
121
+			break;
122
+		};
123
+
124
+		lookup("aliases");
125
+		if (!uri==myself) {
126
+			append_hf("P-hint: outbound alias\r\n"); 
127
+			route(1);
128
+			break;
129
+		};
130
+
131
+		# native SIP destinations are handled using our USRLOC DB
132
+		if (!lookup("location")) {
133
+			sl_send_reply("404", "Not Found");
134
+			break;
135
+		};
136
+	};
137
+	append_hf("P-hint: usrloc applied\r\n"); 
138
+	route(1);
139
+}
140
+
141
+route[1] 
142
+{
143
+	# send it out now; use stateful forwarding as it works reliably
144
+	# even for UDP2TCP
145
+	if (!t_relay()) {
146
+		sl_reply_error();
147
+	};
148
+}
149
+
0 150
new file mode 100644
... ...
@@ -0,0 +1,113 @@
1
+#!/bin/sh
2
+#
3
+# $Id$
4
+#
5
+#
6
+# 3w-xxxx:      Starts the sip_router process
7
+#
8
+# Version:      @(#) /etc/rc.d/init.d/3w-xxxx
9
+#
10
+# chkconfig: 2345 20 80
11
+# description: controls execution of SIP router
12
+# processname: openser
13
+# config: /usr/local/etc/openser/openser.cfg
14
+
15
+# Source function library.
16
+. /etc/rc.d/init.d/functions
17
+
18
+# we use a openser symlink -- that allows us to have a different name
19
+# in process table so that killalls does not start other sers
20
+# run from somewhere else
21
+
22
+BINNAME=openser
23
+OSRDIR=/usr/local/sbin
24
+OSRWDIR=/var/tmp
25
+ETC=/usr/local/etc/openser/openser.cfg
26
+PIDFILE=/var/run/openser.pid
27
+NOTIFY=team@openser.org
28
+USR=510
29
+GRP=510
30
+
31
+MONIT=/usr/local/bin/monit
32
+MONITRC=/usr/local/etc/monitrc
33
+
34
+RETVAL=0
35
+
36
+BIN=$OSRDIR/$BINNAME
37
+CORE=$OSRWDIR/core
38
+TMP=/tmp/osrcore.$$
39
+
40
+openser_start() {
41
+	if [ -r $BIN -a -r $CORE ] ; then
42
+		echo "before startup openser core found on `date` at $HOSTNAME" > $TMP
43
+		echo "----------------------------------" >> $TMP
44
+		DATE=`date "+%Y-%m-%d--%H-%M"`
45
+		NEWCORE=$OSRWDIR/core.$DATE
46
+		mv $CORE $NEWCORE
47
+		echo core stored in $NEWCORE >> $TMP
48
+		gdb $BIN $NEWCORE -x test/bt.gdb -batch >> $TMP
49
+		chmod a+r $NEWCORE
50
+		cd $OSRDIR; tar czf $OSRWDIR/openser.$DATE.tgz .
51
+		mail -s "openser core found" $NOTIFY < $TMP
52
+		rm -f $TMP
53
+	fi
54
+	cd $OSRWDIR
55
+	#ulimit -c 1000000
56
+	echo "Starting Open SIP Router: "
57
+	$BIN -f $ETC -w $OSRWDIR -P $PIDFILE
58
+	RETVAL=$?
59
+	echo
60
+}
61
+
62
+openser_stop() {
63
+	echo "Stopping Open SIP Router: "
64
+	killproc $BINNAME
65
+	RETVAL=$?
66
+	echo
67
+}
68
+
69
+monit_start() {
70
+   echo "Command Monit to start OpenSER..."
71
+   ${MONIT} -c ${MONITRC} start openser
72
+   RETVAL=$?
73
+   echo
74
+}
75
+
76
+monit_stop() {
77
+   echo "Command Monit to stop OpenSER..."
78
+   ${MONIT} -c ${MONITRC} stop openser
79
+   RETVAL=$?
80
+   echo
81
+}
82
+
83
+# See how we were called.
84
+case "$1" in
85
+  openserstart)
86
+	openser_start
87
+	;;
88
+  openserstop)
89
+    openser_stop
90
+	;;
91
+  openserrestart)
92
+	openser_stop
93
+	echo
94
+	openser_start
95
+	;;
96
+  start)
97
+    monit_start
98
+	;;
99
+  stop)
100
+    monit_stop
101
+	;;
102
+  restart)
103
+	monit_stop
104
+	sleep 1
105
+	monit_start
106
+	;;
107
+  *)
108
+	echo "Usage: $0 {start|stop|restart}"
109
+	exit 1
110
+esac
111
+
112
+exit $RETVAL
113
+