fix: update register status with sid

This commit is contained in:
Quan HL
2023-04-02 22:33:03 +07:00
parent 9322c34f4d
commit adddf8b868

View File

@@ -19,6 +19,7 @@ class Regbot {
['ipv4', 'port', 'username', 'password', 'sip_realm'].forEach((prop) => this[prop] = opts[prop]);
logger.debug({ opts }, 'Regbot');
this.voip_carrier_sid = opts.voip_carrier_sid;
this.username = opts.username;
this.password = opts.password;
this.sip_realm = opts.sip_realm || opts.ipv4;
@@ -96,7 +97,7 @@ class Regbot {
reason: `${res.status} ${res.reason}`,
cseq: req.get('Cseq'),
callId: req.get('Call-Id')
});
}, this.voip_carrier_sid);
});
} catch (err) {
this.logger.error({ err }, `Regbot Error registering to ${this.ipv4}:${this.port}`);
@@ -104,7 +105,7 @@ class Regbot {
updateVoipCarriersRegisterStatus({
status: 'fail',
reason: err
});
}, this.voip_carrier_sid);
}
}
@@ -250,6 +251,7 @@ const updateCarrierRegbots = async(logger, srf) => {
// start new regbots
for (const gw of gateways) {
const rb = new Regbot(logger, {
voip_carrier_sid: gw.carrier.voip_carrier_sid,
ipv4: gw.ipv4,
port: gw.port,
username: gw.carrier.register_username,