examples/exec.cfg
468bf60b
 #
 # $Id$
 #
 # this example shows use of ser as stateless redirect server
 # which rewrites URIs using an exernal utility
 #
 
 # ------------------ module loading ----------------------------------
 
0e3e0fbf
 loadmodule "modules/exec/exec.so"
 loadmodule "modules/sl/sl.so"
468bf60b
 
 # -------------------------  request routing logic -------------------
 
 # main routing logic
 
 route{
 	# for testing purposes, simply okay all REGISTERs
 	if (method=="REGISTER") {
 		log("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
c96013a1
 	if (exec_dset("echo sip:mra@iptel.org;echo sip:mrb@iptel.org;echo>/dev/null")) {
468bf60b
 		sl_send_reply("300", "Redirect");
 	} else {
 		sl_reply_error();
 		log(1, "alas, rewriting failed\n");
 	};
 }