-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add description and synchronize it with DH.
- Loading branch information
Showing
3 changed files
with
101 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,51 @@ | ||
[![Build Docker image](https://github.com/sippy/webrtc_phone/actions/workflows/build.yml/badge.svg)](https://github.com/sippy/webrtc_phone/actions/workflows/build.yml) | ||
|
||
# What is it? | ||
|
||
This is a technology demo integrating Sippy RTPProxy and Sippy B2BUA with | ||
WebRTC-compatible clients. It includes four main components: | ||
|
||
1. Sippy B2BUA. | ||
2. Sippy RTPProxy. | ||
3. SIP.js demo application. | ||
4. Web server. | ||
|
||
The container starts RTPProxy and B2BUA listening on WSS port `9876/TCP`, and | ||
a web server on HTTPS port `443/TCP`. Both share the same self-signed TLS key | ||
generated during the container build process. This allows users to open the | ||
demo page and connect their browser to the B2BUA over WSS. | ||
|
||
When the user initiates a call, the B2BUA/RTPProxy sets up two RTP sessions | ||
(one encrypted and one plain) and initiates an outbound SIP call to the SIP | ||
destination controlled by the `OUTBOUND_ROUTE` environment variable. | ||
|
||
# Usage | ||
|
||
```bash | ||
docker pull sippylabs/webrtc_phone:latest | ||
docker run -it --name webrtc_phone -P --network=host -e OUTBOUND_ROUTE="[email protected];auth=foo:bar" -d sippylabs/webrtc_phone:latest | ||
``` | ||
|
||
# Introspection | ||
|
||
The container produces various SIP/RTP/WSS logs that can be inspected using | ||
the `docker log` command. The amount of RTP logs can be controlled by the | ||
`RTPP_LOG_LEVEL` environment variable. Possible values are `DBUG`, `INFO`, | ||
`WARN`, `ERR`, and `CRIT` (in decreasing order of verbosity). | ||
|
||
# Caveats | ||
|
||
- Connection to the WSS server will fail with error `1015` in Firefox. It | ||
works in Chrome and Microsoft Edge as long as the user accepts the security | ||
warning when opening the demo page. This is caused by the usage of the | ||
self-signed certificate. | ||
- Only `Demo 1` works. | ||
- Due to the need for a range of UDP ports for RTP sessions (2,000 by default), | ||
the usage of the `host` network is recommended. | ||
|
||
# Links and References | ||
|
||
- [RTPProxy @ GitHub](https://github.com/sippy/rtpproxy/) | ||
- [Sippy B2BUA @ GitHub](https://github.com/sippy/b2bua/) | ||
- [SIP.js @ GitHub](https://github.com/onsip/SIP.js/) | ||
- [Sources for this container @ GitHub](https://github.com/sippy/webrtc_phone/) |
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,42 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
md5sum_q() { | ||
md5sum "${@}" | awk '{print $1}' | ||
} | ||
|
||
# Get the JWT token | ||
TOKEN="$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USERNAME}'", "password": "'${DOCKER_PASSWORD}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)" | ||
if [ -z "${TOKEN}" -o "${TOKEN}" = "null" ] | ||
then | ||
echo "ERROR: Invalid or no JWT TOKEN returned!" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
BCSUM1="`jq -r .nonce < /dev/null | md5sum_q`" | ||
BCSUM2="`echo | md5sum_q`" | ||
|
||
API_URL="https://hub.docker.com/v2/repositories/${DOCKER_REPO}/" | ||
OLDCSUM="`curl -s -H "Authorization: JWT ${TOKEN}" "${API_URL}" | jq -r .full_description | md5sum_q`" | ||
NEWCSUM="`md5sum_q "${1}"`" | ||
if [ "${OLDCSUM}" = "${NEWCSUM}" ] | ||
then | ||
# description is up to date already | ||
exit 0 | ||
fi | ||
if [ "${OLDCSUM}" = "${BCSUM1}" -o "${OLDCSUM}" = "${BCSUM2}" ] | ||
then | ||
echo "ERROR: Empty description read!" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
MYNAME="`basename "${0}"`" | ||
DESCRIPTION_FILE="`mktemp -t ${MYNAME}.XXXXXXX`" | ||
echo '{"full_description": "' > "${DESCRIPTION_FILE}" | ||
perl -0777 -p -e 's|\n\z||' "${1}" | perl -p -e 's|\n|\\n\n|' >> "${DESCRIPTION_FILE}" | ||
echo '"}' >> "${DESCRIPTION_FILE}" | ||
|
||
# Update the description on DockerHub | ||
curl -X PATCH -H "Content-Type: application/json" -H "Authorization: JWT ${TOKEN}" -d @"${DESCRIPTION_FILE}" "${API_URL}" | ||
rm "${DESCRIPTION_FILE}" |