ACK not reaching other side

928 views
Skip to first unread message

conrad.ja...@gmail.com

unread,
Jun 8, 2016, 7:31:33 AM6/8/16
to SIP.js
Hi guys,

I'm putting together something very simple - in fact its literally the video sample from your home page. 2 people bob and alice calling each other using Secure WebSockets - the only difference is that im using OpenSIPS and RTPengine.


Everything is working except the ACK is not getting back to the confirm that the call is in place.

1) REGISTER works fine
2) INVITE works fine
3) Streams are added, video call established
4) 200 OK send back
5) ACK sent but not received
5) call end due to no ACK received.

Some bit of the SIP trace

======================> RECEIVED
SIP/2.0 200 OK
Record-Route: <sip:XX.(opensips_ip).XX:443;transport=wss;lr;did=44f.998c0042>
Via: SIP/2.0/WSS 2igi5v5qiq62.invalid;received=XX.(my_ip).XX;branch=z9hG4bK5673506
To: <sip:1...@mydomain.com>;tag=atb4so0mb7
From: "Bob" <sip:1...@mydomain.com>;tag=q6ncjgtchp
Call-ID: 51ddqj6d6hdq3ai2u470
CSeq: 513 INVITE
Contact: <sip:nbe5mife@XX.(my_ip).XX:53695;transport=ws>
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Type: application/sdp
Content-Length: 3100

v=0
...
(more SDP data here)
...

<====================== SENT (but never got there)
ACK sip:nbe5...@ackje3ikdfln.invalid;transport=ws SIP/2.0
Route: <sip:XX.(opensips_ip).XX:443;transport=wss;lr;did=44f.998c0042>
Via: SIP/2.0/WSS 2igi5v5qiq62.invalid;branch=z9hG4bK196709
Max-Forwards: 70
To: <sip:1...@mydomain.com>;tag=atb4so0mb7
From: "Bob" <sip:1...@mydomain.com>;tag=q6ncjgtchp
Call-ID: 51ddqj6d6hdq3ai2u470
CSeq: 513 ACK
Supported: outbound
User-Agent: SIP.js/0.7.5
Content-Length: 0


From what i can see is that the ToTag should pick this up and route it to the user, but opensips fails with:

CRITICAL:core:mk_proxy: could not resolve hostname: "ackje3ikdfln.invalid"
ERROR:tm:uri2proxy: bad host name in URI <sip:nbe5...@ackje3ikdfln.invalid;transport=ws>


I'm sure i'm missing something in my rout logic, but cant see it. My thinking is that there isnt enough information in the ACK message to get to the user unless it works like the INVITE, but then shouldn't i have to lookup the user in the location table?


This is my OpenSIPS route logic:

route{

xlog("L_INFO", "Start Route Logic => [$rm]");


if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}

if (has_totag()) {
xlog("L_INFO", "Following ToTag: $tt");

# sequential requests within a dialog should
# take the path determined by record-routing
if ( loose_route() ) {
xlog("L_INFO", "Route Found: $(hdr(Route))");

if ( is_method("INVITE") ) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}

xlog("L_INFO", "route it out to whatever destination was set by loose_route() in $du");
route(relay);
} else {
if ( is_method("ACK") ) {
xlog("L_INFO", "We have an ACK");
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
xlog("L_INFO", "ACK without matching transaction - ignore and discard");
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}

# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans()) t_relay();
exit;
}

t_check_trans();

# preloaded route checking
if (loose_route()) {
xlog("L_ERR", "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK")) sl_send_reply("403","Preload Route denied");
exit;
}

# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();

if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(relay);
}

# requests for my domain
if (is_method("PUBLISH|SUBSCRIBE")) {
sl_send_reply("503", "Service Unavailable");
exit;
}

# consider the client is behind NAT - always fix the contact
fix_nated_contact();

if (is_method("REGISTER")) {

nat_keepalive();
fix_nated_register();

xlog("L_INFO","REGISTER From: $si");

if (!save("location","mc1f")) sl_reply_error();
exit;
}

if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}

# do lookup with method filtering
if (!lookup("location","m")) {
t_newtran();
t_reply("404", "Not Found");
exit;
}

route(relay);
}

route[relay] {
# for INVITEs enable some additional helper routes

if (is_method("INVITE")) {
nat_keepalive();
t_on_branch("rtpengine");
t_on_reply("rtpengine");
} else if (is_method("BYE|CANCEL")) {
rtpengine_delete();
}

if (!t_relay()) send_reply("500","Internal Error");
exit;
}


branch_route[rtpengine] {
xlog("L_INFO","Branch route [$rm] From: $si To: $tu");
if (!is_method("INVITE") || !has_body("application/sdp"))
{
xlog("L_INFO","Not INVITE or application/sdp");
return;
}
$var(rtpengine_flags) = "ICE=force-relay DTLS=passive"; #UDP/TLS/RTP/SAVPF ICE=force
xlog("L_INFO","RTPengine Offer $var(rtpengine_flags)");
rtpengine_offer("$var(rtpengine_flags)");
}

onreply_route[rtpengine] {
xlog("L_INFO","Response: [$rs] From: $si");

if (!has_body("application/sdp"))
{
xlog("L_INFO","Not application/sdp");
return;
}

fix_nated_contact();
$var(rtpengine_flags) = "ICE=force-relay DTLS=passive"; #UDP/TLS/RTP/SAVPF ICE=force
xlog("L_INFO","RTPengine Answer $var(rtpengine_flags)");
rtpengine_answer("$var(rtpengine_flags)");
}

eta...@gmail.com

unread,
Jun 8, 2016, 11:07:17 AM6/8/16
to SIP.js, conrad.ja...@gmail.com
You need to loose route your sequential requests, not t_relay them.

See my federated-sip project for an example - it is opensips + rtpengine.

https://github.com/etamme/federated-sip/blob/master/core/opensips.cfg.erb#L484

eta...@gmail.com

unread,
Jun 8, 2016, 11:10:24 AM6/8/16
to SIP.js, conrad.ja...@gmail.com, eta...@gmail.com

Sorry I see that you are trying to loose route. I would say you should ask in #opensips on freeenode, as this is a problem with your opensips config, not a SIP.js issue.

conrad.ja...@gmail.com

unread,
Jun 8, 2016, 11:28:15 AM6/8/16
to SIP.js, conrad.ja...@gmail.com, eta...@gmail.com
This was my fix... but really im not an expert, so dont take my word for it. It a controlled environment, and I always know that the users will be WSS.

...


if (has_totag()) {
xlog("L_INFO", "Following ToTag: $tt");

# sequential requests within a dialog should
# take the path determined by record-routing
if ( loose_route() ) {
xlog("L_INFO", "Route Found: $(hdr(Route))");

# Fix ACK or it fials
if (is_method("ACK")){
xlog("L_INFO", "SIP Request's original URI: $ou");
xlog("L_INFO", "To URI: $tu");
xlog("L_INFO", "Destination URI: $du");

$ru = $tu;
# Request-URI


if (!lookup("location","m")) {

xlog("L_INFO", "User $rU Not Found");
exit;
}

t_relay();
exit;
}

xlog("L_INFO", "Route it out to whatever destination was set by loose_route() in $du (destination uri)");

route(relay);
} else {
if ( is_method("ACK") ) {
xlog("L_INFO", "We have an ACK");
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
xlog("L_INFO", "ACK without matching transaction - ignore and discard");
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}

...

iewu...@gmail.com

unread,
May 17, 2018, 5:41:28 AM5/17/18
to SIP.js
I also encountered a similar problem, with sip.js web client connected to the opensips, ACK messages can not be Web terminal, the wrong, is the final solution?? I also found that the boot lookup at the back end would not find the Web terminal, reporting a 404 error, but the front end running./opensips -D will be able to find it.
Reply all
Reply to author
Forward
0 new messages