[All below are commands from terminal using the database SIPXCDR as user postgres (no password here) ]
psql --command "create sequence call_ip_id_seq;" SIPXCDR postgres
psql --command "create table call_ip(id bigint default nextval('call_ip_id_seq'),call_id text,from_url text,from_ip text,to_url text, to_ip text,method text, primary key(call_id,from_url,to_url,id));" SIPXCDR postgres
psql --command "alter table cdrs add column caller text;" SIPXCDR postgres
psql --command "alter table cdrs add column caller_ip text;" SIPXCDR postgres
psql --command "alter table cdrs add column callee text;" SIPXCDR postgres
psql --command "alter table cdrs add column callee_ip text;" SIPXCDR postgres
psql --command "create view view_cdrs_ip as SELECT cdrs.id, cdrs.caller, cdrs.caller_ip, cdrs.callee, cdrs.callee_ip, cdrs.start_time, cdrs.connect_time, cdrs.end_time, cdrs.end_time - cdrs.connect_time AS duration, cdrs.termination, cdrs.failure_status, cdrs.failure_reason, cdrs.call_direction FROM cdrs;" SIPXCDR postgres
No comments:
Post a Comment