Entering CLI
Before you can see any of the messages in Asterisk CLI, you need to ssh to the system by using ssh command (if using Linux on your computer) or using putty or similar software if on PC/MAC. After that you can enter the Asterisk CLI via following command:
Code Block |
---|
|
Asterisk 13.6.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO [root@Motion-PBX ~]# asterisk -rvvvvv |
where number of Vs define the verbosity level of the CLI.
Once inside you will see a lot of useful info print out for all actions on the system, Asterisk related though. You will see:
- Phone calls
- Peer registrations
- Subscribe notification
- Reload of system components (Extensions, Trunks, IVRs, etc.)
Code Block |
---|
|
Asterisk 13.6.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 13.6.0 currently running on Motion-PBX (pid = 2112)
Motion-PBX*CLI> |
Entering CLI with additional debugging
If for some reason you have some inexplicable issues, like Asterisk not being able to start, you can try to run the CLI with different set of switches which should give some application specific debug info which includes start up sequence, database connection, registration retries, etc.
Code Block |
---|
|
[root@Motion-PBX ~]# asterisk -rddddd |
where number of Ds define the verbosity of these debug messages.
Code Block |
---|
|
Parsing /etc/asterisk/asterisk.conf
Seeding global EID '00:50:56:8e:23:02' from 'eth0' using 'siocgifhwaddr'
Asterisk 13.6.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 13.6.0 currently running on Motion-PBX (pid = 2112)
Core debug was OFF and is now 5. |
Info |
---|
|
To turn off the debug messages run this command: Code Block |
---|
| Motion-PBX*CLI> core set debug off
Core debug was 5 and is now OFF. |
|
Running commands outside of CLI
If you don't need to be inside CLI, or you need just to execute some command without concern of output from CLI, you can do so by running Asterisk command with following switches being used:
Code Block |
---|
|
[root@Motion-PBX ~]# asterisk -rx "reload" |
Above will reload Asterisk configuration without going into CLI.
SIP debugging
First important command(s) to know is the SIP debug set of commands which are useful when you need to see the SIP data stream going through Asterisk. Simple command is to enable SIP debugging for one phone with:
SIP SET DEBUG PEER PEERNAME
Code Block |
---|
|
Motion-PBX*CLI> sip set debug peer giove1motion
SIP Debugging Enabled for IP: 151.0.175.186 |
If for some reason thepeer is not registered and the IP of the peer is not known to the asterisk, above command will not work and CLI will not show any SIP messages.
In such case, if you know the IP from which traffic should come, it is better to turn on debugging for that specific IP like this:
SIP SET DEBUG IP PEER_IP
where PEER_IP is the IP address of the peer which should send traffic to said extension/trunk.
When you finish debugging the SIP stream, you need to turn off SIP debugging since leaving that running clutters the CLI output and you might miss other important information on the system.
Info |
---|
|
To turn off SIP debug run this command: Code Block |
---|
| Motion-PBX*CLI> sip set debug off
SIP Debugging Disabled |
|
RTP Debugging
One of the primary techniques is to view what is actually getting sent and received by VOIP devices.
If you have issues with audio problems, enable the RTP debug
Code Block |
---|
|
Motion-PBX*CLI> rtp set debug on
RTP Debugging Enabled |
Example of proper bidirectional RTP traffic
Code Block |
---|
|
Got RTP packet from 151.0.175.186:55903 (type 00, seq 013414, ts 317314000, len 000160)
Sent RTP packet to 82.215.163.137:10498 (type 00, seq 053165, ts 317314000, len 000160)
Got RTP packet from 82.215.163.137:10498 (type 00, seq 008373, ts 1558588704, len 000160)
Sent RTP packet to 151.0.175.186:55903 (type 00, seq 020095, ts 1558588704, len 000160)
Got RTP packet from 151.0.175.186:55903 (type 00, seq 013415, ts 317314160, len 000160)
Sent RTP packet to 82.215.163.137:10498 (type 00, seq 053166, ts 317314160, len 000160) |
Info |
---|
|
To turn off RTP debug run this command: Code Block |
---|
| Motion-PBX*CLI> rtp set debug off
RTP Debugging Disabled |
|
CODEC transcoding list
If for some reason you have issues with audio problems, some of the messages might indicate codec incompatibilities on the system. In such cases you can see the possible translation paths in Asterisk with following command:
Code Block |
---|
|
Motion-PBX*CLI> core show translation |
This command will show a table of possible codec transcoding/translation paths that can be followed on the system.
When you see a - sign, it means that transcoding between said codecs is not possible. In most cases, the reason for such issue is missing codec.
Code Block |
---|
|
Motion-PBX*CLI> core show translation
Translation times between formats (in microseconds) for one second of data
Source Format (Rows) Destination Format (Columns)
ulaw alaw gsm g726 g726aal2 adpcm slin slin slin slin slin slin slin slin slin lpc10 ilbc g722 testlaw
ulaw - 9150 15000 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
alaw 9150 - 15000 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
gsm 15000 15000 - 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
g726 15000 15000 15000 - 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
g726aal2 15000 15000 15000 15000 - 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
adpcm 15000 15000 15000 15000 15000 - 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 15000
slin 6000 6000 6000 6000 6000 6000 - 8000 8000 8000 8000 8000 8000 8000 8000 6000 6000 8250 6000
slin 14500 14500 14500 14500 14500 14500 8500 - 8000 8000 8000 8000 8000 8000 8000 14500 14500 14000 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 - 8000 8000 8000 8000 8000 8000 14500 14500 6000 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 - 8000 8000 8000 8000 8000 14500 14500 14500 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 8500 - 8000 8000 8000 8000 14500 14500 14500 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 8500 8500 - 8000 8000 8000 14500 14500 14500 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 8500 8500 8500 - 8000 8000 14500 14500 14500 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 8500 8500 8500 8500 - 8000 14500 14500 14500 14500
slin 14500 14500 14500 14500 14500 14500 8500 8500 8500 8500 8500 8500 8500 8500 - 14500 14500 14500 14500
lpc10 15000 15000 15000 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 - 15000 17250 15000
ilbc 15000 15000 15000 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 - 17250 15000
g722 15600 15600 15600 15600 15600 15600 9600 17500 9000 17000 17000 17000 17000 17000 17000 15600 15600 - 15600
testlaw 15000 15000 15000 15000 15000 15000 9000 17000 17000 17000 17000 17000 17000 17000 17000 15000 15000 17250 - |
Reloading the complete Asterisk configuration
In cases, and not limited to, where you did manual modifications to Asterisk dialplan, you need to reload the complete configuration of the Asterisk subsystem which can be done by a simple command:
Code Block |
---|
|
Motion-PBX*CLI> reload |
Or, out of the Asterisk CLI
Code Block |
---|
|
[root@Motion-PBX ~]# asterisk -rx "reload" |
This will reload all the configuration related to Asterisk telephony engine.
Restarting the Asterisk
If reloading of Asterisk is not enough for the changes made, or there is other reason to do so, you can restart complete Asterisk with:
Code Block |
---|
|
[root@Motion-PBX ~]# service asterisk restart |
List peers
When checking the availability of phones/trunks, you can print out a list of the peers on the system:
Code Block |
---|
|
Motion-PBX*CLI> sip show peers |
The command will print out a list of SIP peers on the system with additional info like online status and IP address from which they connect.
Active calls
Watch the complete list of the active channels and active calls
Code Block |
---|
|
Motion-PBX*CLI> core show channels |
SIP channels list
Watch the complete list of the SIP channels
Code Block |
---|
|
Motion-PBX*CLI> sip show channels |
Registered trunks
Check the registration status of the SIP trunks
Code Block |
---|
|
Motion-PBX*CLI> sip show registry
Host dnsmgr Username Refresh State Reg.Time
voip.eutelia.it:5060 N 0110703070 105 Registered Tue, 17 Jan 2017 14:39:52
82.215.163.137:5060 N xenia_bs2 105 Registered Tue, 17 Jan 2017 14:39:52
2 SIP registrations. |
Note |
---|
|
The trunk registration string must be previously configured in the trunk section of the Motion Web GUI 14:39:52
2 SIP registrations. |
Note |
---|
|
The trunk registration string must be previously configured in the trunk section of the XCALLY Web GUI |