Summary:ASTERISK-14152: Hangup()-command in dialplan does not clear the channel
Reporter:Jonas Kellens (jonaskellens)Labels:
Date Opened:2009-05-17 03:47:26Date Closed:2011-06-07 14:08:03
Versions:Frequency of
Description:I have a TDM410P-card with 3 FXO-modules.
When I call the number of one of these PSTN-lines that terminate in an FXO-module of my Asterisk-server, the call is excepted.

In the weekend there's an voicemail-system that states that the store is closed.
When the voicemail-message is recorded, Asterisk needs to hang up the line. I use the Hangup()-command in my dialplan.

But the line is not hanged up. There is no tone send to the caller that gives the impression that the call was hung up by Asterisk. There is just silence...

When I look at the time at my cellphone-display, that indicates the duration of the call, it just keeps on counting...
The call is only really terminated when the caller puts down his phone and ends the call. Only then is the channel cleared.

So : with my cellphone I call the phone number of the company. In the weekend there is a voicemail. I leave a message and press "#". I here the thankyou-message and then there is silence...

To Asterisk, the conversation has ended. Call Detail recording stops (end-time of the conversation is when Asterisk initiates the hangup()-command).
To me, and my cellphone, the call is still in progress... it finally times out at about 2 minutes...
At the CLI, it's then when I see that the DAHDI-channel has cleared.


This is my chan_dahdi configuration :



hanguponpolarityswitch=yes  ; someone told me to put this
                           ; to handle my hangup()-problem, but it doesn't

channel => 1

channel => 2

channel => 3


This is a part of my dialplan (extension.conf) :

exten => s,1,NoOp(KMO : voicemail)
exten => s,n,Voicemail(50@voicemail-context,u)
exten => s,n,PLayback(/var/lib/asterisk/sounds/TCS/bedankt-oproep)
exten => s,n,Hangup()


This is what happens on the CLI (/var/log/asterisk/verbose) :

[May 16 22:12:05] VERBOSE[7743] logger.c:     -- Goto (voicemail,s,1)
[May 16 22:12:05] VERBOSE[7743] logger.c:     -- Executing [s@voicemail:1] NoOp("DAHDI/2-1", "KMO : voicemail") in new stack
[May 16 22:12:05] VERBOSE[7743] logger.c:     -- Executing [s@voicemail:2] VoiceMail("DAHDI/2-1", "50@voicemail-context|u") in new stack
[May 16 22:12:05] VERBOSE[7743] logger.c:     -- <DAHDI/2-1> Playing '/var/spool/asterisk/voicemail/voicemail-context/50/temp' (language 'be')
[May 16 22:12:08] VERBOSE[7743] logger.c:     -- <DAHDI/2-1> Playing 'vm-intro' (language 'be')
[May 16 22:12:14] VERBOSE[7743] logger.c:     -- <DAHDI/2-1> Playing 'beep' (language 'be')
[May 16 22:12:14] VERBOSE[7743] logger.c:     -- Recording the message
[May 16 22:12:14] VERBOSE[7743] logger.c:     -- x=0, open writing:  /var/spool/asterisk/voicemail/voicemail-context/50/tmp/xYnbsC format: wav49, 0x8e992d8
[May 16 22:12:14] VERBOSE[7743] logger.c:     -- x=1, open writing:  /var/spool/asterisk/voicemail/voicemail-context/50/tmp/xYnbsC format: wav, 0x8e969d0
[May 16 22:12:14] VERBOSE[7743] logger.c:     -- x=2, open writing:  /var/spool/asterisk/voicemail/voicemail-context/50/tmp/xYnbsC format: gsm, 0x8e96d78
[May 16 22:12:31] VERBOSE[7743] logger.c:     -- User ended message by pressing #
[May 16 22:12:31] VERBOSE[7743] logger.c:     -- <DAHDI/2-1> Playing 'auth-thankyou' (language 'be')
[May 16 22:12:31] VERBOSE[7743] logger.c:     -- Executing [s@voicemail:3] Playback("DAHDI/2-1", "/var/lib/asterisk/sounds/TCS/bedankt-oproep") in new stack
[May 16 22:12:31] VERBOSE[7743] logger.c:     -- <DAHDI/2-1> Playing '/var/lib/asterisk/sounds/TCS/bedankt-oproep' (language 'be')
[May 16 22:12:33] VERBOSE[7743] logger.c:     -- Executing [s@voicemail:5] Hangup("DAHDI/2-1", "") in new stack
[May 16 22:12:33] VERBOSE[7743] logger.c:   == Spawn extension (voicemail, s, 5) exited non-zero on 'DAHDI/2-1'
[May 16 22:12:33] VERBOSE[7743] logger.c:     -- Hungup 'DAHDI/2-1'

BUT : the line is still occupied, and still not cleared !
Comments:By: David Woolley (davidw) 2009-05-18 05:51:38

It is fairly common for PSTN providers to not accept called party clears for landline originated calls.  For example that is the case for BT in the UK, and probably for all UK providers, at least when the called line is a simple analogue line.  I would say this wasn't an Asterisk problem.

The reason is to allow the call to be hungup on one parallel connected phone and picked up on a more convenient one.

(If this were an ordinary telephone, rather than a PABX, there are tricks, using recall, that can be used to ublock a line which the caller is blocking.  These are normally mentioned in the context of someone abusively blocking a line.)

By: Tilghman Lesher (tilghman) 2009-05-18 06:57:43

Agreed, this is simply not part of the signalling for FXO lines.  Asterisk can only do so much.  You cannot Hangup a call without first Answer'ing it when it comes to analog lines.

By: David Woolley (davidw) 2009-05-18 07:10:50

He is actually answering, but I think that the problem is that the PABX provider doesn't allow him to reverse clear it.  I think that this is the same issue as http://forums.digium.com/viewtopic.php?t=68757, where he also says that it does clear after 2 minutes.  That is typical behaviour for a reverse clear where the line doesn't have called party clearing for a particular type of call.

To fully confirm that this is not an Asterisk problem, he should take a digital voltmeter and place it across the A and B wires to the exchange and report the voltages:

a) when idle
b) when on a call
c) when the dialplan has issued hangup(), but the line is still busy.

By: Ronald Chan (loloski) 2009-05-18 08:08:26


we are in the same boat i do agree with them that this is not the problem in asterisk, talking to your telco will surely solve your problem, in my case i was force to change my telco and finally put rest the problem to end. :(

Here in the philippines this is not _always_ the case but i do encounter this issue from one telco to another. specially on very remote areas :) good luck.

By: Jonas Kellens (jonaskellens) 2009-05-18 08:25:07

The call is indeed first answered with the answer()-command in another context, then if necessary routed to the [voicemail]-context.

I see one solution to make the other party clear the channel and that is with the Playtones()-application play a busy-sound or so...
The caller in this case will not wait through the silence and hang up so the channel is cleared.

This will shorten the time that the channel is unnecessary occupied.

If it really is the Telco's fault, then I don't understand why a called fixed line or a called cellphone can put down the horn and clear the channel.

When I call a fixed line, and the caller puts down his phone, I hear a tone that the phonecall was ended. The time on my cellphone will not continue counting. It stops when the caller has ended the phone-call...

That's why I thought that it was maybe Asterisk who did not generate the right tone so the Telco knows he needs to clear the channel to the caller...

By: David Woolley (davidw) 2009-05-18 08:33:52

You are calling from a cellphone.  PTTs typically do implement called party clearing for calls from cellphones.  It is assumed that people want to clear promptly.

Simple FXO lines use a low resistance on the line to answer and return to the high resistance state to clear; they don't use tone signalling for seize or clear.

Note is is not a telco fault, but a feature.  It is done quite deliberately.

By: Ronald Chan (loloski) 2009-05-18 08:42:15

yeah, that feature thinggy is bugging me for some installation of mine :), and i'm really glad that playtone apps can help me on this. even its late at least i know now that there's an interim solution that maybe can help :) besides on changing a telco...

By: Leif Madsen (lmadsen) 2009-07-13 10:00:05

Closing this issue, as it appears there is nothing that needs to be resolved in Asterisk here.