text
stringlengths
0
152
mysql> select id from asterisk.ps_aors;
+--------------+
| id |
+--------------+
| 0000f30A0A01 |
| 0000f30B0B02 |
| SOFTPHONE_A |
| SOFTPHONE_B |
+--------------+
4 rows in set (0.00 sec)
Finally, the ps_auths table will need records for each new device.
insert into asterisk.ps_auths (id,auth_type,password,username)
values ('SOFTPHONE_A','userpass','iwouldnotifiwereyou','SOFTPHONE_A'),
('SOFTPHONE_B','userpass','areyoueventrying','SOFTPHONE_B');
Query OK, 2 rows affected (0.00 sec)
And, if all went well, you will have the following authorization records:7
mysql> select id,auth_type,password,username
-> from asterisk.ps_auths;
+--------------+-----------+----------------------+--------------+
| id | auth_type | password | username |
+--------------+-----------+----------------------+--------------+
| 0000f30A0A01 | userpass | not very secure | 0000f30A0A01 |
| 0000f30B0B02 | userpass | hardly to be trusted | 0000f30B0B02 |
| SOFTPHONE_A | userpass | iwouldnotifiwereyou | SOFTPHONE_A |
| SOFTPHONE_B | userpass | areyoueventrying | SOFTPHONE_B |
+--------------+-----------+----------------------+--------------+
4 rows in set (0.00 sec)
The new endpoints are now ready to have devices register to them. You can verify
that they exist with the following Asterisk CLI command:
7 Except, of course, that your passwords will be far better than the ones we’ve used here.
Configuring Asterisk
|
69
mysql> exit
$ sudo asterisk -rvvvvv
*CLI> pjsip show endpoints
The output should list your new endpoints:
Endpoint: 0000f30A0A01 Unavailable 0 of inf
InAuth: 0000f30A0A01/0000f30A0A01
Aor: 0000f30A0A01 2
Transport: transport-udp tls 0 0 0.0.0.0:5061
Endpoint: 0000f30B0B02 Not in use 0 of inf
InAuth: 0000f30B0B02/0000f30B0B02
Aor: 0000f30B0B02 2
Contact: 0000f30B0B02/sip:0000f30B0B02@172.29.1.110 7542ca7ce1 Unknown nan
Transport: transport-udp udp 0 0 0.0.0.0:5060
Endpoint: SOFTPHONE_A Unavailable 0 of inf
InAuth: SOFTPHONE_A/SOFTPHONE_A
Aor: SOFTPHONE_A 2
Endpoint: SOFTPHONE_B Unavailable 0 of inf
InAuth: SOFTPHONE_B/SOFTPHONE_B
Aor: SOFTPHONE_B 2
Hang on a minute…
Do you notice that there’s no transport defined for your new endpoints? That’s
because we haven’t defined anything yet for TLS; we’ve just configured for bog-
standard UDP-style SIP.
Since we have those fancy keys we generated in the previous chapter, let’s implement
them now and see if we can fix this.
$ sudo vim /etc/asterisk/pjsip.conf
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/home/asterisk/certs/self-signed.crt #if you used certbot, the location
priv_key_file=/home/asterisk/certs/self-signed.key #of those keys goes here
Now, because we’re putting some files in a folder that wasn’t part of our SELinux con‐
fig, we have to fix that. What we want is to get SELinux to generate an error, so we’re
going to reload the res_pjsip.so module, even though it will fail to load the trans
port correctly:
*CLI> module reload res_pjsip.so