# @fonoster/rox

> ![publish to docker](https://github.com/fonoster/rox/workflows/publish%20to%2

Latest version **0.3.7** (published 2023-04-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @fonoster/rox
pnpm add @fonoster/rox
yarn add @fonoster/rox
bun add @fonoster/rox
```

Provides the commands `rox`, `run`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.7 |
| Published | 2023-04-05 |
| First published | 2021-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 31 |
| Unpacked size | 83.5 KB |
| Known vulnerabilities | 0 (+4 in 4 direct dependencies) |
| Install scripts | no |
| Maintainers | fonoster-oss |

## Links

- npm: https://www.npmjs.com/package/@fonoster/rox
- npm.io page: https://npm.io/package/@fonoster/rox

## Dependencies (31)

- [ws](https://npm.io/package/ws.md) ^8.1.0
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [ngrok](https://npm.io/package/ngrok.md) ^4.2.2
- [tslib](https://npm.io/package/tslib.md) ^1
- [cli-ux](https://npm.io/package/cli-ux.md) ^5.5.1
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [nanoid](https://npm.io/package/nanoid.md) ^3.1.25
- [pb-util](https://npm.io/package/pb-util.md) ^1.0.2
- [date-fns](https://npm.io/package/date-fns.md) ^2.29.3
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2
- [node-cron](https://npm.io/package/node-cron.md) ^3.0.2
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.6
- [@oclif/config](https://npm.io/package/@oclif/config.md) ^1.8.2
- [@oclif/errors](https://npm.io/package/@oclif/errors.md) ^1.3.4
- [@fonoster/apps](https://npm.io/package/@fonoster/apps.md) ^0.3.22
- [@oclif/command](https://npm.io/package/@oclif/command.md) ^1.8.12
- [@fonoster/voice](https://npm.io/package/@fonoster/voice.md) ^0.3.22
- [@fonoster/logger](https://npm.io/package/@fonoster/logger.md) ^0.3.22
- [@fonoster/secrets](https://npm.io/package/@fonoster/secrets.md) ^0.3.22
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^3
- [@fonoster/googleasr](https://npm.io/package/@fonoster/googleasr.md) ^0.3.22
- [@fonoster/googletts](https://npm.io/package/@fonoster/googletts.md) ^0.3.22
- [@opentelemetry/core](https://npm.io/package/@opentelemetry/core.md) ^1.11.0
- [@google-cloud/dialogflow](https://npm.io/package/@google-cloud/dialogflow.md) ^4.3.1
- [@opentelemetry/sdk-metrics](https://npm.io/package/@opentelemetry/sdk-metrics.md) ^1.11.0
- [@google-cloud/dialogflow-cx](https://npm.io/package/@google-cloud/dialogflow-cx.md) ^2.13.0
- [@opentelemetry/exporter-jaeger](https://npm.io/package/@opentelemetry/exporter-jaeger.md) ^1.11.0
- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) ^1.11.0
- [@opentelemetry/exporter-prometheus](https://npm.io/package/@opentelemetry/exporter-prometheus.md) ^0.37.0
- [@opentelemetry/semantic-conventions](https://npm.io/package/@opentelemetry/semantic-conventions.md) ^1.11.0
- [@google-cloud/opentelemetry-cloud-trace-exporter](https://npm.io/package/@google-cloud/opentelemetry-cloud-trace-exporter.md) ^2.0.0

## Recent versions

- 0.3.7 (latest) — 2023-04-05
- 0.3.6 — 2023-04-04
- 0.3.2 — 2022-06-05
- 0.3.1 — 2022-03-30
- 0.2.3 — 2022-03-03
- 0.2.2 — 2022-02-16
- 0.3.0 — 2022-02-13
- 0.2.1 — 2022-02-11
- 0.2.0 — 2022-02-11
- 0.0.13 — 2022-01-14
- 0.0.12 — 2022-01-12
- 0.0.11 — 2022-01-08
- 0.0.10 — 2022-01-08
- 0.0.6 — 2021-11-24
- 0.0.5 — 2021-11-24
- … 1 more at https://npm.io/package/@fonoster/rox/versions

## README

## 🤖 Rox AI: A connector for Dialogflow ES/CX 

<a href="https://gitpod.io/#https://github.com/fonoster/rox"> <img src="https://img.shields.io/badge/Contribute%20with-Gitpod-908a85?logo=gitpod" alt="Contribute with Gitpod" /> ![publish to docker](https://github.com/fonoster/rox/workflows/publish%20to%20docker%20hub/badge.svg)

This repository contains a dockerized distribution of Rox AI. Also, see [Fonoster](https://github.com/fonoster/fonoster).

## Youtube Demo

See a Car Rental demo using Rox AI

<div align="left">
  <a href="https://www.youtube.com/embed/41Rx8KPb5GU"><img width="300px" src="https://raw.githubusercontent.com/fonoster/rox/main/assets/youtube-3.svg" alt="Demo of Rox AI"/></a>
</div>

## Available Versions

You can see all images available to pull from Docker Hub via the [Tags](https://hub.docker.com/repository/docker/fonoster/rox/tags?page=1) page. Docker tag names that begin with a "change type" word such as task, bug, or feature are available for testing and may be removed at any time.

> The version is the same of the Asterisk this is image is based on

## Installation

You can clone this repository and manually build it.

```
cd fonoster/rox\:%%VERSION%%
docker build -t fonoster/rox:%%VERSION%% .
```

Otherwise, you can pull this image from the docker index.

```
docker pull fonoster/rox:%%VERSION%%
```

## Usage Example

The following is a basic example of using this image.

```
docker run -it -p 3000:3000 fonoster/rox:latest
```

## Deploying in development mode with Gitpod

One-click interactive deployment will familiarize you with the server in development mode.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/fonoster/rox)

## Specs for Dialogflow backend

To allow for seamless integration between Dialogflow and Rox, we introduced the concept of Effects. Effects are actions sent from Dialogflow to Rox so you don't have to program the behavior every time. All you need to do is send the Effect's payload and Rox will react accordingly.

You can set multiple responses in Dialogflow. The Effects will run in sequence.

<table>
<tr>
<td> Effect ID </td> <td> Description </td> <td> Payload Example </td>
</tr>
<tr>
<td> 

`say` 

</td>
<td> The Effect will randomly pick a textual response and play it back to the user </td>
<td>
  
```json
{
  "effect": "say",
  "parameters": {
    "responses": [
      "Goodbye!",
      "Talk later",
      "Bye!",
      "Have a good one!"
    ]
  }
}
```

</td>
</tr>
<tr>
<td> 

`hangup` 

</td>
<td> The hangup Effect will close the call </td>
<td>

```json
{
  "effect": "hangup"
}
```

</td>
</tr>
<tr>
<td> 

`send_data` 

</td>
<td> Use this Effect send arbitrary data to the client. Note that this only works with clients that subscribe for events</td>
<td>

```json
{
  "effect": "send_data",
  "parameters": {
    "type": "map",
    "icon": "https://freeicons.net/icons/map.png",
    "link": "https://goo.gl/maps/YTum2VeZSQwNB4ik6"
  }
}
```

</td>
</tr>
<tr>
<td> 

`transfer` 

</td>
<td> Forward call to a different endpoint </td>
<td>

```json
{
  "effect": "transfer",
  "parameters": {
    "destination": "17853178070",
    "record": true
  }
}
```

</td>
</tr>
</table>

> Notes: The parameter `type` is set to map in the example, but you can send anything that makes sense to the client. If the parameter `allRequiredParamsPresent` is set to true, the fulfillmentText will take precedence over the custom effects.

## Environment Variables

Environment variables are used in the entry point script to render configuration templates. You can specify the values of these variables during `docker run`, `docker-compose up`, or in Kubernetes manifests in the `env` array.

- `DEFAULT_LANGUAGE_CODE` - Sets the default language for the application. Defaults to `en-US`
- `OTL_EXPORTER_PROMETHEUS_PORT` - Sets Prometheus port. Defaults to `9090`
- `OTL_EXPORTER_PROMETHEUS_ENDPOINT` - Sets Prometheus endpoint. Defaults to `/metrics`
- `OTL_EXPORTER_JAEGER_URL` - If set, it will send traces to Jaeger
- `OTL_EXPORTER_GCP_ENABLED` - If set, it will send traces to GCP
- `OTL_EXPORTER_ZIPKIN_URL` - If set, it will send traces to Zipkin
- `EVENTS_SERVER_ENABLED` - Activates the Events Server for socket connection. Defaults to `false`

## Exposed Ports

- `3000` - Port to start a session request
- `3001` - Port to subscribe for `send_data` effects
- `9090` - Default Prometheus port

## Volumes

- None

## TODO

- [ ] Add authentication to secure the events port
- [ ] Include a `--log-level` flag (You can enable logs using the env LOGS_LEVEL)
- [ ] Include a `--app-port` so we can change the default voice application port
- [ ] Include a `--events-port` so we can change the default events port

## Contributing

Please read [CONTRIBUTING.md](https://github.com/fonoster/rox/blob/main/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Authors

- [Pedro Sanders](https://github.com/psanders)

See also the list of contributors who [participated](https://github.com/fonoster/rox/contributors) in this project.

## License

Copyright (C) 2023 by Fonoster Inc. MIT License (see [LICENSE](https://github.com/fonoster/rox/blob/main/LICENSE) for details).

---
_Source: https://npm.io/package/@fonoster/rox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
