You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kamailio/misc/examples/exec/exec.cfg

37 lines
930 B

#!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");
};
}