fix: update register status with sid

This commit is contained in:
Quan HL
2023-04-02 22:46:57 +07:00
parent f120d3aa0f
commit b06911675f
+4 -4
View File
@@ -93,20 +93,20 @@ class Regbot {
debug(`setting timer for next register to ${expires} seconds`); debug(`setting timer for next register to ${expires} seconds`);
this.timer = setTimeout(this.register.bind(this, srf), (expires - 5) * 1000); this.timer = setTimeout(this.register.bind(this, srf), (expires - 5) * 1000);
} }
updateVoipCarriersRegisterStatus(this.voip_carrier_sid, { updateVoipCarriersRegisterStatus(this.voip_carrier_sid, JSON.stringify({
status: res.status === 200 ? 'ok' : 'fail', status: res.status === 200 ? 'ok' : 'fail',
reason: `${res.status} ${res.reason}`, reason: `${res.status} ${res.reason}`,
cseq: req.get('Cseq'), cseq: req.get('Cseq'),
callId: req.get('Call-Id') callId: req.get('Call-Id')
}); }));
}); });
} catch (err) { } catch (err) {
this.logger.error({ err }, `Regbot Error registering to ${this.ipv4}:${this.port}`); this.logger.error({ err }, `Regbot Error registering to ${this.ipv4}:${this.port}`);
this.timer = setTimeout(this.register.bind(this, srf), 60 * 1000); this.timer = setTimeout(this.register.bind(this, srf), 60 * 1000);
updateVoipCarriersRegisterStatus(this.voip_carrier_sid, { updateVoipCarriersRegisterStatus(this.voip_carrier_sid, JSON.stringify({
status: 'fail', status: 'fail',
reason: err reason: err
}); }));
} }
} }