[Devel] Using drop() in Branch_Route seems to break subsequent
branches (bug?)
Tavis P
tavis.lists at galaxytelecom.net
Thu Apr 6 01:03:28 CEST 2006
According to the core docs, inside of a OnReply_Route or Branch Route,
the drop() function needs to be used in place of exit() if you want to
discard the message
I think i've encountered a bug where all subsequent branches that come
after a branch that was "drop()"'d are summarily ignored before with
only the first statement being executed inside the Branch_Route
I've attached a really simple test script, you will need to change the
"port=15061" line
Sending an invite through this script will be branched 4 ways, however
at the second branch i execute drop() and all subsequent branches are
simply left as it (they do not process any of the logic in the
branch_route except for the first line)
thanks!
tavis
-------------- next part --------------
# ----------- global configuration parameters ------------------------
debug=1 # debug level
#fork=yes
#log_stderror=no # (cmd line: -E)
# Debug level to log memory information at
memlog=10
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
# Parameter to set alias hostnames for the server. It can be set many times,
# each value being added in a list to match the hostname when "myself" is checked.
#
alias=127.0.0.1
# Syslog Name
#
log_name="OpenSER"
# User and Group To Run SER As
#
user=openser
group=openser
port=15061
# ------------------ module loading ----------------------------------
# Module Directory
mpath="/openser/lib/openser/modules"
#loadmodule "mysql.so"
#loadmodule "enum.so"
#loadmodule "exec.so"
#loadmodule "pike.so"
#loadmodule "permissions.so"
#loadmodule "domain.so" # needed by mediaproxy.so
#loadmodule "avpops.so"
#loadmodule "avp_radius.so"
#loadmodule "group_radius.so"
#loadmodule "avp.so"
loadmodule "sl.so"
#loadmodule "options.so"
loadmodule "tm.so"
#loadmodule "acc.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
#loadmodule "uri_db.so"
#loadmodule "usrloc.so"
#loadmodule "cpl-c.so"
#loadmodule "registrar.so"
#loadmodule "mediaproxy.so"
#loadmodule "nathelper.so"
#loadmodule "diversion.so"
loadmodule "textops.so"
loadmodule "uri.so"
#loadmodule "auth.so"
#loadmodule "auth_db.so"
#loadmodule "auth_radius.so"
loadmodule "xlog.so"
route
{
# -----------------------------------------------------------------
# - Initial Sanity Checks -
# messages with max_forwards==0, or excessively long requests
# If its an ACK, we simply want to break, not respond.
# -----------------------------------------------------------------
if ( !mf_process_maxfwd_header("10") )
{
# Any messages that are not expecting a response don't need one
if ( !is_method("ACK") )
{
sl_send_reply("483", "Too many hops");
}
xlog("L_WARN", "[$fU] Route{main}: Message Max-Forwards == 0");
exit;
}
if ( msg:len >= max_len )
{
# Any messages that are not expecting a response don't need one
if ( !is_method("ACK") )
{
sl_send_reply("513", "Message too big");
}
xlog("L_WARN", "[$fU] Route{main}: Message was too big");
exit;
}
route(10);
}
# ------------------------------------------------------------------------
# -[ Outbound Routing Block ]-
# ------------------------------------------------------------------------
route[10]
{
xlog("L_WARN", "[$fU] Route{10}: Starting Outbound Routing Block.");
if ( method=="INVITE" )
{
t_on_branch("10");
# Sorry Google!
rewriteuri("sip:2222 at google.com");
append_branch();
rewriteuri("sip:3333 at google.com");
append_branch();
rewriteuri("sip:4444 at google.com");
append_branch();
rewriteuri("sip:1111 at google.com");
}
xlog("L_WARN", "[$fU] Route{10}: Destination Set = [ $ds ]");
# Route Message Out
if ( !t_relay() )
{
xlog("L_WARN", "[$fU] Route{10}: t_relay error in Outbound Routing Block");
sl_reply_error();
}
}
branch_route[10]
{
xlog("L_WARN", "[$fU] Branch_Route{10}: Starting Branch_Route..");
xlog("L_WARN", "[$fU] Branch_Route{10}: Source IP: [$si] Destination IP: [$dd]");
if ( uri =~ "sip:2222 at google.com" )
{
xlog("L_WARN", "Branch_Route{10}: URI WAS 2222, EXECUTING drop() ");
# commenting out this line will make all subsequent branches work properly
drop();
}
xlog("L_WARN", "[$fU] Branch_Route{10}: Branch Route Finished Executing");
}
More information about the Devel
mailing list