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 [2020/07/17 08:13] miconda |
cookbooks:devel:transformations [2021/06/25 10:01] miconda [{s.after,x}] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Transformations ====== | ====== Transformations ====== | ||
- | Version: Kamailio SIP Server v5.5.x (devel) | + | Version: Kamailio SIP Server v5.6.x (devel) |
< | < | ||
Line 375: | Line 375: | ||
<code c> | <code c> | ||
- | abababa" | + | "abababa" |
# will return 4 | # 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**. If the character **x** is not found, it returns the entire input string. | ||
+ | |||
+ | <code c> | ||
+ | " | ||
+ | # will return " | ||
+ | </ | ||
==== {s.urlencode.param} ==== | ==== {s.urlencode.param} ==== | ||
Line 464: | Line 488: | ||
< | < | ||
" | " | ||
+ | </ | ||
+ | |||
+ | ==== {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 481: | Line 538: | ||
< | < | ||
" | " | ||
+ | </ | ||
+ | |||
+ | ' | ||
+ | |||
+ | ' | ||
+ | |||
+ | ==== {param.in, | ||
+ | |||
+ | Return 1 if the parameter ' | ||
+ | |||
+ | Example: | ||
+ | < | ||
+ | " | ||
</ | </ | ||
Line 599: | Line 669: | ||
==== {line.at, | ==== {line.at, | ||
- | Return the line at position ' | + | Return the line at position ' |
Example: | Example: | ||
Line 781: | Line 851: | ||
$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> | ||
+ | " | ||
</ | </ | ||