[asterisk-users] Question about Do Not Disturb

Gordon Henderson gordon+asterisk at drogon.net
Fri Feb 27 03:41:11 CST 2009


On Thu, 26 Feb 2009, Haim Dimer wrote:

> Hello,
>
> Some of my users have phones lacking a DND button. I need to provide
> an extension they can dial that will put them in DND, i.e. tell the
> server not to send them any calls until they get off the DND.
>
> I've researched it for almost 3 days now and tried a range of
> configurations. I'm hoping somebody here has an answer. Currently, I
> have this in extensions.conf
>
> [app-dnd-on]
> exten => *78,1,Answer
> exten => *78,n,NoOp(${CALLERID(num)} channel ${CHANNEL} is going on
> DND ACTIVE)
> exten => *78,n,Set(DB(DND/${CALLERID(num)})=On)
> exten => *78,n,UserEvent(ASTDB|Family: DND^Channel: ${CHANNEL} ^Value:
> On)
> exten => *78,n,Playback(do-not-disturb&activated)
> exten => *78,n,Hangup
>
> [app-dnd-off]
> exten => *79,1,Answer
> exten => *79,n,NoOp(${CALLERID(num)} is going OFF DND)
> exten => *79,n,DBdel(DND/${CALLERID(num)})
> exten => *79,n,UserEvent(ASTDB|Family: DND^Channel: ${CHANNEL} ^Value:
> ^)
> exten => *79,n,Playback(do-not-disturb&de-activated)
> exten => *79,n,Hangup
>
> Using the above config, if I dial *78 I hear Allison's voice telling
> me that do not disturb is activated but I can still be called (either
> directly or as part of a queue). BTW, there are many people on the
> wiki stuck with the same problem : http://www.voip-info.org/wiki/index.php?page_id=787&tk=c7f21c26a40ee72393d7&comments_page=1

I've no idea what your UserEvent is doing other than adding more into the 
astdb, but you've not done anything to actually act on the astDB values.

All you're doing here is changing an astDB value on or off. Asterisk 
doesn't look at the astDB when it places a call - thats for you to do.

In your call-handling code, you need to read the astDB value then decided 
whether to dial the extension or not - and you're not doing this, or if 
you are you haven't put the code here.

So I have a rather large macro that handles internal calls and it has a 
section for DND:

; Check for Do Not Disturb

exten => s,n,Set(DND=${DB(${MACRO_EXTEN}/doNotDisturb)})
exten => s,n,GotoIf(${DND}?:doneDoNotDisturb)
exten => s,n,Wait(90)
exten => s,n,Hangup()
exten => s,n(doneDoNotDisturb),Noop(Carrying on after DO NOT DISTURB Check)


So in my case, if an extension has the "doNotDisturb" flag set 
(manipulated by code similar to your above), then it basically keeps the 
caller ringing for 90 seconds then hands up...

Gordon



More information about the asterisk-users mailing list