mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2026-07-04 19:32:04 +00:00
@@ -1231,6 +1231,22 @@ Duration=${payload.duration} `
|
|||||||
this.activeCallIds.delete(this.req.get('Call-ID'));
|
this.activeCallIds.delete(this.req.get('Call-ID'));
|
||||||
if (this.activeCallIds.size === 0) this.idleEmitter.emit('idle');
|
if (this.activeCallIds.size === 0) this.idleEmitter.emit('idle');
|
||||||
uac.other.destroy();
|
uac.other.destroy();
|
||||||
|
if (this.req.locals.cdr) {
|
||||||
|
const now = Date.now();
|
||||||
|
const day = new Date();
|
||||||
|
const recordAllCalls = this.req.locals.record_all_calls;
|
||||||
|
let recording_url = `/Accounts/${this.account_sid}/RecentCalls/${this.req.locals.cdr.call_sid}/record`;
|
||||||
|
recording_url += `/${day.getFullYear()}/${(day.getMonth() + 1).toString().padStart(2, '0')}`;
|
||||||
|
recording_url += `/${day.getDate().toString().padStart(2, '0')}/${recordAllCalls}`;
|
||||||
|
this.writeCdrs({...this.req.locals.cdr,
|
||||||
|
terminated_at: now,
|
||||||
|
termination_reason: 'caller hungup',
|
||||||
|
sip_status: 200,
|
||||||
|
answered: true,
|
||||||
|
duration: Math.floor((now - this.req.locals.cdr.answered_at) / 1000),
|
||||||
|
...(recordAllCalls && {recording_url})
|
||||||
|
}).catch((err) => this.logger.error({err}, 'Error writing cdr for completed call'));
|
||||||
|
}
|
||||||
this.srf.endSession(this.req);
|
this.srf.endSession(this.req);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user