mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 00:58:34 +00:00
wait for session:reconnect ack to send queued msgs (#723)
This commit is contained in:
@@ -113,11 +113,13 @@ class CallSession extends Emitter {
|
||||
this.requestor.on('command', this._onCommand.bind(this));
|
||||
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
|
||||
this.requestor.on('handover', handover.bind(this));
|
||||
this.requestor.on('reconnect-error', this._onSessionReconnectError.bind(this));
|
||||
};
|
||||
|
||||
this.requestor.on('command', this._onCommand.bind(this));
|
||||
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
|
||||
this.requestor.on('handover', handover.bind(this));
|
||||
this.requestor.on('reconnect-error', this._onSessionReconnectError.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1575,6 +1577,22 @@ Duration=${duration} `
|
||||
}, 'CallSession:_injectTasks - completed');
|
||||
}
|
||||
|
||||
async _onSessionReconnectError(err) {
|
||||
const {writeAlerts, AlertType} = this.srf.locals;
|
||||
const sid = this.accountInfo.account.account_sid;
|
||||
this.logger.info({err}, `_onSessionReconnectError for account ${sid}`);
|
||||
try {
|
||||
await writeAlerts({
|
||||
alert_type: AlertType.WEBHOOK_CONNECTION_FAILURE,
|
||||
account_sid: this.accountSid,
|
||||
detail: `Session:reconnect error ${err}`
|
||||
});
|
||||
} catch (error) {
|
||||
this.logger.error({error}, 'Error writing WEBHOOK_CONNECTION_FAILURE alert');
|
||||
}
|
||||
this._jambonzHangup();
|
||||
}
|
||||
|
||||
_onCommand({msgid, command, call_sid, queueCommand, data}) {
|
||||
this.logger.info({msgid, command, queueCommand, data}, 'CallSession:_onCommand - received command');
|
||||
let resolution;
|
||||
|
||||
Reference in New Issue
Block a user