### Description Hi everyone. I integrate Kamailio with CGRateS and found a strange behaviour. I made a call using Jitsi from 1001 to 1003 (configured before in CGRateS to disconnect after 12 seconds). The call is disconnected correctly but from Kamailio got 3 CGR_CALL_END events with the same data which in CGRateS generate an error because from these events CGRateS generate 3 cdrs and all 3 with the same unique key. Is this a bug or is something wrong with the config?
Kamailio config : https://github.com/cgrates/cgrates/tree/master/data/tutorials/kamevapi/kamai...
### NGREP Events between CGRateS and Kamailio T 2018/04/24 07:55:14.200094 127.0.0.1:8448 -> 127.0.0.1:36774 [AP] 269:{"event":"CGR_AUTH_REQUEST", .."tr_index":"12566", .."tr_label":"1148670067", .."cgr_subsystems":"*attributes;*resources;*accounts;*suppliers", .."RequestType":"*prepaid", .."Tenant":"cgrates.org", .."Account":"1001", .."Destination":"1003", .."SetupTime":"1524570914"}, ## T 2018/04/24 07:55:14.227815 127.0.0.1:36774 -> 127.0.0.1:8448 [AP] 214:{"Event":"CGR_AUTH_REPLY","TransactionIndex":"12566","TransactionLabel":"1148670067","Attributes":"","ResourceAllocation":"SPECIAL_1003","MaxUsage":13,"Suppliers":"supplier2,supplier1","ThresholdHits":0,"Error":""}, ## T 2018/04/24 07:55:17.538695 127.0.0.1:8448 -> 127.0.0.1:36774 [AP] 306:{"event":"CGR_CALL_START", .."h_entry":"226", .."h_id":"8446", .."cgr_subsystems":"*resources;*accounts", .."OriginID":"f1c3db6e9aea754291eed5cdc944cdd2@0:0:0:0:0:0:0:0;2fc2c199", .."RequestType":"*prepaid", .."Tenant":"cgrates.org", .."Account":"1001", .."Destination":"1003", .."AnswerTime":"1524570917"}, ## T 2018/04/24 07:55:29.546055 127.0.0.1:36774 -> 127.0.0.1:8448 [AP] 99:{"Event":"CGR_SESSION_DISCONNECT","HashEntry":"226","HashId":"8446","Reason":"INSUFFICIENT_CREDIT"}, ## T 2018/04/24 07:55:29.546285 127.0.0.1:8448 -> 127.0.0.1:36774 [AP] 285:{"event":"CGR_CALL_END", .."cgr_subsystems":"*resources;*accounts", .."OriginID":"f1c3db6e9aea754291eed5cdc944cdd2@0:0:0:0:0:0:0:0;2fc2c199", .."RequestType":"*prepaid", .."Tenant":"cgrates.org", .."Account":"1001", .."Destination":"1003", .."AnswerTime":"1524570917", .."Usage":"12"}, ## T 2018/04/24 07:55:29.546561 127.0.0.1:8448 -> 127.0.0.1:36774 [AP] 285:{"event":"CGR_CALL_END", .."cgr_subsystems":"*resources;*accounts", .."OriginID":"f1c3db6e9aea754291eed5cdc944cdd2@0:0:0:0:0:0:0:0;2fc2c199", .."RequestType":"*prepaid", .."Tenant":"cgrates.org", .."Account":"1001", .."Destination":"1003", .."AnswerTime":"1524570917", .."Usage":"12"}, ## T 2018/04/24 07:55:29.546664 127.0.0.1:8448 -> 127.0.0.1:36774 [AP] 285:{"event":"CGR_CALL_END", .."cgr_subsystems":"*resources;*accounts", .."OriginID":"f1c3db6e9aea754291eed5cdc944cdd2@0:0:0:0:0:0:0:0;2fc2c199", .."RequestType":"*prepaid", .."Tenant":"cgrates.org", .."Account":"1001", .."Destination":"1003", .."AnswerTime":"1524570917", .."Usage":"12"}, #
### Additional Information ``` kamailio -V version: kamailio 5.1.3 (x86_64/linux) flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 4.9.2 ```
* **Operating System**: ``` root@teo:/home/teo# cat /etc/debian_version 8.10 ```
Thank you in advance TeoV
Closed #1512.
Kamailio doesn't send internally anything to evapi, so it is a config issue.
At a quick look, you execute route(CGR_CALL_END) twice, once the dialog is ended and once a local request is generated, respectively:
``` # Called by Kamailio on dialog end event_route[dialog:end] { route(CGR_CALL_END); } # Called by Kamailio on local disconnect event_route[tm:local-request] { route(CGR_CALL_END); } ```
If what you get is when kamailio ends the dialog, then event_route[tm:local-request] is executed for each BYE sent, one to caller and one to callee, so you get three times execution of route(CGR_CALL_END).
Eventually you can use an htable to keep a key with call-id that you sent the call end event and do not do it again.
Not being a code issue, I am closing this one here, for more discussions use `sr-users@lists.kamailio.org` mailing list
Hi Daniel, Thank you for taking time to check the config and also thank you for the solution. Have a good day.
Thanks, TeoV