Skip to content

Collect Realtime information from FreeSWITCH to Influxdb & PostgreSQL

License

Notifications You must be signed in to change notification settings

DialerAI/freeswitch_realtime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collect Realtime information from FreeSWITCH to Influxdb & PostgreSQL Build Status

Collect Realtime information from FreeSWITCH to InfluxDB & PostgreSQL.

Channels information are pushed in the form of:

%ChannelSeries{fields: %ChannelSeries.Fields{value: 1},
tags: %ChannelSeries.Tags{campaign_id: 1, host: "127.0.0.1"}, timestamp: nil}

If you wish to use this with an other project you might want to remove campaign_id which is specific to Newfies-Dialer.

Installation

If available in Hex, the package can be installed as:

  1. Add freeswitch_realtime to your list of dependencies in mix.exs:

    def deps do
      [{:freeswitch_realtime, "~> 0.1.0"}]
    end
  2. Ensure freeswitch_realtime is started before your application:

    def application do
      [applications: [:freeswitch_realtime]]
    end
  3. Create directory for logs:

    mkdir /var/log/freeswitch_realtime
    
  4. Add host in your /etc/hosts eg:

    127.0.0.1     influxdb_host
    

Compile & Build Release

  1. Edit version in mix.exs

  2. Compile:

    MIX_ENV=prod mix compile

  3. Build release:

    MIX_ENV=prod mix release

Start on reboot

Add freeswitch_realtime to systemd on Debian 8.x:

cp freeswitch_realtime.service /lib/systemd/system/freeswitch_realtime.service
systemctl enable freeswitch_realtime.service
systemctl daemon-reload
systemctl restart freeswitch_realtime.service

Troubleshoot

Ensure InfluxDB is working properly.

Create DB::

curl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE mydb"

Write to serie cpu_load_short::

curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

Read data::

curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SELECT \"value\" FROM \"cpu_load_short\" WHERE \"region\"='us-west'"

With to database newfiesdialer serie freeswitch_channels_cpg_total::

curl -i -XPOST 'http://localhost:8086/write?db=newfiesdialer' --data-binary 'freeswitch_channels_cpg_total,host=37.139.13.157,campaign_id=1,leg_type=1 value=0.64 1434055562000000000'

Read from serie freeswitch_channels_cpg_total:

curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=newfiesdialer" --data-urlencode "q=SELECT \"value\" FROM \"freeswitch_channels_cpg_total\""

Todo

List of improvements and tasks,

About

Collect Realtime information from FreeSWITCH to Influxdb & PostgreSQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 85.3%
  • PLpgSQL 14.7%