Asterisk cmd SubString

Note: This command is completely obsolete and has been removed

Synopsis:
Save substring digits in a given variable

Description:
SubString(variable=string_of_digits|count1|count2)

Assigns the substring of string_of_digits to a given variable. Parameter count1 may be positive or negative. If it's positive then we skip the first count1 digits from the left. If it's negative, we move count1 digits counting from the end of the string to the left.
Parameter count2 may be only positive and implies how many digits we're taking from the point that count1 placed us.

Example:

exten => _NXXXXXX,1,SubString,test=2564286161|0|3
assigns the area code (3 first digits) to variable test.
exten => _NXXXXXX,1,SubString,test=2564286161|-7|7
assigns the last 7 digits to variable test.

Return codes

If there are no parameters it'll return with -1.
If there wrong parameters it go on and return with 0

Note that SubString is deprecated. It has been replaced by a buit-in syntax for obtaining substrings of variables. Please use ${variable:count1:count2} instead, with count1 and count2 as described above.

See also

  • Asterisk extension pattern matching
  • Asterisk cmd cut: Cuts the string at a given substring


Created by: oej, Last modification: Mon 31 of Jul, 2017 (18:29 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+