text
stringlengths
0
152
To check the registration status of a device, simply call up the Asterisk CLI:
$ sudo asterisk -rvvvv
Typing the following command returns a listing of all the peers that Asterisk knows
about (devices that have registered will have a corresponding Contact):
*CLI> pjsip show aors
Aor: <Aor..............................................> <MaxContact>
Contact: <Aor/ContactUri............................> <Hash....> <Status> <RTT(ms)..>
==========================================================================================
Aor: 0000f30A0A01 2
8 Or any other SIP registrar server, for that matter.
72
|
Chapter 5: User Device Configuration
Aor: 0000f30B0B02 2
Contact: 0000f30B0B02/sip:0000f30B0B02@172.29.1.110:5 7542ca7ce1 Unknown nan
Aor: SOFTPHONE_A 2
Aor: SOFTPHONE_B 2
A Basic Dialplan to Test Your Devices
In the next chapter we’re going to dive into the Asterisk dialplan. Here, we’re going to
lay down a very simple dialplan so that if you register devices to the various SIP end‐
points already in the PJSIP configuration, you should be able to make test calls
between them.
$ sudo -u asterisk vim /etc/asterisk/extensions.conf
[general]
[globals]
[sets]
exten => 100,1,Dial(PJSIP/0000f30A0A01)
exten => 101,1,Dial(PJSIP/0000f30B0B02)
exten => 102,1,Dial(PJSIP/SOFTPHONE_A)
exten => 103,1,Dial(PJSIP/SOFTPHONE_B)
exten => 200,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()
From your Asterisk console type the following command:
*CLI> dialplan reload
*CLI> dialplan show
You will see that in the context sets there are some extension numbers you can call.
This basic dialplan will allow you to dial your SIP devices using extensions 100, 101,
102, and 103. You can also listen to the hello-world prompt that was created for this
book by dialing extension 200.
Register a couple of SIP phones (you can download a softphone to your PC and
another one to a tablet or smartphone). You should be able to dial between your
extensions. Open up the CLI in order to see the call progression. You should see
something like this (and the set you are calling should ring):
-- Executing [102@sets:1] Dial("PJSIP/SOFTPHONE_A-00000001", "PJSIP/0000f30B0B02")
-- Called PJSIP/0000f30B0B02
-- PJSIP/0000f30B0B02-00000002 is ringing
A Basic Dialplan to Test Your Devices
|
73
If this does not happen, review your configuration and registration and ensure you
have not made any typos.
Registering a Device to Asterisk
There are so many different sorts of SIP devices you can register to Asterisk, it’s
impossible to provide an example that’ll be useful to everyone. You could have a PC,
or a Mac, or a Linux workstation, or an iPhone, or an Android, or a SIP desk phone,
or some other SIP device entirely; each type of device has many different sorts of SIP
clients available, and they’re all mostly the same, but just different enough to be
annoying to a novice.
We can’t tell you the specific method to register, but we have found that of the dozens,
or perhaps hundreds, of options in each device, the basic process is similar for all of
them. You will need to provide:
• The address of your Asterisk server (hostname, domain, proxy, and server are all
fields we’ve seen for this)
• The identity of the device (id, user, subscriber, username, extension, name,