Skip to content

Commit

Permalink
Merge pull request #36 from amazon-connect/release-5.17
Browse files Browse the repository at this point in the history
release 5.17
  • Loading branch information
kbk-amzn authored Nov 30, 2021
2 parents 7482a73 + c20d99d commit d95dfdc
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 19 deletions.
7 changes: 0 additions & 7 deletions sam-app/lambda_functions/sfContactTraceRecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ def create_ctr_record(ctr):
# Customer Data
if ctr['CustomerEndpoint']:
sf_request[objectnamespace + 'CustomerEndpointAddress__c'] = ctr['CustomerEndpoint']['Address']
if ctr['ContactDetails']:
sf_request[objectnamespace + 'ContactDetails__c'] = json.dumps(ctr['ContactDetails'])

sf_request[objectnamespace + 'InitiationTimestamp__c'] = ctr['InitiationTimestamp']
sf_request[objectnamespace + 'InitialContactId__c'] = ctr['InitialContactId']
Expand All @@ -103,7 +101,6 @@ def create_ctr_record(ctr):
sf_request[objectnamespace + 'LastUpdateTimestamp__c'] = ctr['LastUpdateTimestamp']
sf_request[objectnamespace + 'NextContactId__c'] = ctr['NextContactId']
sf_request[objectnamespace + 'PreviousContactId__c'] = ctr['PreviousContactId']
sf_request[objectnamespace + 'DisconnectReason__c'] = ctr['DisconnectReason']
sf_request[objectnamespace + 'DisconnectTimestamp__c'] = ctr['DisconnectTimestamp']

# Queue
Expand All @@ -120,10 +117,6 @@ def create_ctr_record(ctr):
sf_request[objectnamespace + 'RecordingStatus__c'] = ctr['Recording']['Status']
sf_request[objectnamespace + 'RecordingDeletionReason__c'] = ctr['Recording']['DeletionReason']

# Reference
if ctr['References']:
sf_request[objectnamespace + 'References__c'] = json.dumps(ctr['References'])

# System End Data
if ctr['SystemEndpoint']:
sf_request[objectnamespace + 'SystemEndpointAddress__c'] = ctr['SystemEndpoint']['Address']
Expand Down
10 changes: 5 additions & 5 deletions sam-app/lambda_functions/sfRealTimeQueueMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def ac_queue_metrics(queue_id_name_dict,queue_ids, instance_id):
current_metrics = [
{ 'Name': 'AGENTS_ONLINE', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_AVAILABLE', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_ON_CALL', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_ON_CONTACT', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_STAFFED', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_AFTER_CONTACT_WORK', 'Unit': 'COUNT' },
{ 'Name': 'AGENTS_NON_PRODUCTIVE', 'Unit': 'COUNT' },
Expand All @@ -114,15 +114,15 @@ def ac_queue_metrics(queue_id_name_dict,queue_ids, instance_id):
if next_token == 'NoToken':
logger.info("Call QueueMetric : without no token")
currentMetrics_data = connect.get_current_metric_data(InstanceId = instance_id,
Filters = {'Channels': ['VOICE'],'Queues': queue_ids},
Filters = {'Channels': ['VOICE', 'CHAT', 'TASK'], 'Queues': queue_ids},
Groupings = ['QUEUE'],
CurrentMetrics = current_metrics,
MaxResults = int(queuemetics_max_result)
)
else:
logger.info("Call QueueMetric : with token")
currentMetrics_data = connect.get_current_metric_data(InstanceId = instance_id,
Filters = {'Channels': ['VOICE'],'Queues': queue_ids},
Filters = {'Channels': ['VOICE', 'CHAT', 'TASK'], 'Queues': queue_ids},
Groupings = ['QUEUE'],
CurrentMetrics = current_metrics,
MaxResults = int(queuemetics_max_result),
Expand Down Expand Up @@ -183,7 +183,7 @@ def ac_queue_metrics(queue_id_name_dict,queue_ids, instance_id):
elif metric_data['Name'] == 'AGENTS_AVAILABLE' and 'Value' in metrics_data.keys() :
agent_available = int(metrics_data['Value'])
queue_metics_data_dict['agent_available'] = agent_available
elif metric_data['Name'] == 'AGENTS_ON_CALL' and 'Value' in metrics_data.keys() :
elif metric_data['Name'] == 'AGENTS_ON_CONTACT' and 'Value' in metrics_data.keys() :
agent_on_call = int(metrics_data['Value'])
queue_metics_data_dict['agent_on_call'] = agent_on_call
elif metric_data['Name'] == 'AGENTS_STAFFED' and 'Value' in metrics_data.keys() :
Expand Down Expand Up @@ -226,7 +226,7 @@ def prepare_record(queue_id_name_dict,queue_metric_data):
record['Name'] = queue_id_name_dict[queue_metric_data['queue_id']]
if 'queue_id' in queue_metric_data.keys():

if 'Queue_ARN__c' in queue_metric_data.keys():
if 'queue_arn' in queue_metric_data.keys():
record[objectnamespace + 'Queue_ARN__c'] = queue_metric_data['queue_arn']
else:
record[objectnamespace + 'Queue_ARN__c'] = ''
Expand Down
75 changes: 68 additions & 7 deletions sam-app/lambda_functions/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ Parameters:
AllowedPattern: (^$|^https(.*))
Type: String
SalesforceUsername:
Default: Salesforce API Username
Description: The username of a valid Salesforce API account for your environment.
Default: apiuser@<yoursalesforcedomain>.com
Description: The username of a valid Salesforce API account for your environment. Salesforce usernames are in the form of an email address.
For example, [email protected]
Type: String
AllowedPattern: ^.+@.+\..+$
SalesforceVersion:
Default: v42.0
Description: To find the Salesforce Edition and API Version please visit https://help.salesforce.com/articleView?id=000199268&type=1
Description: To find the Salesforce Edition and API Version please visit https://help.salesforce.com/articleView?id=000199268&type=1. The pattern for this field is vXX.X
Type: String
AllowedPattern: ^v[0-9]+\.[0-9]+$
ConnectReportingS3BucketName:
Default: ''
Description: This is the S3 bucket where Amazon Connect stores scheduled reports. Please refer to http://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-instance.html#datastorage
Expand Down Expand Up @@ -278,8 +280,8 @@ Resources:
PolicyDocument:
Statement:
- Action:
- kms:decrypt
- kms:generatedatakey
- kms:Decrypt
- kms:GenerateDataKey
Effect: Allow
Resource: !Ref SalesforceCredentialsKMSKeyARN
Version: '2012-10-17'
Expand Down Expand Up @@ -347,6 +349,7 @@ Resources:
- sts:AssumeRole
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- Fn::If:
- AmazonConnectInstanceIdHasValue
Expand Down Expand Up @@ -421,7 +424,7 @@ Resources:
- iam:CreateServiceLinkedRole
Effect: Allow
Resource:
Fn::Sub: arn:aws:iam::${AWS::AccountId}:role/aws-service-role/connect.amazonaws.com/*
Fn::Sub: arn:aws:iam::${AWS::AccountId}:role/aws-service-role/connect.amazonaws.com*
Version: '2012-10-17'
PolicyName: sfExecuteAWSServiceServiceLinkedRolePolicy
- Fn::If:
Expand Down Expand Up @@ -582,6 +585,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- PolicyDocument:
Statement:
Expand All @@ -607,6 +611,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- PolicyDocument:
Statement:
Expand All @@ -631,6 +636,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- PolicyDocument:
Statement:
Expand Down Expand Up @@ -681,6 +687,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- PolicyDocument:
Statement:
Expand Down Expand Up @@ -772,6 +779,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- Fn::If:
- CTREventSourceMappingCondition
Expand Down Expand Up @@ -813,6 +821,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- Fn::If:
- sfProcessTranscriptionResultS3PolicyCondition
Expand Down Expand Up @@ -860,6 +869,7 @@ Resources:
Path: /
ManagedPolicyArns:
- !Ref CloudWatchManagedPolicy
- !If [PrivateVpcEnabledCondition, !Ref VpcManagedPolicy, !Ref AWS::NoValue]
Policies:
- Fn::If:
- sfProcessContactLensResultS3PolicyCondition
Expand Down Expand Up @@ -1039,7 +1049,10 @@ Resources:
SALESFORCE_HOST:
Ref: SalesforceHost
SIG4_LAMBDA_ROLE_ARN:
Fn::GetAtt: sfSig4RequestToS3Role.Arn
Fn::If:
- PostcallRecordingImportEnabledCondition
- Fn::GetAtt: sfSig4RequestToS3Role.Arn
- !Ref AWS::NoValue

sfContactTraceRecord:
Type: AWS::Serverless::Function
Expand Down Expand Up @@ -1179,6 +1192,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfRealTimeQueueMetricsLoopJob.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfRealTimeQueueMetricsLoopJobRole.Arn
Layers:
Expand All @@ -1196,6 +1215,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfGenerateAudioRecordingStreamingURL.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfLambdaBasicExec.Arn
Layers:
Expand Down Expand Up @@ -1242,6 +1267,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfGetTranscribeJobStatus.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfGetTranscribeJobStatusRole.Arn
Layers:
Expand All @@ -1256,6 +1287,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfSubmitTranscribeJob.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfSubmitTranscribeJobRole.Arn
Layers:
Expand All @@ -1270,6 +1307,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfExecuteTranscriptionStateMachine.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfExecuteTranscriptionStateMachineRole.Arn
Layers:
Expand Down Expand Up @@ -1297,6 +1340,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfCTRTrigger.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfCTRTriggerRole.Arn
Layers:
Expand Down Expand Up @@ -1333,6 +1382,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfProcessTranscriptionResult.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfProcessTranscriptionResultRole.Arn
Layers:
Expand All @@ -1351,6 +1406,12 @@ Resources:
Type: AWS::Serverless::Function
Properties:
Handler: sfProcessContactLens.lambda_handler
VpcConfig:
!If
- PrivateVpcEnabledCondition
- SubnetIds: !Ref VpcSubnetList
SecurityGroupIds: !Ref VpcSecurityGroupList
- Ref: AWS::NoValue
Role:
Fn::GetAtt: sfProcessContactLensRole.Arn
Timeout: 60
Expand Down

0 comments on commit d95dfdc

Please sign in to comment.