Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page

Table of Contents
minLevel1
maxLevel3
outlinefalse
stylenone
typelist
printablefalse

Note

This documentation is work in progress

📋 What’s about

This scenario occurs if you decide to install the push gateway on the same machine (even if we suggest to use an other machine.

METTERE IMMAGINE

📁 Docker Compose File

Note

In this paragraph we’ll analyse the

View file
namedocker-compose.yml
file that you need to download and launch, but before running the file you need to follow the requirements published below - file da correggere perchè aperta solo 5060 per udp e non tcp E MANCA 9998 PER TLS

In the file you will find as directives:

  • push-gateway for notification system

  • redis for cache

  • redisinsight for dashboard

  • drachtio for the stack SIP. In this case you must consider that in SIP protocol the used default ports are 5060 (for UDP/TCP) and 5061 (for TLS), but on XCALLY the Stack SIP is already present with Asterisk. So for the Stack SIP it’s necessary to insert other ports (a 9999 for UDP/TCP and 9998 for TLS)

Code Block
command: drachtio --contact "sip:*:9999;transport=udp --external-ip 0.0.0.0"        
ports:
  - 9999:9999/udp
  - 9999:9999
Info

As you can see in the file, as system and container ports, you can indicate the desired ones but they must be identical (e.g. 9999:9999) and you need to insert the same number port after sip (e.g. sip:*:9999).
Moreover as external-ip you have to replace 0.0.0.0 with your public IP with which your system exits

  • volumes configuration

  • logging data for logs file

  • restart : always = if the container crashes, it automatically restarts

  • networks section

FILE SSH METTI DOMINIO E IP

(blue star) Requirements

Panel
bgColor#EAE6FF
  • AGGIUNGERE REQUISITI HARDWARE CON ES. 2 CPU E 4 GB DI RAM PIETRO

  • Mancano le info relative alle caratteristiche del server che deve ospitare il container col push-gateway, quale hardware, ecc

To successfully run the docker-compose.yml file, ensure the following requirements are met:

Docker Engine: Must be image-20240905-160853.pngImage Added


(blue star) Requirements

Panel
bgColor#EAE6FF
  • In Settings/Networks section you need to correctly set your localNET and ExternIP (that you can retrieve by launching the command curl https://ifconfig.me/ipand from the output you will be able to copy your IP (the string e.g. 11.222.33.444)

  • Hardware with minimum 1 CPU and 2 GB RAM (but always consider that thisdepends on the expected traffic)

  • You can use all operating systems, that support the required Docker Engine for example Debian

  • You will download the file published in this page (with or without tls depending on your needs) in tmp.
    When you will dearchived it by launching the command -c, file will be inserted in /etc push gateway folder

  • Retrieve your public IP and PushGatewayDnsName to enter then in Drachtio configuration

  • If you want to use TLS, you need to retrieve these 3 files of certificates data: KeyCert, CertFile and ChainCert,that you will need when you configure the Drachtio Conf file

  • Before running the docker compose file:

    • ensure that Docker Engine is installed on the system where you want to run the containers.

AGGIUNGERE COMANDO SE SIAMO SU SCENARIO 1 - SE SCENARIO 1 GIà INSTALLATO IN XCALLY
Se usi altro sistema operativo tieni conto dei comandi di quel sistema operativo

Docker Compose: Ensure
    • If for the push gateway you use the same XCALLY server, Docker Engine is installed by default.
      To verify the Docker installation, you can launch the command docker - v and the output will show you the installed Docker version:
      motion@xc-aws-mil-dev-xc01:~$ docker -v

      Docker version 24.0.7, build afdd53b

    • ensure that Docker Compose is installed, as the docker-compose.yml file will be used to manage the containers.

DI DEFAULT GIà INSTALLATO CON docker - v e docker compose version per vedere se installati
    • By using the same machine, Docker Compose is installed by default.
      To verify if the Docker Compose is correctly installed you can launch the command docker compose versionand the output will show you the installed Docker compose version:
      motion@xc-aws-mil-dev-xc01:~$ docker compose version

      Docker Compose version v2.21.0

  1. Environment Variables Configuration:

  • Some environment variables are required for the services to function correctly. Make sure to configure them properly before running the docker -compose.yml.
    The necessary environment variables are: RICOPIARE DA FILEcompose file:

    • DEBUG_LEVEL: Debug =info | debug level for the push gateway.

    • TOKEN_KEY: =xcally.p8 | Token key for authentication.

    • TOKEN_KEY_ID: =X4R3256H89 | Token key ID.

    • TOKEN_TEAM_ID: =7WCL6FH953 | Team ID of the token.

    • DRACHTIO_HOST: =drachtio | Host address of the Drachtio server.

    • DRACHTIO_PORT: =9022 | Port of the Drachtio server.

    • DRACHTIO_SECRET: =cymru | Secret for the Drachtio server

  • Ensure these values are set and ready before running the docker-compose.yml.

  • For the standard configuration, it is highly recommended to have push gateway on a machine separate from XCALLY (Installing the push gateway on the same machine as XCALLY is recommended for testing only, and in that case follow the procedure reported below)
    PER I PARTNER O CLIENTI CON + MACCHINE, SE TIENI SEPARATI LO STESSO PUSH GATEWAY SI PUò USARE PER PIù CLIENTI, IN PIù PER RAGIONI SICUREZZA è ISOLATO

💡 Running the docker-compose.yml File

Remember that if you decide for any reason to define another drachtio host, port, or secret, these data must also be changed in the variables above.

🎬 Video Tutorial - same server with TLS

In this video you will see the scenario in which you choose to install the push gateway on the same server with TLS
Let’s see the steps to follow:

List of commands:

  • tar zxvf push-gateway-same-machine.tar.gz -C /etc

  • cd /etc/push-gateway

  • curl https://ifconfig.me/ip

  • cd ssl
    ls -la

  • nano conf/drachtio.conf.xml

  • docker compose up -d

  • docker compose ps

📁 Archive to download

ONLY WITH UDP/TCP

WITH TLS

View file
namepush-gateway-same-machine.tar.gz

View file
namepush-gateway-same-machine-tls.tar.gz

  • You need to open the desired file on your Linux machine and you will see it in this way:

image (8)-20240906-154131.jpgImage Added
  • You have to unarchive the file:

    • by launching the command tar zxvf push-gateway-same-machine.tar.gz if you use the folder only with UDP/TCP

    • by launching the command tar zxvf push-gateway-same-machine-tls.tar.gz if you use the TLS

image (7)-20240906-154410.jpgImage Added
  • The push gateway folder will be created. To enter the folder, run the command cd push-gateway

image (7)-20240906-154054.jpgImage Added
  • Then you need to launch command nano conf/drachtio.conf.xml to edit file in conf folder for Drachtio configuration in which you will need to specify your public IPand Push Gateway Dns Name

image (9)-20240906-154650.jpgImage Added
Info

To retrieve the public IP of your server, you can launch the command
curl https://ifconfig.me/ip
From the output you will be able to copy your IP (the string 11.222.33.444)

image (5)-20240906-072842.jpgImage Added

🔐 Drachtio Conf with TLS

Code Block
<drachtio>
        <admin port="9022" secret="cymru">0.0.0.0</admin>
  <sip>
    <contacts>
      <contact dns-names="YourPushGatewayDnsName" external-ip="YourPushGatewayPubblicIp">sips:*:9999;transport=tls</contact>
      <contact dns-names="YourPushGatewayDnsName" external-ip="YourPushGatewayPubblicIp">sip:*:9998;transport=udp,tcp</contact>
    </contacts>
    <tls>
      <key-file>/etc/ssl/xcally/YourKeyCertFile</key-file>
      <cert-file>/etc/ssl/xcally/YourCertFile</cert-file>
      <chain-file>/etc/ssl/xcally/YourChainCertFile</chain-file>
      <dh-param>/etc/ssl/xcally/dh2048.pem</dh-param>
    </tls>
  </sip>
  <logging>
     <console/>
     <sofia-loglevel>3</sofia-loglevel>
     <loglevel>info</loglevel>
  </logging>
</drachtio>

In file drachtio.conf.xml you need to:

  • insert YourPushGatewayDnsName in contact dns-names section

  • insert YourPushGatewayPublicIp in external-ip section

Info

You can see that for TLS transport the designated port is 9999, for UDP/TCP transports the 9998.This is because you must consider that in SIP protocol the used default ports are 5060 (for UDP/TCP) and 5061 (for TLS), but on XCALLY the Stack SIP is already present with Asterisk. So if you use the same server, for the Stack SIP it’s necessary to insert other ports (a 9999 for TLS and 9998 for TCP/UDP)

After you unarchived the file, automatically you will have the folder /etc/pushgateway/ssl, where you need to move your certificate data and it’s mandatoryto have these 3 files: KeyCert, CertFile and ChainCert

  • so in tls section, specify:

    • YourKeyCertFile

    • YourCertFile

    • YourChainCertFile

🔧 Drachtio Conf without TLS

Code Block
<drachtio>
    <admin port="9022" secret="cymru">0.0.0.0</admin>
  <sip>
    <contacts>
      <contact dns-names="YourPushGatewayDnsName" external-ip="YourPushGatewayPubblicIp">sip:*:9998;transport=udp,tcp</contact>
    </contacts>
  </sip>
  <logging>
     <console/>
     <sofia-loglevel>3</sofia-loglevel>
     <loglevel>info</loglevel>
  </logging>
</drachtio>

In the file drachtio.xonf.xml you need to:

  • insert YourPushGatewayDnsName in contact dns-names section

  • insert YourPushGatewayPublicIp in external-ip section

Info

You can see that for UDP/TCP transports the 9998

💡 Run the docker-compose.yml

To run the docker-compose.yml file, follow these steps:

  1. Configure Environment Variables:

  • Download and open Open a terminal or command prompt

  • Open the docker-compose.yml file with a text editor. As installation path, you need to install it come utente root passo a motion e ti sposti in /home/motion ( creando una cartella all’interno nominata push-gateway) :

    View file
    namedocker-compose.yml
    CARICATO FILE NUOVO INVIATO VIA MAIL - file da correggere perchè aperta solo 5060 per udp e non tcp

  • Modify the listed environment variables in the "Requirements" section with appropriate values.
    PRENDERE DA FILE

  1. Run the Docker Compose Command:

  • Open a terminal or command prompt.

  • Navigate to the Modify, if necessary, the environment variables published in requirements

  • As ports you can view this configuration

Code Block
ports:
  - 9999:9999
  - 9998:9998
  - 9998:9998/udp

  • In the directory where the docker-compose.yml file is located.Run the following command , run the Docker Compose Command to start the containers:

After running the
Code Block
docker compose up -d
immagine-20240614-071616.pngImage Removed

  1. Verify Container Startup:

With this command, Docker Compose will start the containers in the background

.You can

immagine-20240614-071616.pngImage Added
  • Verify Container Startup: to verify the status of the containers by running , you have to run the command:

Code Block
docker compose ps

I 4 PACCHETTIYou can see the 4 containers correctly present

image-20240614-073114.png
  • Ensure all services listed in the docker-compose.yml file are running correctly

At the end of the process you will have:

  • push-gateway for notification system

  • redis for cache

  • redisinsight for dashboard

  • drachtio for the stack SIP. As we have seen, you can indicate as ports for UDP/TCP the 9998 and for TLS the 9999, but if you prefer, you can decide to change it (in this case remember to use this information also in mobile agent configuration and to edit them in the drachtio conf file that we’ve analysed above).

  • volumes configuration

  • logging data for logs file

  • restart : always = if the container crashes, it automatically restarts

  • networks section

📊 Access

RedisInsight:

RedisInsight

Info

This is an optional step

RedisInsight is the module installed in the docker compose file to view cache content (it works as cache dashboard).

  • Once running, you can access the RedisInsight web interface by opening your browser and navigating to:

Using the Services:
Code Block
http://serverIP:5540
SERVE PER VISUALIZZARE CONTENUTO DELLA CACHE. è CACHE DASHBOARD, DI DEFAUTL CREATA SENZA DB = add redis database
Info

As serverIP you need to indicate the IP of your XCALLY server (as you are using the same machine)

By default it is created without database and you need to add it, by inserting

  • host : redis

  • porta da non cambiare di default

  • alias come vuoi

  • use the default port

  • define the desired alias

  • you can test connection

aggiungi database

si vedranno TUTTE CHIAVI MEMORIZZATE IN MEMORIA

  • Use the default credentials (if any) to log in to RedisInsight and monitor the Redis instance

Add database

Every time a mobile app is connected, you will see all the keys saved in cache memory

The services are now running and ready to be used.

You can interact with the push gateway, the Redis server, and the Drachtio server as required.

🔥 Configure the firewall

It’s necessary to configure the firewall to accept requests arriving on different ports:

  • 5540 for Redisinsight: optional if you want to reach the service from the web

  • 5060 for Drachtio (mandatory to make it work)

  • 5061 for Drachtio TLS (mandatory to make it work)

🛑 How to stop the Containers

To stop and remove the containers (preserving the data), run the following command in the same directory as the docker-compose.yml file:

Code Block
docker compose down
image-20240614-074359.pngImage Removed

This command will stop and remove all containers associated with the docker-compose.yml file.

These instructions should guide you through the process of running the provided docker-compose.yml file.

If you encounter any issues during the execution or have additional questions, please don't hesitate to ask for assistance.

Otherwise, to remove the whole stack (including data):

Code Block
docker compose down -v
image-20240614-074248.pngImage Removed

Instead, to remove the single container:

Code Block
docker compose down <service name>
image-20240614-074107.pngImage Removed➡️ How to restart the container
Code Block
docker compose restart <service name>

<service name> is the name assigned within the docker-compose.yml e.g. service drachtio

image-20240614-073824.pngImage Removed

Service Name

Description

push-gateway

service to generate push notification

redis

cache server

redisinsight

web GUI for redis

drachtio

proxy sip

To recreate the single container:

Code Block
docker compose up <service name> -d
image-20240614-074154.pngImage Removed

👁️ How to view logs or status

To view container logs:

Code Block
docker logs <container name>
image-20240614-073850.pngImage Removed

To view container status:

Code Block
docker stats
image-20240614-073151.pngImage Removed

To access a container:

Code Block
docker exec -ti <container name> /bin/bash

To exit the container, type exit.

image-20240614-073957.pngImage Removed

SE DEVI ESPORRE ALL’ESTERNO CAMBIARE PORTA

FILE SSH METTI DOMINIO E IP

  • 9998 for Drachtio TCP/UDP

  • 9999 for Drachtio TLS

  • 10000-20000 for RTP stream to allow the voice connection. These ports are open during the call but they are used by Asterisk only after having negotiated ports with external phones

  • 5540 for RedisInsight: optional if you want to reach the service from the web to view cache dashboard

👥 How to configure Mobile Agents

In this scenario, when you create Mobile Agents in Staff Sectionyou will need to specify your Push Gateway Address with the correct port.

image-20240905-103018.pngImage Added

In Staff → Agents → Edit Mobile Agent → Mobile App section → Mobile App Push Gateway you need to specify the push gateway address, that in this case is your IP/XCALLY server address (the same machine you are using) + the specific port used for push gateway (e.g. myxcallyaddress/:9999)

NoteTo use TLS protocol,

Info

You need to indicate the public IP of the server. You can retrieve it by launching the command curl https://ifconfig.me/ip
From the output you will be able to copy your IP (the string 11.222.33.444)

Consider that if you want to use TLS protocol (being a secure protocol that requires a certificate, ) the registered domain must be that of the certificate, so in this field you can apply only the certified domain and not the IP

image-20240905-103018.pngImage Removed

.

image (5)-20240906-072842.jpgImage Added
image-20241009-103903.pngImage Added

Moreover in the agent’s Voice section it’s important to use the same Transport protocol that you decide to use on push gateway.

We recommend to use both udp,tcp options if you use a configuration without tls

image-20240909-142706.pngImage Added

If you use TLS, you need to select tls protocol as transport.

image-20240917-105017.pngImage Added

Moreover for TLS it’s necessary to enable encryption

image-20240909-142957.pngImage Added