This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:devel:transformations [2018/07/12 08:32] gaaf [{re.subst,expression}] |
cookbooks:devel:transformations [2019/09/04 20:56] henningw [{s.unbracket}] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Kamailio SIP Server v5.2.x (devel): Transformations ====== | + | ====== Kamailio SIP Server v5.3.x (devel): Transformations ====== |
< | < | ||
Line 317: | Line 317: | ||
$(var(x){s.corehash}) | $(var(x){s.corehash}) | ||
</ | </ | ||
+ | |||
+ | ==== {s.unquote} ==== | ||
+ | |||
+ | Return the value without surrounding single (') or double quotes ("). | ||
+ | |||
+ | <code c> | ||
+ | $var(x) = " | ||
+ | $var(alice) = $(var(x){s.unquote}); | ||
+ | </ | ||
+ | |||
+ | ==== {s.unbracket} ==== | ||
+ | |||
+ | Return the value without surrounding (), [], {} or <>. | ||
+ | |||
+ | <code c> | ||
+ | $var(x) = "< | ||
+ | $var(uri) = $(var(x){s.unbracket}); | ||
+ | </ | ||
+ | |||
+ | ==== {s.count,c} ==== | ||
+ | |||
+ | Count how many times c appears in the pv value. | ||
+ | |||
+ | <code c> | ||
+ | abababa" | ||
+ | # will return 4 | ||
+ | </ | ||
+ | |||
+ | |||
===== URI Transformations ===== | ===== URI Transformations ===== | ||
Line 398: | Line 427: | ||
The name of the transformation starts with ' | The name of the transformation starts with ' | ||
- | Available transformations in this class: | + | Available transformations in this class are presented in the next sections. |
+ | |||
+ | **Important Note:** the delimiter cannot be comma (,), because this trasformation is using SIP header/URI parameters parser and the comma is a delimiter between serialized SIP header/URI bodies. The workaround is to use the subst transformation to replace the comma with another character that is used then as separator. | ||
Line 693: | Line 724: | ||
$(hu{url.querystring}) => " | $(hu{url.querystring}) => " | ||
+ | </ | ||
+ | |||
+ | ===== JSON Transformations ===== | ||
+ | |||
+ | <fc # | ||
+ | |||
+ | |||
+ | ==== {json.parse} ==== | ||
+ | |||
+ | You can use the transformation to extract values from the json structured pseudo-variables | ||
+ | |||
+ | < | ||
+ | |||
+ | $var(Custom-Data) = $(rb{json.parse, | ||
+ | |||
</ | </ | ||