Skip to content
Permalink
Browse files

Give some love to "console.log|warn|info" messages missing the JsSIP …

…class/module prefix.
  • Loading branch information
ibc committed Feb 5, 2013
1 parent 4be3b23 commit 537d2f2e8504500e3e096c36a324fc602e77ab7a
Showing with 16 additions and 14 deletions.
  1. +2 −0 src/Constants.js
  2. +1 −1 src/DigestAuthentication.js
  3. +3 −3 src/MediaSession.js
  4. +1 −1 src/NameAddrHeader.js
  5. +4 −4 src/UA.js
  6. +2 −2 src/URI.js
  7. +3 −3 src/Utils.js
@@ -24,6 +24,8 @@ JsSIP.C= {
LOG_TRANSACTION: JsSIP.name() +' | '+ 'TRANSACTION' +' | ',
LOG_DIALOG: JsSIP.name() +' | '+ 'DIALOG' +' | ',
LOG_UA: JsSIP.name() +' | '+ 'UA' +' | ',
LOG_URI: JsSIP.name() +' | '+ 'URI' +' | ',
LOG_NAME_ADDR_HEADER: JsSIP.name() +' | '+ 'NAME ADDR HEADER' +' | ',
LOG_INVITE_SESSION: JsSIP.name() +' | '+ 'INVITE SESSION' +' | ',
LOG_CLIENT_INVITE_SESSION: JsSIP.name() +' | '+ 'CLIENT INVITE SESSION' +' | ',
LOG_SERVER_INVITE_SESSION: JsSIP.name() +' | '+ 'SERVER INVITE SESSION' +' | ',
@@ -52,7 +52,7 @@ JsSIP.DigestAuthentication.prototype.authenticate = function(password) {

// nc-value = 8LHEX. Max value = 'FFFFFFFF'
if (this.nc === 4294967296) {
console.log('Maximum "nc" value has been reached. Resetting "nc"');
console.log(JsSIP.C.LOG_DIGEST_AUTHENTICATION + 'Maximum "nc" value has been reached. Resetting "nc"');
this.nc = 1;
}

@@ -148,7 +148,7 @@ JsSIP.MediaSession.prototype = {
};

this.peerConnection.onaddstream = function(mediaStreamEvent) {
console.warn('stream added');
console.warn(JsSIP.C.LOG_MEDIA_SESSION +'stream added');

if (session.remoteView && this.remoteStreams.length > 0) {
session.remoteView.src = webkitURL.createObjectURL(mediaStreamEvent.stream);
@@ -160,8 +160,8 @@ JsSIP.MediaSession.prototype = {
};

this.peerConnection.onstatechange = function() {
console.warn('Status changed to: '+ this.readyState);
console.warn('ICE state is: '+ this.iceState);
console.warn(JsSIP.C.LOG_MEDIA_SESSION +'Status changed to: '+ this.readyState);
console.warn(JsSIP.C.LOG_MEDIA_SESSION +'ICE state is: '+ this.iceState);
};
},

@@ -12,7 +12,7 @@ JsSIP.NameAddrHeader = function(uri, display_name, parameters) {

// Checks
if(!uri || !uri instanceof JsSIP.URI) {
console.warn('Missing or invalid "uri" in NameAddrHeader');
console.warn(JsSIP.C.LOG_NAME_ADDR_HEADER + 'Missing or invalid "uri" in NameAddrHeader');
throw new JsSIP.Exceptions.InvalidValueError('uri', uri);
}

@@ -651,15 +651,15 @@ JsSIP.UA.prototype.loadConfig = function(configuration) {
// Check Mandatory parameters
for(parameter in JsSIP.UA.configuration_check.mandatory) {
if(!configuration.hasOwnProperty(parameter)) {
console.error('Missing config parameter: ' + parameter);
console.error(JsSIP.C.LOG_UA + 'Missing config parameter: ' + parameter);
throw new JsSIP.Exceptions.ConfigurationError(parameter);
} else {
value = configuration[parameter];
checked_value = JsSIP.UA.configuration_check.mandatory[parameter](value);
if (checked_value !== undefined) {
settings[parameter] = checked_value;
} else {
console.error('Bad configuration parameter ' + parameter + ' with value ' + window.JSON.stringify(value));
console.error(JsSIP.C.LOG_UA + 'Bad configuration parameter ' + parameter + ' with value ' + window.JSON.stringify(value));
throw new JsSIP.Exceptions.ConfigurationError(parameter, value);
}
}
@@ -680,7 +680,7 @@ JsSIP.UA.prototype.loadConfig = function(configuration) {
if (checked_value !== undefined) {
settings[parameter] = checked_value;
} else {
console.error('Bad configuration parameter ' + parameter + ' with value ' + window.JSON.stringify(value));
console.error(JsSIP.C.LOG_UA + 'Bad configuration parameter ' + parameter + ' with value ' + window.JSON.stringify(value));
throw new JsSIP.Exceptions.ConfigurationError(parameter, value);
}
}
@@ -690,7 +690,7 @@ JsSIP.UA.prototype.loadConfig = function(configuration) {

// Connection recovery intervals
if(settings.connection_recovery_max_interval < settings.connection_recovery_min_interval) {
console.error('"connection_recovery_max_interval" value is lower than "connection_recovery_min_interval"');
console.error(JsSIP.C.LOG_UA + '"connection_recovery_max_interval" value is lower than "connection_recovery_min_interval"');
throw new JsSIP.Exceptions.ConfigurationError('connection_recovery_max_interval', settings.connection_recovery_max_interval);
}

@@ -15,7 +15,7 @@ JsSIP.URI = function(scheme, user, host, port, parameters, headers) {

// Checks
if(!host) {
console.warn('Missing "host" in URI');
console.warn(JsSIP.C.LOG_URI + 'Missing "host" in URI');
throw new JsSIP.Exceptions.InvalidValueError('host', host);
}

@@ -134,7 +134,7 @@ JsSIP.URI.prototype = {
uri = '';

if(!this.host) {
console.warn(JsSIP.C.LOG_UA +'No domain specified');
console.warn(JsSIP.C.LOG_URI +'No domain specified');
return;
}

@@ -37,7 +37,7 @@ JsSIP.Utils= {
}

if (uri.indexOf('@') === -1) {
console.log('Invalid uri. Missing uri domain.');
console.log(JsSIP.C.LOG_UTILS + 'Invalid URI. Missing URI domain.');
return;
}

@@ -72,12 +72,12 @@ JsSIP.Utils= {
uri = JsSIP.grammar.parse(target, 'lazy_uri');

if (uri === -1) {
console.log('Invalid target: '+ target);
console.log(JsSIP.C.LOG_UTILS + 'Invalid target: '+ target);
return;
}

if (!uri.host && !domain) {
console.log('No domain specified in target nor as function parameter');
console.log(JsSIP.C.LOG_UTILS + 'No domain specified in target nor as function parameter');
return;
}

1 comment on commit 537d2f2

@ibc

This comment has been minimized.

Copy link
Member Author

ibc commented on 537d2f2 Feb 5, 2013

NOTE: still there are some console.warn(e) (being e an exception). Should we also apply the JsSIP class/prefix module in those cases? this is:

console.warn(JsSIP.C.LOG_XXXX + e)
Please sign in to comment.
You can’t perform that action at this time.