[asterisk-users] How to soft hangup all channels at a time .

Alex Balashov abalashov at evaristesys.com
Tue Feb 12 23:24:01 CST 2008


Mohammad Salaque wrote:

> Dear all,
> 
> Anyone can point me how to soft hangup all channels using single
> command ? I am using Asterisk 1.4.15.

Such a command does not exist.

You could run a simple script to do this, except for the annoying fact 
that 'show channels' truncates the full channel name in its output.

Otherwise, you could do something like:

asterisk -r -x 'show channels' | perl -n -e 'chomp; 
if(/^SIP\/([a-zA-Z0-9\.\-]+)/) { print "SIP/$1\n"; }' | while read CHAN;
do
   asterisk -r -x "soft hangup $CHAN"
done

(Yes, you can issue a system() call from inside Perl, I was just trying 
to maintain a sense of humour.)


-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599



More information about the asterisk-users mailing list