[asterisk-users] Hangup extensions via CLI?

Helius Ferreira helius at adinet.com.uy
Thu Feb 12 04:42:25 CST 2009


Asterisk 1.6 implements the "hangup" on the channel you just made the call
and I used it with this command (apparently)

asterisk -rx "soft hangup $(asterisk -rx 'core show channels' | grep SIP/7000|
awk '{ print $1 '} )"

In my asterisk system:

debian*CLI> core show channels
Channel              Location             State   Application(Data)
SIP/7000-09c63a30    (None)               Up      AppDial((Outgoing Line))
SIP/7777-09c59938    7000 at internos:5      Up      Dial(SIP/7000)
2 active channels
1 active call
6 calls processed
debian*CLI>

debian:~# asterisk -rx "soft hangup $(asterisk -rx 'core show channels' | grep 
SIP/7000|awk '{ print $1 '} )"
SIP/7000-09c63a30
SIP/7777-09c59938 is not a known channel

But, with the channel SIP/7777-09c59938 is OK.

asterisk -rx "soft hangup $(asterisk -rx 'core show channels' | grep SIP/7777|
awk '{ print $1 '} )"
Requested Hangup on channel 'SIP/7777-09c59938'

I use asterisk 1.6.1 beta4

On Wed 11 Feb 2009 09:34:12 Lenz Emilitri wrote:
> This is a bit of trickery, but could not resist :)
>
> This will kill a channel that is connected to SIP/201
>
>  asterisk -rx "soft hangup $(asterisk -rx 'show channels' | grep SIP/201 |
> awk '{ print $1 '} )"
>
> It basically calls *, gets the list of channels, filters them out to get
> the channel name and hangs it up.
>
> OK, using AMI and a real programming language and hadling multiple lines
> would be better.
>
> Thanks
>
> l.
>
> 2009/2/9 Tim Nelson <tnelson at rockbochs.com>
>
> > Greetings list-
> >
> > I'd like the ability to hangup all calls for a particular extension from
> > the system CLI. I understand this can probably be scripted using the AMI
> > but I'm not familiar on how to do it. Help!
> >
> > Tim Nelson
> > Systems/Network Support
> > Rockbochs Inc.
> > (218)727-4332 x105





More information about the asterisk-users mailing list