Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rank-math domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u763016847/domains/golinuxhub.com/public_html/wp-includes/functions.php on line 6114
Hanging up active calls in Asterisk PBX - GoLinuxHub

Hanging up active calls in Asterisk PBX

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