{"id":18695796,"url":"https://github.com/docwho2/java-squareup-chatgpt-ivr","last_synced_at":"2025-08-24T03:37:18.781Z","repository":{"id":197585550,"uuid":"695963770","full_name":"docwho2/java-squareup-chatgpt-ivr","owner":"docwho2","description":"Chime SMA ChatGPT Multi Lingual IVR for Square Retail","archived":false,"fork":false,"pushed_at":"2024-10-29T09:09:39.000Z","size":3663,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T10:58:21.960Z","etag":null,"topics":["amazon-chime-sdk","aws-cdk","aws-chime","aws-cloudformation","aws-dynamodb","aws-lambda-java","aws-lex","aws-sam","aws-serverless-application-model","chatgpt","chatgpt-functions","chimesdk","ivr-application","java-21","multi-lingual","openai-chatgpt","sip-media-application","squareup","voice-assistant","voice-bot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docwho2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-24T18:31:19.000Z","updated_at":"2024-10-29T09:09:37.000Z","dependencies_parsed_at":"2024-01-21T14:29:43.494Z","dependency_job_id":"3d22886c-fc5d-4f40-a3e1-48a49e0f1117","html_url":"https://github.com/docwho2/java-squareup-chatgpt-ivr","commit_stats":null,"previous_names":["docwho2/java-squareup-chatgpt-ivr"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwho2%2Fjava-squareup-chatgpt-ivr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwho2%2Fjava-squareup-chatgpt-ivr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwho2%2Fjava-squareup-chatgpt-ivr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docwho2%2Fjava-squareup-chatgpt-ivr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docwho2","download_url":"https://codeload.github.com/docwho2/java-squareup-chatgpt-ivr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223502198,"owners_count":17155938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-chime-sdk","aws-cdk","aws-chime","aws-cloudformation","aws-dynamodb","aws-lambda-java","aws-lex","aws-sam","aws-serverless-application-model","chatgpt","chatgpt-functions","chimesdk","ivr-application","java-21","multi-lingual","openai-chatgpt","sip-media-application","squareup","voice-assistant","voice-bot"],"created_at":"2024-11-07T11:16:16.795Z","updated_at":"2025-08-24T03:37:18.764Z","avatar_url":"https://github.com/docwho2.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amazon Chime SMA ChatGPT IVR for Square Retail\n\n## Background\n\nThis project is a [SIP Media Application](https://docs.aws.amazon.com/chime-sdk/latest/ag/use-sip-apps.html) and makes use of the \n[Java Chime SMA Flow Library](https://github.com/docwho2/java-chime-voicesdk-sma) to deliver a [ChatGPT](https://openai.com/chatgpt) voice bot IVR application. The IVR application is integrated with the [Square API](https://developer.squareup.com/us/en) to allow callers to ask questions about products \nand business hours, transfer to employee cell phones, etc.\n\n## Use Case\n\n[Copper Fox Gifts](https://www.copperfoxgifts.com) is a retail store located in a small town in MN. The goal is to handle the majority of calls without human intervention. Here's a breakdown of the types of calls they receive:\n\n- **About 50% of the calls**: \"Are you open now?\" This is a typical question in resort-type towns where store hours change seasonally and frequently. Many visitors prefer to call ahead to ensure the store is open before they head out.\n  - A common follow-up to this is: \"What are your hours today?\"\n  \n- **45% of the calls**: \"Do you have XYZ product?\" Queries range from mittens, hats, and gummy bears to shorts, candles, and more.\n\n- **The remaining calls**: These are primarily from vendors who are coordinating with a specific individual at the store and wish to speak with them directly.\n\n\n## Solution Summary\n\nThe goal is to introduce a \"Store Virtual Assistant\" powered by [OpenAI ChatGPT](https://openai.com/chatgpt) that can not only answer store-specific queries but also address any general questions the caller might have.\n- Utilize [ChatGPT Function Calls](https://platform.openai.com/docs/guides/gpt/function-calling) to facilitate Square API calls, enabling access to inventory, employee details, and store hours.\n  - Further leverage function calls so that the model can determine when a call should be transferred or concluded.\n- Employ strategic prompting to prime the model with pertinent store information and to guide interactions with callers.\n- Ensure a robust and dependable solution that is deployed across multiple regions within AWS and is entirely cloud-based.\n- CI/CD [GitHub Workflow](https://docs.github.com/en/actions/using-workflows/about-workflows) that deploys/updates two regions in parallel.\n\n**Features:**\n- Callers are consistently greeted and informed about the store's operational status (open or closed).\n- Store hours are ascertained in real-time via a Square API call.\n- Product category and individual item searches are also driven by Square API calls.\n  - Callers can inquire about product categories or specific items in stock.\n- Engaging with store employees or the primary store line.\n  - Callers can request to connect with specific employees, with the information sourced from a Square API call (Team Member list).\n  - If the caller simply wishes to speak to a representative, the model is preloaded with a default number to redirect the call.\n    - During transfers to the main line, this process is optimized to use SIP directly connecting to the store's [Asterisk PBX](https://www.asterisk.org).\n- Directions to the store can be requested and Google directions URL can be sent to the callers mobile device if requested.\n  - When interacting with Text the link is just returned, when using voice, the link is sent to the caller.\n- Messages can be sent to via Email to any of the employees.\n  - ChatGPT can compose some interesting emails, quite entertaining.\n  - The calling number is included in the subject of the email to lend context.\n- Language Support\n  - When interacting via Text channels (Facebook and SMS via Twilio) any language ChatGPT knows about (over 100) is supported.\n    - ChatGPT detects your language and responds in that language.\n  - When interacting via Voice any [language Lex supports](https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html) is possible.\n    - This project is configured with English, Spanish, German, Dutch, Finnish, French (Canadian), Norwegian, Polish, and Swedish.\n      - These are the more common languages spoken in northern Minnesota (Strong Nordic population).\n    - ChatGPT tries to detect (or you can ask of course) if you want to speak in another language.\n    - ChatGPT function calling is used to trigger a language context switch and then the call is moved from one Bot Locale to another at the Chime level.\n  - ChatGPT is instructed to translate request parameters into English so searching items in the Store works in any language.\n    - Do you have gummy bears?  in Spanish is \"¿Tienes ositos de goma?\".\n    - Sí, tenemos ositos de goma. Ofrecemos \"Big Yummy Gummy Bear - 12 Ct.\", \"Snack Pack O'Gummy Bears Milk Chocolate\", y \"Triple-Decker Candy Sour Gummy Bears\".\n- You can call into a test SandBox deployment via +1(612)254-0226 to try it out.\n\n## Demonstration Videos\n\n[Video Playlist of all Demos](https://www.youtube.com/playlist?list=PLd4zA87i_34RG3u4pmvKE9Ms-Qi-7eW9H)\n\n[![Facebook Channel Demo](https://img.youtube.com/vi/VEw1YAZZssU/0.jpg)](https://youtu.be/2DNpgT-o_XA)\n\n\n## High Level Components\n\n![Architecture Diagram](assets/ChimeSMA-Square-IVR.png)\n\n## Call Flow Details\n\n### SMA Controller\n\nThe [ChimeSMA](ChimeSMA/src/main/java/cloud/cleo/chimesma/squareup/ChimeSMA.java) controller controls the call at a high level.  Callers are greeted and told whether the store is open or closed.\n\n```Java\nprotected Action getInitialAction() {\n\n        // Play open or closed prompt based on Square Hours  \n        final var openClosed = PlayAudioAction.builder()\n                .withKeyF(f -\u003e squareHours.isOpen() ? \"open.wav\" : \"closed.wav\") // This is always in english\n                .withNextAction(MAIN_MENU)\n                .withErrorAction(MAIN_MENU)\n                .build();\n\n        // Start with a welcome message\n        final var welcome = PlayAudioAction.builder()\n                .withKey(\"welcome.wav\") // This is always in english\n                .withNextAction(openClosed)\n                .withErrorAction(openClosed)\n                .build();\n\n        return welcome;\n    }\n```\n\nControl is then handed off to a Lex Bot which is backed by ChatGPT to handle the interaction until a terminating event happens.\n\n```Java\nfinal var lexBotEN = StartBotConversationAction.builder()\n                .withDescription(\"ChatGPT English\")\n                .withLocale(english)\n                .withContent(\"You can ask about our products, hours, location, or speak to one of our team members. Tell us how we can help today?\")\n                .build();\n```\n\nIf ChatGPT determines the call needs to be transferred or ended, that action is returned and the SMA Controller transfers or ends the call.\n\n```Java\nFunction\u003cStartBotConversationAction, Action\u003e botNextAction = (a) -\u003e {\n    final var attrs = a.getActionData().getIntentResult().getSessionState().getSessionAttributes();\n    final var botResponse = attrs.get(\"botResponse\");  // When transferring or hanging up, play back GPT's last response\n    final var action = attrs.get(\"action\");  // We don't need or want real intents, so the action when exiting the Bot will be set\n    return switch (action) {\n        case \"transfer\" -\u003e {\n            final var phone = attrs.get(\"transferNumber\");\n            final var transfer = CallAndBridgeAction.builder()\n                .withDescription(\"Send Call to Team Member\")\n                .withRingbackToneKey(\"ringing.wav\")\n                .withCallTimeoutSeconds(60) // Store has 40 seconds before VM, and default is 30, so push to 60 to be safe\n                .withUri(phone)\n               .build();\n            if (phone.equals(MAIN_NUMBER) \u0026\u0026 !VC_ARN.equalsIgnoreCase(\"PSTN\")) {\n                // We are transferring to main number, so use SIP by sending call to Voice Connector\n                transfer.setArn(VC_ARN);\n                transfer.setDescription(\"Send Call to Main Number via SIP\");\n            }\n            yield SpeakAction.builder()\n                .withDescription(\"Indicate transfer in progress with Bot response\")\n                .withTextF(tf -\u003e botResponse)\n                .withNextAction(transfer)\n                .build();\n            }\n        case \"quit\" -\u003e\n            SpeakAction.builder()\n                .withDescription(\"Saying Good Bye\")\n                .withTextF(tf -\u003e botResponse)\n                .withNextAction(hangup)\n                .build();\n        default -\u003e\n            SpeakAction.builder()\n                .withText(\"A system error has occured, please call back and try again\")\n                .withNextAction(hangup)\n                .build();\n    }; \n};\n```\n\n### ChatGPT Fullfillment Lambda\n\nThe [ChatGPTLambda](ChatGPT/src/main/java/cloud/cleo/squareup/ChatGPTLambda.java) and [Functions](ChatGPT/src/main/java/cloud/cleo/squareup/functions) allow the caller to interface with ChatGPT and provide answers based on realtime data from Square API's.  The model is initialized when a new [Session](ChatGPT/src/main/java/cloud/cleo/squareup/ChatGPTSessionState.java) is started.\n\n```Java\n         // General Prompting\n        sb.append(\"Please be a helpfull assistant for a retail store named \\\"Copper Fox Gifts\\\", which has clothing items, home decor, gifts of all kinds, speciality foods, and much more.  \");\n        sb.append(\"The store is located at 160 Main Street, Wahkon Minnesota, near Lake Mille Lacs.  \");\n        sb.append(\"Do not respond with the whole employee list.  You may confirm the existance of an employee and give the full name.  \");\n\n        // Mode specific prompting\n        switch (inputMode) {\n            case TEXT -\u003e {\n                sb.append(\"I am interacting via SMS.  Please keep answers very short and concise, preferably under 180 characters.  \");\n                sb.append(\"To interact with an employee suggest the person call this number instead of texting and ask to speak to that person.  \");\n            }\n            case SPEECH, DTMF -\u003e {\n                sb.append(\"I am interacting with speech via a telephone interface.  please keep answers short and concise.  \");\n                \n                // Hangup\n                sb.append(\"When the caller indicates they are done with the conversation, execute the \").append(HANGUP_FUNCTION_NAME).append(\" function.  \");\n                \n                // Transferring\n                sb.append(\"To transfer or speak with a employee that has a phone number, execute the \").append(TRANSFER_FUNCTION_NAME).append(\" function.  \");\n                sb.append(\"If the caller wants to just speak to a person or leave a voicemail, execute \").append(TRANSFER_FUNCTION_NAME).append(\" with \").append(System.getenv(\"MAIN_NUMBER\")).append(\" which rings the main phone in the store.  \");\n                sb.append(\"Do not provide employee phone numbers, you can use the phone numbers to execute the \").append(TRANSFER_FUNCTION_NAME).append(\" function.  \");\n                \n                // Only recommend resturants for call ins, not SMS\n                sb.append(\"Muggs of Mille Lacs is a great resturant next door that serves some on the best burgers in the lake area and has a large selection draft beers and great pub fare.  \");\n            }\n        }\n```\n\n### Example ChatGPT Function\n\nThe [Store Hours](ChatGPT/src/main/java/cloud/cleo/squareup/functions/SquareHours.java) function is an example of extending the model to provide realtime information.  The executor for the function is rather simple.\n\n```Java\n@Override\npublic String getDescription() {\n        return \"Return the open store hours by day of week, any day of week not returned means the store is closed that day.\";\n    }\n\npublic Function\u003cRequest, Object\u003e getExecutor() {\n        return (var r) -\u003e {\n            try {\n                return client.getLocationsApi()\n                        .retrieveLocation(System.getenv(\"SQUARE_LOCATION_ID\"))\n                        .getLocation().getBusinessHours();\n            } catch (Exception ex) {\n                return mapper.createObjectNode().put(\"error_message\", ex.getLocalizedMessage());\n            } \n        };\n    }\n```\n\nThis API call to Square returns a JSON structure that is returned directly to ChatGPT for it to interpret.\n\n```Json\n    {\n      \"periods\": [\n        {\n          \"day_of_week\": \"SUN\",\n          \"start_local_time\": \"11:00:00\",\n          \"end_local_time\": \"15:00:00\"\n        },\n        {\n          \"day_of_week\": \"FRI\",\n          \"start_local_time\": \"10:00:00\",\n          \"end_local_time\": \"17:00:00\"\n        },\n        {\n          \"day_of_week\": \"SAT\",\n          \"start_local_time\": \"10:00:00\",\n          \"end_local_time\": \"17:00:00\"\n        }\n      ]\n    }\n```\n\nDepending on how the caller asks about hours, the model uses the data to answer questions:\n\n- Are you open next Thursday?\n    - No, we are closed on Thursdays (sometimes it will then speak all the open hours)\n- What are your hours?\n    - Speaks out the hours for each day in order (SUN, FRI, SAT)\n    - Sometimes it sumarizes and says Saturday and Sunday from 10 to 5 and Sunday from 11 to 3\n\n## Chime SDK Phone Number\n\nOnce you have deployed the project either via CLI or Workflow, everything is all SIP.  At this stage you could integrate a PBX (like Asterisk) and call into the application via the Voice Connector that was providioned, however the easiest way to test is to provision a phone number in the AWS Console, then create a SIP Rule to point the phone number to the SMA's created in each region.\n\nAfter provisioning a [phone number in Chime](https://docs.aws.amazon.com/chime-sdk/latest/ag/provision-phone.html), you will need to create a [SIP Rule](https://docs.aws.amazon.com/chime-sdk/latest/ag/understand-sip-data-models.html) for the phone number. When you call the phone number, you will always be routed to the SMA in the us-east-1 region. Only if that region or the Lambda associated with the SMA goes down will you fail over to the us-west-2 region.\n\n\n![Chime Phone Targets](assets/chimephonenumber.png)\n\n\n## Twilio Provisioning and Setup\n\n[Twilio](https://www.twilio.com/) is like the swiss army knife of communications and allows you greater flexibility than provisioning a PSTN number in AWS Chime Voice SDK.\n\nPros:\n- Larger Phone Number Pool\n  - International numbers (UK, Germany, etc.)\n  - Chime only provides numbers in the US.\n- Flexibility in terms of what you can do with incoming voice calls.\n  - Forward the number anywhere at any time.\n  - Use local cloud scripts in Twilio to do just about anything.\n  - Send to your SIP PBX.\n- SMS Support.\n  - Forward or respond to SMS in any way you want.\n  - You can [connect SMS to the Lex Bot](https://docs.aws.amazon.com/lex/latest/dg/twilio-bot-association.html) deployed in this solution to not only have GPT talk to customers, but also provide the same over SMS.\n  - Chime PSTN numbers assigned to SMA's do not support SMS in any way.\n- Load Balancing across AWS Regions.\n  - Chime numbers point to one region and only failover to the other region if the call can't be sent to the higher priority region.\n  - You can equally load balance calls to AWS regions.\n    - Futher if both regions didn't respond for some reason you can send the call to another SIP Destination (PBX, or some other destination)\n    - You can also use a [SIP Trunk Disaster Recovery URL](https://www.twilio.com/docs/sip-trunking#disaster-recovery) as a failsafe if all of Chime Voice becomes unreachable.\n    - In fact you could deploy to as many supported regions as you want, configure balancing equally over us-east-1 and us-west-2, and then a lower priority to ca-central-1 for example.\n- Twilio uses AWS itself and and it's [US Edge locations](https://www.twilio.com/docs/global-infrastructure/edge-locations) are positioned inside AWS regions.\n  - Low latency and the signaling never really goes over the Internet.\n\nCons:\n- Introduces more complexity dealing with the integration, Chime Numbers just require a SIP Rule pointing to SMA's and done (no Voice Connector necessary).\n- Each Twilio number requires a distinct SIP trunk paired to Voice Connectors in Chime Voice SDK.\n  - You are limited to 3 Voice Connectors per region in your AWS account by default.\n\n### Twilio Integration Details\n\nThe main issue with integration is the fact that say you have Twilio number +1-800-555-5555 and point it at the Chime Voice Connectors.\n- Chime recieves the SIP invite and sees that number +1-800-555-5555 is not known and rejects the call because that number does not exist in Chime.\n- You can however use [SIP Header Manipulation](https://www.twilio.com/docs/sip-trunking/sip-header-manipulation) to change the _To_ header to +1-703-555-0122.\n  - +1-703-555-0122 is special Chime number that the Voice Connector will answer and in conjuction with a _Request URI hostname_ SIP Rule pointing to a SMA will route the call properly into the application.\n  - Unfortunately Twilio does not yet provide an API to create these or assign them to a SIP trunk, thus some manual intervention is required for deployment.\n    - You only need to create the Header Manipulation Once which can then be used on any SIP trunk moving forward.\n    - When you initially deploy and if you destroy and then re-deploy, then you need to go to the Twilio console and apply the header manipulation to the SIP Trunk.\n\nCreating a SIP Header Manipulation in the Twilio Console:\n- In the Twilio Console _Develop_ section choose _Elastic SIP Trunking_ --\u003e _SIP Header Manipulations_ [Link](https://console.twilio.com/us1/develop/sip-trunking/settings/header-manipulation?frameUrl=%2Fconsole%2Fsip-trunking%2Fsettings%2Fheader-manipulation%3Fx-target-region%3Dus1).\n- Click on _Create a Policy_ in the upper right.\n- Enter a name for the policy (like \"Chime7035550122\").\n- Click _Create_.\n- Click _Add request rule_.\n- Enter a name for the rule (like \"To7035550122\").\n- In the _Actions_ Block enter:\n  - SIP header field -\u003e Select _To number_\n  - Action -\u003e _Replace with_\n  - Value -\u003e _+17035550122_\n- Click _Add rule_.\n- Click _Save Policy_ at the bottom of Screen.\n- You can now apply this to SIP Trunks (that you create or provisioned via CLI or Work Flow).\n\n(more to come here on provisioning)\n\n\n\n## Deploy the Project\n\nThis project uses both AWS SAM and AWS CDK to deploy resources.  Because Chime Voice SDK resources are not included in CloudFormation, they must be provisioned using AWS API calls.  Custom resources must be created to solve this problem.  This project includes and makes use of [Chime Voice SDK Provisioning Project](https://github.com/docwho2/java-chime-voice-sdk-cdk).\n\n* CDK code deploys Chime resources like the SIP media application (SMA), Voice Connector, and SIP rules to enable SIP connectivity.\n* SAM deploys the actual Lambda's (ChatGPT and SMA), Lex Bot, S3 Prompt Bucket, Prompts, etc.\n\nSome of the prerequisites to fully utilize the project are API keys for both OpenAI and Square.  If you don't care about testing the Square retail features and only want to interfact with ChatGPT, then you can skip any of the Square values and the project will still work.\n\n* [Obtain OpenAI API key](https://platform.openai.com/docs/quickstart?context=curl)\n* [Obtain Square API Key](https://developer.squareup.com/docs/build-basics/access-tokens)\n* [Obtain Square location ID](https://developer.squareup.com/blog/see-your-location-id-without-the-api-call/)\n\n### Forking repository and utlizing the GitHub Workflow\n\nThe [GitHub Workflow](.github/workflows/deploy.yml) included in the repository can be used to a create a full CI/CD pipeline as changes are comitted to the main branch.\n\nTo allow the workflow to operate on your AWS environment, you can use several methods, but in this case we are using the recommended [OIDC method](https://github.com/aws-actions/configure-aws-credentials#OIDC) that requires some setup inside your account.  The workflow uses this to setup Credentials:\n\n```yaml\n- name: Setup AWS Credentials\n      id: aws-creds\n      uses: aws-actions/configure-aws-credentials@v4\n      with:\n        aws-region: ${{ matrix.region }}\n        # The full role ARN if you are using OIDC\n        # https://github.com/aws-actions/configure-aws-credentials#oidc\n        role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}\n        # Set up the below secrets if you are not using OIDC and want to use regular keys (best practice is to use just role above with OIDC provider)\n        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}\n        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}\n        mask-aws-account-id: true\n```\n\nYou will need to [create secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) to use OIDC or Keys.  Set the role or Keys, but not both:\n\nIf you are using the [OIDC method](https://github.com/aws-actions/configure-aws-credentials#OIDC)\n- Create a Secret named **AWS_ROLE_TO_ASSUME** and set it to the full ARN of the role\n  - It should look something like \"arn:aws:iam::123456789:role/github-oidc-provider-Role-nqvduv7P15BZ\"\n\nIf you are going to use [Access Key and Secret](https://repost.aws/knowledge-center/create-access-key)\n- Create a Secret named **AWS_ACCESS_KEY_ID** and set to the Access Key ID\n- Create a Secret named **AWS_SECRET_ACCESS_KEY** and set to the Secret Access Key\n\nThe workflow has sensible defaults (see below snippet from the workflow), but you will need to set up variables and secrets:\n\n```yaml\nenv:\n  # Create secrets in the repository and they will be pushed to Parameter store, these are required\n  # If you don't set an API key for square, you can still use ChatGPT by itself\n  SQUARE_API_KEY: ${{ secrets.SQUARE_API_KEY || 'DISABLED' }}\n  OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY || 'NEED_TO_SET_THIS' }}  \n    \n  \n  # Create repository variables to override any/all of the below from the defaults\n  #\n  CDK_STACK_NAME: ${{ vars.CDK_STACK_NAME || 'chatgpt-square-ivr-cdk' }}\n  STACK_NAME: ${{ vars.STACK_NAME || 'chatgpt-square-ivr' }}\n  \n  # The E164 Number to be used when transferring to main number\n  TRANSFER_NUMBER: ${{ vars.TRANSFER_NUMBER || '+18004444444' }}\n  \n  # Set to PRODUCTION if you have a real Sqaure Buisness or Leave it as SANDBOX if you just have a dev account\n  SQUARE_ENVIRONMENT: ${{ vars.SQUARE_ENVIRONMENT || 'SANDBOX' }}\n  # You can have many locations in Square, need to set to the location you want to query inventory or employees against (required for functions to work)\n  SQUARE_LOCATION_ID: ${{ vars.SQUARE_LOCATION_ID || 'DISABLED' }}\n  \n  # https://platform.openai.com/docs/models/overview (requres model with function calling)\n  OPENAI_MODEL: ${{ vars.OPENAI_MODEL || 'gpt-3.5-turbo-1106' }}\n  \n  # Define in repo variable if you want want to route main number calls via SIP via the Voice Connector\n  PBX_HOSTNAME:  ${{ vars.PBX_HOSTNAME || '' }}\n  \n  # Polly voices to use for English and Spanish https://docs.aws.amazon.com/polly/latest/dg/ntts-voices-main.html\n  VOICE_ID_EN: ${{ vars.VOICE_ID_EN  || 'Joanna' }}\n  VOICE_ID_ES: ${{ vars.VOICE_ID_ES  || 'Lupe' }}\n```\n\nExample [Secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) :\n\nOIDC Method:\n\n![Repository Secrets OIDC](assets/secrets-oidc.png)\n\nAccess Keys:\n\n![Repository Secrets Keys](assets/secrets-keys.png)\n\n\nExample [Variables](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) :\n\n![Repository Variables](assets/variables.png)\n\nThe general steps are:\n* [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo)\n* [Setup required Secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository).\n  - Setup either OIDC or Access Keys as described above.\n  - Create a Secret named **OPENAI_API_KEY** and set to your API key otherwise ChatGPT will not function.\n  - Create a Secret named **SQUARE_API_KEY** if are going to be using Square functionaliy, if don't set this, then square functionality will be disabled.\n* Optionaly [set any variables](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository) from the defaults like **OPENAI_MODEL** for example.\n  - If you are using square then you must also create a variable named **SQUARE_LOCATION_ID** and set to the Location ID you want the API to query.\n  - If you are using a production Square API Key, then also create a variable named **SQUARE_ENVIRONMENT** and set it to **PRODUCTION** as the default is **SANDBOX**.\n  - Create variables for anything else you want to tweak like stack names, ChatGPT model, etc.\n\nThen start committing changes and watch the magic happen.  CDK deploys regions in parallel and then a matrix job deploys each region in parallel for faster deployments:\n\n![Example Deploy](assets/deploy.png)\n\n### Using the deploy.sh bash script\n\nTo deploy this project via CLI, you need the following tools.\n\n* AWS CLI - [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n* AWS SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)\n* AWS CDK - [Instal CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html)\n* Java 21 - [Install Java 21](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/downloads-list.html)\n* Maven - [Install Maven](https://maven.apache.org/install.html)\n\nIf you have [brew](https://brew.sh) installed (highly recommended) then:\n```bash\nbrew install awscli\nbrew install aws-sam-cli\nbrew install aws-cdk\nbrew install corretto21\nbrew install maven\n\n```\n\nTo build and deploy, run the following in your shell (or CloudShell) assuming AWS CLI is setup and verified to work.\n\n```bash\ngit clone https://github.com/docwho2/java-squareup-chatgpt-ivr.git\ncd java-squareup-chatgpt-ivr\n./deploy.sh\n\n```\n\nYou may find it easier to deploy in a [Cloud Shell](https://aws.amazon.com/cloudshell/).  Simply launch a Cloud Shell, then proceed like above.  The deploy script will install maven/Java if it detects you are in a CloudShell.  Note: Due limited storage when using a CloudShell if you have other artifacts and have otherwise used much of the storage, the deploy will fail with space issues (run \"df\" and check if you experience a failed deployment).\n\nYou will see the progress as the stacks deploy.  If you want to change any of the values the script asked for you can simply run it again or as many times as you need.\n\n\n\n## Testing\n\nAfter deploying you can use the [test script](testGPT.sh) to send commands to ChatGPT just to make sure everything is working as planned.  The script collects your input and uses the aws cli to send requests to both regions.\n\nAsking a question like the below example validates several things:\n- The Lex Bot is functioning and calling the [ChatGPT Lambda](ChatGPT/src/main/java/cloud/cleo/squareup/ChatGPTLambda.java)\n- ChatGPT is functioning properly\n  - Your API key is valid and OpenAI service is alive\n  - GPT is performing function calling correctly for defined functions\n- Square is functioning properly\n  - Your Square API Key and location ID are correct\n  - Square API's are responding and service is alive\n  - Valid data was returned from Square and properly interpreted by GPT\n\n```bash\n./testGPT.sh\n\nEnter text to send to ChatGPT Bot [How are you doing today?]: Tell me about your store hours\n\n[Tell me about your store hours] - us-east-1\nResponse is: \n[We are currently closed. Our regular hours are:\n- Friday: 10:00 AM - 5:00 PM\n- Saturday: 10:00 AM - 5:00 PM\n- Sunday: 11:00 AM - 3:00 PM]\n\n\n[Tell me about your store hours] - us-west-2\nResponse is: \n[We are currently closed. Our regular hours are:\n- Friday: 10:00 AM - 5:00 PM\n- Saturday: 10:00 AM - 5:00 PM\n- Sunday: 11:00 AM - 3:00 PM]\n\n```\n\nTesting is also done at deploy time and a couple times a day via Work Flows.\n- The [Test Workflow](.github/workflows/tests.yml) can be run at any time manually and also runs daily via cron settings.\n- The [Test Action](.github/actions/test/action.yml) is meant to be shared and used in various jobs.  After deploy, tests are run for example, but they can also be run manually with the above mentioned WorkFlow.\n\n\n## Cleanup\n\nTo delete the application and all resources created, use the destroy script.  If you provisioned a phone number, you will need to manually delete that as well or **you will continue to incur charges** for that.\n\nYou can run the following:\n\n```bash\n./destroy.sh\n\n```\n\n## Sample Asterisk Config\n\nConnecting your PBX to the Chime Voice Connectors to send and receive calls.  You would take the Chime Voice Connector hostnames from the output of stacks after deployment.  Obviously if you tear down the stacks and redeploy, the Voice Connector names will change, so you need to go back to Asterisk and update the names.\n\n_pjsip_wizzard.conf_ examples: \n\n```properties\n[aws-chime-virginia]\ntype=wizard\ntransport=transport-udp\nremote_hosts=fdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws\nendpoint/context=incoming-twilio\nendpoint/disallow=all\nendpoint/allow=ulaw\nendpoint/direct_media=no\nendpoint/dtmf_mode=auto\nendpoint/rtp_symmetric=yes\n\n[aws-chime-oregon]\ntype=wizard\ntransport=transport-udp\nremote_hosts=cyl0xlnxwrojzkca0pz0d2.voiceconnector.chime.aws\nendpoint/context=incoming-twilio\nendpoint/disallow=all\nendpoint/allow=ulaw\nendpoint/direct_media=no\nendpoint/dtmf_mode=auto\nendpoint/rtp_symmetric=yes\n```\n\n_extensions.conf_ excerpt:\n\n```properties\n[incoming-twilio]\n\nexten =\u003e _+1320495242X,1,NoOp(Call for Copper Fox DID ${EXTEN})\n        same =\u003e n,Goto(copperfox,${EXTEN:1},1)\n\n\n\n[copperfox]\ninclude =\u003e outbound-tc-local\ninclude =\u003e outbound-longdistance\n\n; Calls will come from Chime Voice Connector (or Twilio)\nexten =\u003e 13204952424,1,NoOp(Call to Copper Fox Main Line)\n\tsame =\u003e n,GoSub(known-callers,start,1)\n        same =\u003e n,Dial(SCCP/13204952424,40)\n        same =\u003e n,VoiceMail(${EXTEN})\n        same =\u003e n,Hangup()\n\n; Call SMA in East and failover to West if down\nexten =\u003e 290,1,NoOP(Call to AWS Chime)\n        same =\u003e n,Dial(PJSIP/+17035550122@aws-chime-virginia)\n        same =\u003e n,Playback(sorry-youre-having-problems)\n        same =\u003e n,Dial(PJSIP/+17035550122@aws-chime-oregon)\n\n; Call SMA in the East region only\nexten =\u003e 291,1,NoOP(Call to AWS Chime)\n        same =\u003e n,Dial(PJSIP/+17035550122@aws-chime-virginia)\n\n; Call SMA in the West region only\nexten =\u003e 292,1,NoOP(Call to AWS Chime Oregon)\n        same =\u003e n,Dial(PJSIP/+17035550122@aws-chime-oregon)\n\n```\n\nI've alo observed that Chime endpoints can change over time, usually there are 12, but once Asterisk locks them in it doesn't seem to update them over time.  Asterisk will refuse the call if a new endpoint is added/swapped at some point, so the brute force solution is to just relaod Asterisk every morning.\n\n```\n[root@Asterisk asterisk]# crontab -l\n0 6 * * * /sbin/asterisk -x \"core restart when convenient\"\n\n[root@Asterisk asterisk]# dig fdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws\n\n; \u003c\u003c\u003e\u003e DiG 9.11.4-P2-RedHat-9.11.4-26.P2.amzn2.13.5 \u003c\u003c\u003e\u003e fdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws\n;; QUESTION SECTION:\n;fdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. IN A\n\n;; ANSWER SECTION:\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.114\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.0\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.101\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.108\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.103\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.115\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.102\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.100\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.107\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.1\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.116\nfdtthyhzkjkmvgvgvgykxx.voiceconnector.chime.aws. 60 IN A 3.80.16.106\n```\n\n\n## Sample Deploy Output\n\n```\njava-squareup-chatgpt-ivr % ./deploy.sh\n\nChatGPT won't work if you don't provide a valid API Key, however you can still deploy\nEnter your OpenAI API Key [XXXXXXXXXX]: \nEnter OpenAI Model [gpt-3.5-turbo-1106]: \n\nIf you don't have a Square API Key, just hit enter for the next 3 prompts (will disable square functions)\n\nEnter your Square API Key [DISABLED]: \nEnter Square Environment (SANDBOX|PRODUCTION) [SANDBOX]: \nEnter Square Location ID  [DISABLED]: \n\nEnter transfer # when caller wants to speak to a person [+18004444444]: \n\n\nCloudShell not detected, assuming you have Java/Maven/SAM/CDK all installed, if not script will error\n\nWill now ensure CDK is bootstrapped in us-east-1 us-west-2\n ⏳  Bootstrapping environment aws://***/us-east-1...\nTrusted accounts for deployment: (none)\nTrusted accounts for lookup: (none)\nUsing default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.\n\n ✨ hotswap deployment skipped - no changes were detected (use --force to override)\n\n ✅  Environment aws://***/us-east-1 bootstrapped (no changes).\n\n ⏳  Bootstrapping environment aws://***/us-west-2...\nTrusted accounts for deployment: (none)\nTrusted accounts for lookup: (none)\nUsing default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.\n\n ✨ hotswap deployment skipped - no changes were detected (use --force to override)\n\n ✅  Environment aws://***/us-west-2 bootstrapped (no changes).\n\n\nDeploying CDK stack to us-east-1 us-west-2\n\n\n✨  Synthesis time: 2.86s\n\nchatgpt-square-ivr-cdk:  start: Building 878abf4f8a52ee049c6a885f81aff403cae67b16991c29d582799c0ac1a22669:***-us-east-1\nchatgpt-square-ivr-cdk:  success: Built 878abf4f8a52ee049c6a885f81aff403cae67b16991c29d582799c0ac1a22669:***-us-east-1\nchatgpt-square-ivr-cdk:  start: Publishing 878abf4f8a52ee049c6a885f81aff403cae67b16991c29d582799c0ac1a22669:***-us-east-1\nchatgpt-square-ivr-cdk:  start: Building c0460130f5069dbb2c5e5c6f98a0100dd798e1c7961ec42393e643ceca3490be:***-us-west-2\nchatgpt-square-ivr-cdk:  success: Built c0460130f5069dbb2c5e5c6f98a0100dd798e1c7961ec42393e643ceca3490be:***-us-west-2\nchatgpt-square-ivr-cdk:  start: Publishing c0460130f5069dbb2c5e5c6f98a0100dd798e1c7961ec42393e643ceca3490be:***-us-west-2\nchatgpt-square-ivr-cdk:  success: Published 878abf4f8a52ee049c6a885f81aff403cae67b16991c29d582799c0ac1a22669:***-us-east-1\neast (chatgpt-square-ivr-cdk)\neast (chatgpt-square-ivr-cdk): deploying... [1/2]\nchatgpt-square-ivr-cdk: creating CloudFormation changeset...\nchatgpt-square-ivr-cdk:  success: Published c0460130f5069dbb2c5e5c6f98a0100dd798e1c7961ec42393e643ceca3490be:***-us-west-2\nwest (chatgpt-square-ivr-cdk)\nwest (chatgpt-square-ivr-cdk): deploying... [2/2]\nchatgpt-square-ivr-cdk: creating CloudFormation changeset...\nchatgpt-square-ivr-cdk |  0/19 | 1:40:01 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | smalambdaRole \nchatgpt-square-ivr-cdk |  0/19 | 1:40:01 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | west/CDKMetadata/Default (CDKMetadata) \nchatgpt-square-ivr-cdk |  0/19 | 1:40:01 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/VC_ARN_PARAM (VCARNPARAMA1F8171A) \nchatgpt-square-ivr-cdk |  0/19 | 1:40:02 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | west/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) \nchatgpt-square-ivr-cdk |  0/19 | 1:39:49 PM | REVIEW_IN_PROGRESS   | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk User Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:39:56 PM | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk User Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:40:04 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | east/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) Resource creation Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:40:05 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/VC_ARN_PARAM (VCARNPARAMA1F8171A) Resource creation Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:40:05 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | smalambdaRole Resource creation Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:40:05 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | east/CDKMetadata/Default (CDKMetadata) Resource creation Initiated\nchatgpt-square-ivr-cdk |  1/19 | 1:40:05 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | east/VC_ARN_PARAM (VCARNPARAMA1F8171A) \nchatgpt-square-ivr-cdk |  2/19 | 1:40:05 PM | CREATE_COMPLETE      | AWS::CDK::Metadata          | east/CDKMetadata/Default (CDKMetadata) \nchatgpt-square-ivr-cdk |  2/19 | 1:39:48 PM | REVIEW_IN_PROGRESS   | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk User Initiated\nchatgpt-square-ivr-cdk |  2/19 | 1:39:59 PM | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk User Initiated\nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | east/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) \nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/VC_ARN_PARAM (VCARNPARAMA1F8171A) \nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | east/CDKMetadata/Default (CDKMetadata) \nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | smalambdaRole \nchatgpt-square-ivr-cdk |  0/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/VC_ARN_PARAM (VCARNPARAMA1F8171A) Resource creation Initiated\nchatgpt-square-ivr-cdk |  0/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | west/CDKMetadata/Default (CDKMetadata) Resource creation Initiated\nchatgpt-square-ivr-cdk |  1/19 | 1:40:03 PM | CREATE_COMPLETE      | AWS::CDK::Metadata          | west/CDKMetadata/Default (CDKMetadata) \nchatgpt-square-ivr-cdk |  1/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | west/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) Resource creation Initiated\nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | west/VC_ARN_PARAM (VCARNPARAMA1F8171A) \nchatgpt-square-ivr-cdk |  2/19 | 1:40:03 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | smalambdaRole Resource creation Initiated\nchatgpt-square-ivr-cdk |  3/19 | 1:40:21 PM | CREATE_COMPLETE      | AWS::IAM::Role              | east/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_COMPLETE      | AWS::IAM::Role              | smalambdaRole \nchatgpt-square-ivr-cdk |  3/19 | 1:40:19 PM | CREATE_COMPLETE      | AWS::IAM::Role              | west/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole (AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:19 PM | CREATE_COMPLETE      | AWS::IAM::Role              | smalambdaRole \nchatgpt-square-ivr-cdk |  4/19 | 1:40:19 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:20 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:20 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/SR-CR2/CustomResourcePolicy (SRCR2CustomResourcePolicy6283867E) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:20 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:20 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | west/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:20 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | west/sma-lambda (smalambda) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/SR-CR2/CustomResourcePolicy (SRCR2CustomResourcePolicy6283867E) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | west/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | west/sma-lambda (smalambda) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | west/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/SR-CR1/CustomResourcePolicy (SRCR1CustomResourcePolicy9714D179) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:21 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | east/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | east/sma-lambda (smalambda) \nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:22 PM | CREATE_IN_PROGRESS   | AWS::IAM::Policy            | east/SR-CR1/CustomResourcePolicy (SRCR1CustomResourcePolicy9714D179) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:23 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | east/sma-lambda (smalambda) Resource creation Initiated\nchatgpt-square-ivr-cdk |  4/19 | 1:40:23 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Function       | east/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) Resource creation Initiated\nchatgpt-square-ivr-cdk |  5/19 | 1:40:27 PM | CREATE_COMPLETE      | AWS::Lambda::Function       | west/sma-lambda (smalambda) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:28 PM | CREATE_COMPLETE      | AWS::Lambda::Function       | west/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:28 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/LAMBDAARN (LAMBDAARN5D66CCB0) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:29 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/LAMBDAARN (LAMBDAARN5D66CCB0) Resource creation Initiated\nchatgpt-square-ivr-cdk |  5/19 | 1:40:29 PM | CREATE_COMPLETE      | AWS::Lambda::Function       | east/sma-lambda (smalambda) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:29 PM | CREATE_COMPLETE      | AWS::Lambda::Function       | east/AWS679f53fac002430cb0da5b7982bd2287 (AWS679f53fac002430cb0da5b7982bd22872D164C4C) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:29 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/LAMBDAARN (LAMBDAARN5D66CCB0) \nchatgpt-square-ivr-cdk |  6/19 | 1:40:30 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/LAMBDAARN (LAMBDAARN5D66CCB0) Resource creation Initiated\nchatgpt-square-ivr-cdk |  7/19 | 1:40:31 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | east/LAMBDAARN (LAMBDAARN5D66CCB0) \nchatgpt-square-ivr-cdk |  7/19 | 1:40:29 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | west/LAMBDAARN (LAMBDAARN5D66CCB0) \nchatgpt-square-ivr-cdk |  8/19 | 1:40:36 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | west/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) \nchatgpt-square-ivr-cdk |  9/19 | 1:40:36 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | west/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) \nchatgpt-square-ivr-cdk | 10/19 | 1:40:37 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | west/SR-CR2/CustomResourcePolicy (SRCR2CustomResourcePolicy6283867E) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:37 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | west/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:37 PM | CREATE_IN_PROGRESS   | Custom::SipMediaApplication | west/SMA-CR/Resource/Default (SMACR6E385B4A) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:37 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnector      | west/VC-CR/Resource/Default (VCCRE7EE978A) \nchatgpt-square-ivr-cdk |  8/19 | 1:40:38 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | east/VC-CR-TERM/CustomResourcePolicy (VCCRTERMCustomResourcePolicy3D87E733) \nchatgpt-square-ivr-cdk |  9/19 | 1:40:38 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | east/SMA-CR/CustomResourcePolicy (SMACRCustomResourcePolicy277D2013) \nchatgpt-square-ivr-cdk | 10/19 | 1:40:38 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | east/SR-CR1/CustomResourcePolicy (SRCR1CustomResourcePolicy9714D179) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:38 PM | CREATE_COMPLETE      | AWS::IAM::Policy            | east/VC-CR/CustomResourcePolicy (VCCRCustomResourcePolicy9739604D) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:39 PM | CREATE_IN_PROGRESS   | Custom::SipMediaApplication | east/SMA-CR/Resource/Default (SMACR6E385B4A) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:39 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnector      | east/VC-CR/Resource/Default (VCCRE7EE978A) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:49 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnector      | west/VC-CR/Resource/Default (VCCRE7EE978A) Resource creation Initiated\nchatgpt-square-ivr-cdk | 12/19 | 1:40:49 PM | CREATE_COMPLETE      | Custom::VoiceConnector      | west/VC-CR/Resource/Default (VCCRE7EE978A) \nchatgpt-square-ivr-cdk | 12/19 | 1:40:49 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) \nchatgpt-square-ivr-cdk | 12/19 | 1:40:49 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnectorTerm  | west/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) \nchatgpt-square-ivr-cdk | 12/19 | 1:40:50 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) Resource creation Initiated\nchatgpt-square-ivr-cdk | 12/19 | 1:40:50 PM | CREATE_IN_PROGRESS   | Custom::SipMediaApplication | west/SMA-CR/Resource/Default (SMACR6E385B4A) Resource creation Initiated\nchatgpt-square-ivr-cdk | 13/19 | 1:40:51 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | west/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:51 PM | CREATE_COMPLETE      | Custom::SipMediaApplication | west/SMA-CR/Resource/Default (SMACR6E385B4A) \nchatgpt-square-ivr-cdk | 11/19 | 1:40:51 PM | CREATE_IN_PROGRESS   | Custom::SipMediaApplication | east/SMA-CR/Resource/Default (SMACR6E385B4A) Resource creation Initiated\nchatgpt-square-ivr-cdk | 11/19 | 1:40:51 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnector      | east/VC-CR/Resource/Default (VCCRE7EE978A) Resource creation Initiated\nchatgpt-square-ivr-cdk | 12/19 | 1:40:51 PM | CREATE_COMPLETE      | Custom::SipMediaApplication | east/SMA-CR/Resource/Default (SMACR6E385B4A) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:51 PM | CREATE_COMPLETE      | Custom::VoiceConnector      | east/VC-CR/Resource/Default (VCCRE7EE978A) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/SMA_ID_PARAM (SMAIDPARAM0A524744) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Permission     | east/SMA-CR-PERM (SMACRPERM) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnectorTerm  | east/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | Custom::SipRule             | east/SR-CR1/Resource/Default (SRCR17A38CCA2) \nchatgpt-square-ivr-cdk | 13/19 | 1:40:53 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/SMA_ID_PARAM (SMAIDPARAM0A524744) Resource creation Initiated\nchatgpt-square-ivr-cdk | 13/19 | 1:40:53 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Permission     | east/SMA-CR-PERM (SMACRPERM) Resource creation Initiated\nchatgpt-square-ivr-cdk | 14/19 | 1:40:53 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | east/SMA_ID_PARAM (SMAIDPARAM0A524744) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:53 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | east/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) Resource creation Initiated\nchatgpt-square-ivr-cdk | 15/19 | 1:40:53 PM | CREATE_COMPLETE      | AWS::Lambda::Permission     | east/SMA-CR-PERM (SMACRPERM) \nchatgpt-square-ivr-cdk | 16/19 | 1:40:53 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | east/VC_HOSTNAME_PARAM (VCHOSTNAMEPARAM2165CF79) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:51 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/SMA_ID_PARAM (SMAIDPARAM0A524744) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:51 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Permission     | west/SMA-CR-PERM (SMACRPERM) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:51 PM | CREATE_IN_PROGRESS   | Custom::SipRule             | west/SR-CR2/Resource/Default (SRCR2E1269187) \nchatgpt-square-ivr-cdk | 14/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnectorTerm  | west/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) Resource creation Initiated\nchatgpt-square-ivr-cdk | 15/19 | 1:40:52 PM | CREATE_COMPLETE      | Custom::VoiceConnectorTerm  | west/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) \nchatgpt-square-ivr-cdk | 15/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | AWS::SSM::Parameter         | west/SMA_ID_PARAM (SMAIDPARAM0A524744) Resource creation Initiated\nchatgpt-square-ivr-cdk | 15/19 | 1:40:52 PM | CREATE_IN_PROGRESS   | AWS::Lambda::Permission     | west/SMA-CR-PERM (SMACRPERM) Resource creation Initiated\nchatgpt-square-ivr-cdk | 16/19 | 1:40:52 PM | CREATE_COMPLETE      | AWS::SSM::Parameter         | west/SMA_ID_PARAM (SMAIDPARAM0A524744) \nchatgpt-square-ivr-cdk | 17/19 | 1:40:53 PM | CREATE_COMPLETE      | AWS::Lambda::Permission     | west/SMA-CR-PERM (SMACRPERM) \nchatgpt-square-ivr-cdk | 17/19 | 1:40:53 PM | CREATE_IN_PROGRESS   | Custom::SipRule             | west/SR-CR2/Resource/Default (SRCR2E1269187) Resource creation Initiated\nchatgpt-square-ivr-cdk | 18/19 | 1:40:54 PM | CREATE_COMPLETE      | Custom::SipRule             | west/SR-CR2/Resource/Default (SRCR2E1269187) \nchatgpt-square-ivr-cdk | 19/19 | 1:40:55 PM | CREATE_COMPLETE      | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk \n\n ✅  west (chatgpt-square-ivr-cdk)\n\n✨  Deployment time: 67.89s\n\nOutputs:\nwest.SMAID = 361b1f39-cf7b-4f35-b04f-0a39e2876b38\nwest.VCHOSTNAME = b7myixompli7rcb5hdwwrm.voiceconnector.chime.aws\nStack ARN:\narn:aws:cloudformation:us-west-2:***:stack/chatgpt-square-ivr-cdk/1380a090-80ca-11ee-a788-0ac549880e8d\n\n✨  Total time: 70.75s\n\nchatgpt-square-ivr-cdk | 16/19 | 1:40:54 PM | CREATE_IN_PROGRESS   | Custom::VoiceConnectorTerm  | east/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) Resource creation Initiated\nchatgpt-square-ivr-cdk | 17/19 | 1:40:54 PM | CREATE_COMPLETE      | Custom::VoiceConnectorTerm  | east/VC-CR-TERM/Resource/Default (VCCRTERM11C63EB8) \nchatgpt-square-ivr-cdk | 17/19 | 1:40:54 PM | CREATE_IN_PROGRESS   | Custom::SipRule             | east/SR-CR1/Resource/Default (SRCR17A38CCA2) Resource creation Initiated\nchatgpt-square-ivr-cdk | 18/19 | 1:40:54 PM | CREATE_COMPLETE      | Custom::SipRule             | east/SR-CR1/Resource/Default (SRCR17A38CCA2) \nchatgpt-square-ivr-cdk | 19/19 | 1:40:56 PM | CREATE_COMPLETE      | AWS::CloudFormation::Stack  | chatgpt-square-ivr-cdk \n\n ✅  east (chatgpt-square-ivr-cdk)\n\n✨  Deployment time: 71.36s\n\nOutputs:\neast.SMAID = bc08cbfe-e007-46f6-bd08-0e71707d9da8\neast.VCHOSTNAME = elb3optyef4vu5djzcti20.voiceconnector.chime.aws\nStack ARN:\narn:aws:cloudformation:us-east-1:***:stack/chatgpt-square-ivr-cdk/12c2f5e0-80ca-11ee-b7c2-0a9923416cf1\n\n✨  Total time: 74.21s\n\n\n\nBuilding Libraries\n[INFO] Scanning for projects...\n[INFO] ------------------------------------------------------------------------\n[INFO] ------------------------------------------------------------------------\n[INFO] Reactor Summary:\n[INFO] \n[INFO] AWS Lambda Java Runtime Serialization 2.0.0 ........ SUCCESS [  0.400 s]\n[INFO] AWS Lambda Java Events Library 4.0.0 ............... SUCCESS [  0.147 s]\n[INFO] Chime SMA Parent POM 1.0 ........................... SUCCESS [  0.001 s]\n[INFO] Chime SDK SMA Event Library 1.0 .................... SUCCESS [  0.018 s]\n[INFO] Chime SDK SMA Flow Library 1.0 ..................... SUCCESS [  0.028 s]\n[INFO] Chime Polly Prompt Generator 1.0 ................... SUCCESS [  1.524 s]\n[INFO] Chime Lex ChatGPT Lambda 1.0 ....................... SUCCESS [  1.834 s]\n[INFO] Chime SDK SMA Examples 1.0 ......................... SUCCESS [  1.071 s]\n[INFO] Chime Voice CDK Provision 1.0 ...................... SUCCESS [  0.345 s]\n[INFO] Square Chime SMA Parent POM 1.0 .................... SUCCESS [  0.002 s]\n[INFO] Square Chime Lex ChatGPT Lambda 1.0 ................ SUCCESS [  2.429 s]\n[INFO] Square Chime SMA Lambda 1.0 ........................ SUCCESS [  0.807 s]\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time:  8.681 s\n[INFO] Finished at: 2023-11-11T13:41:08-06:00\n[INFO] ------------------------------------------------------------------------\n                                                                                                                     \nBuilding codeuri: /Users/sjensen/dude/java-squareup-chatgpt-ivr/ChatGPT runtime: java17 metadata: {} architecture: x86_64 functions: ChatGPT                                                                     \n Running JavaMavenWorkflow:CopySource                                                                                                                                                                            \n Running JavaMavenWorkflow:MavenBuild                                                                                                                                                                            \n Running JavaMavenWorkflow:MavenCopyDependency                                                                                                                                                                   \n Running JavaMavenWorkflow:MavenCopyArtifacts                                                                                                                                                                    \n Running JavaMavenWorkflow:CleanUp                                                                                                                                                                               \n Running JavaMavenWorkflow:JavaCopyDependencies                                                                                                                                                                  \n\nBuild Succeeded\n\nBuilt Artifacts  : .aws-sam/build\nBuilt Template   : .aws-sam/build/template.yaml\n\nCommands you can use next\n=========================\n[*] Validate SAM template: sam validate\n[*] Invoke Function: sam local invoke\n[*] Test Function in the Cloud: sam sync --stack-name {{stack-name}} --watch\n[*] Deploy: sam deploy --guided\n\n\t\tManaged S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-13mtysy565mpu\n\t\tA different default S3 bucket can be set in samconfig.toml\n\t\tOr by specifying --s3-bucket explicitly.\n\tUploading to edbb4caca275e3789a7e7b323715310e  18709716 / 18709716  (100.00%)\nFile with same data already exists at edbb4caca275e3789a7e7b323715310e, skipping upload                                                                                                                          \n\tUploading to 8e59dd1bc032ccd9e5d603662d4af6aa  12156120 / 12156120  (100.00%)\n\tUploading to 03a1e0f143a451b90f9f90e595685355  33735650 / 33735650  (100.00%)\n\n\tDeploying with following values\n\t===============================\n\tStack name                   : chatgpt-square-ivr\n\tRegion                       : us-east-1\n\tConfirm changeset            : False\n\tDisable rollback             : False\n\tDeployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-13mtysy565mpu\n\tCapabilities                 : [\"CAPABILITY_IAM\"]\n\tParameter overrides          : {\"OPENAIAPIKEY\": \"/chatgpt-square-ivr/OPENAI_API_KEY\", \"SMAID\": \"/chatgpt-square-ivr-cdk/SMA_ID\", \"VOICECONNECTORARN\": \"/chatgpt-square-ivr-cdk/VC_ARN\", \"SQUAREENVIRONMENT\": \"SANDBOX\", \"SQUARELOCATIONID\": \"DISABLED\", \"TRANSFERNUMBER\": \"+18004444444\", \"OPENAIMODEL\": \"gpt-3.5-turbo-1106\", \"VOICEIDEN\": \"Joanna\", \"VOICEIDES\": \"Lupe\"}\n\tSigning Profiles             : {}\n\nInitiating deployment\n=====================\n\n\tUploading to 57f7012144864dea8bceb3c43ccd2e92.template  16416 / 16416  (100.00%)\n\n\nWaiting for changeset to be created..\n\nCloudFormation stack changeset\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nOperation                                           LogicalResourceId                                   ResourceType                                        Replacement                                       \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n+ Add                                               BotAliasGPT                                         AWS::Lex::BotAlias                                  N/A                                               \n+ Add                                               BotRuntimeRole                                      AWS::IAM::Role                                      N/A                                               \n+ Add                                               BotVersionGPT                                       AWS::Lex::BotVersion                                N/A                                               \n+ Add                                               ChatGPTAliasSNAPSTART                               AWS::Lambda::Alias                                  N/A                                               \n+ Add                                               ChatGPTRole                                         AWS::IAM::Role                                      N/A                                               \n+ Add                                               ChatGPTVersiona09db0da17                            AWS::Lambda::Version                                N/A                                               \n+ Add                                               ChatGPT                                             AWS::Lambda::Function                               N/A                                               \n+ Add                                               ChimeCallLexGPT                                     AWS::Lex::ResourcePolicy                            N/A                                               \n+ Add                                               ChimeSMAAliasSNAPSTART                              AWS::Lambda::Alias                                  N/A                                               \n+ Add                                               ChimeSMAPerm                                        AWS::Lambda::Permission                             N/A                                               \n+ Add                                               ChimeSMARole                                        AWS::IAM::Role                                      N/A                                               \n+ Add                                               ChimeSMASnapPerm                                    AWS::Lambda::Permission                             N/A                                               \n+ Add                                               ChimeSMAVersiondb12bc9449                           AWS::Lambda::Version                                N/A                                               \n+ Add                                               ChimeSMA                                            AWS::Lambda::Function                               N/A                                               \n+ Add                                               ClosedEN                                            Custom::PromptCreator                               N/A                                               \n+ Add                                               GoodbyePromptEN                                     Custom::PromptCreator                               N/A                                               \n+ Add                                               GoodbyePromptES                                     Custom::PromptCreator                               N/A                                               \n+ Add                                               LexBotGPT                                           AWS::Lex::Bot                                       N/A                                               \n+ Add                                               LexToChatGPTPerm                                    AWS::Lambda::Permission                             N/A                                               \n+ Add                                               LexToChatGPTSnapPerm                                AWS::Lambda::Permission                             N/A                                               \n+ Add                                               MainPromptEast                                      Custom::PromptCreator                               N/A                                               \n+ Add                                               OpenEN                                              Custom::PromptCreator                               N/A                                               \n+ Add                                               PromptBucketPolicy                                  AWS::S3::BucketPolicy                               N/A                                               \n+ Add                                               PromptBucket                                        AWS::S3::Bucket                                     N/A                                               \n+ Add                                               PromptCopierRole                                    AWS::IAM::Role                                      N/A                                               \n+ Add                                               PromptCopier                                        AWS::Lambda::Function                               N/A                                               \n+ Add                                               PromptCreatorRole                                   AWS::IAM::Role                                      N/A                                               \n+ Add                                               PromptCreator                                       AWS::Lambda::Function                               N/A                                               \n+ Add                                               SessionTable                                        AWS::DynamoDB::Table                                N/A                                               \n+ Add                                               StaticPrompts                                       Custom::PromptCopier                                N/A                                               \n+ Add                                               TransferEN                                          Custom::PromptCreator                               N/A                                               \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nChangeset created successfully. arn:aws:cloudformation:us-east-1:***:changeSet/samcli-deploy1699731736/0c063172-8389-4763-b45a-f8ee80e49c72\n\n\n2023-11-11 13:42:33 - Waiting for stack create/update to complete\n\nCloudFormation events from stack operations (refresh every 5.0 seconds)\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nResourceStatus                                      ResourceType                                        LogicalResourceId                                   ResourceStatusReason                              \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nCREATE_IN_PROGRESS                                  AWS::CloudFormation::Stack                          chatgpt-square-ivr                                  User Initiated                                    \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChimeSMARole                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::S3::Bucket                                     PromptBucket                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::DynamoDB::Table                                SessionTable                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      BotRuntimeRole                                      -                                                 \nCREATE_IN_PROGRESS                                  AWS::S3::Bucket                                     PromptBucket                                        Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      BotRuntimeRole                                      Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::DynamoDB::Table                                SessionTable                                        Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChimeSMARole                                        Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::DynamoDB::Table                                SessionTable                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChatGPTRole                                         -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChatGPTRole                                         Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::IAM::Role                                      ChimeSMARole                                        -                                                 \nCREATE_COMPLETE                                     AWS::IAM::Role                                      BotRuntimeRole                                      -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::Bot                                       LexBotGPT                                           -                                                 \nCREATE_COMPLETE                                     AWS::S3::Bucket                                     PromptBucket                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      PromptCreatorRole                                   -                                                 \nCREATE_IN_PROGRESS                                  AWS::S3::BucketPolicy                               PromptBucketPolicy                                  -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      PromptCopierRole                                    -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::Bot                                       LexBotGPT                                           Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      PromptCreatorRole                                   Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      PromptCopierRole                                    Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::S3::BucketPolicy                               PromptBucketPolicy                                  Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::S3::BucketPolicy                               PromptBucketPolicy                                  -                                                 \nCREATE_COMPLETE                                     AWS::IAM::Role                                      ChatGPTRole                                         -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               ChatGPT                                             -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               ChatGPT                                             Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::IAM::Role                                      PromptCreatorRole                                   -                                                 \nCREATE_COMPLETE                                     AWS::IAM::Role                                      PromptCopierRole                                    -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               PromptCreator                                       -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               PromptCopier                                        -                                                 \nCREATE_COMPLETE                                     AWS::Lambda::Function                               ChatGPT                                             -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             LexToChatGPTPerm                                    -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Version                                ChatGPTVersiona09db0da17                            -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               PromptCreator                                       Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               PromptCopier                                        Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             LexToChatGPTPerm                                    Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Permission                             LexToChatGPTPerm                                    -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Version                                ChatGPTVersiona09db0da17                            Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Function                               PromptCopier                                        -                                                 \nCREATE_COMPLETE                                     AWS::Lambda::Function                               PromptCreator                                       -                                                 \nCREATE_COMPLETE                                     AWS::Lex::Bot                                       LexBotGPT                                           -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCopier                                StaticPrompts                                       -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               GoodbyePromptES                                     -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               TransferEN                                          -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               OpenEN                                              -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               MainPromptEast                                      -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               ClosedEN                                            -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               GoodbyePromptEN                                     -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::BotVersion                                BotVersionGPT                                       -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::BotVersion                                BotVersionGPT                                       Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               GoodbyePromptES                                     Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  Custom::PromptCopier                                StaticPrompts                                       Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               GoodbyePromptEN                                     Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               MainPromptEast                                      Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               OpenEN                                              Resource creation Initiated                       \nCREATE_COMPLETE                                     Custom::PromptCreator                               GoodbyePromptES                                     -                                                 \nCREATE_COMPLETE                                     Custom::PromptCopier                                StaticPrompts                                       -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               TransferEN                                          Resource creation Initiated                       \nCREATE_COMPLETE                                     Custom::PromptCreator                               GoodbyePromptEN                                     -                                                 \nCREATE_COMPLETE                                     Custom::PromptCreator                               MainPromptEast                                      -                                                 \nCREATE_COMPLETE                                     Custom::PromptCreator                               OpenEN                                              -                                                 \nCREATE_COMPLETE                                     Custom::PromptCreator                               TransferEN                                          -                                                 \nCREATE_IN_PROGRESS                                  Custom::PromptCreator                               ClosedEN                                            Resource creation Initiated                       \nCREATE_COMPLETE                                     Custom::PromptCreator                               ClosedEN                                            -                                                 \nCREATE_COMPLETE                                     AWS::Lex::BotVersion                                BotVersionGPT                                       -                                                 \nCREATE_COMPLETE                                     AWS::Lambda::Version                                ChatGPTVersiona09db0da17                            -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Alias                                  ChatGPTAliasSNAPSTART                               -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Alias                                  ChatGPTAliasSNAPSTART                               Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Alias                                  ChatGPTAliasSNAPSTART                               -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             LexToChatGPTSnapPerm                                -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::BotAlias                                  BotAliasGPT                                         -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             LexToChatGPTSnapPerm                                Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Permission                             LexToChatGPTSnapPerm                                -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::BotAlias                                  BotAliasGPT                                         Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lex::BotAlias                                  BotAliasGPT                                         -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::ResourcePolicy                            ChimeCallLexGPT                                     -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               ChimeSMA                                            -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Function                               ChimeSMA                                            Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::Lex::ResourcePolicy                            ChimeCallLexGPT                                     Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lex::ResourcePolicy                            ChimeCallLexGPT                                     -                                                 \nCREATE_COMPLETE                                     AWS::Lambda::Function                               ChimeSMA                                            -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Version                                ChimeSMAVersiondb12bc9449                           -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             ChimeSMAPerm                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             ChimeSMAPerm                                        Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Permission                             ChimeSMAPerm                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Version                                ChimeSMAVersiondb12bc9449                           Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Version                                ChimeSMAVersiondb12bc9449                           -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Alias                                  ChimeSMAAliasSNAPSTART                              -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Alias                                  ChimeSMAAliasSNAPSTART                              Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Alias                                  ChimeSMAAliasSNAPSTART                              -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             ChimeSMASnapPerm                                    -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lambda::Permission                             ChimeSMASnapPerm                                    Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::Lambda::Permission                             ChimeSMASnapPerm                                    -                                                 \nCREATE_COMPLETE                                     AWS::CloudFormation::Stack                          chatgpt-square-ivr                                  -                                                 \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nSuccessfully created/updated stack - chatgpt-square-ivr in us-east-1\n\n\n\t\tManaged S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-m21j5av2movi\n\t\tA different default S3 bucket can be set in samconfig.toml\n\t\tOr by specifying --s3-bucket explicitly.\n\tUploading to edbb4caca275e3789a7e7b323715310e  18709716 / 18709716  (100.00%)\nFile with same data already exists at edbb4caca275e3789a7e7b323715310e, skipping upload                                                                                                                          \n\tUploading to 8e59dd1bc032ccd9e5d603662d4af6aa  12156120 / 12156120  (100.00%)\n\tUploading to 03a1e0f143a451b90f9f90e595685355  33735650 / 33735650  (100.00%)\n\n\tDeploying with following values\n\t===============================\n\tStack name                   : chatgpt-square-ivr\n\tRegion                       : us-west-2\n\tConfirm changeset            : False\n\tDisable rollback             : False\n\tDeployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-m21j5av2movi\n\tCapabilities                 : [\"CAPABILITY_IAM\"]\n\tParameter overrides          : {\"OPENAIAPIKEY\": \"/chatgpt-square-ivr/OPENAI_API_KEY\", \"SMAID\": \"/chatgpt-square-ivr-cdk/SMA_ID\", \"VOICECONNECTORARN\": \"/chatgpt-square-ivr-cdk/VC_ARN\", \"SQUAREENVIRONMENT\": \"SANDBOX\", \"SQUARELOCATIONID\": \"DISABLED\", \"TRANSFERNUMBER\": \"+18004444444\", \"OPENAIMODEL\": \"gpt-3.5-turbo-1106\", \"VOICEIDEN\": \"Joanna\", \"VOICEIDES\": \"Lupe\"}\n\tSigning Profiles             : {}\n\nInitiating deployment\n=====================\n\n\tUploading to c00f16ae3c0dda98779c01bf739809bb.template  16412 / 16412  (100.00%)\n\n\nWaiting for changeset to be created..\n\nCloudFormation stack changeset\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nOperation                                           LogicalResourceId                                   ResourceType                                        Replacement                                       \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n+ Add                                               BotAliasGPT                                         AWS::Lex::BotAlias                                  N/A                                               \n+ Add                                               BotRuntimeRole                                      AWS::IAM::Role                                      N/A                                               \n+ Add                                               BotVersionGPT                                       AWS::Lex::BotVersion                                N/A                                               \n+ Add                                               ChatGPTAliasSNAPSTART                               AWS::Lambda::Alias                                  N/A                                               \n+ Add                                               ChatGPTRole                                         AWS::IAM::Role                                      N/A                                               \n+ Add                                               ChatGPTVersion0f137f08d8                            AWS::Lambda::Version                                N/A                                               \n+ Add                                               ChatGPT                                             AWS::Lambda::Function                               N/A                                               \n+ Add                                               ChimeCallLexGPT                                     AWS::Lex::ResourcePolicy                            N/A                                               \n+ Add                                               ChimeSMAAliasSNAPSTART                              AWS::Lambda::Alias                                  N/A                                               \n+ Add                                               ChimeSMAPerm                                        AWS::Lambda::Permission                             N/A                                               \n+ Add                                               ChimeSMARole                                        AWS::IAM::Role                                      N/A                                               \n+ Add                                               ChimeSMASnapPerm                                    AWS::Lambda::Permission                             N/A                                               \n+ Add                                               ChimeSMAVersion3bae246093                           AWS::Lambda::Version                                N/A                                               \n+ Add                                               ChimeSMA                                            AWS::Lambda::Function                               N/A                                               \n+ Add                                               ClosedEN                                            Custom::PromptCreator                               N/A                                               \n+ Add                                               GoodbyePromptEN                                     Custom::PromptCreator                               N/A                                               \n+ Add                                               GoodbyePromptES                                     Custom::PromptCreator                               N/A                                               \n+ Add                                               LexBotGPT                                           AWS::Lex::Bot                                       N/A                                               \n+ Add                                               LexToChatGPTPerm                                    AWS::Lambda::Permission                             N/A                                               \n+ Add                                               LexToChatGPTSnapPerm                                AWS::Lambda::Permission                             N/A                                               \n+ Add                                               MainPromptEast                                      Custom::PromptCreator                               N/A                                               \n+ Add                                               OpenEN                                              Custom::PromptCreator                               N/A                                               \n+ Add                                               PromptBucketPolicy                                  AWS::S3::BucketPolicy                               N/A                                               \n+ Add                                               PromptBucket                                        AWS::S3::Bucket                                     N/A                                               \n+ Add                                               PromptCopierRole                                    AWS::IAM::Role                                      N/A                                               \n+ Add                                               PromptCopier                                        AWS::Lambda::Function                               N/A                                               \n+ Add                                               PromptCreatorRole                                   AWS::IAM::Role                                      N/A                                               \n+ Add                                               PromptCreator                                       AWS::Lambda::Function                               N/A                                               \n+ Add                                               SessionTable                                        AWS::DynamoDB::Table                                N/A                                               \n+ Add                                               StaticPrompts                                       Custom::PromptCopier                                N/A                                               \n+ Add                                               TransferEN                                          Custom::PromptCreator                               N/A                                               \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nChangeset created successfully. arn:aws:cloudformation:us-west-2:***:changeSet/samcli-deploy1699732145/bec8de1f-78d5-4e54-8853-aba4164c6b4a\n\n\n2023-11-11 13:49:18 - Waiting for stack create/update to complete\n\nCloudFormation events from stack operations (refresh every 5.0 seconds)\n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nResourceStatus                                      ResourceType                                        LogicalResourceId                                   ResourceStatusReason                              \n-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nCREATE_IN_PROGRESS                                  AWS::CloudFormation::Stack                          chatgpt-square-ivr                                  User Initiated                                    \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChimeSMARole                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::DynamoDB::Table                                SessionTable                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      BotRuntimeRole                                      -                                                 \nCREATE_IN_PROGRESS                                  AWS::S3::Bucket                                     PromptBucket                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::S3::Bucket                                     PromptBucket                                        Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::DynamoDB::Table                                SessionTable                                        Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      BotRuntimeRole                                      Resource creation Initiated                       \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChimeSMARole                                        Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::DynamoDB::Table                                SessionTable                                        -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChatGPTRole                                         -                                                 \nCREATE_IN_PROGRESS                                  AWS::IAM::Role                                      ChatGPTRole                                         Resource creation Initiated                       \nCREATE_COMPLETE                                     AWS::IAM::Role                                      ChimeSMARole                                        -                                                 \nCREATE_COMPLETE                                     AWS::IAM::Role                                      BotRuntimeRole                                      -                                                 \nCREATE_IN_PROGRESS                                  AWS::Lex::Bot                                       LexBotGPT                                           -                                                 \nCREATE_COMPLETE                                     AWS::S3::Bucket                          ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocwho2%2Fjava-squareup-chatgpt-ivr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocwho2%2Fjava-squareup-chatgpt-ivr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocwho2%2Fjava-squareup-chatgpt-ivr/lists"}