Hi,
avpops module in the CVS head has several new features:
*** A new function is now available to perform integer operations with avps:
avp_op("source/destination", "operator/value/flags")
the result of this function is the evaluation of the expression: 'destination' = 'source' 'operator' 'value'. If the 'destination' is not specified, then a new avp having the name and type of 'source' will be created.
The flags are: - d - delete the source after the operation - g - apply the operation to all 'source' avp
the 'value' must be an integer in the form of "i:integer_number" or an avp alias.
'source' and 'destination' can be specified as avp name or avp alias.
The operations that can be performed: - add - addition - sub - substitution - mul - multiplication - div - division - mod - module - and - bitwise and - or - bitwise or - xor - bitwise xor - not - bitwise not
*** avp_copy() can now perform cast operations. Two new flags were added - n - convert the value of source avp into integer number and store it in destination - s - convert the value of source avp into string and store it in destination
*** avp_check() has now more check operators - ne - not equal - le - least or equal - ge - greater or equal - and - bitwise and - or -bitwise or - xor - bitwise xor
See the readme for a few more information, the avpops tutorial will be updated for openser soon. Some internals were changed to allow these new features, so testing and feedback will be highly appreciated.
Regards, Ramona
On 7/13/05, Elena Ramona Modroiu ramona@voice-system.ro wrote:
*** A new function is now available to perform integer operations with avps:
avp_op("source/destination", "operator/value/flags")
the result of this function is the evaluation of the expression: 'destination' = 'source' 'operator' 'value'. If the 'destination' is not specified, then a new avp having the name and type of 'source' will be created.
I'm just wondering, why SER developers chose that way of implementing it's own language for configuration/scripting. Now we have _functions_ for such simple operations as addition etc.
Why not just embedding some widely used language like python (perl or other) into SER?
I think that would save much of en effort.
On 07/14/05 08:20, Timur Irmatov wrote:
On 7/13/05, Elena Ramona Modroiu ramona@voice-system.ro wrote:
*** A new function is now available to perform integer operations with avps:
avp_op("source/destination", "operator/value/flags")
the result of this function is the evaluation of the expression: 'destination' = 'source' 'operator' 'value'. If the 'destination' is not specified, then a new avp having the name and type of 'source' will be created.
I'm just wondering, why SER developers chose that way of implementing it's own language for configuration/scripting. Now we have _functions_ for such simple operations as addition etc.
Why not just embedding some widely used language like python (perl or other) into SER?
This language developed in time, at the beginning just few statements and methods were available, and they seemed to be enough for a SIP router. This language and its interpreter allow a lot of operations that help to speed up the processing and control what can be done in the configuration file -- ser was designed to be very fast, and a customized language was the most suitable.
Could be an alternative to embed some language in the configuration, but will require a lot of development and maybe internal structure changes. Also, the config will be a wild garden, maybe more flexible, but more exposed to troubles.
Daniel
I think that would save much of en effort.