1 2 3 4 5 6 7
#!/bin/bash # cleanly hangup remaining sessions before killing asterisk in the cpe for CHAN in $(asterisk -rx "core show channels concise" | grep AppDial | grep -v serve_call | awk -F! '{print $13}'); do asterisk -rx "hangup request ${CHAN}" sleep 0.1 done
You can clone a snippet to your computer for local editing. Learn more.