GithubHelp home page GithubHelp logo

cgrates / cgrates Goto Github PK

View Code? Open in Web Editor NEW
426.0 426.0 218.0 80.65 MB

Real-time Charging System for Telecom & ISP environments

Home Page: http://cgrates.org

License: GNU General Public License v3.0

Go 98.79% Shell 0.85% Python 0.12% Makefile 0.01% JavaScript 0.01% Dockerfile 0.07% Jinja 0.14% HTML 0.04%

cgrates's Introduction

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

Build Status Documentation Status GoDoc

Features

  • Real-time Online/Offline Charging System (OCS).
  • Account Balances Management with bundle support.
  • Session or Event charging with reservation.
  • Rating engine.
  • CDR logging with support for Interim Records.
  • QoS LCR and LCR over Bundles.
  • Fraud detection with automatic mitigation.
  • Call Statistics with pattern monitoring.
  • Performance oriented.
  • Modular architecture.
  • Test driven development.
  • Plug-able/non-intrusive into existing setups.
  • Cloud-ready, built on independent micro-services with rich set of RPC APIs.
  • Agile in developing new features.
  • Very fast (5000+ req/sec on a single machine)
  • Good documentation.
  • Commercial support available

Documentation

Step by steps tutorials

Debian apt-get repository

Installing CGRateS from sources on minimal debian (for devel or testing)

Browsable HTML docs http://readthedocs.org/docs/cgrates/

PDF, Epub, Manpage http://readthedocs.org/projects/cgrates/downloads/

API reference godoc

cgrates's People

Contributors

adragusin avatar arberkatellari avatar armirveliaj avatar basitengr avatar bhepp avatar ccppprogrammer avatar cgrates avatar danbogos avatar dobby16 avatar eloycoto avatar ewsamuels avatar gezimbll avatar ghenry avatar ionutboangiu avatar j0hnsteel avatar marcinkowalczyk avatar nikolaspetriti avatar paolovisintin avatar petekelly avatar porosnicuadrian avatar razvancrainea avatar rbarrabe avatar rif avatar rinor avatar sebastic avatar shaneneuerburg avatar taeduard avatar teov avatar varundhand avatar voicelandglobal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cgrates's Issues

TimeStart and TimeEnd querying on AnswerTime rather than SetupTime

Hello All,

I been using the ApierV1.GetCdrs and noticed that it only returns the connected calls but it doesn't return the failed calls or cancelled calls.
I can confirm that I am seeing all the calls during a capture on port 2080 and they are also in the Postgres DB.

It appears the TimeStart and TimeEnd is querying on AnswerTime rather than SetupTime.

regards,

Errol

Possible bug in the json_client.py

Hi rif,

I have been suspecting for quite some time now that there is a bug in the json_client.py file that you sent me in the zipped app back in October that was probably causing some issues with some API calls.
So yesterday I made some more tests using this API call using the default json_client.py that you sent me back in October 2014.

response = connection.call("ApierV1.ExportCdrsToFile",{"ExportDir":"/usr/share/cgrates/cdrs","ExportFileName":"ErrolCDRs.csv","TimeStart":"2015-02-23T00:00:00Z","TimeEnd":"2015-03-09T00:00:00Z"})
Here I noticed that in the resulting ErrolCDRs.csv file I only got 10189 rows. I decided to increase the buffer size to 8192 as below then I got 35799 rows

This must loop if resp is bigger than 4K
    buffer = ''
    data = True
    while data:
        data = self.socket.recv(8192)
        buffer += data
        if len(data) < 8192: break

Finally, I decided to increase it even further to 16384 and made the API call again and this time the file produced 51829 rows which turns out to be ALL the CDRs for that period.

Does this seem normal?

Thanks
Errol

Add destination name matched in *voice balances

Hi DanB,
As per our conversation in the irc channel it would be very useful to Add the match destination in the *voice balances. In fact it would be good to should the destination name for all call attempts which would be great for reporting purposes.
Regards,
Errol

LoadRatingPlan performance

HI DanB,
As per our discussions on the IRC channel when calling LoadRatingPlan with 170K unique destinations it takes 45mins to 1 hour for that process to complete so this ticket has been opened at your request.
I believe you were also testing with my data and using shared destination and it was still running even after 35 mins.

Regards,
Errol

Minutes LCR

Since CGRateS is already call state aware, we could use this information to build a LCR system based on terminated minutes on each supplier endpoint.

EG: 1000 minutes in a specific time interval terminated over specific gateway, kill the call after and disable the gateway until next init commanded by scheduler.

Dan

Dropped calls when rate_increment and group_interval_start set to 6

Hello,

I uploaded my A-Z rates and I was able to make calls to any international destination that I called however I noticed that whenever I made a call to the USA the call would drop as soon as it was answered.

There were no errors in the Freeswitch or CGRates logs but what I did realize was that all the international destinations I was calling the rate_increment and group_interval_start were both set to 1 whereas for the USA both the rate_increment and group_interval_start were both set to 6.

I set both the rate_increment and group_interval_start were both set to 1 and was able to make calls to the USA then I set them back to 6 and the calls dropped again.

GET CALL COST with rate_increment and group_interval_start set to 6

cgr-console 'cost Direction="_out" Category="call" Tenant="sbc.mydomain.com" Subject="2651797610" Account="2651797610" Destination="19173001321" TimeStart="2014-12-31T14:00:00Z" TimeEnd="2014-12-31T14:05:00Z"'
{
"Direction": "_out",
"Category": "call",
"Tenant": "sbc.mydomain.com",
"Subject": "322181565",
"Account": "322181565",
"Destination": "19123001321",
"TOR": "_voice",
"Cost": 6e+09,
"Timespans": [
{
"TimeStart": "2014-12-31T14:00:00Z",
"TimeEnd": "2014-12-31T14:00:06Z",
"Cost": 6e+09,
"RateInterval": {
"Timing": {
"Years": [],
"Months": [],
"MonthDays": [],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": ""
},
"Rating": {
"ConnectFee": 0,
"RoundingMethod": "_middle",
"RoundingDecimals": 5,
"Rates": [
{
"GroupIntervalStart": 6000000000,
"Value": 0,
"RateIncrement": 6000000000,
"RateUnit": 60000000000
}
]
},
"Weight": 10
},
"DurationIndex": 6000000000,
"Increments": null,
"MatchedSubject": "_out:sbc.mydomain.com:call:_any",
"MatchedPrefix": "1912",
"MatchedDestId": "United_States"
},
{
"TimeStart": "2014-12-31T14:00:06Z",
"TimeEnd": "2014-12-31T14:05:00Z",
"Cost": 0,
"RateInterval": {
"Timing": {
"Years": [],
"Months": [],
"MonthDays": [],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": ""
},
"Rating": {
"ConnectFee": 0,
"RoundingMethod": "_middle",
"RoundingDecimals": 5,
"Rates": [
{
"GroupIntervalStart": 6000000000,
"Value": 0,
"RateIncrement": 6000000000,
"RateUnit": 60000000000
}
]
},
"Weight": 10
},
"DurationIndex": 300000000000,
"Increments": null,
"MatchedSubject": "_out:sbc.mydomain.com:call:*any",
"MatchedPrefix": "1912",
"MatchedDestId": "United_States"
}
]
}

GET CALL COST with rate_increment and group_interval_start set to 1

root@sbc:~# cgr-console 'cost Direction="_out" Category="call" Tenant="sbc.mydomain.com" Subject="322181565" Account="322181565" Destination="19123001321" TimeStart="2014-12-31T14:00:00Z" TimeEnd="2014-12-31T14:05:00Z"'
{
"Direction": "_out",
"Category": "call",
"Tenant": "sbc.mydomain.com",
"Subject": "322181565",
"Account": "322181565",
"Destination": "19123001321",
"TOR": "_voice",
"Cost": 1e+09,
"Timespans": [
{
"TimeStart": "2014-12-31T14:00:00Z",
"TimeEnd": "2014-12-31T14:00:01Z",
"Cost": 1e+09,
"RateInterval": {
"Timing": {
"Years": [],
"Months": [],
"MonthDays": [],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": ""
},
"Rating": {
"ConnectFee": 0,
"RoundingMethod": "_middle",
"RoundingDecimals": 5,
"Rates": [
{
"GroupIntervalStart": 1000000000,
"Value": 0,
"RateIncrement": 1000000000,
"RateUnit": 60000000000
}
]
},
"Weight": 10
},
"DurationIndex": 1000000000,
"Increments": null,
"MatchedSubject": "_out:sbc.mydomain.com:call:_any",
"MatchedPrefix": "1912",
"MatchedDestId": "United_States"
},
{
"TimeStart": "2014-12-31T14:00:01Z",
"TimeEnd": "2014-12-31T14:05:00Z",
"Cost": 0,
"RateInterval": {
"Timing": {
"Years": [],
"Months": [],
"MonthDays": [],
"WeekDays": [],
"StartTime": "00:00:00",
"EndTime": ""
},
"Rating": {
"ConnectFee": 0,
"RoundingMethod": "_middle",
"RoundingDecimals": 5,
"Rates": [
{
"GroupIntervalStart": 1000000000,
"Value": 0,
"RateIncrement": 1000000000,
"RateUnit": 60000000000
}
]
},
"Weight": 10
},
"DurationIndex": 300000000000,
"Increments": null,
"MatchedSubject": "_out:sbc.mydomain.com:call:*any",
"MatchedPrefix": "1912",
"MatchedDestId": "United_States"
}
]
}
tp_rates

tp_rating_plan

tp_rating_profile

I trust someone would be able to make some sense from this.

Happy New Year to ALL!

regards,

Errol

Timed Balances

A useful feature when you want to specify something like: "User has 1000 minutes in weekends".
The timed part should be seen as a filter which only activates specific balance during some time interval.

Dan

Performance discussion regarding Importing into tp tables

Hi Dan,

I have been for the past few days doing some investigation and research to find ways to improve the performance of getting my data into cgrates tp_* tables and thought I would share my finds with you.

As I been mentioning to you on IRC etc I been getting slow performance and as you suggested I took some timing importing my destinations in cgrates as follows:

Here this test imports the 3 csv files using the cgr-loader and most of the test I did it took anywhere from 12 mins to just over 13 mins to load the Destinations.csv file.

root@demo:~# cgr-loader -flushdb -verbose -to_stordb -tpid="USA_172K" -stordb_type="postgres" -stordb_port=5432 -path=/usr/share/demo/tariffplans/
2015/02/05 05:16:33 Processing file: <DestinationRates.csv>
2015/02/05 05:16:33 Ignoring line 1, warning:
2015/02/05 05:24:35 Processing file: <Destinations.csv>
2015/02/05 05:24:35 Ignoring line 1, warning:
2015/02/05 05:37:36 Processing file: <Rates.csv>
2015/02/05 05:37:36 Ignoring line 1, warning:
Thu Feb 5 05:46:21 CST 2015

DestinationRates — 8 mins 2 secs
Destinations - 13 mins 1 secs
Rates - 8 mins 45 secs

I actually did another test on a Dedicated box with 32G and SSD HardDrives and the same took over 40 mins to complete. Now sure what that is about...So performance was better on my VMs.

So I decided to do some research about doing large inserts in Postgres and found that the COPY command was highly recommended so I created another file called COPY_Destinations.csv and did the import using this command.

cgrates=# COPY tp_destinations FROM '/usr/share/cgrtbilling/tariffplans/COPY_Destinations.csv' DELIMITER ',' CSV HEADER;
COPY 171578
This took a mere 10 secs to import the 171578 destinations.

Here are the links to the files I used
Maybe it would be a good idea to have an API that uses COPY to import csv files to the tp_ tables.

What do you think?

regards,
Errol

Latest package (24 Feb) crashing with some API calls

Hello DanB,

I seem to be having some issues with your latest package dated 24th Feb.

>>> connection = CGRConnector()
Connecting to cgr-engine...
>>> from cgrtbilling.json_client import CGRConnector
>>> connection = CGRConnector()
Connecting to cgr-engine...
>>> response = connection.call("ApierV1.SetTPActions",{"ActionsId": "TOPUP_RST_0", "Actions": [{"BalanceWeight": 0.0, "Direction": "*out", "Weight": 20.0, "ExpiryTime": "*unlimited", "DestinationId": "*any", "Units": 0.0, "Identifier": "*topup_reset", "BalanceType": "*monetary"}], "TPid": "DEFAULT"})
('ERROR: ', <type 'exceptions.ValueError'>, ValueError('No JSON object could be decoded',))
Connecting to cgr-engine...
[Errno 111] Connection refused 

Then I tried with cgr-loader and got this log:

cgr-loader -flushdb -verbose -to_stordb -tpid=DEFAULT -stordb_type="postgres" -stordb_host="127.0.0.1" -stordb_port=5432 -path=/usr/share/tariffplans/
2015/02/27 06:19:15 Processing file: <Actions.csv> 
2015/02/27 06:19:15 Ignoring line 1, warning: <Line starts with comment character.> 
panic: reflect.Value.Addr of unaddressable value

goroutine 16 [running]:
runtime.panic(0x99dca0, 0xc2080dd000)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
reflect.Value.Addr(0x99d220, 0xc208139440, 0x0, 0x62, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/pkg/reflect/value.go:345 +0x99
github.com/jinzhu/gorm.Create(0xc208093400)
    /tmp/cgrates/src/github.com/jinzhu/gorm/callback_create.go:73 +0x82b
github.com/jinzhu/gorm.(*Scope).callCallbacks(0xc208093400, 0xc20808df00, 0x8, 0x8, 0xb8a7e0)
    /tmp/cgrates/src/github.com/jinzhu/gorm/scope_private.go:297 +0x6b
github.com/jinzhu/gorm.(*DB).Save(0xc20810cdc0, 0xb8a7e0, 0xc208139440, 0xc208139440)
    /tmp/cgrates/src/github.com/jinzhu/gorm/main.go:265 +0x96
github.com/cgrates/cgrates/engine.(*SQLStorage).SetTPActions(0xc20803edc0, 0x7fff2117886a, 0x7, 0xc208116540, 0x0, 0x0)
    /tmp/cgrates/src/github.com/cgrates/cgrates/engine/storage_sql.go:523 +0x521
github.com/cgrates/cgrates/engine.(*TPCSVImporter).importActions(0xc20810a230, 0xc2081163b4, 0xb, 0x0, 0x0)
    /tmp/cgrates/src/github.com/cgrates/cgrates/engine/tpimporter_csv.go:419 +0x2f4
github.com/cgrates/cgrates/engine.(*TPCSVImporter).Run(0xc20810a230, 0x0, 0x0)
    /tmp/cgrates/src/github.com/cgrates/cgrates/engine/tpimporter_csv.go:65 +0x1d3
main.main()
    /tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-loader/cgr-loader.go:127 +0xab0

goroutine 19 [finalizer wait]:
runtime.park(0x4181a0, 0xfe1100, 0xfdf329)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0xfe1100, 0xfdf329)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 21 [runnable]:
database/sql.(*DB).connectionOpener(0xc20804a500)
    /usr/local/go/src/pkg/database/sql/sql.go:583 +0x48
created by database/sql.Open
    /usr/local/go/src/pkg/database/sql/sql.go:442 +0x27c

goroutine 17 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

ls -l /usr/bin/ | grep cgr
-rwxr-xr-x 1 root root 11859552 Feb 24 08:51 cgr-console
-rwxr-xr-x 1 root root 13990432 Feb 24 08:51 cgr-engine
-rwxr-xr-x 1 root root 12457504 Feb 24 08:51 cgr-loader
-rwxr-xr-x 1 root root 11806976 Feb 24 08:51 cgr-tester

Regards

Errol

Count Calls before Rating

Hello,
we need availability to Count calls per destination for a clients before a Rating plan is apply to this client.
for example the client1 has 1000 Locals Calls free/month before we start billing them the calls using his profile.

Regards

Daniel

send warning before call drops

We need ability to send/play msg during call if user is running out of balance. it may be settings :
warning_msg = "some_name_of_voice_msg" - play msg at channel from freeswitch sounds
warning_msg_time = 30s - if user have 30s to end of the call , play sound warning msg
warning_script = "/usr/local/launch_script.pl UUID" - optional script that will be launched when hit 30s to end of that call

FS SessionManager - Sync calls on socket reconnect

Right now we do not consider the case when we loose connection to FreeSWITCH and continuing debiting like nothing has happened. There could be missynchronization between active calls in FreeSWITCH and active calls in CGRateS cache which can create issues.

One immediate solution is to kill all the calls CGRateS related on connection established to FreeSWITCH and check if debits need to be made (if call was handled previously, debit the rest of the costs, if not debit complete costs).

DanB

Dry run for TP loader

We would need to be able to parse csv and stordb data without loading it. The errors should be returned as bulk and not one by one as we do now.

DanB

<Rater> FallbackSubject from user space implementation

It appears that we do not use FallbackSubject from call descriptor. This would be quite needed in cases when customer would like to try rating at different levels (eg: if user calling from US offer discounted rates, otherwise apply user standard ones.

DanB

Reconnect mechanism implementation in CGRateS

Since we start services asynchronously, we should implement reconnect mechanism for components connecting between each other.

The following log outlines the issue:

  • Rater is scheduled to bind on port but it does not have enough time to do that before the mediator service will try to connect to it (both started from same cgr-rater process).

Apr 18 15:58:33 CGRateSDev CGRateS: Starting CGRateS Rater on 127.0.0.1:2012.
Apr 18 15:58:33 CGRateSDev CGRateS: Starting CGRateS Scheduler.
Apr 18 15:58:33 CGRateSDev CGRateS: Starting CGRateS SessionManager.
Apr 18 15:58:33 CGRateSDev CGRateS: Starting CGRateS Mediator.
Apr 18 15:58:33 CGRateSDev CGRateS: Could not connect to rater: dial tcp 127.0.0.1:2012: connection refused
Apr 18 15:58:33 CGRateSDev CGRateS: Could not connect to rater: dial tcp 127.0.0.1:2012: connection refused
Apr 18 15:58:33 CGRateSDev CGRateS: Stopped all components. CGRateS shutdown!

Balance Units Increments

At present we got balances kept by default in minutes which is not bad but it does not give the customer flexibility to specify values below that and also it does not follow consistent units usage principle.

A clean approach would be: use consistent units in the code (eg. seconds for duration, currency for charges and so on). For this we would need to specify one extra parameter in the user balances , something like "UnitIncrements" which would be by default 60.

Dan

Installation Issues

After installing git and then go, tried to install CGRateS with command provided in the documentation, however it looks like something is missing out of git sources:

root@CGRateSrv1:/usr/local/go# go get github.com/cgrate/cgrates
# cd .; git clone https://github.com/cgrate/cgrates /usr/local/go/src/pkg/github.com/cgrate/cgrates
Cloning into /usr/local/go/src/pkg/github.com/cgrate/cgrates...
fatal: https://github.com/cgrate/cgrates/info/refs not found: did you run git update-server-info on the server?
package github.com/cgrate/cgrates: exit status 128

DanB

Unable to determine rating plan

Hi Dan,

I've been tracking all the latest changes that have been added..Fridays build was working fine after adding the new options to the command line...however today I can't seem to get it to work.

I reloaded the configuration without any problems, but when I try and rate a call I get a response of " Could not determine rating plans for call"

Any ideas?

Cheers

Paul

Issue with ApierV1.GetAccount

Hello Dan,

As per our chat on IRC I am adding this ticket as requested.

I came across an issue not sure if it is CGRates intended but when we use the GetBalance API we are getting two elements returned as below and I am not sure why.

response = connection.call("ApierV2.GetAccount",{"Tenant":"sbc.mydomain.com","Account":"2651797610","Direction":"_out"})
response
{u'UnitCounters': [{u'Direction': u'_out', u'Balances': [{u'Category': u'', u'Uuid': u'', u'Weight': 0, u'RatingSubject': u'', u'Value': 0.03770999999999994, u'DestinationId': u'', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}], u'BalanceType': u'_monetary'}], u'BalanceMap': {u'_monetary_out': [{u'Category': u'', u'Uuid': u'bcb34776-76e0-481c-afd8-77d79999e7f1', u'Weight': 0, u'RatingSubject': u'', u'Value': 0, u'DestinationId': u'_any', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}, {u'Category': u'', u'Uuid': u'f808a4d4-af00-4a12-b7c7-b9565705b0e5', u'Weight': 10, u'RatingSubject': u'', u'Value': 10.71229, u'DestinationId': u'_any', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}]}, u'AllowNegative': False, u'ActionTriggers': None, u'Disabled': False, u'Id': u'_out:sbc.mydomain.com:2651797610'}

CGRateS: cgrates_0.9.1-rc6_amd64.deb (4th Dec and also tested on latest 18th Dec)
Database: PostgreSQL 9.4

I suspected there was an issue with the weight which was initially set to 10 so as a test I added a test I set the weight to 0 and added balance of 3 and that seems to work fine as you can see from the result below. So is it better to add balances with weight set to 0 or is that dependent on something else?

connection.call("ApierV2.GetAccount",{"Tenant":"sbc.mydomain.com","Account":"2651797610","Direction":"_out"})
{u'UnitCounters': [{u'Direction': u'_out', u'Balances': [{u'Category': u'', u'Uuid': u'', u'Weight': 0, u'RatingSubject': u'', u'Value': 0.03770999999999994, u'DestinationId': u'', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}], u'BalanceType': u'_monetary'}], u'BalanceMap': {u'_monetary_out': [{u'Category': u'', u'Uuid': u'bcb34776-76e0-481c-afd8-77d79999e7f1', u'Weight': 0, u'RatingSubject': u'', u'Value': 3, u'DestinationId': u'_any', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}, {u'Category': u'', u'Uuid': u'f808a4d4-af00-4a12-b7c7-b9565705b0e5', u'Weight': 10, u'RatingSubject': u'', u'Value': 10.71229, u'DestinationId': u'_any', u'ExpirationDate': u'0001-01-01T00:00:00Z', u'SharedGroup': u''}]}, u'AllowNegative': False, u'ActionTriggers': None, u'Disabled': False, u'Id': u'_out:sbc.mydomain.com:2651797610'}

Please note that we are not using CSV files but pushing the data into StorDB via API and then using ApierV1.LoadDestination, ApierV1.LoadRatingPlan and ApierV1.LoadRatingProfile to move the data from StorDB to DataDB.

Attached are a couple of images of my tp_actions and tp_action_plans.

tp_actions
tp_action_plans

regards,

Errol

Performance problem

I have loaded a rating plan with approximately 12,000 number prefixes, rating queries now seem to take an excessive amount of time. Each json query takes around 3 secs to complete. If I do an identical query immediately afterwards I get a near instant response, presumably because of some caching?? Any ideas? I'm running cgrates and Redis on the same machine, its and 8 core G5 (bare metal, no VMS!) on Centos 6.

Destination name aliases

Hi All,
I think it would be great to have access to the Destination names that we uploaded when creating the tariffplans. This would help us build great reports.

I discussed with Dan on IRC and he mentioned the possibility of creating an aliasing table.

regards,

Errol

Rating problem

I have cgrates configured as follows:
::::::::::::::
AccountActions.csv
::::::::::::::

Tenant,Account,Direction,ActionTimingsTag,ActionTriggersTag

cgrates.org,1001,_out,AT_FS10,STANDARD_TRIGGERS
cgrates.org,1002,_out,AT_FS10,STANDARD_TRIGGERS
cgrates.org,1003,_out,AT_FS10,STANDARD_TRIGGERS
cgrates.org,1004,_out,AT_FS10,STANDARD_TRIGGERS
cgrates.org,1005,*out,AT_FS10,STANDARD_TRIGGERS
::::::::::::::
Actions.csv
::::::::::::::

ActionsTag,Action,BalanceType,Direction,Units,ExpirationDate,DestinationTag,RateType,RateValue,MinutesWeight,Weight

TOPUP_10,_topup_reset,_monetary,_out,10,_unlimited,*any,,,,10
::::::::::::::
ActionTimings.csv
::::::::::::::

Tag,ActionsTag,TimingTag,Weight

AT_FS10,TOPUP_10,ASAP,10
::::::::::::::
ActionTriggers.csv
::::::::::::::

Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,DestinationTag,ActionsTag,Weight

STANDARD_TRIGGERS,_monetary,_out,_min_balance,2,,LOG_BALANCE,10
STANDARD_TRIGGERS,_monetary,_out,_max_balance,20,,LOG_BALANCE,10
STANDARD_TRIGGERS,_monetary,_out,_max_counter,15,FS_USERS,LOG_BALANCE,10
::::::::::::::
DestinationRates.csv
::::::::::::::
DR,PSTN_70,GBP_70
DR,PSTN_71,GBP_71
DR,PSTN_72,GBP_72
::::::::::::::
DestinationRateTimings.csv
::::::::::::::
DRT,DR,ALWAYS,10
::::::::::::::
Destinations.csv
::::::::::::::
PSTN_70,70
PSTN_71,71
PSTN_72,72
::::::::::::::
Rates.csv
::::::::::::::
GBP_70,0.000000,2.22222,1s,1s,0s,_up,4,20
GBP_71,0.000000,5.55555,1s,1s,0s,_up,4,20
GBP_72,0.000000,7.77777,1s,1s,0s,_up,4,20
::::::::::::::
RatingProfiles.csv
::::::::::::::

Tenant,TOR,Direction,Subject,ActivationTime,DestinationRateTimingTag,RatesFallbackSubject

cgrates.org,call,_out,_any,2012-01-01T00:00:00Z,DRT,
::::::::::::::
Timings.csv
::::::::::::::

Tag,Years,Months,MonthDays,WeekDays,Time

ALWAYS,_any,_any,_any,_any,00:00:00
ASAP,_any,_any,_any,_any,*asap

I have a python script that makes a call of the following form:
cd = {"Direction":"*out", "TOR":"call", "Tenant": "cgrates.org", "Subject": "1001", "Destination": "7054567", "TimeStart": "2013-08-07T17:30:00Z", "TimeEnd": "2013-08-07T17:31:00Z"}
result = ""
result = rpc.call("Responder.GetCost", cd)
print(result)

The output I get is:
{u'Direction': u'*out', u'TOR': u'call', u'Destination': u'70', u'Account': u'', u'ConnectFee': 0, u'Cost': 466.6662, u'Timespans': [{u'MinuteInfo': None, u'Interval': {u'RoundingDecimals': 0, u'Weight': 10, u'MonthDays': [], u'Months': [], u'WeekDays': [], u'Years': [], u'ConnectFee': 0, u'RoundingMethod': u'', u'StartTime': u'00:00:00', u'Prices': [{u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 2.2222200000000001}, {u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 5.5555500000000002}, {u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 7.7777700000000003}], u'EndTime': u''}, u'CallDuration': 0, u'TimeEnd': u'2013-08-07T17:31:00Z', u'TimeStart': u'2013-08-07T17:30:00Z', u'Cost': 466.6662, u'ActivationPeriod': {u'Intervals': [{u'RoundingDecimals': 0, u'Weight': 10, u'MonthDays': [], u'Months': [], u'WeekDays': [], u'Years': [], u'ConnectFee': 0, u'RoundingMethod': u'', u'StartTime': u'00:00:00', u'Prices': [{u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 2.2222200000000001}, {u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 5.5555500000000002}, {u'RateIncrement': 1000000000, u'GroupIntervalStart': 0, u'RateUnit': 1000000000, u'Value': 7.7777700000000003}], u'EndTime': u''}], u'ActivationTime': u'2012-01-01T00:00:00Z'}}], u'Tenant': u'cgrates.org', u'Subject': u'1001'}

I am confused as to why it identifies the destination as 70, then applies the amount that is applicable to a destination of 72. I also don't understand why it responds with pricing for all 3 destinations.

If I change the destination to something that matches 71 or 72 I get exactly the same response other than the matched destination changes.

Am I doing something wrong here?

Thanks

Paul
Crocodile RCS

Support for time conversions

Right now we consider localtime everywhere. If customer will not use UTC on his servers, there will be issues on transition between Winter/Summer time or non-geographically split switches.

The way I see this implementation would be defining in each section which deals with time a timezone parameter and consider internally in CGRateS database all times UTC.

DanB

cgrates.json installs in the wrong location

Hi DanB,

It seems the latest package dated 21st Jan installs the config file in /etc/cgrates.json instead of /etc/cgrates/cgrates/json and I just wanted to bring that to your attention. Not sure if it was intentional or not.

regards,

Errol

Crash with API call SetActionPlan

Hi DanB,

I am trying to activate a new package with the following API calls but cgrates is crashing:

response = connection.call("ApierV1.SetTPActions", {"TPId":"PKG_USA15","ActionsId":"TOPUP_PKG_USA15","Actions":[{"Identifier":"*topup","BalanceType":"*voice","Direction":"*out","Units":15,"ExpiryTime":"*unlimited","DestinationId":"DR_PLAN15USA_United_States","BalanceWeight":20,"Weight":10}]})

Then

response = connection.call("ApierV1.SetTPActionPlan",{"TPId":"PKG_USA15","Id":"PKG_USA15","ActionPlan":[{"TimingId":"*asap","Weight":10,"ActionsId":"TOPUP_PKG_USA15"}]})

Then

response = connection.call("ApierV1.SetActionPlan", {"Id":"PKG_USA15","Overwrite":True,"ActionPlan":[{"Time":"*asap","Weight":10,"ActionsId":"TOPUP_PKG_USA15"}]})

with this error:
('ERROR: ', <type 'exceptions.ValueError'>, ValueError('No JSON object could be decoded',))
Connecting to cgr-engine...
[Errno 111] Connection refused

Strace

Started at: Tue Mar 10 06:02:11 CDT 2015

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x488d48]

goroutine 44 [running]:
runtime.panic(0xc29940, 0x116f2f3)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/cgrates/cgrates/apier/v1.(_ApierV1).SetActionPlan(0xc20882dea0, 0xc221ad9677, 0x9, 0xc220249320, 0x1, 0x4, 0x1, 0xc221ad9680, 0x0, 0x0)
/tmp/cgrates/src/github.com/cgrates/cgrates/apier/v1/apier.go:507 +0xa88
reflect.Value.call(0xb36660, 0xcc5728, 0x0, 0x130, 0xce91e0, 0x4, 0xc221ab8e40, 0x3, 0x3, 0x0, ...)
/usr/local/go/src/pkg/reflect/value.go:563 +0x1210
reflect.Value.Call(0xb36660, 0xcc5728, 0x0, 0x130, 0xc221ab8e40, 0x3, 0x3, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/reflect/value.go:411 +0xd7
net/rpc.(_service).call(0xc208098c30, 0xc208043280, 0xc221a95a30, 0xc208856d80, 0xc22134b1c0, 0xc2cf40, 0xc221ad5c50, 0x0, 0x196, 0xa39680, ...)
/usr/local/go/src/pkg/net/rpc/server.go:382 +0x1c7
created by net/rpc.(*Server).ServeCodec
/usr/local/go/src/pkg/net/rpc/server.go:453 +0x427

goroutine 16 [chan receive, 2 minutes]:
main.main()
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:528 +0x156f

goroutine 19 [finalizer wait, 2 minutes]:
runtime.park(0x41ad00, 0x11745c0, 0x11727e9)
/usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x11745c0, 0x11727e9)
/usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall, 2 minutes]:
os/signal.loop()
/usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
/usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 22 [chan send, 2 minutes]:
github.com/cgrates/cgrates/balancer2go.func·001()
/tmp/cgrates/src/github.com/cgrates/cgrates/balancer2go/balancer.go:31 +0x150
created by github.com/cgrates/cgrates/balancer2go.NewBalancer
/tmp/cgrates/src/github.com/cgrates/cgrates/balancer2go/balancer.go:34 +0xd3

goroutine 23 [chan receive, 2 minutes]:
database/sql.(*DB).connectionOpener(0xc20804e600)
/usr/local/go/src/pkg/database/sql/sql.go:583 +0x48
created by database/sql.Open
/usr/local/go/src/pkg/database/sql/sql.go:442 +0x27c

goroutine 17 [syscall, 2 minutes]:
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 39 [IO wait]:
net.runtime_pollWait(0x7f814019f228, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(_pollDesc).Wait(0xc21ae1b790, 0x72, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(_pollDesc).WaitRead(0xc21ae1b790, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(_netFD).accept(0xc21ae1b730, 0xeab8c0, 0x0, 0x7f814019e418, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:409 +0x343
net.(_TCPListener).AcceptTCP(0xc21eb64190, 0x6, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:234 +0x5d
net.(_TCPListener).Accept(0xc21eb64190, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:244 +0x4b
github.com/cgrates/cgrates/engine.(_Server).ServeGOB(0x117cede, 0xc2080e3700, 0xe)
/tmp/cgrates/src/github.com/cgrates/cgrates/engine/server.go:86 +0x2a3
created by main.serveRpc
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:278 +0x105

goroutine 25 [chan receive, 2 minutes]:
main.generalSignalHandler()
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/registration.go:49 +0x191
created by main.main
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:460 +0xdfd

goroutine 26 [chan receive, 2 minutes]:
github.com/cgrates/cgrates/scheduler.(*Scheduler).Loop(0xc208134210)
/tmp/cgrates/src/github.com/cgrates/cgrates/scheduler/scheduler.go:44 +0x5d
main.func·001()
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:471 +0xee
created by main.main
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:472 +0xebf

goroutine 38 [IO wait]:
net.runtime_pollWait(0x7f814019f2d8, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(_pollDesc).Wait(0xc21ae1b640, 0x72, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(_pollDesc).WaitRead(0xc21ae1b640, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(_netFD).accept(0xc21ae1b5e0, 0xeab8c0, 0x0, 0x7f814019e418, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:409 +0x343
net.(_TCPListener).AcceptTCP(0xc21eb64180, 0x10, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:234 +0x5d
net.(_TCPListener).Accept(0xc21eb64180, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:244 +0x4b
github.com/cgrates/cgrates/engine.(_Server).ServeJSON(0x117cede, 0xc2080e36e0, 0xe)
/tmp/cgrates/src/github.com/cgrates/cgrates/engine/server.go:64 +0x2a3
created by main.serveRpc
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:277 +0xc9

goroutine 40 [IO wait]:
net.runtime_pollWait(0x7f814019f388, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(_pollDesc).Wait(0xc21ae1b5d0, 0x72, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(_pollDesc).WaitRead(0xc21ae1b5d0, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(_netFD).Read(0xc21ae1b570, 0xc221aba000, 0x2000, 0x2000, 0x0, 0x7f814019e418, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:232 +0x34c
net.(_conn).Read(0xc21eb641b0, 0xc221aba000, 0x2000, 0x2000, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/net.go:122 +0xe7
bufio.(_Reader).fill(0xc221ab8060)
/usr/local/go/src/pkg/bufio/bufio.go:97 +0x1b3
bufio.(_Reader).ReadSlice(0xc221ab8060, 0xc20802cd0a, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/bufio/bufio.go:298 +0x22c
bufio.(_Reader).ReadBytes(0xc221ab8060, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/bufio/bufio.go:376 +0xe3
github.com/cgrates/fsock.(_FSock).readHeaders(0xc21d871b00, 0x0, 0x0, 0x0, 0x0)
/tmp/cgrates/src/github.com/cgrates/fsock/fsock.go:221 +0xd7
github.com/cgrates/fsock.(_FSock).readEvent(0xc21d871b00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/tmp/cgrates/src/github.com/cgrates/fsock/fsock.go:261 +0xbb
github.com/cgrates/fsock.(_FSock).readEvents(0xc21d871b00, 0xc221ab8180, 0xc221ab81e0)
/tmp/cgrates/src/github.com/cgrates/fsock/fsock.go:286 +0x68
created by github.com/cgrates/fsock.(*FSock).Connect
/tmp/cgrates/src/github.com/cgrates/fsock/fsock.go:435 +0x504

goroutine 31 [chan receive]:
github.com/cgrates/fsock.(_FSock).ReadEvents(0xc21d871b00, 0x0, 0x0)
/tmp/cgrates/src/github.com/cgrates/fsock/fsock.go:494 +0x62
github.com/cgrates/cgrates/sessionmanager.(_FSSessionManager).Connect(0xc21ae1b500, 0x0, 0x0)
/tmp/cgrates/src/github.com/cgrates/cgrates/sessionmanager/fssessionmanager.go:63 +0x29d
main.startSessionManager(0xc20880ef20, 0x7f81401a0810, 0xc20802a320, 0xc2080055c0)
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:207 +0x45a
created by main.main
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:504 +0x1323

goroutine 33 [chan receive, 2 minutes]:
main.shutdownSessionmanagerSingnalHandler()
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/registration.go:126 +0x1bd
created by main.main
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:506 +0x1332

goroutine 41 [IO wait]:
net.runtime_pollWait(0x7f814019f0c8, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(_pollDesc).Wait(0xc21ae1b870, 0x72, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(_pollDesc).WaitRead(0xc21ae1b870, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(_netFD).Read(0xc21ae1b810, 0xc208094800, 0x200, 0x200, 0x0, 0x7f814019e418, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:232 +0x34c
net.(_conn).Read(0xc21eb641c0, 0xc208094800, 0x200, 0x200, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/net.go:122 +0xe7
encoding/json.(_Decoder).readValue(0xc20802cea0, 0x7f813ffedbb0, 0x0, 0x0)
/usr/local/go/src/pkg/encoding/json/stream.go:124 +0x557
encoding/json.(_Decoder).Decode(0xc20802cea0, 0xb8a9e0, 0xc221ab8260, 0x0, 0x0)
/usr/local/go/src/pkg/encoding/json/stream.go:44 +0x7a
net/rpc/jsonrpc.(_serverCodec).ReadRequestHeader(0xc221ab8240, 0xc22134b420, 0x0, 0x0)
/usr/local/go/src/pkg/net/rpc/jsonrpc/server.go:66 +0x9d
net/rpc.(_Server).readRequestHeader(0xc208043280, 0x7f813c2077a0, 0xc221ab8240, 0x0, 0x0, 0xc22134b420, 0xeab900, 0x0, 0x0)
/usr/local/go/src/pkg/net/rpc/server.go:552 +0x9b
net/rpc.(_Server).readRequest(0xc208043280, 0x7f813c2077a0, 0xc221ab8240, 0xc208856d80, 0xc22134b1c0, 0xc2cf40, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/pkg/net/rpc/server.go:519 +0xbe
net/rpc.(_Server).ServeCodec(0xc208043280, 0x7f813c2077a0, 0xc221ab8240)
/usr/local/go/src/pkg/net/rpc/server.go:438 +0x69
net/rpc.ServeCodec(0x7f813c2077a0, 0xc221ab8240)
/usr/local/go/src/pkg/net/rpc/server.go:639 +0x3e
net/rpc/jsonrpc.ServeConn(0x7f813c207740, 0xc21eb641c0)
/usr/local/go/src/pkg/net/rpc/jsonrpc/server.go:133 +0x53
created by github.com/cgrates/cgrates/engine.(*Server).ServeJSON
/tmp/cgrates/src/github.com/cgrates/cgrates/engine/server.go:71 +0x405

goroutine 35 [IO wait]:
net.runtime_pollWait(0x7f814019f178, 0x72, 0x0)
/usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(_pollDesc).Wait(0xc21ae1b800, 0x72, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(_pollDesc).WaitRead(0xc21ae1b800, 0x0, 0x0)
/usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(_netFD).accept(0xc21ae1b7a0, 0xeab8c0, 0x0, 0x7f814019e418, 0xb)
/usr/local/go/src/pkg/net/fd_unix.go:409 +0x343
net.(_TCPListener).AcceptTCP(0xc21eb641a0, 0x7f813ffebd00, 0x0, 0x0)
/usr/local/go/src/pkg/net/tcpsock_posix.go:234 +0x5d
net/http.tcpKeepAliveListener.Accept(0xc21eb641a0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/http/server.go:1947 +0x4b
net/http.(_Server).Serve(0xc221ab8000, 0x7f813c2076e0, 0xc21eb641a0, 0x0, 0x0)
/usr/local/go/src/pkg/net/http/server.go:1698 +0x91
net/http.(_Server).ListenAndServe(0xc221ab8000, 0x0, 0x0)
/usr/local/go/src/pkg/net/http/server.go:1688 +0x14d
net/http.ListenAndServe(0xc2080e3720, 0xe, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/pkg/net/http/server.go:1778 +0x79
github.com/cgrates/cgrates/engine.(*Server).ServeHTTP(0x117cede, 0xc2080e3720, 0xe)
/tmp/cgrates/src/github.com/cgrates/cgrates/engine/server.go:114 +0x1ef
main.serveHttp(0xc20802a038, 0x1, 0x1)
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:286 +0xc1
created by main.main
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:527 +0x154a
goroutine 36 [chan receive, 2 minutes]:
main.reloadSchedulerSingnalHandler(0xc208134210, 0x7f81401a0450, 0xc2080eb360)
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/registration.go:111 +0x116
created by main.func·001
/tmp/cgrates/src/github.com/cgrates/cgrates/cmd/cgr-engine/cgr-engine.go:467 +0xa7

I am using the most recent package from 9th Mar 2015.
Let me know if I ave missed anything.
Thanks

Errol

New Balance type: INTERNET_TIME

Common scenario in hotels: an account should be limited on it's Internet usage on one hour. The time should be debited via API call.

Paginator parameter for ApierV1.GetCdrs gets ignored

if i specify the Paginator in AttrGetCdrs parameters, the api ignores it and returns ever the same data, here a pastebin of the payload

http://pastebin.com/zw62yBUW

it is with paginator and itemsperpage = 16 and page = 3.
I also activated the mysql log and i have ever the same query applied with any value of the variables of the paginator parameter. I also inspected the source code and it seems to ignore the paginator parameter, but here is specified as available http://godoc.org/github.com/cgrates/cgrates/utils#AttrGetCdrs

Pre-caching error

I've updated my build to the latest code and now have a problem with cgrates failing to start. I get the following log entries:

Dec 16 10:37:28 CGRateS[27573]: Caching all destinations
Dec 16 10:37:30 CGRateS[27573]: Finished destinations caching.
Dec 16 10:37:30 CGRateS[27573]: Caching all rating plans
Dec 16 10:37:30 CGRateS[27573]: Finished rating plans caching.
Dec 16 10:37:30 CGRateS[27573]: Caching all rating profiles
Dec 16 10:37:30 CGRateS[27573]: Pre-caching error: codec.decoder: Only encoded map or array can be decoded into a struct. (valueType: 8)

Any ideas what the problem is?

Thanks

Paul

Stuck call - DigiDaz

Yesterday I had some sort of stuck call, though there were no calls showing on freeswitch one of my clients balances was continuing to deplete.

I eventually restarted cgrates, to stop the balance depleting completely. Upon reflection maybe I should have left it and then maybe I would have gotten a CDR when the balance was totally exhausted.

I couldn't really allow the balance to go to nil as this is a live client.

There is no CDR for this call so I can only guess what this clients balance should be.

I was hoping that restarting cgrates may end the calls and then rate them but this is obviously not the case as there is no CDR for it.

The client is showing about £8 of usage yesterday but his balance declined by about £50.

I thought maybe it was potentially a single long call that had had a duration of days but checking his call costs his maximum call cost since he started with us is only just over £6.

Rating the b leg of calls

Hello,
I am trying to rate the b leg of the call somehow but not sure of the best way of doing this. At the moment I have enabled in json_cdr.conf.xml and I am able to see both legs of the call, the a-leg of the call is rated but I am unable to get the B-leg of the call rated.

I understand that CGRates will only rate the calls for the A-leg of the call and I see that no problem but I also need to show the rate and what the provider charged for the call if that makes sense.

DanB you did mention about creating some sort of loop with Freeswitch on IRC so we can get both legs but you never went into the details of how to get it done. So I would be grateful if you can share this info.

Thanks
Errol

ApierV1.LoadDestination performance issue

We have trying to move the Destinations from the StorDB over to the DataDB using the ApierV1.LoadDestination but the performance is painfully slow.

It takes well over 20 mins to Load the Destinations of about 57095 rows into the DataDB. The webserver actually times out after 10 mins.
SetTPDestinations completes in about 288 second(s).

CGRates version: cgrates_0.9.1-rc6_amd64.deb (3rd Jan 2015) Also tested on earlier versions.
Postgres version 9.3 and 9.4

Any ideas?

Errol

minimum call duration

we need to be able to setup minimum amount of time that will allow to make a call , so if we setup 60s as minimum so if cgraes calculate based on destination sched_hangup = 61 call should go trough (auth_OK)

Trigger automatic cdr post after mediation

Hi Dan,
As per our conversations on IRC I am posting the ticket here as a reminder.
4:43 PM esamuels, after each call, not sure whether is productive but you would need to export each call I guess
4:43 PM there could be a solution to post the rated cdr to an external server, but that is a feature request again
4:44 PM (if you ask me I think it is easier to develop the destination name fixing instead of external cdr posting)
4:44 PM but both are doable
4:44 PM DanB, I know that I can capture the Freeswitch CDRs but obviously they won't be rated
4:44 PM yes, true
4:45 PM but posting the server out is pretty nice feature I think
4:45 PM If I have control of the rated CDRs then I have more flexibility
4:45 PM Especially for Reporting
4:45 PM I have more flexibility to create different types of reports
4:46 PM yes and also we take the responsibility of storing the cdr then exporting (we already support do_not_store option in case of non rated cdrs)

regards,
Errol

Monetary LCR

Since CGRateS has already built in all the notions regarding monetary costs, we could build a LCR system on top which could give out the best route based on monetary costs considerations. This could be simple rules or combinations with included minutes, discounts and so on (more or less what CGRateS already does for a prepaid account today).

DanB

MediatorV1.RateCdrs issue

Hello,
There seems to be an issue when I ReRate CDRs the account balances are not correctly adjusted it seems that the existing balance just increases by the value of the CDRs that were ReRated which is incorrect. Or maybe I did something wrong, here is the API call I did.

response = connection.call("MediatorV1.RateCdrs",{"Tenant":"cgrates.org","TimeStart":"2015-03-01T00:00:00Z","TimeEnd":"2015-03-07T00:00:00Z","RerateErrors":True,"RerateRated":True})

How do I reset the Balance or correctly adjust the balance?
regards,

Errol

Installation issue on fresh Debian 7 from source

When installing on a clean Debian 7, using
go get github.com/cgrates/cgrates as mentioned at http://cgrates.readthedocs.org/en/latest/installation.html get the following errors

root@cgrates:~# go get github.com/cgrates/cgrates

github.com/cgrates/cgrates/cdrexporter

/usr/lib/go/src/pkg/github.com/cgrates/cgrates/cdrexporter/fixedwidth.go:41: function ends without a return statement

github.com/go-sql-driver/mysql

/usr/lib/go/src/pkg/github.com/go-sql-driver/mysql/driver.go:46: undefined: net.Dialer

labix.org/v2/mgo/bson

/usr/lib/go/src/pkg/labix.org/v2/mgo/bson/decode.go:241: k.Convert undefined (type reflect.Value has no field or method Convert)

github.com/ugorji/go/codec

/usr/lib/go/src/pkg/github.com/ugorji/go/codec/encode.go:107: undefined: io.ByteWriter

Any comments on this?

cdr-c crash

Hi,

I had some crash in cgr-engine system when I'm using postpaid accounts and cdr-client

Here is the crash:
https://gist.github.com/eloycoto/549c0923c98eb2442321

The log only show this:
Parsing: /var/log/cgrates/cdrc/in/Master.csv-20150106-1420539901

cgr-engine version: CGRateS 0.9.1rc5

Could you help me?
Regards.

GroupedRates

There should be possibility to define the following:

  • Charge first minute as a whole and rest in increments of 10 seconds.
  • Charge first 2 minutes with this price then free.

For this we should be using grouped rates. I am seeing this implemented in the following way:

  • Define two extra parameters in Rates file, named maybe RatesGroup and GroupWeight.
  • Get all grouped rates for a subject sorted per weight.
  • Once a group is a winner, apply something like: if the rate is last one in the group priority, apply it for the rest of duration, if not, only use it only once.

Dan

ApierV2.CountCdrs possible bug

Hi rif,
Further to our chat on IRC here is the note for you.

response = connection.call("ApierV2.CountCdrs",{"Tenants":["my.domain.com"],"Accounts":["3867129383"],"AnswerTimeStart":"2015-02-23T00:00:00Z","AnswerTimeEnd":"2015-03-02T00:00:00Z"})
9:01 PM ('ERROR: ', <type 'exceptions.Exception'>, Exception(u'SERVER_ERROR:pq: R:"check_ungrouped_columns_walker" S:"ERROR" C:"42803" M:"column "cdrs_primary.cgrid" must appear in the GROUP BY clause or be used in an aggregate function" P:"9" F:"parse_agg.c" L:"1061"',))
9:04 PM that's one for the issue list, please create an issue on the github

regards,

Errol

PriceUnits

Right now we "assume" price values are per minute.
I would like to add a new column to Rates where to specify the number of units a price apply to.

EG:

Price 0.010
PriceUnits 60
BillingUnit 10

Should translate into:
Price: 10 cents per 60 units (60 seconds since the basic unit of duration is second), chargeable in 10 units (10 seconds) interval.

Dan

Shared balances

One feature missing and hit by it today:

  • There should be a possibility to specify shared balances for an account.

I see it as defining balance group for both primary balances as well as destination balances. There should also be specified GroupWeight. If the balance of a user is not enough for a specific action, instead of debiting his account, the next balance available with GroupWeight smaller than his own one should be debited.

DanB

MaxCallCost

Should be able to define in rates.csv a MaxCallCost as the upper limit of the call cost, rates becoming 0 after that limit is hit. This feature is common for premium destinations in countries like Netherlands.

DanB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.