mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-03-28 19:09:35 +00:00
Compare commits
5 Commits
fix/missin
...
feat/decli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8eaefd77b2 | ||
|
|
df30496dac | ||
|
|
e7aa0968b4 | ||
|
|
1c724c00ee | ||
|
|
18c38ce970 |
@@ -28,7 +28,6 @@ module.exports = function(srf, logger) {
|
||||
registrar,
|
||||
lookupClientByAccountAndUsername
|
||||
} = srf.locals.dbHelpers;
|
||||
const {addKey} = srf.locals.dbHelpers;
|
||||
const {
|
||||
writeAlerts,
|
||||
AlertType
|
||||
@@ -143,14 +142,6 @@ module.exports = function(srf, logger) {
|
||||
rootSpan
|
||||
};
|
||||
|
||||
/* write a short-lived Redis key mapping the original Call-ID (X-CID) to the traceId,
|
||||
so sbc-inbound can look it up for CDRs even when a CANCEL is sent to sbc-inbound */
|
||||
const externalCallId = req.get('X-CID');
|
||||
if (externalCallId) {
|
||||
addKey(`callid:${externalCallId}`, traceId, 300)
|
||||
.catch((err) => logger.error(err, 'createRootSpan: error writing traceId to Redis'));
|
||||
}
|
||||
|
||||
/**
|
||||
* end the span on final failure or cancel from caller;
|
||||
* otherwise it will be closed when sip dialog is destroyed
|
||||
|
||||
@@ -1488,12 +1488,7 @@ class CallSession extends Emitter {
|
||||
else if (opts.call_status === CallStatus.NoAnswer) {
|
||||
if (this.direction === CallDirection.Inbound) {
|
||||
if (this.res && !this.res.finalResponseSent) {
|
||||
const traceId = this.req?.locals?.traceId;
|
||||
this.res.send(503, {
|
||||
headers: {
|
||||
...(traceId && {'X-Trace-ID': traceId})
|
||||
}
|
||||
});
|
||||
this.res.send(503);
|
||||
this._callReleased();
|
||||
}
|
||||
}
|
||||
@@ -2481,7 +2476,7 @@ Duration=${duration} `
|
||||
this.logger.info(`allocated endpoint ${ep.uuid}`);
|
||||
|
||||
this.ep.on('destroy', () => {
|
||||
this.logger.debug(`endpoint was destroyed!! ${this.ep.uuid}`);
|
||||
this.logger.debug(`endpoint was destroyed!! ${this.ep?.uuid}`);
|
||||
});
|
||||
|
||||
if (this.direction === CallDirection.Inbound || this.application?.transferredCall) {
|
||||
@@ -2526,12 +2521,10 @@ Duration=${duration} `
|
||||
// Send SIP error response immediately for inbound calls
|
||||
if (this.res && !this.res.finalResponseSent) {
|
||||
this.logger.info(`Sending ${err.status} response to SBC due to SipError`);
|
||||
const traceId = this.req?.locals?.traceId;
|
||||
this.res.send(err.status, {
|
||||
headers: {
|
||||
'X-Reason': `endpoint allocation failure: ${err.reason || 'Endpoint Allocation Failed'}`,
|
||||
...(sipReasonHeader && {'Reason': sipReasonHeader}),
|
||||
...(traceId && {'X-Trace-ID': traceId})
|
||||
...(sipReasonHeader && {'Reason': sipReasonHeader})
|
||||
}
|
||||
});
|
||||
this._notifyCallStatusChange({
|
||||
|
||||
@@ -51,14 +51,12 @@ class InboundCallSession extends CallSession {
|
||||
|
||||
_onTasksDone() {
|
||||
if (!this.res.finalResponseSent) {
|
||||
const traceId = this.req.locals.traceId;
|
||||
if (this._mediaServerFailure) {
|
||||
this.rootSpan.setAttributes({'call.termination': 'media server failure'});
|
||||
this.logger.info('InboundCallSession:_onTasksDone generating 480 due to media server failure');
|
||||
this.res.send(480, {
|
||||
headers: {
|
||||
'X-Reason': 'crankback: media server failure',
|
||||
...(traceId && {'X-Trace-ID': traceId})
|
||||
'X-Reason': 'crankback: media server failure'
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -71,19 +69,14 @@ class InboundCallSession extends CallSession {
|
||||
this.res.send(status, {
|
||||
headers: {
|
||||
'X-Reason': `endpoint allocation failure: ${reason}`,
|
||||
...(sipReasonHeader && {'Reason': sipReasonHeader}),
|
||||
...(traceId && {'X-Trace-ID': traceId})
|
||||
...(sipReasonHeader && {'Reason': sipReasonHeader})
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.rootSpan.setAttributes({'call.termination': 'tasks completed without answering call'});
|
||||
this.logger.info('InboundCallSession:_onTasksDone auto-generating non-success response to invite');
|
||||
this.res.send(603, {
|
||||
headers: {
|
||||
...(traceId && {'X-Trace-ID': traceId})
|
||||
}
|
||||
});
|
||||
this.res.send(603);
|
||||
}
|
||||
}
|
||||
this.req.removeAllListeners('cancel');
|
||||
|
||||
@@ -17,7 +17,7 @@ class TaskSipDecline extends Task {
|
||||
async exec(cs, {res}) {
|
||||
super.exec(cs);
|
||||
res.send(this.data.status, this.data.reason, {
|
||||
headers: this.headers
|
||||
headers: {'X-Reason': 'SIP Decline Verb', ...this.headers}
|
||||
}, (err) => {
|
||||
if (!err) {
|
||||
// Call was successfully declined
|
||||
|
||||
Reference in New Issue
Block a user