Skip to content

Commit 1962f87

Browse files
committed
Add documentation
1 parent aa2eded commit 1962f87

File tree

5 files changed

+37
-16
lines changed

5 files changed

+37
-16
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
11
# intercom-sip-server
22
An open example implementing a SIP server for an intercom
3+
4+
# Deploy server
5+
6+
To deploy project, create file `deploy/.env` from example, adjust settings and use `deploy.sh` from the project root.
7+
8+
Following ports should be accessible on server:
9+
- 80 (for HTTP)
10+
- 5060 (for SIP)
11+
- 16000-16999 (for RTP media)
12+
13+
# Run frontend
14+
15+
After deploy, frontend and SIP over WebSocket will be on HTTP port 80 on the server. It's preferred to set up proxy with HTTPS in front of it.
16+
The client app should navigate to `https://{PROXY_URL}/?user={USER_NUMBER}&password={USER_PASSWORD}&domain={EXTERNAL_IP}&url={WS_ENDPOINT}`.
17+
18+
External IP could be acquired by running command `docker exec -it doma-freeswitch-1 /usr/local/freeswitch/bin/fs_cli -x 'sofia status profile internal'` on deployed server in field `Ext-RTP-IP`.
19+
20+
For example, if your server is deployed on IP `192.168.10.42` and is behind proxy on `https://sip.example.com/`
21+
22+
user = 1000
23+
password = 1234
24+
domain = 192.168.10.42
25+
url = wss://sip.example.com/sip (Note wss instead of https)
26+
27+
All url parameters should be url-encoded.
28+
29+
# Users import script
30+
31+
Prepare `.csv` file with pairs of `number,password` of users, and run `cd scripts && node importUsers.js /path/to/users.csv`. This script will import users in running instance of the server.
32+
33+
Note: if container was rebuilt, it's required to import users again.

deploy/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SIP_SERVER_IP=192.168.10.42

deploy/docker-compose.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ services:
55
build:
66
context: ../services/freeswitch
77
dockerfile: ./Dockerfile
8-
args:
9-
- SIP_PASSWORD
108
network_mode: host
119
restart: always
1210

@@ -15,10 +13,8 @@ services:
1513
context: ../services/frontend
1614
dockerfile: ./Dockerfile
1715
args:
18-
- VITE_SIP_SERVER_IP
19-
- VITE_SIP_SERVER_URL
20-
- SERVER_IP
16+
- SIP_SERVER_IP
2117
network_mode: host
2218
env_file:
23-
- ../services/frontend/.env
19+
- .env
2420
restart: always

services/frontend/Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@ COPY package.json package-lock.json ./
99
RUN npm ci
1010
COPY . /app
1111

12-
ARG VITE_SIP_SERVER_IP
13-
ARG VITE_SIP_SERVER_URL
12+
ARG SIP_SERVER_IP
1413

15-
ENV VITE_SIP_SERVER_IP=$VITE_SIP_SERVER_IP
16-
ENV VITE_SIP_SERVER_URL=$VITE_SIP_SERVER_URL
17-
18-
# RUN printenv >> .env
14+
ENV SIP_SERVER_IP=$SIP_SERVER_IP
1915

2016
RUN npm run build
2117
RUN rm -rf ./node_modules
2218

2319
COPY nginx.conf /etc/nginx/conf.d/default.conf
24-
RUN sed -i -E "s/SERVER_IP/$VITE_SIP_SERVER_IP/" /etc/nginx/conf.d/default.conf
20+
RUN sed -i -E "s/SERVER_IP/$SIP_SERVER_IP/" /etc/nginx/conf.d/default.conf
2521

2622
EXPOSE 80

services/frontend/deploy/.env.example

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)