Hi,
I am using the following routing configuration for
testing Ser as a presence server only.
The aim is to route all register,
invite and other audio related messages to the main SIP and RTP proxy
while keeping presence messages to SER.
But there are some configuration
parts that I don't understand:
1- if I remove the following lines from
route[2] , client can't register through
Ser.
if (!t_newtran())
{
log(1, "newtran
error\n");
sl_reply_error();
break;
};
2- What is the meaning of : if (uri==myself) { ?
I just
commented this out and it seems to work.
3- Can anyone explain me the
meaning of following lines:
# if
(!method=="REGISTER")
record_route();
# if (loose_route())
{
#
# mark routing logic in
request
#
append_hf("P-hint:
rr-enforced\r\n");
#
route(1);
#
break;
#
};
Thanks,
İlker
Below is my full routing
configuration:
# main routing
logic
route{
# XML
RPC
if (method == "POST" ||
method == "GET")
{
create_via();
dispatch_rpc();
break;
}
# 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 >= max_len
)
{
sl_send_reply("513", "Message too
big");
break;
};
# we record-route all
messages -- to make sure that
#
subsequent messages will go through our proxy;
that's
# particularly good if
upstream and downstream entities
#
use different transport protocol
# if
(!method=="REGISTER")
record_route();
# 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 the request is for
other domain use UsrLoc
# (in
case, it does not work, use the following
command
# with proper names and
addresses in it)
# if (uri==myself)
{
#
if (!lookup_domain("To")) {
#xlog("L_ERR", "URI=MYSELF\n");
#xlog("L_ERR",
"to: %tu from:
%fu\n");
#
log(1, "Unknown domain - message should be
forwarded?");
#
route(1);
#
break;
#
}
#
}
if
(method=="REGISTER") {
xlog("L_ERR", "REGISTER\n");
xlog("L_ERR", "to: %tu
from:
%fu\n");
append_hf("P-hint:
outbound\r\n");
save_noreply("location");
route(2);
break;
};
if (method=="INVITE")
{
xlog("L_ERR", "INVITE\n");
xlog("L_ERR", "to: %tu from: %fu\n");
if
(!lookup("location")) {
route(2);
break;
};
if
(lookup("location")) {
route(1);
break;
};
};
if (method=="MESSAGE")
{
xlog("L_ERR", "MESSAGE\n");
xlog("L_ERR", "to: %tu from:
%fu\n");
if
(!lookup("location"))
{
sl_send_reply("404","Not
found");
break;
};
route(1);
break;
};
if (method=="NOTIFY")
{
xlog("L_ERR", "NOTIFY\n");
xlog("L_ERR", "to: %tu from:
%fu\n");
if
(!lookup("location"))
{
sl_send_reply("404","Not
found");
break;
};
route(1);
break;
};
if (method=="SUBSCRIBE")
{
xlog("L_ERR", "SUBSCRIBE\n");
xlog("L_ERR", "to: %tu from:
%fu\n");
if (!t_newtran()) { # creates a new
transaction
sl_reply_error();
break;
};
handle_subscription("registrar");
break;
};
if (method=="PUBLISH")
{
xlog("L_ERR", "PUBLISH\n");
xlog("L_ERR", "to: %tu from:
%fu\n");
if (!t_newtran())
{
sl_reply_error();
break;
};
handle_publish("registrar");
break;
};
xlog("L_ERR",
"OTHER\n");
xlog("L_ERR", "to: %tu from: %fu\n");
if (!lookup("location"))
{
route(2);
break;
};
if
(lookup("location")) {
route(1);
break;
};
# append_hf("P-hint:
outbound\r\n");
#
route(2);
#
break;
}
route[1]
{
xlog("L_INFO","t_relay()\n");
if
(!t_relay())
{
sl_reply_error();
};
}
route[2]
{
if (!t_newtran()) {
xlog("L_ERR", "newtran error
?????\n");
log(1, "newtran
error\n");
sl_reply_error();
break;
};
if
(!t_forward_nonack("10.100.200.97", 5060))
{
sl_reply_error();
};
xlog("L_ERR", "FORWARD\n");
}