Question On Softhangup

Home » Asterisk Users » Question On Softhangup
Asterisk Users 1 Comment

How do I use softhangup through the AMI interface?

I am using 1.4.43. Will softhangup hangup a DAHDI channel?

I have found that “Action: Hangup” does not hangup a DAHDI channel only sip.



One thought on - Question On Softhangup

  • Dave Platt provided the following answer to a similar question of mine last week. I was trying to use SoftHangup() to prempt a DAHDI line for an emergency call. Here is his reply.

    That may be due to a common characteristic of PSTN lines (at least, it’s common here in the U.S.)

    By design, most U.S. PSTN lines have a very asymmetrical response to a physical hangup:

    – If the calling party hangs up, the call is terminated

    – If the called party hangs up, and the calling party does not,
    the line remains “live” for some time (typically around 30
    seconds, I believe). If the called party goes off-hook again
    during this period, they can resume the call.

    If I recall correctly, things were designed this way so that the called party could say “Oh, hang on, I answered this call in the bedroom and the stuff I need is in the living room”, hang up the extension phone, go to another room, pick up the other phone and carry on with the call.

    If that’s what you’re running into here – if the line you are trying to SoftHangup() was handing an inbound call – then there may be no good solution. As far as I know, there is no way to force an incoming PSTN call to release the line, other than “go on-hook, and wait for 30 seconds to pass”.

    Several possible workarounds, roughly in order of increasing complexity and decreasing reliability:

    (1) Keep one of your PSTN lines reserved for emergency calls
    only; remove it from your inbound hunt group and place
    it in a Dahdi line group of its own (or don’t group it at

    (2) Keep one of your PSTN lines reserved for *outbound* calls
    only; you should be able to SoftHangup() an outbound call
    within a second or two.

    (3) Figure out a way to check the PSTN lines that are in use
    at the time of an emergency – if they’re all in use,
    somehow find one which was in use for an outbound call,
    and select it as the one to SoftHangup() and dial upon.

    (4) If you must keep all of your PSTN lines in bidirectional
    use, you may have to *tell* the parties that the line is
    needed for an emergency call, and ask them to release the
    line. Do a barge-in on the channel, play an alert sound,
    play a message saying “Emergency call in progress, please hang
    up this line immediately, play the alert sound again for
    a few seconds, SoftHangup(), Wait(2), and then try dialing.