Hi Aqs,
Please see inline ...
On Thu, 2018-09-06 at 07:43 -0700, Aqs Younas wrote:
> Thanks DanB, That is impressive. (Y)
Thanks!
>
> But somehow i am a little bit confused in understanding some
> Attributes filters. Like in below Attributes file(Taken from cluelrn
> demo).
>
> #Tenant,ID,Contexts,FilterIDs,ActivationInterval,FieldName,Initial,Su
> bstitute,Append,Blocker,Weight
>
cgrates.org,LRN_Dst3125650565,lrn,*string:Destination:
3125650565,,Des
> tination,*any,
13128543000,true,false,10
>
cgrates.org,LRN_Dst3125650565,,,,OriginalDestination,*any,
3125650565,
> true,false,10
>
cgrates.org,LRN_LATA_Dst13128543000,lrn,*string:Destination:131285430
> 00;*rsr::OriginalDestination(!^$),,DestinationLATA,*any,358,true,fals
> e,20
>
> I know.
>
Before getting into each line you should understand how the queries to
AttributeS will be looping.
We will send the Event to AttributeS in a loop. Each loop will match an
attribute profile and change some parameters. Once the parameters are
changed, the altered event will be fed again into AttributeS and match
maybe another attribute profile. If you have multiple attribute
profiles matching (by filters), the winner will be decided based on
weight (higher weight -> more priority to match).
> First line is checking if destination number is
3125650565 then
> replace it with
13128543000.
> Second line, Since destination number has become
13128543000 due to
> first line effect, lets add an attribute -> OriginalDestination of
> value
3125650565.
>
> But third line is kinda becoming abstruse to me. Could you please
> explain this last line to me especially the last part *rsr.
The third line is part of another profile (first two lines are part of
one attribute profile -> one process event).
The *rsr is an internal filter into CGRateS (RegexpSearchReplace) and
it is used as a dynamic way to match/search/replace using Regexp rules
(or some other particular rules available within CGRateS). You can call
it a special language we have developed in order to dynamically parse
content with regexp. So looking back at the line 3 that one will say:
Destination needs to be "
13128543000" and OriginalDestination needs not
to be empty. The extra filter was needed so we can make sure we match
the right attribute profile (after processing the first one)
You should be able to understand more on *rsr if you look on this tests
regarding *rsr filters:
https://github.com/cgrates/cgrates/blob/master/utils/rsrfield_test.go#L313
Hope this helps.
DanB