# Clipping \${EXTEN}

I’m sure this is simple and I should be able to figure it out but thus far I haven’t. Let’s say that \${EXTEN} is 95556666. I want \${EXTEN} to be 5556666 without the 9. I thought it was as easy as Set(\${EXTEN}=\${EXTEN:2:7}) but that does not seem to be working. So help the old guy out here and tell me what I’m doing wrong. Thank You.

This is Asterisk Basic.

[quote]The \${EXTEN} variable properly has the syntax \${EXTEN:x:y}, where x is the starting position and y is the number of digits to return. Given the following dial string:

94169671111

we can extract the following digit strings using the \${EXTEN:x:y} construct:

``````\${EXTEN:1:3} would contain 416

\${EXTEN:4:7} would contain 9671111

\${EXTEN:-4:4} would start four digits from the end and return four digits, giving us 1111

\${EXTEN:2:-4} would start two digits in and exclude the last four digits, giving us 16967

\${EXTEN:-6:-4} would start six digits from the end and exclude the last four digits, giving us 67

\${EXTEN:1} would give us everything after the first digit, or 4169671111 (if the number of digits to return is left blank, it will return the entire remaining string)[/quote]
``````

asteriskdocs.org/en/3rd_Edit … -book.html

\${EXTEN} is really a readlonly function, that reads a field in the channel data structure. You set extensions using Goto (or Gosub).

Thank you for your replies. Got it figured out and is working the way they want it.