New FreeSWITCH Db application added.

Status
Not open for further replies.

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,414
376
83
A new application has been added to the DjangoPBX Applications repository:
https://github.com/djangopbx/djangopbx-applications

If, in the installer, you opted to move the FreeSWITCH database from SQLite into PostgreSql, then this application provides access to the FreeSWITCH tables and also presents them for viewing in the Admin Interface.
This application also adds an additional 27 REST API endpoints that allow each of the FreeSWITCH tables to be accessed via the API.

Below are a couple of screenshots, one of the tables in the Admin interface, and one showing the links in the Browsable API viewer.

Screenshot from 2024-03-07 15-48-02.png

Ignore the http URLs, this is a screenshot from a test box, the connection would normally be https with an FQDN on port 443.

Screenshot from 2024-03-07 15-47-29.png

If you do not have the FreeSWITCH tables in PostgreSql, you can set it up manually. The steps taken to set this up in the install script may be of some help.
For convenience, the relevant section of install.sh is reproduced here:

Code:
###############################################
# Freeswitch core DB in postgreSql
###############################################
if [[ $freeswitch_core_in_postgres == "yes" ]]
then
    echo " "
    echo "Updating Switch DSNs..."
    sudo -u django-pbx bash -c "source ~/envdpbx/bin/activate && cd /home/django-pbx/pbx && python3 manage.py updateswitchvariable --category DSN --name dsn --value \"pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='${database_password}'\""
    sudo -u django-pbx bash -c "source ~/envdpbx/bin/activate && cd /home/django-pbx/pbx && python3 manage.py updateswitchvariable --category DSN --name dsn_callcentre --value \"pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='${database_password}'\""
    sudo -u django-pbx bash -c "source ~/envdpbx/bin/activate && cd /home/django-pbx/pbx && python3 manage.py updateswitchvariable --category DSN --name dsn_voicemail --value \"pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='${database_password}'\""
    sed -r -i 's/<!-- (<param name="core-db-dsn" value="\$\$\{dsn\}" \/>) -->/\1/g' /home/django-pbx/freeswitch/autoload_configs/switch.conf.xml
    sed -r -i 's/<!-- (<param name="auto-create-schemas" value="false"\/>) -->/\1/g' /home/django-pbx/freeswitch/autoload_configs/switch.conf.xml
    sed -r -i 's/<!-- (<param name="auto-clear-sql" value="false"\/>) -->/\1/g' /home/django-pbx/freeswitch/autoload_configs/switch.conf.xml
    sed -r -i 's/<!--(<param name="odbc-dsn" value="\$\$\{dsn\}"\/>)-->/\1/g' /home/django-pbx/freeswitch/autoload_configs/voicemail.conf.xml
    sed -r -i 's/<!--(<param name="odbc-dsn" value="\$\$\{dsn\}"\/>)-->/\1/g' /home/django-pbx/freeswitch/autoload_configs/fifo.conf.xml
    sed -r -i 's/<!--(<param name="odbc-dsn" value="\$\$\{dsn\}"\/>)-->/\1/g' /home/django-pbx/freeswitch/autoload_configs/db.conf.xml
    sed -r -i 's/(<param name="dbname" value="\/var\/lib\/freeswitch\/vm_db\/voicemail_default.db"\/>)/<!--\1-->/g' /home/django-pbx/freeswitch/autoload_configs/voicemail.conf.xml
    sudo -u postgres psql -d djangopbx -c "update pbx_sip_profile_settings set enabled = 'true' where name = 'odbc-dsn';"
    sudo -u django-pbx bash -c 'source ~/envdpbx/bin/activate && cd /home/django-pbx/pbx && python3 manage.py writeoutswitchvars'
fi
 
Last edited:
Status
Not open for further replies.