-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Jan,
Thanks for your answer!
See the attached files (ser.cfg and ngrep dump).
PS: Of corse I did some modifications in that files just to protect our
Network.
If you want the original files I can send to your personal e-mail.
Thanks again.
Jan Janak wrote:
| Could you send the whole config file and also SIP message dumps ?
|
| Jan.
|
| On 08-11 18:18, Rodrigo P. Telles wrote:
|
|>Hi folks,
|>
|>I've been having litle troubles with SER.
|>When I offhook my BT100 and called another phone, I saw in
|>my log file that SER query the MySQL 3 or more times for the same
|>thing (in this case, about group membership) and the same for log messages.
|>I tried to flag the action but it doens't work.
|>
|>I think that the real problem is that I'm missing some thing
|>in my configuration or I just didn't understand the call flow in SER.
|>any ideas?
|>
|>I'm sending part of my ser.cfg, I hope it helps.
|>===================================
|>record_route();
|>
|>if (method=="INVITE" && !isflagset(11)) {
|>~ log(1, "Voicemail is enable? ");
|>~ if (is_user_in("To", "voicemail")) {
|>~ log(1, "Yes\n");
|>~ setflag(8);
|>~ t_on_failure("1");
|>~ } else {
|>~ log(1, "No\n");
|>~ }
|>
|>~ # native SIP destinations are handled using our USRLOC DB
|>~ if (!lookup("location")) {
|>~ #sl_send_reply("404", "Not
Found");
|>~ if (uri=~"sip:[0-9]{4,6}@") {
|>~ if (!radius_proxy_authorize(""))
{
|>~ proxy_challenge("",
"0");
|>~ sl_send_reply("403",
"That's not
|>your home");
|>~ break;
|>~ };
|>~ rewriteuser("901");
|>~ rewritehostport("x.y.z.w:5060");
|>~ log(1, "Not found\n");
|>~ t_relay();
|>~ break;
|>~ } else {
|>~ route(1);
|>~ break;
|>~ };
|>~ };
|>~ setflag(11);
|>};
|>=========================================
|>Thanks in advance.
|>
|>--
|>============================================
|>Rodrigo P. Telles <telles(a)devel-it.com.br>
|>Project Manager
|>Devel-IT -
http://www.devel-it.com.br
|>TDKOM Group
|>============================================
|>
|>_______________________________________________
|>Serusers mailing list
|>serusers(a)lists.iptel.org
|>http://lists.iptel.org/mailman/listinfo/serusers
|>
|
|
|
- --
============================================
Rodrigo P. Telles <telles(a)devel-it.com.br>
Gerente de Projetos
Devel-IT -
http://www.devel-it.com.br
Grupo TDKOM
============================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQFBkPhEiLK8unYgEMQRArnLAKCCkhYncvM4jgOmenYhoOM94Sz+lwCeLaMe
ugGOf/J334pWDu2U0b5U+AQ=
=2krN
-----END PGP SIGNATURE-----
interface: eth0 (200.xxx.yyy.www/255.255.255.x)
filter: ip and ( port 5060 )
match: 1919
#####
U 192.168.0.91:44863 -> 192.168.0.65:5060
INVITE sip:2020@ser.server.net SIP/2.0..Via: SIP/2.0/UDP
10.0.0.2:44863;branch=z9hG4bKc2c125fc7680ccf0..Fr
om: "Telles 2" <sip:1919@ser.server.net>;tag=ef9d331f5bca723c..To:
<sip:2020@ser.server.net>..Contact: <sip:19
19@10.0.0.2:44863>..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385
INVITE..User-Agent: Grandstream BT
100 1.0.5.11..Max-Forwards: 70..Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Ty
pe: application/sdp..Content-Length: 394....v=0..o=1919@ 8000 8000 IN IP4
10.0.0.2..s=SIP Call..c=IN IP4 1
72.16.22.2..t=0 0..m=audio 20390 RTP/AVP 99 18 4 0 8 9 2 15 101..a=rtpmap:99
iLBC/8000..a=fmtp:99 mode=20..a
=rtpmap:18 G729/8000..a=rtpmap:4 G723/8000..a=rtpmap:0 PCMU/8000..a=rtpmap:8
PCMA/8000..a=rtpmap:9 G722/8000
..a=rtpmap:2 G726-32/8000..a=rtpmap:15 G728/8000..a=ptime:20..a=rtpmap:101
telephone-event/8000..a=fmtp:101
0-11..
#
U 192.168.0.65:5060 -> 192.168.0.91:44863
SIP/2.0 100 trying -- your call is important to us..Via: SIP/2.0/UDP
10.0.0.2:44863;branch=z9hG4bKc2c125f
c7680ccf0;rport=44863;received=192.168.0.91..From: "Telles 2"
<sip:1919@ser.server.net>;tag=ef9d331f5bca723
c..To: <sip:2020@ser.server.net>..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385
INVITE..Server: Sip EXpr
ess router (0.8.14 (i386/linux))..Content-Length: 0..Warning: 392 192.168.0.65:5060
"Noisy feedback tells:
pid=20180 req_src_ip=192.168.0.91 req_src_port=44863 in_uri=sip:2020@ser.server.net
out_uri=sip:2020@192.
168.0.87:5060 via_cnt==1"....
#
U 192.168.0.65:5060 -> 192.168.0.87:5060
INVITE sip:2020@192.168.0.87:5060 SIP/2.0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr
=on>..Via: SIP/2.0/UDP 192.168.0.65;branch=z9hG4bK54.23f86f66.0..Via: SIP/2.0/UDP
10.0.0.2:44863;rport=
44863;received=192.168.0.91;branch=z9hG4bKc2c125fc7680ccf0..From: "Telles 2"
<sip:1919@ser.server.net>;tag=
ef9d331f5bca723c..To: <sip:2020@ser.server.net>..Contact:
<sip:1919@192.168.0.91:44863>..Call-ID: e0b16e3a3
d427e23@10.0.0.2..CSeq: 33385 INVITE..User-Agent: Grandstream BT100
1.0.5.11..Max-Forwards: 69..Allow: IN
VITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Type:
application/sdp..Content-Length: 397.
.P-hint: fixed NAT contact for request..P-hint: request forced to
mediaproxy....v=0..o=1919@ 8000 8000 IN IP4
10.0.0.2..s=SIP Call..c=IN IP4 192.168.0.67..t=0 0..m=audio 35566 RTP/AVP 99 18 4 0 8 9
2 15 101..a=rt
pmap:99 iLBC/8000..a=fmtp:99 mode=20..a=rtpmap:18 G729/8000..a=rtpmap:4
G723/8000..a=rtpmap:0 PCMU/8000..a=r
tpmap:8 PCMA/8000..a=rtpmap:9 G722/8000..a=rtpmap:2 G726-32/8000..a=rtpmap:15
G728/8000..a=ptime:20..a=rtpma
p:101 telephone-event/8000..a=fmtp:101 0-11..
#
U 192.168.0.87:5060 -> 192.168.0.65:5060
SIP/2.0 100 Trying..To: <sip:2020@ser.server.net>..From: "Telles 2"
<sip:1919@ser.server.net>;tag=ef9d331f5bca
723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385 INVITE..Via: SIP/2.0/UDP
192.168.0.65;branch=z9hG
4bK54.23f86f66.0..Via: SIP/2.0/UDP
10.0.0.2:44863;rport=44863;received=192.168.0.91;branch=z9hG4bKc2c12
5fc7680ccf0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..Server: Sipura/SPA2000-2.0
.10(e)..Content-Length: 0....
#
U 192.168.0.87:5060 -> 192.168.0.65:5060
SIP/2.0 180 Ringing..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@ser.serv
er.net>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385
INVITE..Via: SIP/2.0/UDP 19
2.168.65;branch=z9hG4bK54.23f86f66.0..Via: SIP/2.0/UDP
10.0.0.2:44863;rport=44863;received=192.168.
0.91;branch=z9hG4bKc2c125fc7680ccf0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..Se
rver: Sipura/SPA2000-2.0.10(e)..Content-Length: 0....
#
U 192.168.0.65:5060 -> 192.168.0.91:44863
SIP/2.0 180 Ringing..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@ser.serv
er.net>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385
INVITE..Via: SIP/2.0/UDP 10
.0.0.2:44863;rport=44863;received=192.168.0.91;branch=z9hG4bKc2c125fc7680ccf0..Record-Route:
<sip:2020@
192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..Server:
Sipura/SPA2000-2.0.10(e)..Content-Length: 0....
##
U 192.168.0.87:5060 -> 192.168.0.65:5060
SIP/2.0 200 OK..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@ser.server.ne
t>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385 INVITE..Via:
SIP/2.0/UDP 192.168
.0.65;branch=z9hG4bK54.23f86f66.0..Via: SIP/2.0/UDP
10.0.0.2:44863;rport=44863;received=192.168.0.91;
branch=z9hG4bKc2c125fc7680ccf0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..Contact
: Someone NET <sip:2020@192.168.0.87:5060>..Server:
Sipura/SPA2000-2.0.10(e)..Content-Length: 244..Allo
w: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER..Supported:
x-sipura..Content-Type: application/sd
p....v=0..o=- 10523026 10523026 IN IP4 192.168.0.87..s=-..c=IN IP4 192.168.0.87..t=0
0..m=audio 16408 RT
P/AVP 18 100 101..a=rtpmap:18 G729a/8000..a=rtpmap:100 NSE/8000..a=rtpmap:101
telephone-event/8000..a=fmtp:1
01 0-15..a=ptime:30..a=sendrecv..
#
U 192.168.0.65:5060 -> 192.168.0.91:44863
SIP/2.0 200 OK..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@ser.server.ne
t>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385 INVITE..Via:
SIP/2.0/UDP 10.0.
0.2:44863;rport=44863;received=192.168.0.91;branch=z9hG4bKc2c125fc7680ccf0..Record-Route:
<sip:2020@192.1
68.0.65;ftag=ef9d331f5bca723c;lr=on>..Contact: Someone NET
<sip:2020@192.168.0.87:5060>..Server: Sipu
ra/SPA2000-2.0.10(e)..Content-Length: 244..Allow: ACK, BYE, CANCEL, INFO, INVITE,
NOTIFY, OPTIONS, REFER..Su
pported: x-sipura..Content-Type: application/sdp..P-hint: response forced to
mediaproxy....v=0..o=- 10523026
10523026 IN IP4 192.168.0.87..s=-..c=IN IP4 192.168.0.67..t=0 0..m=audio 35566 RTP/AVP
18 100 101..a=rt
pmap:18 G729a/8000..a=rtpmap:100 NSE/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101
0-15..a=ptime:30..a
=sendrecv..
#
U 192.168.0.91:44863 -> 192.168.0.65:5060
ACK sip:2020@192.168.0.87:5060 SIP/2.0..Via: SIP/2.0/UDP
10.0.0.2:44863;branch=z9hG4bK7246a42746efbbc5.
.Route: <sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..From: "Telles
2" <sip:1919@ser.server.net>;tag
=ef9d331f5bca723c..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..Contact:
<sip:1919@10.0.0.2:44863
..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33385
ACK..User-Agent: Grandstream BT100 1.0.5.11..Max-Forwa
rds: 70..Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Length: 0....
#
U 192.168.0.65:5060 -> 192.168.0.87:5060
ACK sip:2020@192.168.0.87:5060 SIP/2.0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on
..Via: SIP/2.0/UDP 192.168.0.65;branch=0..Via:
SIP/2.0/UDP 10.0.0.2:44863;rport=44863;received=192.168
.0.91;branch=z9hG4bK7246a42746efbbc5..From: "Telles 2"
<sip:1919@ser.server.net>;tag=ef9d331f5bca723c..To:
<sip:2020@ser.server.net>;tag=3033786eec83f67bi0..Contact:
<sip:1919@192.168.0.91:44863>..Call-ID: e0b16e3a
3d427e23@10.0.0.2..CSeq: 33385 ACK..User-Agent: Grandstream BT100
1.0.5.11..Max-Forwards: 69..Allow: INVI
TE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Length: 0..P-hint: fixed
NAT contact for requ
est....
######
U 192.168.0.91:44863 -> 192.168.0.65:5060
BYE sip:2020@192.168.0.87:5060 SIP/2.0..Via: SIP/2.0/UDP
10.0.0.2:44863;branch=z9hG4bK63b83d2965c75b38.
.Route: <sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..From: "Telles
2" <sip:1919@ser.server.net>;tag
=ef9d331f5bca723c..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..Contact:
<sip:1919@10.0.0.2:44863
..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33386
BYE..User-Agent: Grandstream BT100 1.0.5.11..Max-Forwa
rds: 70..Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Length: 0....
#
U 192.168.0.65:5060 -> 192.168.0.87:5060
BYE sip:2020@192.168.0.87:5060 SIP/2.0..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on
..Via: SIP/2.0/UDP
192.168.0.65;branch=z9hG4bK24.615e1d66.0..Via: SIP/2.0/UDP 10.0.0.2:44863;rport=448
63;received=192.168.0.91;branch=z9hG4bK63b83d2965c75b38..From: "Telles 2"
<sip:1919@ser.server.net>;tag=ef9
d331f5bca723c..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..Contact:
<sip:1919@192.168.0.91:44863>
..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33386 BYE..User-Agent: Grandstream BT100
1.0.5.11..Max-Forwar
ds: 69..Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Length: 0..P-hint:
fixed N
AT contact for request....
#
U 192.168.0.87:5060 -> 192.168.0.65:5060
SIP/2.0 200 OK..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@sip.server.ne
t>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33386 BYE..Via:
SIP/2.0/UDP 192.168.
0.65;branch=z9hG4bK24.615e1d66.0..Via: SIP/2.0/UDP
10.0.0.2:44863;rport=44863;received=192.168.0.91;bra
nch=z9hG4bK63b83d2965c75b38..Record-Route:
<sip:2020@192.168.0.65;ftag=ef9d331f5bca723c;lr=on>..Server: Si
pura/SPA2000-2.0.10(e)..Content-Length: 0....
#
U 192.168.0.65:5060 -> 192.168.0.91:44863
SIP/2.0 200 OK..To: <sip:2020@ser.server.net>;tag=3033786eec83f67bi0..From:
"Telles 2" <sip:1919@sip.server.ne
t>;tag=ef9d331f5bca723c..Call-ID: e0b16e3a3d427e23@10.0.0.2..CSeq: 33386 BYE..Via:
SIP/2.0/UDP 10.0.0.
2:44863;rport=44863;received=192.168.0.91;branch=z9hG4bK63b83d2965c75b38..Record-Route:
<sip:2020@192.168.
0.65;ftag=ef9d331f5bca723c;lr=on>..Server: Sipura/SPA2000-2.0.10(e)..Content-Length:
0....
#
# ----------- global configuration parameters ------------------------
debug=1
listen=x.y.z.w
fork=yes
log_stderror=no
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=10
fifo="/tmp/ser_fifo"
fifo_mode=438 # 666
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
# Uncomment this if you want digest authentication
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
# ----------------- setting module-specific parameters ---------------
# configuracao do DB (somente usrloc, domain e group)
modparam("domain|group|usrloc", "db_url",
"sql://user:pass@a.b.c.d/ser")
# TM params - timeouts
modparam("tm", "fr_inv_timer", 40 )
modparam("tm", "fr_timer", 30 )
# radius
modparam("auth_radius", "service_type", 15)
modparam("auth_radius", "radius_config",
"/usr/local/etc/radiusclient/radiusclient.conf")
# Accounting
modparam("acc", "radius_flag", 1)
modparam("acc", "report_ack", 0)
modparam("acc", "radius_missed_flag", 2)
# -- usrloc params --
#modparam("usrloc", "db_mode", 0)
# 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)
modparam("registrar", "nat_flag", 6)
modparam("mediaproxy", "natping_interval", 30) # Ping interval 30 s
# ------------------------- request routing logic -------------------
# main routing logic
route{
# Loga todas as transacoes
xlog("L_ALERT", "SER [%ci:%rm] from [%is:%fu] to [%tu]\n");
xlog("L_ALERT","SER [%ci]
-------------------------------------------\n");
xlog("L_ALERT","SER [%ci] entering main loop\n");
if (method=="REGISTER" || !search("^Record-Route:")) {
# Testa se o registro vem de um cliente atraz de NAT e seta a flag 5
if (client_nat_test("7")) {
xlog("L_ALERT","SER [%ci] src address different than via header->NAT
detected\n");
xlog("L_ALERT","SER [%ci] force_rport, fix_contact and
setflag(5)\n");
#try NAT traversal, works only if the client is symmetrical
force_rport();
fix_contact();
append_hf("P-hint: fixed NAT contact for request\r\n");
# flag 5 indicates that incoming request is from NATed client
setflag(5);
};
};
if (method == "BYE" || method == "CANCEL") {
xlog("L_ALERT","SER [%ci] closing media_session\n");
end_media_session();
};
# 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;
};
# accounting
if (method=="INVITE" || method=="BYE" || method=="CANCEL")
{
setflag(1);
setflag(2);
};
# 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
record_route();
# loose-route processing
if (loose_route()) {
t_relay();
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 (method=="REGISTER") {
xlog("L_ALERT","SER [%ci] analyzing REGISTER request\n");
if (!radius_www_authorize("")) {
www_challenge("", "0");
break;
};
if (isflagset(5)) {
#register from nated client, save nat_flag=6
#in location table
xlog("L_ALERT","SER [%ci] REGISTER from nated client\n");
setflag(6);
};
if (!save("location")) {
xlog("L_ALERT","SER [%ci] save location error\n");
sl_reply_error();
};
break;
};
xlog("L_ALERT","SER [%ci]
-------------------------------------------\n");
xlog("L_ALERT","SER [%ci] entering route[1] - relaying SIP
message\n");
if ((isflagset(5)) || (isflagset(6))) {
xlog("L_ALERT", "SER [%ci] at least one of the participants is
NATed->record_route\n");
record_route();
xlog("L_ALERT","SER [%ci] -->setting up reply processing
->onreply_route[1]");
t_on_reply("1");
if (method=="INVITE") {
xlog("L_ALERT", "SER [%ci] INVITE request-->use_media_proxy, set
NATED-INVITE flag(7)");
use_media_proxy();
append_hf("P-hint: request forced to mediaproxy\r\n");
setflag(7);
};
};
if (method=="INVITE" && !isflagset(11)) {
xlog("L_ALERT","SER [%ci] Voicemail is enable for %tu? ");
if (is_user_in("To", "voicemail")) {
xlog("L_ALERT","SER [%ci] Yes\n");
setflag(8);
t_on_failure("1");
} else {
xlog("L_ALERT", "SER [%ci] No\n");
};
###lookup("aliases");
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
#sl_send_reply("404", "Not Found");
if (uri=~"sip:[0-9]{4,6}@") {
if (!radius_proxy_authorize("")) {
proxy_challenge("", "0");
sl_send_reply("403", "That's not your home");
break;
};
# voicemail OK
if ( isflagset(8) ) {
prefix("u");
xlog("L_ALERT","SER [%ci] Redirecting to Voicemail\n");
} else {
rewriteuser("404");
xlog("L_ALERT","SER [%ci->%tu] Not found\n");
};
rewritehostport("b.c.d.a:5060");
t_relay();
break;
} else {
route(1);
break;
};
};
setflag(11);
};
};
# forward to current uri now; use stateful forwarding; that
# works reliably even if we forward from TCP to UDP
xlog("L_ALERT","SER [%ci] relaying message ...\n");
if (!t_relay()) {
xlog("L_ALERT","SER [%ci] t_relay error occured\n");
sl_reply_error();
};
}
route[1] {
if (method=="INVITE") {
if (!radius_proxy_authorize("")) {
proxy_challenge("", "0");
sl_send_reply("403", "That's not your home");
break;
};
if (uri=~"sip:8[0-9]{2}@") {
rewritehostport("b.c.d.a:5060");
xlog("L_ALERT","SER [%ci] Redirecting to b.c.d.a:5060\n");
t_relay();
break;
} else if (uri=~"sip:7[0-9]{2}@") {
rewritehostport("b.c.d.a:5060");
xlog("L_ALERT","SER [%ci] Redirecting to b.c.d.a:5060\n");
t_relay();
break;
} else {
route(2);
###sl_send_reply("404", "Not Found");
break;
};
}
}
route[2] {
if (method=="INVITE") {
if (!radius_proxy_authorize("")) {
proxy_challenge("", "0");
sl_send_reply("403", "That's not your home");
break;
};
if (uri=~"sip:50[0-9]+@") {
rewritehostport("1.2.3.4:5060");
xlog("L_ALERT","SER [%ci] Redirecting to 1.2.3.4:5060\n");
t_relay();
break;
} else if (uri=~"sip:60[0-9]+@") {
rewritehostport("2.3.4.5:5060");
xlog("L_ALERT","SER [%ci] Redirecting to 2.3.4.5:5060\n");
t_relay();
break;
} else {
sl_send_reply("404", "Not Found");
break;
};
}
}
#all incoming replies for t_on_reply(1) transactions enter here
onreply_route[1] {
xlog("L_ALERT","SER [%ci]
-------------------------------------------\n");
xlog("L_ALERT","SER [%ci] onreply_route[1] entered\n");
if (isflagset(6)) {
xlog("L_ALERT","SER [%ci] transaction was sent to a NATED client ->
fix nated contact\n");
fix_contact();
append_hf("P-hint: fixed NAT contact for response\r\n");
}
if ( (status=~"100") ) {
xlog("L_ALERT","SER [%ci] status 100 received\n");
};
if ( (status=~"180") ) {
xlog("L_ALERT","SER [%ci] status 180 received\n");
};
if ( (status=~"202") ) {
xlog("L_ALERT","SER [%ci] status 202 received\n");
};
if ( (status=~"200" || status=~"183") ) {
xlog("L_ALERT","SER [%ci] status 200 or 183");
if ( isflagset(7) ) {
xlog("L_ALERT","SER [%ci] marked(7) as NATED-INVITE ->
use_media_proxy \n");
use_media_proxy();
append_hf("P-hint: response forced to mediaproxy\r\n");
};
};
}
failure_route[1] {
if ( isflagset(8) ) {
if(t_check_status("486")){
prefix("b");
} else {
prefix("u");
};
xlog("L_ALERT","SER [%ci] Redirecting to Voicemail\n");
rewritehostport("a.b.c.d:5060");
append_branch();
t_relay();
break;
};
}