Hi,
It there an easy way to count the number of existing headers of certain type?
For example:
- How many 'via' headers: $hdrcount(Via) ? - How many 'diversion' headers: $hdrcount(Diversion) ?
The $hdrcount is an example, just wondering if there is an easy way to get the number.
Thanks.
Best regards, Joel.
On 06/24/2016 07:51 PM, Joel Serrano | VOZELIA wrote:
- How many 'via' headers: $hdrcount(Via) ?
- How many 'diversion' headers: $hdrcount(Diversion) ?
Unfortunately, it's probably going to come down to:
$var(i) = 0;
while(defined $(hdr(Via)[$var(i)])) $var(i) = $var(i) + 1;
-- Alex
Hi Alex,
I thought it could end up being something like that.
I just tried that and it worked perfectly.
Thanks for your help :)
Best regards, Joel.
----- Original Message -----
From: "Alex Balashov" abalashov@evaristesys.com To: sr-users@lists.sip-router.org Sent: Friday, June 24, 2016 5:53:31 PM Subject: Re: [SR-Users] Count number of headers of type
On 06/24/2016 07:51 PM, Joel Serrano | VOZELIA wrote:
- How many 'via' headers: $hdrcount(Via) ?
- How many 'diversion' headers: $hdrcount(Diversion) ?
Unfortunately, it's probably going to come down to:
$var(i) = 0;
while(defined $(hdr(Via)[$var(i)])) $var(i) = $var(i) + 1;
-- Alex
-- Alex Balashov | Principal | Evariste Systems LLC 1447 Peachtree Street NE, Suite 700 Atlanta, GA 30309 United States
Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users