Sorry to bother on this, but is it possible to access Kamailio transformations in KEMI, and if so, how?
In Kamailio's native scripting language I could do:
$var(pai_user) = $(hdr(P-Asserted-Identity){tobody.user});
In KEMI, I can easily get the full header like this:
KSR.hdr.get("P-Asserted-Identity")
But I don't see how to access the transformations. Am I missing it?
Ben Kaufman
In a fully-fledged general programming runtime, do you need transformations? ;-)
l header like this:
KSR.hdr.get("P-Asserted-Identity")
But I don’t see how to access the transformations. Am I missing it?
In a fully-fledged general programming runtime, do you need transformations? ;-)
https://docs.python.org/3/library/urllib.parse.html
— Alex
By way of further answer:
Kamailio’s transformations exist in order to provide some semblance of string utility & parsing functions to a custom, from-ground-up programming language that wouldn’t otherwise possess them, for lack of a standard library that general-purpose programming languages have.
It has no built-in string primitives with accessor and mutator functions of various kinds[1], no String object with manipulation methods, no len(), no split(), etc.
The transformations are Kamailio config script’s effort to provide a subset of this sort of capability that is most useful for processing SIP messages.
Things like {tobody.user} exist in Kamailio because there’s literally* no other way to do that.
The whole point of doing Kamailio config scripting through KEMI in a more general language is to be able to leverage those general language capabilities, along with other libraries or modules, hot reload, etc.
— Alex
[1] Outside of the blunt instruments of textops* and friends.
I get that, and in the general scope of things it's hard to argue against leveraging what should be a more feature rich language. With that said, the desire to leverage transformations is:
1. To be able to quickly convert existing Kamailio scripts to KEMI. Long term it's certainly best to evaluate line-by-line what to change, but the more that an existing config can simply 'drop in' to Kamailio, the easier this move could be facilitated. 2. Some of this comes to re-inventing the wheel. A cursory look for python modules doesn't yield any results that I find as lightweight (twisted seems heavy for this purpose), simple, and battle tested as Kamailio's transformations for this specific purpose of parsing a tobody/nameaddr SIP header.
-----Original Message----- From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Alex Balashov Sent: Wednesday, July 28, 2021 10:05 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Accessing Transformations in KEMI
By way of further answer:
Kamailio’s transformations exist in order to provide some semblance of string utility & parsing functions to a custom, from-ground-up programming language that wouldn’t otherwise possess them, for lack of a standard library that general-purpose programming languages have.
It has no built-in string primitives with accessor and mutator functions of various kinds[1], no String object with manipulation methods, no len(), no split(), etc.
The transformations are Kamailio config script’s effort to provide a subset of this sort of capability that is most useful for processing SIP messages.
Things like {tobody.user} exist in Kamailio because there’s literally* no other way to do that.
The whole point of doing Kamailio config scripting through KEMI in a more general language is to be able to leverage those general language capabilities, along with other libraries or modules, hot reload, etc.
— Alex
[1] Outside of the blunt instruments of textops* and friends.
Hello,
transformations are bound to variables, you have to use KSR.pv.get("$(hdr(P-Asserted-Identity){tobody.user})") or the other variants to get the value of variables from KSR.pv group of functions:
* http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/core/#ksrpv...
Cheers, Daniel
On 28.07.21 16:47, Ben Kaufman wrote:
Sorry to bother on this, but is it possible to access Kamailio transformations in KEMI, and if so, how?
In Kamailio’s native scripting language I could do:
$var(pai_user) = $(hdr(P-Asserted-Identity){tobody.user});
In KEMI, I can easily get the full header like this:
KSR.hdr.get("P-Asserted-Identity")
But I don’t see how to access the transformations. Am I missing it?
*Ben Kaufman*
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thank you. What's the process for submitting changes to the KEMI documentation system? If the search box had returned results for "transformation" it would have been helpful. I think I also saw a small type-o somewhere in their recently.
Ben Kaufman
From: Daniel-Constantin Mierla miconda@gmail.com Sent: Wednesday, July 28, 2021 10:16 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.com Subject: Re: [SR-Users] Accessing Transformations in KEMI
Hello,
transformations are bound to variables, you have to use KSR.pv.get("$(hdr(P-Asserted-Identity){tobody.user})") or the other variants to get the value of variables from KSR.pv group of functions:
* http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/core/#ksrpv...
Cheers, Daniel On 28.07.21 16:47, Ben Kaufman wrote: Sorry to bother on this, but is it possible to access Kamailio transformations in KEMI, and if so, how?
In Kamailio's native scripting language I could do:
$var(pai_user) = $(hdr(P-Asserted-Identity){tobody.user});
In KEMI, I can easily get the full header like this:
KSR.hdr.get("P-Asserted-Identity")
But I don't see how to access the transformations. Am I missing it?
Ben Kaufman
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users@lists.kamailio.orgmailto:sr-users@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.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
The repo for the docs is at:
* https://github.com/kamailio/kamailio-docs
The kemi docs are generated from the folder kamailio-kemi-framework. The index of exported functions by Kamailio modules is auto-generated. To add documentation for a specific function, you have to create (or update if exiting) a dedicated file, like:
* https://github.com/kamailio/kamailio-docs/blob/master/kamailio-kemi-framewor...
To contribute, just make pull requests.
The mkdocs framework is used for generating the html version.
Cheers, Daniel
On 28.07.21 17:41, Ben Kaufman wrote:
Thank you. What’s the process for submitting changes to the KEMI documentation system? If the search box had returned results for “transformation” it would have been helpful. I think I also saw a small type-o somewhere in their recently.
*Ben Kaufman*
*From:* Daniel-Constantin Mierla miconda@gmail.com *Sent:* Wednesday, July 28, 2021 10:16 AM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org; Ben Kaufman bkaufman@nexvortex.com *Subject:* Re: [SR-Users] Accessing Transformations in KEMI
Hello,
transformations are bound to variables, you have to use KSR.pv.get("$(hdr(P-Asserted-Identity){tobody.user})") or the other variants to get the value of variables from KSR.pv group of functions:
* http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/core/#ksrpv... http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/core/#ksrpvget
Cheers, Daniel
On 28.07.21 16:47, Ben Kaufman wrote:
Sorry to bother on this, but is it possible to access Kamailio transformations in KEMI, and if so, how? In Kamailio’s native scripting language I could do: $var(pai_user) = $(hdr(P-Asserted-Identity){tobody.user}); In KEMI, I can easily get the full header like this: KSR.hdr.get("P-Asserted-Identity") But I don’t see how to access the transformations. Am I missing it? *Ben Kaufman* __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org <mailto:sr-users@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 <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