Collect and push CDRs from FreeSWITCH Sqlite to PostgreSQL.
If available in Hex, the package can be installed as:
-
Add
excdr_pusher
to your list of dependencies inmix.exs
:def deps do [{:excdr_pusher, "~> 0.1.0"}] end
-
Ensure
excdr_pusher
is started before your application:def application do [applications: [:excdr_pusher]] end
-
Create directory for logs:
mkdir /var/log/excdr_pusher
-
Add host in your
/etc/hosts
eg:127.0.0.1 influxdb_host
-
Edit version in
mix.exs
-
Compile:
MIX_ENV=prod mix compile
-
Build release:
MIX_ENV=prod mix release
You will need to install inotify-tools to use mix test.watch
.
mix test.watch
will automatically run your Elixir project's tests each
time you save a file (https://github.com/lpil/mix-test.watch)
You will need inotify-tools installed.
We use Credo as colinter
mix credo
Add excdr_pusher to systemd
on Debian 8.x:
cp excdr_pusher.service /lib/systemd/system/excdr-pusher.service
systemctl enable excdr-pusher.service
systemctl daemon-reload
systemctl restart excdr-pusher.service
List of improvements and tasks,
- Repo.insert_all make genserver crash on error, so we need to find a way to capture error, and uncommit the sqlite CDRs that were fetched, this will ensure that on error we can do something, maybe flag the CDRs as errors for future checks
- use conform to support config file
- add inch_ex
- add credo - https://github.com/rrrene/credo