Hangup() on DAHDI results in fast busy

Hello; I’m Mike, the utter newbie, and I have a small question.

I’m currently working with Asterisk SVN-branch-10-r349045, and I notice that when a DAHDI line hits a hangup() function, the line does indeed hang up, but the function then exits with a non-zero result and the DAHDI line receives a fast busy.

An example from the CLI:

-- Executing [333@LocalSets:3] Hangup("DAHDI/4-1", "") in new stack == Spawn extension (LocalSets, 333, 3) exited non-zero on 'DAHDI/4-1' -- Hanging up on 'DAHDI/4-1' -- Hungup 'DAHDI/4-1'

Any way to get a zero exit and the DAHDI line back to a dial tone?


A zero result will cause the next step in the dialplan to be executed. Every application that detects a hangup of the channel running the pbx really needs to exit non-zero.

Actually, you probably don’t need to invoke hangup explicitly, anyway.

To get a dial tone you need to hangup the phone. It’s nothing to do with the return codes, but rather to do with telling you that you have a dead line.

(I believe the very early Asterisk’s used to go back to s,1 when the callee hungup, and I think there is an option to request this behaviour. However, as you have hungup the caller, this may not help.)

Ah; so the RC of -1 is necessary. All right.

That’s quite understandable, but I’m still stuck with the DAHDI line going fast-busy, which is not what people are used to.
I’ve dug a little deeper, and I see there’s a SoftHangup() command, which generates a RC of zero and allows the dialplan to proceed. I tried using SoftHangup(${EXTEN}) and followed it with a branch back to the start of the main menu, and that works fine. So; that’s one thing figured out, even though it’s not-too terribly useful.

Still can’t figure out a way to sweet-talk the Digium board into going back to off-hook dialtone, though. . . .

I have never tried it, but perhaps you can simulate the behaviour with PlayTones() and WaitExten() or Read().

You, sir, are a genius.

same => n,SoftHangup(${EXTEN})
same => n,Wait(1)
same => n,Goto(LocalSets,s,1)

exten => s,1,NoOp()
same => n,Playtones(dial)
same => n,Set(TIMEOUT(digit)=5)
same => n,WaitExten(10)


It’s a little ticklish, but it works.