mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-07-06 04:01:54 +00:00
e35a03c7ad
* feat: schema change * feat: record all calls * add bucket test for S3 * wip: add S3 upload stream implementation * wip * wip: add ws server * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip: modify sub folder * wip: add record endpoint * wip: add record endpoint * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix: failing testcase * bucket credentials with tags * add tagging * wip * wip * wip * wip * wip * wip * fixed phone number is not in order * feat: schema change * feat: record all calls * add bucket test for S3 * wip: add S3 upload stream implementation * wip * wip: add ws server * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip: modify sub folder * wip: add record endpoint * wip: add record endpoint * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix: failing testcase * bucket credentials with tags * add tagging * wip * wip * wip * wip * wip * fixed phone number is not in order * add schema changes to upgrade script * use aws-sdk v3 * jambonz lamejs * jambonz lamejs * add back wav encoder * wip: add record format to schema * add record_format * fix: record file ext * fix: record file ext * fix: record file ext * fix: record file ext * fix download audio * bug fix: dtmf metadata is causing closure of websocket * fix: add extra data to S3 metadata * upgrade db script * bugfix: region was being ignored in test s3 upload --------- Co-authored-by: Dave Horton <daveh@beachdognet.com>
43 lines
934 B
JavaScript
43 lines
934 B
JavaScript
const { S3Client, PutObjectCommand, GetObjectCommand } = require('@aws-sdk/client-s3');
|
|
|
|
async function testAwsS3(logger, opts) {
|
|
const s3 = new S3Client({
|
|
credentials: {
|
|
accessKeyId: opts.access_key_id,
|
|
secretAccessKey: opts.secret_access_key,
|
|
},
|
|
region: opts.region || 'us-east-1'
|
|
});
|
|
|
|
const input = {
|
|
'Body': 'Hello From Jambonz',
|
|
'Bucket': opts.name,
|
|
'Key': 'jambonz-sample.text'
|
|
};
|
|
|
|
const command = new PutObjectCommand(input);
|
|
|
|
await s3.send(command);
|
|
}
|
|
|
|
async function getS3Object(logger, opts) {
|
|
const s3 = new S3Client({
|
|
credentials: {
|
|
accessKeyId: opts.access_key_id,
|
|
secretAccessKey: opts.secret_access_key,
|
|
},
|
|
region: opts.region || 'us-east-1'
|
|
});
|
|
const command = new GetObjectCommand({
|
|
Bucket: opts.name,
|
|
Key: opts.key
|
|
});
|
|
const res = await s3.send(command);
|
|
return res.Body;
|
|
}
|
|
|
|
module.exports = {
|
|
testAwsS3,
|
|
getS3Object
|
|
};
|