If you want to setup a 1 to 1 mapping from a analog line to a extension using FXO cards in a Cisco 2821 using Call Manager Express CME, you will need to use dial peers and translation profiles. The client had about 10 analog lines coming into their 2821 router. Each line has its own phone number and they wanted to make sure the caller id was showing the persons extension. They were originally using a pool of lines and they would get whatever line was free when they made a outgoing call. The problem is the caller id would show up as the number they were dialing out of from the pool and not their phone number. The solution was to setup 1 to 1 mapping for outgoing calls to their specific line.
I tried using this documentation from Cisco:
http://www.cisco.com/en/US/tech/tk652/tk90/technologies_configuration_example09186a00801bc341.shtml
But it didn't work because Call Manager Express was automatically creating dial-peers for a specific answer address and you can't change them.
I ended up assigning a translation profile and rule on the phone. So when you dial 9555124 it dials 195551234 and the dial peer sees the 19 in front of a number and drops the 19 and dials out the specific line the dial peer is assigned to. You can see an example of my commands below. Just make sure your dial peers don't end up dialing internal numbers.
This takes incoming calls from this port and routes them to the specific internal extension.
voice-port 0/0/0
connection plar opx 1234
description John Doe
caller-id enable
!
You will need to assign a translation profile to the phone.
ephone-dn 12 dual-line
number 1234
label 1234
description John Doe
name John Doe
call-forward busy 602
call-forward noan 602 timeout 10
translation-profile incoming Phone1
hold-alert 30 originator
!
This assigns the translation profile from the phone to a outgoing translation rule.
voice translation-profile Phone1
translate called 1
!
You will need to create a translation rule. This one takes an number that is dialed with a 9 in the beginning and replaces it with a 19.
voice translation-rule 1
rule 1 /^9/ /19/
!
This will take the 19T dial pattern and dial out on this specific port.
dial-peer voice 19 pots
description 1234
destination-pattern 19T
port 0/0/0
!
I would like to add that using 1 to 1 mappings for users do have its disadvantages. You only get one analog line per use so they can't conference in multiple people unless their service provider supports it. Also you have to have a analog line for every person and a phone number for any extension that wants to make outgoing calls. You can setup a pool of outgoing analog lines and share that with people who don't need a caller ID to show up as their specific line. You can have your phone company make the caller id look the same for the pool of numbers. The real solution is to get a PRI or partial PRI. This way you can set your caller ID to the extension and it will show up when you dial out. Doesn't matter what port the call is using since you are providing the caller id on the outgoing call.