v2.09 SQLs for MySQL v4.0.26

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

 



For those of you still using v2.09 you will encounter a problem with
passwords if you use MySQL v4.1.x and above. You will have to put in an
entry in the [MySQLd] section:-
set passwords = old_passwords = 1
or start the service with the old_passwords parameter.

The best is to use a MySQL v3.23.x or v4.0.26.

Unfortunately, the use of these earlier versions of MySQL did not provide
you the means of using certain nice string and data functions available in
the later versions like STR_TO_DATE.

If you are using MySQL v3.23.x or v4.0.x, then the following will be useful
for your [SQLAcct] section of the GNUgk config file:-

[Gatekeeper::Acct]
SQLAcct=required;start,update,stop

[SQLAcct]
Driver=MySQL
Host=localhost
Database=gnugk
Username=gkuser
Password=gkpwd
MinPoolSize=5
StartQuery=INSERT INTO cdrs (gkname, sessid, callno, username, calling,
called, duration, disconnectcause) VALUES ('%g', '%s', %n, '%u',
'%{Calling-Station-Id}', '%{Called-Station-Id}', %d, %c)
StartQueryAlt=UPDATE cdrs SET username = '%u', calling =
'%{Calling-Station-Id}', called = '%{Called-Station-Id}', duration = %d,
disconnectcause = %c WHERE gkname = '%g' AND sessid = '%s'
UpdateQuery=UPDATE cdrs SET duration = %d WHERE gkname = '%g' AND sessid =
'%s'
StopQuery=UPDATE cdrs SET username = '%u', calling =
'%{Calling-Station-Id}', called = '%{Called-Station-Id}', duration = %d,
disconnectcause = %c, cttime = CONCAT(RIGHT(@a:=RIGHT('%{connect-time}',11),
4), '-', LPAD(FIND_IN_SET(LEFT(@a, 3),
'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'), 2, '0'), '-',
LPAD(TRIM(MID(@a, 5, 2)), 2, '0'), ' ', LEFT('%{connect-time}',8))) WHERE
gkname = '%g' AND sessid = '%s'
StopQueryAlt=INSERT INTO cdrs (gkname, sessid, callno, username, calling,
called, duration, disconnectcause, cttime) VALUES ('%g', '%s', %n, '%u',
'%{Calling-Station-Id}', '%{Called-Station-Id}', %d, %c,
CONCAT(RIGHT(@a:=RIGHT('%{connect-time}',11), 4), '-',
LPAD(FIND_IN_SET(LEFT(@a, 3),
'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'), 2, '0'), '-',
LPAD(TRIM(MID(@a, 5, 2)), 2, '0'), ' ', LEFT('%{connect-time}',8)))

Also the following SQL statements can be used for creating a rudimentary CDR
table:-

create database if not exists `gnugk`;
USE `gnugk`;
CREATE TABLE `cdrs` (
  `CDRID` int(11) NOT NULL auto_increment,
  `gkname` varchar(30) default NULL,
  `sessid` varchar(16) default NULL,
  `callno` int(11) default NULL,
  `username` varchar(30) default NULL,
  `calling` varchar(25) default NULL,
  `called` varchar(25) default NULL,
  `cttime` datetime default NULL,
  `duration` int(11) default NULL,
  `disconnectcause` int(11) default NULL,
  PRIMARY KEY  (`CDRID`)
) TYPE=MyISAM;

The above can be split int the config and sql parts and made a part of the
contrib sections and is useful for those who want cdrs only and not
billing - more for identity and backhaul calling.

Regards,
Ap.Muthu





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________________

Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
Homepage: http://www.gnugk.org/

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

  Powered by Linux