offline charging configuration

345 views
Skip to first unread message

Juan Sepulveda

unread,
Jun 14, 2017, 4:39:53 AM6/14/17
to CGRateS
Hi,

we try to configure the agent diameter for offline charging, accounting message ACR/ACA.

can you clarify if this is possible with cgrates as we see only script for credit control message CCR/CCA?

if yes, can you provide us some templates or direction on how to configure this type of message?

our CTF send billing ACR messages over an Rf interface to the cgrates agent diameter acting as CDF.

thx for your help

Juan

DanB

unread,
Jun 14, 2017, 5:43:18 AM6/14/17
to cgr...@googlegroups.com
Hi Juan,

Diameter is implemented pretty generically in CGRateS, so I would say
it should be possible. The logic is pretty simple: we get attributes
and values which you extract using templates (request fields are for
extracting the values out of your incoming diameter messages and
reply_fields are the ones you put back in diameter answer). So all you
need is to know which fields in your diameter requests map to what
CGRateS request fields.
If you give me a sample of inbound diameter message (already decoded),
and logic you want to apply for it (eg: which field is account, which
is destination, answerTime and duration), I can put together a
processor template for you.

We could also try to do it interactively over IRC today afternoon
(europe time) if you are around.

DanB
> --
> 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/dd661354-c61d-4d3c-b746-ce98bc6f62f2%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

Juan Sepulveda

unread,
Jun 14, 2017, 6:46:32 AM6/14/17
to CGRateS
Hi Dan,

thx for your feedback.

I put in attached file the diiameter ACR message sent by our CTF.

hope it is what you requested.

Juan
ctf diameter acr message.pcap

DanB

unread,
Jun 14, 2017, 6:59:39 AM6/14/17
to cgr...@googlegroups.com
Hey Juan,

Can you please send me a decoded version of your message? I would
otherwise need to have your exact dictionaries and it is a bit of pain
for me to stay in sync. Would be great if you could export the .pcap as
text or something.

Thanks,
DanB


Juan Sepulveda

unread,
Jun 15, 2017, 5:29:13 AM6/15/17
to CGRateS
Hi Dan,

here is in attached file a decoded version of the diameter message.

Juan
acr on cgrates.txt

DanB

unread,
Jun 15, 2017, 5:37:47 AM6/15/17
to cgr...@googlegroups.com
Juan,

Great, this one looks good.

Now my question, can u point me out which fields should be converted
into CGRateS CDR?

At minimum I need the following fields:
* Account - the entity you will bill - caller.
* Destination - the entity you bill for - callee.
* AnswerTime - field telling us the answer time of your call
* Usage - number of seconds or data usage out of your CDR.

There are a number of fields in CGRateS which are useful and can be
added but these 4 are the minimal requirement for billing. Once I know
these, I can advise you regarding template.

DanB

Juan Sepulveda

unread,
Jun 15, 2017, 6:29:47 AM6/15/17
to CGRateS
Dan,

we can start with:

Account - the entity you will bill - caller. 
Destination - the entity you bill for - callee. 
AnswerTime - field telling us the answer time of your call 
Usage - number of seconds or data usage out of your CDR. 
user session id
calling party address
called party address
origin host
origin realm
destination host
destination realm

Juan

DanB

unread,
Jun 15, 2017, 6:34:34 AM6/15/17
to cgr...@googlegroups.com
Juan,

Can u please identify for me exact fields you want to extract from
diameter?

I need a mapping for each of the mandatory fields I have exemplified:

ie: CGRateS Account -> Diameter calling party address
CGRateS Destination -> Diameter called party address

and so on for the rest of the fields (AnswerTime, Usage and any other
you want to include).

Thanks,
DanB

Juan Sepulveda

unread,
Jun 15, 2017, 7:50:16 AM6/15/17
to CGRateS
here is:

cgrates Caller calling party address
cgrates Callee called party address
cgrates source host origin host
cgrates source realm origin realm
cgrates destination host destination host
cgrates destination realm destination realm
cgrates start-time event-Timestamp
cgrates call duration sip-request-timestamp-fraction
cgrates role of node Role-of-node
cgrates Node functionality node-functionality
cgrates sip session id user-session-id

Juan

DanB

unread,
Jun 15, 2017, 9:19:50 AM6/15/17
to cgr...@googlegroups.com
Hi Juan,

You can try with this template (although please review the paths,
especially for grouped AVPs):

"""
"diameter_agent": {
"request_processors": [
{
"id": "TestJuan",
"dry_run": false,
"request_filter": "",
"ccr_fields":[
{"tag": "TOR", "field_id": "ToR",
"type": "*composed", "value": "^*voice", "mandatory": true},
{"tag": "OriginID", "field_id":
"OriginID", "type": "*composed", "value": "Session-Id", "mandatory":
true},
{"tag": "OriginHost", "field_id":
"OriginHost", "type": "*composed", "value": "Origin-Host", "mandatory":
true},
{"tag": "RequestType", "field_id":
"RequestType", "type": "*composed", "value": "^*rated", "mandatory":
true},
{"tag": "Account", "field_id":
"Account", "type": "*composed", "value": "Service-Information>IMS-
Information>Calling-Party-Address", "mandatory": true},
{"tag": "Destination", "field_id":
"Destination", "type": "*composed", "value": "Service-Information>IMS-
Information>Called-Party-Address", "mandatory": true},
{"tag": "SetupTime", "field_id":
"SetupTime", "type": "*composed", "value": "Event-Timestamp",
"mandatory": true},
{"tag": "AnswerTime", "field_id":
"AnswerTime", "type": "*composed", "value": "Event-Timestamp",
"mandatory": true},
{"tag": "Usage", "field_id": "Usage",
"type": "*composed", "value": "Service-Information>IMS-
Information>Time-Stamps>SIP-Request-Timestamp-Fraction", "mandatory":
true},
{"tag": "SourceRealm", "field_id":
"SourceRealm", "type": "*composed", "value": "Origin-Realm"},
{"tag": "SourceRealm", "field_id":
"DestinationRealm", "type": "*composed", "value": "Destination-Realm"},
{"tag": "RoleOfNode", "field_id":
"RoleOfNode", "type": "*composed", "value": "Service-Information>IMS-
Information>Role-Of-Node"},
{"tag": "NodeFunctionality",
"field_id": "NodeFunctionality", "type": "*composed", "value":
"Service-Information>IMS-Information>Node-Functionality"},
{"tag": "SipSessionID", "field_id":
"SipSessionID", "type": "*composed", "value": "Service-Information>IMS-
Information>User-Session-Id"},
],
"cca_fields":[
],
},

],
}
"""

I suggest playing with dry_run: true until you are happy with the event
being sent out to CGR-SMG.

DanB


Juan Sepulveda

unread,
Jun 20, 2017, 5:46:31 AM6/20/17
to CGRateS
Hi Dan,

I have included your template in the cgrates.json file (see attached file).

but we don't see data in the mysql tables:

mysql> select * from cdrs_primary limit 20;
Empty set (0.00 sec)

mysql> exit


also as you will see in the log file, we still have a message saying "unexpected message" for the ACR message. no ACA is sent to the CTF.

can you clarify us what is missing or wrong in the config file?

Thx for your help

Kr

Juan
acr on cgrates 200617.txt
cgrates_template.json

Dan B

unread,
Jun 20, 2017, 8:44:56 AM6/20/17
to cgr...@googlegroups.com
Hi Juan,

I understand where your problem is. I need to add some code to fix your message. Please have some patience on this since I am on vacation till early July.
Please add a new issue on github where you can monitor it's progress.

Thanks,
DanB

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to cgr...@googlegroups.com.

Juan Sepulveda

unread,
Jun 21, 2017, 2:38:31 AM6/21/17
to CGRateS
ok, thx

I will create a new issue called "Diameter-agent - unexpected message  ACR".

have nice holydays.

Kr

Juan
To unsubscribe from this group and stop receiving emails from it, send an email to cgrates+u...@googlegroups.com.

DanB

unread,
Jul 2, 2017, 9:49:56 AM7/2/17
to CGRateS
Hi Juan,

I have checked and did not see any new issue from you on github regarding ACR message. Did u create one?

DanB

Juan Sepulveda

unread,
Jul 5, 2017, 7:28:10 AM7/5/17
to CGRateS
Hi Dan,

yes I created a new issue. but with your comment, I realized that I created in the mailing group.

I will now create it in the github.

sorry for the misunderstanding

Juan

Juan Sepulveda

unread,
Jul 5, 2017, 7:34:43 AM7/5/17
to CGRateS

DanB

unread,
Jul 5, 2017, 8:08:08 AM7/5/17
to cgr...@googlegroups.com
Juan,

Thanks, noted!
Will keep you updated in the issue about progress.

DanB

Reply all
Reply to author
Forward
0 new messages