CREATE TABLE queuelog (
 id serial,

 start_time timestamp with time zone NOT NULL default CURRENT_TIMESTAMP,
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 sessionid varchar(50) NOT NULL default '',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 call_seq varchar(50) NOT NULL default '',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 queue integer NOT NULL default '1',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 agent integer NOT NULL default '1',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 agents integer NOT NULL default '0',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 waiting integer NOT NULL default '0',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 waittime numeric NOT NULL default '0',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 ringtime numeric NOT NULL default '0',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 talktime numeric NOT NULL default '0',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 cause integer NOT NULL default '16',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 from_function varchar(24),
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO: soort nummerplan element waar gesprek vandaan komt, bijvoorbeeld: ivr
--HELP_NL_LONG:

 from_lookupid integer NOT NULL default '1',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 to_function varchar(24),
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO: soort nummerplan element waar gesprek eventueel na wachtrij heengaat
--HELP_NL_LONG:

 to_lookupid integer NOT NULL default '1',
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:

 PRIMARY KEY  (id)
);

CREATE INDEX queuelog_start_time ON queuelog (start_time);
CREATE INDEX queuelog_sessionid_index ON queuelog (sessionid);

GRANT UPDATE, SELECT, INSERT, DELETE ON queuelog TO astium;
