Re: Mysql Schemes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lucas,
 
I had the same problem awhile ago and could find nothing on it. Consequently I did it myself. Here is what I did. Hope it helps you and anyone else who is (and will be) looking for something like these.
 
What I did was creating a new database in the name of GUNK. You can do it using the following command in myself environment.
 
create database GUNK;
 
Then I created a table in the name of CDR as follows.
 
create table GUNK.CDR (
        gatekeeper_name archer(255),
        call_number into zerofill,
        call_duration mediumint unsigned zerofill,
                index duration_idx (call_duration),
        disconnect_cause smallint unsigned zerofill,
                index dcc_idx (disconnect_cause),
        acct_session_id varchar(255),
        h323_id varchar(255),
        gkip varchar(15),
        CallId varchar(255),
        ConfID varchar(255),
        setup_time datetime,
        connect_time datetime,
        disconnect_time datetime,
        caller_ip varchar(15),
                index srcip_idx (caller_ip),
        caller_port smallint unsigned zerofill,
        callee_ip varchar(15),
                index destip_idx (callee_ip),
        callee_port smallint unsigned zerofill,
        src_info varchar(255),
        dest_info varchar(255),
        Calling_Station_Id varchar(255),
        Called_Station_Id varchar(255),
                index dialednumber_idx (Called_Station_Id (20)),
        Dialed_Number varchar(255)
);
 
 
You can copy and paste it in the mysql environment.
 
Then you need to creat a username for accessing the data. You can do it throught the following command in mysql environment.
 
GRANT delete,insert,select,update ON GNUGK.* TO 'YourDesireUsername'@'localhost' IDENTIFIED BY 'APassword';
 
With this command you will permit accessing the data from only the local server. If you need to access these data from any other computer then you have to set the proper security options.
 
Then you can add the following settings ( at the bottom of this email) into your gnugk.ini file to insert and update the history of the calls into your database.
 
Please note the fields that I used were based on version 2.2.1 and I beleive there are more available data to keep in the latest version (2.2.3-2) which I haven't added them yet for myself. By the way, I used the same definitions with the latest version and it worked fine. Please add the new data fields yourself if you think you need them to keep.
 
Hope these save a little bit of time for you and whomever who will possibly use these later.
 
Good luck,
Bahram.
 
P.S. I guess it would have been helpful if something like this was included in the original manual of the GNUGK to save some time for the people who are looking for something as a startup.
 
 
[Gatekeeper::Acct]
SQLAcct=optional;start,stop,update
FileAcct=sufficient;stop
 
[FileAcct]
DetailFile=Add your desire path here something like /var/log/cdr.log
StandardCDRFormat=0
CDRString=%g|%n|%d|%c|%s|%u|%{gkip}|%{CallId}|%{ConfId}|%{setup-time}|%{connect-time}|%{disconnect-time}|%{caller-ip}|%{caller-port}|%{callee-ip}|%{callee-port}|%{src-info}|%{dest-info}|%{Calling-Station-Id}|%{Called-Station-Id}|%{Dialed-Number}
Rotate=daily
RotateTime=23:59
 

[SQLAcct]
Driver=MySQL
Database=GNUGK
Username=YourDesireUsername
Password=APassword
StartQuery= insert into CDR (gatekeeper_name, call_number, call_duration, disconnect_cause, acct_session_id, h323_id, gkip, CallId, ConfId, setup_time, connect_time, disconnect_time, caller_ip, caller_port, callee_ip, callee_port, src_info, dest_info, Calling_Station_Id, Called_Station_Id, Dialed_Number) values ('%g', '%n', %d, %c, '%s', '%u', '%{gkip}', '%{CallId}', '%{ConfId}', '%{setup-time}', '%{connect-time}', '%{disconnect-time}', '%{caller-ip}', '%{caller-port}', '%{callee-ip}', '%{callee-port}', '%{src-info}', '%{dest-info}', '%{Calling-Station-Id}', '%{Called-Station-Id}', '%{Dialed-Number}')
 
StartQueryAlt= insert into CDR (gatekeeper_name, call_number, call_duration, disconnect_cause, acct_session_id, h323_id, gkip, CallId, ConfID, setup_time, connect_time, disconnect_time, caller_ip, caller_port, callee_ip, callee_port, src_info, dest_info, Calling_Station_Id, Called_Station_Id, Dialed_Number) values ('%g', '%n', %d, %c, '%s', '%u', '%{gkip}', '%{CallId}', '%{ConfID}', '%{setup-time}', '%{connect-time}', '%{disconnect-time}', '%{caller-ip}', '%{caller-port}', '%{callee-ip}', '%{callee-port}', '%{src-info}', '%{dest-info}', '%{Calling-Station-Id}', '%{Called-Station-Id}', '%{Dialed-Number}')
 
UpdateQuery= update CDR set call_duration=%d where gatekeeper_name='%g' and acct_session_id='%s'
 
StopQuery= update CDR set call_duration=%d, disconnect_cause=%c, disconnect_time='%{disconnect-time}' where gatekeeper_name='%g' and acct_session_id='%s'
 
StopQueryAlt= insert into CDR (gatekeeper_name, call_number, call_duration, disconnect_cause, acct_session_id, h323_id, gkip, CallId, ConfID, setup_time, connect_time, disconnect_time, caller_ip, caller_port, callee_ip, callee_port, src_info, dest_info, Calling_Station_Id, Called_Station_Id, Dialed_Number) values ('%g STOP Alt', '%n', %d, %c, '%s', '%u', '%{gkip}', '%{CallId}', '%{ConfID}', '%{setup-time}', '%{connect-time}', '%{disconnect-time}', '%{caller-ip}', '%{caller-port}', '%{callee-ip}', '%{callee-port}', '%{src-info}', '%{dest-info}', '%{Calling-Station-Id}', '%{Called-Station-Id}', '%{Dialed-Number}')
 
TimestampFormat=MySQL

 
 
 
----- Original Message -----
Sent: Sunday, September 11, 2005 5:24 PM
Subject: Mysql Schemes

Hi All,
I'm Trying to configure GNUGK with mysql but i cant find the database schemes could anyone help?

--
Lucas Nishimura
--------------------------------------------------------------------------------
Tel: (43)9911-3440
Email: lucas.nishimura@xxxxxxxxxx
GVT - LONDRINA - PR
--------------------------------------------------------------------------------

 

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux