freeswitch websocket Demo
时间: 2023-06-23 14:43:02 浏览: 63
Here is a simple demo of how to use WebSockets with FreeSWITCH using the mod_verto module:
1. First, you need to configure FreeSWITCH with mod_verto as described in my previous answer.
2. Next, create a simple HTML file with the following code:
```
<!DOCTYPE html>
<html>
<head>
<title>FreeSWITCH WebSocket Demo</title>
<script src="https://freeswitch.org/stash/projects/FS/repos/freeswitch/raw/libs/verto/js/verto-min.js"></script>
<script>
var verto = new Verto({
login: "1000",
passwd: "1234",
socketUrl: "wss://your.freeswitch.server:8082",
tag: "webcam"
});
verto.connect();
</script>
</head>
<body>
<h1>Welcome to the FreeSWITCH WebSocket Demo</h1>
</body>
</html>
```
Replace "your.freeswitch.server" with the hostname or IP address of your FreeSWITCH server.
3. Open the HTML file in a web browser. You should see the "Welcome to the FreeSWITCH WebSocket Demo" message.
4. Open the FreeSWITCH console and type the following command to make a test call:
```
originate sofia/internal/1000 &echo()
```
You should hear a ringtone in the web browser.
5. Answer the call by typing the following command in the FreeSWITCH console:
```
uuid_answer <UUID>
```
Replace "<UUID>" with the UUID of the call, which you can find in the FreeSWITCH console.
6. You should now hear audio from the call in the web browser.
This is just a simple demo to get you started with WebSockets and FreeSWITCH. You can find more information about mod_verto and how to use it in the FreeSWITCH documentation.