# Asterisk not hanging up channels properly (hung channels)

**URL:** <https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546>\
**Category:** Asterisk Support\
**Created:** [September 26, 2012, 8:00am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546 "2012-09-26T08:00:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [September 26, 2012, 8:00am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/1 "2012-09-26T08:00:36Z")

</div>

I want to ask a question about a behaviour that I am seeing on multiple versions of Asterisk 1.8. The bug has to do with SIP channels not being hung properly in Asterisk. These are the symptoms:

The “core show channels” shows the correct ammount of concurrent calls and active channels on the system:

```auto
Channel Location State Application(Data)
0 active channels
0 active call
33158 calls processed
```

But the “sip show channelstats” returns a totally different output:

```auto
EXTRALUX-IP-PBX*CLI> sip show channelstats
Peer Call ID Duration Recv: Pack Lost ( %) Jitter Send: Pack Lost ( %) Jitter
172.16.8.155 88c454870bf 0000004564 0000000000 ( 0.00%) 0.0000 0000004577 0000000000 ( 0.00%) 0.0000
192.168.2.30 4b075265579 0000011854 0000000000 ( 0.00%) 0.0000 0000011846 0000000000 ( 0.00%) 0.0001
172.16.8.145 52f58e9a56f 0000001707 0000000000 ( 0.00%) 0.0000 0000001729 0000000000 ( 0.00%) 0.0000
10.10.10.10 0c2da8a6079 0000003638 0000000000 ( 0.00%) 0.0000 0000003616 0000000000 ( 0.00%) 0.0001
172.16.8.164 7bbda4cce6a 0000011846 0000000000 ( 0.00%) 0.0000 0000011854 0000000000 ( 0.00%) 0.0000
172.16.8.112 4543acfe0a3 0000000581 0000000000 ( 0.00%) 0.0000 0000000594 0000000000 ( 0.00%) 0.0001
10.10.10.10 31792474079 0000001729 0000000000 ( 0.00%) 0.0000 0000001707 0000000000 ( 0.00%) 0.0000
172.16.8.11 3837e7e8335 0000004577 0000000000 ( 0.00%) 0.0000 0000004564 0000000000 ( 0.00%) 0.0000
172.16.8.162 d5b6a4934b7 0000000594 0000000000 ( 0.00%) 0.0000 0000000581 0000000000 ( 0.00%) 0.0001
10.10.10.10 0f75d0d6079 0000008660 0000000000 ( 0.00%) 0.0000 0000008637 0000000000 ( 0.00%) 0.0000
172.16.8.163 22d65b7c6f2 0000008637 0000000000 ( 0.00%) 0.0000 0000008659 0000000000 ( 0.00%) 0.0000
172.16.8.162 363bc836336 0000003616 0000000000 ( 0.00%) 0.0000 0000003638 0000000000 ( 0.00%) 0.0001
12 active SIP channels
```

Interesting thing is that the number of SIP channels shown by the commands does not math. One more way to identify these “hung channels” is also, that there is no value for Duration in the “sip show channelstats” output. For the calls, that actually are active, the Duration parameter is visible and increasing by time.

A command “sip show channels” is also showing a strange output:

```auto
172.16.8.155 670 88c454870bf7e6d 0x0 (nothing) No Rx: BYE 670
192.168.2.30 790 4b075265579e86f 0x0 (nothing) No Rx: BYE 790
10.10.10.10 0031111111 a1388d0c07ab11e 0x8 (alaw) No Rx: ACK RM_T2_Trun
172.16.8.145 681 52f58e9a56f494e 0x0 (nothing) No Rx: BYE 681
10.10.10.10 004222222 0c2da8a6079b11e 0x0 (nothing) No Rx: BYE RM_T2_Trun
172.16.8.164 671 7bbda4cce6a9dd9 0x0 (nothing) No Rx: BYE 671
172.16.8.112 678 4543acfe0a3332c 0x0 (nothing) No Rx: BYE 678
10.10.10.10 005333333 31792474079a11e 0x0 (nothing) No Rx: BYE RM_T2_Trun
172.16.8.11 06444444 3837e7e833554a7 0x0 (nothing) No Rx: BYE GSM_Trunk_
172.16.8.145 (None) 6c33cd8d03dd5dc 0x0 (nothing) No Rx: REGISTER <guest>
172.16.8.162 668 d5b6a4934b772ee 0x0 (nothing) No Rx: BYE 668
172.16.8.151 (None) 82ba2d4384daca3 0x0 (nothing) No Rx: REGISTER <guest>
10.10.10.10 0075555555 0f75d0d6079811e 0x0 (nothing) No Rx: BYE RM_T2_Trun
192.168.1.10 (None) 84ccd25614f811b 0x0 (nothing) No Rx: REGISTER <guest>
172.16.8.161 (None) f909811561ddffd 0x0 (nothing) No Rx: REGISTER <guest>
172.16.8.112 678 2b21d7c073f1b45 0x8 (alaw) No Tx: ACK 678
172.16.8.163 669 22d65b7c6f28804 0x0 (nothing) No Rx: BYE 669
172.16.8.162 668 363bc836336a37d 0x0 (nothing) No Rx: BYE 668
18 active SIP dialogs
```

Does anyone know how to explain these strange outputs?

I think that the issue must be quite common, since I am seeing this on majority of my production systems (small PBX-es, up to 30 users). The problem is harmless and can be cured by a simple asterisk restart, but it is sill bothering me.

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [September 26, 2012, 8:33am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/2 "2012-09-26T08:33:18Z")

</div>

SIP dialogues remain for several seconds after they cease to be usable, because Asterisk needs to recognise late and duplicate responses.

However lots of last TX BYE suggests a problem with the other side recognising the BYE.

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [September 26, 2012, 12:56pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/3 "2012-09-26T12:56:50Z")

</div>

These outputs are from a PBX that at the moment of issuing of the commands had 0 active calls a lot more than just a couple of seconds.

I am specially wondering about the output of the “sip show channelstats”. If Asterisk didn’t receive a reply to a SIP Bye (ACK did not make it to the server), shouldn’t Asterisk clear/end the call internally anyways after some sort of timeout?

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [September 26, 2012, 1:37pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/4 "2012-09-26T13:37:27Z")

</div>

It should clear after about 30 seconds.

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [September 26, 2012, 6:09pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/5 "2012-09-26T18:09:08Z")

</div>

I am not too sure about the “sip show channels” command output, but I am 100% sure that the command output of “sip show channelstats” never clears up. Only a Asterisk restart clears it up.

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [September 28, 2012, 7:50am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/6 "2012-09-28T07:50:35Z")

</div>

Do you think the issue is valid for posting on the bug tracker?

---

<div class="post-metadata">

**Author:** ![david55](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@david55](https://community.asterisk.org/u/david55)\
**Post date:** [September 28, 2012, 8:14am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/7 "2012-09-28T08:14:01Z")

</div>

I think it is OK, but remember that you need to think about why this is not being seen widely. What is special about your system may be a clue to the cause. It will also determine the severity (lower, the more your system differs from that of a typical user).

You will need to confirm it with the latest released version on the branch, and you will need to provide verbose and debug output and sip set debug or wireshark captures. You will get a better response if you can prune those to show just one case where the call gets stuck, as nobody likes trawling through large log files.

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [October 1, 2012, 9:25am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/8 "2012-10-01T09:25:43Z")

</div>

Hmmmm, I must admit that I am surprised that this is not seen more widely. I do not have many PBX-es that I am administering, but I see the problem on the majority of them (all are small systems). Each have individual setups, so at the moment I can not put my finger on what might be the problem. The second part of the problem is, that the issues happens quite randomly, so it’s hard to catch.

Thank’s for your help David. It seems I owe you one 😉

---

<div class="post-metadata">

**Author:** ![dejanst](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dejanst](https://community.asterisk.org/u/dejanst)\
**Post date:** [October 15, 2012, 7:35am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/9 "2012-10-15T07:35:01Z")

</div>

I did some further work on that and I see this problem only on systems that have some VoIP gateways that we use. For the system that I reported this bug, a change of the switch port for the Asterisk server did the trick. After I connected the server and the IP phones to the same switch, the problem stopped happening. All calls are cleared successfully.

From that I suspect that Asterisk does not handle well the case where Asterisk sends a SIP Bye to the remote end and the SIP ACK (that remote end sends back) does not make it to the server. I think that Asterisk should clear/end the call internally anyways after some sort of timeout, but it does not. To be more specific, the call is cleared as far as telephony channels is concerned (channel is not active - call minutes are not running), but it is not cleared from the “sip show channels” and “sip show channelstats commands”. Only a Asterisk restart clears those calls.  
I have no idea on how to simulate this scenario. Doing a packet capture and a detailed debug is very hard, because the problem is very sporadic and hard to replicate. But I hope that somebody can pick up on this.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [November 1, 2012, 4:16pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/10 "2012-11-01T16:16:07Z")

</div>

I have a smiliar issue. A call comes in PSTN to my 1.8 Asterisk. Asterisk sends an INVITE to an App server that proxies the invite on to a softphone. Call sets up ok but the final 200 is repeatedly send by the softphone becasue Asterisk is sending the ACK to the proxy (which doens’t forward it) rather than to the softphone as it should.

Any ideas? Is this a knwon issue?

---

<div class="post-metadata">

**Author:** ![jj\_chiou](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jj\_chiou](https://community.asterisk.org/u/jj_chiou)\
**Post date:** [December 25, 2014, 9:07am UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/11 "2014-12-25T09:07:37Z")

</div>

ha ha ha

I have the same issue , when remote device response disnormal , the call is hung .asterisk try to end the call leg , it will expire the call via register again or sent bye . but asterisk not end the call leg with user device . My Asterisk version is 11.7 .

---

<div class="post-metadata">

**Author:** ![ashok5021004](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ashok5021004](https://community.asterisk.org/u/ashok5021004)\
**Post date:** [July 5, 2023, 7:18pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/12 "2023-07-05T19:18:51Z")

</div>

Hi Everyone,

I am also seeing the same issue in my production server and my asterisk version is 11.  
Is there any workaround or fix for this issue available? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [July 5, 2023, 7:54pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/13 "2023-07-05T19:54:34Z")

</div>

Upgrade to a supported version of Asterisk and a supported channel driver (chan\_pjsip).

---

<div class="post-metadata">

**Author:** ![FrancoSmash](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/francosmash/32/6689_2.png) [@FrancoSmash](https://community.asterisk.org/u/FrancoSmash)\
**Post date:** [July 5, 2023, 8:12pm UTC](https://community.asterisk.org/t/asterisk-not-hanging-up-channels-properly-hung-channels/40546/14 "2023-07-05T20:12:54Z")

</div>

Asterisk 11 is too far out of date. As david551, stated you MUST upgrade to keep up with “production”
