Can somebody please take a look at the routing logic below...
I am trying to use exec_dset along with another program to do some LCR
with SER but it doesn't work properly (here is a capture of what it
produces:
http://pastebin.ca/146771
Any ideas of what's doing wrong? Code:
# --------------------------------------
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
break;
};
if (method=="REGISTER") {
sl_send_reply("501", "Not Implemented");
break;
};
if (method=="OPTIONS") {
sl_send_reply("501", "Not Implemented");
break;
};
record_route();
setflag(1);
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
route(1);
break;
};
if (method=="INVITE") {
route(2);
break();
};
route(1);
break();
}
route[1]
{
if (!t_relay()) {
sl_reply_error();
};
}
route[2]
{
# replaces the INVITE URI with the right host
exec_dset ("/usr/local/Asterisk-LCR/bin/ser-lcr");
if (uri=~"^sip:STOP@127") {
sl_send_reply("503", "Service Unavailable");
break;
};
t_on_failure("2");
if(isflagset(1)) {
append_branch();
};
setflag(1);
t_relay();
}
# /usr/local/Asterisk-LCR/bin/ser-lcr will give us the next uri to try
# in case of failure, or send sip:STOP@127.0.0.1 if no more routes
failure_route[2] {
route(2);
}
# --------------------------------------