Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Commit

Permalink
Release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lwarneminde committed Jan 5, 2023
1 parent 079c3a7 commit 556a5ec
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
dist/.DS_Store
.gradle/*
build/
# Due to VSCode Java plugin; see https://github.com/redhat-developer/vscode-java/issues/634
bin/

# misc
.DS_Store
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [1.0.2] - 2022-01-05
### Changed
- TranscriptionRequest.java - remove unused imports
- KVSByteToAudioEventSubscription.java - remove unused logger & imports
- KVSContactTagProcessor.java - remove unused import; fix log formatting
- KVSUtils.java - suppress compiler warning
- kvs_transcribe_streaming_lambda.zip - update with latest changes
- build.gradle - change 'compile' to 'implementation', remove jars location as directory no longer used, distribute to correct zip file name
- README.md - Building instructions
- .gitignore - Ignore /bin directory used by VS Code

## [1.0.1] - 2022-01-27
### Added
- Lambda zip files restored in deployment/* folder
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Getting started with this project is easy. The most basic use case of capturing
- Create an S3 bucket and create a new folder “deployment” and upload the deployment/ folder into it
- Open the `cloudformation.template` file and copy the S3 url on it's detail page
- Go to CloudFormation and select 'Create Stack'.
- Create the stack from an S3 url and paste the url from the cloudformation.yaml file
- Create the stack from an S3 url and paste the url from the cloudformation.template file
- Fill in the parameters for the stack. The existingS3BucketName and existingS3Path should be the ones created above that contain all the deployment related code.
![](images/cloud-formation-stack-parameters.png)
- While the stack is building, go to the Amazon Connect AWS console and ensure that your Amazon Connect instance has the "live media streaming" feature enabled by following the [Amazon Connect documentation](https://docs.aws.amazon.com/connect/latest/userguide/customer-voice-streams.html) for "Enable Live Media Streaming"
Expand All @@ -70,7 +70,7 @@ Getting started with this project is easy. The most basic use case of capturing
![](images/connect-configure-phone-number.png)

### Building the KVS Transcriber project
The lambda code is designed to be built with Gradle. All requisite dependencies are captured in the `build.gradle` file. The code also depends on the [AWS Kinesis Video Streams Parser Library](https://github.com/aws/amazon-kinesis-video-streams-parser-library) which has been built into a jar can be found in the jars folder. Simply use `gradle build` to build the zip that can be deployed as an AWS Lambda application. After running `gradle build`, the updated zip file can be found in the `build/distributions` folder
The lambda code is designed to be built with Gradle. All requisite dependencies are captured in the `build.gradle` file. Simply use `gradle build` to build the zip that can be deployed as an AWS Lambda application. After running `gradle build`, the updated zip file can be found in the `build/distributions` folder; copy it to the `deployment` folder then follow the Easy Setup steps above. Other files in the `deployment` folder are zip archives, each containing an individual file from the `functions` folder. The `layer.zip` file is produced by the Connect Audio Utils project; see the Audio Utils section below for further info.

### Lambda Environment Variables
This Lambda Function has environment variables that control its behavior:
Expand Down Expand Up @@ -117,7 +117,7 @@ The following is a sample invocation event:
```
## Audio Utils
This solution uses the Connect Audio Utils project for combining audio files. For details on the building Connect Audio Utils see this link.
[Amazon Connect Audio Utils] https://github.com/amazon-connect/amazon-connect-audio-utils
[Amazon Connect Audio Utils](https://github.com/amazon-connect/amazon-connect-audio-utils)
## License Summary
This sample code is made available under a modified MIT license. See the LICENSE file.

8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ repositories {
}

dependencies {
compile fileTree(dir: 'jars', include: '*.jar')
compile group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.2'
compile group: 'com.amazonaws', name: 'amazon-kinesis-video-streams-parser-library', version: '1.2.1'
compile(
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.2'
implementation group: 'com.amazonaws', name: 'amazon-kinesis-video-streams-parser-library', version: '1.2.1'
implementation(
'software.amazon.awssdk:transcribestreaming:2.16.30',

'com.amazonaws:aws-java-sdk-dynamodb:1.11.987',
Expand All @@ -33,6 +32,7 @@ dependencies {
}

task buildZip(type: Zip) {
archiveBaseName = 'kvs_transcribe_streaming_lambda'
from compileJava
from processResources

Expand Down
Binary file modified deployment/kvs_transcribe_streaming_lambda.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.amazonaws.kinesisvideo.parser.utilities.FragmentMetadata;
import com.amazonaws.kinesisvideo.parser.utilities.FragmentMetadataVisitor;
import com.amazonaws.kinesisvideo.parser.utilities.MkvTag;
import com.amazonaws.transcribestreaming.KVSByteToAudioEventSubscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -31,9 +30,9 @@ public void process(MkvTag mkvTag, Optional<FragmentMetadata> currentFragmentMet
sameContact = true;
}
else {
logger.info("Contact Id in tag does not match expected, will stop streaming. "
logger.info(String.format("Contact Id in tag does not match expected, will stop streaming. "
+ "contact id: %s, expected: %s",
mkvTag.getTagValue(), contactId);
mkvTag.getTagValue(), contactId));
sameContact = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public static ByteBuffer getByteBufferFromStream(StreamingMkvReader streamingMkv
mkvElement.accept(fragmentVisitor);
if (MkvTypeInfos.SIMPLEBLOCK.equals(mkvElement.getElementMetaData().getTypeInfo())) {
MkvDataElement dataElement = (MkvDataElement) mkvElement;
@SuppressWarnings("unchecked")
Frame frame = ((MkvValue<Frame>) dataElement.getValueCopy()).getVal();
ByteBuffer audioBuffer = frame.getFrameData();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.services.transcribestreaming.model.LanguageCode;

public class TranscriptionRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.apache.commons.lang3.Validate;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.transcribestreaming.model.AudioEvent;
import software.amazon.awssdk.services.transcribestreaming.model.AudioStream;
Expand Down Expand Up @@ -41,8 +39,6 @@
*/
public class KVSByteToAudioEventSubscription implements Subscription {

private static final Logger logger = LoggerFactory.getLogger(KVSByteToAudioEventSubscription.class);

private static final int CHUNK_SIZE_IN_KB = 4;
private ExecutorService executor = Executors.newFixedThreadPool(1); // Change nThreads here!! used in SubmissionPublisher not subscription
private AtomicLong demand = new AtomicLong(0); // state container
Expand Down

0 comments on commit 556a5ec

Please sign in to comment.