Digit manipulation techniques covered under Cisco IOS are so much granular and hence comes with sort of confusion too. Specifically with POTS dial peer, many additional techniques are available viz digit-strip, prefix, forward-digits etc along with number expansion and my favorite translation rules and profiles. I have had many discussions on CSC about the exact sequence of all these techniques being applied during call flow. Let's have a look at one of the call flow and apply each of the technique available in Cisco IOS.
Taking following POTS dial peer as an example;
dial-peer voice 1 pots
destination-patter 7......$
port 0/2/0:15
1. Dial 7222222
Because of default behavior of automatic digit stripping of explicitly matched string on POTS dial peer, IOS will strip leading 7.
Actual dialed number: 222222
2. Apply no digit-strip
dial-peer voice 1 pots
destination-patter ^7......$
no digit-strip
port 0/2/0:15
Actual dialed number: 7222222
3. Apply number expansion
num-exp 1234 7222222
Now dial 1234, it will first translate to 7222222. This will match the destination-pattern under dial-peer voice 1 and following will be the actual dialed number.
Actual dialed number: 7222222
4. Now we apply the translation profile to change the dialed number viz 7222222 to 8222222
voice-translation rule 1
rule 1 /^7\(.*\)$/ /8\1/
voice-translation profile POTS
translate called 1
Apply this to dial peer voice 1;
dial-peer voice 1 pots
translation-profile outgoing POTS
destination-patter ^7......$
no digit-strip <<Once number is given to translation profile, this command has no relevance>>
port 0/2/0:15
Now if you dial 1234, number expansion will translate it to 7222222. It will match dial-peer voice 1 and translation profile being applied under dial-peer will change the actual dialed number as;
Actual dialed number: 8222222
5. Strip leading 8 using forward-digits command
dial-peer voice 1 pots
translation-profile outgoing POTS
destination-patter ^7......$
forward-digits 6
port 0/2/0:15
Now if you dial 1234, will change the actual dialed number as;
Actual dialed number: 222222
6. Add again 8 as prefix using prefix command
dial-peer voice 1 pots
translation-profile outgoing POTS
destination-patter ^7......$
forward-digits 6
prefix 8
port 0/2/0:15
Now if you dial 1234, will change the actual dialed number as;
Actual dialed number: 8222222
--
Best Regards
Vivek Batra