12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #
- # $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 ----------------------------------
- loadmodule "modules/sl/sl.so"
- loadmodule "modules/tm/tm.so"
- # ------------------------- 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;
- };
- # create transaction state; abort if error occurred
- if ( !t_newtran()) {
- sl_reply_error();
- break;
- };
- # 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();
- };
- };
- }
|