class AastraXmlApi::Phone

Constants

HIGHASCII

Public Class Methods

new() click to toggle source

Create an Phone object and set initial values. Everything sent to the phone will inherit from this class.

# File lib/aastra_xml_api/phone.rb, line 96
def initialize
  @entries = []
  @softkeys = []
  @icons = []
  @refreshTimeout = 0
  @timeout = 0
end

Public Instance Methods

addIcon(index, icon) click to toggle source

Add an icon to be used by either a softkey of PhoneTextMenu. Only available on the 55i, 57i, and 57iCT. The index is the same as what is referenced by addSoftkey or PhoneTextMenu.addEntry. The icon can be either a predefined icon or the hex of an icon image.

# File lib/aastra_xml_api/phone.rb, line 180
def addIcon(index, icon)
  @icons += [PhoneIconEntry.new(index, icon)]
end
addSoftkey(index, label, uri, icon=nil) click to toggle source

Add a softkey to be displayed while the XML object is on the screen. Only available on the 9480i, 9480iCT, 55i, 57i, and 57iCT. Softkey will be at position index. label is what is displayed next to the softkey button. uri is what is called when the softkey is pressed. Optionally, icon is the index of the icon to display to the left of the label.

# File lib/aastra_xml_api/phone.rb, line 172
def addSoftkey(index, label, uri, icon=nil)
  @softkeys += [PhoneSoftkeyEntry.new(index, escape(label), escape(uri), icon)]
end
convert_high_ascii(s) click to toggle source

Convert characters when using double sized text in PhoneFormattedTextScreen.

# File lib/aastra_xml_api/phone.rb, line 193
def convert_high_ascii(s)
  ret = ""
  s.each do |char|
    if not HIGHASCII[char].nil? then
      ret += HIGHASCII[char]
    else
      ret += char
    end
  end
  return ret
end
escape(s) click to toggle source

Convert any HTML characters to the proper escaped format. i.e. > becomes >

# File lib/aastra_xml_api/phone.rb, line 186
def escape(s)
  return nil if s.nil?
  CGI.escapeHTML(s)
end
getRefreshTimeout() click to toggle source

Returns the set refresh timeout value.

# File lib/aastra_xml_api/phone.rb, line 157
def getRefreshTimeout
  return @refreshTimeout
end
getRefreshURL() click to toggle source

Returns the set refresh URI.

# File lib/aastra_xml_api/phone.rb, line 162
def getRefreshURL
  return @refreshURL
end
setAllowAnswer() click to toggle source

Applies only to the non-softkey phones (53i). When set, the phone displays ‘Ignore’ and ‘Answer’ if the XML object is displayed when the phone is ringing.

# File lib/aastra_xml_api/phone.rb, line 152
def setAllowAnswer
  @allowAnswer = "yes"
end
setBeep() click to toggle source

Beep phone when XML is received.

# File lib/aastra_xml_api/phone.rb, line 123
def setBeep
  @beep = "yes"
end
setCancelAction(cancelAction) click to toggle source

Defines the URI to call when the user cancels the XML object.

# File lib/aastra_xml_api/phone.rb, line 133
def setCancelAction(cancelAction)
  @cancelAction = cancelAction
end
setDestroyOnExit() click to toggle source

Do not keep the object in the phone browser after exit.

# File lib/aastra_xml_api/phone.rb, line 128
def setDestroyOnExit
  @destroyOnExit = "yes"
end
setLockIn() click to toggle source

Ignores all keys that would cause the screen to exit without using keys defined by the object.

# File lib/aastra_xml_api/phone.rb, line 139
def setLockIn
  @lockin = "yes"
end
setRefresh(timeout, url) click to toggle source

Set refresh timeout (seconds) and the URI to load when the timeout is reached.

# File lib/aastra_xml_api/phone.rb, line 117
def setRefresh(timeout, url)
  @refreshTimeout = timeout
  @refreshURL = url
end
setTimeout(timeout) click to toggle source

Override the default 45 second timeout. A value of 0 will disable timeout.

# File lib/aastra_xml_api/phone.rb, line 145
def setTimeout(timeout)
  @timeout = timeout
end
setTitle(title) click to toggle source

Set the title of the Phone object. Typically displayed on the top of the phone.

# File lib/aastra_xml_api/phone.rb, line 106
def setTitle(title)
  @title = title
end
setTitleWrap() click to toggle source

Allow the title to wrap over multiple lines when displayed.

# File lib/aastra_xml_api/phone.rb, line 111
def setTitleWrap
  @title_wrap = "yes"
end