diff --git a/debian/resources/postgresql/dsn.sh b/debian/resources/postgresql/dsn.sh new file mode 100644 index 0000000..6ede532 --- /dev/null +++ b/debian/resources/postgresql/dsn.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +#set the password +database_password= + +#set PGPASSWORD +export PGPASSWORD=$database_password + +#enable odbc-dsn in the xml +sed -i /etc/freeswitch/autoload_configs/db.conf.xml -e s:'::' +sed -i /etc/freeswitch/autoload_configs/fifo.conf.xml -e s:'::' +sed -i /etc/freeswitch/autoload_configs/switch.conf.xml -e s:'::' + +#enable odbc-dsn in the sip profiles +sudo -u postgres psql -d fusionpbx -c "update v_sip_profile_settings set sip_profile_setting_enabled = 'true' where sip_profile_setting_name = 'odbc-dsn';"; + +#add the dsn variables +sudo -u postgres psql -d fusionpbx -c "insert into v_vars (var_uuid, var_name, var_value, var_cat, var_enabled, var_order, var_description, var_hostname) values ('785d7013-1152-4a44-aa15-28336d9b36f9', 'dsn_system', 'pgsql://hostaddr=127.0.0.1 dbname=fusionpbx user=fusionpbx password=$database_password options=', 'DSN', 'true', '0', null, null);"; +sudo -u postgres psql -d fusionpbx -c "insert into v_vars (var_uuid, var_name, var_value, var_cat, var_enabled, var_order, var_description, var_hostname) values ('0170e737-b453-40ea-99f2-f1375474e5ce', 'dsn', 'pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=fusionpbx password=$database_password options=', 'DSN', 'true', '0', null, null);"; +sudo -u postgres psql -d fusionpbx -c "insert into v_vars (var_uuid, var_name, var_value, var_cat, var_enabled, var_order, var_description, var_hostname) values ('32e3e364-a8ef-4fe0-9d02-c652d5122bbf', 'dsn_callcenter', 'sqlite:///usr/local/freeswitch/db/call_center.db', 'DSN', 'false', '0', null, null);"; + +#remove the sqlite database files +rm /var/lib/freeswitch/db/core.db +rm /var/lib/freeswitch/db/fifo.db +rm /var/lib/freeswitch/db/call_limit.db +rm /var/lib/freeswitch/db/sofia_reg_* + +#flush memcache +./fs_cli -x 'memcache flush' + +#restart freeswitch +#service freeswitch restart