Refactoring how we are organizing the twilio chatbot examples and improving the readmes
This commit is contained in:
@@ -110,31 +110,6 @@ To start a call, simply make a call to your configured Twilio phone number. The
|
|||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
It is also possible to automatically test the server without making phone calls by using a software client.
|
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.
|
||||||
First, update `templates/streams.xml` to point to your server's websocket endpoint. For example:
|
- [typescript](client/typescript/README.md): This typescript client enables manual testing of the server via WebSocket without the need to make actual phone calls.
|
||||||
|
|
||||||
```
|
|
||||||
<?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 you’re 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.
|
|
||||||
39
examples/twilio-chatbot/client/python/README.md
Normal file
39
examples/twilio-chatbot/client/python/README.md
Normal 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 server’s 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)
|
||||||
27
examples/twilio-chatbot/client/typescript/README.md
Normal file
27
examples/twilio-chatbot/client/typescript/README.md
Normal 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.
|
||||||
@@ -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.
|
|
||||||
Reference in New Issue
Block a user