aastra_xml_api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +341 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/aastra_xml_api.gemspec +22 -0
- data/lib/aastra_xml_api/AastraIPPhone.rb +203 -0
- data/lib/aastra_xml_api/AastraIPPhoneConfiguration.rb +55 -0
- data/lib/aastra_xml_api/AastraIPPhoneConfigurationEntry.rb +41 -0
- data/lib/aastra_xml_api/AastraIPPhoneDirectory.rb +119 -0
- data/lib/aastra_xml_api/AastraIPPhoneDirectoryEntry.rb +32 -0
- data/lib/aastra_xml_api/AastraIPPhoneExecute.rb +58 -0
- data/lib/aastra_xml_api/AastraIPPhoneExecuteEntry.rb +30 -0
- data/lib/aastra_xml_api/AastraIPPhoneFormattedTextScreen.rb +117 -0
- data/lib/aastra_xml_api/AastraIPPhoneFormattedTextScreenEntry.rb +48 -0
- data/lib/aastra_xml_api/AastraIPPhoneGDImage.rb +185 -0
- data/lib/aastra_xml_api/AastraIPPhoneIconEntry.rb +27 -0
- data/lib/aastra_xml_api/AastraIPPhoneImageMenu.rb +143 -0
- data/lib/aastra_xml_api/AastraIPPhoneImageMenuEntry.rb +25 -0
- data/lib/aastra_xml_api/AastraIPPhoneImageScreen.rb +139 -0
- data/lib/aastra_xml_api/AastraIPPhoneInputScreen.rb +249 -0
- data/lib/aastra_xml_api/AastraIPPhoneInputScreenEntry.rb +84 -0
- data/lib/aastra_xml_api/AastraIPPhoneSoftkeyEntry.rb +37 -0
- data/lib/aastra_xml_api/AastraIPPhoneStatus.rb +66 -0
- data/lib/aastra_xml_api/AastraIPPhoneStatusEntry.rb +56 -0
- data/lib/aastra_xml_api/AastraIPPhoneTextMenu.rb +145 -0
- data/lib/aastra_xml_api/AastraIPPhoneTextMenuEntry.rb +52 -0
- data/lib/aastra_xml_api/AastraIPPhoneTextScreen.rb +93 -0
- data/lib/aastra_xml_api/arraynatsort.rb +63 -0
- data/lib/aastra_xml_api/version.rb +3 -0
- data/lib/aastra_xml_api.rb +9 -0
- metadata +89 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneSoftkeyEntry
|
3
|
+
# Firmware 2.2.0 or better
|
4
|
+
# Copyright Aastra Telecom 2008
|
5
|
+
#
|
6
|
+
# Ruby adaptation by Carlton O'Riley
|
7
|
+
#
|
8
|
+
# Internal class for AastraIPPhone object.
|
9
|
+
################################################################################
|
10
|
+
|
11
|
+
class AastraIPPhoneSoftkeyEntry
|
12
|
+
@index
|
13
|
+
@label
|
14
|
+
@uri
|
15
|
+
@icon
|
16
|
+
|
17
|
+
# Create new softkey entry at index showing on screen with label. When
|
18
|
+
# pressed will call URI. Next to the label text the given icon
|
19
|
+
# will be shown.
|
20
|
+
def initialize(index, label, uri, icon)
|
21
|
+
@index = index
|
22
|
+
@label = label
|
23
|
+
@uri = uri
|
24
|
+
@icon = icon
|
25
|
+
end
|
26
|
+
|
27
|
+
# Create XML text output for this entry.
|
28
|
+
def render
|
29
|
+
xml = "<SoftKey index=\"#{@index}\""
|
30
|
+
xml += " icon=\"#{@icon}\"" if not @icon.nil?
|
31
|
+
xml += ">\n"
|
32
|
+
xml += "<Label>#{@label}</Label>\n"
|
33
|
+
xml += "<URI>#{@uri}</URI>\n"
|
34
|
+
xml += "</SoftKey>\n"
|
35
|
+
return xml
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneStatus
|
3
|
+
# Copyright Aastra Telecom 2008
|
4
|
+
#
|
5
|
+
# Ruby adaptation by Carlton O'Riley
|
6
|
+
#
|
7
|
+
# AastraIPPhoneStatus object.
|
8
|
+
#
|
9
|
+
# Public methods
|
10
|
+
#
|
11
|
+
# Inherited from AastraIPPhone
|
12
|
+
# setBeep to enable a notification beep with the object (optional)
|
13
|
+
#
|
14
|
+
# Specific to the object
|
15
|
+
# setSession(session) to setup the session ID
|
16
|
+
# setTriggerDestroyOnExit to set the triggerDestroyOnExit tag to
|
17
|
+
# "yes" (optional)
|
18
|
+
# addEntry(index,message,type,timeout) to add a message to be displayed
|
19
|
+
# on the idle screen.
|
20
|
+
#
|
21
|
+
# Example
|
22
|
+
# require 'AastraIPPhoneStatus.rb'
|
23
|
+
# status = AastraIPPhoneStatus.new
|
24
|
+
# status.setSession('Session');
|
25
|
+
# status.setBeep
|
26
|
+
# status.addEntry('1', 'Message 1', '', 0)
|
27
|
+
# status.addEntry('2', 'Message 2', 'alert', 5)
|
28
|
+
# aastra_output status
|
29
|
+
#
|
30
|
+
################################################################################
|
31
|
+
|
32
|
+
class AastraIPPhoneStatus < AastraIPPhone
|
33
|
+
@session
|
34
|
+
@triggerDestroyOnExit
|
35
|
+
|
36
|
+
# Sets the session associated with this status message. Only important
|
37
|
+
# if more than one application is sending status messages.
|
38
|
+
def setSession(session)
|
39
|
+
@session = session
|
40
|
+
end
|
41
|
+
|
42
|
+
# When set, the previous user interface XML object is destroyed
|
43
|
+
# if its destroyOnExit tag is also set to yes.
|
44
|
+
def setTriggerDestroyOnExit
|
45
|
+
@triggerDestroyOnExit = "yes"
|
46
|
+
end
|
47
|
+
|
48
|
+
# Adds a new status message to be displayed at index. The type can only
|
49
|
+
# be nothing (default) or alert which shows the message for 3 seconds.
|
50
|
+
# The timeout can override the default 3 seconds for an alert message.
|
51
|
+
def addEntry(index, message, type=nil, timeout=nil)
|
52
|
+
@entries += [AastraIPPhoneStatusEntry.new(index, message, type, timeout)]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Create XML text output.
|
56
|
+
def render
|
57
|
+
xml = "<AastraIPPhoneStatus"
|
58
|
+
xml += " Beep=\"yes\"" if @beep == "yes"
|
59
|
+
xml += " triggerDestroyOnExit=\"yes\"" if @triggerDestroyOnExit == "yes"
|
60
|
+
xml += ">\n"
|
61
|
+
xml += "<Session>#{@session}</Session>\n"
|
62
|
+
@entries.each { |entry| xml += entry.render }
|
63
|
+
xml += "</AastraIPPhoneStatus>\n"
|
64
|
+
return xml
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneStatusEntry
|
3
|
+
# Copyright Aastra Telecom 2008
|
4
|
+
#
|
5
|
+
# Ruby adaptation by Carlton O'Riley
|
6
|
+
#
|
7
|
+
# Internal class for AastraIPPhoneStatus object.
|
8
|
+
################################################################################
|
9
|
+
|
10
|
+
class AastraIPPhoneStatusEntry < AastraIPPhone
|
11
|
+
@index
|
12
|
+
@message
|
13
|
+
@type
|
14
|
+
@timeout
|
15
|
+
|
16
|
+
# Create new status message at index. Type can only be "alert" or left
|
17
|
+
# blank. If the type is anything but blank, it is automatically set
|
18
|
+
# to "alert". The timeout overrides the default 3 seconds for an
|
19
|
+
# alert message.
|
20
|
+
def initialize(index, message, type=nil, timeout=nil)
|
21
|
+
@index = index
|
22
|
+
@message = message
|
23
|
+
setType(type)
|
24
|
+
@timeout = timeout
|
25
|
+
end
|
26
|
+
|
27
|
+
# Set the index of this message.
|
28
|
+
def setIndex(index)
|
29
|
+
@index = index
|
30
|
+
end
|
31
|
+
|
32
|
+
# Set the text of the message.
|
33
|
+
def setMessage(message)
|
34
|
+
@message = message
|
35
|
+
end
|
36
|
+
|
37
|
+
# Set the type of the message. Either "alert" or normal (blank and default)
|
38
|
+
def setType(type)
|
39
|
+
@type = type if type.nil?
|
40
|
+
@type = "alert" if not type.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
# Set the timeout (in seconds) of an alert message
|
44
|
+
def setTimeout(timeout)
|
45
|
+
@timeout = timeout
|
46
|
+
end
|
47
|
+
|
48
|
+
# Create XML text output of this entry
|
49
|
+
def render
|
50
|
+
xml = "<Message index=\"#{escape(@index)}\""
|
51
|
+
xml += " type=\"#{escape(@type)}\"" if not @type.nil?
|
52
|
+
xml += " Timeout=\"#{@timeout}\"" if not @timeout.nil?
|
53
|
+
xml += ">#{escape(@message)}</Message>\n"
|
54
|
+
return xml
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneTextMenu
|
3
|
+
# Copyright Aastra Telecom 2008
|
4
|
+
#
|
5
|
+
# AastraIPPhoneTextMenu object.
|
6
|
+
#
|
7
|
+
# Public methods
|
8
|
+
#
|
9
|
+
# Inherited from AastraIPPhone
|
10
|
+
# setTitle(Title) to setup the title of an object (optional)
|
11
|
+
# setTitleWrap to set the title to be wrapped on 2 lines (optional)
|
12
|
+
# setDestroyOnExit to set DestroyOnExit parameter to "yes" (optional)
|
13
|
+
# setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (optional)
|
14
|
+
# setBeep to enable a notification beep with the object (optional)
|
15
|
+
# setLockIn to set the Lock-in tag to 'yes' (optional)
|
16
|
+
# setAllowAnswer to set the allowAnswer tag to 'yes' (optional)
|
17
|
+
# setTimeout(timeout) to define a specific timeout for the XML object (optional)
|
18
|
+
# addSoftkey(index,label,uri,icon_index) to add custom softkeys to the object (optional)
|
19
|
+
# addIcon(index,icon) to add custom icons to the object (optional)
|
20
|
+
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
21
|
+
#
|
22
|
+
# Specific to the object
|
23
|
+
# setDefaultIndex(index) to set the default selection in the list (optional)
|
24
|
+
# setStyle(style) to set the style of the list numbered/none/radio (optional)
|
25
|
+
# setWrapList to allow 2 lines items (optional)
|
26
|
+
# addEntry(name,url,selection,icon,dial) to add an element in the list to be displayed
|
27
|
+
# natsortbyname to order the list
|
28
|
+
#
|
29
|
+
# Example 1
|
30
|
+
# require 'AastraIPPhoneTextMenu.rb'
|
31
|
+
# menu = AastraIPPhoneTextMenu.new
|
32
|
+
# menu.setTitle('Title')
|
33
|
+
# menu.setDestroyOnExit
|
34
|
+
# menu.setDeFaultIndex('3')
|
35
|
+
# menu.addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2')
|
36
|
+
# menu.addEntry('Choice 1', 'http://myserver.com/script.php?choice=1', 'Value=1')
|
37
|
+
# menu.addEntry('Choice 3', 'http://myserver.com/script.php?choice=3', 'Value=3')
|
38
|
+
# menu.natsortByName
|
39
|
+
# menu.addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1')
|
40
|
+
# menu.addSoftkey('6', 'Exit', 'SoftKey:Exit')
|
41
|
+
# aastra_output menu
|
42
|
+
#
|
43
|
+
# Example 2
|
44
|
+
# require 'AastraIPPhoneTextMenu.rb'
|
45
|
+
# menu = AastraIPPhoneTextMenu.new
|
46
|
+
# menu.setTitle('Title')
|
47
|
+
# menu.setDestroyOnExit
|
48
|
+
# menu.setDeFaultIndex('2')
|
49
|
+
# menu.addEntry('Choice 2', 'http://myserver.com/script.php?choice=2', 'Value=2','1')
|
50
|
+
# menu.addEntry('Choice 1', 'http://myserver.com/script.php?choice=1', 'Value=1','2')
|
51
|
+
# menu.addEntry('Choice 3', 'http://myserver.com/script.php?choice=3', 'Value=3','3')
|
52
|
+
# menu.natsortByName
|
53
|
+
# menu.addSoftkey('1', 'My Select', 'http://myserver.com/script.php?action=1')
|
54
|
+
# menu.addSoftkey('6', 'Exit', 'SoftKey:Exit')
|
55
|
+
# menu.addIcon('1', 'Icon:PhoneOnHook')
|
56
|
+
# menu.addIcon('2', 'Icon:PhoneOffHook')
|
57
|
+
# menu.addIcon('3', 'Icon:PhoneRinging')
|
58
|
+
# aastra_output menu
|
59
|
+
#
|
60
|
+
################################################################################
|
61
|
+
|
62
|
+
class AastraIPPhoneTextMenu < AastraIPPhone
|
63
|
+
@defaultIndex
|
64
|
+
@style
|
65
|
+
@wraplist
|
66
|
+
@maxitems
|
67
|
+
|
68
|
+
# Sets the default index to highlight when first shown.
|
69
|
+
def setDefaultIndex(defaultIndex)
|
70
|
+
@defaultIndex = defaultIndex
|
71
|
+
end
|
72
|
+
|
73
|
+
# Set the style to one of numbered (default), none, or radio.
|
74
|
+
def setStyle(style)
|
75
|
+
@style = style
|
76
|
+
end
|
77
|
+
|
78
|
+
# Add a menu entry with name displayed and calls url when selected. The
|
79
|
+
# selection option is the value appended to a custom softkey URL when
|
80
|
+
# this item is highlighted. icon is a reference to an included icon
|
81
|
+
# that is shown with the menu entry. dial is what is called when
|
82
|
+
# the user hits a softkey with the URI "SoftKey:Dial2".
|
83
|
+
def addEntry(name, url, selection=nil, icon=nil, dial=nil)
|
84
|
+
@entries += [AastraIPPhoneTextMenuEntry.new(name, url, selection, icon, dial)]
|
85
|
+
end
|
86
|
+
|
87
|
+
# Allows entries in the list to wrap.
|
88
|
+
def setWrapList
|
89
|
+
@wraplist = "yes"
|
90
|
+
end
|
91
|
+
|
92
|
+
# Use natural order sorting to sort the menu by name.
|
93
|
+
def natsortByName
|
94
|
+
tmparray = []
|
95
|
+
linklist = {}
|
96
|
+
for i in 0..@entries.size-1
|
97
|
+
tmparray += [@entries[i].getName]
|
98
|
+
linklist[@entries[i].getName] = i
|
99
|
+
end
|
100
|
+
tmparray.natsort!
|
101
|
+
newentries = []
|
102
|
+
tmparray.each do |name|
|
103
|
+
newentries += [@entries[linklist[name]]]
|
104
|
+
end
|
105
|
+
@entries = newentries
|
106
|
+
end
|
107
|
+
|
108
|
+
# Create XML text output.
|
109
|
+
def render
|
110
|
+
@maxitems = 30 if @maxitems.nil?
|
111
|
+
xml = "<AastraIPPhoneTextMenu"
|
112
|
+
xml += " destroyOnExit=\"yes\"" if @destroyOnExit == "yes"
|
113
|
+
xml += " cancelAction=\"#{escape(@cancelAction)}\"" if not @cancelAction.nil?
|
114
|
+
xml += " defaultIndex=\"#{@defaultIndex}\"" if not @defaultIndex.nil?
|
115
|
+
xml += " style=\"#{@style}\"" if not @style.nil?
|
116
|
+
xml += " Beep=\"yes\"" if @beep == "yes"
|
117
|
+
xml += " LockIn=\"yes\"" if @lockin == "yes"
|
118
|
+
xml += " wrapList=\"yes\"" if @wraplist == "yes"
|
119
|
+
xml += " allowAnswer=\"yes\"" if @allowAnswer == "yes"
|
120
|
+
xml += " Timeout=\"#{@timeout}\"" if @timeout != 0
|
121
|
+
xml += ">\n"
|
122
|
+
if not @title.nil? then
|
123
|
+
xml += "<Title"
|
124
|
+
xml += " wrap=\"yes\"" if @title_wrap == "yes"
|
125
|
+
xml += ">#{escape(@title)}</Title>\n"
|
126
|
+
end
|
127
|
+
index = 0
|
128
|
+
@entries.each do |entry|
|
129
|
+
xml += entry.render if index < @maxitems
|
130
|
+
index += 1
|
131
|
+
end
|
132
|
+
@softkeys.each { |softkey| xml += softkey.render }
|
133
|
+
iconList = 0
|
134
|
+
@icons.each do |icon|
|
135
|
+
if iconList == 0 then
|
136
|
+
xml += "<IconList>\n"
|
137
|
+
iconList = 1
|
138
|
+
end
|
139
|
+
xml += icon.render
|
140
|
+
end
|
141
|
+
xml += "</IconList>\n" if iconList != 0
|
142
|
+
xml += "</AastraIPPhoneTextMenu>\n"
|
143
|
+
return xml
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneTextMenuEntry
|
3
|
+
# Copyright Aastra Telecom 2008
|
4
|
+
#
|
5
|
+
# Ruby adaptation by Carlton O'Riley
|
6
|
+
#
|
7
|
+
# Internal class for AastraIPPhoneTextMenu object.
|
8
|
+
################################################################################
|
9
|
+
|
10
|
+
class AastraIPPhoneTextMenuEntry < AastraIPPhone
|
11
|
+
@name
|
12
|
+
@url
|
13
|
+
@selection
|
14
|
+
@icon
|
15
|
+
@dial
|
16
|
+
|
17
|
+
# Create new text menu entry with given name to be displayed, url to be
|
18
|
+
# called when selected. Selection is the value appended to a custom URI
|
19
|
+
# attached to a softkey. This will be added as either ?selection=value
|
20
|
+
# or &selection=value depending on if the URI already has parameters.
|
21
|
+
# icon is the index of the icon to be displayed to the left of the
|
22
|
+
# given entry. dial is the number to call if the user pushes a softkey
|
23
|
+
# with URI SoftKey:Dial2.
|
24
|
+
def initialize(name, url, selection, icon, dial)
|
25
|
+
@name = name
|
26
|
+
@url = url
|
27
|
+
@selection = selection
|
28
|
+
@icon = icon
|
29
|
+
@dial = dial
|
30
|
+
@selection = nil if @selection == ''
|
31
|
+
@icon = nil if @icon == ''
|
32
|
+
@dial = nil if @dial == ''
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the name associated with this entry.
|
36
|
+
def getName
|
37
|
+
return @name
|
38
|
+
end
|
39
|
+
|
40
|
+
# Create XML text output of this entry.
|
41
|
+
def render
|
42
|
+
xml = "<MenuItem"
|
43
|
+
xml += " icon=\"#{@icon}\"" if not @icon.nil?
|
44
|
+
xml += ">\n"
|
45
|
+
xml += "<Prompt>#{escape(@name)}</Prompt>\n"
|
46
|
+
xml += "<URI>#{escape(@url)}</URI>\n"
|
47
|
+
xml += "<Selection>#{escape(@selection)}</Selection>\n" if not @selection.nil?
|
48
|
+
xml += "<Dial>#{@dial}</Dial>\n" if not @dial.nil?
|
49
|
+
xml += "</MenuItem>\n"
|
50
|
+
return xml
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Aastra XML API Classes - AastraIPPhoneTextScreen
|
3
|
+
# Copyright Aastra Telecom 2008
|
4
|
+
#
|
5
|
+
# Ruby adaptation by Carlton O'Riley
|
6
|
+
#
|
7
|
+
# AastraIPPhoneTextScreen object.
|
8
|
+
#
|
9
|
+
# Public methods
|
10
|
+
#
|
11
|
+
# Inherited from AastraIPPhone
|
12
|
+
# setTitle(Title) to setup the title of an object (optional)
|
13
|
+
# setTitleWrap to set the title to be wrapped on 2 lines (optional)
|
14
|
+
# setDestroyOnExit to set DestroyonExit parameter to 'yes', 'no' by default (optional)
|
15
|
+
# setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (optional)
|
16
|
+
# setBeep to enable a notification beep with the object (optional)
|
17
|
+
# setLockIn to set the Lock-in tag to 'yes' (optional)
|
18
|
+
# setAllowAnswer to set the allowAnswer tag to 'yes' (optional)
|
19
|
+
# setTimeout(timeout) to define a specific timeout for the XML object (optional)
|
20
|
+
# addSoftkey(index,label,uri,iconindex) to add custom softkeys to the object (optional)
|
21
|
+
# addIcon(index,icon) to add custom icons to the object (optional)
|
22
|
+
# setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
|
23
|
+
#
|
24
|
+
# Specific to the object
|
25
|
+
# setText(text) to set the text to be displayed.
|
26
|
+
# setDoneAction(uri) to set the URI to be called when the user selects the default "Done" key (optional)
|
27
|
+
# setAllowDTMF to allow DTMF passthrough on the object
|
28
|
+
#
|
29
|
+
# Example
|
30
|
+
# require 'AastraIPPhoneTextScreen.rb'
|
31
|
+
# text = AastraIPPhoneTextScreen.new
|
32
|
+
# text.setTitle('Title')
|
33
|
+
# text.setText('Text to be displayed.')
|
34
|
+
# text.setDestroyOnExit
|
35
|
+
# text.addSoftkey('1', 'Mail', 'http://myserver.com/script.php?action=1', '1')
|
36
|
+
# text.addSoftkey('6', 'Exit', 'SoftKey:Exit')
|
37
|
+
# text.addIcon('1', 'Icon:Envelope')
|
38
|
+
# aastra_output text
|
39
|
+
#
|
40
|
+
################################################################################
|
41
|
+
|
42
|
+
class AastraIPPhoneTextScreen < AastraIPPhone
|
43
|
+
@text
|
44
|
+
@doneAction
|
45
|
+
@allowDTMF
|
46
|
+
|
47
|
+
# Set the text to be displayed on this screen.
|
48
|
+
def setText(text)
|
49
|
+
@text = text
|
50
|
+
end
|
51
|
+
|
52
|
+
# Set the URI to be called when done viewing this screen.
|
53
|
+
def setDoneAction(uri)
|
54
|
+
@doneAction = uri
|
55
|
+
end
|
56
|
+
|
57
|
+
# When set allows DTMF tones to be sent while viewing this screen.
|
58
|
+
def setAllowDTMF
|
59
|
+
@allowDTMF = "yes"
|
60
|
+
end
|
61
|
+
|
62
|
+
# Create XML text output.
|
63
|
+
def render
|
64
|
+
xml = "<AastraIPPhoneTextScreen"
|
65
|
+
xml += " destroyOnExit=\"yes\"" if @destroyOnExit == "yes"
|
66
|
+
xml += " cancelAction=\"#{escape(@cancelAction)}\"" if not @cancelAction.nil?
|
67
|
+
xml += " doneAction=\"#{escape(@doneAction)}\"" if not @doneAction.nil?
|
68
|
+
xml += " Beep=\"yes\"" if @beep == "yes"
|
69
|
+
xml += " Timeout=\"#{@timeout}\"" if @timeout != 0
|
70
|
+
xml += " LockIn=\"yes\"" if @lockin == "yes"
|
71
|
+
xml += " allowAnswer=\"yes\"" if @allowAnswer == "yes"
|
72
|
+
xml += " allowDTMF=\"yes\"" if @allowDTMF == "yes"
|
73
|
+
xml += ">\n"
|
74
|
+
if not @title.nil? then
|
75
|
+
xml += "<Title"
|
76
|
+
xml += " wrap=\"yes\"" if @title_wrap == "yes"
|
77
|
+
xml += ">#{escape(@title)}</Title>\n"
|
78
|
+
end
|
79
|
+
xml += "<Text>#{escape(@text)}</Text>\n"
|
80
|
+
@softkeys.each { |softkey| xml += softkey.render }
|
81
|
+
iconList = 0
|
82
|
+
@icons.each do |icon|
|
83
|
+
if iconList == 0 then
|
84
|
+
xml += "<IconList>\n"
|
85
|
+
iconList = 1
|
86
|
+
end
|
87
|
+
xml += icon.render
|
88
|
+
end
|
89
|
+
xml += "</IconList>\n" if iconList != 0
|
90
|
+
xml += "</AastraIPPhoneTextScreen>\n"
|
91
|
+
return xml
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Performs natural order sorting of an array. Natural order is the way in
|
2
|
+
# which a human might sort a list of files that are incremented by
|
3
|
+
# one. They will sort normally as long as they have leading zeros,
|
4
|
+
# however this doesn't look good and is hard to read. What natural sorting
|
5
|
+
# does is allow the following to be sorted properly (as shown):
|
6
|
+
#
|
7
|
+
# file1
|
8
|
+
# file2
|
9
|
+
# file4
|
10
|
+
# file22
|
11
|
+
# file30
|
12
|
+
# file100
|
13
|
+
#
|
14
|
+
# Code used is from http://zijab.blogspot.com/2007/05/natural-order-string-comparison-for.html
|
15
|
+
#
|
16
|
+
|
17
|
+
class Array
|
18
|
+
|
19
|
+
# Method which sort an array composed of strings with embedded numbers by
|
20
|
+
# the 'natural' representation of numbers inside a string.
|
21
|
+
def natsort
|
22
|
+
|
23
|
+
reg_number = /\d+/
|
24
|
+
|
25
|
+
# We call the sort method of the Array class.
|
26
|
+
self.sort do |str1, str2|
|
27
|
+
|
28
|
+
# We try to find an embedded number
|
29
|
+
a = str1.match(reg_number)
|
30
|
+
b = str2.match(reg_number)
|
31
|
+
|
32
|
+
# If there is no number
|
33
|
+
if [a,b].include? nil
|
34
|
+
str1 <=> str2
|
35
|
+
else
|
36
|
+
while true
|
37
|
+
begin
|
38
|
+
# We compare strings before the number. If there
|
39
|
+
# are equal, we will have to compare the numbers
|
40
|
+
if (comp = a.pre_match <=> b.pre_match) == 0
|
41
|
+
# If the numbers are equal
|
42
|
+
comp = (a[0] == b[0]) ? comp = a[0] + a.post_match <=> b[0] + b.post_match :
|
43
|
+
comp = a[0].to_i <=> b[0].to_i
|
44
|
+
end
|
45
|
+
|
46
|
+
str1, str2 = a.post_match, b.post_match
|
47
|
+
a = str1.match(reg_number)
|
48
|
+
b = str2.match(reg_number)
|
49
|
+
rescue
|
50
|
+
break
|
51
|
+
end
|
52
|
+
end
|
53
|
+
comp
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Same as 'natsort' but replace in place.
|
59
|
+
def natsort!
|
60
|
+
self.replace(natsort)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aastra_xml_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emery A. Miller
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
description: Gemified version of Carlton O'Riley's Aastra XML Ruby Port
|
28
|
+
email:
|
29
|
+
- emery.miller@easyofficephone.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE.txt
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- aastra_xml_api.gemspec
|
40
|
+
- lib/aastra_xml_api.rb
|
41
|
+
- lib/aastra_xml_api/AastraIPPhone.rb
|
42
|
+
- lib/aastra_xml_api/AastraIPPhoneConfiguration.rb
|
43
|
+
- lib/aastra_xml_api/AastraIPPhoneConfigurationEntry.rb
|
44
|
+
- lib/aastra_xml_api/AastraIPPhoneDirectory.rb
|
45
|
+
- lib/aastra_xml_api/AastraIPPhoneDirectoryEntry.rb
|
46
|
+
- lib/aastra_xml_api/AastraIPPhoneExecute.rb
|
47
|
+
- lib/aastra_xml_api/AastraIPPhoneExecuteEntry.rb
|
48
|
+
- lib/aastra_xml_api/AastraIPPhoneFormattedTextScreen.rb
|
49
|
+
- lib/aastra_xml_api/AastraIPPhoneFormattedTextScreenEntry.rb
|
50
|
+
- lib/aastra_xml_api/AastraIPPhoneGDImage.rb
|
51
|
+
- lib/aastra_xml_api/AastraIPPhoneIconEntry.rb
|
52
|
+
- lib/aastra_xml_api/AastraIPPhoneImageMenu.rb
|
53
|
+
- lib/aastra_xml_api/AastraIPPhoneImageMenuEntry.rb
|
54
|
+
- lib/aastra_xml_api/AastraIPPhoneImageScreen.rb
|
55
|
+
- lib/aastra_xml_api/AastraIPPhoneInputScreen.rb
|
56
|
+
- lib/aastra_xml_api/AastraIPPhoneInputScreenEntry.rb
|
57
|
+
- lib/aastra_xml_api/AastraIPPhoneSoftkeyEntry.rb
|
58
|
+
- lib/aastra_xml_api/AastraIPPhoneStatus.rb
|
59
|
+
- lib/aastra_xml_api/AastraIPPhoneStatusEntry.rb
|
60
|
+
- lib/aastra_xml_api/AastraIPPhoneTextMenu.rb
|
61
|
+
- lib/aastra_xml_api/AastraIPPhoneTextMenuEntry.rb
|
62
|
+
- lib/aastra_xml_api/AastraIPPhoneTextScreen.rb
|
63
|
+
- lib/aastra_xml_api/arraynatsort.rb
|
64
|
+
- lib/aastra_xml_api/version.rb
|
65
|
+
homepage: http://www.easyofficephone.com
|
66
|
+
licenses:
|
67
|
+
- GNU GPL v2
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.2.0
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Aastra XML API for Ruby
|
89
|
+
test_files: []
|