Asterisk cmd Cut

Synopsis

Cut(newvar=varname,delimiter,fieldspec)

Deprecated

As of Asterisk 1.2 this command has been depracated. It has been removed as of Asterisk 1.4.
Use the function Cut instead.

Description

Cut(newvar=varname,delimiter,fieldspec)

  • newvar: this variable is set to the result string
  • varname: variable you want cut
  • delimiter: defaults to -
  • fieldspec: number of the field you want (1-based offset), may also be specified as a range (with -) or group of ranges and fields (with &)

Notes

  • The delimiter must be a single character. When multiple characters are specified, only the first character is used.
  • To specify a comma as a delimiter, escape it with a backslash: Cut(foo,\,,1)
  • When multiple fields are specified, they are joined back together using the delimiter specified.
  • This command is most useful when dealing with fields that are variable width. For fixed width string processing, use the builtin variable substitution.
  • The application Cut has been deprecated in 1.2 in favor of the builtin function CUT.

(:exclaim:) The varname parameter must be a variable name, not a string value. This is unusual syntax. So:

exten => s,1,Cut(foo=bar,,2) ; This is correct syntax
exten => s,1,Cut(foo=${bar},,2) ; This is invalid syntax

Example

exten => s,1,Set(foo=1-2-3-4-5)
exten => s,2,Cut(foo=foo,,1-3&5)

foo is now set to 1-2-3-5

See also


Synopsis

Cut(newvar=varname,delimiter,fieldspec)

Deprecated

As of Asterisk 1.2 this command has been depracated. It has been removed as of Asterisk 1.4.
Use the function Cut instead.

Description

Cut(newvar=varname,delimiter,fieldspec)

  • newvar: this variable is set to the result string
  • varname: variable you want cut
  • delimiter: defaults to -
  • fieldspec: number of the field you want (1-based offset), may also be specified as a range (with -) or group of ranges and fields (with &)

Notes

  • The delimiter must be a single character. When multiple characters are specified, only the first character is used.
  • To specify a comma as a delimiter, escape it with a backslash: Cut(foo,\,,1)
  • When multiple fields are specified, they are joined back together using the delimiter specified.
  • This command is most useful when dealing with fields that are variable width. For fixed width string processing, use the builtin variable substitution.
  • The application Cut has been deprecated in 1.2 in favor of the builtin function CUT.

(:exclaim:) The varname parameter must be a variable name, not a string value. This is unusual syntax. So:

exten => s,1,Cut(foo=bar,,2) ; This is correct syntax
exten => s,1,Cut(foo=${bar},,2) ; This is invalid syntax

Example

exten => s,1,Set(foo=1-2-3-4-5)
exten => s,2,Cut(foo=foo,,1-3&5)

foo is now set to 1-2-3-5

See also


Created by: oej, Last modification: Wed 27 of Oct, 2010 (03:17 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+