There are many times when we run out of free channels in your PBX while making calls or in case a phone is not placed properly the calls does not gets disconnected and is shown as busy on the PBX. So at those moments it becomes a job of Administrator to monitor these logs and accordingly hangup unwanted calls to free up the channels.
Well I had to surf a lot to find the exact command to hangup calls in the latest Free PBX so here I will show you in easy steps for how to hangup active calls on PBX.
Login to your asterisk CLI console
asterisk2*CLI> core show channels Channel Location State Application(Data) SIP/3224-00000a19 s@macro-dial-one:42 Up Dial(SIP/4027,15,trI) IAX2/IAX_Trunk_to_US (None) Up AppDial((Outgoing Line)) SIP/4003-00000a2f s@macro-dialout-trun Up Dial(IAX2/IAX_Trunk_to_US/1001 SIP/4001-0000089e s-CHANUNAVAIL@macro- Up VoiceMail(3102@default,u"") SIP/3117-00000102 s-NOANSWER@macro-vm: Up VoiceMail(3106@default,u"") SIP/4027-00000a1a (None) Up AppDial((Outgoing Line)) 6 active channels 4 active calls 1553 calls processed
As you can see in my case there are 4 active channels and I want to disconnect user 4003 for example.
asterisk2*CLI> channel request hangup SIP/4003-00000a2f Requested Hangup on channel 'SIP/4003-00000a30' -- Executing [h@macro-dialout-trunk:1] Macro("SIP/4003-00000a30", "hangupcall,") in new stack -- Executing [s@macro-hangupcall:1] GotoIf("SIP/4003-00000a30", "1?theend") in new stack -- Goto (macro-hangupcall,s,3) -- Executing [s@macro-hangupcall:3] ExecIf("SIP/4003-00000a30", "0? Set(CDR(recordingfile)=)") in new stack -- Executing [s@macro-hangupcall:4] Hangup("SIP/4003-00000a30", "") in new stack == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/4003-00000a30' in macro hangupcall' == Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on 'SIP/4003-00000a30' -- Hungup 'IAX2/IAX_Trunk_to_US-49'
Now user 4003 has been disconnected as you can verify below.
asterisk2*CLI> core show channels
Channel Location State Application(Data)
SIP/3224-00000a19 s@macro-dial-one:42 Up Dial(SIP/4027,15,trI)
SIP/4001-0000089e s-CHANUNAVAIL@macro- Up VoiceMail(3102@default,u"")
SIP/3117-00000102 s-NOANSWER@macro-vm: Up VoiceMail(3106@default,u"")
SIP/4027-00000a1a (None) Up AppDial((Outgoing Line))
4 active channels
3 active calls
1554 calls processed
Related Articles