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
About the system:
bell*CLI> core show version
Asterisk 1.4.23.1 built by root @ bell on a i686 running Linux on
2009-01-26 01:57:36 UTC
GUI-version : SVN-branch-2.0-r4489 (It's the Digium GUI)
Thanks!
Haim.
In a nut shell the CHANNEL variable is just that variable. It has a call leg id attached to it so if that is what you are storing it will change everytime you create a new channel. For example if I place a call Thru SIP channel polycom1 the channel is: SIP/polycom1-23a3bc, You could look at parsing the channel name out but that may not work depending on your peer names. You may instead try using the EXTEN variable and testing for it when they dial. ? Kindly consider the environment before printing this e-mail.> -----Original Message----- > From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users- > bounces at lists.digium.com] On Behalf Of Haim Dimer > Sent: Thursday, February 26, 2009 6:34 PM > To: asterisk-users at lists.digium.com > Subject: [asterisk-users] Question about Do Not Disturb > > 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 > > About the system: > > bell*CLI> core show version > Asterisk 1.4.23.1 built by root @ bell on a i686 running Linux on > 2009-01-26 01:57:36 UTC > > GUI-version : SVN-branch-2.0-r4489 (It's the Digium GUI) > > Thanks! > > Haim. > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > -- > This message was scanned by Connected.Net and is believed to be clean.-- This message was scanned by Connected.Net and is believed to be clean.
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=1I'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
Thank you Gordon and Alexander. With your help, I got it working like
so:
[app-dnd-on]
exten => *78,1,Answer
exten => *78,n,NoOp(${CALLERID(num)} is going on DND ACTIVE)
exten => *78,n,Set(DB(DND/${CALLERID(num)})=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,Playback(do-not-disturb&de-activated)
exten => *79,n,Hangup
[...]
exten => _XXXX,1,Set(DND=${DB(DND/${EXTEN})})
exten => _XXXX,n,NoOp(For ${EXTEN}, DND is ${DND})
exten => _XXXX,n,GotoIf(${DND}?unavailable)
[... some normal dialing stuff ...]
exten => _XXXX,n(unavailable),Wait(2)
exten => _XXXX,n,Congestion
Works like a charm. Thank you again,
Haim.