User Tools

Site Tools


cookbooks:devel:transformations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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/08/19 14:30]
miconda [Parameters List Transformations]
Line 1: Line 1:
-====== Kamailio SIP Server v5.2.x (devel): Transformations ======+====== Kamailio SIP Server v5.3.x (devel): Transformations ======
  
 <code> <code>
Line 316: Line 316:
 <code c> <code c>
 $(var(x){s.corehash}) $(var(x){s.corehash})
 +</code>
 +
 +==== {s.unquote} ====
 +
 +Return the value without surrounding single (') or double quotes (").
 +
 +<code c>
 +$var(x) = "\"alice\"";
 +$var(alice) = $(var(x){s.unquote});
 +</code>
 +
 +==== {s.unbracket} ====
 +
 +Return the value without surrounding (), [], {} or <>.
 +
 +<code c>
 +$var(x) = "<sip:alice@test.sip>";
 +$var(uri) = $(var(x){s.unbracket});
 </code> </code>
 ===== URI Transformations ===== ===== URI Transformations =====
Line 398: Line 416:
 The name of the transformation starts with 'param.'. The PV value is considered to be a string like name1=value1;name2=value2;...". The transformations returns the value for a specific parameter, or the name of a parameter at a specific index. The name of the transformation starts with 'param.'. The PV value is considered to be a string like name1=value1;name2=value2;...". The transformations returns the value for a specific parameter, or the name of a parameter at a specific index.
  
-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 parameter 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 713:
  
 $(hu{url.querystring}) => "this=is&the=querystring" $(hu{url.querystring}) => "this=is&the=querystring"
 +</code>
 +
 +===== JSON Transformations =====
 +
 +<fc #0000ff>This transformation class is exported by **json** module.</fc>
 +
 +
 +==== {json.parse} ====
 +
 +You can use the transformation to extract values from the json structured pseudo-variables
 +
 +<code>
 +
 +$var(Custom-Data) = $(rb{json.parse,Custom-Data});
 +
 </code> </code>
  
cookbooks/devel/transformations.txt · Last modified: 2022/04/08 18:08 by miconda