SER example exec

SER application integration


this example shows use of ser as stateless SIP server redirect which rewrites URIs using an exernal utility

  1. $Id: exec.cfg,v 1.7 2003/06/03 03:18:12 jiri Exp $

  1. ------------------ module loading ----------------------------------

loadmodule "modules/exec/exec.so"
loadmodule "modules/sl/sl.so"

  1. ------------------------- request routing logic -------------------

  1. main routing logic

route{
  1. for testing purposes, simply okay all REGISTERs
if (method=="REGISTER") {
log("REGISTER");
sl_send_reply("200", "ok");
break;
};

  1. first dump the message to a file using cat command
exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt");
  1. and then rewrite URI using external utility
  2. 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();
log(1, "alas, rewriting failed\n");
};
}

See also



SER application integration


this example shows use of ser as stateless SIP server redirect which rewrites URIs using an exernal utility

  1. $Id: exec.cfg,v 1.7 2003/06/03 03:18:12 jiri Exp $

  1. ------------------ module loading ----------------------------------

loadmodule "modules/exec/exec.so"
loadmodule "modules/sl/sl.so"

  1. ------------------------- request routing logic -------------------

  1. main routing logic

route{
  1. for testing purposes, simply okay all REGISTERs
if (method=="REGISTER") {
log("REGISTER");
sl_send_reply("200", "ok");
break;
};

  1. first dump the message to a file using cat command
exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt");
  1. and then rewrite URI using external utility
  2. 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();
log(1, "alas, rewriting failed\n");
};
}

See also



Created by: oej, Last modification: Fri 19 of Sep, 2003 (19:48 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+