I am trying to get record_route() working in a simple configuration
file which I use for lab testing of our UA product.
After the INVITE is sent by the UA (our gateway) the call just isn't
routed.
Attached is the debug trace from ser (debug level 6.) this shows just
the first INVITE which is retried 4 times. The config file is shown
below that.
5(2018) SIP Request:
5(2018) method: <INVITE>
5(2018) uri: <sip:17325555555@192.168.20.12>
5(2018) version: <SIP/2.0>
5(2018) parse_headers: flags=1
5(2018) get_hdr_field: cseq <CSeq>: <1> <INVITE>
5(2018) end of header reached, state=9
5(2018) DEBUG: get_hdr_field: <To> [33];
uri=[sip:17325555555@192.168.20.12]
5(2018) DEBUG: to body [<sip:17325555555@192.168.20.12> ]
5(2018) Found param type 232, <branch> =
<z9hG4bK-tenor-c0a8-14dc-0024>; state=16
5(2018) end of header reached, state=5
5(2018) parse_headers: Via found, flags=1
5(2018) parse_headers: this is the first via
5(2018) After parse_msg...
5(2018) preparing to run routing scripts...
5(2018) DEBUG : is_maxfwd_present: searching for max_forwards header
5(2018) parse_headers: flags=128
5(2018) DEBUG: get_hdr_body : content_length=164
5(2018) DEBUG: is_maxfwd_present: value = 70
5(2018) parse_headers: flags=256
5(2018) found end of header
5(2018) find_first_route(): No Route headers found
5(2018) loose_route(): There is no Route HF
5(2018) rwrite(): Rewriting Request-URI with 'sip:192.168.20.137'
5(2018) receive_msg: cleaning up
6(2021) SIP Request:
6(2021) method: <INVITE>
6(2021) uri: <sip:17325555555@192.168.20.12>
6(2021) version: <SIP/2.0>
6(2021) parse_headers: flags=1
6(2021) get_hdr_field: cseq <CSeq>: <1> <INVITE>
6(2021) end of header reached, state=9
6(2021) DEBUG: get_hdr_field: <To> [33];
uri=[sip:17325555555@192.168.20.12]
6(2021) DEBUG: to body [<sip:17325555555@192.168.20.12> ]
6(2021) Found param type 232, <branch> =
<z9hG4bK-tenor-c0a8-14dc-0024>; state=16
6(2021) end of header reached, state=5
6(2021) parse_headers: Via found, flags=1
6(2021) parse_headers: this is the first via
6(2021) After parse_msg...
6(2021) preparing to run routing scripts...
6(2021) DEBUG : is_maxfwd_present: searching for max_forwards header
6(2021) parse_headers: flags=128
6(2021) DEBUG: get_hdr_body : content_length=164
6(2021) DEBUG: is_maxfwd_present: value = 70
6(2021) parse_headers: flags=256
6(2021) found end of header
6(2021) find_first_route(): No Route headers found
6(2021) loose_route(): There is no Route HF
6(2021) rwrite(): Rewriting Request-URI with 'sip:192.168.20.137'
6(2021) receive_msg:
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this
config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# 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 (len_gt( max_len )) {
sl_send_reply("513", "Message too big");
break;
};
# store user location if a REGISTER appears
if (method=="REGISTER") {
save("location");
};
############################
/* grant Route routing if route headers present */
# if (loose_route()) { t_relay(); break; };
/* record-route INVITEs -- all subsequent requests must visit
us */
# if (method=="INVITE") {
# record_route();
# };
# now check if it really is a PSTN destination which should be
handled
# by our gateway; if not, and the request is an invitation,
drop it --
# we cannot terminate it in PSTN; relay non-INVITE requests --
it may
# be for example BYEs sent by gateway to call originator
if (uri=="sip:17325555555@192.168.20.12") {
sl_send_reply("678","matched uri for 20.137");
if (method=="INVITE")
# forward(192.168.20.137, 5060);
record_route();
# t_relay();
break;
};
if (uri=~"sip:1732922[0-9]*@192.168.20.12") {
sl_send_reply("678","matched uri for 20.220");
if (method=="INVITE")
# forward(192.168.20.220, 5060);
record_route();
# t_relay();
break;
};
if (uri=~"sip:173221000[0-9]*@192.168.20.12") {
sl_send_reply("678","matched uri for 20.210");
if (method=="INVITE")
forward(192.168.20.210, 5060);
#record_route();
break;
};
if (uri=~"sip:173220000[0-9]*@192.168.20.12") {
sl_send_reply("678","matched uri for 20.209");
if (method=="INVITE")
forward(192.168.20.209, 5060);
#record_route();
break;
};
#################################
}