/// <summary>
        /// Ends the contact initiated by the <code>StartOutboundVoiceContact</code> operation.
        ///
        ///
        /// <para>
        /// If you are using an IAM account, it must have permissions to the <code>connect:StopContact</code>
        /// operation.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the StopContact service method.</param>
        ///
        /// <returns>The response from the StopContact service method, as returned by Connect.</returns>
        /// <exception cref="Amazon.Connect.Model.ContactNotFoundException">
        /// The contact with the specified ID is not active or does not exist.
        /// </exception>
        /// <exception cref="Amazon.Connect.Model.InternalServiceException">
        /// Request processing failed due to an error or failure with the service.
        /// </exception>
        /// <exception cref="Amazon.Connect.Model.InvalidParameterException">
        /// One or more of the parameters provided to the operation are not valid.
        /// </exception>
        /// <exception cref="Amazon.Connect.Model.InvalidRequestException">
        /// The request is not valid.
        /// </exception>
        /// <exception cref="Amazon.Connect.Model.ResourceNotFoundException">
        /// The specified resource was not found.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContact">REST API Reference for StopContact Operation</seealso>
        public virtual StopContactResponse StopContact(StopContactRequest request)
        {
            var marshaller   = StopContactRequestMarshaller.Instance;
            var unmarshaller = StopContactResponseUnmarshaller.Instance;

            return(Invoke <StopContactRequest, StopContactResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the StopContact operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the StopContact operation on AmazonConnectClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStopContact
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContact">REST API Reference for StopContact Operation</seealso>
        public virtual IAsyncResult BeginStopContact(StopContactRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = StopContactRequestMarshaller.Instance;
            var unmarshaller = StopContactResponseUnmarshaller.Instance;

            return(BeginInvoke <StopContactRequest>(request, marshaller, unmarshaller,
                                                    callback, state));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the StopContact operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the StopContact operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContact">REST API Reference for StopContact Operation</seealso>
        public virtual Task <StopContactResponse> StopContactAsync(StopContactRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = StopContactRequestMarshaller.Instance;
            var unmarshaller = StopContactResponseUnmarshaller.Instance;

            return(InvokeAsync <StopContactRequest, StopContactResponse>(request, marshaller,
                                                                         unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the StopContact operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the StopContact operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContact">REST API Reference for StopContact Operation</seealso>
        public virtual Task <StopContactResponse> StopContactAsync(StopContactRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StopContactRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StopContactResponseUnmarshaller.Instance;

            return(InvokeAsync <StopContactResponse>(request, options, cancellationToken));
        }
        internal virtual StopContactResponse StopContact(StopContactRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = StopContactRequestMarshaller.Instance;
            options.ResponseUnmarshaller = StopContactResponseUnmarshaller.Instance;

            return(Invoke <StopContactResponse>(request, options));
        }
Exemple #6
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)));
        }