[OpenSER-Users] get Count of items in lists

Dave Singer dave.singer at wideideas.com
Thu Dec 13 21:38:43 CET 2007


I'm a little confused. Are you saying there is a transformation {s.count}
that can be applied to avp's to get the number of items in an avp
list/stack?
I don't see any documentation for one at the link that you sent me. I had
already scoured it looking for something to help me, but checked again in
case something had changed.
It sound more like you are saying that there is no such functionality and
suggesting that I code/create a new transformation.
Unfortunately my "Programing" experience is quite rusty, the last time I
looked at C/C++ was in College almost 15 years ago. Not to mention already
not enough time in a day to get done what I'm supposed to do. Maybe some
time in the future I/we will be able to contribute code to openser and/or
modules, but not now. We are pushing hard to have a quality sell able
product/service.
Or company is planning to contribute back to openser in several ways. When
we get our servers setup and working, providing a stable, load-balanced,
scalable platform that our sales team can sell our services with confidence,
we are planning to post our openser.cfg files highly commented, along with
database structure changes(added tables, views, colums, indexes...), example
data, and a way to manage the data.

So for now (assuming you are saying there isn't something there now) I'll
have to use what is currently available and hope that someone else with more
experience and time finds these features valuable enough to implement them.
I like the idea of a transformation but maybe like this:
   $var(step_count) = $(avp(s:list){ary.count})
   while ( $var(step_count) != 0 ) {
      $var(working_var) = $(avp(s:list){ary.index,$var(step_count)});
      # do some stuff on this reverse process list.
      # also we are not deleting list items to get to other list items.
   }
 and later used like...
   $var(step_count) = $(di{ary.count}); # if $di was a list/array of all the
Diversion headers
   # same as in avp example above with other PV that could be lists/arrays

Also as the original email for this conversation stated, we need a
{s.count,seperator}
to compliment {s.select,index,seperator}

Thanks
Dave

On 12/13/07, Henning Westerholt <henning.westerholt at 1und1.de> wrote:
>
> Hello Dave,
>
> i think the best way to implement this would be as a transformation, see
> http://www.openser.org/dokuwiki/doku.php/transformations:devel
>
> You could implement a operation like $avp(..){s.count} that return the
> wanted
> number.
>
> Cheers,
>
> Henning
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20071213/3de25e5a/attachment.htm>


More information about the sr-users mailing list