-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add a lab for ha ivr with routr and asterisk
- Loading branch information
Showing
14 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: "3.9" | ||
|
||
services: | ||
routr: | ||
image: fonoster/routr-one:latest | ||
environment: | ||
EXTERNAL_ADDRS: ${DOCKER_HOST_ADDRESS} | ||
RTPENGINE_HOST: rtpengine | ||
ports: | ||
- 51908:51908 | ||
- 5060:5060 | ||
- 5060:5060/udp | ||
- 5062:5062 | ||
volumes: | ||
- shared:/var/lib/postgresql/data | ||
|
||
# RTPEngine requires of network mode "host" to work properly. However, this option doesn't work on | ||
# Windows and MacOs. For development, we are opening a few ports to the host machine. | ||
# For production, you must use the network_mode: host which works on Linux. | ||
rtpengine: | ||
image: fonoster/rtpengine:latest | ||
restart: unless-stopped | ||
# Uncomment the following line for production | ||
# network_mode: host | ||
environment: | ||
# Set DOCKER_HOST_ADDRESS to an IP address that is reachable to the SIP clients | ||
PUBLIC_IP: ${DOCKER_HOST_ADDRESS} | ||
PORT_MIN: 10000 | ||
PORT_MAX: 10100 | ||
LOG_LEVEL: 6 | ||
ports: | ||
- 22222:22222/udp | ||
- 10000-10100:10000-10100/udp | ||
|
||
volumes: | ||
shared: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Video Feed</title> | ||
<style> | ||
h1 { font-family: 'Courier New', Courier, monospace; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h1>Door Phone Video Feed</h1> | ||
<div style="border: 1px solid black; width: 300px; height: 300px;"> | ||
<video id="remoteVideo" autoplay muted style="background-color: black; height: 100%"></video> | ||
</div> | ||
|
||
<br /> | ||
|
||
<button id="callButton">Call Door Phone</button> | ||
<button id="hangupButton">Hangup</button> | ||
|
||
<audio style="display: none" id="remoteAudio" controls> | ||
<p>Your browser doesn't support HTML5 audio.</p> | ||
</audio> | ||
<script type="module"> | ||
import { Web } from "https://unpkg.com/[email protected]/lib/index.js"; | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
const remoteVideo = document.getElementById('remoteVideo'); | ||
const callButton = document.getElementById('callButton'); | ||
const hangupButton = document.getElementById('hangupButton'); | ||
const remoteAudio = document.getElementById('remoteAudio'); | ||
|
||
const config = { | ||
server: "ws://localhost:5062", | ||
aor: "sip:[email protected]", | ||
doorPhoneAor: "sip:[email protected]" | ||
} | ||
|
||
const options = { | ||
aor: config.aor, | ||
media: { | ||
constraints: { audio: true, video: true }, | ||
remote: { | ||
audio: remoteAudio, | ||
video: remoteVideo | ||
} | ||
}, | ||
userAgentOptions: { | ||
authorizationUsername: "admin", | ||
authorizationPassword: "1234", | ||
} | ||
}; | ||
|
||
const simpleUser = new Web.SimpleUser(config.server, options); | ||
|
||
callButton.addEventListener('click', async() => { | ||
await simpleUser.connect(); | ||
simpleUser.call(config.doorPhoneAor); | ||
}); | ||
|
||
hangupButton.addEventListener('click', () => { | ||
simpleUser.hangup(); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Calling the PSTN from SIP.js | ||
|
||
This example shows how to use the SIP.js library to make a call from a web page to a phone number. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: "3.9" | ||
|
||
services: | ||
routr: | ||
image: fonoster/routr-one:latest | ||
environment: | ||
EXTERNAL_ADDRS: ${DOCKER_HOST_ADDRESS} | ||
RTPENGINE_HOST: rtpengine | ||
ports: | ||
- 51908:51908 | ||
- 5060:5060 | ||
- 5060:5060/udp | ||
- 5062:5062 | ||
volumes: | ||
- shared:/var/lib/postgresql/data | ||
|
||
# RTPEngine requires of network mode "host" to work properly. However, this option doesn't work on | ||
# Windows and MacOs. For development, we are opening a few ports to the host machine. | ||
# For production, you must use the network_mode: host which works on Linux. | ||
rtpengine: | ||
image: fonoster/rtpengine:latest | ||
restart: unless-stopped | ||
# Uncomment the following line for production | ||
# network_mode: host | ||
environment: | ||
# Set DOCKER_HOST_ADDRESS to an IP address that is reachable to the SIP clients | ||
PUBLIC_IP: ${DOCKER_HOST_ADDRESS} | ||
PORT_MIN: 10000 | ||
PORT_MAX: 10100 | ||
LOG_LEVEL: 6 | ||
ports: | ||
- 22222:22222/udp | ||
- 10000-10100:10000-10100/udp | ||
|
||
volumes: | ||
shared: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Happy hacking! | ||
|
||
To start the service, use the following command: | ||
|
||
```bash | ||
# Remember to replace the Docker Host Address with your own | ||
DOCKER_HOST_ADDRESS=192.168.1.3 docker compose up | ||
``` | ||
|
||
> Wait for all the services to be "healthy". | ||
Then, you will need to register with Routr from a softphone like Zoiper. | ||
|
||
The access information is as follows: | ||
|
||
Domain: sip.local | ||
Username: 1001 | ||
Password: 1234 | ||
|
||
After this, you can make a call to Asterisk using sip:asterisk@routr as the address of record. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
version: "3" | ||
|
||
services: | ||
routr: | ||
image: fonoster/routr-one:2.7.0 | ||
environment: | ||
EXTERNAL_ADDRS: ${DOCKER_HOST_ADDRESS} | ||
RTPENGINE_HOST: rtpengine | ||
ports: | ||
- 51908:51908 | ||
- 5060:5060 | ||
- 5062:5062 | ||
volumes: | ||
- shared:/var/lib/postgresql/data | ||
|
||
rtpengine: | ||
image: fonoster/rtpengine:latest | ||
ports: | ||
- 22222:22222/udp | ||
- 10000-10100:10000-10100/udp | ||
environment: | ||
PUBLIC_IP: ${DOCKER_HOST_ADDRESS} | ||
PORT_MIN: 10000 | ||
PORT_MAX: 10100 | ||
|
||
asterisk-01: | ||
image: fonoster/mediaserver:latest | ||
expose: | ||
- 6060 | ||
environment: | ||
EXTERN_ADDR: ${DOCKER_HOST_ADDRESS} | ||
SIPPROXY_HOST: routr | ||
SIPPROXY_USERNAME: asterisk | ||
SIPPROXY_SECRET: asterisk | ||
volumes: | ||
- ./extensions.conf:/etc/asterisk/extensions.conf | ||
- ./sounds/count-1.sln16:/var/lib/asterisk/sounds/count.sln16 | ||
|
||
asterisk-02: | ||
image: fonoster/mediaserver:latest | ||
expose: | ||
- 6060 | ||
environment: | ||
EXTERN_ADDR: ${DOCKER_HOST_ADDRESS} | ||
SIPPROXY_HOST: routr | ||
SIPPROXY_USERNAME: asterisk | ||
SIPPROXY_SECRET: asterisk | ||
volumes: | ||
- ./extensions.conf:/etc/asterisk/extensions.conf | ||
- ./sounds/count-2.sln16:/var/lib/asterisk/sounds/count.sln16 | ||
|
||
simplephone: | ||
image: psanders/simplephone:latest | ||
ports: | ||
- 8080:8080 | ||
|
||
volumes: | ||
shared: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[local-ctx] | ||
exten => asterisk,1,NoOp() | ||
same => n,Playback(count) | ||
same => n,Hangup() |
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.