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.
Brian McEntire wrote:> 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?Read the warnings. Apart from that, what you do is good. Right before you Dial() to a user you need to check the value you have stored in DB(DND/${EXTEN}) and if it's "YES" simply do not Dial(). Regards, Philipp -- amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de Let's use IT to solve problems and not to create new ones. Asterisk? -> http://www.das-asterisk-buch.de Gesch?ftsf?hrer: Stefan Wintermeyer Handelsregister: Neuwied B 14998
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@default,u) On 4/3/07, Brian McEntire <brian.mcentire@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
Brian McEntire wrote:> Hello - > I've read Asterisk should be able to activate a do not disturb featureInstead of using 2 extensions, you can get away with just one. Check the database entry at the start, if it's already set, remove it. If it's not there, add it. [dnd] ; ************************************** ; Do not disturb can be set via Asterisk ; instead of the phones by dialing this ; number. ; ************************************** exten => 79*,1,Set(CALLBACK=${DB(DND/${CALLERIDNUM})}) exten => 79*,2,GotoIf($["${CALLBACK}" = "YES"]?79*,3:79*,101) exten => 79*,3,Set(DB(DND/${CALLERIDNUM})=NO) exten => 79*,4,Playback(local/stutter) exten => 79*,5,Playback(de-activated) exten => 79*,6,Hangup() exten => 79*,101,Set(DB(DND/${CALLERIDNUM})=YES) exten => 79*,102,Playback(local/stutter) exten => 79*,103,Playback(activated) exten => 79*,104,Hangup() Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."