Debian Codegraph @

agi/agimodels/commands.go

raw symbols SCIP
1 // Code generated by xmlgen. DO NOT EDIT.
2
3 package agimodels
4
5 // GosubCommand Cause the channel to execute the specified dialplan subroutine.
6 //
7 // Cause the channel to execute the specified dialplan subroutine, returning to the dialplan with execution of a Return().
8 type GosubCommand struct {
9 Context string
10 Extension string
11 Priority int
12 OptionalArgument *string
13 }
14
15 func (cmd GosubCommand) Command() (string, error) {
16 s := []interface{}{cmd.CommandString(), cmd.Context, cmd.Extension, cmd.Priority, cmd.OptionalArgument}
17 return joinCommand(s), nil
18 }
19 func (cmd GosubCommand) CommandString() string {
20 return "GOSUB"
21 }
22
23 func (cmd GosubCommand) SetOptionalArgument(v string) GosubCommand {
24 cmd.OptionalArgument = &v
25 return cmd
26 }
27
28 func (c *Client) Gosub(context string, extension string, priority int) Response {
29 return c.Handler.Command(GosubCommand{
30 Context: context,
31 Extension: extension,
32 Priority: priority,
33 })
34 }
35
36 // AnswerCommand Answer channel
37 //
38 // Answers channel if not already in answer state. Returns `-1` on channel failure, or `0` if successful.
39 type AnswerCommand struct {
40 }
41
42 func (cmd AnswerCommand) Command() (string, error) {
43 s := []interface{}{cmd.CommandString()}
44 return joinCommand(s), nil
45 }
46 func (cmd AnswerCommand) CommandString() string {
47 return "ANSWER"
48 }
49
50 func (c *Client) Answer() Response {
51 return c.Handler.Command(AnswerCommand{})
52 }
53
54 // AsyncAGIBreakCommand Interrupts Async AGI
55 //
56 // Interrupts expected flow of Async AGI commands and returns control to previous source (typically, the PBX dialplan).
57 type AsyncAGIBreakCommand struct {
58 }
59
60 func (cmd AsyncAGIBreakCommand) Command() (string, error) {
61 s := []interface{}{cmd.CommandString()}
62 return joinCommand(s), nil
63 }
64 func (cmd AsyncAGIBreakCommand) CommandString() string {
65 return "ASYNCAGI BREAK"
66 }
67
68 func (c *Client) AsyncAGIBreak() Response {
69 return c.Handler.Command(AsyncAGIBreakCommand{})
70 }
71
72 // ChannelStatusCommand Returns status of the connected channel.
73 //
74 // Returns the status of the specified channelname . If no channel name is given then returns the status of the current channel.
75 //
76 // Return values:
77 type ChannelStatusCommand struct {
78 ChannelName *string
79 }
80
81 func (cmd ChannelStatusCommand) Command() (string, error) {
82 s := []interface{}{cmd.CommandString(), cmd.ChannelName}
83 return joinCommand(s), nil
84 }
85 func (cmd ChannelStatusCommand) CommandString() string {
86 return "CHANNEL STATUS"
87 }
88
89 func (cmd ChannelStatusCommand) SetChannelName(v string) ChannelStatusCommand {
90 cmd.ChannelName = &v
91 return cmd
92 }
93
94 func (c *Client) ChannelStatus() Response {
95 return c.Handler.Command(ChannelStatusCommand{})
96 }
97
98 // ControlStreamFileCommand Sends audio file on channel and allows the listener to control the stream.
99 //
100 // Send the given file, allowing playback to be controlled by the given digits, if any. Use double quotes for the digits if you wish none to be permitted. If offsetms is provided then the audio will seek to offsetms before play starts. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or `-1` on error or if the channel was disconnected. Returns the position where playback was terminated as endpos.
101 //
102 // It sets the following channel variables upon completion:
103 type ControlStreamFileCommand struct {
104 // FileName The file extension must not be included in the filename.
105 FileName string
106 EscapeDigits string
107 SkipMS *int
108 Ffchar *string // default to #
109 Rewchr *string // default to *
110 Pausechr *string
111 // OffsetMS Offset, in milliseconds, to start the audio playback
112 OffsetMS *int
113 }
114
115 func (cmd ControlStreamFileCommand) Command() (string, error) {
116 s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.SkipMS, cmd.Ffchar, cmd.Rewchr, cmd.Pausechr, cmd.OffsetMS}
117 return joinCommand(s), nil
118 }
119 func (cmd ControlStreamFileCommand) CommandString() string {
120 return "CONTROL STREAM FILE"
121 }
122
123 func (cmd ControlStreamFileCommand) SetSkipMS(v int) ControlStreamFileCommand {
124 cmd.SkipMS = &v
125 return cmd
126 }
127 func (cmd ControlStreamFileCommand) SetFfchar(v string) ControlStreamFileCommand {
128 cmd.Ffchar = &v
129 return cmd
130 }
131 func (cmd ControlStreamFileCommand) SetRewchr(v string) ControlStreamFileCommand {
132 cmd.Rewchr = &v
133 return cmd
134 }
135 func (cmd ControlStreamFileCommand) SetPausechr(v string) ControlStreamFileCommand {
136 cmd.Pausechr = &v
137 return cmd
138 }
139 func (cmd ControlStreamFileCommand) SetOffsetMS(v int) ControlStreamFileCommand {
140 cmd.OffsetMS = &v
141 return cmd
142 }
143
144 func (c *Client) ControlStreamFile(fileName string, escapeDigits string) Response {
145 return c.Handler.Command(ControlStreamFileCommand{
146 FileName: fileName,
147 EscapeDigits: escapeDigits,
148 })
149 }
150
151 // DatabaseDelCommand Removes database key/value
152 //
153 // Deletes an entry in the Asterisk database for a given family and key .
154 //
155 // Returns `1` if successful, `0` otherwise.
156 type DatabaseDelCommand struct {
157 Family string
158 Key string
159 }
160
161 func (cmd DatabaseDelCommand) Command() (string, error) {
162 s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key}
163 return joinCommand(s), nil
164 }
165 func (cmd DatabaseDelCommand) CommandString() string {
166 return "DATABASE DEL"
167 }
168
169 func (c *Client) DatabaseDel(family string, key string) Response {
170 return c.Handler.Command(DatabaseDelCommand{
171 Family: family,
172 Key: key,
173 })
174 }
175
176 // DatabaseDelTreeCommand Removes database keytree/value
177 //
178 // Deletes a family or specific keytree within a family in the Asterisk database.
179 //
180 // Returns `1` if successful, `0` otherwise.
181 type DatabaseDelTreeCommand struct {
182 Family string
183 KeyTree *string
184 }
185
186 func (cmd DatabaseDelTreeCommand) Command() (string, error) {
187 s := []interface{}{cmd.CommandString(), cmd.Family, cmd.KeyTree}
188 return joinCommand(s), nil
189 }
190 func (cmd DatabaseDelTreeCommand) CommandString() string {
191 return "DATABASE DELTREE"
192 }
193
194 func (cmd DatabaseDelTreeCommand) SetKeyTree(v string) DatabaseDelTreeCommand {
195 cmd.KeyTree = &v
196 return cmd
197 }
198
199 func (c *Client) DatabaseDelTree(family string) Response {
200 return c.Handler.Command(DatabaseDelTreeCommand{
201 Family: family,
202 })
203 }
204
205 // DatabaseGetCommand Gets database value
206 //
207 // Retrieves an entry in the Asterisk database for a given family and key .
208 //
209 // Returns `0` if key is not set. Returns `1` if key is set and returns the variable in parenthesis.
210 //
211 // Example return code: 200 result=1 (testvariable)
212 type DatabaseGetCommand struct {
213 Family string
214 Key string
215 }
216
217 func (cmd DatabaseGetCommand) Command() (string, error) {
218 s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key}
219 return joinCommand(s), nil
220 }
221 func (cmd DatabaseGetCommand) CommandString() string {
222 return "DATABASE GET"
223 }
224
225 func (c *Client) DatabaseGet(family string, key string) Response {
226 return c.Handler.Command(DatabaseGetCommand{
227 Family: family,
228 Key: key,
229 })
230 }
231
232 // DatabasePutCommand Adds/updates database value
233 //
234 // Adds or updates an entry in the Asterisk database for a given family , key , and value .
235 //
236 // Returns `1` if successful, `0` otherwise.
237 type DatabasePutCommand struct {
238 Family string
239 Key string
240 Value string
241 }
242
243 func (cmd DatabasePutCommand) Command() (string, error) {
244 s := []interface{}{cmd.CommandString(), cmd.Family, cmd.Key, cmd.Value}
245 return joinCommand(s), nil
246 }
247 func (cmd DatabasePutCommand) CommandString() string {
248 return "DATABASE PUT"
249 }
250
251 func (c *Client) DatabasePut(family string, key string, value string) Response {
252 return c.Handler.Command(DatabasePutCommand{
253 Family: family,
254 Key: key,
255 Value: value,
256 })
257 }
258
259 // ExecCommand Executes a given Application
260 //
261 // Executes application with given options .
262 //
263 // Returns whatever the application returns, or `-2` on failure to find application .
264 type ExecCommand struct {
265 Application string
266 Options string
267 }
268
269 func (cmd ExecCommand) Command() (string, error) {
270 s := []interface{}{cmd.CommandString(), cmd.Application, cmd.Options}
271 return joinCommand(s), nil
272 }
273 func (cmd ExecCommand) CommandString() string {
274 return "EXEC"
275 }
276
277 func (c *Client) Exec(application string, options string) Response {
278 return c.Handler.Command(ExecCommand{
279 Application: application,
280 Options: options,
281 })
282 }
283
284 // GetDataCommand Prompts for DTMF on a channel
285 //
286 // Stream the given file , and receive DTMF data.
287 //
288 // Returns the digits received from the channel at the other end.
289 type GetDataCommand struct {
290 File string
291 Timeout *int
292 Maxdigits *string
293 }
294
295 func (cmd GetDataCommand) Command() (string, error) {
296 s := []interface{}{cmd.CommandString(), cmd.File, cmd.Timeout, cmd.Maxdigits}
297 return joinCommand(s), nil
298 }
299 func (cmd GetDataCommand) CommandString() string {
300 return "GET DATA"
301 }
302
303 func (cmd GetDataCommand) SetTimeout(v int) GetDataCommand {
304 cmd.Timeout = &v
305 return cmd
306 }
307 func (cmd GetDataCommand) SetMaxdigits(v string) GetDataCommand {
308 cmd.Maxdigits = &v
309 return cmd
310 }
311
312 func (c *Client) GetData(file string) Response {
313 return c.Handler.Command(GetDataCommand{
314 File: file,
315 })
316 }
317
318 // GetFullVariableCommand Evaluates a channel expression
319 //
320 // Evaluates the given expression against the channel specified by channelname , or the current channel if channelname is not provided.
321 //
322 // Unlike GET VARIABLE, the expression is processed in a manner similar to dialplan evaluation, allowing complex and built-in variables to be accessed, e.g. `The time is ${EPOCH} `
323 //
324 // Returns `0` if no channel matching channelname exists, `1` otherwise.
325 //
326 // Example return code: 200 result=1 (The time is 1578493800)
327 type GetFullVariableCommand struct {
328 Expression string
329 ChannelName *string
330 }
331
332 func (cmd GetFullVariableCommand) Command() (string, error) {
333 s := []interface{}{cmd.CommandString(), cmd.Expression, cmd.ChannelName}
334 return joinCommand(s), nil
335 }
336 func (cmd GetFullVariableCommand) CommandString() string {
337 return "GET FULL VARIABLE"
338 }
339
340 func (cmd GetFullVariableCommand) SetChannelName(v string) GetFullVariableCommand {
341 cmd.ChannelName = &v
342 return cmd
343 }
344
345 func (c *Client) GetFullVariable(expression string) Response {
346 return c.Handler.Command(GetFullVariableCommand{
347 Expression: expression,
348 })
349 }
350
351 // GetOptionCommand Stream file, prompt for DTMF, with timeout.
352 //
353 // Behaves similar to STREAM FILE but used with a timeout option.
354 type GetOptionCommand struct {
355 FileName string
356 EscapeDigits string
357 Timeout *int
358 }
359
360 func (cmd GetOptionCommand) Command() (string, error) {
361 s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.Timeout}
362 return joinCommand(s), nil
363 }
364 func (cmd GetOptionCommand) CommandString() string {
365 return "GET OPTION"
366 }
367
368 func (cmd GetOptionCommand) SetTimeout(v int) GetOptionCommand {
369 cmd.Timeout = &v
370 return cmd
371 }
372
373 func (c *Client) GetOption(fileName string, escapeDigits string) Response {
374 return c.Handler.Command(GetOptionCommand{
375 FileName: fileName,
376 EscapeDigits: escapeDigits,
377 })
378 }
379
380 // GetVariableCommand Gets a channel variable.
381 //
382 // Returns `0` if variablename is not set. Returns `1` if variablename is set and returns the variable in parentheses.
383 //
384 // Example return code: 200 result=1 (testvariable)
385 type GetVariableCommand struct {
386 VariableName string
387 }
388
389 func (cmd GetVariableCommand) Command() (string, error) {
390 s := []interface{}{cmd.CommandString(), cmd.VariableName}
391 return joinCommand(s), nil
392 }
393 func (cmd GetVariableCommand) CommandString() string {
394 return "GET VARIABLE"
395 }
396
397 func (c *Client) GetVariable(variableName string) Response {
398 return c.Handler.Command(GetVariableCommand{
399 VariableName: variableName,
400 })
401 }
402
403 // HangupCommand Hangup a channel.
404 //
405 // Hangs up the specified channel. If no channel name is given, hangs up the current channel
406 type HangupCommand struct {
407 ChannelName *string
408 }
409
410 func (cmd HangupCommand) Command() (string, error) {
411 s := []interface{}{cmd.CommandString(), cmd.ChannelName}
412 return joinCommand(s), nil
413 }
414 func (cmd HangupCommand) CommandString() string {
415 return "HANGUP"
416 }
417
418 func (cmd HangupCommand) SetChannelName(v string) HangupCommand {
419 cmd.ChannelName = &v
420 return cmd
421 }
422
423 func (c *Client) Hangup() Response {
424 return c.Handler.Command(HangupCommand{})
425 }
426
427 // NoopCommand Does nothing.
428 //
429 // Does nothing.
430 type NoopCommand struct {
431 }
432
433 func (cmd NoopCommand) Command() (string, error) {
434 s := []interface{}{cmd.CommandString()}
435 return joinCommand(s), nil
436 }
437 func (cmd NoopCommand) CommandString() string {
438 return "NOOP"
439 }
440
441 func (c *Client) Noop() Response {
442 return c.Handler.Command(NoopCommand{})
443 }
444
445 // ReceiveCharCommand Receives one character from channels supporting it.
446 //
447 // Receives a character of text on a channel. Most channels do not support the reception of text. Returns the decimal value of the character if one is received, or `0` if the channel does not support text reception. Returns `-1` only on error/hangup.
448 type ReceiveCharCommand struct {
449 // Timeout The maximum time to wait for input in milliseconds, or `0` for infinite. Most channels
450 Timeout int
451 }
452
453 func (cmd ReceiveCharCommand) Command() (string, error) {
454 s := []interface{}{cmd.CommandString(), cmd.Timeout}
455 return joinCommand(s), nil
456 }
457 func (cmd ReceiveCharCommand) CommandString() string {
458 return "RECEIVE CHAR"
459 }
460
461 func (c *Client) ReceiveChar(timeout int) Response {
462 return c.Handler.Command(ReceiveCharCommand{
463 Timeout: timeout,
464 })
465 }
466
467 // ReceiveTextCommand Receives text from channels supporting it.
468 //
469 // Receives a string of text on a channel. Most channels do not support the reception of text. Returns `-1` for failure or `1` for success, and the string in parenthesis.
470 type ReceiveTextCommand struct {
471 // Timeout The timeout to be the maximum time to wait for input in milliseconds, or `0` for infinite.
472 Timeout int
473 }
474
475 func (cmd ReceiveTextCommand) Command() (string, error) {
476 s := []interface{}{cmd.CommandString(), cmd.Timeout}
477 return joinCommand(s), nil
478 }
479 func (cmd ReceiveTextCommand) CommandString() string {
480 return "RECEIVE TEXT"
481 }
482
483 func (c *Client) ReceiveText(timeout int) Response {
484 return c.Handler.Command(ReceiveTextCommand{
485 Timeout: timeout,
486 })
487 }
488
489 // RecordFileCommand Records to a given file.
490 //
491 // Record to a file until a given dtmf digit in the sequence is received. Returns `-1` on hangup or error. The format will specify what kind of file will be recorded. The timeout is the maximum record time in milliseconds, or `-1` for no timeout . offset samples is optional, and, if provided, will seek to the offset without exceeding the end of the file. beep can take any value, and causes Asterisk to play a beep to the channel that is about to be recorded. silence is the number of seconds of silence allowed before the function returns despite the lack of dtmf digits or reaching timeout . silence value must be preceded by `s=` and is also optional.
492 type RecordFileCommand struct {
493 // FileName The destination filename of the recorded audio.
494 FileName string
495 // Format The audio format in which to save the resulting file.
496 Format string
497 // EscapeDigits The DTMF digits that will terminate the recording process.
498 EscapeDigits string
499 // Timeout The maximum recording time in milliseconds. Set to -1 for no limit.
500 Timeout int
501 // OffsetSamples Causes the recording to first seek to the specified offset before recording begins.
502 OffsetSamples *string
503 // Beep Causes Asterisk to play a beep as recording begins. This argument can take any value.
504 Beep *string
505 // SSilence The number of seconds of silence that are permitted before the recording is terminated, regardless of the escape_digits or timeout arguments. If specified, this parameter must be preceded by `s=`.
506 SSilence *string
507 }
508
509 func (cmd RecordFileCommand) Command() (string, error) {
510 s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.Format, cmd.EscapeDigits, cmd.Timeout, cmd.OffsetSamples, cmd.Beep, cmd.SSilence}
511 return joinCommand(s), nil
512 }
513 func (cmd RecordFileCommand) CommandString() string {
514 return "RECORD FILE"
515 }
516
517 func (cmd RecordFileCommand) SetOffsetSamples(v string) RecordFileCommand {
518 cmd.OffsetSamples = &v
519 return cmd
520 }
521 func (cmd RecordFileCommand) SetBeep(v string) RecordFileCommand {
522 cmd.Beep = &v
523 return cmd
524 }
525 func (cmd RecordFileCommand) SetSSilence(v string) RecordFileCommand {
526 cmd.SSilence = &v
527 return cmd
528 }
529
530 func (c *Client) RecordFile(fileName string, format string, escapeDigits string, timeout int) Response {
531 return c.Handler.Command(RecordFileCommand{
532 FileName: fileName,
533 Format: format,
534 EscapeDigits: escapeDigits,
535 Timeout: timeout,
536 })
537 }
538
539 // SayAlphaCommand Says a given character string.
540 //
541 // Say a given character string, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
542 type SayAlphaCommand struct {
543 Number string
544 EscapeDigits string
545 }
546
547 func (cmd SayAlphaCommand) Command() (string, error) {
548 s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits}
549 return joinCommand(s), nil
550 }
551 func (cmd SayAlphaCommand) CommandString() string {
552 return "SAY ALPHA"
553 }
554
555 func (c *Client) SayAlpha(number string, escapeDigits string) Response {
556 return c.Handler.Command(SayAlphaCommand{
557 Number: number,
558 EscapeDigits: escapeDigits,
559 })
560 }
561
562 // SayDigitsCommand Says a given digit string.
563 //
564 // Say a given digit string, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
565 type SayDigitsCommand struct {
566 Number string
567 EscapeDigits string
568 }
569
570 func (cmd SayDigitsCommand) Command() (string, error) {
571 s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits}
572 return joinCommand(s), nil
573 }
574 func (cmd SayDigitsCommand) CommandString() string {
575 return "SAY DIGITS"
576 }
577
578 func (c *Client) SayDigits(number string, escapeDigits string) Response {
579 return c.Handler.Command(SayDigitsCommand{
580 Number: number,
581 EscapeDigits: escapeDigits,
582 })
583 }
584
585 // SayNumberCommand Says a given number.
586 //
587 // Say a given number, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
588 type SayNumberCommand struct {
589 Number string
590 EscapeDigits string
591 Gender *string
592 }
593
594 func (cmd SayNumberCommand) Command() (string, error) {
595 s := []interface{}{cmd.CommandString(), cmd.Number, cmd.EscapeDigits, cmd.Gender}
596 return joinCommand(s), nil
597 }
598 func (cmd SayNumberCommand) CommandString() string {
599 return "SAY NUMBER"
600 }
601
602 func (cmd SayNumberCommand) SetGender(v string) SayNumberCommand {
603 cmd.Gender = &v
604 return cmd
605 }
606
607 func (c *Client) SayNumber(number string, escapeDigits string) Response {
608 return c.Handler.Command(SayNumberCommand{
609 Number: number,
610 EscapeDigits: escapeDigits,
611 })
612 }
613
614 // SayPhoneticCommand Says a given character string with phonetics.
615 //
616 // Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit pressed, the ASCII numerical value of the digit if one was pressed, or `-1` on error/hangup.
617 type SayPhoneticCommand struct {
618 String string
619 EscapeDigits string
620 }
621
622 func (cmd SayPhoneticCommand) Command() (string, error) {
623 s := []interface{}{cmd.CommandString(), cmd.String, cmd.EscapeDigits}
624 return joinCommand(s), nil
625 }
626 func (cmd SayPhoneticCommand) CommandString() string {
627 return "SAY PHONETIC"
628 }
629
630 func (c *Client) SayPhonetic(string string, escapeDigits string) Response {
631 return c.Handler.Command(SayPhoneticCommand{
632 String: string,
633 EscapeDigits: escapeDigits,
634 })
635 }
636
637 // SayDateCommand Says a given date.
638 //
639 // Say a given date, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
640 type SayDateCommand struct {
641 // Date Is number of seconds elapsed since 00:00:00 on January 1, 1970. Coordinated Universal Time (UTC).
642 Date string
643 EscapeDigits string
644 }
645
646 func (cmd SayDateCommand) Command() (string, error) {
647 s := []interface{}{cmd.CommandString(), cmd.Date, cmd.EscapeDigits}
648 return joinCommand(s), nil
649 }
650 func (cmd SayDateCommand) CommandString() string {
651 return "SAY DATE"
652 }
653
654 func (c *Client) SayDate(date string, escapeDigits string) Response {
655 return c.Handler.Command(SayDateCommand{
656 Date: date,
657 EscapeDigits: escapeDigits,
658 })
659 }
660
661 // SayTimeCommand Says a given time.
662 //
663 // Say a given time, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
664 type SayTimeCommand struct {
665 // Time Is number of seconds elapsed since 00:00:00 on January 1, 1970. Coordinated Universal Time (UTC).
666 Time float64
667 EscapeDigits string
668 }
669
670 func (cmd SayTimeCommand) Command() (string, error) {
671 s := []interface{}{cmd.CommandString(), cmd.Time, cmd.EscapeDigits}
672 return joinCommand(s), nil
673 }
674 func (cmd SayTimeCommand) CommandString() string {
675 return "SAY TIME"
676 }
677
678 func (c *Client) SayTime(time float64, escapeDigits string) Response {
679 return c.Handler.Command(SayTimeCommand{
680 Time: time,
681 EscapeDigits: escapeDigits,
682 })
683 }
684
685 // SayDatetimeCommand Says a given time as specified by the format given.
686 //
687 // Say a given time, returning early if any of the given DTMF digits are received on the channel. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or `-1` on error/hangup.
688 type SayDatetimeCommand struct {
689 // Time Is number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)
690 Time float64
691 EscapeDigits string
692 // Format Is the format the time should be said in. See voicemail.conf (defaults to `ABdY 'digits/at' IMp`).
693 Format *string
694 // Timezone Acceptable values can be found in /usr/share/zoneinfo Defaults to machine default.
695 Timezone *string
696 }
697
698 func (cmd SayDatetimeCommand) Command() (string, error) {
699 s := []interface{}{cmd.CommandString(), cmd.Time, cmd.EscapeDigits, cmd.Format, cmd.Timezone}
700 return joinCommand(s), nil
701 }
702 func (cmd SayDatetimeCommand) CommandString() string {
703 return "SAY DATETIME"
704 }
705
706 func (cmd SayDatetimeCommand) SetFormat(v string) SayDatetimeCommand {
707 cmd.Format = &v
708 return cmd
709 }
710 func (cmd SayDatetimeCommand) SetTimezone(v string) SayDatetimeCommand {
711 cmd.Timezone = &v
712 return cmd
713 }
714
715 func (c *Client) SayDatetime(time float64, escapeDigits string) Response {
716 return c.Handler.Command(SayDatetimeCommand{
717 Time: time,
718 EscapeDigits: escapeDigits,
719 })
720 }
721
722 // SendImageCommand Sends images to channels supporting it.
723 //
724 // Sends the given image on a channel. Most channels do not support the transmission of images. Returns `0` if image is sent, or if the channel does not support image transmission. Returns `-1` only on error/hangup. Image names should not include extensions.
725 type SendImageCommand struct {
726 Image string
727 }
728
729 func (cmd SendImageCommand) Command() (string, error) {
730 s := []interface{}{cmd.CommandString(), cmd.Image}
731 return joinCommand(s), nil
732 }
733 func (cmd SendImageCommand) CommandString() string {
734 return "SEND IMAGE"
735 }
736
737 func (c *Client) SendImage(image string) Response {
738 return c.Handler.Command(SendImageCommand{
739 Image: image,
740 })
741 }
742
743 // SendTextCommand Sends text to channels supporting it.
744 //
745 // Sends the given text on a channel. Most channels do not support the transmission of text. Returns `0` if text is sent, or if the channel does not support text transmission. Returns `-1` only on error/hangup.
746 type SendTextCommand struct {
747 // TextToSend Text consisting of greater than one word should be placed in quotes since the command only accepts a single argument.
748 TextToSend string
749 }
750
751 func (cmd SendTextCommand) Command() (string, error) {
752 s := []interface{}{cmd.CommandString(), cmd.TextToSend}
753 return joinCommand(s), nil
754 }
755 func (cmd SendTextCommand) CommandString() string {
756 return "SEND TEXT"
757 }
758
759 func (c *Client) SendText(textToSend string) Response {
760 return c.Handler.Command(SendTextCommand{
761 TextToSend: textToSend,
762 })
763 }
764
765 // SetAutoHangupCommand Autohangup channel in some time.
766 //
767 // Cause the channel to automatically hangup at time seconds in the future. Of course it can be hungup before then as well. Setting to `0` will cause the autohangup feature to be disabled on this channel.
768 type SetAutoHangupCommand struct {
769 Time float64
770 }
771
772 func (cmd SetAutoHangupCommand) Command() (string, error) {
773 s := []interface{}{cmd.CommandString(), cmd.Time}
774 return joinCommand(s), nil
775 }
776 func (cmd SetAutoHangupCommand) CommandString() string {
777 return "SET AUTOHANGUP"
778 }
779
780 func (c *Client) SetAutoHangup(time float64) Response {
781 return c.Handler.Command(SetAutoHangupCommand{
782 Time: time,
783 })
784 }
785
786 // SetCallerIDCommand Sets callerid for the current channel.
787 //
788 // Changes the callerid of the current channel.
789 type SetCallerIDCommand struct {
790 Number string
791 }
792
793 func (cmd SetCallerIDCommand) Command() (string, error) {
794 s := []interface{}{cmd.CommandString(), cmd.Number}
795 return joinCommand(s), nil
796 }
797 func (cmd SetCallerIDCommand) CommandString() string {
798 return "SET CALLERID"
799 }
800
801 func (c *Client) SetCallerID(number string) Response {
802 return c.Handler.Command(SetCallerIDCommand{
803 Number: number,
804 })
805 }
806
807 // SetContextCommand Sets channel context.
808 //
809 // Sets the context for continuation upon exiting the application.
810 type SetContextCommand struct {
811 DesiredContext string
812 }
813
814 func (cmd SetContextCommand) Command() (string, error) {
815 s := []interface{}{cmd.CommandString(), cmd.DesiredContext}
816 return joinCommand(s), nil
817 }
818 func (cmd SetContextCommand) CommandString() string {
819 return "SET CONTEXT"
820 }
821
822 func (c *Client) SetContext(desiredContext string) Response {
823 return c.Handler.Command(SetContextCommand{
824 DesiredContext: desiredContext,
825 })
826 }
827
828 // SetExtensionCommand Changes channel extension.
829 //
830 // Changes the extension for continuation upon exiting the application.
831 type SetExtensionCommand struct {
832 NewExtension string
833 }
834
835 func (cmd SetExtensionCommand) Command() (string, error) {
836 s := []interface{}{cmd.CommandString(), cmd.NewExtension}
837 return joinCommand(s), nil
838 }
839 func (cmd SetExtensionCommand) CommandString() string {
840 return "SET EXTENSION"
841 }
842
843 func (c *Client) SetExtension(newExtension string) Response {
844 return c.Handler.Command(SetExtensionCommand{
845 NewExtension: newExtension,
846 })
847 }
848
849 // SetMusicCommand Enable/Disable Music on hold generator
850 //
851 // Enables/Disables the music on hold generator. If class is not specified, then the `default` music on hold class will be used. This generator will be stopped automatically when playing a file.
852 //
853 // Always returns `0`.
854 type SetMusicCommand struct {
855 Class string
856 // has missing params
857 }
858
859 func (cmd SetMusicCommand) Command() (string, error) {
860 s := []interface{}{cmd.CommandString(), cmd.Class}
861 return joinCommand(s), nil
862 }
863 func (cmd SetMusicCommand) CommandString() string {
864 return "SET MUSIC"
865 }
866
867 func (c *Client) SetMusic(class string) Response {
868 return c.Handler.Command(SetMusicCommand{
869 Class: class,
870 })
871 }
872
873 // SetPriorityCommand Set channel dialplan priority.
874 //
875 // Changes the priority for continuation upon exiting the application. The priority must be a valid priority or label.
876 type SetPriorityCommand struct {
877 Priority int
878 }
879
880 func (cmd SetPriorityCommand) Command() (string, error) {
881 s := []interface{}{cmd.CommandString(), cmd.Priority}
882 return joinCommand(s), nil
883 }
884 func (cmd SetPriorityCommand) CommandString() string {
885 return "SET PRIORITY"
886 }
887
888 func (c *Client) SetPriority(priority int) Response {
889 return c.Handler.Command(SetPriorityCommand{
890 Priority: priority,
891 })
892 }
893
894 // SetVariableCommand Sets a channel variable.
895 //
896 // Sets a variable to the current channel.
897 type SetVariableCommand struct {
898 VariableName string
899 Value string
900 }
901
902 func (cmd SetVariableCommand) Command() (string, error) {
903 s := []interface{}{cmd.CommandString(), cmd.VariableName, cmd.Value}
904 return joinCommand(s), nil
905 }
906 func (cmd SetVariableCommand) CommandString() string {
907 return "SET VARIABLE"
908 }
909
910 func (c *Client) SetVariable(variableName string, value string) Response {
911 return c.Handler.Command(SetVariableCommand{
912 VariableName: variableName,
913 Value: value,
914 })
915 }
916
917 // StreamFileCommand Sends audio file on channel.
918 //
919 // Send the given file, allowing playback to be interrupted by the given digits, if any. Returns `0` if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or `-1` on error or if the channel was disconnected. If musiconhold is playing before calling stream file it will be automatically stopped and will not be restarted after completion.
920 //
921 // It sets the following channel variables upon completion:
922 type StreamFileCommand struct {
923 // FileName File name to play. The file extension must not be included in the filename .
924 FileName string
925 // EscapeDigits Use double quotes for the digits if you wish none to be permitted.
926 EscapeDigits string
927 // SampleOffset If sample offset is provided then the audio will seek to sample offset before play starts.
928 SampleOffset *int
929 }
930
931 func (cmd StreamFileCommand) Command() (string, error) {
932 s := []interface{}{cmd.CommandString(), cmd.FileName, cmd.EscapeDigits, cmd.SampleOffset}
933 return joinCommand(s), nil
934 }
935 func (cmd StreamFileCommand) CommandString() string {
936 return "STREAM FILE"
937 }
938
939 func (cmd StreamFileCommand) SetSampleOffset(v int) StreamFileCommand {
940 cmd.SampleOffset = &v
941 return cmd
942 }
943
944 func (c *Client) StreamFile(fileName string, escapeDigits string) Response {
945 return c.Handler.Command(StreamFileCommand{
946 FileName: fileName,
947 EscapeDigits: escapeDigits,
948 })
949 }
950
951 // TddModeCommand Toggles TDD mode (for the deaf).
952 //
953 // Enable/Disable TDD transmission/reception on a channel. Returns `1` if successful, or `0` if channel is not TDD-capable.
954 type TddModeCommand struct {
955 Boolean string
956 }
957
958 func (cmd TddModeCommand) Command() (string, error) {
959 s := []interface{}{cmd.CommandString(), cmd.Boolean}
960 return joinCommand(s), nil
961 }
962 func (cmd TddModeCommand) CommandString() string {
963 return "TDD MODE"
964 }
965
966 func (c *Client) TddMode(boolean string) Response {
967 return c.Handler.Command(TddModeCommand{
968 Boolean: boolean,
969 })
970 }
971
972 // VerboseCommand Logs a message to the asterisk verbose log.
973 //
974 // Sends message to the console via verbose message system. level is the verbose level (1-4). Always returns `1`
975 type VerboseCommand struct {
976 Message string
977 Level string
978 }
979
980 func (cmd VerboseCommand) Command() (string, error) {
981 s := []interface{}{cmd.CommandString(), cmd.Message, cmd.Level}
982 return joinCommand(s), nil
983 }
984 func (cmd VerboseCommand) CommandString() string {
985 return "VERBOSE"
986 }
987
988 func (c *Client) Verbose(message string, level string) Response {
989 return c.Handler.Command(VerboseCommand{
990 Message: message,
991 Level: level,
992 })
993 }
994
995 // WaitForDigitCommand Waits for a digit to be pressed.
996 //
997 // Waits up to timeout milliseconds for channel to receive a DTMF digit. Returns `-1` on channel failure, `0` if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received. Use `-1` for the timeout value if you desire the call to block indefinitely.
998 type WaitForDigitCommand struct {
999 Timeout int
1000 }
1001
1002 func (cmd WaitForDigitCommand) Command() (string, error) {
1003 s := []interface{}{cmd.CommandString(), cmd.Timeout}
1004 return joinCommand(s), nil
1005 }
1006 func (cmd WaitForDigitCommand) CommandString() string {
1007 return "WAIT FOR DIGIT"
1008 }
1009
1010 func (c *Client) WaitForDigit(timeout int) Response {
1011 return c.Handler.Command(WaitForDigitCommand{
1012 Timeout: timeout,
1013 })
1014 }
1015
1016 // SpeechCreateCommand Creates a speech object.
1017 //
1018 // Create a speech object to be used by the other Speech AGI commands.
1019 type SpeechCreateCommand struct {
1020 Engine string
1021 }
1022
1023 func (cmd SpeechCreateCommand) Command() (string, error) {
1024 s := []interface{}{cmd.CommandString(), cmd.Engine}
1025 return joinCommand(s), nil
1026 }
1027 func (cmd SpeechCreateCommand) CommandString() string {
1028 return "SPEECH CREATE"
1029 }
1030
1031 func (c *Client) SpeechCreate(engine string) Response {
1032 return c.Handler.Command(SpeechCreateCommand{
1033 Engine: engine,
1034 })
1035 }
1036
1037 // SpeechSetCommand Sets a speech engine setting.
1038 //
1039 // Set an engine-specific setting.
1040 type SpeechSetCommand struct {
1041 Name string
1042 Value string
1043 }
1044
1045 func (cmd SpeechSetCommand) Command() (string, error) {
1046 s := []interface{}{cmd.CommandString(), cmd.Name, cmd.Value}
1047 return joinCommand(s), nil
1048 }
1049 func (cmd SpeechSetCommand) CommandString() string {
1050 return "SPEECH SET"
1051 }
1052
1053 func (c *Client) SpeechSet(name string, value string) Response {
1054 return c.Handler.Command(SpeechSetCommand{
1055 Name: name,
1056 Value: value,
1057 })
1058 }
1059
1060 // SpeechDestroyCommand Destroys a speech object.
1061 //
1062 // Destroy the speech object created by `SPEECH CREATE`.
1063 type SpeechDestroyCommand struct {
1064 }
1065
1066 func (cmd SpeechDestroyCommand) Command() (string, error) {
1067 s := []interface{}{cmd.CommandString()}
1068 return joinCommand(s), nil
1069 }
1070 func (cmd SpeechDestroyCommand) CommandString() string {
1071 return "SPEECH DESTROY"
1072 }
1073
1074 func (c *Client) SpeechDestroy() Response {
1075 return c.Handler.Command(SpeechDestroyCommand{})
1076 }
1077
1078 // SpeechLoadGrammarCommand Loads a grammar.
1079 //
1080 // Loads the specified grammar as the specified name.
1081 type SpeechLoadGrammarCommand struct {
1082 GrammarName string
1083 PathToGrammar string
1084 }
1085
1086 func (cmd SpeechLoadGrammarCommand) Command() (string, error) {
1087 s := []interface{}{cmd.CommandString(), cmd.GrammarName, cmd.PathToGrammar}
1088 return joinCommand(s), nil
1089 }
1090 func (cmd SpeechLoadGrammarCommand) CommandString() string {
1091 return "SPEECH LOAD GRAMMAR"
1092 }
1093
1094 func (c *Client) SpeechLoadGrammar(grammarName string, pathToGrammar string) Response {
1095 return c.Handler.Command(SpeechLoadGrammarCommand{
1096 GrammarName: grammarName,
1097 PathToGrammar: pathToGrammar,
1098 })
1099 }
1100
1101 // SpeechUnloadGrammarCommand Unloads a grammar.
1102 //
1103 // Unloads the specified grammar.
1104 type SpeechUnloadGrammarCommand struct {
1105 GrammarName string
1106 }
1107
1108 func (cmd SpeechUnloadGrammarCommand) Command() (string, error) {
1109 s := []interface{}{cmd.CommandString(), cmd.GrammarName}
1110 return joinCommand(s), nil
1111 }
1112 func (cmd SpeechUnloadGrammarCommand) CommandString() string {
1113 return "SPEECH UNLOAD GRAMMAR"
1114 }
1115
1116 func (c *Client) SpeechUnloadGrammar(grammarName string) Response {
1117 return c.Handler.Command(SpeechUnloadGrammarCommand{
1118 GrammarName: grammarName,
1119 })
1120 }
1121
1122 // SpeechActivateGrammarCommand Activates a grammar.
1123 //
1124 // Activates the specified grammar on the speech object.
1125 type SpeechActivateGrammarCommand struct {
1126 GrammarName string
1127 }
1128
1129 func (cmd SpeechActivateGrammarCommand) Command() (string, error) {
1130 s := []interface{}{cmd.CommandString(), cmd.GrammarName}
1131 return joinCommand(s), nil
1132 }
1133 func (cmd SpeechActivateGrammarCommand) CommandString() string {
1134 return "SPEECH ACTIVATE GRAMMAR"
1135 }
1136
1137 func (c *Client) SpeechActivateGrammar(grammarName string) Response {
1138 return c.Handler.Command(SpeechActivateGrammarCommand{
1139 GrammarName: grammarName,
1140 })
1141 }
1142
1143 // SpeechDeactivateGrammarCommand Deactivates a grammar.
1144 //
1145 // Deactivates the specified grammar on the speech object.
1146 type SpeechDeactivateGrammarCommand struct {
1147 GrammarName string
1148 }
1149
1150 func (cmd SpeechDeactivateGrammarCommand) Command() (string, error) {
1151 s := []interface{}{cmd.CommandString(), cmd.GrammarName}
1152 return joinCommand(s), nil
1153 }
1154 func (cmd SpeechDeactivateGrammarCommand) CommandString() string {
1155 return "SPEECH DEACTIVATE GRAMMAR"
1156 }
1157
1158 func (c *Client) SpeechDeactivateGrammar(grammarName string) Response {
1159 return c.Handler.Command(SpeechDeactivateGrammarCommand{
1160 GrammarName: grammarName,
1161 })
1162 }
1163
1164 // SpeechRecognizeCommand Recognizes speech.
1165 //
1166 // Plays back given prompt while listening for speech and dtmf.
1167 type SpeechRecognizeCommand struct {
1168 Prompt string
1169 Timeout int
1170 Offset *string
1171 }
1172
1173 func (cmd SpeechRecognizeCommand) Command() (string, error) {
1174 s := []interface{}{cmd.CommandString(), cmd.Prompt, cmd.Timeout, cmd.Offset}
1175 return joinCommand(s), nil
1176 }
1177 func (cmd SpeechRecognizeCommand) CommandString() string {
1178 return "SPEECH RECOGNIZE"
1179 }
1180
1181 func (cmd SpeechRecognizeCommand) SetOffset(v string) SpeechRecognizeCommand {
1182 cmd.Offset = &v
1183 return cmd
1184 }
1185
1186 func (c *Client) SpeechRecognize(prompt string, timeout int) Response {
1187 return c.Handler.Command(SpeechRecognizeCommand{
1188 Prompt: prompt,
1189 Timeout: timeout,
1190 })
1191 }