-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtim.conf
71 lines (56 loc) · 2.82 KB
/
tim.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[TIM]
; Paul Seward - https://github.com/paulseward/asterisk-tim
exten => s,1,Set(tz=Europe/London) ; Change this to be your timezone, see /usr/share/zoneinfo for other options
; Check the voice parameter matches one of the voices available, default to PAT
exten => s,n,Set(VOICE=${FILTER(ABCDEFGHIJKLMNOPQRSTUVWXYZ,${TOUPPER(${ARG1})})})
exten => s,n,GotoIf($["${VOICE}":"GORDON"]?set_gordon)
exten => s,n,GotoIf($["${VOICE}":"ETHEL"]?set_ethel)
exten => s,n,GotoIf($["${VOICE}":"PAT"]?set_pat)
exten => s,n,Goto(set_pat)
; Use Gordon Gow (Australia)
exten => s,n(set_gordon),Set(VOICE="gordon_gow")
exten => s,n,Goto(tim_ringtone)
; Use Ethel Cain (UK) - AUDIO NOT YET AVAILABLE so return congestion tone
; exten => s,n(set_ethel),Set(VOICE="ethel_cain")
; exten => s,n,Goto(tim_ringtone)
;
exten => s,n(set_ethel),Progress
exten => s,n,Playtones(congestion)
exten => s,n,Wait(10)
exten => s,n,Hangup
; Use Pat Simmons (UK)
exten => s,n(set_pat),Set(VOICE="pat_simmons")
exten => s,n,Goto(tim_ringtone)
; Send some progress tones (UK ring tone)
exten => s,n(tim_ringtone),Progress()
exten => s,n,Playtones(400*25/400,0/200,400*25/400,0/2000)
; We want to start announcing on a 10second boundary, so work out when the next one is
exten => s,n,Set(FutureTime=$[${EPOCH} + 10])
exten => s,n,Set(FutureTimeMod=$[${FutureTime} % 10])
exten => s,n,Set(SpeakTime=$[${FutureTime} - ${FutureTimeMod}])
exten => s,n,Set(MaxConnectTime=$[${SpeakTime} + 180])
; Spin our heels until it's time to start talking
exten => s,n(tim_countdown_start),GotoIf($[${SpeakTime}-${EPOCH} <= 1]?tim_answer:tim_countdown_wait)
exten => s,n(tim_countdown_wait),wait(1)
exten => s,n,goto(tim_countdown_start)
; Off we go!
exten => s,n(tim_answer),Answer()
exten => s,n,wait(1)
exten => s,n(tim_saytime),Set(SpeakTime=$[${SpeakTime} + 10])
; Work out what time we're announcing
exten => s,n,set(TimHours=${STRFTIME(${SpeakTime},${tz},%I)}) ; Hour in 01-12 form
exten => s,n,set(TimMins=${STRFTIME(${SpeakTime},${tz},%M)}) ; Minute in 00-59 form
exten => s,n,set(TimSecs=${STRFTIME(${SpeakTime},${tz},%S)}) ; Seconds in 00-59 form
; Convert 00 minutes to "oclock"
exten => s,n,set(TimMins=${IF($[ "${TimMins}" = "00"] ? "oclock" : ${TimMins})})
; Convert 00 seconds to "precisely"
exten => s,n,set(TimSecs=${IF($[ "${TimSecs}" = "00"] ? "precisely" : and_${TimSecs}_seconds)})
; Announce the time...
exten => s,n,playback(TIM/${VOICE}/the_phrase) ; "At the third stroke"
exten => s,n,playback(TIM/${VOICE}/hour_${TimHours}) ; "it will be three"
exten => s,n,playback(TIM/${VOICE}/${TimMins}) ; "45"
exten => s,n,playback(TIM/${VOICE}/${TimSecs}) ; "and 30 seconds"
exten => s,n,playback(TIM/${VOICE}/pips) ; "pip, pip, pip"
; And go back to the start of playback
exten => s,n,GotoIf($[${EPOCH} >= ${MaxConnectTime}]?tim_hangup:tim_saytime)
exten => s,n(tim_hangup),Hangup()