mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2025-12-18 20:27:43 +00:00
allow uas leg can send re-invite with outbound gatway credential (#221)
* allow uas leg can send re-invite with outbound gatway credential * fix cannot get register username/password * fix cannot get register username/password * fix cannot get register username/password * fixed failing test cases
This commit is contained in:
@@ -332,6 +332,15 @@ class CallSession extends Emitter {
|
||||
},
|
||||
});
|
||||
|
||||
// passing gateway outbound auth that sbc-inbound can send RE-INVITE with authentication process on UAS side
|
||||
const {gateway} = this.req.locals;
|
||||
if (gateway && gateway.register_username && gateway.register_password) {
|
||||
this.logger.debug('passing outbound gateway auth to CallSession for reinvite processing');
|
||||
uas.auth = {
|
||||
username: gateway.register_username,
|
||||
password: gateway.register_password
|
||||
};
|
||||
}
|
||||
// successfully connected
|
||||
this.logger.info('call connected successfully to feature server');
|
||||
debug('call connected successfully to feature server');
|
||||
|
||||
@@ -7,7 +7,8 @@ const sqlSelectSPForAccount = 'SELECT service_provider_sid FROM accounts WHERE a
|
||||
|
||||
const sqlSelectAllCarriersForAccountByRealm =
|
||||
`SELECT sg.sip_gateway_sid, sg.voip_carrier_sid, vc.name, vc.account_sid,
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto,
|
||||
vc.register_username, vc.register_password
|
||||
FROM sip_gateways sg, voip_carriers vc, accounts acc
|
||||
WHERE acc.sip_realm = ?
|
||||
AND vc.account_sid = acc.account_sid
|
||||
@@ -17,7 +18,8 @@ AND sg.voip_carrier_sid = vc.voip_carrier_sid`;
|
||||
|
||||
const sqlSelectAllCarriersForSPByRealm =
|
||||
`SELECT sg.sip_gateway_sid, sg.voip_carrier_sid, vc.name, vc.account_sid,
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto,
|
||||
vc.register_username, vc.register_password
|
||||
FROM sip_gateways sg, voip_carriers vc, accounts acc
|
||||
WHERE acc.sip_realm = ?
|
||||
AND vc.service_provider_sid = acc.service_provider_sid
|
||||
@@ -28,7 +30,8 @@ AND sg.voip_carrier_sid = vc.voip_carrier_sid`;
|
||||
|
||||
const sqlSelectAllGatewaysForSP =
|
||||
`SELECT sg.sip_gateway_sid, sg.voip_carrier_sid, vc.name, vc.service_provider_sid,
|
||||
vc.account_sid, vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto
|
||||
vc.account_sid, vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto,
|
||||
vc.register_username, vc.register_password
|
||||
FROM sip_gateways sg, voip_carriers vc
|
||||
WHERE sg.voip_carrier_sid = vc.voip_carrier_sid
|
||||
AND vc.service_provider_sid IS NOT NULL
|
||||
@@ -57,7 +60,8 @@ AND outbound = 1`;
|
||||
|
||||
const sqlSelectCarrierRequiringRegistration = `
|
||||
SELECT sg.sip_gateway_sid, sg.voip_carrier_sid, vc.name, vc.service_provider_sid, vc.account_sid,
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto
|
||||
vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto,
|
||||
vc.register_username, vc.register_password
|
||||
FROM sip_gateways sg, voip_carriers vc
|
||||
WHERE sg.voip_carrier_sid = vc.voip_carrier_sid
|
||||
AND vc.requires_register = 1
|
||||
@@ -77,7 +81,8 @@ AND (
|
||||
|
||||
const sqlSelectGatewaysByVoipCarrierSids = `
|
||||
SELECT sg.sip_gateway_sid, sg.voip_carrier_sid, vc.name, vc.service_provider_sid,
|
||||
vc.account_sid, vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto
|
||||
vc.account_sid, vc.application_sid, sg.inbound, sg.outbound, sg.is_active, sg.ipv4, sg.netmask, sg.pad_crypto,
|
||||
vc.register_username, vc.register_password
|
||||
FROM sip_gateways sg, voip_carriers vc
|
||||
WHERE sg.voip_carrier_sid IN (?)
|
||||
AND sg.voip_carrier_sid = vc.voip_carrier_sid
|
||||
@@ -305,7 +310,9 @@ module.exports = (srf, logger) => {
|
||||
name: gw.name,
|
||||
service_provider_sid: gw.service_provider_sid,
|
||||
account_sid: gw.account_sid,
|
||||
application_sid: gw.application_sid
|
||||
application_sid: gw.application_sid,
|
||||
register_username: gw.register_username,
|
||||
register_password: gw.register_password
|
||||
};
|
||||
});
|
||||
/* remove duplicates, winnow down to voip_carriers, not gateways */
|
||||
@@ -326,7 +333,8 @@ module.exports = (srf, logger) => {
|
||||
service_provider_sid: gw.service_provider_sid,
|
||||
account_sid: gw.account_sid,
|
||||
application_sid: gw.application_sid,
|
||||
pad_crypto: gw.pad_crypto
|
||||
register_username: gw.register_username,
|
||||
register_password: gw.register_password
|
||||
};
|
||||
});
|
||||
/* remove duplicates */
|
||||
@@ -459,7 +467,9 @@ module.exports = (srf, logger) => {
|
||||
service_provider_sid: gw.service_provider_sid,
|
||||
account_sid: gw.account_sid,
|
||||
application_sid: gw.application_sid,
|
||||
pad_crypto: gw.pad_crypto
|
||||
pad_crypto: gw.pad_crypto,
|
||||
register_username: gw.register_username,
|
||||
register_password: gw.register_password
|
||||
};
|
||||
});
|
||||
/* remove duplicates, winnow down to voip_carriers, not gateways */
|
||||
@@ -479,7 +489,9 @@ module.exports = (srf, logger) => {
|
||||
service_provider_sid: gw.service_provider_sid,
|
||||
account_sid: gw.account_sid,
|
||||
application_sid: gw.application_sid,
|
||||
pad_crypto: gw.pad_crypto
|
||||
pad_crypto: gw.pad_crypto,
|
||||
register_username: gw.register_username,
|
||||
register_password: gw.register_password
|
||||
};
|
||||
});
|
||||
/* remove duplicates */
|
||||
|
||||
Reference in New Issue
Block a user