From 405097edfb7e303c6129e8462ca5ac796d6c2986 Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:09:17 +0530 Subject: [PATCH 1/6] Defining network and running VoIP --- .env.example | 6 + README.md | 14 +++ compose.network.yml | 22 ++++ compose.voip.yml | 38 ++++++ files/drachtio/drachtio.conf.xml | 200 +++++++++++++++++++++++++++++++ 5 files changed, 280 insertions(+) create mode 100644 compose.network.yml create mode 100644 compose.voip.yml create mode 100644 files/drachtio/drachtio.conf.xml diff --git a/.env.example b/.env.example index 28515ce..384ecc0 100644 --- a/.env.example +++ b/.env.example @@ -36,3 +36,9 @@ MONGODB_PORT_NUMBER=27017 # Nats NATS_PORT_NUMBER=4222 NATS_BIND_IP=127.0.0.1 + +# SIP +VOIP_DOMAIN=voip.unmiscible-desolatingly-devorah.ngrok-free.dev +EXTENSION_PASSWORD=1234 +FREESWITCH_PASSWORD=admin_1234 +~ diff --git a/README.md b/README.md index a314fc7..684aae6 100644 --- a/README.md +++ b/README.md @@ -136,4 +136,18 @@ When running multiple Rocket.Chat servers, you can configure Traefik to discover ```env ROCKETCHAT_BACKEND_SERVERS=rocketchat-1:3000,rocketchat-2:3000,rocketchat-3:3000 ``` +### VoIP setup +There is a quick way for rolling out a VoIP solution using Drachtio and FreeSwitch as a SIP proxy. To achieve this some network configurations are required. `compose.network.yml` defines a network private network called `rc_voip_private` for VoIP servers. Currently it uses subnet 172.28.0.0/16 and assigns static IP 172.28.0.10 and 172.28.0.11. If you would want to change this network configuration, add desired value for subnet and static ip addresses in that subnet to `freeswitch` and `drachtio` service. `compose.network.yml` also configures rocketchat service to have access to default and `rc_voip_private` network. It communicates with non VoIP services on default network and VoIP services on `rc_voip_private` network. Once the desired configuration changes are made, run + ```bash + docker compose \ + -f compose.monitoring.yml \ + -f compose.traefik.yml \ + -f compose.database.yml \ + -f compose.yml \ + -f compose.voip.yml \ + -f compose.networ.yml \ + up -d + ``` + to start the stack. + Once the stack is running, do the necessary VoIP configurations using the static ips for FreeSwitch and Drachtio. diff --git a/compose.network.yml b/compose.network.yml new file mode 100644 index 0000000..065c9ab --- /dev/null +++ b/compose.network.yml @@ -0,0 +1,22 @@ +#define a private network for VoIP and its own subnet +networks: + rc_voip_private: + driver: bridge + ipam: + config: + - subnet: 172.28.0.0/16 +#add voip services to the new network +services: + freeswitch: + networks: + rc_voip_private: + ipv4_address: 172.28.0.10 + drachtio: + networks: + rc_voip_private: + ipv4_address: 172.28.0.11 + #make rocket chat connect on default network for DB and other things and VoIP network + rocketchat: + networks: + - rc_voip_private + - default \ No newline at end of file diff --git a/compose.voip.yml b/compose.voip.yml new file mode 100644 index 0000000..0b8bc98 --- /dev/null +++ b/compose.voip.yml @@ -0,0 +1,38 @@ +services: + freeswitch: + image: docker.io/rocketchat/freeswitch:latest + # build: . + restart: always + environment: + EXTERNAL_ADDRESS_FQDN: ${VOIP_DOMAIN:-} + FREESWITCH_PASSWORD: ${FREESWITCH_PASSWORD:-} + EXTENSION_PASSWORD: ${EXTENSION_PASSWORD:-} + EXTENSIONS: ${EXTENSIONS:-} + RTP_START_PORT: 20000 + RTP_END_PORT: 20046 + DEBUG_MODE: "true" + INTERNAL_INBOUND_MEDIA: "relay" + INTERNAL_OUTBOUND_TO_INTERNAL_MEDIA: "relay" + INTERNAL_OUTBOUND_TO_EXTERNAL_MEDIA: "relay" + EXTERNAL_INBOUND_MEDIA: "relay" + EXTERNAL_OUTBOUND_TO_INTERNAL_MEDIA: "relay" + ACCEPT_EXTERNAL_CALLS: false + USE_LEGACY_ARCH: false + DRACHTIO_DOMAIN: ${VOIP_DRACHTIO_DOMAIN} + expose: + - 8021 + - 5060 + ports: + - 8021:8021 + - 20000-20046:20000-20046/udp + + drachtio: + image: drachtio/drachtio-server:latest + restart: always + ports: + - "9022:9022" + - "5060:5060/udp" + volumes: + # Drachtio params are configured on this file + # You must modify it to configure a strong and unique secret string + - ./files/drachtio/drachtio.conf.xml:/etc/drachtio.conf.xml diff --git a/files/drachtio/drachtio.conf.xml b/files/drachtio/drachtio.conf.xml new file mode 100644 index 0000000..7d88ec4 --- /dev/null +++ b/files/drachtio/drachtio.conf.xml @@ -0,0 +1,200 @@ + + + + 0.0.0.0 + + + + + + + + + sip:*;transport=udp + + + + + + + + + + + + + + + + + 8192 + + + + + + +
+ sip-cli + sipcli + friendly-scanner +
+
+ sipvicious +
+
+
+ + + false + + + 127.0.0.1 + + + + + + + + + + + + + + /var/log/drachtio/drachtio.log + /var/log/drachtio/archive + 100 + 20 + true + + + + 3 + + + info + + +
\ No newline at end of file From 25263583678b6b9a0aa34fcdc3ebb5dac414331c Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:13:51 +0530 Subject: [PATCH 2/6] Fixing README --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 684aae6..6dd07df 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ ROCKETCHAT_BACKEND_SERVERS=rocketchat-1:3000,rocketchat-2:3000,rocketchat-3:3000 ``` ### VoIP setup There is a quick way for rolling out a VoIP solution using Drachtio and FreeSwitch as a SIP proxy. To achieve this some network configurations are required. `compose.network.yml` defines a network private network called `rc_voip_private` for VoIP servers. Currently it uses subnet 172.28.0.0/16 and assigns static IP 172.28.0.10 and 172.28.0.11. If you would want to change this network configuration, add desired value for subnet and static ip addresses in that subnet to `freeswitch` and `drachtio` service. `compose.network.yml` also configures rocketchat service to have access to default and `rc_voip_private` network. It communicates with non VoIP services on default network and VoIP services on `rc_voip_private` network. Once the desired configuration changes are made, run - ```bash +```bash docker compose \ -f compose.monitoring.yml \ -f compose.traefik.yml \ @@ -147,7 +147,5 @@ There is a quick way for rolling out a VoIP solution using Drachtio and FreeSwit -f compose.voip.yml \ -f compose.networ.yml \ up -d - ``` - to start the stack. - - Once the stack is running, do the necessary VoIP configurations using the static ips for FreeSwitch and Drachtio. +``` +to start the stack. Once the stack is running, do the necessary VoIP configurations using the static ips for FreeSwitch and Drachtio. From f63fc28c2f80bcaae091eb856a8c58f5e59d0439 Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:17:12 +0530 Subject: [PATCH 3/6] Fixing README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dd07df..d06f155 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ There is a quick way for rolling out a VoIP solution using Drachtio and FreeSwit -f compose.database.yml \ -f compose.yml \ -f compose.voip.yml \ - -f compose.networ.yml \ + -f compose.network.yml \ up -d ``` to start the stack. Once the stack is running, do the necessary VoIP configurations using the static ips for FreeSwitch and Drachtio. From a6aa9199068b5f5938db61a4c63dbc2f97096143 Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Wed, 10 Dec 2025 01:38:20 +0530 Subject: [PATCH 4/6] Removing trailing character --- .env.example | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.example b/.env.example index 384ecc0..076ba33 100644 --- a/.env.example +++ b/.env.example @@ -41,4 +41,3 @@ NATS_BIND_IP=127.0.0.1 VOIP_DOMAIN=voip.unmiscible-desolatingly-devorah.ngrok-free.dev EXTENSION_PASSWORD=1234 FREESWITCH_PASSWORD=admin_1234 -~ From 2cc3b268d11481d415a9a7ede6ffb0fbe4307040 Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Thu, 11 Dec 2025 23:04:28 +0530 Subject: [PATCH 5/6] 1. Removing port 8021. It is no more used because we do not use FS extensions. 2. Removing extension details from docker compose as well as from the environment variables. --- .env.example | 3 +-- compose.network.yml | 22 ---------------------- compose.voip.yml | 9 --------- 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 compose.network.yml diff --git a/.env.example b/.env.example index 076ba33..53f16e6 100644 --- a/.env.example +++ b/.env.example @@ -38,6 +38,5 @@ NATS_PORT_NUMBER=4222 NATS_BIND_IP=127.0.0.1 # SIP -VOIP_DOMAIN=voip.unmiscible-desolatingly-devorah.ngrok-free.dev -EXTENSION_PASSWORD=1234 +VOIP_DOMAIN=valid.voip.domain.com FREESWITCH_PASSWORD=admin_1234 diff --git a/compose.network.yml b/compose.network.yml deleted file mode 100644 index 065c9ab..0000000 --- a/compose.network.yml +++ /dev/null @@ -1,22 +0,0 @@ -#define a private network for VoIP and its own subnet -networks: - rc_voip_private: - driver: bridge - ipam: - config: - - subnet: 172.28.0.0/16 -#add voip services to the new network -services: - freeswitch: - networks: - rc_voip_private: - ipv4_address: 172.28.0.10 - drachtio: - networks: - rc_voip_private: - ipv4_address: 172.28.0.11 - #make rocket chat connect on default network for DB and other things and VoIP network - rocketchat: - networks: - - rc_voip_private - - default \ No newline at end of file diff --git a/compose.voip.yml b/compose.voip.yml index 0b8bc98..e2e0295 100644 --- a/compose.voip.yml +++ b/compose.voip.yml @@ -6,24 +6,15 @@ services: environment: EXTERNAL_ADDRESS_FQDN: ${VOIP_DOMAIN:-} FREESWITCH_PASSWORD: ${FREESWITCH_PASSWORD:-} - EXTENSION_PASSWORD: ${EXTENSION_PASSWORD:-} - EXTENSIONS: ${EXTENSIONS:-} RTP_START_PORT: 20000 RTP_END_PORT: 20046 DEBUG_MODE: "true" - INTERNAL_INBOUND_MEDIA: "relay" - INTERNAL_OUTBOUND_TO_INTERNAL_MEDIA: "relay" - INTERNAL_OUTBOUND_TO_EXTERNAL_MEDIA: "relay" - EXTERNAL_INBOUND_MEDIA: "relay" - EXTERNAL_OUTBOUND_TO_INTERNAL_MEDIA: "relay" ACCEPT_EXTERNAL_CALLS: false USE_LEGACY_ARCH: false DRACHTIO_DOMAIN: ${VOIP_DRACHTIO_DOMAIN} expose: - - 8021 - 5060 ports: - - 8021:8021 - 20000-20046:20000-20046/udp drachtio: From f4df987fc5d4b3cd636f1b38d47e759b5d81d0fb Mon Sep 17 00:00:00 2001 From: amolghode1981 <86001342+amolghode1981@users.noreply.github.com> Date: Thu, 11 Dec 2025 23:07:32 +0530 Subject: [PATCH 6/6] Handling review comment. --- compose.voip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.voip.yml b/compose.voip.yml index e2e0295..9116840 100644 --- a/compose.voip.yml +++ b/compose.voip.yml @@ -11,7 +11,7 @@ services: DEBUG_MODE: "true" ACCEPT_EXTERNAL_CALLS: false USE_LEGACY_ARCH: false - DRACHTIO_DOMAIN: ${VOIP_DRACHTIO_DOMAIN} + DRACHTIO_DOMAIN: ${VOIP_DRACHTIO_DOMAIN:-drachtio} expose: - 5060 ports: