[SR-Users] incomplete values and Wrong Counting for $hfl and $hflc

Patrick Karton patrickarton at hotmail.com
Thu Jul 21 17:31:49 CEST 2022

Hello Daniel,

Thanks for feedbacks.

im using $hfl($var(hname)) with $var(hname) being "Record-Route"? and it produces wrong results like explained.

and indeed with static name like  $hflc(Record-Route) and $hfl(Record-Route) the results are correct. i did not test first with static name because i tought the results were the same.

i already opened an issue on github https://github.com/kamailio/kamailio/issues/3194
incomplete values and Wrong Counting for $hfl and $hflc · Issue #3194 · kamailio/kamailio<https://github.com/kamailio/kamailio/issues/3194>
Description the counting and values provides by $hfl and $hflc are wrong and imcomplete Troubleshooting Reproduction Debugging Data route { $var(hname) = "Record-Route"; if (is_present_hf...

De : Daniel-Constantin Mierla <miconda at gmail.com>
Envoyé : jeudi 21 juillet 2022 15:43
À : Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>; Patrick Karton <patrickarton at hotmail.com>
Objet : Re: [SR-Users] incomplete values and Wrong Counting for $hfl and $hflc

Are you using it exactly like $hfl(Record-Route) or is it like $hfl($var(hname)) with $var(hname) being "Record-Route"?

The first variant is the one covered by $hfl()/$hflc(), parsing of the name being optimized at startup. On the second variant, the name is dynamic at runtime, based on the $var() value and simply compares the generic header names in the list, without any specific optimization for "Record-Route" case.

I noticed an issue opened on bug tracker and there was the second variant, while in this message seems to be the first variant. If the first variant fails, then it is a bug there. If it is the second that doesn't provide, it's because the feature is not there yet.


On 21.07.22 15:00, Patrick Karton wrote:
the counting and values provided by $hfl and $hflc are wrong and incomplete from my understanding. looking at the source code these pseudo vars count the body values of Via, Record-Route and Route headers.

in kamalio 5.6.1

Record-Route: <sip:;lr=on;nat=yes><sip:;lr=on;nat=yes>
Record-Route: <sip:;lr;transport=udp><sip:;lr;transport=udp>,<sip:;lr;transport=udp><sip:;lr;transport=udp>

i get $hflc(Record-Route) == 2 instead of 3

and $(hfl(Record-Route)[0]) ==
       $(hfl(Record-Route)[1]) ==

 $(hfl(Record-Route)[3]) does not exists.

Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Daniel-Constantin Mierla -- www.asipto.com<http://www.asipto.com>
www.twitter.com/miconda<http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda<http://www.linkedin.com/in/miconda>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220721/7b285325/attachment.htm>

More information about the sr-users mailing list