Skip to content

Commit

Permalink
Add some log lines into sanity check code for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Jan 2, 2013
1 parent c3a4926 commit 81595be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SanityCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ JsSIP.sanityCheck = (function() {
// Sanity Check functions for responses
function rfc3261_8_1_3_3() {
if(message.countHeader('via') > 1) {
console.warn(JsSIP.c.LOG_SANITY_CHECK +'More than one Via header field present in the response. Dropping the response');
return false;
}
}

function rfc3261_18_1_2() {
var via_host = ua.configuration.via_host;
if(message.via.host !== via_host) {
console.warn(JsSIP.c.LOG_SANITY_CHECK +'Via host in the response does not match UA Via host value. Dropping the response');
return false;
}
}
Expand All @@ -118,6 +120,7 @@ JsSIP.sanityCheck = (function() {
contentLength = message.getHeader('content-length');

if(len < contentLength) {
console.warn(JsSIP.c.LOG_SANITY_CHECK +'Message body length is lower than the value in Content-Length header field. Dropping the response');
return false;
}
}
Expand All @@ -130,6 +133,7 @@ JsSIP.sanityCheck = (function() {

while(idx--) {
if(!message.hasHeader(mandatoryHeaders[idx])) {
console.warn(JsSIP.c.LOG_SANITY_CHECK +'Missing mandatory header field : '+ mandatoryHeaders[idx] +'. Dropping the response');
return false;
}
}
Expand Down

0 comments on commit 81595be

Please sign in to comment.