Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd Cut

Author image

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.

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


Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.