erichmond-ruby-agi 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,891 @@
1
+ #
2
+ # File: agi.rb
3
+ #
4
+ # ruby-agi: Ruby Language API for Asterisk
5
+ #
6
+ # Copyright (C) <2005> Mohammad Khan <info@beeplove.com>
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
+ #
22
+
23
+
24
+ require 'sync'
25
+
26
+ require 'ruby-agi/error.rb'
27
+ require 'ruby-agi/command.rb'
28
+ require 'ruby-agi/asterisk_variable.rb'
29
+ require 'ruby-agi/return_status.rb'
30
+
31
+
32
+ class AGI
33
+
34
+ #
35
+ # constructor method of class AGI
36
+ #
37
+ # <b>Parameters</b>
38
+ # - none
39
+ #
40
+ # <b>Returns</b>
41
+ # - self
42
+ #
43
+ def initialize
44
+ @@debug = nil
45
+ @@stdin_semaphore = nil
46
+ @@stdout_semaphore = nil
47
+ @@stderr_semaphore = nil
48
+
49
+ begin
50
+ @@env = AsteriskVariable.new if @@env.nil?
51
+ rescue NameError
52
+ @@env = AsteriskVariable.new
53
+ rescue
54
+ raise(AGIError, "Error to initialize @@env in AGI#initialize, please report to info@beeplove.com")
55
+ end
56
+
57
+ begin
58
+ @@command = Command.new if @@command.nil?
59
+ rescue NameError
60
+ @@command = Command.new
61
+ rescue
62
+ raise(AGIError, "Error to initialize @@command in AGI#initialize, please report to info@beeplove.com")
63
+ end
64
+ end
65
+
66
+ #
67
+ # method to get Command object instance
68
+ #
69
+ # <b>Parameters</b>
70
+ # - none
71
+ # <b>Returns</b>
72
+ # - Command object
73
+ #
74
+ private
75
+ def command
76
+ if @@command.nil?
77
+ @@command = Command.new
78
+ end
79
+ return @@command
80
+ end
81
+
82
+ #
83
+ # <method description>
84
+ #
85
+ # <b>Parameters</b>
86
+ # - none
87
+ # <b>Returns</b>
88
+ # - AsteriskVariable object
89
+ #
90
+ private
91
+ def env
92
+ if @@env.nil?
93
+ @@env = AsteriskVariable.new
94
+ end
95
+
96
+ return @@env
97
+ end
98
+
99
+ #
100
+ # <method description>
101
+ #
102
+ # <b>Parameters</b>
103
+ # - none
104
+ # <b>Returns</b>
105
+ # - Sync object
106
+ #
107
+ private
108
+ def stdin_semaphore
109
+ if @@stdin_semaphore.nil?
110
+ @@stdin_semaphore = Sync.new
111
+ end
112
+ $stdin.sync = true
113
+
114
+ return @@stdin_semaphore
115
+ end
116
+
117
+ #
118
+ # <method description>
119
+ #
120
+ # <b>Parameters</b>
121
+ # - none
122
+ # <b>Returns</b>
123
+ # - Sync object
124
+ #
125
+ private
126
+ def stdout_semaphore
127
+ if @@stdout_semaphore.nil?
128
+ @@stdout_semaphore = Sync.new
129
+ end
130
+ $stdout.sync = true
131
+
132
+ return @@stdout_semaphore
133
+ end
134
+
135
+ #
136
+ # <method description>
137
+ #
138
+ # <b>Parameters</b>
139
+ # - none
140
+ # <b>Returns</b>
141
+ # - Sync object
142
+ #
143
+ private
144
+ def stderr_semaphore
145
+ if @@stderr_semaphore.nil?
146
+ @@stderr_semaphore = Sync.new
147
+ end
148
+ $stderr.sync = true
149
+
150
+ return @@stderr_semaphore
151
+ end
152
+
153
+ #
154
+ # <method description>
155
+ #
156
+ # <b>Parameters</b>
157
+ # - none
158
+ # <b>Returns</b>
159
+ # - yield
160
+ #
161
+ public
162
+ def semaphore
163
+ if block_given?
164
+ stderr_semaphore.synchronize do
165
+ stdout_semaphore.synchronize do
166
+ stdin_semaphore.synchronize do
167
+ yield
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+
174
+ #
175
+ # <method description>
176
+ #
177
+ # <b>Parameters</b>
178
+ # - val(Boolean)
179
+ # <b>Returns</b>
180
+ # - none
181
+ #
182
+ def debug=(val)
183
+ @@debug = val
184
+ end
185
+
186
+ #
187
+ # <method description>
188
+ #
189
+ # <b>Parameters</b>
190
+ # - none
191
+ # <b>Returns</b>
192
+ # - Boolean
193
+ #
194
+ def debug?
195
+ return @@debug == true
196
+ end
197
+
198
+ #
199
+ # <method description>
200
+ #
201
+ # <b>Parameters</b>
202
+ # - none
203
+ # <b>Returns</b>
204
+ # - String
205
+ #
206
+ def request
207
+ return env.request
208
+ end
209
+
210
+ #
211
+ # <method description>
212
+ #
213
+ # <b>Parameters</b>
214
+ # - none
215
+ # <b>Returns</b>
216
+ # - String
217
+ #
218
+ def channel
219
+ return env.channel
220
+ end
221
+
222
+ #
223
+ # <method description>
224
+ #
225
+ # <b>Parameters</b>
226
+ # - none
227
+ # <b>Returns</b>
228
+ # - String
229
+ #
230
+ def language
231
+ return env.language
232
+ end
233
+
234
+ #
235
+ # <method description>
236
+ #
237
+ # <b>Parameters</b>
238
+ # - none
239
+ # <b>Returns</b>
240
+ # - String
241
+ #
242
+ def type
243
+ return env.type
244
+ end
245
+
246
+ #
247
+ # <method description>
248
+ #
249
+ # <b>Parameters</b>
250
+ # - none
251
+ # <b>Returns</b>
252
+ # - String
253
+ #
254
+ def uniqueid
255
+ return env.uniqueid
256
+ end
257
+
258
+ #
259
+ # method to read callerid, Ex. "John Smith" <1234567890>
260
+ # regardless of asterisk version, method callerid would return "Caller Name" <Number>
261
+ #
262
+ # <b>Parameters</b>
263
+ # - none
264
+ #
265
+ # <b>Returns</b>
266
+ # - String : empty string for Unidentified
267
+ #
268
+ def callerid
269
+ return env.callerid
270
+ end
271
+
272
+ #
273
+ # method to read calleridname, Ex. John Smith
274
+ #
275
+ # <b>Parameters</b>
276
+ # - none
277
+ #
278
+ # <b>Returns</b>
279
+ # - String : empty string for Unidentified
280
+ #
281
+ def calleridname
282
+ return env.calleridname
283
+ end
284
+
285
+ #
286
+ # method to read calleridnumber, Ex. 1234567890
287
+ #
288
+ # <b>Parameters</b>
289
+ # - none
290
+ #
291
+ # <b>Returns</b>
292
+ # - String : empty string for Unidentified
293
+ #
294
+ def calleridnumber
295
+ return env.calleridnumber
296
+ end
297
+
298
+ #
299
+ # <method description>
300
+ #
301
+ # <b>Parameters</b>
302
+ # - none
303
+ # <b>Returns</b>
304
+ # - String
305
+ #
306
+ def callingpres
307
+ return env.callingpres
308
+ end
309
+
310
+ #
311
+ # <method description>
312
+ #
313
+ # <b>Parameters</b>
314
+ # - none
315
+ # <b>Returns</b>
316
+ # - String
317
+ #
318
+ def callingani2
319
+ return env.callingani2
320
+ end
321
+
322
+ #
323
+ # <method description>
324
+ #
325
+ # <b>Parameters</b>
326
+ # - none
327
+ # <b>Returns</b>
328
+ # - String
329
+ #
330
+ def callington
331
+ return env.callington
332
+ end
333
+
334
+ #
335
+ # <method description>
336
+ #
337
+ # <b>Parameters</b>
338
+ # - none
339
+ # <b>Returns</b>
340
+ # - String
341
+ #
342
+ def callingtns
343
+ return env.callingtns
344
+ end
345
+
346
+ #
347
+ # <method description>
348
+ #
349
+ # <b>Parameters</b>
350
+ # - none
351
+ # <b>Returns</b>
352
+ # - String
353
+ #
354
+ def dnid
355
+ return env.dnid
356
+ end
357
+
358
+ #
359
+ # <method description>
360
+ #
361
+ # <b>Parameters</b>
362
+ # - none
363
+ # <b>Returns</b>
364
+ # - String
365
+ #
366
+ def rdnid
367
+ return env.rdnid
368
+ end
369
+
370
+ #
371
+ # <method description>
372
+ #
373
+ # <b>Parameters</b>
374
+ # - none
375
+ # <b>Returns</b>
376
+ # - String
377
+ #
378
+ def context
379
+ return env.context
380
+ end
381
+
382
+ #
383
+ # <method description>
384
+ #
385
+ # <b>Parameters</b>
386
+ # - none
387
+ # <b>Returns</b>
388
+ # - String
389
+ #
390
+ def extension
391
+ return env.extension
392
+ end
393
+
394
+ #
395
+ # <method description>
396
+ #
397
+ # <b>Parameters</b>
398
+ # - none
399
+ # <b>Returns</b>
400
+ # - String
401
+ #
402
+ def priority
403
+ return env.priority
404
+ end
405
+
406
+ #
407
+ # <method description>
408
+ #
409
+ # <b>Parameters</b>
410
+ # - none
411
+ # <b>Returns</b>
412
+ # - String
413
+ #
414
+ def enhanced
415
+ return env.enhanced
416
+ end
417
+
418
+ #
419
+ # <method description>
420
+ #
421
+ # <b>Parameters</b>
422
+ # - none
423
+ # <b>Returns</b>
424
+ # - String
425
+ #
426
+ def accountcode
427
+ return env.accountcode
428
+ end
429
+
430
+ #
431
+ # <method description>
432
+ #
433
+ # <b>Parameters</b>
434
+ # - str(String) : asterisk command in raw format to be executed
435
+ # <b>Returns</b>
436
+ # - ReturnStatus object
437
+ #
438
+ def raw_command(str)
439
+ return command.raw_command(str)
440
+ end
441
+
442
+ #
443
+ # Answers channel if not already in answer state.
444
+ #
445
+ # <b>Parameters</b>
446
+ # - none
447
+ #
448
+ # <b>Returns</b>
449
+ # - ReturnStatus object
450
+ #
451
+ def answer
452
+ return command.answer
453
+ end
454
+
455
+ #
456
+ # <method description>
457
+ #
458
+ # <b>Parameters</b>
459
+ # - val(Integer) : time in secconds
460
+ # <b>Returns</b>
461
+ # - ReturnStatus object
462
+ #
463
+ def set_auto_hangup(val)
464
+ return command.set_auto_hangup(val)
465
+ end
466
+
467
+ #
468
+ # Returns the status of the specified channel.
469
+ # If no channel name is given the returns the status of the current channel.
470
+ #
471
+ # <b>Parameters</b>
472
+ # - channel : name of the channel.
473
+ #
474
+ # <b>Returns</b>
475
+ # - ReturnStatus object
476
+ #
477
+ def channel_status(channel=nil)
478
+ return command.channel_status(channel)
479
+ end
480
+
481
+ #
482
+ # Executes <application> with given <options>.
483
+ # Applications are the functions you use to create a dial plan in extensions.conf.
484
+ #
485
+ # <b>Parameters</b>
486
+ # - application : Asterisk command of the application
487
+ # - options : options to be passed with the asterisk application
488
+ #
489
+ # <b>Returns</b>
490
+ # - ReturnStatus object
491
+ #
492
+ def exec(asterisk_application, options=nil)
493
+ return command.exec(asterisk_application, options)
494
+ end
495
+
496
+ #
497
+ # method to get digit(s)
498
+ # pressing '#' will always terminate the input process
499
+ #
500
+ # <b>Parameters</b>
501
+ # - filename : audio to be played before get as input
502
+ # - timeout : maximum allowed time in second(s) to receive each digit
503
+ # wait for ever if timeout is nil or negative or zero
504
+ # - max_digit: maximum number of digits to get as input
505
+ # wait for unlimited number of digits if max_digit is nil or negative or zero
506
+ # <b>Returns</b>
507
+ # - ReturnStatus object
508
+ #
509
+ def wait_for_digits(filename, timeout=nil, max_digit=nil)
510
+ return command.wait_for_digits(filename, timeout, max_digit)
511
+ end
512
+
513
+ #
514
+ # method to read a variable
515
+ #
516
+ # <b>Parameters</b>
517
+ # - name : name of the variable to read
518
+ #
519
+ # <b>Returns</b>
520
+ # - ReturnStatus object
521
+ #
522
+ def get_variable(name)
523
+ return command.get_variable(name)
524
+ end
525
+
526
+ #
527
+ # method to hang up the specified channel.
528
+ # If no channel name is given, hangs up the current channel.
529
+ #
530
+ # <b>Parameters</b>
531
+ # - channel : name of the channel to hang up
532
+ # <b>Returns</b>
533
+ # - ReturnStatus object
534
+ #
535
+ def hangup(channel=nil)
536
+ return command.hangup(channel)
537
+ end
538
+
539
+ #
540
+ # method that Does nothing !!
541
+ #
542
+ # <b>Parameters</b>
543
+ # - msg : message to pass this method
544
+ #
545
+ # <b>Returns</b>
546
+ # - ReturnStatus object
547
+ # success: 200 result=0
548
+ #
549
+ def noop(msg)
550
+ return command.noop(msg)
551
+ end
552
+
553
+ #
554
+ # Receives a character of text on a channel, and discards any further characters after the first one waiting.
555
+ # Most channels do not support the reception of text. See Asterisk Text for details.
556
+ #
557
+ # <b>Parameters</b>
558
+ # - timeout : maximum time to wait for input in seconds
559
+ # negative or zero is not acceptable
560
+ #
561
+ # <b>Returns</b>
562
+ # - ReturnStatus object
563
+ #
564
+ def receive_char(timeout)
565
+ return command.receive_char(timeout)
566
+ end
567
+
568
+ #
569
+ # Receives a string text on a channel.
570
+ # Most channels do not support the reception of text.
571
+ #
572
+ # <b>Parameters</b>
573
+ # - timeout : time to wait for input in seconds
574
+ # negative or zero is not acceptable
575
+ #
576
+ # <b>Returns</b>
577
+ # - ReturnStatus object
578
+ #
579
+ def receive_text(timeout)
580
+ return command.receive_text(timeout)
581
+ end
582
+
583
+ #
584
+ # Record to a file until <escape digits> are received as dtmf.
585
+ #
586
+ # <b>Parameters</b>
587
+ # - filename : location of the file where the audio file will be saved
588
+ # - format : specify what kind of file will be recorded.
589
+ # - timeout : maximum record time in seconds
590
+ # nil, negative or 0 for no timeout.
591
+ # - offset : [offset samples] is optional,
592
+ # and if provided will seek to the offset without exceeding the end of the file.
593
+ # - silence : number of seconds of silence allowed before the function returns
594
+ # despite the lack of dtmf digits or reaching timeout.
595
+ # Silence value must be preceeded by "s=" and is optional.
596
+ #
597
+ # <b>Returns</b>
598
+ # - ReturnStatus object
599
+ #
600
+ def record_file(filename, format='gsm', escape_digits=nil, timeout=nil, beep=true)
601
+ return command.record_file(filename, format, escape_digits, timeout, beep)
602
+ end
603
+
604
+ #
605
+ # Say a given digit string, returning early if any of the given DTMF digits are received on the channel.
606
+ #
607
+ # <b>Parameters</b>
608
+ # - number : number to announce
609
+ # - escape_digit : if digit pressed during playback, will return from announce
610
+ #
611
+ # <b>Returns</b>
612
+ # - ReturnStatus (object)
613
+ #
614
+ # failure: 200 result=-1
615
+ # success: 200 result=0
616
+ # digit pressed: 200 result=<digit>
617
+ # <digit> is the ascii code for the digit pressed.
618
+ #
619
+ def say_digits(digit_string, escape_digits=nil)
620
+ return command.say_digits(digit_string, escape_digits)
621
+ end
622
+
623
+ #
624
+ # Say a given number, returning early if any of the given DTMF digits are received on the channel.
625
+ #
626
+ # <b>Parameters</b>
627
+ # - number : number to announce
628
+ # - escape_digit : if pressed, return from program
629
+ #
630
+ # <b>Returns</b>
631
+ # - ReturnStatus object
632
+ #
633
+ def say_number(number, escape_digits=nil)
634
+ return command.say_number(number, escape_digits)
635
+ end
636
+
637
+ #
638
+ # Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel.
639
+ #
640
+ # <b>Parameters</b>
641
+ # - string : character string to announce
642
+ # - escape_digit : digit to be pressed to escape from program
643
+ #
644
+ # <b>Returns</b>
645
+ # - ReturnStatus (object)
646
+ #
647
+ def say_phonetic(string, escape_digits=nil)
648
+ return command.say_phonetic(string, escape_digits)
649
+ end
650
+
651
+ #
652
+ # Say a given time, returning early if any of the given DTMF digits are received on the channel.
653
+ #
654
+ # <b>Parameters</b>
655
+ # - time : number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
656
+ # - escape_digits : digit to be pressed to escape from the program
657
+ #
658
+ # <b>Returns</b>
659
+ # - ReturnStatus (object)
660
+ #
661
+ def say_time(time=Time.now.to_i, escape_digits='#')
662
+ return command.say_time(time, escape_digits)
663
+ end
664
+
665
+ #
666
+ # Sends the given image on a channel.
667
+ # Most channels do not support the transmission of images.
668
+ # Image names should not include extensions.
669
+ #
670
+ # <b>Parameters</b>
671
+ # - image : location of image
672
+ #
673
+ # <b>Returns</b>
674
+ # - ReturnStatus (object)
675
+ #
676
+ def send_image(image)
677
+ return command.send_image(image)
678
+ end
679
+
680
+ #
681
+ # Sends the given text on a channel.
682
+ # Most channels do not support the transmission of text.
683
+ # Text consisting of greater than one word should be placed in quotes since the command only accepts a single argument.
684
+ #
685
+ # <b>Parameters</b>
686
+ # - text : text to be send
687
+ #
688
+ # <b>Returns</b>
689
+ # - ReturnStatus (object)
690
+ #
691
+ def send_text(text)
692
+ return command.send_text(text)
693
+ end
694
+
695
+ #
696
+ # Changes the callerid of the current channel.
697
+ #
698
+ # <b>Parameters</b>
699
+ # - number : number to be set a callerid
700
+ #
701
+ # <b>Returns</b>
702
+ # - ReturnStatus (object)
703
+ #
704
+ def set_caller_id(number)
705
+ return command.set_caller_id(number)
706
+ end
707
+
708
+ #
709
+ # Sets the context for continuation upon exiting the application.
710
+ #
711
+ # <b>Parameters</b>
712
+ # - context : name of the context
713
+ #
714
+ # <b>Returns</b>
715
+ # - ReturnStatus object
716
+ #
717
+ def set_context(context)
718
+ return command.set_context(context)
719
+ end
720
+
721
+ #
722
+ # Changes the extension for continuation upon exiting the application.
723
+ #
724
+ # <b>Parameters</b>
725
+ # - extension: name or number of extension to be set
726
+ #
727
+ # <b>Returns</b>
728
+ # - ReturnStatus object
729
+ #
730
+ def set_extension(extension)
731
+ return command.set_extension(extension)
732
+ end
733
+
734
+ #
735
+ # Changes the priority for continuation upon exiting the application.
736
+ #
737
+ # <b>Parameters</b>
738
+ # - priority : number of priority
739
+ #
740
+ # <b>Returns</b>
741
+ # - ReturnStatus object
742
+ def set_priority(priority)
743
+ return command.set_priority(priority)
744
+ end
745
+
746
+ #
747
+ # Enables/Disables the music on hold generator.
748
+ #
749
+ # <b>Parameters</b>
750
+ # - mode : on or off
751
+ # - moh_class : name of the music on hold class
752
+ # 'default' for not provided or nil
753
+ #
754
+ # <b>Returns</b>
755
+ # - ReturnStatus object
756
+ #
757
+ def set_music(mode=true, moh_class='default')
758
+ return command.set_music(mode, moh_class)
759
+ end
760
+
761
+ #
762
+ # set variable: Sets a channel variable
763
+ # These variables live in the channel Asterisk creates
764
+ # when you pickup a phone and as such they are both local
765
+ # and temporary. Variables created in one channel can not
766
+ # be accessed by another channel. When you hang up the phone,
767
+ # the channel is deleted and any variables in that channel are deleted as well.
768
+ #
769
+ # <b>Parameters</b>
770
+ # - variablename : name of the variable
771
+ # - value : value to be set for the variable
772
+ #
773
+ # <b>Returns</b>
774
+ # - ReturnStatus object
775
+ #
776
+ def set_variable(name, value)
777
+ return command.set_variable(name, value)
778
+ end
779
+
780
+ #
781
+ # stream file: Sends audio file on channel
782
+ # Send the given file, allowing playback to be interrupted by the given digits, if any.
783
+ # Use double quotes for the digits if you wish none to be permitted.
784
+ # If sample offset is provided then the audio will seek to sample offset before play starts.
785
+ # Remember, the file extension must not be included in the filename.
786
+ #
787
+ # <b>Parameters</b>
788
+ # - filename : location of the file to be played
789
+ # - escape_digit: digit to be pressed to escape from playback
790
+ #
791
+ # <b>Returns</b>
792
+ # - ReturnStatus object
793
+ #
794
+ def stream_file(filename, escape_digits='#')
795
+ return command.stream_file(filename, escape_digits)
796
+ end
797
+
798
+ #
799
+ # tdd mode: Activates TDD mode on channels supporting it, to enable communication with TDDs.
800
+ # Enable/Disable TDD transmission/reception on a channel.
801
+ # This function is currently (01July2005) only supported on Zap channels.
802
+ # As of 02July2005, this function never returns 0 (Not Capable).
803
+ # If it fails for any reason, -1 (Failure) will be returned, otherwise 1 (Success) will be returned.
804
+ # The capability for returning 0 if the channel is not capable of TDD MODE is a future plan.
805
+ #
806
+ # <b>Parameters</b>
807
+ # - mode : mode of the tdd to be set
808
+ # set tdd on if non-zero or 'true' specified
809
+ #
810
+ # <b>Returns</b>
811
+ # - ReturnStatus object
812
+ #
813
+ def tdd_mode(settings=true)
814
+ return command.tdd_mode(settings)
815
+ end
816
+
817
+ #
818
+ # Sends <message> to the console via verbose message system.
819
+ # The Asterisk verbosity system works as follows.
820
+ # The Asterisk user gets to set the desired verbosity at startup time
821
+ # or later using the console 'set verbose' command.
822
+ # Messages are displayed on the console if their verbose level
823
+ # is less than or equal to desired verbosity set by the user.
824
+ # More important messages should have a low verbose level;
825
+ # less important messages should have a high verbose level.
826
+ #
827
+ # <b>Parameters</b>
828
+ # - message : message to be send as log
829
+ # - level : verbose level to be set
830
+ # [level] is the the verbose level (1-4)
831
+ # If you specify a verbose level less than 1 or greater than 4, the verbosity is 1.
832
+ # The default verbosity seems to be 0 (in 1.0.8),
833
+ # and supplying a 0 (zero) verbosity does work:
834
+ # the message will be displayed regardless of the console verbosity setting.
835
+ #
836
+ # <b>Returns</b>
837
+ # - ReturnStatus object
838
+ #
839
+ def verbose(message, level=3)
840
+ return command.verbose(message, level)
841
+ end
842
+
843
+ #
844
+ # wait for digit: Waits for a digit to be pressed
845
+ # Waits up to <timeout> milliseconds for channel to receive a DTMF digit.
846
+ #
847
+ # <b>Parameters</b>
848
+ # - timeout : maximum allow waiting time in seconds to get input
849
+ # nil, zero or negative would be considered as infinite wait time
850
+ #
851
+ # <b>Returns</b>
852
+ # - ReturnStatus object
853
+ #
854
+ def wait_for_digit(timeout=nil)
855
+ return command.wait_for_digit(timeout)
856
+ end
857
+
858
+ #
859
+ # method to dial out
860
+ #
861
+ # <b>Parameters</b>
862
+ # - telephone_number : telephone_number or extension to dial
863
+ # - protocol : protocol to be used to make this call
864
+ # - username : username to be used to make this call using the specified protocol
865
+ # - context : name of the context to be used for authentication
866
+ # - timeout : maximum allowed time in seconds to make this call
867
+ # - options : options to be passed in 'Dial' command
868
+ #
869
+ # <b>Returns</b>
870
+ # - ReturnStatus object
871
+ #
872
+ def dial(telephone_number=nil, protocol=nil, username=nil, context=nil, timeout=nil, options=nil)
873
+ return command.dial(telephone_number, protocol, username, context, timeout, options)
874
+ end
875
+
876
+ #
877
+ # method to jump in a specified context, extension and priority
878
+ #
879
+ # <b>Parameters</b>
880
+ # - context : name of the context
881
+ # - extension : name of the extension
882
+ # - priority : name of the priority
883
+ #
884
+ # <b>Returns</b>
885
+ # - none
886
+ #
887
+ def jump_to(context=nil, extension=nil, priority=nil)
888
+ command.jump_to(context, extension, priority)
889
+ end
890
+ end
891
+