docs update

This commit is contained in:
Dave Horton
2021-05-12 13:23:28 -04:00
parent 5fd4e510d5
commit cecd1c40cc
8 changed files with 131 additions and 21 deletions

View File

@@ -59,7 +59,7 @@ navi:
title: transcribe
-
path: rest
title: API Reference
title: REST API
pages:
-
path: overview
@@ -71,24 +71,18 @@ navi:
path: calls
title: Calls
-
path: getting-started
title: Getting Started
path: client-sdks
title: Client SDKs
pages:
-
path: add-carrier
title: Add a Carrier
path: node-js-sdk
title: Node.js SDK
-
path: add-speech
title: Add Speech Credentials
path: create-jambonz-app
title: create-jambonz-app
-
path: add-application
title: Add an Application
-
path: add-phone-numbers
title: Add Phone Numbers
-
path: register-sip-client
title: Register SIP clients
path: node-red
title: Node-RED
-
path: tutorials
title: Tutorials

View File

@@ -71,7 +71,7 @@ dilemma:
text: complete open source (MIT License)
-
icon: CheckCircle
text: connect to our our cloud service OR deploy on your own infrastructure
text: connect to our cloud service OR deploy on your own infrastructure
-
icon: CheckCircle
text: vibrant community of users and contributors

View File

@@ -0,0 +1,61 @@
# Create a new jambonz app
The simplest way to create a new jambonz webhook or REST API application is to use create-jambonz-app. Youll need to have Node >= 10.16 and npm >= 5.6 on your machine. To create a project, run:
```bash
npx create-jambonz-app my-app
cd my-app
npm start
```
To see a bit more about what it can do, execute it with the --help flag to see the various options.
```bash
$ npx create-jambonz-app --help
Usage: create-jambonz-app [options] project-name
Options:
-v, --version display the current version
-s, --scenario <scenario> generates sample webhooks for specified scenarios, default is dial and tts (default: "tts, dial")
-h, --help display help for command
Scenarios available:
- tts: answer call and play greeting using tts,
- dial: use the dial verb to outdial through your carrier,
- record: record the audio stream generated by the listen verb,
- auth: authenticate sip devices, or
- all: generate all of the above scenarios
Example:
$ npx create-jambonz-app my-app
```
It scaffolds out a jambonz application for you, using [express](https://expressjs.com) as the http middleware. By default, it will generate three endpoints for you:
- /hello-world: a webhook that speaks a greeting using text-to-speech,
- /dial-time: a webhook that speaks a greeting and then dials to a Canadian-based speaking clock, and
- /call-status: a webhook that logs call status events.
These simple webhook apps are particularly useful in testing out a new system or account and verifying carrier interconnects and text-to-speech are all working properly.
Some of the webhooks that you generate require environment variables to be set, and a default [pm2](https://pm2.keymetrics.io/docs/usage/quick-start/) [ecosystem file](https://pm2.keymetrics.io/docs/usage/application-declaration/) is generated for you with placeholders that you can fill out.
#### Additional scenarios
Based on the options you supply, it can generate additional webhooks:
##### Record
A webhook application that uses the listen verb to send a real-time audio stream to an endpoint that the application also exposes. You supply the path to the websocket server as an environment variable, along with an AWS S3 bucket to upload the recordings to. The bucket must be public and writable by all. The application then will then prompt the caller for a message, and the recorded message will end up in S3 storage.
This, of course, is only an example of one way of storing recordings and you can implement any storage back-end that you want for your application.
##### Authenticating sip users
A webhook application that illustrates how to authenticate sip users and webrtc clients.
This application uses a simple in-memory database of sip usernames and passwords, but of course you can implement your own database or other storage back-end for holding authentication credentials.
> [See here](https://github.com/jambonz/jambonz-node-example-app) for an example that authenticates sip users based on a roster kept in a Google sheet.
#### Exposing your endpoints
If you don't have a server with a public address to host the application, you can use [ngrok](https://ngrok.com/). By default, the application will be listening on port 3000 (you can change this in the ecosystem file), so after installing ngrok you can generate a public URL for the application:
```bash
ngrok http 3000
```

View File

@@ -0,0 +1,53 @@
# jambonz Node.js SDK
The jambonz Node.js SDK is one of the simplest and most powerful ways to build jambonz applications.
The video below provides a walk-through of how to create an application using the [create-jambonz-app](/docs/client-sdks/create-jambonz-app) utility, and then gives examples of building various webhooks applications that include collecting speech or dtmf input as well as integration with Google [Dialogflow](https://developers.google.com/learn/pathways/chatbots-dialogflow) and AWS [Lex V2](https://aws.amazon.com/blogs/aws/amazon-lex-enhanced-console-experience/).
<iframe width="560" height="315" src="https://www.youtube.com/embed/42jcqyvCstU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
#### Up and running
As mentioned above, the [create-jambonz-app](/docs/client-sdks/create-jambonz-app) will scaffold you an [express](https://expressjs.com/)-based app that provides a great starting point.
If you prefer to use a different http server, or you need to integrate the jambonz webhooks into an existing Node.js application, then you simply need to install [@jambonz/node-client](https://www.npmjs.com/package/@jambonz/node-client) in your application.
```bash
npm install --save @jambonz/node-client
```
If your application just needs to respond to [webhooks](/docs/webhooks/overview/), you can include it like this:
```js
const {WebhookResponse} = require('@jambonz/node-client');
```
If your application also needs to make [REST API calls](/docs/rest/overview/), you can include it like this:
```js
const jambonz = require('@jambonz/node-client');
const {WebhookResponse} = jambonz;
const client = jambonz('your-account-sid', 'your-api-key', {baseUrl: 'https://jambonz.us'});
```
> Note: if you are running a self-hosted system, replace `https://jambonz.us` in the above with the appropriate URL of your own jambonz system.
#### How to use it - Webhooks
Responding to webhooks is quite simple:
```js
router.post('/', (req, res) => {
const app = new WebhookResponse();
app
.pause({length: 1.5})
.say({
text 'hi there, and welcome to jambonz!'
});
res.status(200).json(app);
```
The WebhookResponse instance offers methods corresponding to each of the [jambonz verbs](/docs/webhooks/overview/), so for the example above you can see the possible options for the `pause` verb [here](/docs/webhooks/pause/), and for the `say` verb [here](/docs/webhooks/say/). After adding all of the verbs that you want to execute, in the order that you want them to happen, simply return the `app` object in the 200 OK to the HTTP request.
#### How to use it - REST API
To making a REST API call simply use the `client` object we showed how to create earlier:
```js
await client.calls.update(req.body.call_sid, {mute_status: 'mute'});
```
Documentation for the REST API can be found [here](/docs/rest/overview/).

View File

@@ -0,0 +1,2 @@
# Node-RED plugin for jambonz

View File

@@ -2,13 +2,13 @@
jambonz is an open-source CPaaS platform that is primarily designed for use by communications service providers.
As an API-driven platform, you will primarily interface with it using [Webhooks](/docs/webhooks/overview/) and [REST APIs](/docs/rest/overview/). Our client SDKs include a [Node.js SDK]() SDK as well as [Node-RED plugins]().
As an API-driven platform, you will primarily interface with it using [Webhooks](/docs/webhooks/overview/) and [REST APIs](/docs/rest/overview/). Our client SDKs include a [Node.js SDK](/docs/client-sdks/node-js-sdk/) SDK as well as [Node-RED plugins]().
There are two ways to run jambonz:
- use our hosted platform (you can [create a free account](https://jambonz.us/register)), or
- self-host your own jambonz system using the open-source distribution.
> Pro tip: Start by creating a free account on the hosted platform because you can start testing immediately without going through a build/install process or having to allocate any compute/network/storage resources. You can always migrate your applications seamlessly to a self-hosted platform later.
> Pro tip: Start by creating a free account on the hosted platform because you can start testing immediately. You can always build a self-hosted platform later and migrate your applications seamlessly.
In these pages you will find information about our SDKs and APIs, along with some useful tips for [Getting Started]() on the hosted platform, [tutorials]() describing how to perform common tasks, as well as some quick [how-to videos]().

View File

@@ -45,8 +45,8 @@ You can use the following options in the `lex` verb:
| option | description | required |
| ------------- |-------------| -----|
| botID | Lex bot ID | yes |
| botAliasId | Lex bot alias ID | yes |
| botId | Lex bot ID | yes |
| botAlias | Lex bot alias ID | yes |
| credentials | AWS credentials | yes |
| credentials.accessKey | AWS access key id | yes |
| credentials.secretAccessKey | AWS secret access key id | yes |

View File

@@ -19,7 +19,7 @@ You can use the following options in the `say` action:
| ------------- |-------------| -----|
| text | text to speak; may contain SSML tags | yes |
| synthesizer.vendor | speech vendor to use: Google or aws (polly is also an alias for aws)| no |
| synthesizer.language | language code to use. | yes |
| synthesizer.language | language code to use. | no |
| synthesizer.gender | (Google only) MALE, FEMALE, or NEUTRAL. | no |
| synthesizer.voice | voice to use. Note that the voice list differs whether you are using aws or Google. Defaults to application setting, if provided. | no |
| loop | the number of times a text is to be repeated; 0 means repeat forever. Defaults to 1. | no |