Problem with Codec

My box which is “asterisk-11.9.0” , I have a gateway which supporting g729,g723,alaw,ulaw on other side I am using my softphone which has g729,alaw,ulaw.
In both side setting I disallow all and allow g729,g723,alaw,ulaw.
When I call from softphone I see :

But I think it should pass the codec between both ends!
When I send calls directly to gateway it is going well.
Thanks for any idea which how I can solve it

As long as Asterisk doesn’t have a g729-codec installed it can only pass through g729.
This pass through will IMHO only work when Asterisk won’t reside in the media path.
Additionally the codec priorities of both parties come to the same result.
The second problem could be solved if You set SIP_CODEC and maybe additionally SIP_CODEC_OUTBOUND to g729 prior to Your Dial command.

Thx for your nice reply.
Just could you make it clear for me:
By codec Priority you mean If one is like [color=#FF0000]g729,alaw,ulaw[/color] and the other is [color=#FF0000]ulaw,alaw,g729[/color] then in this case it is not possible to use pass-through?