Runfilter in DerivedCharger

38 views
Skip to first unread message

Srigo Kana

unread,
Jul 4, 2018, 5:22:45 PM7/4/18
to CGRateS
Hi,

Im currently having an input CDR like this:

{ "method": "CdrsV1.ProcessExternalCDR", "params": [{"Direction":"*out", "Category":"call", "RequestType":"*rated", "ToR":"*voice", "Tenant":"v.ibrowse.com", "Account":"4201@100000", "Destination":"3365231XXXXX", "AnswerTime":"1527064481", "SetupTime":"1527064473", "Usage":"4s","OriginID":"9427055b745f-en652bvkq2s4-gkpmlsdqhs-c6NyB0t2yHH0B", "Subject":"HOTEL_RATING", "ExtraFields": {"room":"12"}}]}

And my derivedChargers:
DestinationField[14],SetupTimeField[15],PddField[16],AnswerTimeField[17],UsageField[18],SupplierField[19],DisconnectCause[20],RatedField[21],CostField[22]
*out,v.ibrowse.com,call,*any,*any,,guest_rating_run1,~filterhdr1:s/[0-9]*/room/,^*rated,*default,*default,*default,*default,^GUEST_RATING,*default,*default,*default,*default,*default,*default,*default,*default,*default

I want to run DerivedCharger only when room is not empty (regex: [a-zA-Z0-9]*)? I don't know how to do it.

i tried:
  - room([a-zA-Z0-9]*)
  - ~filterhdr1:s/[0-9]*/room/
  - ^room/[a-zA-Z0-9]*/

None of them worked for me

Thx for your help
srigo



DanB

unread,
Jul 9, 2018, 5:03:27 AM7/9/18
to cgr...@googlegroups.com
Hi Srigo,

I think it should work "room(12)" as RunFilter.

DanB

PS: If you can wait a couple of weeks more we should have ready a new
derived chargers module which will be more powerful and user friendly.
> --
> 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/91547227-2451-4140-abbd-23eb7e6e4e56%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.

Srigo Kana

unread,
Jul 9, 2018, 8:23:09 AM7/9/18
to CGRateS
Thank you Dan. Looking forward for the feature.

Srigo

Srigo Prog

unread,
Jul 10, 2018, 6:08:04 AM7/10/18
to cgr...@googlegroups.com
Hi Dan,

I was testing the runfilter in DerivedChargers. room(12) works, however when I’m using the regex as follow "room(\d+)", it’s not matching.

Srigo

DanB

unread,
Jul 10, 2018, 6:17:48 AM7/10/18
to cgr...@googlegroups.com
Srigo,

That is because you have not defined properly the filter type.

In order to make regexp filtering work, you should configure something
like: room(~\d+). Otherwise it will try to match string \d+.

You can find further options in test here:
https://github.com/cgrates/cgrates/blob/master/utils/rsrfield_test.go#L
318

DanB
> msgid/cgrates/B04AA3F0-4917-4E6D-AB1D-B4895F21709C%40gmail.com.

Srigo Prog

unread,
Jul 10, 2018, 6:40:57 AM7/10/18
to cgr...@googlegroups.com
My mistake. Thanks Dan, It works great!

Srigo
> To view this discussion on the web visit https://groups.google.com/d/msgid/cgrates/b29d96c04a8e3a64d9377648fa3bbc6f7998051f.camel%40cgrates.org.
Reply all
Reply to author
Forward
0 new messages