Strip Digits in Asterisk 1.8.5


#1

I have just installed Asterisk 1.8.5 from source. I am trying to have a call come in and send it out another trunk. When the number goes out the second trunk, I need to strip the first 3 digits off. Here is what I have, but it is not working.

[code][from-pstn]
exten => _XXXXXXXXXX,1,Goto(main,s,1)

[main]
exten => s,1,Dial(DAHDI/25/${EXTEN:3})
exten => s,2,Playback(vm-goodbye)
exten => s,3,Hangup()[/code]


#2

should work…

try inserting Verbose(1, exten: ${EXTEN} - stripped: ${EXTEN:3})
and core set verbose 1 to see whats wrong


#3

Your dialplan is wrong as You use extension s, resulting in ${EXTEN}=s inste3ad of the number You wish to call.
Try the following dialplan and lokk if it’s working as expexted:

[code][from-pstn]
exten => _XXXXXXXXXX,1,Goto(main,${EXTEN},1)

[main]
exten => _X.,1,Dial(DAHDI/25/${EXTEN:3})
exten => _X.,2,Playback(vm-goodbye)
exten => _X.,3,Hangup()[/code]

But if You insist of using die s-Extension in main You would need to store die Extension to dial in another Variable and make the Dialcommand using this variable.


#4

Thanks. Removing s from the [main] and using _X. worked.