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
cookbooks:devel:transformations [2021/06/25 11:05]
miconda [{s.rbefore,x}]
cookbooks:devel:transformations [2022/04/08 18:08]
miconda [URI Alias Transformations]
Line 877: Line 877:
  
 </code> </code>
 +
 +===== Socket Address Transformations =====
 +
 +Transformations related to socket address values (**proto:host:port**).
 +
 +==== {sock.host} ====
 +
 +Return the host part.
 +
 +==== {sock.port} ====
 +
 +Return the port part.
 +
 +==== {sock.proto} ====
 +
 +Return the proto part.
 +
 +==== {sock.touri} ====
 +
 +Return the socket address converted to SIP URI: **sip:host:port;transport=proto**.
  
 ===== URI Alias Transformations ===== ===== URI Alias Transformations =====
Line 898: Line 918:
 </code> </code>
  
 +===== Value Transformations  =====
 +
 +Exported by **pv** module.
 +
 +==== {val.json} ====
 +
 +If value is $null, return empty string; if value is string, then it is escaped for use as json value (without surrounding quotes.
 +
 +<code c>
 +$var(x) = '"name" <sip:name@a.com>';
 +$(var(x){val.json}) => \"name\" <sip:name@a.com>
 +</code>
 +
 +==== {val.n0} ====
 +
 +Return integer 0 for values that are $null.
 +
 +<code c>
 +$sht(a=>x) = $null;
 +$(sht(a=>x){val.n0}) => 0
 +</code>
 +
 +==== {val.ne} ====
 +
 +Return empty string for values that are $null.
 +
 +<code c>
 +$sht(a=>x) = $null;
 +# $(sht(a=>x){val.ne});
 +</code>
 +
 +==== {val.jsonqe} ====
 +
 +If value is $null, return quoted empty string; if value is string, then it is escaped for use as json value already with surrounding quotes; if the value is int, then it is preserved as it is.
 +
 +<code c>
 +$var(x) = '"name" <sip:name@a.com>';
 +$(var(x){val.jsonqe}) => "\"name\" <sip:name@a.com>"
 +</code>
cookbooks/devel/transformations.txt ยท Last modified: 2022/04/08 18:08 by miconda