Skip to content

Commit dfa66f6

Browse files
authored
Merge pull request #1 from Bandwidth-Samples/v1
SWI-3542 Clean up for V1 Release
2 parents e8182b5 + 2d8f92d commit dfa66f6

File tree

6 files changed

+10
-48
lines changed

6 files changed

+10
-48
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Bandwidth Samples
3+
Copyright (c) 2023 Bandwidth Samples
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Logo Icon.png

-1.21 KB
Binary file not shown.

README.md

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@
66
* [Pre-Requisites](#pre-requisites)
77
* [Running the Application](#running-the-application)
88
* [Environmental Variables](#environmental-variables)
9-
* [Callback URLs](#callback-urls)
10-
* [Ngrok](#ngrok)
119

1210
# Description
1311

14-
A short description of your sample app and its capabilities.
12+
A simple dial pad application used to create calls using our WebRTC SDK.
1513

1614
# Pre-Requisites
1715

18-
In order to use the Bandwidth API users need to set up the appropriate application at the [Bandwidth Dashboard](https://dashboard.bandwidth.com/) and create API tokens.
19-
20-
To create an application log into the [Bandwidth Dashboard](https://dashboard.bandwidth.com/) and navigate to the `Applications` tab. Fill out the **New Application** form selecting the service (Messaging or Voice) that the application will be used for. All Bandwidth services require publicly accessible Callback URLs, for more information on how to set one up see [Callback URLs](#callback-urls).
16+
In order to use this sample app, your account must have In-App Calling enabled. You will also have to generate an auth token using our Identity API.
2117

2218
For more information about API credentials see our [Account Credentials](https://dev.bandwidth.com/docs/account/credentials) page.
2319

@@ -26,40 +22,14 @@ For more information about API credentials see our [Account Credentials](https:/
2622
Use the following command/s to run the application:
2723

2824
```sh
29-
# start command here
25+
yarn start
3026
```
3127

3228
# Environmental Variables
3329

3430
The sample app uses the below environmental variables.
3531

3632
```sh
37-
BW_ACCOUNT_ID # Your Bandwidth Account Id
38-
BW_USERNAME # Your Bandwidth API Username
39-
BW_PASSWORD # Your Bandwidth API Password
40-
BW_NUMBER # The Bandwidth phone number involved with this application
41-
USER_NUMBER # The user's phone number involved with this application
42-
BW_VOICE_APPLICATION_ID # Your Voice Application Id created in the dashboard
43-
BW_MESSAGING_APPLICATION_ID # Your Messaging Application Id created in the dashboard
44-
BASE_CALLBACK_URL # Your public base url to receive Bandwidth Webhooks. No trailing '/'
45-
LOCAL_PORT # The port number you wish to run the sample on
46-
```
47-
48-
# Callback URLs
49-
50-
For a detailed introduction, check out our [Bandwidth Product Specific Callbacks](https://dev.bandwidth.com/docs/messaging/webhooks) page.
51-
52-
Below are the callback paths:
53-
* **Should follow `/callbacks/{direction}/{service}` conventions**
54-
* `<add other callbacks>`
55-
56-
## Ngrok
57-
58-
A simple way to set up a local callback URL for testing is to use the free tool [ngrok](https://ngrok.com/).
59-
After you have downloaded and installed `ngrok` run the following command to open a public tunnel to your port (`$LOCAL_PORT`)
60-
61-
```sh
62-
ngrok http $LOCAL_PORT
33+
REACT_APP_IN_APP_CALLING_TOKEN # You Identity Token
34+
REACT_APP_IN_APP_CALLING_NUMBER # A valid phone number on your account
6335
```
64-
65-
You can view your public URL at `http://127.0.0.1:{LOCAL_PORT}` after ngrok is running. You can also view the status of the tunnel and requests/responses here.

public/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
name="In-App Calling Dialpad Sample App"
1010
content=""
1111
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1312
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined"
1413
rel="stylesheet">
1514
<!--

src/components/DialPad.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import { BandwidthUA } from "@bandwidth/bw-webrtc-sdk";
1010
import { useStopwatch } from 'react-timer-hook';
1111

1212
export default function DialPad() {
13-
const authToken = process.env.REACT_APP_IDENTITY_TOKEN;
14-
const defaultSourceNumber = process.env.BW_NUMBER; //?.replace(/\D/g, "");
15-
console.log(defaultSourceNumber)
13+
const authToken = process.env.REACT_APP_IN_APP_CALLING_TOKEN;
14+
const defaultSourceNumber = process.env.REACT_APP_IN_APP_CALLING_NUMBER;
1615
const destinationNumberNote = "Call international or domestic. Include area code and country code, but don't add the '+'";
1716
const sourceNumberNote = "Enter a number on your BW account. Include area code and country code, but don't add the '+'";
1817
const {
@@ -26,7 +25,7 @@ export default function DialPad() {
2625
} = useStopwatch({ autoStart: false });
2726

2827
const [destNumber, setDestNumber] = useState('');
29-
const [sourceNumber, setSourceNumber] = useState(`${defaultSourceNumber}`); // TODO: grab this from an env variable
28+
const [sourceNumber, setSourceNumber] = useState(`${defaultSourceNumber}`);
3029
const [destNumberValid, setDestNumberValid] = useState(false);
3130
const [allowHangup, setAllowHangup] = useState(false);
3231
const [phone, setPhone] = useState(new BandwidthUA());
@@ -51,7 +50,7 @@ export default function DialPad() {
5150
serverConfig.iceServers
5251
);
5352

54-
newPhone.setOAuthToken(authToken); // TODO: get this from the identity api
53+
newPhone.setOAuthToken(authToken);
5554
setPhone(newPhone);
5655
},[authToken]);
5756

@@ -62,10 +61,7 @@ export default function DialPad() {
6261
switch ('cause' + cause) {
6362
case "connected":
6463
console.log("phone>>> loginStateChanged: connected");
65-
6664
setWebrtcStatus({ color: 'var(--green50)', text: "Connected to WebRTC Service" });
67-
68-
6965
break;
7066
case "disconnected":
7167
console.log("phone>>> loginStateChanged: disconnected");

src/logo.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)