Skip to content

Commit 31bb0a0

Browse files
author
Russ Williams
committedOct 22, 2021
Fixed "server refused connection" error from change in port the bot was running on (was 3978 with SDK bots and it 3980 with Composer). When the port is wrong, the agent hub can't find the bot's MessageToBot endpoint which the ACSConnector add to the Composer bot
1 parent 307c200 commit 31bb0a0

19 files changed

+120
-17
lines changed
 

‎ACSConnector/ACSConnector.csproj

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<Authors>Russ Williams</Authors>
2020
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2121
<PackageLicenseExpression>MIT</PackageLicenseExpression>
22-
<PackageProjectUrl>http://aka.ms/corptex</PackageProjectUrl>
23-
<RepositoryUrl>http://aka.ms/corptex</RepositoryUrl>
22+
<PackageProjectUrl>http://aka.ms/acshub#adding-escalation-to-your-bot</PackageProjectUrl>
23+
<RepositoryUrl>http://aka.ms/acshub#adding-escalation-to-your-bot</RepositoryUrl>
2424
<PackageIcon>Agent.png</PackageIcon>
2525
<PackageIconUrl />
2626
<RepositoryType>GitHub</RepositoryType>
@@ -38,12 +38,15 @@
3838
<Pack>True</Pack>
3939
<PackagePath></PackagePath>
4040
</None>
41-
<None Include="README.md" Condition="Exists('README.md')" Pack="true" PackagePath="" />
41+
<None Include="doc/CreatingLocalFeed.png">
42+
<Pack>True</Pack>
43+
<PackagePath></PackagePath>
44+
</None>
45+
<None Include="README.md" Condition="Exists('README.md')" Pack="true" PackagePath="" />
4246
</ItemGroup>
4347

4448

4549
<ItemGroup>
46-
<PackageReference Include="Microsoft.Azure.EventGrid" Version="3.2.0" />
4750
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.13.1" />
4851
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.8" />
4952
</ItemGroup>

‎ACSConnector/Controllers/ACSController.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using ACSAgentHubSDK.Models;
22
using ACSConnector.Models;
33
using Microsoft.AspNetCore.Mvc;
4-
using Microsoft.Azure.EventGrid;
5-
using Microsoft.Azure.EventGrid.Models;
64
using Microsoft.Bot.Builder;
75
using Microsoft.Bot.Builder.Integration.AspNet.Core;
86
using Microsoft.Bot.Connector;

‎ACSConnector/README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# ACS Agent Hub
2-
The ACS Agent Hub package implements agent escalation and makes it extremely simple to
3-
add a human handoff capability to any bot.
2+
This package integrates with a ready-made agent hub solution built on the Azure Communication Service that allows
3+
you to add human handoff experiences to your bot. Super simple to use, just add a Send Handoff Activity to your
4+
dialog and the ACSConnector takes care of the rest. Escalations will be sent to a ready-made agent hub that you
5+
clone from GitHub which allows multiple agents to handle multiple simultaneous conversations with bot users.
6+
Because it's built purely from Azure Services, you can have an agent escalation capability up and working in 15
7+
minutes or so.
48

59
### Prerequisites
610
Successful use of this package requires the installation of a set of prerequisites so if you haven't installed them
711
yet, browse the the [ACS Agent Hub Prerequisites](http://aka.ms/acshub#prerequisites) and install them
812

9-
### <a name="GettingStarted"></a>Getting Started
13+
### Getting Started
1014

1115
Getting started couldn't be easier. Simply clone the ACS Agent Hub repo and run a single deployment script and
1216
you're ready to run add escalation to your bot. There are a variety of escalation scenarios you can support and
@@ -32,7 +36,7 @@ other services created by this script
3236
- **\<location name>** is the Azure location name of the region that services will be deployed in
3337
- **\<nuget path>** is the full path to the nuget.exe (e.g., c:\nuget\nuget.exe)
3438

35-
### <a name="ExploreEscalationScenarios"></a>Explore Escalation Scenarios
39+
### Explore Escalation Scenarios
3640
To make it easy for you to quickly experiment with the ACS Agent Hub we've included sample applications that are all
3741
ready to go. All you need to do to try it out is to open the Bot Framework Composer and select the **Open** link on
3842
the Home tab and open the ComposerExample that's in the root folder of the solution. This is a very simple bot with
@@ -42,7 +46,7 @@ when the bot finishes it's startup processing. Type, _**talk to human**_ to sta
4246
a short [demo video](http://add-demo-here) you can watch that shows all these steps and various escalation and agent
4347
management scenaios you can replicate using this sample app.
4448

45-
### <a name="AddingEscalationToYourBot"></a>Adding Escalation to Your Bot
49+
### Adding Escalation to Your Bot
4650
The sample is nice for quickly experimenting with escalation and taking a look at how it's coded, but it doesn't
4751
address how to add escalation to bots. The good news is that adding agent escalation to a Composer bot is very
4852
simple and only involves a few steps. The following steps are shown in a very short video
@@ -51,7 +55,7 @@ simple and only involves a few steps. The following steps are shown in a very s
5155
1) **Install Agent Hub Package** - First, create a local feed and set its URL property to the full path of the
5256
.\ACSConnector\localFeed folder so Composer will know where find the package and second, add the ACSConnector package
5357
to your bot as shown in the following screen shots, respectively<br>
54-
![High-level Subsystem Overview](doc/CreatingLocalFeed.png)<br>
58+
![High-level Subsystem Overview](CreatingLocalFeed.png)<br>
5559
![High-level Subsystem Overview](doc/InstallingACSConnector.png)
5660
2) **Set App Setting** - Paste the following at the top of the bot's appsettings.json file:<br>
5761
```

‎ACSConnector/doc/AppSettings.png

78.5 KB
Loading
92 KB
Loading

‎ACSConnector/doc/EscalateAction.png

35 KB
Loading
55.3 KB
Loading
95.7 KB
Loading
1.09 MB
Loading
52.8 KB
Loading
179 KB
Loading
40.8 KB
Loading
12.9 KB
Loading
Loading

‎ACSConnector/doc/ngrokEndpoint.png

36.8 KB
Loading

‎Deployment/Scripts/create_agent_hub_appsettings.ps1

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Param(
77
[string] $wpsConnectionString,
88
[string] $storageConnectionString,
99
[string] $resourceGroup,
10+
[string] $botBaseAddress = "http://localhost:3980/", # port 3978 is VA Template bots... port 3980 is Composer bots
1011
[string] $showCommands = "false"
1112
)
1213

@@ -18,7 +19,7 @@ $acsAgentHubLocalSettings = Get-Content $acsAgentHubAppSettingFile -Encoding UTF
1819

1920
$acsAgentHubLocalSettings.Values.agentHubStorageConnectionString = $storageConnectionString
2021
$acsAgentHubLocalSettings.Values.acsConnectionString = $acsConnectionString
21-
$acsAgentHubLocalSettings.Values.botBaseAddress = "http://localhost:3978/"
22+
$acsAgentHubLocalSettings.Values.botBaseAddress = $botBaseAddress
2223
$acsAgentHubLocalSettings.Values.useACSManagedIdentity = "false"
2324
$acsAgentHubLocalSettings.Values.webPusSubConnectionString = $wpsConnectionString
2425
$acsAgentHubLocalSettings.Values.webPubSubHubName = "refreshConversations"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<#
2+
This is a multi-line comment syntax
3+
#>
4+
5+
#Requires -Version 6
6+
7+
Param(
8+
[string] $NuGetFullPath,
9+
[string] $connectorPackageVersion = "1.0.0",
10+
[string] $showCommands = "false",
11+
[string] $projDir = $(Get-Location),
12+
[string] $logFile = $(Join-Path $PSScriptRoot .. "deploy_log.txt" -Resolve)
13+
)
14+
15+
# Reset log file
16+
if (Test-Path $logFile) {
17+
Clear-Content $logFile -Force | Out-Null
18+
}
19+
else {
20+
New-Item -Path $logFile | Out-Null
21+
}
22+
23+
# Check for AZ CLI and confirm version
24+
if (Get-Command az -ErrorAction SilentlyContinue) {
25+
$azcliversionoutput = az -v
26+
[regex]$regex = '(\d{1,3}.\d{1,3}.\d{1,3})'
27+
[version]$azcliversion = $regex.Match($azcliversionoutput[0]).value
28+
[version]$minversion = '2.2.0'
29+
30+
if ($azcliversion -ge $minversion) {
31+
$azclipassmessage = "AZ CLI passes minimum version. Current version is $azcliversion"
32+
Write-Debug $azclipassmessage
33+
$azclipassmessage | Out-File -Append -FilePath $logfile
34+
}
35+
else {
36+
$azcliwarnmessage = "You are using an older version of the AZ CLI, `
37+
please ensure you are using version $minversion or newer. `
38+
The most recent version can be found here: http://aka.ms/installazurecliwindows"
39+
Write-Warning $azcliwarnmessage
40+
$azcliwarnmessage | Out-File -Append -FilePath $logfile
41+
}
42+
}
43+
else {
44+
$azclierrormessage = 'AZ CLI not found. Please install latest version.'
45+
Write-Error $azclierrormessage
46+
$azclierrormessage | Out-File -Append -FilePath $logfile
47+
}
48+
49+
if (-not (Test-Path (Join-Path $projDir 'ACSAgentHub.sln' -Resolve)))
50+
{
51+
Write-Host "! Could not find the 'ACSAgentHub.sln' file in the current directory." -ForegroundColor Red
52+
Write-Host "+ Please re-run this script from root of the solution directory." -ForegroundColor Magenta
53+
Break
54+
}
55+
56+
# Get mandatory parameters
57+
58+
if (-not $NuGetFullPath) {
59+
$NuGetFullPath = Read-Host "? Full path to nuget.exe (e.g., c:\nuget\nuget.exe):"
60+
}
61+
62+
if (-not $connectorPackageVersion) {
63+
$connectorPackageVersion = Read-Host "? Package version (e.g., 1.0.0):"
64+
}
65+
66+
if (-not $NuGetFullPath) {
67+
$NuGetFullPath = Read-Host "? Full path to nuget.exe"
68+
}
69+
70+
# Get timestamp
71+
$startTime = Get-Date
72+
73+
# Create local NuGet feed for ACSConnector
74+
Write-Host "Creating local NuGet feed for ACSConnector" -NoNewline -ForegroundColor Green
75+
$acsConnectorNuGetPackage = Join-Path $PSScriptRoot ..\..\ "ACSConnector\bin\Debug\ACSConnector.$connectorPackageVersion.nupkg" -Resolve
76+
$acsAgentHubSDKNuGetPackage = Join-Path $PSScriptRoot ..\.. "ACSAgentHubSDK\bin\Debug\ACSAgentHubSDK.$connectorPackageVersion.nupkg" -Resolve
77+
$acsConnectorLocalFeedFolder = join-Path $PSScriptRoot ..\..\ "ACSConnector\localFeed" -Resolve
78+
# First, create folder for local NuGet feed
79+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "mkdir -Force $acsConnectorLocalFeedFolder"}
80+
mkdir -Force $acsConnectorLocalFeedFolder
81+
82+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "$NuGetFullPath delete ACSAgentHubSDK $connectorPackageVersion -Source $acsConnectorLocalFeedFolder -NonInteractive " }
83+
& $NuGetFullPath delete ACSAgentHubSDK $connectorPackageVersion -Source $acsConnectorLocalFeedFolder -NonInteractive
84+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "$NuGetFullPath delete ACSConnector $connectorPackageVersion -Source $acsConnectorLocalFeedFolder -NonInteractive " }
85+
& $NuGetFullPath delete ACSConnector $connectorPackageVersion -Source $acsConnectorLocalFeedFolder -NonInteractive
86+
87+
# Next, clear all NuGet caches in case we are overwriting existing versions of existing NuGet packages (this can cause runtime startup issues in Composer)
88+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "$NuGetFullPath locals all -clear" }
89+
& $NuGetFullPath locals all -clear
90+
91+
# Next, add ACSConnector and its dependencies to local NuGet feed
92+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "$NuGetFullPath add $acsAgentHubSDKNuGetPackage -Source $acsConnectorLocalFeedFolder" }
93+
& $NuGetFullPath add $acsAgentHubSDKNuGetPackage -Source $acsConnectorLocalFeedFolder
94+
if ($showCommands.ToLower() -eq "true") {Write-Host ''; Write-Host "$NuGetFullPath add $acsConnectorNuGetPackage -Source $acsConnectorLocalFeedFolder" }
95+
& $NuGetFullPath add $acsConnectorNuGetPackage -Source $acsConnectorLocalFeedFolder

‎Deployment/Scripts/deploy_and_configure.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if ($configurationOnly.ToLower() -eq "false") {
7878
Write-Host "Starting Agent Hub service" -NoNewline -ForegroundColor Green
7979
# First, change working directory to the ACSAgentHub project folder
8080
Set-Location $ACSAgentHubPath
81-
start -FilePath "func" -ArgumentList "start" -WindowStyle Minimized
81+
start -FilePath "func" -ArgumentList "start --csharp" -WindowStyle Minimized
8282
# Sleep before continuing to ensure Function App time is fully up and running or else Create Agent Account step will fail
8383
if ($configurationOnly.ToLower() -eq "false") {
8484
Start-Sleep -s 120

‎README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# ACS Agent Hub
2-
The sample uses the Azure Communication Service and Azure Bot Service to implement a
3-
contact center "call deflection" pattern where multiple agents can simultaneously engage
4-
with multiple customers in a ready-made agent portal that's also included in the solution
2+
This package integrates with a ready-made agent hub solution built on the Azure Communication Service that allows you to
3+
add human handoff experiences to your bot. Super simple to use, just add a Send Handoff Activity to your dialog and the
4+
ACSConnector takes care of the rest. Escalations will be sent to a ready-made agent hub that you clone from GitHub which
5+
allows multiple agents to handle multiple simultaneous conversations with bot users. Because it’s built purely from Azure
6+
Services, you can have an agent escalation capability up and working in 15 minutes or so.
57

68
### <a name="Prerequisites"></a>Prerequisites
79

0 commit comments

Comments
 (0)
Please sign in to comment.