alter table astiumcdr add column src_contact integer;
update astiumcdr set src_contact = '1' where src_contact IS NULL;
alter table astiumcdr alter column src_contact set not null;
alter table astiumcdr alter column src_contact set default '1';

alter table astiumcdr add column dial_contact integer;
update astiumcdr set dial_contact = '1' where dial_contact IS NULL;
alter table astiumcdr alter column dial_contact set not null;
alter table astiumcdr alter column dial_contact set default '1';

alter table astiumcdr add column ans_contact integer;
update astiumcdr set ans_contact = '1' where ans_contact IS NULL;
alter table astiumcdr alter column ans_contact set not null;
alter table astiumcdr alter column ans_contact set default '1';

CREATE INDEX astiumcdr_src_company_index ON astiumcdr (src_company);
CREATE INDEX astiumcdr_src_department_index ON astiumcdr (src_department);
CREATE INDEX astiumcdr_src_contact_index ON astiumcdr (src_contact);

CREATE INDEX astiumcdr_dial_company_index ON astiumcdr (dial_company);
CREATE INDEX astiumcdr_dial_department_index ON astiumcdr (dial_department);
CREATE INDEX astiumcdr_dial_contact_index ON astiumcdr (dial_contact);

CREATE INDEX astiumcdr_ans_company_index ON astiumcdr (ans_company);
CREATE INDEX astiumcdr_ans_department_index ON astiumcdr (ans_department);
CREATE INDEX astiumcdr_ans_contact_index ON astiumcdr (ans_contact);

