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?!
Thanks,
Ionut
Hello Ionut,
if you like to do it in the cfg - just some ideas:
- iterate in a loop over the number of headers $hdrc
- access with the loop variable the respective header $hdr[i]
- do your operation, save temporary results in another $avp
- finish the operation by appending your header from the $avp
These PVs are (as usual) documented in the cookbook.
Cheers,
Henning
Am 25.07.19 um 17:44 schrieb Ionut Razvan Ionita:
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?!
Thanks,
Ionut
_______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.orgmailto:sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Hello,
Thank you for your reply. One more question. How am I supposed to access parameters inside a header. If the header has this format
<URI>; reason=someReason;index=someIndex
Is there any othere way than using regex to access these parameters?
Thank you,
Ionut
________________________________ From: Henning Westerholt hw@skalatan.de Sent: Thursday, July 25, 2019 7:29 PM To: Kamailio (SER) - Development Mailing List; Ionut Razvan Ionita Subject: Re: [sr-dev] Parsing list of headers
Hello Ionut,
if you like to do it in the cfg - just some ideas:
- iterate in a loop over the number of headers $hdrc
- access with the loop variable the respective header $hdr[i]
- do your operation, save temporary results in another $avp
- finish the operation by appending your header from the $avp
These PVs are (as usual) documented in the cookbook.
Cheers,
Henning
Am 25.07.19 um 17:44 schrieb Ionut Razvan Ionita:
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?!
Thanks,
Ionut
_______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.orgmailto:sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Hi Ionut,
if you are referring to URI parameters, there is a transformation for that :-)
https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations#uriparams
Cheers,
Henning
Am 30.07.19 um 10:41 schrieb Ionut Razvan Ionita:
Hello,
Thank you for your reply. One more question. How am I supposed to access parameters inside a header. If the header has this format
<URI>; reason=someReason;index=someIndex
Is there any othere way than using regex to access these parameters?
Thank you,
Ionut
________________________________ From: Henning Westerholt hw@skalatan.demailto:hw@skalatan.de Sent: Thursday, July 25, 2019 7:29 PM To: Kamailio (SER) - Development Mailing List; Ionut Razvan Ionita Subject: Re: [sr-dev] Parsing list of headers
Hello Ionut,
if you like to do it in the cfg - just some ideas:
- iterate in a loop over the number of headers $hdrc
- access with the loop variable the respective header $hdr[i]
- do your operation, save temporary results in another $avp
- finish the operation by appending your header from the $avp
These PVs are (as usual) documented in the cookbook.
Cheers,
Henning
Am 25.07.19 um 17:44 schrieb Ionut Razvan Ionita:
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?!
Thanks,
Ionut
_______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.orgmailto:sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Hello,
actually in this case is better to use first tobody.params and then param transformations:
- https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations#tobodyparams
- https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations#parameters_lis...
The value is not a SIP URI only, but a SIP URI followed by header parameters.
Cheers, Daniel
On 30.07.19 10:50, Henning Westerholt wrote:
Hi Ionut,
if you are referring to URI parameters, there is a transformation for that :-)
https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations#uriparams
Cheers,
Henning
Am 30.07.19 um 10:41 schrieb Ionut Razvan Ionita:
Hello,
Thank you for your reply. One more question. How am I supposed to access parameters inside a header. If the header has this format
<URI>; reason=someReason;index=someIndex
Is there any othere way than using regex to access these parameters?
Thank you,
Ionut
*From:* Henning Westerholt hw@skalatan.de *Sent:* Thursday, July 25, 2019 7:29 PM *To:* Kamailio (SER) - Development Mailing List; Ionut Razvan Ionita *Subject:* Re: [sr-dev] Parsing list of headers
Hello Ionut,
if you like to do it in the cfg - just some ideas:
iterate in a loop over the number of headers $hdrc
access with the loop variable the respective header $hdr[i]
do your operation, save temporary results in another $avp
finish the operation by appending your header from the $avp
These PVs are (as usual) documented in the cookbook.
Cheers,
Henning
Am 25.07.19 um 17:44 schrieb Ionut Razvan Ionita:
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?!
Thanks,
Ionut
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
-- Henning Westerholt - https://skalatan.de/blog/ Kamailio services - https://skalatan.de/services
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
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
Hi all,
In the end I was successfull using param.value transformations for the parameters in the header and tobody.uri to get the URI. Thank you for your your help!
Ionut
________________________________ From: Daniel-Constantin Mierla miconda@gmail.com Sent: Tuesday, July 30, 2019 5:25 PM To: Kamailio (SER) - Development Mailing List; Ionut Razvan Ionita Subject: Re: [sr-dev] Parsing list of headers
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.comhttp://www.asipto.com www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda