Maxi
Maxi

Reputation: 443

Freeswitch users directory using a database

I am quite new to freeswitch and want my directory currently hardcoded in XML config files on the server to be in a relational database. I found this tutorial:

https://saevolgo.blogspot.com/2012/07/freeswitch-with-sip-users-in-mysql-mod.html

But this seems very outdated as the GIT repository used does not exist anymore. Can anyone let me know the XML I have to fill so that it gets the users from database instead of other XML files? Per default it does this:

<users>
  <X-PRE-PROCESS cmd="include" data="default/*.xml"/>
</users>

But I guess there is a similar configuration to get them from database? Thanks in advance

Upvotes: 0

Views: 3381

Answers (2)

Maxi
Maxi

Reputation: 443

Although @os11k answered the question with good references I decided to go antoher way:

In /etc/freeswitch/autoload_configs/xml_curl.conf.xml I put

<configuration name="xml_curl.conf" description="cURL XML Gateway">
  <bindings>
    <binding name="directory">
      <param name="method" value="GET" />
      <param name="gateway-url" value="https://example.com/my-freeswitch-directory.xml" bindings="directory"/>
    </binding>  

    <binding name="dialplan">
      <param name="gateway-url" value="https://example.com/my-freeswitch-dialplan.xml" bindings="diaplan"/>
      <param name="method" value="GET" />
    </binding>
  </bindings>
</configuration>

Then I am able to autogenerate the dialplan and directory on my webserver and don't need to connect to a central database with my freeswitch servers. Don't forget to activate the module xml_curl in /etc/freeswitch/autoload_configs/modules.xml

Upvotes: 3

os11k
os11k

Reputation: 1358

The FreeSWITCH Database Handler allows you to connect to databases from your Lua script:

https://freeswitch.org/confluence/display/FREESWITCH/Lua+FreeSWITCH+Dbh

Here is example for using Database handler with user directory

https://asterisk-pbx.ru/wiki/blog/freeswitch_directory_mysql_storage_with_lua_dbh

Upvotes: 2

Related Questions