Having issues with postpaid and pseudo-prepaid on RC8

103 views
Skip to first unread message

Mo Rajib

unread,
Mar 28, 2017, 4:13:05 PM3/28/17
to CGRateS
Hi DanB,
 I am setting up CGRateS 0.9.1 rc8 with OpenSIPS 2.2 using the tutorials that come with the .deb package. This is part of an upgrade from rc7/opensips 2.1 which has been working just fine for sometime now. I am doing a fresh install of RC8 on a separate server so I can test it before the upgrade. However, I am having some basic issues. Prepaid calls are working and debiting fine. Postpaid and pseudo-prepaid are not debiting the balance at the end of the call. I printed the "cgr_reqtype" variable in Opensips and it seems to have the correct value.

As I mentioned before, I am using tutorials config files for both cgrates and opensips (cgrates.json and opensips.cfg). I did however change a bit the tarrif plans to make testing easier. 

I am installing RC8 on Ubuntu 16.04 64-bit.
# cgr-engine -version
CGRateS 0.9.1~rc8 git+d0b7b0a (2017-03-20T17:56:14+01:00)

# opensips -V
version: opensips 2.2.3 (x86_64/linux)

Any idea why the postpaid and pseudo-prepaid are not debiting at the end of the call. May be some configuration changes I missed. It's been a while since I worked on CGRateS and am a bit rusty.

PS. I tried to do a straight upgrade from rc7 to rc8 and that didn't go well. There seems to be many changes in the MySQL DB, cgr-console command, tarrif plans, cgrates.json file. That's why I decided to do a fresh install on a separate server and test it before the upgrade. 

Thanks.


DanB

unread,
Mar 29, 2017, 3:12:11 PM3/29/17
to cgr...@googlegroups.com

Hi Mo,


Answers inline ..


On 28.03.2017 22:13, Mo Rajib wrote:
Hi DanB,
 I am setting up CGRateS 0.9.1 rc8 with OpenSIPS 2.2 using the tutorials that come with the .deb package. This is part of an upgrade from rc7/opensips 2.1 which has been working just fine for sometime now. I am doing a fresh install of RC8 on a separate server so I can test it before the upgrade. However, I am having some basic issues. Prepaid calls are working and debiting fine. Postpaid and pseudo-prepaid are not debiting the balance at the end of the call. I printed the "cgr_reqtype" variable in Opensips and it seems to have the correct value.
Do you see the CDR being stored in cdrs table?


As I mentioned before, I am using tutorials config files for both cgrates and opensips (cgrates.json and opensips.cfg). I did however change a bit the tarrif plans to make testing easier. 

I am installing RC8 on Ubuntu 16.04 64-bit.
# cgr-engine -version
CGRateS 0.9.1~rc8 git+d0b7b0a (2017-03-20T17:56:14+01:00)

# opensips -V
version: opensips 2.2.3 (x86_64/linux)

Any idea why the postpaid and pseudo-prepaid are not debiting at the end of the call. May be some configuration changes I missed. It's been a while since I worked on CGRateS and am a bit rusty.
Can you maybe capture the communication between CGRateS and OpenSIPS and send it over (port 2020 normally for events coming from OpenSIPS and port 8020 for events we send back to OpenSIPS)?


PS. I tried to do a straight upgrade from rc7 to rc8 and that didn't go well. There seems to be many changes in the MySQL DB, cgr-console command, tarrif plans, cgrates.json file. That's why I decided to do a fresh install on a separate server and test it before the upgrade.
We have some migrators for that but I would also prefer to start it fresh.

DanB

Thanks.


--
You received this message because you are subscribed to the Google Groups "CGRateS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.
To post to this group, send email to cgr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cgrates/d77ffba0-7893-43c3-a42e-5bc36b8c6900%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mo Rajib

unread,
Mar 29, 2017, 8:44:50 PM3/29/17
to CGRateS
Hello DanB,
 Thank you for taking the time to reply to my post. Nothing is stored in the cdrs table even for prepaid calls that seem to work fine. In the case of prepaid, which seems to work fine, data is stored in "sm_costs" table but nothing in cdrs table. As for postpaid, no data is stored in either tables (cdrs, sm_costs).

What shall i be looking at for the issue of data not stored in cdrs table?

I have pasted cgrates.json file below in case I am mis-configuring something there. 

Below is the captured data between opensips and cgrates (port 2020). 

U 2017/03/29 18:11:45.302315 127.0.0.1:38703 -> 127.0.0.1:2020
E_ACC_EVENT
method::INVITE
from_tag::42581
to_tag::42531
sip_code::200
sip_reason::OK
time::1490832705
cgr_reqtype::*postpaid
cgr_account::1002
cgr_destination::5002
cgr_supplier::suppl1
cgr_answertime::1490832705
dialog_id::4088:918757958
duration::

#
U 2017/03/29 18:12:25.306907 127.0.0.1:38703 -> 127.0.0.1:2020
E_ACC_EVENT
method::BYE
from_tag::42581
to_tag::42531
sip_code::200
sip_reason::OK
time::1490832745
cgr_reqtype::
cgr_account::
cgr_destination::
cgr_supplier::
cgr_answertime::1490832705
dialog_id::4088:918757958
duration::

====================================================

This is the data captured on port 8020

U 2017/03/29 18:12:52.406916 127.0.0.1:53436 -> 127.0.0.1:8020
:event_subscribe:
E_ACC_MISSED_EVENT
61

#
U 2017/03/29 18:12:52.406993 127.0.0.1:8020 -> 127.0.0.1:53436
200 OK

#
U 2017/03/29 18:12:52.407073 127.0.0.1:53436 -> 127.0.0.1:8020
:event_subscribe:
E_ACC_EVENT
61

#
U 2017/03/29 18:12:52.407135 127.0.0.1:8020 -> 127.0.0.1:53436
200 OK

====================================================================

{

// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
// Copyright (C) ITsysCOM GmbH

"listen": {
"rpc_json": "127.0.0.1:2012",
"rpc_gob": "127.0.0.1:2013",
"http": "127.0.0.1:2080",
},

"rals": {
"enabled": true,
"cdrstats_conns": [ {"address": "*internal"} ],
},

"scheduler": {
"enabled": true,
},

"cdrs": {
"enabled": true,
"extra_fields": [],
"store_cdrs": true,
"cdr_account_summary": true,
"sm_cost_retries": 5,
"rals_conns": [ {"address": "*internal"} ],
"cdrstats_conns": [ {"address": "*internal"} ],
},

"cdrstats": {
"enabled": true,
},

"cdre": {
"*default": {
"cdr_format": "csv",
"field_separator": ",",
"data_usage_multiply_factor": 1,
"sms_usage_multiply_factor": 1,
"mms_usage_multiply_factor": 1,
"generic_usage_multiply_factor": 1,
"cost_multiply_factor": 1,
"export_directory": "/var/spool/cgrates/cdre",
"header_fields": [],
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "CGRID"},
{"tag":"RunID", "type": "*composed", "value": "RunID"},
{"tag":"TOR", "type": "*composed", "value": "ToR"},
{"tag":"OriginID", "type": "*composed", "value": "OriginID"},
{"tag":"RequestType", "type": "*composed", "value": "RequestType"},
{"tag":"Direction", "type": "*composed", "value": "Direction"},
{"tag":"Tenant", "type": "*composed", "value": "Tenant"},
{"tag":"Category", "type": "*composed", "value": "Category"},
{"tag":"Account", "type": "*composed", "value": "Account"},
{"tag":"Subject", "type": "*composed", "value": "Subject"},
{"tag":"Destination", "type": "*composed", "value": "Destination"},
{"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag":"Usage", "type": "*composed", "value": "Usage"},
{"tag":"Cost", "type": "*composed", "value": "Cost", "rounding_decimals": 4},
],
"trailer_fields": [],
},
},

"sm_opensips": {
"enabled": true,
"listen_udp": "127.0.0.1:2020",
"rals_conns": [ {"address": "*internal"} ],
"cdrs_conns": [ {"address": "*internal"} ],
"reconnects": 5,
"create_cdr": true,
"debit_interval": "10s",
"min_call_duration": "0s",
"max_call_duration": "3h",
"events_subscribe_interval": "60s",
"mi_addr": "127.0.0.1:8020",
},

}

==============================================================

DanB

unread,
Mar 31, 2017, 3:15:04 PM3/31/17
to cgr...@googlegroups.com

Hi Mo,

I can see that in rc8 we have create_cdr on false (most probably to give you the freedom to choose how you inject your CDRs from OpenSIPS).

Anyway, can u configure this parameter to true:

https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L345

and let me know how it goes?


DanB

Mo Rajib

unread,
Apr 2, 2017, 1:59:18 PM4/2/17
to CGRateS
Hi DanB,
 I am already setting "create_cdr" parameter to "true". The "cgrates.json" that I posted here is from the tutorials folder that comes with the installation. However, there are some discrepancies of the "cgrates.json" configuration file that comes with the source install and the one that comes with .deb install (/usr/share/cgrates/....). 

When I installed rc7 a year ago, all the call types tested successfully on the first go. Do you have a sample "cgrates.json" file for RC8 for opensips that you know works for all call types?

Thanks.

On Friday, March 31, 2017 at 1:15:04 PM UTC-6, DanB wrote:

Hi Mo,

I can see that in rc8 we have create_cdr on false (most probably to give you the freedom to choose how you inject your CDRs from OpenSIPS).

Anyway, can u configure this parameter to true:

https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L345

and let me know how it goes?


DanB

On 30.03.2017 02:44, Mo Rajib wrote:
Hello DanB,
 Thank you for taking the time to reply to my post. Nothing is stored in the cdrs table even for prepaid calls that seem to work fine. In the case of prepaid, which seems to work fine, data is stored in "sm_costs" table but nothing in cdrs table. As for postpaid, no data is stored in either tables (cdrs, sm_costs).

What shall i be looking at for the issue of data not stored in cdrs table?

I have pasted cgrates.json file below in case I am mis-configuring something there. 

Below is the captured data between opensips and cgrates (port 2020). 

U 2017/03/29 18:11:45.302315 127.0.0.1:38703 -> 127.0.0.1:2020
E_ACC_EVENT
method::INVITE
from_tag::42581
to_tag::42531
sip_code::200
sip_reason::OK
time::1490832705
cgr_reqtype::*postpaid
cgr_account::1002
cgr_destination::5002
cgr_supplier::suppl1
cgr_answertime::1490832705
dialog_id::4088:918757958
duration::

#
U 2017/03/29 18:12:25.306907 127.0.0.1:38703 -> 127.0.0.1:2020
E_ACC_EVENT
method::BYE
from_tag::42581
to_tag::42531

DanB

unread,
Apr 2, 2017, 3:00:31 PM4/2/17
to cgr...@googlegroups.com

Hi Mo,

Did not check OpenSIPS since a while but I know for sure Razvan from OpenSIPS core developers did it (using tutorial config which you have also) and there were no issues reported.

Planning to review the tutorials myself at some point during next weeks but cannot commit on certain date yet.

Maybe you come on irc channel tomorrow and we can check it together more interactively?

DanB

Reply all
Reply to author
Forward
0 new messages