How force asterisk allow phones with different codec

I Install trixbox 2.4, and I try connect between two Linksys pap2 adapter.

pap2 codec:
G729a,G711u,G711a,G726/16/24/32/40,G723

Asterisk support out of the Box:
GSM,G729a,G711u,G711a,G726,LPC10,ADPCM,ILBC

I success connecting only with G729a (and G711u but is take 80k)
Now the problem that pap2 not have ability to use with G729a on his two lines in same time. so I want to config the pap2 that place on the office with G711u codec and pap2 that connect to office with adsl to G729a.

I try to connect two pap2 the first one with G711u and second with G729a but is not connected!
How force Asterisc to allow connect between two codecs?

here my sip.

[general]
bindport = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
allow=all

context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
tos=0x68

notifyringing=yes
notifyhold=yes
limitonpeers=yes

[200]
type=friend
secret=222
record_out=Adhoc
record_in=Adhoc
qualify=yes
port=5060
pickupgroup=
nat=yes
mailbox=200@device
host=dynamic
dtmfmode=rfc2833
disallow=
dial=SIP/200
context=from-internal
canreinvite=no
callgroup=
callerid=device <200>
allow=
accountcode=
call-limit=50

[201]
type=friend
secret=222
record_out=Adhoc
record_in=Adhoc
qualify=yes
port=5060
pickupgroup=
nat=no
mailbox=201@default
host=dynamic
dtmfmode=rfc2833
disallow=
dial=SIP/201
context=from-internal
canreinvite=no
callgroup=
callerid=device <201>
allow=
accountcode=
call-limit=50

You should specify the codecs that each sip device can use in the sip.conf file.

This is best done by the disallow and allow conditions.

Begin by disallowing all codecs:

disallow=all

Then specify the codecs you wish to use in the order you prefer them to be tried for the device.

Example:

allow=ulaw
allow=gsm

This will prefer the ulaw codec, but will use the gsm codec if the device calling cannot use ulaw.

This may not correct your problem. Since the device can use G729a, Asterisk will try to use the codec. But you maybe able to restrict one device so that it does not try to use the G729a codec.