private Amazon.Connect.Model.StartOutboundVoiceContactResponse CallAWSServiceOperation(IAmazonConnect client, Amazon.Connect.Model.StartOutboundVoiceContactRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Connect Service", "StartOutboundVoiceContact"); try { #if DESKTOP return(client.StartOutboundVoiceContact(request)); #elif CORECLR return(client.StartOutboundVoiceContactAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Connect.Model.StartOutboundVoiceContactRequest(); // populate AnswerMachineDetectionConfig var requestAnswerMachineDetectionConfigIsNull = true; request.AnswerMachineDetectionConfig = new Amazon.Connect.Model.AnswerMachineDetectionConfig(); System.Boolean?requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_AwaitAnswerMachinePrompt = null; if (cmdletContext.AnswerMachineDetectionConfig_AwaitAnswerMachinePrompt != null) { requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_AwaitAnswerMachinePrompt = cmdletContext.AnswerMachineDetectionConfig_AwaitAnswerMachinePrompt.Value; } if (requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_AwaitAnswerMachinePrompt != null) { request.AnswerMachineDetectionConfig.AwaitAnswerMachinePrompt = requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_AwaitAnswerMachinePrompt.Value; requestAnswerMachineDetectionConfigIsNull = false; } System.Boolean?requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_EnableAnswerMachineDetection = null; if (cmdletContext.AnswerMachineDetectionConfig_EnableAnswerMachineDetection != null) { requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_EnableAnswerMachineDetection = cmdletContext.AnswerMachineDetectionConfig_EnableAnswerMachineDetection.Value; } if (requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_EnableAnswerMachineDetection != null) { request.AnswerMachineDetectionConfig.EnableAnswerMachineDetection = requestAnswerMachineDetectionConfig_answerMachineDetectionConfig_EnableAnswerMachineDetection.Value; requestAnswerMachineDetectionConfigIsNull = false; } // determine if request.AnswerMachineDetectionConfig should be set to null if (requestAnswerMachineDetectionConfigIsNull) { request.AnswerMachineDetectionConfig = null; } if (cmdletContext.Attribute != null) { request.Attributes = cmdletContext.Attribute; } if (cmdletContext.CampaignId != null) { request.CampaignId = cmdletContext.CampaignId; } if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.ContactFlowId != null) { request.ContactFlowId = cmdletContext.ContactFlowId; } if (cmdletContext.DestinationPhoneNumber != null) { request.DestinationPhoneNumber = cmdletContext.DestinationPhoneNumber; } if (cmdletContext.InstanceId != null) { request.InstanceId = cmdletContext.InstanceId; } if (cmdletContext.QueueId != null) { request.QueueId = cmdletContext.QueueId; } if (cmdletContext.SourcePhoneNumber != null) { request.SourcePhoneNumber = cmdletContext.SourcePhoneNumber; } if (cmdletContext.TrafficType != null) { request.TrafficType = cmdletContext.TrafficType; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }