Hi All,
I'm trying to establish a topology with Kamailio which is located between Asterisk and
Outside.
My issue is "transaction matching failed" (t_check_trans failed). That means
Kamailio does not recognise ACK & BYE message to forwards. I had a check on email list
and google but found nothing.
I'm using it with record_route.
SIP signalling and part of kamailio.cfg is below. Is there any suggestion?
route[WITHINDLG] {
if (!has_totag()) return;
if (loose_route()) {
route(DLGURI);
if (is_method("BYE")) {
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the transaction fails
}
else if ( is_method("ACK") ) {
xlog("ack is came: $si:$sp\n");
route(NATMANAGE);
}
else if ( is_method("NOTIFY") ) {
record_route();
}
route(RELAY);
exit;
}
if (is_method("SUBSCRIBE") && uri == myself) {
route(PRESENCE);
exit;
}
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
route(RELAY);
exit;
} else {
exit;
}
}
sl_send_reply("404","Not here");
exit;
}
route[NATMANAGE] {
#!ifdef WITH_NAT
if (is_request()) {
if(has_totag()) {
if(check_route_param("nat=yes")) {
setbflag(FLB_NATB);
}
}
}
route(RTPPROXY);
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
return;
if (is_request()) {
if (!has_totag()) {
if(t_is_branch_route()) {
add_rr_param(";nat=yes");
}
}
}
if (is_reply()) {
if(isbflagset(FLB_NATB)) {
if(is_first_hop())
set_contact_alias();
}
}
#!endif
return;
}
Asterisk > Kamailio
INVITE sip:user@outside_ip SIP/2.0
Via: SIP/2.0/UDP asterisk_ip:5060;branch=z9hG4bK1b56cce0
Max-Forwards: 70
From: "KUYRUK"
<sip:0553847<tel:+10553847>aaaa@asterisk_ip>;tag=as3dde7cdb
To: <sip:user@outside_ip>
Contact: <sip:0553847<tel:+10553847>aaaa@asterisk_ip:5060>
Call-ID: 62a480bf71d2a1aa0ec94b454cd98945@asterisk_ip:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.32.3
Kamailio > Outside
INVITE sip:user@outside_ip SIP/2.0
Record-Route: <sip:kamailio_ip;lr;nat=yes>
Via: SIP/2.0/UDP kamailio_ip;branch=z9hG4bK7b3f.8e4716eeea4b0dc45cc51d21b5aded57.0
Via: SIP/2.0/UDP asterisk_ip:5060;rport=5060;branch=z9hG4bK1b56cce0
From: "KUYRUK"
<sip:0553847<tel:+10553847>aaaa@asterisk_ip>;tag=as3dde7cdb
To: <sip:user@outside_ip>
Contact:
<sip:0553847<tel:+10553847>aaaa@asterisk_ip:5060;alias=asterisk_ip~5060~1>
Call-ID: 62a480bf71d2a1aa0ec94b454cd98945@asterisk_ip:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.32.3
Outside > Kamailio
SIP/2.0 200 OK
Via: SIP/2.0/UDP kamailio_ip;branch=z9hG4bK7b3f.8e4716eeea4b0dc45cc51d21b5aded57.0
Via: SIP/2.0/UDP asterisk_ip:5060;rport=5060;branch=z9hG4bK1b56cce0
From: "KUYRUK"
<sip:0553847<tel:+10553847>aaaa@asterisk_ip>;tag=as3dde7cdb
To: <sip:user@outside_ip>;tag=kv8iml6ur9
Call-ID: 62a480bf71d2a1aa0ec94b454cd98945@asterisk_ip:5060
CSeq: 102 INVITE
Record-Route: <sip:kamailio_ip;lr;nat=yes>
Contact: <sip:user@outside_ip:5060;alias=x.x.x.x~18005~6;transport=udp>
Kamailio > Asterisk
SIP/2.0 200 OK
Via: SIP/2.0/UDP asterisk_ip:5060;rport=5060;branch=z9hG4bK1b56cce0
From: "KUYRUK"
<sip:0553847<tel:+10553847>aaaa@asterisk_ip>;tag=as3dde7cdb
To: <sip:user@outside_ip>;tag=kv8iml6ur9
Call-ID: 62a480bf71d2a1aa0ec94b454cd98945@asterisk_ip:5060
CSeq: 102 INVITE
Record-Route: <sip:kamailio_ip;lr;nat=yes>
Contact: <sip:user@outside_ip:5060;alias=x.x.x.x~18005~6;transport=udp>
Asterisk > Kamailio THIS ACK IS NOT ROUTED TO OUTSIDE BY KAMAILIO!!
ACK sip:user@outside_ip:5060;alias=x.x.x.x~18005~6;transport=udp SIP/2.0
Via: SIP/2.0/UDP asterisk_ip:5060;branch=z9hG4bK73366924
Route: <sip:kamailio_ip;lr;nat=yes>
From: "KUYRUK"
<sip:0553847<tel:+10553847>aaaa@asterisk_ip>;tag=as3dde7cdb
To: <sip:user@outside_ip>;tag=kv8iml6ur9
Contact: <sip:0553847<tel:+10553847>aaaa@asterisk_ip:5060>
Call-ID: 62a480bf71d2a1aa0ec94b454cd98945@asterisk_ip:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.8.32.3
Get Outlook for Android<https://aka.ms/ghei36>