Method: Command#dial
- Defined in:
- lib/ruby-agi/command.rb
#dial(telephone_number = nil, protocol = nil, username = nil, context = 'default', timeout = nil, options = nil) ⇒ Object
method to dial out
Parameters
-
telephone_number : telephone_number or extension to dial
-
protocol : protocol to be used to make this call
-
username : username to be used to make this call using the specified protocol
-
context : name of the context to be used for authentication
-
timeout : maximum allowed time in seconds to make this call
-
options : options to be passed in ‘Dial’ command
Returns
-
ReturnStatus object
Command Reference: Dial(type/identifier,timeout,options,URL)
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'lib/ruby-agi/command.rb', line 802 def dial(telephone_number=nil, protocol=nil, username=nil, context='default', timeout=nil, =nil) dial_string = nil if protocol == 'LOCAL' return nil if (telephone_number.nil? or context.nil?) dial_string = "LOCAL/#{telephone_number}@#{context}" elsif protocol == 'IAX2' return nil if (telephone_number.nil? or username.nil? or context.nil?) telephone_number.strip! dial_string = "IAX2/#{username}@#{context}/#{telephone_number}" elsif protocol == 'SIP' else return nil end timeout.nil? ? dial_string += "|" : dial_string += "|#{timeout}" .nil? ? dial_string += "|" : dial_string += "|#{}" rs = exec('DIAL', dial_string) return rs end |