Get Account ID dynamically in an Action with call_url

72 views
Skip to first unread message

Turoa TETOE

unread,
Feb 1, 2019, 5:09:21 PM2/1/19
to CGRateS
Hello,

When using the ActionType "call_url" or "call_url_async", is there a way to get the Account id dynamically in the url?
I'm using Actions and ActionTriggers to send an alert and I'd like to create a generic Action that could work for multiple accounts at the same time. (I don't want to create one Action+ActionTriggers for each account if possible)

Actions:
 "ALRT_Test1_100": [
  {
   "Id": "ALRT_Test1_100",
   "ActionType": "*call_url_async",
   "ExtraParameters": "http://xxx/?destination=<<.Account.GetID>>&content=Message",
   "Filter": "",
   "ExpirationString": "*unlimited",
   "Weight": 10,
   "Balance": {
    "Uuid": null,
    "ID": null,
    "Type": null,
    "Value": null,
    "Directions": {
     "*out": true
    },
    "ExpirationDate": "0001-01-01T00:00:00Z",
    "Weight": 10,
    "DestinationIDs": null,
    "RatingSubject": null,
    "Categories": null,
    "SharedGroups": null,
    "TimingIDs": null,
    "Timings": null,
    "Disabled": false,
    "Factor": null,
    "Blocker": false
   }
  }
 ],

ActionTriggers:
 {
  "ID": "TRG_Test1",
  "UniqueID": "1",
  "ThresholdType": "*min_balance",
  "ThresholdValue": 6000000001,
  "Recurrent": false,
  "MinSleep": 0,
  "ExpirationDate": "0001-01-01T00:00:00Z",
  "ActivationDate": "0001-01-01T00:00:00Z",
  "Balance": {
   "Uuid": null,
   "ID": null,
   "Type": "*voice",
   "Value": null,
   "Directions": {
    "*out": true
   },
   "ExpirationDate": null,
   "Weight": null,
   "DestinationIDs": null,
   "RatingSubject": null,
   "Categories": null,
   "SharedGroups": null,
   "TimingIDs": null,
   "Timings": null,
   "Disabled": null,
   "Factor": null,
   "Blocker": null
  },
  "Weight": 10,
  "ActionsID": "ALRT_Test1_100",
  "MinQueuedItems": 0,
  "Executed": false,
  "LastExecutionTime": "0001-01-01T00:00:00Z"
 },

Best regards

Dan B

unread,
Feb 4, 2019, 7:01:03 AM2/4/19
to cgr...@googlegroups.com
Hi Turoa,

You cannot add the account ID since the event itself it will contain it. Does this not work for you?

DanB

Am Fr., 1. Feb. 2019, 23:09 hat Turoa TETOE <muzz...@gmail.com> geschrieben:
--
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/9551e3d8-2da6-44cf-9160-37301733ddc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Turoa TETOE

unread,
Feb 4, 2019, 7:35:23 AM2/4/19
to CGRateS
Hi Dan,

It might work if I create one action+action trigger for each account but I’d like to avoid that and just do one for multiple accounts.

I’m not sure I’m getting it for the event thing. Can we get some event information dynamically in the url?

Dan Christian Bogos

unread,
Feb 4, 2019, 12:13:15 PM2/4/19
to cgr...@googlegroups.com
Hi Turoa,

I recommend you looking into ThresholdS since in that case you can
configure just one ThresholdProfile for all of your accounts (and
implicitly having to create only one action - you will get the account
as said in the event body).
The reason we did not develop in-url templates was because HTTP is just
one way to send events out and if we go into specifics of HTTP we might
not have a generic/simple dispatch method for all the notification
types.

Let me know how that works out for you.

DanB

Turoa TETOE

unread,
Feb 15, 2019, 5:16:29 PM2/15/19
to CGRateS
Hello Dan,

Ok I got the Thresholds working and sending all the informations I need to an url.

It's working perfectly when a Voice balance is updated with a threshold set on a BalanceUpdate event.
But I don't see any event when a Monetary balance is updated beside the ""EventName":"SMA_SESSION_TERMINATE"", do I have to tweak the configuration to get a BalanceUpdate on a monetary update?

Best regards,
Turoa

Dan Christian Bogos

unread,
Feb 19, 2019, 12:07:10 PM2/19/19
to cgr...@googlegroups.com
Hi Turoa,

Do u have the thresholds_conns defined in your RALs?
It should be this setting here:
https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L163

I also remember fixing some stuff related to this in the last month.
Please make sure you have the latest master.

DanB

Turoa TETOE

unread,
Feb 19, 2019, 1:56:44 PM2/19/19
to CGRateS
Yes it is set:
"rals": {
"enabled": true,
"thresholds_conns": [
{"address": "127.0.0.1:2012", "transport": "*json"},
],
"stats_conns": [
{"address": "127.0.0.1:2012", "transport": "*json"},
],
},

cgr-console 'status'
{
 "ActiveGoroutines": 52,
 "Footprint": "68.7MiB",
 "MemoryUsage": "5.2MiB",
 "NodeID": "CGRAsterisk",
 "Version": "CGRateS 0.9.1~rc8 git+af059c1 (2019-02-05T09:30:03+01:00)"
}

I'm updating and will try again, thanks.

Turoa TETOE

unread,
Feb 20, 2019, 3:40:39 PM2/20/19
to CGRateS
Hi Dan,

I did update
cgr-console 'status'
{
 "ActiveGoroutines": 49,
 "Footprint": "68.4MiB",
 "MemoryUsage": "5.4MiB",
 "NodeID": "CGRAsterisk",
 "Version": "CGRateS 0.9.1~rc8 git+3e99bc3 (2019-02-19T14:06:04+02:00)"
}

But I still don't see a balance update Threshold event when making a call using monetary balance.

Dan B

unread,
Feb 20, 2019, 3:44:04 PM2/20/19
to cgr...@googlegroups.com
Hi Turoa,

Can u send me your config as well as full capture of events/api calls?

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.

Turoa TETOE

unread,
Feb 20, 2019, 4:27:11 PM2/20/19
to CGRateS
I just tried the Action triggers one more time (almost the same setup as my first comment here).
It turns out it already does everything I need (can setup one action trigger for every account etc...), I didn't know at the time that the event was sent in json.

When testing Thresholds, I modified my receiver to get the json info but never tried back the ActionTriggers until now, sorry about that.

I only have one question now, what is your plan concerning action triggers? Will it be deprecated in the future?

Dan Christian Bogos

unread,
Feb 22, 2019, 12:10:00 PM2/22/19
to cgr...@googlegroups.com
Hey Turoa,

We don't have a concrete date for deprecating ActionTriggers but we are
going towards using ThresholdS everywhere. Unless there is a specific
feature which you have it in ActionTriggers and cannot have it in
ThresholdS, I would vote for ThresholdS.

Thanks,
DanB
Reply all
Reply to author
Forward
0 new messages