This file is indexed.

/usr/share/svxlink/events.d/TclVoiceMail.tcl is in svxlink-server 14.08.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
###############################################################################
#
# TclVoiceMail module event handlers
#
###############################################################################

#
# This is the namespace in which all functions and variables below will exist.
# The name must match the configuration variable "NAME" in the
# [ModuleTclVoiceMail] section in the configuration file. The name may be
# changed but it must be changed in both places.
#
namespace eval TclVoiceMail {

#
# Check if this module is loaded in the current logic core
#
if {![info exists CFG_ID]} {
  return
}

#
# Extract the module name from the current namespace
#
set module_name [namespace tail [namespace current]]


#
# An "overloaded" playMsg that eliminates the need to write the module name
# as the first argument.
#
#   msg - The message to play
#
proc playMsg {msg} {
  variable module_name
  ::playMsg $module_name $msg
}


#
# A convenience function for printing out information prefixed by the
# module name
#
#   msg - The message to print
#
proc printInfo {msg} {
  variable module_name
  puts "$module_name: $msg"
}


#
# Executed when this module is being activated
#
proc activating_module {} {
  variable module_name
  Module::activating_module $module_name
  playMsg "login"
}


#
# Executed when this module is being deactivated.
#
proc deactivating_module {} {
  variable module_name
  Module::deactivating_module $module_name
}


#
# Executed when the inactivity timeout for this module has expired.
#
proc timeout {} {
  variable module_name
  Module::timeout $module_name
}


#
# Executed when playing of the help message for this module has been requested.
#
proc play_help {} {
  variable module_name
  Module::play_help $module_name
}


#
# Executed when the state of this module should be reported on the radio
# channel. The rules for when this function is called are:
#
# When a module is active:
# * At manual identification the status_report function for the active module is
#   called.
# * At periodic identification no status_report function is called.
#
# When no module is active:
# * At both manual and periodic (long variant) identification the status_report
#   function is called for all modules.
#
proc status_report {} {
  variable users
  variable recdir
  
  #printInfo "status_report called...";
  
  # FIXME: We should not read info directly from the module implementation
  
  set user_list {}
  foreach userid [lsort [array names users]] {
    set call [id2var $userid call]
    if {[llength [glob -nocomplain -directory "$recdir/$call" *_subj.wav]] > 0} {
      lappend user_list $call
    }
  }
  if {[llength $user_list] > 0} {
    playMsg "messages_for"
    foreach call $user_list {
      spellWord $call
      playSilence 250
    }
  }
}


#
# Called when a fatal module error ocurrs after which the module is deactivated
#
proc module_error {} {
  playMsg "operation_failed"
}


#
# Called when the user enters an unknown user ID when a user is checking
# if there are any voice mails available for him.
#
#   userid - The entered user ID
#
proc idle_unknown_userid {userid} {
  spellNumber $userid
  playMsg "unknown_userid"
}


#
# Called, when the module is not active, to announce how many voice mails
# a user have.
#
#   call    - User callsign
#   msg_cnt - The number of messages available
#
proc idle_announce_num_new_messages_for {call msg_cnt} {
  spellWord $call
  playSilence 200
  playMsg $msg_cnt
  playMsg "new_messages"
  playSilence 500
}


#
# Called when the login procedure is aborted.
#
proc login_aborted {} {
  playMsg "aborted"
  playSilence 500
}


#
# Called when login is approved.
#
#   call - User callsign
#
proc login_ok {call} {
  spellWord $call
  playMsg "login_ok"
  playSilence 500
  logged_in_menu_help
}


#
# Called when login fails due to entering an invalid user ID
#
#   userid - The entered, invalid, user ID
#
proc login_failed_unknown_userid {userid} {
  playMsg "wrong_userid_or_password"
  playSilence 500
  playMsg "login"
}


#
# Called when login fails due to entering the wrong password
#
#   call     - User callsign
#   userid   - User ID
#   password - The entered password
#
proc login_failed_wrong_password {call userid password} {
  playMsg "wrong_userid_or_password"
  playSilence 500
  playMsg "login"
}


#
# Called when the logged in menu help should be played
#
proc logged_in_menu_help {} {
  playSubcommands "TclVoiceMail" "logged_in_menu"
}


#
# Called when an invalid command is entered in the "logged in" mode.
#
#   cmd - The entered, invalid, command
#
proc logged_in_unknown_command {cmd} {
  playNumber $cmd
  playMsg "unknown_command"
  playSilence 500
  logged_in_menu_help
}


#
# Called when a recording is aborted before it's finished.
#
proc rec_aborted {} {
  playMsg "aborted"
  playSilence 500
  logged_in_menu_help
}


#
# Called when the user should enter the recipient for a voice mail.
#
proc rec_enter_rcpt {} {
  playMsg "rec_enter_rcpt"
}


#
# Called when an unknown recipient user ID is entered.
#
#   userid - The entered, invalid, user ID
#
proc rec_enter_rcpt_unknown_userid {userid} {
  spellNumber $userid
  playMsg "unknown_userid"
  playSilence 500
  rec_enter_rcpt
}


#
# Called when starting to record the subject after entering the recipient.
#
#   call - The callsign of the recipient
#
proc rec_sending_to {call} {
  playMsg "rec_sending_to"
  spellWord $call
  playSilence 500
  playMsg "rec_subject"
}


#
# Called when the recording of the message body starts.
#
proc rec_message {} {
  playMsg "rec_message"
}


#
# Called when a voice mail recording has been finished.
#
proc rec_done {} {
  playMsg "rec_done"
  playSilence 500
}


#
# This is not an event but a helper to play back a message specified by the
# function argument "basename". The basename is the full path to the voice
# mail file excluding the end of the filename (_subj.wav and _mesg.wav).
#
#   basename - The basename of the message and subject file
#
proc playMessage {basename} {
  playFile "$basename\_subj.wav"
  playSilence 1000
  playFile "$basename\_mesg.wav"
}


#
# Called when the user request playing of the next new message.
#
#   msg_cnt  - The total number of messages available for this user
#   basename - The basename of the message file (see playMessage)
#
proc play_next_new_message {msg_cnt {basename ""}} {
  playNumber $msg_cnt;
  playMsg "new_messages"
  playSilence 500;
  if {$msg_cnt > 0} {
    playMessage $basename
    playSilence 1000
    pnm_menu_help
  }
}


#
# Called when the pnm menu help should be played
#
proc pnm_menu_help {} {
  playSubcommands "TclVoiceMail" "pnm_menu"
}


#
# Called when aborting from the menu after listening to a message
#
proc pnm_aborted {} {
  playMsg "aborted"
  playSilence 500
  logged_in_menu_help
}


#
# Called when an invalid command is entered after listening to a message
#
#   cmd - The entered, invalid, command
#
proc pnm_unknown_command {cmd} {
  playNumber $cmd
  playMsg "unknown_command"
  playSilence 500
  pnm_menu_help
}


#
# Called when a delete is requested after listening to a message
#
proc pnm_delete {} {
  playMsg "message_deleted"
  playSilence 500
  logged_in_menu_help
}


#
# Called when "reply and delete" is requested after listening to a message
#
proc pnm_reply_and_delete {} {
  playMsg "message_deleted"
  playSilence 500
  pnm_menu_help
}


#
# Called when "play again" is requested after listening to a message
#
#   basename - The baename of the message file to replay (see playMessage)
#
proc pnm_play_again {basename} {
  playMessage $basename
  playSilence 1000
  pnm_menu_help
}


# end of namespace
}


#
# This file has not been truncated
#