Caller's codec getting changed in SIP to IAX call

Hi,
I am using Asterisk 1.8.5.0 (from source) in CentOS 5.6. I am using SIP to IAX2 (trunk) calls only. when G729 is received on SIP side, it goes out successfully via IAX2 trunk.

If G723.1 is received on SIP side, asterisk tries to send out calls to IAX using G729 anyway. Any help would be appreciated to overcome this issue.

a)When G723.1 is received on SIP side and G729 is allowed in IAX trunk:
Asterisk sends G729 to IAX2 side and the call connects resulting mute calls as the receiving end thinks packets to be G729 payload.

b) When G723.1 is received on SIP side with G729 disallowed and Only G723 allowed in IAX trunk:
Asterisk tries to force transcode to G729 and drops the call giving following error:
[Oct 31 14:18:30] WARNING[29055]: chan_iax2.c:12060 iax2_request: Unable to create translator path for g723 to g729 on IAX2/branch1_10-6586

Here’s the config in SIP side:
[siptrunk]
type=peer
host=x.x.x.x
host=y.y.y.y
insecure=very
context=redstation
canreinvite=no
qualify=no

And the config in IAX2 side:

[branch1_2]
type=peer
context=redstation
username=branch1_2
secret=murg5555
host=dynamic
trunk=yes
notransfer=yes
disallow=all
allow=g723.1
qualify=yes
codecpriority=caller

And extensions.conf:
exten=>_0102.,1,dial(IAX2/branch1_2/${EXTEN},30)

allow=g723.1 is valid, in addition to allow=g723

Its been a while since your last reply, but I lived with G729 for last few months, now this G723.1 codec changing problem has really become a serious issue.

Yes I know g723.1 is valid, but the problem is, when g732.1 is allowed in an outgoing IAX2 trunk, it always tries to change the codec to G729 making the use of G729 and G723 together in an IAX2 trunk impossible.

I’m am not familiar with IAX and its codec handling, but “insecure=very” does nothing, except produce an error message, on that version of Asterisk, and canreinvite is deprecated, in favour of directmedia, although still recognized.

The correct way of doing insecure=very is insecure=port,invite, but most people should be using insecure=invite, instead. As your configuration still seems to be working, I rather suspect that either you don’t need insecure at all, or you have allowguest set to yes and the call is not going through your siptrunk settings at all.

Thanks David, call is going through actually, I have tried to discuss it elaborately in the initial post.
Codec is getting changed unnecessarily.

can anybody please help by telling me of a particular version where SIP to IAX calls don’t try to change codec?