public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonConnectConfig config = new AmazonConnectConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonConnectClient client = new AmazonConnectClient(creds, config);

            ListInstancesResponse resp = new ListInstancesResponse();

            do
            {
                ListInstancesRequest req = new ListInstancesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListInstances(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.InstanceSummaryList)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Example #2
0
        public ActionResult InitOutboundCall(string number, string idContactFlow, string sourcePhoneNumber)
        {
            string accessKey           = WebConfigurationManager.AppSettings["AWSAccessKey"];
            string secretKey           = WebConfigurationManager.AppSettings["AWSSecretKey"];
            AmazonConnectClient client = new AmazonConnectClient(accessKey, secretKey, RegionEndpoint.USEast1);
            var request = new StartOutboundVoiceContactRequest
            {
                InstanceId = "10a4c4eb-f57e-4d4c-b602-bf39176ced07", //The identifier for your Amazon Connect instance. To find the ID of your instance,
                                                                     //open the AWS console and select Amazon Connect. Select the alias of the instance in the Instance alias column.
                                                                     //The instance ID is displayed in the Overview section of your instance settings.
                                                                     //For example, the instance ID is the set of characters at the end of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
                SourcePhoneNumber      = sourcePhoneNumber,          //one of нour numbers
                ContactFlowId          = idContactFlow,
                DestinationPhoneNumber = number,
                Attributes             = new Dictionary <string, string>()//variables for text at contactFlow
                {
                    { "agentName", "Alex" },
                    { "contactFlowId", idContactFlow },
                    { "orderNumber", "AB123456" },
                    { "notifyUrl", "http://this.hostname/Home/ProcessLogs" } //Route to ProcessLogs action
                }
            };

            try
            {
                var response = client.StartOutboundVoiceContact(request);
                return(new JsonNetResult(new JsonResponse(true, response.ContactId)));
            }
            catch (Amazon.Connect.AmazonConnectException ex)
            {
                Logger.Error(ex);
                return(new JsonNetResult(new JsonResponse(false, ex)));
            }
        }
Example #3
0
 public InstancesReader(InputContext context, IRowFactory rowFactory) {
    _context = context;
    _rowFactory = rowFactory;
    _client = new AmazonConnectClient();
    CheckFieldTypes();
    _request = new ListInstancesRequest();
 }
Example #4
0
        static async Task Main(string[] args)
        {
            var client  = new AmazonConnectClient();
            var request = new StartOutboundVoiceContactRequest {
                InstanceId             = "c2e9dc6f-3f69-40e2-b0ec-f78d0c62bee6",
                ContactFlowId          = "ae4e2be3-5541-4c57-9738-217052e61eb3",
                SourcePhoneNumber      = "+12065550100",
                DestinationPhoneNumber = "+12065550101",
                ClientToken            = "put something random here"
            };
            var response = await client.StartOutboundVoiceContactAsync(request);

            Console.WriteLine(response);
        }
        protected IAmazonConnect CreateClient(AWSCredentials credentials, RegionEndpoint region)
        {
            var config = new AmazonConnectConfig {
                RegionEndpoint = region
            };

            Amazon.PowerShell.Utils.Common.PopulateConfig(this, config);
            this.CustomizeClientConfig(config);
            var client = new AmazonConnectClient(credentials, config);

            client.BeforeRequestEvent += RequestEventHandler;
            client.AfterResponseEvent += ResponseEventHandler;
            return(client);
        }
Example #6
0
        public UsersReader(InputContext context, IRowFactory rowFactory)
        {
            _context    = context;
            _rowFactory = rowFactory;
            _client     = new AmazonConnectClient();
            CheckFieldTypes();

            var instanceId = context.Process.Parameters.FirstOrDefault(p => p.Name.ToLower().Replace("-", string.Empty) == "instanceid");

            if (instanceId == null)
            {
                _run = false;
                context.Error("The aws connect list-instances provider needs an instance-id parameter.");
            }
            else
            {
                _request = new ListUsersRequest()
                {
                    InstanceId = instanceId.Value
                };
            }
        }
Example #7
0
        public ActionResult StopOutboundCall(string contactId)
        {
            string accessKey           = WebConfigurationManager.AppSettings["AWSAccessKey"];
            string secretKey           = WebConfigurationManager.AppSettings["AWSSecretKey"];
            AmazonConnectClient client = new AmazonConnectClient(accessKey, secretKey, RegionEndpoint.USEast1);
            var stopRequest            = new StopContactRequest
            {
                ContactId  = contactId,                             //The unique identifier of the contact to end.
                InstanceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" //The identifier for your Amazon Connect instance
            };

            try
            {
                client.StopContact(stopRequest);
            }
            catch (Amazon.Connect.AmazonConnectException ex)
            {
                Logger.Error(ex);
                return(new JsonNetResult(new JsonResponse(false, ex)));
            }

            return(new JsonNetResult(new JsonResponse(true)));
        }