Remove prefix on destination number

How to put condition if dialed number is abcXXXXXXXXXXX to remove abc, leave only the number and redirect to voicemail.?I tried this but doesn’t work…

exten => _[a-z]XXXXXXXXXXXX,1,Voicemail({EXTEN}=${EXTEN:3}@VoiceMail)
exten => _[a-z]XXXXXXXXXXXX,2,Playback(Goodbye)
exten => _[a-z]XXXXXXXxXXXX,3,Hangup

This is explained here: wiki.asterisk.org/wiki/display/ … les+Basics

In fact it seems that you do everything in the right way. Just pay attention that ${EXTEN} is a pre-defined Asterisk variable.

You may change your diaplan to something like:

exten => _[a-z]XXXXXXXXXXXX,1,Voicemail(${EXTEN:3}@VoiceMail)
    same => n,Playback(Goodbye)
    same => n,Hangup

I have edited my question since i was wrote it wrong.

Now if I dial “abc1111111111” I get response that ‘abc1111111111’ is not found in context. I have ‘1111111111’ in context… thats why I need to remove ‘abc’.

The only ways of setting ${EXTEN} are GoTo and GoSub!

Can you provide me some example? How to call to number abc123456789 → remove abc → call to 123456789

It’s too obvious to require examples.

But {EXTEN} is the caller, right? I don’t care the number of the caller… I know how to cut/remove digits from the caller but don’t know from the number B ( called number )

Wrong.

Tried with something like this

exten => _X.,1,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})}) exten => _X.,n,Voicemail(${EXTEN}@VoiceMail) exten => _X.,n,Playback(Goodbye) exten => _X.,n,Hangup
also with this

exten => _[a-z]XXXXXXXXXXXX,1,Goto{${EXTEN:3},1) exten => _XXXXXXXXXXXX,1,Dial(SIP/${EXTEN},1) exten => _XXXXXXXXXXXX,n,Voicemail(${EXTEN}@VoiceMail)
Still when I try to make test call to ‘asd12345’ I got that this number is not found in the context… number 12345 is in the context.

X only matches digits.

Well second dialplan as I understand should match chars+digits and will cut first 3 from number:

exten => _[a-z]XXXXXXXXXXXX,1,Goto{${EXTEN:3},1)
but it doesn’t… Any idea why?

I’s solved thank’s.