[sr-dev] Parsing list of headers

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 30 16:25:44 CEST 2019


Hello,

On 25.07.19 17:44, Ionut Razvan Ionita wrote:
>
> Hello all,
>
>
> I am trying to implement RFC 7544 in kamailio.cfg, more specifically
> to transform Diversion header into History-Info. To do this I need
> to iterate over all Diversion headers and be able to get all the
> parameters from it. At first I discovered $di core variable, but I can
> access only the first header with it. I discovered kamailio selectors
> but I can't index them with a variable. I came to the point where I
> want to implement variable indexing to selectors but after I saw this
> API is quite complex I thought to ask here if there's
> any other solution to do this?!
>
if you refer to $sel(...) and they do not support variables for index,
you can try:

  - double evaluation using pv_evalx() -
https://www.kamailio.org/docs/modules/devel/modules/pv.html#pv.f.pv_evalx

  - use an embedded script with inline execution -- eg app_jsdt doesn't
have external dependencies and you can run a small javascript script
where you can use local variables for index and construct the $sel() as
you need, then pass that to KSR.pv.get(...).


Cheers,
Daniel


-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190730/aed3be9e/attachment-0001.html>


More information about the sr-dev mailing list