Skip to content

Commit 81595be

Browse files
committed
Add some log lines into sanity check code for clarity
1 parent c3a4926 commit 81595be

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/SanityCheck.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ JsSIP.sanityCheck = (function() {
101101
// Sanity Check functions for responses
102102
function rfc3261_8_1_3_3() {
103103
if(message.countHeader('via') > 1) {
104+
console.warn(JsSIP.c.LOG_SANITY_CHECK +'More than one Via header field present in the response. Dropping the response');
104105
return false;
105106
}
106107
}
107108

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

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

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

0 commit comments

Comments
 (0)