Configuration File Common Options

Each protocol has its own specific options, but they share a number of options common across files. Let’s
go over a few common tasks and the options that control them that you’ll likely run into when editing
configuration files.

Users, Peers, and Friends
Asterisk uses some peculiar classifications for its VoIP connections.They are classified by the type= setting
which is either set to user, friend or peer.These are often accompanied by little to no explanation, which is a
 shame because they’re actually quite simple.
A user is a connection that will be used to make telephone calls to the local server; a peer is a connection
that will be used to make telephone calls from the local server; and a friend is a connection that will be used
to make telephone calls both to, and from, the local server.
These classifications are most commonly used in IAX2 and SIP connections. However, using them in SIP
connections is actually starting to become redundant due to how SIP connections are normally set up.We
will cover that later in the chapter.

Allowing and Disallowing Codecs
Asterisk supports numerous codecs for audio. Codecs can save bandwidth and allow for more simultaneous
phone calls on a data link. For a big list of the codecs Asterisk supports, refer to the table in Chapter 1.
Codecs are configured via the allow and disallow directives. Disallow can be used to explicitly deny use of
specific codecs, or it can be used in conjunction with allow to grant the use of only specific codecs.
Confused yet? Let’s look at a common situation: Say your shiny new Asterisk server has a connection to
your telephone provider via the IAX2 protocol. However, whenever a phone call is made through the
provider, the GSM codec is used, rather than the ulaw codec that is used when you call between extensions in the office.This needs to be fixed. So opening up the iax.conf configuration file you add the following line to the section controlling the connection:
                     disallow=gsm
Then issue a reload command to Asterisk. Problem solved, right? Not necessarily. While yes, this will
disallow use of the GSM codec, the behavior that results might not be the one expected.The added line tells
Asterisk not to use GSM; however, it still has the option of picking from all the other codecs it supports.The
correct way to ensure ulaw is used as the codec would be to add the following lines to iax.conf.
                   disallow=all
                   allow=ulaw
Now, if you’re scratching your head at the disallow=all statement, don’t worry. While, yes, that directive
essentially tells Asterisk to disallow every codec from being used, it is followed by the allow=ulaw
statement, which tells Asterisk that ulaw is okay to use. Essentially, those two lines are the same as typing
out disallow statements for every codec Asterisk supports except the one you want to use. When receiving
a phone call, Asterisk will check each allow and disallow statement to see which codecs it can and cannot
 use. It will first see the disallow=all statement, stopping the use of all codecs, but then it will allow the ulaw
codec once it reads the allow=ulaw statement. This can be expanded to work with multiple codecs as well.
If you wanted to allow both ulaw and alaw,ulaw European equivalent, the same steps would be followed,
except this time there would be two allow lines, allowing both ulaw and alaw.


No comments:

Post a Comment