[asterisk-users] Adding DND to dialplan

Bruce Reeves breeves at nortex-networks.com
Tue Apr 3 08:12:46 MST 2007


Brian,

DND is not real hard. You basicly want to to note the extension is set to
DND and then when someone calls that extension you check for DND status and
if it is yes then you go on to voicemail instead of dial. It sounds like you
are miss understanding the dialplan and how to use it. In your sample, do
the macros user-callerid and hangupcall exist? Do the sound files you
specified exist in var/lib/asterisk/sounds? A simple DND would look like so:

exten => *73,1,Answer()
exten => *73,n,Wait(0.5)
exten => *73,n,Set(DB(${CALLERID(number)}/DND)=1)
exten => *73,n,Playback(do-not-disturb)
exten => *73,n,Playback(enabled)
exten => *73,n,Hangup()

and then

When someone calls say extension 1000 I would have a macro check for :

exten => s,n,Set(DNDStatus=$["${DB(1000/DND)}" = "1"]) <= returns a 1 if
enabled or a 0
exten => s,n,GoToIf($[${DNDStatus} = 1]?DND)
exten => s,n(DND),Voicemail(1000 at default,u)


On 4/3/07, Brian McEntire <brian.mcentire at gmail.com> wrote:
>
> Hello -
> I've read Asterisk should be able to activate a do not disturb feature
> to turn off the ringers on extensions. I checked the wiki and can't
> find documentation for how to do it.
>
> Here's my attempt, added to extensions.conf:
>
> [dnd-on]
> exten => _#78,1,Answer
> exten => _#78,n,Wait(1)
> exten => _#78,n,Macro(user-callerid,)
> exten => _#78,n,Set(DB(DND/${CALLERID(number)})=YES)
> exten => _#78,n,Playback(do-not-disturb&activated)
> exten => _#78,n,Macro(hangupcall,)
>
> [dnd-off]
> exten => _#79,1,Answer
> exten => _#79,n,Wait(1)
> exten => _#79,n,Macro(user-callerid,)
> exten => _#79,n,dbDel(DND/${CALLERID(number)})
> exten => _#79,n,Playback(do-not-disturb&de-activated)
> exten => _#79,n,Macro(hangupcall,)
>
> ;further down
> include => dnd-on
> include => dnd-off
>
> - - -
>
> Monitoring asterisk from the CLI, when I dial #78 on an extension, I
> just get a fast busy signal and this information is reported on the
> CLI:
>
> Apr  3 10:41:33 WARNING[30702]: app_macro.c:144 macro_exec: No such
> context 'macro-user-callerid' for macro 'user-callerid'
> Apr  3 10:41:33 WARNING[30702]: func_db.c:97 function_db_write: DB
> requires an argument, DB(<family>/<key>)=value
> Apr  3 10:41:33 WARNING[30702]: file.c:504 ast_openstream_full: File
> do-not-disturb does not exist in any format
> Apr  3 10:41:33 WARNING[30702]: file.c:816 ast_streamfile: Unable to
> open do-not-disturb (format unknown): No such file or directory
> Apr  3 10:41:33 WARNING[30702]: app_playback.c:106 playback_exec:
> ast_streamfile failed on Zap/2-1 for do-not-disturb&activated
> Apr  3 10:41:33 WARNING[30702]: file.c:504 ast_openstream_full: File
> activated does not exist in any format
> Apr  3 10:41:33 WARNING[30702]: file.c:816 ast_streamfile: Unable to
> open activated (format unknown): No such file or directory
> Apr  3 10:41:33 WARNING[30702]: app_playback.c:106 playback_exec:
> ast_streamfile failed on Zap/2-1 for do-not-disturb&activated
> Apr  3 10:41:33 WARNING[30702]: app_macro.c:144 macro_exec: No such
> context 'macro-hangupcall' for macro 'hangupcall'
>
> - - -
>
> Any tips?
>
> All I really want to do is turn off the ringers / do not ring
> extenstions when I've activated DND. Right now I'm just using a hack
> which is to shutdown asterisk altogether when I don't want the phones
> to ring, which of course also prevents dialing out, it's a
> sledgehammer approach and I'm looking for something more typical.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Bruce Reeves
Nortex Networks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070403/e8801257/attachment.htm


More information about the asterisk-users mailing list