fix: update register status with sid

This commit is contained in:
Quan HL
2023-04-02 22:36:44 +07:00
parent adddf8b868
commit b817e1b95e
+4 -4
View File
@@ -92,20 +92,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({ updateVoipCarriersRegisterStatus(this.voip_carrier_sid, {
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')
}, this.voip_carrier_sid); });
}); });
} 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({ updateVoipCarriersRegisterStatus(this.voip_carrier_sid, {
status: 'fail', status: 'fail',
reason: err reason: err
}, this.voip_carrier_sid); });
} }
} }