1
0
Форкнуть 0
This commit is contained in:
Sander van Leeuwen 2022-10-06 18:00:51 +02:00
Родитель 9544f24775
Коммит 59bcde587e
3 изменённых файлов: 16 добавлений и 50 удалений

Просмотреть файл

@ -12,10 +12,11 @@ products:
[![Deploy To Azure US Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fcommunication-services-pstn-calling%2Fmain%2Fdeploy%2Fazuredeploy.json)
[![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fcommunication-services-pstn-calling%2Fmain%2Fdeploy%2Fazuredeploy.json)
#
# PSTN Calling Example
This is a sample application to show how one can use the `azure@communication-calling` package to build a calling experience.
The client-side application is a React based user interface. Alongside this front-end is a NodeJS web server application powered by ExpressJS that performs functionality like minting new user tokens for each Client participant. This separate server is necessary as you do not not want to make the **connection string** public, which gives everyone access to your Azure Communication Service resource.
This is a sample application to show how one can setup a calling architecture and setup SIP trunks using the [`Azure.Communication.PhoneNumbers`](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers) SDK.
Also, it showcases how the [`Azure.Communication.CallingServer`](https://www.nuget.org/packages/Azure.Communication.CallingServer) can be used to support inbound calling. Lastly, [`azure@communication-calling`](https://www.npmjs.com/package/@azure/communication-calling) package is be used to build the a calling experience.
The client-side application is a Typescript React based user interface. Alongside this front-end is a C# ASP Core web server application that generates new user tokens, gets and sets sip trunk configurations and voice routes, redirects inbound calls to the client application, and retrieves purchased phone numbers for each Client participant. This separate server is necessary as you do not not want to make the **connection string** public, which gives everyone access to your Azure Communication Service resource.
## Prerequisites
@ -27,31 +28,29 @@ The client-side application is a React based user interface. Alongside this fron
## Code structure
- [`./Client/src`](./Client/src): Where the client code lives
- [`./Client/src/app/App.jsx`](./Client/src/app/App.jsx): Entry point into the Client sample
- [`./Server/src/`](./Server/src/): Where the server code lives.
- [`./Client/src/app/App.tsx`](./Client/src/app/App.tsx): Entry point into the Client sample
- [`./Server/`](./Server/src/): Where the C# ASP Core server code lives.
- [`./Server/src/app.ts`](./Server/src/app.ts): Entry point into the Server sample
- [`./Server/appsettings.json`](./Server/appsettings.json): Where to put your azure communication services connection string
- [`./deploy`](./deploy/): Bicep and ARM templates for automatic deployment of this app to an Azure AppService.
- [`./deploy/azuredeploy.bicep`](./deploy/azuredeploy.bicep): Bicep file for deployment of this app (creates a new Azure Communication Resource).
- [`./deploy/existing_resources/azuredeploy.bicep`](./deploy/existing_resources/azuredeploy.bicep): Bicep file for deployment of this app (connects to an existing Azure Communication Resource)
## Before running the sample for the first time
1. Open an instance of PowerShell, Windows Terminal, Command Prompt or equivalent and navigate to the directory that you'd like to clone the sample to.
2. `git clone https://github.com/t-sanderv/communication-services-web-calling-tutorial`
3. `cd communication-services-web-calling-tutorial/Project`
4. Get a connection string by creating an Azure Communication Services resource from the Azure portal. Use the connection string as value for key `ResourceConnectionString` in `Server/appsettings.json` file.
3. `cd communication-services-web-calling-tutorial`
4. Get a connection string by creating an Azure Communication Services resource from the Azure portal. Use the connection string as value for key `ConnectionString` in `Server/appsettings.json` file.
## Local Run
1. Set your connection string in `Server/appsettings.json`
2. `npm run setup` from the root directory
3. `npm run start` from the root directory
4. Open `http://localhost:9000` in a browser. (Supported browsers are Chrome, Edge Chromium, and Safari)
## Publish to Azure
1. `npm run setup`
2. `npm run build`
3. `npm run package`
4. Use the Azure extension and deploy the Client/dist directory to your app service
2. Open [`Server/PSTNServerApp.csproj`](Server/PSTNServerApp.csproj) with Visual Studio
3. Click `IIS Express` to start the server-side app.
4. Run `npm install` from the `Client` directory
5. Run `npm run start` from the `Client` directory
6. Open `http://localhost:5000` in a browser. (Supported browsers are Chrome, Edge Chromium, and Safari)
## Resources

Просмотреть файл

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSTNServerApp", "PSTNServerApp.csproj", "{FBBD0A41-DAF9-4DC9-BCDA-228C39A4ED5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FBBD0A41-DAF9-4DC9-BCDA-228C39A4ED5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBBD0A41-DAF9-4DC9-BCDA-228C39A4ED5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBBD0A41-DAF9-4DC9-BCDA-228C39A4ED5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBBD0A41-DAF9-4DC9-BCDA-228C39A4ED5C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1C8ABFD0-3DB0-4861-9396-5E8C81095ED5}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,8 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}