I am trying to use the UAC module in conjunction with a gateway that
requires authentication. I am getting the following when trying to dial a
number that gets sent to the gateway:
ERROR: t_newtran: transaction already in process
Prior to this the following are written to the log file:
international PSTN match
resetflag(9)
host rewritten
What seems to be happening is that the t_relay_to_udp is being called and
the gateway is contacted but before any reply is received openser is
throwing a t_newtran error.
My config file is as follows:
<snip>
route {
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
return;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
return;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" && client_nat_test("3")) {
record_route_preset("60.000.000.000:5060;nat=yes"); # insert IP address
} else if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (method=="BYE" || method=="CANCEL") {
setflag(1);
end_media_session();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
setflag(6);
use_media_proxy();
};
};
route(1);
return;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri!=myself) {
route(5);
route(1);
return;
};
if (uri==myself) {
if (method=="ACK") {
route(6);
return;
} else if (method=="CANCEL") {
route(1);
return;
} else if (method=="INVITE") {
route(3);
return;
} else if (method=="REGISTER") {
route(2);
return;
};
lookup("aliases");
if (uri!=myself) {
route(5);
route(1);
return;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
return;
};
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# ----------------------------------------------------------------
sl_send_reply("100", "Trying");
log(1,"route[2] (Register handler");
if (!search("^Contact: \*") && client_nat_test("7")) {
setflag(6);
fix_nated_register();
force_rport();
};
if (!www_authorize("","subscriber")) {
www_challenge("","0");
return;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
return;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (client_nat_test("3")) {
setflag(7);
force_rport();
fix_nated_contact();
};
if (!allow_trusted() && !is_uri_host_local()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
consume_credentials();
};
lookup("aliases");
if (uri!=myself) {
route(5);
route(1);
return;
};
if (uri=~"^sip:[+|00|011][0-9]*@") { # International PSTN
log(1,"international PSTN match");
route(4);
return;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{11}@") { # Domestic(US) PSTN
# route(4);
return;
};
sl_send_reply("404", "User Not Found");
return;
};
if (method=="CANCEL") {
route(1);
return;
};
setflag(1);
setflag(3);
route(5);
route(1);
}
route[4] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
#UAC module routing#
t_on_failure("1");
resetflag(9);
log(1,"resetflag(9)");
t_relay_to_udp("203.100.100.100","5060"); #PSTN gateway
log(1,"host rewritten");
avp_write("i:45", "inv_timeout");
setflag(1);
setflag(3);
route(5);
route(1);
}
route[5] {
# -----------------------------------------------------------------
# RTP Proxy Enabler
# -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) {
use_media_proxy();
};
}
route[6] {
# ------------------------------------------------------------------------
# ACK Handler
# ------------------------------------------------------------------------
# ------------------------------------------------------------------------
# Aliases Section
# ------------------------------------------------------------------------
lookup("aliases");
if (uri!=myself) {
route(5);
route(1);
return;
};
lookup("location");
route(1);
}
onreply_route[1]
{
if ((isflagset(6) || isflagset(7)) &&
(status=~"(180)|(183)|2[0-9][0-9]"))
{
if (!search("^Content-Length:\ 0")) {
use_media_proxy();
};
};
if (client_nat_test("1")) {
fix_nated_contact();
};
}
failure_route[1]
{
log(1,"hit failure_route[1]");
if (t_check_status("401|407"))
{
log(1,"status is 401 or 407");
if (isflagset(9))
{
log(1,"flag9 is set");
t_reply("503","Authentication failed");
return;
}
if (uac_auth())
{ log(1, "called uac_auth");
setflag(9);
t_on_failure("1");
append_branch();
t_relay();
}
}
}
The SIP traffic is as follows:
U 192.168.0.50:5060 -> 192.168.0.6:5060
INVITE sip:021555222@domain.co.nz SIP/2.0..Via: SIP/2.0/UDP 192.168.0.5
0:5060;rport;branch=z9hG4bK29BECBA8F97C4648A1E027E5DF93BEC0..From: Cameron
local Domain <sip:6494466546@domain.co.nz>;tag=3738281931..To: <sip
:021555222@domain.co.nz>..Contact: <sip:6494466546@192.168.0.50:5060>..
Call-ID: B1402DE5-6390-4715-A03F-9B1F78AB60CF@192.168.0.50..CSeq: 28000
INV
ITE..Proxy-Authorization: Digest username="6494466546",realm="domain.co
.nz",nonce="44329b8ecd24c22c48293896310ed7d403738b94",response="014bc155e1a
3554039f6688e9d1e8d42",uri="sip:021555222@domain.co.nz"..Max-Forwards:
70..Content-Type: application/sdp..User-Agent: X-Lite release
1103m..Conten
t-Length: 301....v=0..o=6494466546 766866495 766868168 IN IP4
192.168.0.50.
.s=X-Lite..c=IN IP4 192.168.0.50..t=0 0..m=audio 8000 RTP/AVP 0 8 3 98 97
1
01..a=rtpmap:0 pcmu/8000..a=rtpmap:8 pcma/8000..a=rtpmap:3
gsm/8000..a=rtpm
ap:98 iLBC/8000..a=rtpmap:97 speex/8000..a=rtpmap:101
telephone-event/8000.
.a=fmtp:101 0-15..
####
U 192.168.0.6:5060 -> 192.168.0.50:5060
SIP/2.0 100 trying -- your call is important to us..Via: SIP/2.0/UDP
192.16
8.0.50:5060;rport=5060;branch=z9hG4bK29BECBA8F97C4648A1E027E5DF93BEC0..From
: Cameron local Domain <sip:6494466546@domain.co.nz>;tag=3738281931
..To: <sip:021555222@domain.co.nz>..Call-ID: B1402DE5-6390-4715-A03F-9B
1F78AB60CF@192.168.0.50..CSeq: 28000 INVITE..Server: OpenSer (1.0.1
(i386/l
inux))..Content-Length: 0..Warning: 392 192.168.0.6:5060 "Noisy feedback
te
lls: pid=8125 req_src_ip=192.168.0.50 req_src_port=5060
in_uri=sip:0214462
02(a)domain.co.nz out_uri=sip:021555222@domain.co.nz via_cnt==1"....
#
U 192.168.0.6:5060 -> 203.184.16.2:5060
INVITE sip:021555222@domain.co.nz SIP/2.0..Record-Route: <sip:60.234.13
7.50:5060;nat=yes;ftag=3738281931;lr=on>..Via: SIP/2.0/UDP
192.168.0.6;bran
ch=z9hG4bKbdfc.69423e86.0..Via: SIP/2.0/UDP
192.168.0.50:5060;rport=5060;br
anch=z9hG4bK29BECBA8F97C4648A1E027E5DF93BEC0..From: Cameron local domain
<sip:6494466546@domain.co.nz>;tag=3738281931..To:
<sip:021555222@domain.co.nz>..Contact:
<sip:6494466546@192.168.0.50:5060>..Call-ID: B1402D
E5-6390-4715-A03F-9B1F78AB60CF@192.168.0.50..CSeq: 28000
INVITE..Max-Forwar
ds: 69..Content-Type: application/sdp..User-Agent: X-Lite release
1103m..Co
ntent-Length: 301....v=0..o=6494466546 766866495 766868168 IN IP4
192.168.0
.50..s=X-Lite..c=IN IP4 192.168.0.50..t=0 0..m=audio 8000 RTP/AVP 0 8 3 98
97 101..a=rtpmap:0 pcmu/8000..a=rtpmap:8 pcma/8000..a=rtpmap:3
gsm/8000..a=
rtpmap:98 iLBC/8000..a=rtpmap:97 speex/8000..a=rtpmap:101
telephone-event/8
000..a=fmtp:101 0-15..
####
U 192.168.0.6:5060 -> 192.168.0.50:5060
SIP/2.0 500 I'm terribly sorry, server error occurred (1/SL)..Via:
SIP/2.0/
UDP
192.168.0.50:5060;rport=5060;branch=z9hG4bK29BECBA8F97C4648A1E027E5DF93
BEC0..From: Cameron local Domain <sip:6494466546@domain.co.nz>;tag=
3738281931..To: <sip:021555222@domain.co.nz>;tag=329cfeaa6ded039da25ff8
cbb8668bd2.bcdf..Call-ID:
B1402DE5-6390-4715-A03F-9B1F78AB60CF(a)192.168.0.50
..CSeq: 28000 INVITE..Server: OpenSer (1.0.1
(i386/linux))..Content-Length:
0..Warning: 392 192.168.0.6:5060 "Noisy feedback tells: pid=8125
req_src_
ip=192.168.0.50 req_src_port=5060 in_uri=sip:021555222@domain.co.nz out
_uri=sip:021555222@domain.co.nz via_cnt==1"....
#
Any help would be appreciated
Cameron