Compare commits

...

4 Commits

Author SHA1 Message Date
Markus Frindt
f5058d8f4b Merge 8473b20941 into 48e1a72ef3 2024-06-17 09:49:25 +02:00
Hoan Luu Huu
48e1a72ef3 support use sips scheme for outbound tls gateway (#332)
* support use sips scheme for outbound tls gateway

* support use sips scheme for outbound tls gateway

* update license
2024-06-15 09:17:05 -04:00
Hoan Luu Huu
4337a55a27 update getAwsAuthToken to use parameters as object (#330)
* update getAwsAuthToken to use parameters as object

* update speech utils version
2024-06-15 08:10:58 -04:00
Markus Frindt
8473b20941 Reject old JWT tokens 2024-03-07 08:18:25 +01:00
9 changed files with 67 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Drachtio Communications Services, LLC
Copyright (c) 2018-2024 FirstFive8, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -459,6 +459,7 @@ outbound BOOLEAN NOT NULL COMMENT 'if true, include in least-cost routing when p
voip_carrier_sid CHAR(36) NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT 1,
send_options_ping BOOLEAN NOT NULL DEFAULT 0,
use_sips_scheme BOOLEAN NOT NULL DEFAULT 0,
pad_crypto BOOLEAN NOT NULL DEFAULT 0,
protocol ENUM('udp','tcp','tls', 'tls/srtp') DEFAULT 'udp' COMMENT 'Outbound call protocol',
PRIMARY KEY (sip_gateway_sid)

View File

@@ -2332,7 +2332,7 @@
</location>
<size>
<width>281.00</width>
<height>260.00</height>
<height>280.00</height>
</size>
<zorder>7</zorder>
<SQLField>
@@ -2406,6 +2406,13 @@
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[E04C19A2-12BF-443F-AB61-96990224A18D]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[use_sips_scheme]]></name>
<type><![CDATA[BOOLEAN]]></type>
<defaultValue><![CDATA[0]]></defaultValue>
<notNull><![CDATA[1]]></notNull>
<uid><![CDATA[5DCBDD48-913B-4580-B78C-9B06C939FEA8]]></uid>
</SQLField>
<SQLField>
<name><![CDATA[pad_crypto]]></name>
<type><![CDATA[BOOLEAN]]></type>
@@ -3111,11 +3118,11 @@
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
<uid><![CDATA[58C99A00-06C9-478C-A667-C63842E088F3]]></uid>
<windowHeight><![CDATA[1027.000000]]></windowHeight>
<windowLocationX><![CDATA[1728.000000]]></windowLocationX>
<windowLocationY><![CDATA[65.000000]]></windowLocationY>
<windowHeight><![CDATA[1079.000000]]></windowHeight>
<windowLocationX><![CDATA[0.000000]]></windowLocationX>
<windowLocationY><![CDATA[0.000000]]></windowLocationY>
<windowScrollOrigin><![CDATA[{1, 0}]]></windowScrollOrigin>
<windowWidth><![CDATA[1675.000000]]></windowWidth>
<windowWidth><![CDATA[1676.000000]]></windowWidth>
</SQLDocumentInfo>
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>

View File

@@ -196,6 +196,7 @@ const sql = {
'ALTER TABLE sip_gateways ADD COLUMN send_options_ping BOOLEAN NOT NULL DEFAULT 0',
'ALTER TABLE applications MODIFY COLUMN speech_synthesis_voice VARCHAR(256)',
'ALTER TABLE applications MODIFY COLUMN fallback_speech_synthesis_voice VARCHAR(256)',
'ALTER TABLE sip_gateways ADD COLUMN use_sips_scheme BOOLEAN NOT NULL DEFAULT 0',
]
};

View File

@@ -31,6 +31,11 @@ function makeStrategy(logger) {
logger.info('jwt invalidated after logout');
return done(null, false);
}
/* Reject the request if we receive an old token */
if (result !== token) {
logger.info('jwt was invalidated after login by another session');
return done(null, false);
}
} catch (error) {
debug(err);
logger.info({err}, 'Error checking redis for jwt');

View File

@@ -183,7 +183,10 @@ const testAwsStt = async(logger, getAwsAuthToken, credentials) => {
} else if (roleArn) {
client = new TranscribeClient({
region,
credentials: await getAwsAuthToken(null, null, region, roleArn),
credentials: await getAwsAuthToken({
region,
roleArn
}),
});
} else {
client = new TranscribeClient({region});

8
package-lock.json generated
View File

@@ -19,7 +19,7 @@
"@jambonz/lamejs": "^1.2.2",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.9",
"@jambonz/speech-utils": "^0.1.3",
"@jambonz/speech-utils": "^0.1.11",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.72",
"@soniox/soniox-node": "^1.2.2",
@@ -2027,9 +2027,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.3.tgz",
"integrity": "sha512-Ess3yc8XyJAoUvXFz9maLq4NgxkTkTgiN2uW3rgOFiRr7b6l9A3oNQrN/ZJCJc9Ge+I3CypFmcwCiLNehuqF/g==",
"version": "0.1.11",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.11.tgz",
"integrity": "sha512-VgljBLUF871adib/3yWpzd7kv26ioxiLVkAIxm94CSk9WeZuzX1lVcE2SohojW3mjCYdYY6+B8FRyzlTD+en3g==",
"dependencies": {
"@aws-sdk/client-polly": "^3.496.0",
"@aws-sdk/client-sts": "^3.496.0",

View File

@@ -29,7 +29,7 @@
"@jambonz/lamejs": "^1.2.2",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.9",
"@jambonz/speech-utils": "^0.1.3",
"@jambonz/speech-utils": "^0.1.11",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.72",
"@soniox/soniox-node": "^1.2.2",

View File

@@ -75,6 +75,44 @@ test('sip gateway tests', async(t) => {
});
//console.log(`result: ${JSON.stringify(result)}`);
t.ok(result.statusCode === 204, 'successfully deleted sip gateway');
/* add a sip gateway */
result = await request.post('/SipGateways', {
resolveWithFullResponse: true,
auth: authAdmin,
json: true,
body: {
voip_carrier_sid,
ipv4: '192.168.1.2',
netmask: 32,
inbound: true,
outbound: true,
protocol: 'tls',
use_sips_scheme: true
}
});
t.ok(result.statusCode === 201, 'successfully created sip gateway ');
const sipsSid = result.body.sid;
/* query one sip gateway */
result = await request.get(`/SipGateways/${sipsSid}`, {
auth: authAdmin,
json: true,
});
//console.log(`result: ${JSON.stringify(result)}`);
t.ok(result.ipv4 === '192.168.1.2' , 'successfully retrieved voip carrier by sid');
t.ok(result.protocol === 'tls' , 'successfully retrieved voip carrier by sid');
t.ok(result.use_sips_scheme, 'successfully retrieved voip carrier by sid');
/* delete sip gateways */
result = await request.delete(`/SipGateways/${sipsSid}`, {
resolveWithFullResponse: true,
simple: false,
json: true,
auth: authAdmin
});
//console.log(`result: ${JSON.stringify(result)}`);
t.ok(result.statusCode === 204, 'successfully deleted sip gateway');
await deleteObjectBySid(request, '/VoipCarriers', voip_carrier_sid);