Skip to content

Instantly share code, notes, and snippets.

@dgershman
Last active March 10, 2021 17:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dgershman/0c9abf6cb55ec5932830 to your computer and use it in GitHub Desktop.
Save dgershman/0c9abf6cb55ec5932830 to your computer and use it in GitHub Desktop.
Used for configuring ODBC for FreeSWITCH
while true; do
read -p "If you already have compiled FreeSWITCH you will need to manually edit the configure file to set enable_core_odbc_support=yes, are you sure you want to continue? (y/n)" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes to continue to installing ODBC and compiling FreeSWITCH, answer no to abort this process.";;
esac
done
yum -y install unixODBC-devel mysql-connector-odbc
odbcinst -j
ln -s /usr/lib64/libmyodbc5.so /usr/lib/libmyodbc5.so
ln -s /usr/lib64/libodbcmyS.so /usr/lib/libodbcmyS.so
rm /etc/odbc.ini
rm /etc/odbcinst.ini
fscompilepath=/usr/local/src/freeswitch
odbcinst=/usr/local/etc/odbcinst.ini
echo "[MySQL]" > $odbcinst
echo "Description = ODBC for MySQL" >> $odbcinst
echo "Driver = /usr/lib/libmyodbc5.so" >> $odbcinst
echo "Setup = /usr/lib/libodbcmyS.so" >> $odbcinst
echo "Driver64 = /usr/lib64/libmyodbc5.so" >> $odbcinst
echo "Setup64 = /usr/lib64/libodbcmyS.so" >> $odbcinst
echo "FileUsage = 1" >> $odbcinst
odbcini=/usr/local/etc/odbc.ini
echo "[freeswitch]" > $odbcini
echo "Driver = MySQL" >> $odbcini
echo "SERVER = " >> $odbcini
echo "PORT = 3306" >> $odbcini
echo "DATABASE = freeswitch" >> $odbcini
echo "OPTION = 67108864" >> $odbcini
echo "USERNAME = " >> $odbcini
echo "PASSWORD = " >> $odbcini
ln -s /usr/local/etc/odbc.ini /etc/odbc.ini
ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.ini
ln -s /usr/local/etc/odbc.ini /usr/local/freeswitch/etc/odbc.ini
ln -s /usr/local/etc/odbcinst.ini /usr/local/freeswitch/etc/odbcinst.ini
cd $fscompilepath
./configure --enable-core-odbc-support && make && make install
echo "You will need to populate the SERVER, USERNAME and PASSWORD values in the file: "$odbcini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment