Wednesday 30 July 2014

opensips String transformations | Generating MD5 hash from opensips.cfg | String to Integer convertion in core script

By vm  |  05:56 No comments

String Transformations

The name of these transformation starts with 's.'. They are intended to apply string operations to variables.
Available transformations in this class:

1.1 {s.len}

Return strlen of variable value
$var(x) = "abc";
if($(var(x){s.len}) == 3)
{
   ...
}

1.2 {s.int}

Return integer value of a string-represented number
$var(x) = "1234";
if($(var(x){s.int})==1234) {
  ...
}

1.3 {s.md5}

Return md5 over variable value
xlog("MD4 over From username: $(fU{s.md5})");

1.4 {s.substr,offset,length}

Return substring starting at offset having size of 'length'. If offset is negative, then it is counted from the end of the value, -1 being the last char. In case of positive value, 0 is first char. Length must be positive, in case of 0, substring to the end of variable value is returned. offset and length can be a varibale as well.
Example:
$var(x) = "abcd";
$(var(x){s.substr,1,0}) = "bcd"

1.5 {s.select,index,separator}

Return a field from the value of a variable. The field is selected based on separator and index. The separator must be a character used to identify the fields. Index must be a integer value or a variable. If index is negative, the count of fields starts from end of value, -1 being last field. If index is positive, 0 is the first field.
Example:
$var(x) = "12,34,56";
$(var(x){s.select,1,,}) => "34" ;

$var(x) = "12,34,56";
$(var(x){s.select,-2,,}) => "34"

Author: vm

Hello, I am Author, decode to know more: In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In commodo magna nisl, ac porta turpis blandit quis. Lorem ipsum dolor sit amet.

0 comments:

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles

© 2014 VOIP4Learn. WP themonic converted by Bloggertheme9. Powered by Blogger.
TOP