Welcome to madhatt.com

A Simple website from a computer geek in Colorado with dreams of moving to Alaska

My Travels Photo Gallery

Cool little script to kill page calls

This is a copy of a forum post I made to show how to kill calls that get transferred into the page system of Asterisk 1.6 and higher.

Here is the finished dial plan I used.
It seems to only work in Asterisk 1.6 or higher.
The second line will execute a Shell command that reads the core channels, look for the channel that matches 60@ (in our system you dial 'or transfer to' extension 60 to page)
The third line hangs up on the channel which in turn will hangup on all of the other channels in the page

exten => *70,1,Answer

exten => *70,n,Set(CHAN=${SHELL(asterisk -rx "core show channels" | awk '/60@/ {print $1}' | tr -d '\n')}) 

exten => *70,n,SoftHangup(${CHAN})

exten => *70,n,hangup()
In our system it works almost instantly and we give out the *70 number to managers so they know how to kill pages when I'm not there.
It may seem like a simple script to many but I'm happy that I found the awk command!