Skip to content

Commit 79f6e79

Browse files
authored
Merge pull request #301 from Azure-Samples/v-durgesh/feature/js-connect-rooms-quickstart
callautomation-connect-rooms initial changes.
2 parents fc7da86 + 46801f5 commit 79f6e79

File tree

13 files changed

+410
-0
lines changed

13 files changed

+410
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PORT=8080
2+
CONNECTION_STRING="<YOUR_CONNECTION_STRING>"
3+
ACS_RESOURCE_PHONE_NUMBER ="<YOUR_ACS_NUMBER>"
4+
TARGET_PHONE_NUMBER="<+1XXXXXXXXXX>"
5+
CALLBACK_URI="<VS_TUNNEL_URL>"
6+
COGNITIVE_SERVICES_ENDPOINT="<COGNITIVE_SERVICES_ENDPOINT>"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Ignore node_modules directory
2+
node_modules/
3+
4+
# Ignore environment variables file
5+
.env
6+
7+
# Ignore build output directory
8+
dist/
9+
build/
10+
public/assets/
11+
12+
# Ignore IDE/Editor-specific files
13+
.vscode/
14+
.vs
15+
.idea/
16+
17+
# Ignore user-specific configuration files
18+
.npmrc
19+
.gitconfig
20+
21+
# Ignore log files
22+
*.log
23+
24+
# Ignore OS-generated files
25+
.DS_Store
26+
Thumbs.db
27+
28+
# Ignore package lock files
29+
package-lock.json
30+
yarn.lock
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
|page_type|languages|products
3+
|---|---|---|
4+
|sample|<table><tr><td>Typescript</tr></td></table>|<table><tr><td>azure</td><td>azure-communication-services</td></tr></table>|
5+
6+
# Connect to a room call using Call Automation SDK
7+
8+
In this quickstart sample, we cover how you can use Call Automation SDK to connect to an active Azure Communication Services (ACS) Rooms call with a connect endpoint.
9+
This involves creating a room call with room id and users and enabling PSTN dial out to add PSTN participant(s).
10+
11+
## Prerequisites
12+
13+
- Create an Azure account with an active subscription. For details, see [Create an account for free](https://azure.microsoft.com/free/)
14+
- [Visual Studio Code](https://code.visualstudio.com/download) installed
15+
- [Node.js](https://nodejs.org/en/download) installed
16+
- Create an Azure Communication Services resource. For details, see [Create an Azure Communication Resource](https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource). You will need to record your resource **connection string** for this sample.
17+
- Get a phone number for your new Azure Communication Services resource. For details, see [Get a phone number](https://learn.microsoft.com/azure/communication-services/quickstarts/telephony/get-phone-number?tabs=windows&pivots=programming-language-csharp)
18+
19+
- To know about rooms see https://learn.microsoft.com/en-us/azure/communication-services/concepts/rooms/room-concept
20+
- To join room call see https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/rooms/join-rooms-call?pivots=platform-web
21+
22+
## Before running the sample for the first time
23+
24+
1. Open an instance of PowerShell, Windows Terminal, Command Prompt or equivalent and navigate to the directory that you would like to clone the sample to.
25+
2. git clone `https://github.com/Azure-Samples/communication-services-javascript-quickstarts.git`.
26+
3. cd into the `callautomation-connect-rooms-quickstart` folder.
27+
4. From the root of the above folder, and with node installed, run `npm install`
28+
29+
## Before running calling rooms quickstart
30+
1. To initiate rooms call with room id https://github.com/Azure-Samples/communication-services-javascript-quickstarts/tree/main/calling-rooms-quickstart
31+
2. cd into the `calling-rooms-quickstart` folder.
32+
3. From the root of the above folder, and with node installed, run `npm install`
33+
4. to run sample `npx webpack serve --config webpack.config.js`
34+
35+
### Setup and host your Azure DevTunnel
36+
37+
[Azure DevTunnels](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) is an Azure service that enables you to share local web services hosted on the internet. Use the commands below to connect your local development environment to the public internet. This creates a tunnel with a persistent endpoint URL and which allows anonymous access. We will then use this endpoint to notify your application of calling events from the ACS Call Automation service.
38+
39+
```bash
40+
devtunnel create --allow-anonymous
41+
devtunnel port create -p 8080
42+
devtunnel host
43+
```
44+
45+
### Configuring application
46+
47+
Open the `.env` file to configure the following settings
48+
49+
1. `CONNECTION_STRING`: Azure Communication Service resource's connection string.
50+
2. `ACS_RESOURCE_PHONE_NUMBER`: Phone number associated with the Azure Communication Service resource. For e.g. "+1425XXXAAAA"
51+
3. `TARGET_PHONE_NUMBER`: Target phone number to add in the call. For e.g. "+1425XXXAAAA"
52+
4. `CALLBACK_URI`: Base url of the app. (For local development replace the dev tunnel url)
53+
5. `COGNITIVE_SERVICES_ENDPOINT` : Cognitive service endpoint.
54+
55+
### Run app locally
56+
57+
1. Open a new Powershell window, cd into the `callautomation-connect-rooms-quickstart` folder and run `npm run dev`
58+
2. Browser should pop up with the below page. If not navigate it to `http://localhost:8080/`
59+
3. To connect rooms call, click on the `Connect a call!` button or make a Http get request to https://<CALLBACK_URI>/connectCall
60+
61+
### Creating and connecting to room call.
62+
63+
1. Navigate to `http://localhost:8080/` or devtunnel url to create users and room id ![create room with user](./data/createRoom.png)
64+
2. Open two tabs for Presenter and attendee ![calling room quickstart](./data/callingRoomQuickstart.png)
65+
3. Copy tokens for presenter and attendee from ![tokens](./data/tokens.png)
66+
4. Initialize call agent with tokens for both presenter and attendee.
67+
5. Take room id ![room id](./data/roomId.png) and initiate rooms call for both users. ![join room call](./data/joinRoomCall.png)
68+
6. Connect room call with call automation connect call endpoint. ![connect room call](./data/connectCall.png)
69+
70+
50 KB
Loading
180 KB
Loading
232 KB
Loading
54.6 KB
Loading
182 KB
Loading
183 KB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "callautomation_connect_rooms",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "tsc",
8+
"dev": "nodemon ./src/app.ts"
9+
},
10+
"keywords": [],
11+
"author": "",
12+
"license": "ISC",
13+
"dependencies": {
14+
"@azure/communication-call-automation": "^1.3.0",
15+
"@azure/communication-common": "^2.2.0",
16+
"@azure/communication-identity": "^1.3.1",
17+
"@azure/communication-rooms": "^1.1.1",
18+
"@azure/eventgrid": "^4.12.0",
19+
"@types/express": "^4.17.17",
20+
"@types/node": "^20.2.1",
21+
"dotenv": "^16.0.3",
22+
"express": "^4.18.2"
23+
},
24+
"devDependencies": {
25+
"nodemon": "^2.0.22",
26+
"ts-node": "^10.9.1",
27+
"typescript": "^5.0.4"
28+
}
29+
}

0 commit comments

Comments
 (0)