Pattern-matching syntax

From TD-er's Wiki
Jump to navigationJump to search
  • X — Refers to any digit between 0 and 9
  • N — Refers to any digit between 2 and 9
  • Z — Any digit that is not zero. (E.g. 1 to 9)
  • [Various] — Match only one character that matches any of the one in the square brackets. (E.g. [02-68*#] would match 0, any number between 2 and 6 inclusive, 8, * and #. Or, another way of saying this would be 'Match * or #, or a number that isn't 1,7 or 9') –Avoid using this notation in your Trunk Dial Rule as it does not seem to work. Use this only in your Outgoing Route Dial Pattern.
  • . — Wildcard. Match any number of anything. Must match *something*.
  • | — This lets you use a '0 to dial out' (or '9' in the US) by matching anything before the line, but not sending it to the trunk.


N.B. If you forget the underscore in Asterisk's configfiles at the front of your pattern, Asterisk will think it’s just a named extension and won’t do any pattern matching.