Skip to content

Commit

Permalink
Fix detection of incoming merged requests (don't generate 482 for ret…
Browse files Browse the repository at this point in the history
…ransmissions).
  • Loading branch information
ibc committed Sep 25, 2014
1 parent 5f16c66 commit f9ef522
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions src/SanityCheck.js
Expand Up @@ -71,31 +71,45 @@ function rfc3261_8_2_2_2() {
call_id = message.call_id, call_id = message.call_id,
cseq = message.cseq; cseq = message.cseq;


if(!message.to_tag) { // Accept any in-dialog request.
if(message.method === JsSIP.C.INVITE) { if(message.to_tag) {
tr = ua.transactions.ist[message.via_branch]; return;
if(!tr) { }
return;
} else { // INVITE request.
for(idx in ua.transactions.ist) { if (message.method === JsSIP.C.INVITE) {
tr = ua.transactions.ist[idx]; // If the branch matches the key of any IST then assume it is a retransmission
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) { // and ignore the INVITE.
reply(482); // TODO: we should reply the last response.
return false; if (ua.transactions.ist[message.via_branch]) {
} return false;
}
// Otherwise check whether it is a merged request.
else {
for(idx in ua.transactions.ist) {
tr = ua.transactions.ist[idx];
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) {
reply(482);
return false;
} }
} }
} else { }
tr = ua.transactions.nist[message.via_branch]; }
if(!tr) { // Non INVITE request.
return; else {
} else { // If the branch matches the key of any NIST then assume it is a retransmission
for(idx in ua.transactions.nist) { // and ignore the request.
tr = ua.transactions.nist[idx]; // TODO: we should reply the last response.
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) { if (ua.transactions.nist[message.via_branch]) {
reply(482); return false;
return false; }
} // Otherwise check whether it is a merged request.
else {
for(idx in ua.transactions.nist) {
tr = ua.transactions.nist[idx];
if(tr.request.from_tag === fromTag && tr.request.call_id === call_id && tr.request.cseq === cseq) {
reply(482);
return false;
} }
} }
} }
Expand Down

0 comments on commit f9ef522

Please sign in to comment.