It’s easier to think of a peer as a SIP device. Every device connects to Asterisk based on the set configuration.
Checking Peers using Asterisk console
The Asterisk console can be open from Odoo by going to
Settings -> Server and clicking on the
Console button. Alternatively it can be opened by running
asterisk -r in your terminal emulator. To see the list of SIP peers, type the command:
sip show peers
See the example below of the output:
CLI> sip show peers Name/username Host Dyn Forcerport Comedia ACL Port Status Description 1001 (Unspecified) D Yes Yes A 0 Unmonitored
Note that the Status in our example is set to Unmonitored. This is because we are not using the qualify=yes option in our sip.conf file. If we enable peer qualify, we will see if the peer is Available or Not Available. Also, when the ping to the user is greater than 2 seconds, the peer will be noted as Lagged.
SIP Peer templates
Odoo PBX has included set of peer templates that would be suitable for the great majority of created peers. The easiest way to create quickly your peers is to select one of the templates below when creating it:
SIP NAT User: Template used when the peer is not connected directly to Asterisk and NAT is used. For the majority of peers this template is mandatory.
SIP NAT User Strict: Same as SIP NAT User, but permits additional configuration by allowing or denying certain IP addresses.
WebRTC: The WebRTC template is used for peers that use WebRTC, for example Odoo VoIP.
To access and manage the templates, go to PBX -> Settings -> SIP templates.
Creating SIP Peers
Go to PBX -> Applications -> Peers to manage your Peers.
The most frequent way to create a Peer is by attaching it to a user when it is created. To do this, one needs to fill in the following fields:
SIP Name: The name of the peer. Is used for authentication. For peers that are attached to the user it is usually the peer’s extension.
Template: The template of the user. In 95% of cases it will be SIP NAT User.
SIP Secret: The password used for peer’s authentication to Asterisk.
When a SIP Peer that is not attached to a user needs to be created, the logic of the fields changes:
SIP Name: The name of the peer. Is used for authentication. In this case it can be any string.
Service Extension: The internal phone number of the Peer.
Other frequently used parameters
Host: The IP address of the peer. Usually the peers are moving from one IP address to another, so this field also supports
dynamic as its contents.
Context: The context of the peer that is used in the dialplans, the logic inside Asterisk
Caller ID: How the Peer is presented to the outside world.
Allow Codecs: The audio codecs that need to be used. The default value is
all - all the codecs that are supported by Asterisk, but they can sometimes be restricted to specific codecs, separated by commas.
NAT: If the Peer will use NAT or not.
Permit: The IP addresses from which the Peer can connect to Asterisk. Has the form of
netmask. 0.0.0.0/0.0.0.0 means all the IP addresses
Deny: The IP addresses from which the Peer is prohibited to connect to Asterisk. The form is similar as above.
You can click on the
Show Only Changed Settings button to show off additional parameters, that extend the options for Peer’s configuration, meant for more advanced users.