File: exec.cfg

package info (click to toggle)
kamailio 6.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 70,432 kB
  • sloc: ansic: 859,295; xml: 203,409; makefile: 9,687; sh: 9,043; sql: 8,571; yacc: 4,121; python: 3,086; perl: 2,955; java: 449; cpp: 289; javascript: 270; php: 258; ruby: 248; awk: 27
file content (36 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (5)
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
#!KAMAILIO
#
# this example shows use of ser as stateless redirect server
# which rewrites URIs using an exernal utility
#

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

loadmodule "exec.so"
loadmodule "sl.so"
loadmodule "xlog.so"

# -------------------------  request routing logic -------------------

# main routing logic

request_route {
	# for testing purposes, simply okay all REGISTERs
	if (method=="REGISTER") {
		xlog("REGISTER");
		sl_send_reply("200", "ok");
		break;
	};

	# first dump the message to a file using cat command
	exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt");
	# and then rewrite URI using external utility
	# note that the last echo command trashes input parameter
	if (exec_dset("echo sip:mra@iptel.org;echo sip:mrb@iptel.org;echo>/dev/null")) {
		sl_send_reply("300", "Redirect");
	} else {
		sl_reply_error();
		xlog("rewriting failed\n");
	};
}