CGRateS + OpenSIPS simpleauth context

74 views
Skip to first unread message

vasilios.t...@voiceland.gr

unread,
Jul 22, 2021, 3:08:53 AM7/22/21
to CGRateS
Dear team,

I am using Version 0.10 and I would like to ask if there is a way to send a specific context from OpenSIPS to CGRateS.

I would like to use for a example this "simpleauth" context mentioned here --> https://github.com/cgrates/cgrates/blob/v0.10/data/tariffplans/tutorial/Attributes.csv

I use *sessions or *any right now for this functionality but there are situation where I only need custom contexts to be queried from OpenSIPS side. Is there any variable like $cgr(context) so that we can achieve this? It would be really useful.

thank you in advance.

Vasilios Tzanoudakis


Andrei-Sebastian Andronache

unread,
Jul 26, 2021, 9:55:50 AM7/26/21
to CGRateS
Hi Vasilios Tzanoudakis,

In order to send a specific context from OpenSIPS to CGRateS you will need to set a custom context in the config for OpenSIPS.
The variable you are going to use is "Context", and the final line in the config is supposed to look like this : $cgr(Context) = "your_context_here".
This will populate the event with your desired context.
After doing this, we would appreciate if you could post the captured ngrep for us to analyze.

Thanks,
Andrei

vasilios.t...@voiceland.gr

unread,
Jul 28, 2021, 8:24:41 AM7/28/21
to CGRateS
Dear Andrei,

Thank you for your response. 
Using $cgr(Context) = "simpleauth" from OpenSIPS side its working fine. 

ngrep 2014
======================
##
T 2021/07/28 12:22:44.248071 127.0.0.1:49812 -> 127.0.0.1:2014 [AP] #8
{ "method": "SessionSv1.AuthorizeEventWithDigest", "id": 510523725, "params": [ { "Tenant": "voiceland.dev", "GetAttributes": true, "Event": { "Account": "+302107001398", "Context": "simpleauth" } } ] }
#
T 2021/07/28 12:22:44.250487 127.0.0.1:2014 -> 127.0.0.1:49812 [AP] #9
{"id":510523725,"result":{"AttributesDigest":"SipUserName:+302107001398,SipPassword:XXXXX","ResourceAllocation":null,"MaxUsage":0,"SuppliersDigest":null,"Thresholds":null,"StatQueues":null},"error":null}


thank you for your support
Vasilios Tzanoudakis
Reply all
Reply to author
Forward
0 new messages