Page 181 - Asterisk™: The Future of Telephony
P. 181

If you wish to match on all possible values for any of these arguments, simply put an
               * in for that argument.
               The label argument can be any of the following:

                 • A priority label within the same extension, such as time_has_passed
                 • An extension and a priority within the same context, such as 123,time_has_passed
                 • A context, extension, and priority, such as incoming,123,time_has_passed
               Now that we’ve covered the syntax, let’s look at a couple of examples. The following
               example would match from 9:00 A.M. to 5:59 P.M., on Monday through Friday, on
               any day of the month, in any month of the year:
                   exten => s,1,GotoIfTime(09:00-17:59,mon-fri,*,*?open,s,1)
               If the caller calls during these hours, the call will be sent to the first priority of the s
               extension in the context named open. If the call is made outside of the specified times,
               it will be sent to the next priority of the current extension. This allows you to easily
               branch on multiple times, as shown in the next example (note that you should always
               put your most specific time matches before the least specific ones):
                   ; If it's any hour of the day, on any day of the week,
                   ; during the fourth day of the month, in the month of July,
                   ; we're closed
                   exten => s,1,GotoIfTime(*,*,4,jul?open,s,1)
                   ; During business hours, send calls to the open context
                   exten => s,n,GotoIfTime(09:00-17:59|mon-fri|*|*?open,s,1)
                   exten => s,n,GotoIfTime(09:00-11:59|sat|*|*?open,s,1)
                   ; Otherwise, we're closed
                   exten => s,n,Goto(closed,s,1)


                           If you run into the situation where you ask the question, “But I specified
                           17:58 and it’s now 17:59. Why is it still doing the same thing?” it should
                           be noted that the granularity of the GotoIfTime() application is only to
                           a two-minute period. So if you specify 18:00 as the ending time of a
                           period, the system will continue to perform the same way for an addi-
                           tional minute, until 18:01:59.

               Voicemail

               One of the most popular (or, arguably, unpopular) features of any modern telephone
               system is voicemail. Naturally, Asterisk has a reasonably flexible voicemail system.
               Some of the features of Asterisk’s voicemail system include:
                 • Unlimited password-protected voicemail boxes, each containing mailbox folders
                   for organizing voicemail
                 • Different greetings for busy and unavailable states


                                                                             Voicemail | 153
   176   177   178   179   180   181   182   183   184   185   186