Iax.conf

From AllStarLink Wiki
Revision as of 01:14, 20 January 2021 by KK9ROB (talk | contribs) (→‎[general])
Jump to navigation Jump to search

The iax.conf configuration file controls defines how to register a node with the Allstar link node assignment authority, and assigns a context incoming connections receive so that statements in extensions.conf can direct the connection to the correct local node. iax.conf contains two sections relevant to app_rpt. The [general] section, and the [radio] section.

[general]

The [general] section sets up the global configuration for iax.conf, and also is used to hold the register statements for each node defined on the system. A register statement looks like this:

register=2000:1234567@register.allstarlink.org

A separate register statement is required for every node number hosted on the computer. In other words, if you have 2 nodes hosted on the computer, then 2 register statements will be required.

The format for the register statement is:

register=node:password@register.allstarlink.org
  • node is your assigned Allstar link node number
  • password is your Allstar link password for the above node number

In addition to register statements, the permitted codecs for outgoing connections are also defined in the [general] stanza of iax,conf. The way codec definitions work is we first disallow all of them with a disallow=all statement, then we define the codecs we wish to permit with allow statements. The suggested outgoing codecs are defined in this example:

disallow=all 
allow=gsm 
allow=g726aal2 
allow=ulaw 

The statements above only allow GSM, ADPCM, and ULAW codecs to be used for outgoing connections. This is the suggested contents of the [general] stanza to be included in iax.conf

[general] 
bindaddr=0.0.0.0 
disallow=all 
allow=gsm 
allow=g726aal2 
allow=ulaw 
jitterbuffer=yes 
forcejitterbuffer=yes 
dropcount=2 
maxjitterbuffer=4000 
maxjitterinterps=10 
resyncthreshold=1000 
maxexcessbuffer=80 
minexcessbuffer=10 
jittershrinkrate=1 
tos=0x1E 
autokill=yes 
delayreject=yes 
iaxthreadcount=30 
iaxmaxthreadcount=150

[radio]

The [radio] stanza controls the types of codecs which can be used, how they are selected (or negotiated) and the context to call in extensions.conf when an incoming connection occurs from a remote node. The suggested [radio] section for iax.conf should look like this:

; Incoming radio connections 

[radio] 
type=user 
disallow=all 
allow=g726aal2 
allow=gsm 
codecpriority=host 
context=radio-secure 
transfer=no 

Let's now pick the above configuration apart. The configuration allows incoming connections only (type=user), and only ADPCM and GSM codecs (disallow=all, allow=g726aal2, and allow=gsm). The order of selection (negotiation) is determined by this machine (codecpriority=host), and is in the order specified by the allow statements (ADPCM first, GSM second). The context to call in extensions.conf is radio-secure (context=radio-secure). And call transfers to external systems are disallowed (transfer=no)

Adding support for another codec is fairly straightforward. For example, if we want to allow the use of the ulaw codec on incoming connections all that would be required is to add an allow=ulaw statement to the [radio] stanza so it looks like this:

[radio] 
type=user 
disallow=all 
allow=ulaw ; added
allow=g726aal2 
allow=gsm 
codecpriority=host 
context=radio-secure 
transfer=no 

Now the system will try to negotiate a ulaw connection first, ADPCM second and GSM last.

A final note about codec selection. There are quite a few codecs in Asterisk to choose from, but ulaw, alaw, GSM and ADPCM should only be used, the rest of the standard Asterisk codecs (speex, ilbc, lpc10, etc) should be avoided. The ulaw and alaw codecs have the best audio quality, followed by ADPCM, and lastly GSM, Bandwidth used is in the reverse order to audio quality. GSM uses the least bandwidth, and alaw/ulaw the most. Here is a quality versus bandwidth trade off table:

CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers)
ADPCM good 55 kbps
GSM mediocre 36 kbps
ULAW best 87 kilobits per second (kbps)