Hi
I am just starting to work with CGRates and I have been following some of the tutorials to gain an understanding of how the various components work together.
I am in a situation where I can successfully rate calls by using the inbuilt OpenSIPS module, and I have some derived chargers set up too so I am hopefully well onto the learning curve.
As a next step I have been experimenting with sending data directly into CGRates (instead of relying on the OpenSIPS module) so that I can send decoupled information in and gain some more understanding of what is going on.
However whenever I try this CURL example, it generates an unique indexing error when inserting into PostgreSQL - it seems that the unique index which is in place across these columns is being violated:
(cgrid, run_id, origin_id)
When I check the raw SQL that CGRates is trying to insert, it seems that the origin_id column is being set to NULL:
(cgrid, run_id, origin_id)=(95c7e5ccf93f207c64150b0b0b74bfb184c48cb9, *raw, )
I am making the following curl request:
curl --data "tor=*voice&accid=iiaasbsfgfddfggsfgdsaf&cdrhost=192.168.1.2&cdrsource=curl_cdr&reqtype=rated&direction=*out&ten
ant=
100000.v.com&category=call2345&account=
100000.v.com&subject=dan12&destination=33234&answer_time=1383813748&usage=3&sip_user=Jitsi23&subject2=1005&origin_id=1234&origin_host=sdfgd
The output from CGRates is this:
(pq: duplicate key value violates unique constraint "cdrs_cgrid_run_id_origin_id_key")
[2018-05-21 14:51:16]
2018/05/21 14:51:16 CGRateS <b0faaf2> [ERROR] <CDRS> Storing primary CDR {"CGRID":"95c7e5ccf93f207c64150b0b0b74bfb184c48cb9","RunID":"*raw","OrderID":0,"OriginHost":"","Source":"
127.0.0.1:37608","OriginID":"","ToR":"","RequestType":"*rated","Tenant":"
cgrates.org","Category":"call","Account":"","Subject":"","Destination":"","SetupTime":"0001-01-01T00:00:00Z","AnswerTime":"0001-0
1-01T00:00:00Z","Usage":0,"ExtraFields":{"accid":"iiaasbsfgfddfggsfgdsaf","account":"
100000.v.com","answer_time":"1383813748","category":"call2345","cdrhost":"192.168.1.2","cdrsource":"curl_
cdr","destination":"33234","direction":"*out","origin_host":"sdfgdfgf","origin_id":"1234","reqtype":"rated","sip_user":"Jitsi23","subject":"dan12","subject2":"1005","tenant":"100000.v.ibrows
e.com","tor":"*voice","usage":"3"},"ExtraInfo":"","Partial":false,"Rated":false,"CostSource":"","Cost":-1,"CostDetails":null}, got error: pq: duplicate key value violates unique constraint "
cdrs_cgrid_run_id_origin_id_key"
2018/05/21 14:51:16 CGRateS <b0faaf2> [ERROR] <CDRS> Errors when storing CDR entry: pq: duplicate key value violates unique constraint "cdrs_cgrid_run_id_origin_id_key"
If anybody could shed any light onto this situation I would be grateful - it seems that somehow the origin_id is not being set correctly within cgrates.
Pete