examples/uas.cfg
468bf60b
 #
 # $Id$
 #
 # this example shows usage of ser as user agent
 # server which does some functionality (in this
 # example, 'log' is used to print a notification
 # on a new transaction) and behaves statefuly
 # (e.g., it retransmits replies on request
 # retransmissions)
 
 # ------------------ module loading ----------------------------------
 
0e3e0fbf
 loadmodule "modules/sl/sl.so"
 loadmodule "modules/tm/tm.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;
 	};
 
0e3e0fbf
 	# create transaction state; abort if error occured
 	if ( !t_newtran()) {
468bf60b
 		sl_reply_error();
0e3e0fbf
 		break;
468bf60b
 	};
0e3e0fbf
 
 	# the following log will be only printed on receipt of 
 	# a new message; retranmissions are absorbed by t_newtran
 	log(1, "New Transaction Arrived\n");
        	# do what you want to do as a sever...
 	if (uri=~"a@") {
 		if (!t_reply("409", "Bizzar Error")) {
 			sl_reply_error();
 		};
 	} else {
 		if (!t_reply("699", "I don't want to chat with you")) {
 			sl_reply_error();
 		};
c96013a1
    	};
468bf60b
 }