Suggestion - Error event when SIP Server is down
Hey there!
We're trying to do something like a recovering system, which must be triggered when our SIP Server is down.
Currently, when we try to start() our User Agent, the last event being triggered is the "connecting". SIP debug messages, however, already shows that we have an error "ECONNREFUSED", since our SIP Server is down, so we were expecting an error event to be triggered - maybe the "disconnected" event.
What happens when SIP Server is up and running:


What happens when SIP Server is down:


Our code:
// SIP Event Handlers
sipUA.on('connecting', onConnecting);
sipUA.on('connected', onConnected);
sipUA.on('disconnected', onDisconnected);
sipUA.on('registered', onRegistered);
sipUA.on('unregistered', onUnregistered);
sipUA.on('registrationFailed', onRegistrationFailed);
sipUA.on('invite', onInvite);
sipUA.on('message', onMessage);
Logger.debug('[createSipUA] Added SIP event listeners to UA');
(...)
function onConnecting(args) {
Logger.debug('SIP UA connecting..');
}
function onConnected() {
Logger.debug('SIP UA connected');
registerSipUA();
}
function onDisconnected() {
Logger.fatal('SIP UA disconnected');
}
function onRegistered() {
Logger.info('SIP UA is probably registered now');
}
function onUnregistered(cause) {
Logger.warn('SIP UA was unregistered:\n\t' + cause);
}
function onRegistrationFailed(cause) {
Logger.fatal('SIP UA registration failed:\n\t' + cause);
}
Maybe related to #217 ?
Hrm. I would have expected that to have some sort of error event propagate up. I know this ticket is a little stale at this point (sorry!). Is the issue still happening? I'll see if I can't reproduce it.
Yeah, it's still happening! For now I'm using the workaround proposed on #217!
Related to this: the 0.11.0 release contains a major refactor to the transport code. Included in these changes is a transportError event that is emitted by the Transport. I'm going to close this for now, but if the behavior of the event isn't quite what you'd expected I think it'd be appropriate to just open a new discussion (seeing as this one is a few years old) or even a PR.