How to specify the codec used by iax trunk

I have two asterisk systems each installed with a 4 port E1 card that connected to PBX. I make call from one PBX to another using IAX trunk and show IAX2 channels. I find the fomat is alaw.How can i specify other lower bandwith codec such as g729 or g723 be used? And how to specify the codec priority to be used?

read the documentation, particularly for iax.conf

using the “disallow=” and “allow=” directives you can set the codecs that can be used by the connection. always start with “disallow=all” and then your first choice codec.

Yes, this my setting in iax.conf

;allow=all ; same as bandwidth=high
;disallow=g723.1 ; Hm… Proprietary, don’t use it…
;disallow=lpc10 ; Icky sound quality… Mr. Roboto.
allow=g729 ; Always allow GSM, it’s cool :smile:

but i always find the call used in gsm format. as flow:

IVRSZ*CLI> iax2 show channels
Channel Peer Username ID (Lo/Rem) Seq (Tx/Rx) Lag Jitter JitBuf Format
IAX2/REC_SERVER@192. REC_SERVER 00002/00001 00005/00004 00000ms 0002ms 0000ms gsm
1 active IAX channel(s)


I have comment all other codec only left allow=g729 and can force iax trunk use g729 now. I want to know how much of bandwith would be used for a iax trunk call. I calculate by tool on … ulator.php. The result is 22.84 Kbps. Really? We know that the g729 audio codec is only 8kbps plus some IP package head. That would not reach 22.84kbps. I think it is too much. Do you think? How much is the true.

run iptraf and check

where to run iptraf

iptraf is run from the command line on your Asterisk box. Go to the LAN Station Monitor section, and look at the InRate and OutRate for the MAC address of the remote Asterisk system. Note that I can’t see a way in iptraf to see the rate to/from an IP address, just a MAC address.

Alternatively, iftop will give you a rough idea of the bandwidth in use between various hosts. Pressing ‘L’ for a logarithmic display may help you.

Note that SSHing into your Asterisk box consumes network traffic.