[Freeswitch-users] Problem with ODBC Cdr

Francesco Facco de Lagarda francesco at delagarda.com
Mon Aug 6 13:02:18 UTC 2018


I have (details below) 

1.	I have setup a mysql db as specified in docs
2.	I have setup odbc and tested with isql
3.	I have installed relevant modules (apt get as that's how my fs is
installed)
4.	I have included module in autoload modules.conf.xml
5.	I have configured odbc_cdr.conf

 

Every time I try to start freeswitch service it crashes, neither 'systemctl
status freeswitch.service' or 'journalctl -xn' give any useful info (6):

 

Freewitch runs fine if I exlude odbc_cdr.conf

 

Please  help

 

 

 

 

DETAILS

 

=========================================================================

1. cdr db tables

=========================================================================

CREATE TABLE `cdr_table_a_leg` (

`CallId` VARCHAR(80) NULL DEFAULT NULL,

`orig_id` VARCHAR(80) NULL DEFAULT NULL,

`term_id` VARCHAR(80) NULL DEFAULT NULL,

`ClientId` VARCHAR(80) NULL DEFAULT NULL,

`IP` VARCHAR(80) NULL DEFAULT NULL,

`IPInternal` VARCHAR(80) NULL DEFAULT NULL,

`CODEC` VARCHAR(80) NULL DEFAULT NULL,

`directGateway` VARCHAR(80) NULL DEFAULT NULL,

`redirectGateway` VARCHAR(80) NULL DEFAULT NULL,

`CallerID` VARCHAR(80) NULL DEFAULT NULL,

`TelNumber` VARCHAR(80) NULL DEFAULT NULL,

`TelNumberFull` VARCHAR(80) NULL DEFAULT NULL,

`sip_endpoint_disposition` VARCHAR(80) NULL DEFAULT NULL,

`sip_current_application` VARCHAR(80) NULL DEFAULT NULL

)

COLLATE='latin1_swedish_ci'

ENGINE=InnoDB

;

 

CREATE TABLE `cdr_table_b_leg` (

`CallId` VARCHAR(80) NULL DEFAULT NULL,

`orig_id` VARCHAR(80) NULL DEFAULT NULL,

`term_id` VARCHAR(80) NULL DEFAULT NULL,

`ClientId` VARCHAR(80) NULL DEFAULT NULL,

`IP` VARCHAR(80) NULL DEFAULT NULL,

`IPInternal` VARCHAR(80) NULL DEFAULT NULL,

`CODEC` VARCHAR(80) NULL DEFAULT NULL,

`directGateway` VARCHAR(80) NULL DEFAULT NULL,

`redirectGateway` VARCHAR(80) NULL DEFAULT NULL,

`CallerID` VARCHAR(80) NULL DEFAULT NULL,

`TelNumber` VARCHAR(80) NULL DEFAULT NULL,

`TelNumberFull` VARCHAR(80) NULL DEFAULT NULL,

`sip_endpoint_disposition` VARCHAR(80) NULL DEFAULT NULL,

`sip_current_application` VARCHAR(80) NULL DEFAULT NULL

)

COLLATE='latin1_swedish_ci'

ENGINE=InnoDB

;

 

CREATE TABLE `cdr_table_both` (

`CallId` VARCHAR(80) NULL DEFAULT NULL,

`orig_id` VARCHAR(80) NULL DEFAULT NULL,

`TEST_id` VARCHAR(80) NULL DEFAULT NULL

)

COLLATE='latin1_swedish_ci'

ENGINE=InnoDB

;

 

 

=========================================================================

2. ODBC setup

=========================================================================

/etc/odbcinst.ini

[myodbc_mysql]

Description=ODBC for MySQL

Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so

Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so

UsageCount=2

 

 

/etc/odbc.ini

[freeswitch]

Description=description of your DSN

Driver=myodbc_mysql

Server=localhost

Port=3306

Socket=/var/run/mysqld/mysqld.sock

Database=telispe3

Username=root

Password=passw0rd

Option=3

ReadOnly=No

 

[cdr]

Description=description of your DSN

Driver=myodbc_mysql

Server=localhost

Port=3306

Socket=/var/run/mysqld/mysqld.sock

Database=cdr

Username=root

Password=passw0rd

Option=3

ReadOnly=No

 

=========================================================================

3. install modules

=========================================================================

apt-get install freeswitch-mod-odbc-cdr

 

=========================================================================

4. modules.conf.xml

=========================================================================

 

<load module="mod_cdr_csv"/>

<load module="mod_odbc_cdr" />

<!-- load module="mod_cdr_sqlite"/ -->

 

=========================================================================

5. odbc_cdr.conf

=========================================================================

 

<configuration name="odbc_cdr.conf" description="ODBC CDR Configuration">

                <settings>

                               <!-- <param name="odbc-dsn"
value="database:username:password"/> -->

                               <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="/usr/local/freeswitch/log/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="/usr/local/freeswitch/log/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

 

 

=========================================================================

6. systemctl status freeswitch.service

=========================================================================

 

 

Aug 06 14:49:32 telispe3 systemd[1]: Failed to start freeswitch.

Aug 06 14:49:32 telispe3 systemd[1]: Unit freeswitch.service entered failed
state.

Aug 06 14:49:32 telispe3 systemd[1]: freeswitch.service holdoff time over,
scheduling restart.

Aug 06 14:49:32 telispe3 systemd[1]: Stopping freeswitch...

Aug 06 14:49:32 telispe3 systemd[1]: Starting freeswitch...

Aug 06 14:49:32 telispe3 systemd[1]: freeswitch.service start request
repeated too quickly, refusing to start.

Aug 06 14:49:32 telispe3 systemd[1]: Failed to start freeswitch.

Aug 06 14:49:32 telispe3 systemd[1]: Unit freeswitch.service entered failed
state.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180806/b26edba6/attachment-0001.html>


More information about the FreeSWITCH-users mailing list