text
stringlengths
0
152
PJSIP is an open source, all-purpose multimedia communication library that provides
not only SIP signaling, but also the media features and NAT traversal functions that
are essential components of a SIP-based application. It is provided and supported by
Teluu Ltd., and the library is used in far more than just Asterisk. Softphones, propri‐
etary products, and other open source projects also make use of the framework. The
Asterisk community needed/wanted a new SIP channel driver, and rather than build‐
ing one from scratch, the developers decided to use the PJSIP library.
Configuring Asterisk
|
67
The components listed in Table 5-1 will be used in your endpoint configurations.
Table 5-1. PJSIP components of Asterisk
Component
ps_aors
ps_auths
ps_con
tacts
ps_end
points
Purpose
The Address Of Record (AOR) table is used to define how Asterisk can contact an endpoint. When the set
attempts to register, Asterisk will consult the AOR in order to identify it.
The Authentication section contains the credentials that endpoints will need to provide in order to authorize
communication with Asterisk.
Typically created automatically as part of the registration process, it is here that Asterisk will store the
details of the endpoint determined during registration.
The heart of the SIP configuration, it is here that each endpoint is defined. This is also where the
associations to the other PJSIP records are defined.
Adding an endpoint
During the installation, several example endpoints were created for you, in order to
simplify the process of providing you with a working system. If you want to add addi‐
tional endpoints, you simply need to define additional records in each of the ps_aors,
ps_auths, and ps_endpoints tables.
Let’s say we want to add a couple of softphones to our system, named SOFTPHONE_A
and SOFTPHONE_B.
First, into the ps_endpoints table, we’ll want to add the following:
$ mysql -D asterisk -u asterisk -p
Let’s review what we have there already (from the previous chapters):
mysql> select id,transport,aors,auth,context,disallow,allow from asterisk.ps_endpoints;
+--------------+---------------+--------------+--------------+----------+----------+-------+
| id | transport | aors | auth | context | disallow | allow |
+--------------+---------------+--------------+--------------+----------+----------+-------+
| 0000f30A0A01 | transport-udp | 0000f30A0A01 | 0000f30A0A01 | starfish | all | ulaw |
| 0000f30B0B02 | transport-udp | 0000f30B0B02 | 0000f30B0B02 | starfish | all | ulaw |
+--------------+---------------+--------------+--------------+----------+----------+-------+
2 rows in set (0.00 sec)
We’re going to insert a couple of extra records.
mysql> insert into asterisk.ps_endpoints
(id,transport,aors,auth,context,disallow,allow)
values
('SOFTPHONE_A','transport-tls','SOFTPHONE_A','SOFTPHONE_A','sets','all','ulaw'),
('SOFTPHONE_B','transport-tls','SOFTPHONE_B','SOFTPHONE_B','sets','all','ulaw');
Query OK, 2 rows affected (0.02 sec)
The ps_endpoints table should then look something like this:
68
|
Chapter 5: User Device Configuration
mysql> select id,transport,aors,auth,context,disallow,allow from ps_endpoints;
+--------------+---------------+--------------+--------------+---------+----------+-------+
| id | transport | aors | auth | context | disallow | allow |
+--------------+---------------+--------------+--------------+---------+----------+-------+
| 0000f30A0A01 | transport-udp | 0000f30A0A01 | 0000f30A0A01 | sets | all | ulaw |
| 0000f30B0B02 | transport-udp | 0000f30B0B02 | 0000f30B0B02 | sets | all | ulaw |
| SOFTPHONE_A | transport-tls | SOFTPHONE_A | SOFTPHONE_A | sets | all | ulaw |
| SOFTPHONE_B | transport-tls | SOFTPHONE_B | SOFTPHONE_B | sets | all | ulaw |
+--------------+---------------+--------------+--------------+---------+----------+-------+
4 rows in set (0.00 sec)
Then, we’ll need two related records in the ps_aors table:
mysql> insert into asterisk.ps_aors (id,max_contacts)
values ('SOFTPHONE_A',2),('SOFTPHONE_B',2);
Query OK, 2 rows affected (0.01 sec)
The ps_aors table should then return the following: