Switch to MySQL db for config
I would like to use MySQL to hold my FreeSWITCH config. I found instructions on how to setup the DSN, but how to I create the db/table structure? Is there a script to do this?
On Monday 06 December 2021 at 16:00:30, TTT wrote:
I would like to use MySQL to hold my FreeSWITCH config.
What do you mean by "config"? All of it, or just certain aspects (such as user directory, SIP registrations, dialplan...)?
I found instructions on how to setup the DSN,
Point us at the URL so that we know what you're doing?
but how to I create the db/table structure? Is there a script to do this?
What are you using as the "glue" between MySQL and FreeSwitch? Common options would be xml-curl or lua. In both cases you create your DB tables however you like, and you then write a lua script or create something that curl can interrogate, to return the XML which you would otherwise have placed into a flat file for FreeSwitch to parse. Regards, Antony. -- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT Please reply to the list; please *don't* CC me.
I was actually referring to FreeSWITCH core. I'm reading a book on FreeSwitch (https://www.amazon.ca/FreeSWITCH-1-8-Anthony-Minessale-II-ebook/dp/B071ZZBH8...) and it mentions that FreeSWITCH keeps its operating information in a database at runtime. I think it's PostgreSQL I was wondering if/how I could switch that to MySQL. I thought there might be a DSN setting in the XML registry that affects this. This books says you can setup ODBC providers but it's not clear how, or if this applies to "core". -----Original Message----- From: FreeSWITCH-users [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Antony Stone Sent: Monday, December 6, 2021 11:02 AM To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] Switch to MySQL db for config On Monday 06 December 2021 at 16:00:30, TTT wrote:
I would like to use MySQL to hold my FreeSWITCH config.
What do you mean by "config"? All of it, or just certain aspects (such as user directory, SIP registrations, dialplan...)?
I found instructions on how to setup the DSN,
Point us at the URL so that we know what you're doing?
but how to I create the db/table structure? Is there a script to do this?
What are you using as the "glue" between MySQL and FreeSwitch? Common options would be xml-curl or lua. In both cases you create your DB tables however you like, and you then write a lua script or create something that curl can interrogate, to return the XML which you would otherwise have placed into a flat file for FreeSwitch to parse. Regards, Antony. -- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT Please reply to the list; please *don't* CC me. _________________________________________________________________________ The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform. Join our online community to chat in real time https://signalwire.community Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
Hi, Adding " <param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='blablabla' options='-c client_min_messages=NOTICE'" />" to "switch.conf.xml" did the trick for us. You can add a similar line for mariadb/mysql. Rahman TTT <lists@telium.io>, 8 Ara 2021 Çar, 07:12 tarihinde şunu yazdı:
I was actually referring to FreeSWITCH core. I'm reading a book on FreeSwitch ( https://www.amazon.ca/FreeSWITCH-1-8-Anthony-Minessale-II-ebook/dp/B071ZZBH8...) and it mentions that FreeSWITCH keeps its operating information in a database at runtime. I think it's PostgreSQL
I was wondering if/how I could switch that to MySQL. I thought there might be a DSN setting in the XML registry that affects this. This books says you can setup ODBC providers but it's not clear how, or if this applies to "core".
-----Original Message----- From: FreeSWITCH-users [mailto: freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Antony Stone Sent: Monday, December 6, 2021 11:02 AM To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] Switch to MySQL db for config
On Monday 06 December 2021 at 16:00:30, TTT wrote:
I would like to use MySQL to hold my FreeSWITCH config.
What do you mean by "config"?
All of it, or just certain aspects (such as user directory, SIP registrations, dialplan...)?
I found instructions on how to setup the DSN,
Point us at the URL so that we know what you're doing?
but how to I create the db/table structure? Is there a script to do this?
What are you using as the "glue" between MySQL and FreeSwitch? Common options would be xml-curl or lua. In both cases you create your DB tables however you like, and you then write a lua script or create something that curl can interrogate, to return the XML which you would otherwise have placed into a flat file for FreeSwitch to parse.
Regards,
Antony.
-- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
This page talks about it: https://freeswitch.org/confluence/display/FREESWITCH/ODBC+DSN. Basically there's a parameter switch-core-dsn in switch.conf.xml. In the vanilla config there's a bunch of comments in that file explaining the options. No need to worry about creating the schema - FreeSWITCH does that for you. Martin. Martin Paterson, Pattersong Music Reduced orchestrations of G&S On Tue, 7 Dec 2021 at 22:25, TTT <lists@telium.io> wrote:
I was actually referring to FreeSWITCH core. I'm reading a book on FreeSwitch (https://www.amazon.ca/FreeSWITCH-1-8-Anthony-Minessale-II-ebook/dp/B071ZZBH8...) and it mentions that FreeSWITCH keeps its operating information in a database at runtime. I think it's PostgreSQL
I was wondering if/how I could switch that to MySQL. I thought there might be a DSN setting in the XML registry that affects this. This books says you can setup ODBC providers but it's not clear how, or if this applies to "core".
-----Original Message----- From: FreeSWITCH-users [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Antony Stone Sent: Monday, December 6, 2021 11:02 AM To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] Switch to MySQL db for config
On Monday 06 December 2021 at 16:00:30, TTT wrote:
I would like to use MySQL to hold my FreeSWITCH config.
What do you mean by "config"?
All of it, or just certain aspects (such as user directory, SIP registrations, dialplan...)?
I found instructions on how to setup the DSN,
Point us at the URL so that we know what you're doing?
but how to I create the db/table structure? Is there a script to do this?
What are you using as the "glue" between MySQL and FreeSwitch? Common options would be xml-curl or lua. In both cases you create your DB tables however you like, and you then write a lua script or create something that curl can interrogate, to return the XML which you would otherwise have placed into a flat file for FreeSwitch to parse.
Regards,
Antony.
-- .evah I serutangis sseltniop tsom eht fo eno eb tsum sihT
Please reply to the list; please *don't* CC me.
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
On 12/7/2021 2:25 PM, TTT wrote:
I was actually referring to FreeSWITCH core. I'm reading a book on FreeSwitch (https://www.amazon.ca/FreeSWITCH-1-8-Anthony-Minessale-II-ebook/dp/B071ZZBH8...) and it mentions that FreeSWITCH keeps its operating information in a database at runtime. I think it's PostgreSQL
I was wondering if/how I could switch that to MySQL. I thought there might be a DSN setting in the XML registry that affects this. This books says you can setup ODBC providers but it's not clear how, or if this applies to "core".
I believe you can. The module in question is mod_mariadb, but that's because it uses the mariadb shared library rather than the mysql shared library, not because it only works with mariadb. Those two use compatible over-the-wire protocols, so using it to talk to mysql shouldn't be an issue. I haven't tested this with mysql itself, however. At any rate, these are the steps it took for me using MariaDB. Much simpler than ODBC in my opinion. You will want to make sure that mod_mariadb is installed and preloaded. I'm not certain that preloaded is necessary, but it was specified in the writeup I found. So this is the file autoload_configs/pre_load_modules.xml from my server. <configuration name="pre_load_modules.conf" description="Modules"> <modules> <!-- Databases --> <load module="mod_mariadb" /> <!-- <load module="mod_pgsql"/> --> </modules> </configuration> Then, you need to set the core-db-dsn param in switch.conf.xml as mentioned above. In the case of a mariadb dsn, it would look like this. <param name="core-db-dsn" value="mariadb://Socket=/var/run/mysqld/mysqld.sock;Database=FreeSWITCH;uid=FreeSWITCH;Pwd=XXXXXXXXXXXX"/> If you're using TCP instead of a unix socket, replace the "Socket=[socket name]" with "Host=[host name]" and a setting for Port if you're not using the default port. Also, change the Database and uid parameter to suit your setup. Oh, and as an FYI, the default storage provider that FreeSWITCH uses is SQLLite, not PGSQL.
participants (5)
-
Antony Stone
-
Eric Schwertfeger
-
Martin Paterson
-
Rahman Duran
-
TTT