Skip to content

Commit

Permalink
- update grunt-browserify to avoid clean build errors
Browse files Browse the repository at this point in the history
- move around a few functions (no functional change) to make jshint happy on clean build during grunt
  • Loading branch information
James Criscuolo committed Jan 19, 2016
1 parent 92c5bd7 commit b5da723
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"beefy": "^2.1.5",
"browserify": "^4.1.8",
"grunt": "~0.4.0",
"grunt-browserify": "^2.1.0",
"grunt-browserify": "^4.0.1",
"grunt-cli": "~0.1.6",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-jasmine": "~0.8.0",
Expand Down
54 changes: 27 additions & 27 deletions src/SanityCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ var sanityCheck,
responses = [],
all = [];

// Reply
function reply(status_code) {
var to,
response = SIP.Utils.buildStatusLine(status_code),
vias = message.getHeaders('via'),
length = vias.length,
idx = 0;

for(idx; idx < length; idx++) {
response += "Via: " + vias[idx] + "\r\n";
}

to = message.getHeader('To');

if(!message.to_tag) {
to += ';tag=' + SIP.Utils.newTag();
}

response += "To: " + to + "\r\n";
response += "From: " + message.getHeader('From') + "\r\n";
response += "Call-ID: " + message.call_id + "\r\n";
response += "CSeq: " + message.cseq + " " + message.method + "\r\n";
response += "\r\n";

transport.send(response);
}

/*
* Sanity Check for incoming Messages
*
Expand Down Expand Up @@ -145,33 +172,6 @@ function minimumHeaders() {
}
}

// Reply
function reply(status_code) {
var to,
response = SIP.Utils.buildStatusLine(status_code),
vias = message.getHeaders('via'),
length = vias.length,
idx = 0;

for(idx; idx < length; idx++) {
response += "Via: " + vias[idx] + "\r\n";
}

to = message.getHeader('To');

if(!message.to_tag) {
to += ';tag=' + SIP.Utils.newTag();
}

response += "To: " + to + "\r\n";
response += "From: " + message.getHeader('From') + "\r\n";
response += "Call-ID: " + message.call_id + "\r\n";
response += "CSeq: " + message.cseq + " " + message.method + "\r\n";
response += "\r\n";

transport.send(response);
}

requests.push(rfc3261_8_2_2_1);
requests.push(rfc3261_16_3_4);
requests.push(rfc3261_18_3_request);
Expand Down
20 changes: 10 additions & 10 deletions src/Transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ var Transport,
STATUS_ERROR: 2
};

/**
* Compute an amount of time in seconds to wait before sending another
* keep-alive.
* @returns {Number}
*/
function computeKeepAliveTimeout(upperBound) {
var lowerBound = upperBound * 0.8;
return 1000 * (Math.random() * (upperBound - lowerBound) + lowerBound);
}

Transport = function(ua, server) {

this.logger = ua.getLogger('sip.transport');
Expand Down Expand Up @@ -356,16 +366,6 @@ Transport.prototype = {
}
};

/**
* Compute an amount of time in seconds to wait before sending another
* keep-alive.
* @returns {Number}
*/
function computeKeepAliveTimeout(upperBound) {
var lowerBound = upperBound * 0.8;
return 1000 * (Math.random() * (upperBound - lowerBound) + lowerBound);
}

Transport.C = C;
return Transport;
};
18 changes: 9 additions & 9 deletions src/WebRTC/MediaStreamManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ MediaStreamManager.render = function render (streams, elements) {
throw new TypeError('elements must not be empty');
}

function attachAndPlay (elements, stream, index) {
if (typeof elements === 'function') {
elements = elements();
}
var element = elements[index % elements.length];
(environment.attachMediaStream || attachMediaStream)(element, stream);
ensureMediaPlaying(element);
}

function attachMediaStream(element, stream) {
if (typeof element.src !== 'undefined') {
environment.revokeObjectURL(element.src);
Expand All @@ -83,6 +74,15 @@ MediaStreamManager.render = function render (streams, elements) {
}, interval);
}

function attachAndPlay (elements, stream, index) {
if (typeof elements === 'function') {
elements = elements();
}
var element = elements[index % elements.length];
(environment.attachMediaStream || attachMediaStream)(element, stream);
ensureMediaPlaying(element);
}

// [].concat "casts" `elements` into an array
// so forEach works even if `elements` was a single element
elements = [].concat(elements);
Expand Down

0 comments on commit b5da723

Please sign in to comment.