-1
我是Ruby的nobie,發現rubyphone代碼,我試圖讓它與xml一起工作。我已經得到它看到XML。現在唯一的部分是它的錯誤:test.rb:17:未定義的局部變量或方法`tsapi'爲main:Object(NameError)未定義的本地變量或方法'tsapi'爲main.Object(NameError)
第17行我試過用tsapi.new和tsapi = tsapi。新
任何幫助將是偉大的。
require "Win32API"
require "tsapi"
require 'rexml/document'
include REXML
file = File.new("tsapi.xml")
#doc = Document.new(file)
doc = REXML::Document.new('tsapi.xml')
root=doc.root
$server = ["section[@name='config']/server"]
$username = ["section[@name='config']/username"]
$password = ["section[@name='config']/password"]
$app = ["section[@name='config']/app"]
$tracing = ["section[@name='config']/tracing"]
tsapi.new($extension, $server, $username, $password, $app)
result == tsapi.open
if result == true
#Win32API.new("user32", "MessageBox", ['i','p','p','i'], 'i').call(0, "Calling Voice Mail.", "Calling VMail", 0) if result == true
result = tsapi.call("12345")
end
tsapi.close