Refactoring how we are organizing the twilio chatbot examples and improving the readmes

This commit is contained in:
Filipi Fuchter
2025-06-17 16:08:35 -03:00
parent cbd0529674
commit 2300c2632e
12 changed files with 69 additions and 55 deletions

View File

@@ -110,31 +110,6 @@ To start a call, simply make a call to your configured Twilio phone number. The
## Testing
It is also possible to automatically test the server without making phone calls by using a software client.
First, update `templates/streams.xml` to point to your server's websocket endpoint. For example:
```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Connect>
<Stream url="ws://localhost:8765/ws"></Stream>
</Connect>
<Pause length="40"/>
</Response>
```
Then, start the server with `-t` to indicate we are testing:
```sh
# Make sure youre in the project directory and your virtual environment is activated
python server.py -t
```
Finally, just point the client to the server's URL:
```sh
python client.py -u http://localhost:8765 -c 2
```
where `-c` allows you to create multiple concurrent clients.
It is also possible to test the server without making phone calls by using one of these clients.
- [python](client/python/README.md): This Python client enables automated testing of the server via WebSocket without the need to make actual phone calls.
- [typescript](client/typescript/README.md): This typescript client enables manual testing of the server via WebSocket without the need to make actual phone calls.

View File

@@ -0,0 +1,39 @@
# Python Client for Server Testing
This Python client enables automated testing of the server via WebSocket without the need to make actual phone calls.
## Setup Instructions
### 1. Configure the Stream Template
Edit the `templates/streams.xml` file to point to your servers WebSocket endpoint. For example:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Connect>
<Stream url="ws://localhost:8765/ws" />
</Connect>
<Pause length="40"/>
</Response>
```
### 2. Start the Server in Test Mode
Run the server with the `-t` flag to indicate test mode:
```sh
# Ensure you're in the project directory and your virtual environment is activated
python server.py -t
```
### 3. Run the Client
Start the client and point it to the server URL:
```sh
python client.py -u http://localhost:8765 -c 2
```
- `-u`: Server URL (default is `http://localhost:8765`)
- `-c`: Number of concurrent client connections (e.g., 2)

View File

@@ -0,0 +1,27 @@
# Typescript Client for Server Testing
This typescript client enables manual testing of the server via WebSocket without the need to make actual phone calls.
## Setup
1. Run the bot server. See the [server README](../../README).
2. Navigate to the `client/typescript` directory:
```bash
cd client/typescript
```
3. Install dependencies:
```bash
npm install
```
4. Run the client app:
```
npm run dev
```
5. Visit http://localhost:5173 in your browser.

View File

@@ -1,27 +0,0 @@
# JavaScript Implementation
Basic implementation using the [Pipecat JavaScript SDK](https://docs.pipecat.ai/client/js/introduction).
## Setup
1. Run the bot server. See the [server README](../README).
2. Navigate to the `client/javascript` directory:
```bash
cd client/javascript
```
3. Install dependencies:
```bash
npm install
```
4. Run the client app:
```
npm run dev
```
5. Visit http://localhost:5173 in your browser.