[OpenSIPS-Users] opensips sip_capture + homer with postgres

Jennifer Hashimoto jennifer.hashimoto at caztel.com
Mon Aug 21 16:25:58 EDT 2017

HI everyone,

I decided to setup homer sip capture with opensips as the program that inserts into my homer database because I use opensips everywhere else so it makes sense.

I use postgres as the backend.

I am experiencing a problem where many sip messages are not getting inserted into the database due to key violations.

I do get some rows in my tables, all with id 0 since the primary key is id + date (but as we know sip message happen very fast and can be exactly the same including timestamp)

I made a test of the database auto increment by manually inserting a row without specifying the id field (ie. insert into sip_capture_rest_20170821 (date, ... ) values (’2017-08… and it correctly put the id as 1 (auto incremented it as all the others were 0)

I am using opensips.cfg from https://github.com/sipcapture/homer-api/blob/da13a87b8eda55d4c597ce32270521249ab21dc4/examples/sipcapture/sipcapture.opensips <https://github.com/sipcapture/homer-api/blob/da13a87b8eda55d4c597ce32270521249ab21dc4/examples/sipcapture/sipcapture.opensips>

(I put … for the non valid information)

from my opensips log file:

	 2017-08-21 14:26:15) already exists.#012 Query: insert into sip_capture_rest_20170821 (id,date, ... ) values (0,’2017-08...

my database is defined as:

CREATE TABLE public.sip_capture_call_20170821 (
	id int8 NOT NULL DEFAULT nextval('sip_capture_call_20170821_id_seq'::regclass),
	"date" timestamp NOT NULL DEFAULT now(),
	micro_ts int8 NOT NULL DEFAULT 0::bigint,
	CONSTRAINT sip_capture_call_20170821_pkey PRIMARY KEY (id,"date")
) ;
CREATE INDEX sip_capture_call_20170821_auth_user ON public.sip_capture_call_20170821 (auth_user) ;
CREATE INDEX sip_capture_call_20170821_callid ON public.sip_capture_call_20170821 (callid) ;
CREATE INDEX sip_capture_call_20170821_callid_aleg ON public.sip_capture_call_20170821 (callid_aleg) ;
CREATE INDEX sip_capture_call_20170821_date ON public.sip_capture_call_20170821 (date) ;
CREATE INDEX sip_capture_call_20170821_from_user ON public.sip_capture_call_20170821 (from_user) ;
CREATE INDEX sip_capture_call_20170821_pid_user ON public.sip_capture_call_20170821 (pid_user) ;
CREATE INDEX sip_capture_call_20170821_ruri_user ON public.sip_capture_call_20170821 (ruri_user) ;
CREATE INDEX sip_capture_call_20170821_to_user ON public.sip_capture_call_20170821 (to_user) ;

CREATE SEQUENCE public.sip_capture_call_20170821_id_seq
MAXVALUE 9223372036854775807

Jennifer Akemi Hashimoto
Caztel Communications
jennifer.hashimoto at caztel.com <mailto:jennifer.hashimoto at caztel.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170821/edb28b82/attachment.html>

More information about the Users mailing list