<div class="gmail_quote">This version will hang up the given extension even if it has multiple channels open:</div><div class="gmail_quote"></div><div class="gmail_quote">asterisk -rx "show channels" | perl -lane "print \"asterisk -rx \'soft hangup @F[0]\'\" if m.SIP/201." | bash</div>
<div class="gmail_quote"></div><div class="gmail_quote">perl is always your friend when needing some programming mischief :)</div><div class="gmail_quote">l.</div><div class="gmail_quote"></div><div class="gmail_quote"></div>
<div class="gmail_quote"></div><div class="gmail_quote">2009/2/12 Danny Nicholas <span dir="ltr"><<a href="mailto:danny@debsinc.com">danny@debsinc.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Here's an "improved hack" to this "bit of trickery":<br>
<br>
Exten => _86XXXX,1,system('/usr/sbin/asterisk -rx "soft hangup<br>
$(/usr/sbin/asterisk -rx 'core show channels' | grep SIP/${EXTEN(2)| awk '{<br>
print $1 '} )")<br>
<br>
Where dialing 861234 would hangup extension 1234<br>
<br>
If this needs refinement, will repost:<br>
<div class="Ih2E3d"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a><br>
</div><div><div class="Wj3C7c">[mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a>] On Behalf Of Helius<br>
Ferreira<br>
Sent: Thursday, February 12, 2009 4:42 AM<br>
To: <a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a><br>
Subject: Re: [asterisk-users] Hangup extensions via CLI?<br>
<br>
Asterisk 1.6 implements the "hangup" on the channel you just made the call<br>
and I used it with this command (apparently)<br>
<br>
asterisk -rx "soft hangup $(asterisk -rx 'core show channels' | grep<br>
SIP/7000|<br>
awk '{ print $1 '} )"<br>
<br>
In my asterisk system:<br>
<br>
debian*CLI> core show channels<br>
Channel Location State Application(Data)<br>
SIP/7000-09c63a30 (None) Up AppDial((Outgoing Line))<br>
SIP/7777-09c59938 7000@internos:5 Up Dial(SIP/7000)<br>
2 active channels<br>
1 active call<br>
6 calls processed<br>
debian*CLI><br>
<br>
debian:~# asterisk -rx "soft hangup $(asterisk -rx 'core show channels' |<br>
grep<br>
SIP/7000|awk '{ print $1 '} )"<br>
SIP/7000-09c63a30<br>
SIP/7777-09c59938 is not a known channel<br>
<br>
But, with the channel SIP/7777-09c59938 is OK.<br>
<br>
asterisk -rx "soft hangup $(asterisk -rx 'core show channels' | grep<br>
SIP/7777|<br>
awk '{ print $1 '} )"<br>
Requested Hangup on channel 'SIP/7777-09c59938'<br>
<br>
I use asterisk 1.6.1 beta4<br>
<br>
On Wed 11 Feb 2009 09:34:12 Lenz Emilitri wrote:<br>
> This is a bit of trickery, but could not resist :)<br>
><br>
> This will kill a channel that is connected to SIP/201<br>
><br>
> asterisk -rx "soft hangup $(asterisk -rx 'show channels' | grep SIP/201 |<br>
> awk '{ print $1 '} )"<br>
><br>
> It basically calls *, gets the list of channels, filters them out to get<br>
> the channel name and hangs it up.<br>
><br>
> OK, using AMI and a real programming language and hadling multiple lines<br>
> would be better.<br>
><br>
> Thanks<br>
><br>
> l.<br>
><br>
> 2009/2/9 Tim Nelson <<a href="mailto:tnelson@rockbochs.com">tnelson@rockbochs.com</a>><br>
><br>
> > Greetings list-<br>
> ><br>
> > I'd like the ability to hangup all calls for a particular extension from<br>
> > the system CLI. I understand this can probably be scripted using the AMI<br>
> > but I'm not familiar on how to do it. Help!<br>
> ><br>
> > Tim Nelson<br>
> > Systems/Network Support<br>
> > Rockbochs Inc.<br>
> > (218)727-4332 x105<br>
<br>
<br>
<br>
_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
<br>
<br>
_______________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Loway - home of QueueMetrics - <a href="http://queuemetrics.com">http://queuemetrics.com</a><br><br>