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 [2019/08/19 14:30] miconda [Parameters List Transformations] |
cookbooks:devel:transformations [2021/06/25 10:03] miconda [{s.before,x}] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Kamailio SIP Server v5.3.x (devel): Transformations ====== | + | ====== |
+ | |||
+ | Version: | ||
< | < | ||
Line 153: | Line 155: | ||
Decode base64 encoded PV and return value | Decode base64 encoded PV and return value | ||
+ | ==== {s.encode.base64t} ==== | ||
+ | |||
+ | Return base64 encoding of PV value without trailing padding characters(' | ||
+ | |||
+ | |||
+ | ==== {s.decode.base64t} ==== | ||
+ | |||
+ | Decode base64 encoded PV, handling missing trailing padding characters, and return value. | ||
+ | |||
+ | ==== {s.encode.base64url} ==== | ||
+ | |||
+ | Return base64-url encoding of PV value | ||
+ | |||
+ | ==== {s.decode.base64url} ==== | ||
+ | |||
+ | Decode base64-url encoded PV and return value | ||
+ | |||
+ | ==== {s.encode.base64urlt} ==== | ||
+ | |||
+ | Return base64-url encoding of PV value without trailing padding characters(' | ||
+ | |||
+ | |||
+ | ==== {s.decode.base64urlt} ==== | ||
+ | |||
+ | Decode base64-url encoded PV, handling missing trailing padding characters, and return value. | ||
Line 308: | Line 335: | ||
</ | </ | ||
+ | ==== {s.rmws} ==== | ||
+ | |||
+ | Remove occurrences of whitespace characters (' ', '\t, ' | ||
+ | |||
+ | <code c> | ||
+ | $(var(x){s.rmws}) | ||
+ | </ | ||
==== {s.corehash, | ==== {s.corehash, | ||
Line 335: | Line 369: | ||
$var(uri) = $(var(x){s.unbracket}); | $var(uri) = $(var(x){s.unbracket}); | ||
</ | </ | ||
+ | |||
+ | ==== {s.count,c} ==== | ||
+ | |||
+ | Count how many times c appears in the pv value. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return 4 | ||
+ | </ | ||
+ | |||
+ | ==== {s.after,x} ==== | ||
+ | |||
+ | Return the part of the string after the character **x** searched from the start of the value. If the character **x** is not found, it returns empty string. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return " | ||
+ | </ | ||
+ | |||
+ | ==== {s.rafter, | ||
+ | |||
+ | Return the part of the string after the character **x** searched from the end of the value. If the character **x** is not found, it returns empty string. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return " | ||
+ | </ | ||
+ | ==== {s.before, | ||
+ | |||
+ | Return the part of the string before the character **x** searched from the start of the value. If the character **x** is not found, it returns the entire input string. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return " | ||
+ | </ | ||
+ | |||
+ | ==== {s.rbefore, | ||
+ | |||
+ | Return the part of the string before the character **x** searched from the end of the value. If the character **x** is not found, it returns the entire input string. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return " | ||
+ | </ | ||
+ | ==== {s.urlencode.param} ==== | ||
+ | |||
+ | Encode the value for URL param format. | ||
+ | |||
+ | ==== {s.urldecode.param} ==== | ||
+ | |||
+ | Decode the value from URL param format. | ||
+ | |||
===== URI Transformations ===== | ===== URI Transformations ===== | ||
Line 411: | Line 497: | ||
< | < | ||
" | " | ||
+ | </ | ||
+ | |||
+ | ==== {uri.duri} ==== | ||
+ | |||
+ | Return the destination URI for routing, keeping only schema, host, port and transport parameter. If port and transport are not in the original value, they are also not in the returned value. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | $var(ouri) = " | ||
+ | $var(duri) = $(var(ouri){uri.duri}); | ||
+ | </ | ||
+ | |||
+ | ==== {uri.saor} ==== | ||
+ | |||
+ | Return the SIP AoR, keeping only schema, user and host. If user is not in the original value, it is also not in the returned value. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | $var(ouri) = " | ||
+ | $var(suri) = $(var(ouri){uri.saor}); | ||
+ | </ | ||
+ | |||
+ | ==== {uri.suri} ==== | ||
+ | |||
+ | Return the simple URI for routing, keeping only schema, user, host, port and transport parameter. If user, port and transport are not in the original value, they are also not in the returned value. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | $var(ouri) = " | ||
+ | $var(suri) = $(var(ouri){uri.suri}); | ||
</ | </ | ||
===== Parameters List Transformations ===== | ===== Parameters List Transformations ===== | ||
Line 418: | Line 537: | ||
Available transformations in this class are presented in the next sections. | Available transformations in this class are presented in the next sections. | ||
- | **Important Note:** the delimiter cannot be comma (,), because this trasformation | + | **Important Note:** the delimiter cannot be comma (,), because this transformation |
Line 428: | Line 547: | ||
< | < | ||
" | " | ||
+ | </ | ||
+ | |||
+ | ' | ||
+ | |||
+ | ' | ||
+ | |||
+ | ==== {param.in, | ||
+ | |||
+ | Return 1 if the parameter ' | ||
+ | |||
+ | Example: | ||
+ | < | ||
+ | " | ||
</ | </ | ||
Line 546: | Line 678: | ||
==== {line.at, | ==== {line.at, | ||
- | Return the line at position ' | + | Return the line at position ' |
Example: | Example: | ||
Line 728: | Line 860: | ||
$var(Custom-Data) = $(rb{json.parse, | $var(Custom-Data) = $(rb{json.parse, | ||
+ | </ | ||
+ | |||
+ | ===== URI Alias Transformations ===== | ||
+ | |||
+ | Transformations related to URI alias values (**addr~port~protoid**). | ||
+ | |||
+ | ==== {urialias.encode} ==== | ||
+ | |||
+ | Encode SIP URI to alias value. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | ==== {urialias.decode} ==== | ||
+ | |||
+ | Decode from alias value to SIP URI. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
</ | </ | ||