Skip to content

Commit 4331d7c

Browse files
committed
update example
1 parent 1962f87 commit 4331d7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2326
-10217
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SOCKET_PASSWORD=reallySecr3tP@ssw0rd
2+
SIP_PASSWORD=FsPOa!3d
3+
SIP_IP=89.232.161.240
4+
PUSH_URL=https://some-api.example/send-push
5+
PUSH_API_KEY=pushapikey

.gitignore

Lines changed: 46 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,46 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
.pnpm-debug.log*
9-
10-
# Diagnostic reports (https://nodejs.org/api/report.html)
11-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12-
13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
*.lcov
25-
26-
# nyc test coverage
27-
.nyc_output
28-
29-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30-
.grunt
31-
32-
# Bower dependency directory (https://bower.io/)
33-
bower_components
34-
35-
# node-waf configuration
36-
.lock-wscript
37-
38-
# Compiled binary addons (https://nodejs.org/api/addons.html)
39-
build/Release
40-
41-
# Dependency directories
42-
node_modules/
43-
jspm_packages/
44-
45-
# Snowpack dependency directory (https://snowpack.dev/)
46-
web_modules/
47-
48-
# TypeScript cache
49-
*.tsbuildinfo
50-
51-
# Optional npm cache directory
52-
.npm
53-
54-
# Optional eslint cache
55-
.eslintcache
56-
57-
# Optional stylelint cache
58-
.stylelintcache
59-
60-
# Microbundle cache
61-
.rpt2_cache/
62-
.rts2_cache_cjs/
63-
.rts2_cache_es/
64-
.rts2_cache_umd/
65-
66-
# Optional REPL history
67-
.node_repl_history
68-
69-
# Output of 'npm pack'
70-
*.tgz
71-
72-
# Yarn Integrity file
73-
.yarn-integrity
74-
75-
# dotenv environment variable files
76-
.env
77-
.env.development.local
78-
.env.test.local
79-
.env.production.local
80-
.env.local
81-
82-
# parcel-bundler cache (https://parceljs.org/)
83-
.cache
84-
.parcel-cache
85-
86-
# Next.js build output
87-
.next
88-
out
89-
90-
# Nuxt.js build / generate output
91-
.nuxt
92-
dist
93-
94-
# Gatsby files
95-
.cache/
96-
# Comment in the public line in if your project uses Gatsby and not Next.js
97-
# https://nextjs.org/blog/next-9-1#public-directory-support
98-
# public
99-
100-
# vuepress build output
101-
.vuepress/dist
102-
103-
# vuepress v2.x temp and cache directory
104-
.temp
105-
.cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# TernJS port file
120-
.tern-port
121-
122-
# Stores VSCode versions used for testing VSCode extensions
123-
.vscode-test
124-
125-
# yarn v2
126-
.yarn/cache
127-
.yarn/unplugged
128-
.yarn/build-state.yml
129-
.yarn/install-state.gz
130-
.pnp.*
131-
132-
deploy/data
1+
# Compiled Lua sources
2+
luac.out
3+
4+
# luarocks build files
5+
*.src.rock
6+
*.zip
7+
*.tar.gz
8+
9+
volumes
10+
11+
# Object files
12+
*.o
13+
*.os
14+
*.ko
15+
*.obj
16+
*.elf
17+
18+
# Precompiled Headers
19+
*.gch
20+
*.pch
21+
22+
# Libraries
23+
*.lib
24+
*.a
25+
*.la
26+
*.lo
27+
*.def
28+
*.exp
29+
30+
# Shared objects (inc. Windows DLLs)
31+
*.dll
32+
*.so
33+
*.so.*
34+
*.dylib
35+
36+
# Executables
37+
*.exe
38+
*.out
39+
*.app
40+
*.i*86
41+
*.x86_64
42+
*.hex
43+
44+
input-users
45+
output-users
46+
volume-configs

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
# intercom-sip-server
2-
An open example implementing a SIP server for an intercom
32

4-
# Deploy server
3+
docker-compose для развертывания
54

6-
To deploy project, create file `deploy/.env` from example, adjust settings and use `deploy.sh` from the project root.
5+
## Build
76

8-
Following ports should be accessible on server:
9-
- 80 (for HTTP)
10-
- 5060 (for SIP)
11-
- 16000-16999 (for RTP media)
7+
Базовая команда выглядит так:
8+
```sh
9+
sudo docker compose build
10+
```
1211

13-
# Run frontend
12+
## Configuration
1413

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}`.
14+
Конфигурация должна быть прописана .env:
15+
```env
16+
SOCKET_PASSWORD=
17+
SIP_PASSWORD=
18+
SIP_IP=
19+
```
1720

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`.
21+
- `SIP_PASSWORD` - Пароль от тестовых учёток SIP
22+
- `SOCKET_PASSWORD` - Пароль от сокета mod_event_socket
23+
- `SIP_IP` - публичный IP контейнера, по которому его можно зарезольвить. Используется для SDP и прочих вещей.
1924

20-
For example, if your server is deployed on IP `192.168.10.42` and is behind proxy on `https://sip.example.com/`
25+
## Подключение к сокету
2126

22-
user = 1000
23-
password = 1234
24-
domain = 192.168.10.42
25-
url = wss://sip.example.com/sip (Note wss instead of https)
27+
```sh
28+
sudo docker compose exec -it sip-server /usr/local/freeswitch/bin/fs_cli -rRS --password ${SOCKET_PASSWORD}
29+
```
2630

27-
All url parameters should be url-encoded.
31+
## Порты
2832

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.
33+
Контейнер использует следующие порты:
34+
- `8021` для mod_event_socket
35+
- `5060` для SIP (нужно открыть)
36+
- `5061` для SIP over TLS
37+
- `5080` для SIP
38+
- `24000`-`25000` для RTP (нужно открыть)
39+
- `4443` WSS mod_sofia (используется самоподписанный сертификат)
40+
- `7443` WS mod_sofia
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<configuration name="acl.conf" description="Network Lists">
2+
<network-lists>
3+
<!--
4+
These ACL's are automatically created on startup.
5+
6+
rfc1918.auto - RFC1918 Space
7+
nat.auto - RFC1918 Excluding your local lan.
8+
localnet.auto - ACL for your local lan.
9+
loopback.auto - ACL for your local lan.
10+
-->
11+
12+
<list name="lan" default="allow">
13+
<node type="deny" cidr="192.168.42.0/24"/>
14+
<node type="allow" cidr="192.168.42.42/32"/>
15+
</list>
16+
17+
<!--
18+
This will traverse the directory adding all users
19+
with the cidr= tag to this ACL, when this ACL matches
20+
the users variables and params apply as if they
21+
digest authenticated.
22+
-->
23+
<list name="domains" default="deny">
24+
<!-- domain= is special it scans the domain from the directory to build the ACL -->
25+
<node type="allow" domain="$${domain}"/>
26+
<!-- use cidr= if you wish to allow ip ranges to this domains acl. -->
27+
<!-- <node type="allow" cidr="192.168.0.0/24"/> -->
28+
</list>
29+
30+
31+
<list name="ipv4" default="deny">
32+
<node type="allow" cidr="0.0.0.0/0"/>
33+
</list>
34+
35+
<list name="never" default="deny">
36+
<node type="allow" cidr="255.255.255.255/32"/>
37+
</list>
38+
39+
</network-lists>
40+
</configuration>
41+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<configuration name="event_socket.conf" description="Socket Client">
2+
<settings>
3+
<param name="nat-map" value="false"/>
4+
<param name="listen-ip" value="::"/>
5+
<param name="listen-port" value="8021"/>
6+
<param name="password" value="$$SOCKET_PASSWORD"/>
7+
<!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
8+
<!--<param name="stop-on-bind-error" value="true"/>-->
9+
</settings>
10+
</configuration>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<configuration name="lua.conf" description="LUA Configuration">
2+
<settings>
3+
4+
<!--
5+
Specify local directories that will be searched for LUA modules
6+
These entries will be pre-pended to the LUA_CPATH environment variable
7+
-->
8+
<!-- <param name="module-directory" value="/usr/lib/lua/5.1/?.so"/> -->
9+
<!-- <param name="module-directory" value="/usr/local/lib/lua/5.1/?.so"/> -->
10+
11+
<!--
12+
Specify local directories that will be searched for LUA scripts
13+
These entries will be pre-pended to the LUA_PATH environment variable
14+
-->
15+
<!-- <param name="script-directory" value="/usr/local/lua/?.lua"/> -->
16+
<!-- <param name="script-directory" value="$${script_dir}/?.lua"/> -->
17+
18+
<!--<param name="xml-handler-script" value="/dp.lua"/>-->
19+
<!--<param name="xml-handler-bindings" value="dialplan"/>-->
20+
21+
<!--
22+
The following options identifies a lua script that is launched
23+
at startup and may live forever in the background.
24+
You can define multiple lines, one for each script you
25+
need to run.
26+
-->
27+
<param name="startup-script" value="on_register.lua"/>
28+
<param name="startup-script" value="on_unregister.lua"/>
29+
<param name="startup-script" value="on_expire.lua"/>
30+
31+
<hook event="CUSTOM" subclass="callcenter::info" script="on_callcenter_event.lua"/>
32+
33+
</settings>
34+
</configuration>

0 commit comments

Comments
 (0)