-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carl Hartzell
committed
Jun 29, 2023
1 parent
6c5859c
commit e84db72
Showing
46 changed files
with
10,775 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
extends: [ | ||
'plugin:prettier/recommended', | ||
'plugin:security/recommended', | ||
], | ||
plugins: [ | ||
'html' | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
rules: { | ||
'prefer-const': 'error', | ||
'react/prop-types': 'off', | ||
'react/display-name': 'off', | ||
'security/detect-object-injection': 'off', | ||
'no-unused-vars': 2, | ||
'no-undef': 2, | ||
'prettier/prettier': 'off', | ||
'semi': 2 | ||
}, | ||
globals: { | ||
Cypress: true, | ||
RED: true, | ||
$: true | ||
}, | ||
env: { | ||
'amd': true, | ||
'node': true, | ||
'es6': true, | ||
'jest': true, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
with: | ||
release-type: node | ||
package-name: "@sinch/node-red-voice-api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.DS_Store | ||
.vscode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Contributing to @sinch/node-red-voice-api | ||
All contributions are welcome. Here are some guidelines you must follow. | ||
|
||
### Raising an issue | ||
Raise the issue on the project's issue tracker and make sure that the issue hasn't been raised before. | ||
Try to be as clear as possible in the description of your issue. | ||
Include what Node-RED version and node.js version you're running. | ||
Also, if possible, include a small example flow that can be used to reproduce the issue. | ||
|
||
### Feature request | ||
For now, features are requested by raising an issue on the project. | ||
|
||
### Pull request | ||
For pull-requests, make sure that the commit message follows the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) specification. | ||
If the pull-request relates to an issue, also include the issue number (#issuenumber) in the commit message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# @sinch/node-red-voice-api | ||
|
||
A package of nodes for [Node-RED](https://nodered.org) which allows you to connect, initiate and receive voice calls through the Sinch Voice API. For more information about the Sinch Voice API and how to get started, see the [documentation](https://developers.sinch.com/docs/voice/getting-started/). | ||
|
||
![Sinch Voice API](docs/images/sinch-voice-api-nodes.png) | ||
|
||
## Installation | ||
|
||
The first step is to install [Node-RED](https://nodered.org/docs/getting-started/local). | ||
|
||
``` | ||
$ sudo npm install -g node-red | ||
``` | ||
|
||
> Compatible with Node-Red version 3.x.x and later | ||
The second step is to install the package. You can either install it directly using the Palette Manager. Instructions can be found here: [Node-RED](https://nodered.org/docs/user-guide/runtime/adding-nodes). | ||
|
||
Or install manually using npm: | ||
|
||
Navigate to the Node-RED installation and install the package: | ||
|
||
``` | ||
$ cd ~/.node-red | ||
$ npm install @sinch/node-red-voice-api | ||
``` | ||
|
||
Run Node-RED locally: | ||
``` | ||
$ node-red | ||
``` | ||
|
||
This will start a server for Node-RED on [http://127.0.0.1:1880/](http://127.0.0.1:1880/). | ||
|
||
If the installation of the node package was successful, the Sinch Voice API nodes should be available in the node palette to the left, under the category "Sinch Voice". | ||
|
||
## Get started | ||
After you've installed Node-RED and the @sinch/node-red-voice-api package you can start building your flow. To get you started we provide an example [flows.json](docs/examples/flow.json) containing the essentials for initiating and receiving voice calls. To import the flows.json file, open Node-RED in the brower and select the hamburger menu in the top right corner. Choose "Import" and press "select a file to import". The flow file will then be imported on a tab called "Example flow". | ||
|
||
The flow.json contains two separate flow examples. For each of the flows there exists a comment node containing additional information about the configuration required to test it out. | ||
|
||
### Testing | ||
If you're running Node-RED locally on localhost and want to test receiving voice calls and events, we recommend using a tool like [Ngrok](https://ngrok.com/). This tool allow you to expose your localhost to the internet and makes it possible to route callback events to Node-RED. This is also a useful for testing the native Http-in node provided by Node-RED. | ||
|
||
## More about the nodes | ||
This package contains the following four nodes: | ||
|
||
### Incoming Call node | ||
Handles and routes inbound voice calls from the Sinch Voice API for a specific application and Sinch number. | ||
|
||
In order to receive calls from the Sinch Voice APi, you need to configure a Callback URL on the voice application in the [Sinch dashboard](https://dashboard.sinch.com/voice/apps). The path should be: <i><node-red-path>/sinch-voice-api/callback</i>. | ||
|
||
### Voice Call node | ||
Initiates an outbound voice call using the Sinch Voice API. | ||
|
||
In order to initiate calls from the Sinch Voice APi, you need to configure a Callback URL on the voice application in the [Sinch dashboard](https://dashboard.sinch.com/voice/apps). The path should be: <i><node-red-path>/sinch-voice-api/callback</i>. | ||
|
||
### DTMF Answer | ||
Captures the DTMF (Dual Tone Multi Frequency) keypad (0-9, * and #) input from the user response. | ||
|
||
### Answered Call Event (ACE) | ||
Stores a SVAML for a call (inbound or outbound) in case of an ACE (Answered Call Event). | ||
|
||
## Contributing | ||
See, [CONTRIBUTING.md](CONTRIBUTING.md). | ||
|
||
## Copyright and license | ||
Copyright Sinch AB, https://sinch.com under the [Apache 2.0 license](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
[ | ||
{ | ||
"id": "352c14c5878acfd8", | ||
"type": "tab", | ||
"label": "Sinch Voice API", | ||
"disabled": false, | ||
"info": "" | ||
}, | ||
{ | ||
"id": "de31144f.01d448", | ||
"type": "sinch-voice-incoming-call", | ||
"z": "352c14c5878acfd8", | ||
"application": "", | ||
"endpoint": "", | ||
"svaml": "{\"instructions\":[],\"action\":{\"name\":\"RunMenu\",\"barge\":true,\"menus\":[{\"id\":\"main\",\"mainPrompt\":\"#tts[Welcome to Sinch. You have two options, press 1 or 2]\",\"options\":[{\"dtmf\":\"1\",\"action\":\"return(option1)\"},{\"dtmf\":\"2\",\"action\":\"return(option2)\"}]}]}}", | ||
"x": 550, | ||
"y": 400, | ||
"wires": [ | ||
[ | ||
"87e5a492.af0318", | ||
"550945e2.9863cc" | ||
] | ||
] | ||
}, | ||
{ | ||
"id": "87e5a492.af0318", | ||
"type": "sinch-voice-dtmf", | ||
"z": "352c14c5878acfd8", | ||
"action": "option1", | ||
"svaml": "{ \"instructions\": [ { \"name\": \"say\", \"text\": \"Hello, this is a text-to-speech message.\", \"locale\": \"en-US\" } ]}", | ||
"x": 970, | ||
"y": 360, | ||
"wires": [ | ||
[ | ||
"101f0ef8.fe6f51" | ||
] | ||
] | ||
}, | ||
{ | ||
"id": "550945e2.9863cc", | ||
"type": "sinch-voice-dtmf", | ||
"z": "352c14c5878acfd8", | ||
"action": "option2", | ||
"svaml": "{\n \"instructions\": [\n {\n \"name\": \"say\",\n \"text\": \"Hello, this is a text-to-speech message.\",\n \"locale\": \"en-US\"\n }\n ]\n}", | ||
"x": 970, | ||
"y": 440, | ||
"wires": [ | ||
[ | ||
"c72328f1.fba0e8" | ||
] | ||
] | ||
}, | ||
{ | ||
"id": "101f0ef8.fe6f51", | ||
"type": "debug", | ||
"z": "352c14c5878acfd8", | ||
"name": "debug node", | ||
"tosidebar": true, | ||
"console": false, | ||
"tostatus": false, | ||
"complete": "true", | ||
"targetType": "full", | ||
"statusVal": "", | ||
"statusType": "auto", | ||
"x": 1250, | ||
"y": 360, | ||
"wires": [] | ||
}, | ||
{ | ||
"id": "c72328f1.fba0e8", | ||
"type": "debug", | ||
"z": "352c14c5878acfd8", | ||
"name": "debug node", | ||
"tosidebar": true, | ||
"console": false, | ||
"tostatus": false, | ||
"complete": "true", | ||
"targetType": "full", | ||
"statusVal": "", | ||
"statusType": "auto", | ||
"x": 1250, | ||
"y": 440, | ||
"wires": [] | ||
}, | ||
{ | ||
"id": "e6feda7a.90f418", | ||
"type": "sinch-voice-call", | ||
"z": "352c14c5878acfd8", | ||
"name": "sinch-voice-call node", | ||
"application": "", | ||
"destinationEndpoint": "", | ||
"cli": "", | ||
"destinationType": "number", | ||
"svaml": "", | ||
"text": "Hello, this is a message from Sinch", | ||
"dtmf": "", | ||
"prompts": "", | ||
"messageType": "text", | ||
"locale": "en-US", | ||
"debug": false, | ||
"x": 825, | ||
"y": 615, | ||
"wires": [ | ||
[ | ||
"9c065b1e.5fb728" | ||
], | ||
[ | ||
"fa63809f.86565" | ||
] | ||
] | ||
}, | ||
{ | ||
"id": "7efd3e1e.c036c", | ||
"type": "inject", | ||
"z": "352c14c5878acfd8", | ||
"name": "inject node", | ||
"props": [ | ||
{ | ||
"p": "", | ||
"v": "", | ||
"vt": "str" | ||
} | ||
], | ||
"repeat": "", | ||
"crontab": "", | ||
"once": false, | ||
"onceDelay": 1, | ||
"topic": "", | ||
"x": 540, | ||
"y": 615, | ||
"wires": [ | ||
[ | ||
"e6feda7a.90f418" | ||
] | ||
] | ||
}, | ||
{ | ||
"id": "9c065b1e.5fb728", | ||
"type": "debug", | ||
"z": "352c14c5878acfd8", | ||
"name": "debug node", | ||
"tosidebar": true, | ||
"console": false, | ||
"tostatus": false, | ||
"complete": "payload", | ||
"targetType": "msg", | ||
"statusVal": "", | ||
"statusType": "auto", | ||
"x": 1070, | ||
"y": 580, | ||
"wires": [] | ||
}, | ||
{ | ||
"id": "fa63809f.86565", | ||
"type": "debug", | ||
"z": "352c14c5878acfd8", | ||
"name": "debug node", | ||
"tosidebar": true, | ||
"console": false, | ||
"tostatus": false, | ||
"complete": "payload", | ||
"targetType": "msg", | ||
"statusVal": "", | ||
"statusType": "auto", | ||
"x": 1070, | ||
"y": 640, | ||
"wires": [] | ||
} | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.