In order for our phones to communicate with each other, we need to configure an account for each phone in the channel driver which corresponds to the protocol they'll be using. Since the phones are using the SIP protocol, we actually have two options for a SIP channel driver, the configuration file would be sip.conf for chan_sip, or pjsip.conf for chan_pjsip/res_pjsip (res_pjsip actually provides the configuration). You may already know that chan_pjsip is only available in Asterisk 12 or later. These files reside in the Asterisk configuration directory, which is typically /etc/asterisk. We'll include separate instructions for each channel driver below, so you have the option of using either.
You For the sake of the examples in this section, you should only configure and use one SIP channel driver at a time or you'll run into confusing behavior.. Advanced configuration is needed to use two different SIP channel drivers simultaneously.
Use of templates
In the below examples of channel driver configuration we will use templates. Using templates can make the configuration seem a bit more confusing at first, but in the long run it will simplify managing larger groups of extensions. Templates are used to define sections of options or settings that can then be inherited by a child section. Read about templates here. The short story is that parents are defined with a bang in parentheses after their section name, and children specify a parent in the parentheses after their section name.