Skip to content

Commit 0437cfb

Browse files
author
Russ Williams
committedAug 3, 2022
Fixed ngrok host-header command flag and update doc
1 parent b17a199 commit 0437cfb

File tree

6 files changed

+24
-11
lines changed

6 files changed

+24
-11
lines changed
 

‎ACSAgentHub/local.settings.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"Values": {
44
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
55
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
6-
"agentHubStorageConnectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=acsagenthubrhw;AccountKey=1CEyV1LH0o2xyXh2OiFW1/ofFEMiHWYv2sTJPnPXnJjZn80cF15wYsvUGt29LyFSyvlONf7hG/VY+AStiIaUVQ==",
7-
"acsConnectionString": "endpoint=https://acsagenthubrhwacs.communication.azure.com/;accesskey=/6LN9tienVGXi65p3gcYyGrQf+YHX8dzg+mMn9e5aUfupI77qExVX1TZrVJQVTuS0Fhk0IE/HbJmyy1xQ5AEJg==",
6+
"agentHubStorageConnectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=acsagenthubrhw;AccountKey=zPARow+zF74cCGlsfiQE9rMDSE4I7iTteDqNyuPbmk8p2g57LbYITrH6P9OoP3enPm2R5OgU6Y0Q+AStKFFQ4A==",
7+
"acsConnectionString": "endpoint=https://acsagenthubrhwacs.communication.azure.com/;accesskey=GK23bSvJMBQUqXpwUit84nLlyhCQg3unqP0PiNCw23VXCe/khyjD112xPfwO92rHzLdcgsZWQWYxNt11eMXfyw==",
88
"botBaseAddress": "http://localhost:3980/",
99
"useACSManagedIdentity": "false",
10-
"webPusSubConnectionString": "Endpoint=https://acsagenthubrhwwps.webpubsub.azure.com;AccessKey=IIKkVIPszyVZtSEmvAzLTSObrd8wNVub/KIZoCHImXY=;Version=1.0;",
10+
"webPusSubConnectionString": "Endpoint=https://acsagenthubrhwwps.webpubsub.azure.com;AccessKey=1uzqaDhRx4xCesM8Qg9E5hZU44Y0OfybHaq6Hj0m0qA=;Version=1.0;",
1111
"webPubSubHubName": "refreshConversations"
1212
},
1313
"Host": {

‎ACSConnector/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ In PowerShell, change the current directory to the root solution folder (i.e., t
2626
that contains the ACSAgentHub.sln file). Then run the following script to deploy and
2727
configure all the services required by the ACS Agent Hub:
2828
```
29-
.\Deployment\Scripts\deploy_and_configure.ps1 -hubName <hub name> -resourceGroup <resource group> $ngrokFullPath <ngrok path> -location <location name> -NuGetFullPath <nuget path>
29+
.\Deployment\Scripts\deploy_and_configure.ps1 -hubName <hub name> -resourceGroup <resource group> -ngrokFullPath <ngrok path> -location <location name> -NuGetFullPath <nuget path>
3030
```
3131
where:
3232
- **\<hub name>** is the name of your agent hub which will also be used as part of the name of

‎Deployment/Scripts/deploy_and_configure.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ if ($configurationOnly.ToLower() -eq "false") {
121121

122122
# Step 5 - Create Tunnel to Agent Hub
123123
Write-Host "Creating Tunnel to Agent Hub" -NoNewline -ForegroundColor Green
124-
start -FilePath $ngrokFullPath -ArgumentList "http 7071 -host-header=localhost:7071" -WindowStyle Minimized
124+
if ($showCommands.ToLower() -eq "true") { Write-Host ''; Write-Host "start -FilePath $ngrokFullPath -ArgumentList ""http 7071 --host-header=localhost:7071"" -WindowStyle Minimized" }
125+
start -FilePath $ngrokFullPath -ArgumentList "http 7071 --host-header=localhost:7071" -WindowStyle Minimized
125126

126127
if ($?) {Write-Host " - Done." -ForegroundColor Green} else {Write-Host " - Failed" -ForegroundColor Green; $errCnt++}
127128

@@ -131,6 +132,7 @@ Start-Sleep -s 15 2>> "$logFile" | Out-Null
131132
# Step 6 - Subscribe to ACS Message Event
132133
# No need for Write-Host progress update since update_webhook.ps1 reports its own status
133134
# Frist, query ngrok and turn JSON result into object that we can use to get https endpoint
135+
if ($showCommands.ToLower() -eq "true") { Write-Host ''; Write-Host "$ngrokResult = curl http://127.0.0.1:4040/api/tunnels 2>> ""$logFile""" }
134136
$ngrokResult = curl http://127.0.0.1:4040/api/tunnels 2>> "$logFile"
135137
$ngrok = ConvertFrom-Json $ngrokResult
136138

‎README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ Services, you can have an agent escalation capability up and working in 15 minut
1111
The deployment scripts require Powershell 7 which can be downloaded [here](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2)
1212

1313
#### Ngrok
14-
To install ngrok, follow instructions [here](https://ngrok.com/download)
14+
To install ngrok v3, follow instructions [here](https://ngrok.com/download) or to upgrade your existing ngrok version, follow
15+
the instructions [here](https://ngrok.com/docs/guides/upgrade-v2-v3). The previous version of the deployment scripts used
16+
single dashes for ngrok command line flags which now fail in ngrok v3 per the "Breaking Changes" section on the ngrok site
17+
[here](https://ngrok.com/docs/guides/upgrade-v2-v3) so those deployment scripts have been updated to use double dash flags
18+
which may or may not work with older versions of ngrok (e.g., c:\ngrok\ngrok http 7071 --host-header=localhost:7071)
1519

1620
#### Azure CLI
1721
The deployment scripts require Azure CLI version 2.22.0 or newer. You can check which version of the Azure CLI you have

‎agent-portal/src/components/ChatPanel.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import './ChatPanel.css';
33
import React, { FC } from 'react';
44
import { useEffect, useState, useContext } from 'react';
55
import { ChatAdapter, ChatComposite, createAzureCommunicationChatAdapter } from '@azure/communication-react';
6+
import { AzureCommunicationTokenCredential } from '@azure/communication-common';
67

7-
import { Conversation, ConversationStatus, Agent } from './Models'
8+
import { Conversation, ConversationStatus, Agent } from './Models';
89
import { addAgentToThread } from '../services/agents';
910

1011
import { getAgentAccessContext } from '../services/accessContext';
11-
import { ApplicationContext, ApplicationContextConsumer } from './ApplicationContext'
12+
import { ApplicationContext, ApplicationContextConsumer } from './ApplicationContext';
1213

1314
const ChatPanel: FC = () => {
1415
// Creating an adapter is asynchronous.
@@ -32,8 +33,14 @@ const ChatPanel: FC = () => {
3233
if (showChat(applicationContext!.currentConversation!) == true) {
3334
addAgentToThread(applicationContext!.currentConversation!.threadId!, applicationContext!.agent!.name).then(() => {
3435
getAgentAccessContext().then(agentAccessContext => {
35-
createAzureCommunicationChatAdapter(agentAccessContext.token, agentAccessContext.endPoint, applicationContext!.currentConversation!.threadId, applicationContext!.agent!.name).then(adapter => {
36-
setAdapter(adapter);
36+
createAzureCommunicationChatAdapter({
37+
endpoint: agentAccessContext.endPoint,
38+
displayName: applicationContext!.agent!.name,
39+
threadId: applicationContext!.currentConversation!.threadId,
40+
userId: { communicationUserId: applicationContext!.currentConversation!.agentId },
41+
credential: new AzureCommunicationTokenCredential(agentAccessContext.token)
42+
}).then(adapter => {
43+
setAdapter(adapter);
3744
});
3845
});
3946
});
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// App settings for the agent-portal
22
export const appsettings = {
33
agentHubBaseAddress: 'http://localhost:7071',
4-
webPusSubConnectionString: 'Endpoint=https://acsagenthubrhwwps.webpubsub.azure.com;AccessKey=IIKkVIPszyVZtSEmvAzLTSObrd8wNVub/KIZoCHImXY=;Version=1.0;',
4+
webPusSubConnectionString: 'Endpoint=https://acsagenthubrhwwps.webpubsub.azure.com;AccessKey=1uzqaDhRx4xCesM8Qg9E5hZU44Y0OfybHaq6Hj0m0qA=;Version=1.0;',
55
webPubSubHubName: 'refreshConversations'
66
};

0 commit comments

Comments
 (0)
Please sign in to comment.