To stop the Asterisk PBX software, waiting until there are no longer any active calls,but allowing new calls in the interim:sudo asterisk ­rx “stop when convenient”To stop the Asterisk PBX software, waiting until there are no longer any active calls,without allowing new calls in the interim:sudo asterisk ­rx “stop gracefully”To stop the Asterisk PBX software immediately:sudo /etc/init.d/asterisk stop

Starting Asterisk

To start the Asterisk PBX software:sudo /etc/init.d/asterisk start

Notify when no calls

In some situations you may want to wait until there are no calls on the sytem beforeperforming some action. The script below will print the message “0 active channels”when no calls are active:#!/bin/bash while [ 1 ­lt 2 ]; do printf “.” sudo asterisk ­rx “core show channels” | grep ­x “0 active calls” sleep 1 done