mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
return 480 when failing due to no media server
This commit is contained in:
@@ -533,7 +533,10 @@ class CallSession extends Emitter {
|
||||
getMS() {
|
||||
if (!this.ms) {
|
||||
this.ms = this.srf.locals.getFreeswitch();
|
||||
if (!this.ms) throw new Error('no available freeswitch');
|
||||
if (!this.ms) {
|
||||
this._mediaServerFailure = true;
|
||||
throw new Error('no available freeswitch');
|
||||
}
|
||||
}
|
||||
return this.ms;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,18 @@ class InboundCallSession extends CallSession {
|
||||
|
||||
_onTasksDone() {
|
||||
if (!this.res.finalResponseSent) {
|
||||
this.logger.info('InboundCallSession:_onTasksDone auto-generating non-success response to invite');
|
||||
this.res.send(603);
|
||||
if (this._mediaServerFailure) {
|
||||
this.logger.info('InboundCallSession:_onTasksDone generating 480 due to media server failure');
|
||||
this.res.send(480, {
|
||||
headers: {
|
||||
'X-Reason': 'crankback: media server failure'
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.logger.info('InboundCallSession:_onTasksDone auto-generating non-success response to invite');
|
||||
this.res.send(603);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user