Problem negotiation codec in pass-thru with codecs g729,g711

Hello,

I’m having problems with Asterisk 1.8.3.2, negotiating codecs pass-thru mode (devices natively support g729).

I have this scenario:

  • ATA configuration with sip and a list of codecs in order of preference:

g729 (in vad)
G711u
G711A

  • Cisco PSTN Gateway Trunk

g729 (in vad)
G711u
G711A

Setup asterisk, sip.conf, I have:

[7000778]
amaflags = billing
callerid = 7000778
canreinvite = yes
context = a2billing
dtmfmode = RFC2833
host = dynamic
nat = no
qualify = yes
type = friend
username = 7000778
allow = g729, ulaw, alaw
regseconds = 0
cancallforward = yes
cid_number = 7000778

(ATA FXS 7000778 > ASTERISK PASS-THRU > CISCO GATEWAY E1 TRUNK > PSTN)

If I make a call from the ATA to a Cisco PSTN number, the call works, and is negotiated the g729 codec. But if the call is rejected, and Asterisk returns to the playback, call drops, and the asterisk says unable to make the negotiation of codecs.

[Apr 7 08:51:40] WARNING [15570]: channel.c: 4975 set_format: Unable to find a codec translation path from 0x100 (g729) to 0x40 (slin)
[Apr 7 08:51:40] WARNING [15570]: indications.c: 153 playtones_alloc: Unable to set ‘SIP/7000778-0000001c’ to signed linear format (write)
[Apr 7 08:51:40] WARNING [15570]: channel.c: 4390 ast_indicate_data: Unable to handle 5 Indication for ‘SIP/7000778-0000001c’
[Apr 7 08:51:41] DEBUG [15334]: rtp_engine.c: 292 instance_destructor: Destroyed RTP instance x159f63d8 '0 '
[Apr 7 08:51:41] WARNING [15570]: channel.c: 4975 set_format: Unable to find a codec translation path from 0x100 (g729) to 0x2 (gsm)

But if I change the setting to sip.conf, giving priority to the G711 as indicated below, playback works correctly:

[7000778]
amaflags = billing
callerid = 7000778
canreinvite = yes
context = a2billing
dtmfmode = RFC2833
host = dynamic
nat = no
qualify = yes
type = friend
username = 7000778
allow = ulaw, alaw, g729
regseconds = 0
cancallforward = yes
cid_number = 7000778

I need to use g729 with the devices in Asterisk pass-thru, but need the Asterisk allows the use of G711 codec when using the g729 is not possible. I do not want Asterisk to make transcodinng g729 codec. I’ve used this scenario with the GnuGk H.323 and it works perfectly, as do this in Asterisk?

Regards!

Once the call leg has been negotiated by Asterisk to use G.729, then Asterisk won’t reinvite the first leg to a different codec just because the second call leg fails for some reason.

The best thing you can do is download the prompts in G.729 format and have those played back.

Cheers.

Ok, but if the negotiation is with a peer or trunk that supports only G711u, this same problem also occurs. Asterisk allows negotiation of codecs directly between the peers?(the asterisk documentation, say yes).

In this case the option canreinvite must be yes or no?

Regards