[Freeswitch-users] Monitoring mod_odbc_cdr

Francesco Facco de Lagarda francesco at delagarda.com
Fri Nov 16 13:08:20 UTC 2018


These are my notes on how I got it working..
Hope they help!
NOTE: I just set it up, but don’t really use. It works, but NOWHERE is a timestamp/date time field!!! I think you just have to play with config and db tables to setup

F



https://freeswitch.org/confluence/display/FREESWITCH/Using+ODBC+in+the+core

// mod-odbc-cdr

apt-get install libmyodbc
apt-get install freeswitch-mod-odbc-cdr

// SETUP odbc..

/etc/odbc.ini for MySQL


[cdr]
Description=description of your DSN
Driver=myodbc_mysql
Server=localhost
Port=3306
Socket=/var/run/mysqld/mysqld.sock
Database=cdr
Username=*******
Password=********
Option=3
ReadOnly=No

Test with 

isql -v cdr

SQL> show tables;
+-----------------------------------------------------------------+
| Tables_in_cdr                                                   |
+-----------------------------------------------------------------+
| cdr_table_a_leg                                                 |
| cdr_table_b_leg                                                 |
| cdr_table_both                                                  |
+-----------------------------------------------------------------+
SQLRowCount returns 3
3 rows fetched
SQL>



https://asterisk-pbx.ru/wiki/freeswitch/freeswitch-cdr-viewer

to get it to connect with the right use, use ...
<param name="odbc-dsn" value="cdr:root:passw0rd"/>

<configuration name="odbc_cdr.conf" description="ODBC CDR Configuration">
    <settings>
        <param name="odbc-dsn" value="cdr:root:passw0rd"/>
        <!-- param name="odbc-dsn" value="odbc://cdr"/ -->

        <!-- global value can be "a-leg", "b-leg", "both" (default is "both") -->
        <param name="log-leg" value="both"/>
        <!-- value can be "always", "never", "on-db-fail" -->
        <param name="write-csv" value="on-db-fail"/>
        <!-- location to store csv copy of CDR -->
        <param name="csv-path" value="/var/log/freeswitch/odbc_cdr"/>
        
        <!-- if "csv-path-on-fail" is set, failed INSERTs will be placed here as CSV files otherwise they will be placed in "csv-path" -->
        <param name="csv-path-on-fail" value="/var/log/freeswitch/odbc_cdr/failed"/>
        <!-- dump SQL statement after leg ends -->
        <param name="debug-sql" value="true"/>
    </settings>
    <tables>
        <!-- only a-legs will be inserted into this table -->
        <table name="cdr_table_a_leg" log-leg="a-leg">
            <field name="CallId" chan-var-name="call_uuid"/>
            <field name="orig_id" chan-var-name="uuid"/>
            <field name="term_id" chan-var-name="sip_call_id"/>
            <field name="ClientId" chan-var-name="uuid"/>
            <field name="IP" chan-var-name="sip_network_ip"/>
            <field name="IPInternal" chan-var-name="sip_via_host"/>
            <field name="CODEC" chan-var-name="read_codec"/>
            <field name="directGateway" chan-var-name="sip_req_host"/>
            <field name="redirectGateway" chan-var-name="sip_redirect_contact_host_0"/>
            <field name="CallerID" chan-var-name="sip_from_user"/>
            <field name="TelNumber" chan-var-name="sip_req_user"/>
            <field name="TelNumberFull" chan-var-name="sip_to_user"/>
            <field name="sip_endpoint_disposition" chan-var-name="endpoint_disposition"/>
            <field name="sip_current_application" chan-var-name="current_application"/>
        </table>
        <!-- only b-legs will be inserted into this table -->
        <table name="cdr_table_b_leg" log-leg="b-leg">
            <field name="CallId" chan-var-name="call_uuid"/>
            <field name="orig_id" chan-var-name="uuid"/>
            <field name="term_id" chan-var-name="sip_call_id"/>
            <field name="ClientId" chan-var-name="uuid"/>
            <field name="IP" chan-var-name="sip_network_ip"/>
            <field name="IPInternal" chan-var-name="sip_via_host"/>
            <field name="CODEC" chan-var-name="read_codec"/>
            <field name="directGateway" chan-var-name="sip_req_host"/>
            <field name="redirectGateway" chan-var-name="sip_redirect_contact_host_0"/>
            <field name="CallerID" chan-var-name="sip_from_user"/>
            <field name="TelNumber" chan-var-name="sip_req_user"/>
            <field name="TelNumberFull" chan-var-name="sip_to_user"/>
            <field name="sip_endpoint_disposition" chan-var-name="endpoint_disposition"/>
            <field name="sip_current_application" chan-var-name="current_application"/>
        </table>
        <!-- both legs will be inserted into this table -->
        <table name="cdr_table_both">
            <field name="CallId" chan-var-name="uuid"/>
            <field name="orig_id" chan-var-name="Caller-Unique-ID"/>
            <field name="TEST_id" chan-var-name="sip_from_uri"/>
        </table>
    </tables>
</configuration>

-----Original Message-----
From: FreeSWITCH-users <freeswitch-users-bounces at lists.freeswitch.org> On Behalf Of morfair at gmail.com
Sent: venerdì 16 novembre 2018 11:47
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Subject: [Freeswitch-users] Monitoring mod_odbc_cdr

Hello all!

I use mod_odbc_cdr for store CDR in  MySQL for billing. Today I saw that no records in DB in 2 weeks. IT IS FAIL!!

I went to fs_cli and type `reload mod_odbc_cdr`. After that all work again. But I lost records in two weeks.

How to monitor mod_odbc_cdr and prevent risks with its?


_________________________________________________________________________
Professional FreeSWITCH Services
sales at 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 at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com




More information about the FreeSWITCH-users mailing list