mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +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() {
|
getMS() {
|
||||||
if (!this.ms) {
|
if (!this.ms) {
|
||||||
this.ms = this.srf.locals.getFreeswitch();
|
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;
|
return this.ms;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,20 @@ class InboundCallSession extends CallSession {
|
|||||||
|
|
||||||
_onTasksDone() {
|
_onTasksDone() {
|
||||||
if (!this.res.finalResponseSent) {
|
if (!this.res.finalResponseSent) {
|
||||||
|
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.logger.info('InboundCallSession:_onTasksDone auto-generating non-success response to invite');
|
||||||
this.res.send(603);
|
this.res.send(603);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answer the call, if it has not already been answered.
|
* Answer the call, if it has not already been answered.
|
||||||
|
|||||||
Reference in New Issue
Block a user