Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Need help in executing call with Real-Time data

159 views
Skip to first unread message

Amisha sinha

unread,
Feb 25, 2025, 5:19:23 AMFeb 25
to CGRateS
Hello Everyone,
I am trying to execute call with realtime data with below details.
FROM NUMBER CALLED  2082674170
TO NUMBER CALLED  2397192258
DURATION 20s
# cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="2082674170" Destination="+12397192258" AnswerTime="2025-02-21T13:00:00Z" Usage="20s"'
Error executing command: SERVER_ERROR: UNAUTHORIZED_DESTINATION

But it says  SERVER_ERROR: UNAUTHORIZED_DESTINATION , although I have updated the Destinations.csv to below.

#Id,Prefix
DST_+12397192258,+12397192258
DST_+12082674170,+12082674170
DST_FS,10
DST_1003,1003

Also While loading the data, I am facing this below error: (error attached)

Let me know if anyone has encountered this issue before, seeking for guidance here. 
Thank You!
Loader Error.txt

Armir Veliaj

unread,
Feb 25, 2025, 1:27:57 PMFeb 25
to CGRateS
Hi Amisha,

The error you're encountering is occurring because the tariff plans are already stored in storDB. When loading again, it creates duplicates. You need to provide a different tipid if you are loading a second time into storDB.
We suggest working with .csv files for better understanding at first, until you get more comfortable.


Thanks,
Armir

Amisha sinha

unread,
Feb 27, 2025, 6:27:35 AMFeb 27
to CGRateS
Hello Armir,
Thank You for your response I was able to make the data load into the DB, now When I am trying to execute the call again It's giving same error,
I followed the guide https://cgrates.readthedocs.io/en/latest/rals.html#account.
This is how my Destinations.csv looks like,
#Id,Prefix
DST_+12397192258,+1
DST_+12082674170,+1
DST_FS,10
DST_1003,1003
also used this one as well,

#Id,Prefix
DST_+12397192258,+12397192258
DST_+12082674170,+12082674170
DST_FS,10
DST_1003,1003
Both isn't working.
cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="+12082674170" Destination="+12397192258" AnswerTime="2025-02-27T13:00:00Z" Usage="20s"'

Error executing command: SERVER_ERROR: UNAUTHORIZED_DESTINATION

This is the error, Could you please confirm how I can make real-time number work, do I need to provide specific tenant in tentant ID or it's fine to make it work with cgrates.org

Also below are the additional CSVs attached. 
Thank You.
DestinationRatescsv.txt
Ratingplans.csv
Ratingprofiles.csv

Armir Veliaj

unread,
Feb 27, 2025, 11:14:00 AMFeb 27
to CGRateS
Hi Amisha,

I tried with your csv files on my side (although I needed to swap the names of the csv files you had for DestinationRates with that of RatingPlans), and it worked on my side, with the cost being shown afterward using the same command "cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="+12082674170" Destination="+12397192258" AnswerTime="2025-02-27T13:00:00Z" Usage="20s"'
and for loading tariff plans : "cgr-loader -verbose -path=/usr/share/cgrates/tariffplans/tutorial".

You can try again by starting fresh to make sure you are not mixing data.Also please send us how you are loading those tariff plans into the DataDB, the command you are using, and the logs you receive together with ngreps.

Thanks,
Armir

Amisha sinha

unread,
Feb 27, 2025, 3:08:58 PMFeb 27
to CGRateS
Hello Armir, 
When trying this command  "cgr-loader -verbose -path=/usr/share/cgrates/tariffplans/tutorial" it's returning Empty set in DB, 
[cgrates]> select * from tp_rating_plans;
Empty set (0.001 sec)
But When I am trying with below command, (which am usually using) to load data, it's working;
cgr-loader -verbose -path=/usr/share/cgrates/tariffplans/tutorial -to_stordb -tpid="CGRATES_1"
 [cgrates]> select * from tp_rating_plans;
+----+-----------+---------------------+-----------------------+------------+--------+---------------------+
| id | tpid      | tag                 | destrates_tag         | timing_tag | weight | created_at          |
+----+-----------+---------------------+-----------------------+------------+--------+---------------------+
|  1 | CGRATES_1 | RP_1003             | DR_+12082674170_10CNT | *any       |  10.00 | 2025-02-27 16:34:41 |
|  2 | CGRATES_1 | RP_SMS              | DR_SMS                | *any       |   0.00 | 2025-02-27 16:34:41 |
|  3 | CGRATES_1 | RP_MMS              | DR_MMS                | *any       |   0.00 | 2025-02-27 16:34:41 |
|  4 | CGRATES_1 | RP_DATA             | DR_MMS                | *any       |   0.00 | 2025-02-27 16:34:41 |
|  5 | CGRATES_1 | RP_+12082674170     | DR_+12397192258_20CNT | *any       |  10.00 | 2025-02-27 16:34:41 |
|  6 | CGRATES_1 | RP_+12082674170     | DR_1003_MAXCOST_DISC  | *any       |  10.00 | 2025-02-27 16:34:41 |
|  7 | CGRATES_1 | RP_+12397192258     | DR_+12082674170_20CNT | *any       |  10.00 | 2025-02-27 16:34:41 |
|  8 | CGRATES_1 | RP_+12397192258_LOW | DR_+12082674170_10CNT | *any       |  10.00 | 2025-02-27 16:34:41 |
+----+-----------+---------------------+-----------------------+------------+--------+---------------------+
8 rows in set (0.001 sec)


Also I believe this may storing cache somewhere, I started fresh Ran a call it executed, Top-up worked as well But No balance deductions later, also When I tried exporting CDR didn't work, Please suggest a way forward. 
Attaching the console log. 

Thank You!
Realtimecalltest.txt

Armir Veliaj

unread,
Feb 28, 2025, 10:42:13 AMFeb 28
to CGRateS
Hi Amisha,

CGRates looks for profiles only in dataDB, so you load tariff plans to there.  

For CDR exports, the command in our tutorial still works, but it's outdated and uses parameters from previous versions, which are ignored. Using export_cdrs directly should suffice, and you can check all available parameters by running "cgr-console help export_cdrs".

Also, make sure your config has both ees and apiers enabled to allow CDR exports.

If you're still having issues, please send us your engine logs, ngrep outputs, and the config you're using.

Thanks,
Armir

Amisha sinha

unread,
Mar 3, 2025, 1:08:34 PMMar 3
to CGRateS
Hello Armir, 
Thank You again from replying. . 
Now I am using Mongodb as data db and sotredb and I am loading data to datadb using command: 
cgr-loader -verbose -path=/usr/share/cgrates/tariffplans/tutorial -stordb_name=admin -datadb_name=admin '-datadb_type=*mongo' -datadb_port=27017 '-stordb_type=*mongo' -stordb_port=27017 -datadb_passwd=CGRateS.org
and data is successfully loaded 
Top up also worked and call executed (with the standard command) without an error but deduction still didn't happen.

For CDR, this is the output: 
# cgr-console help export_cdrs

        Usage: export_cdrs ExporterIDs=null Verbose=false CGRIDs=null NotCGRIDs=null RunIDs=null NotRunIDs=null OriginIDs=null NotOriginIDs=null OriginHosts=null NotOriginHosts=null Sources=null NotSources=null ToRs=null NotToRs=null RequestTypes=null NotRequestTypes=null Tenants=null NotTenants=null Categories=null NotCategories=null Accounts=null NotAccounts=null Subjects=null NotSubjects=null DestinationPrefixes=null NotDestinationPrefixes=null Costs=null NotCosts=null ExtraFields=null NotExtraFields=null SetupTimeStart="" SetupTimeEnd="" AnswerTimeStart="" AnswerTimeEnd="" CreatedAtStart="" CreatedAtEnd="" UpdatedAtStart="" UpdatedAtEnd="" MinUsage="" MaxUsage="" OrderBy="" ExtraArgs=null Limit=null Offset=null
Also in json file, apier and ees are enables and also attaching json file for your refrence. 

Please let me know how I can  export the CDR, also mongodb doesn't creating CDR table but it's loading all the csv files. 
Thank You,
Amisha
cgrates.json

Armir Veliaj

unread,
Mar 4, 2025, 4:21:09 AMMar 4
to CGRateS
Hi Amisha,

When executing cgr-loader, you can specify just the configuration file.
In your case, the stordb flags are redundant, as the data is only stored to dataDB.

Regarding cgr-console help export_cdrs, it works as intended, as its only purpose is to show the available parameters.
You can then choose which ones to use. For example:
cgr-console 'export_cdrs ExporterIDs=["tutorial_export"]'

We cannot determine what went wrong with the billing unless you provide us with the CDRs themselves (which should either have an error in the ExtraInfo field or valid CostDetails). You can retrieve them using CDRsV1.GetCDRs or the "cdrs" command in cgr-console (see cgr-console help cdrs). You should provide the complete ngrep output after ensuring that all connections are either *localhost or any *json connection:
Sample ngrep command: sudo  ngrep -t -W byline port 2012 or 2014 -d any

Note: Your configuration file contains many outdated entries. I recommend checking some of the tutorial samples. You can find them in data/conf/samples and choose from there.

Thanks,
Armir

Reply all
Reply to author
Forward
0 new messages