jicksta-adhearsion 0.7.999

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.
Files changed (107) hide show
  1. data/CHANGELOG +6 -0
  2. data/EVENTS +11 -0
  3. data/LICENSE +456 -0
  4. data/README.txt +5 -0
  5. data/Rakefile +120 -0
  6. data/adhearsion.gemspec +146 -0
  7. data/app_generators/ahn/USAGE +5 -0
  8. data/app_generators/ahn/ahn_generator.rb +87 -0
  9. data/app_generators/ahn/templates/.ahnrc +34 -0
  10. data/app_generators/ahn/templates/README +8 -0
  11. data/app_generators/ahn/templates/Rakefile +23 -0
  12. data/app_generators/ahn/templates/components/ami_remote/ami_remote.rb +15 -0
  13. data/app_generators/ahn/templates/components/disabled/HOW_TO_ENABLE +7 -0
  14. data/app_generators/ahn/templates/components/disabled/stomp_gateway/README.markdown +47 -0
  15. data/app_generators/ahn/templates/components/disabled/stomp_gateway/config.yml +12 -0
  16. data/app_generators/ahn/templates/components/disabled/stomp_gateway/stomp_gateway.rb +34 -0
  17. data/app_generators/ahn/templates/components/restful_rpc/README.markdown +11 -0
  18. data/app_generators/ahn/templates/components/restful_rpc/config.yml +34 -0
  19. data/app_generators/ahn/templates/components/restful_rpc/example-client.rb +48 -0
  20. data/app_generators/ahn/templates/components/restful_rpc/restful_rpc.rb +87 -0
  21. data/app_generators/ahn/templates/components/simon_game/simon_game.rb +56 -0
  22. data/app_generators/ahn/templates/config/startup.rb +53 -0
  23. data/app_generators/ahn/templates/dialplan.rb +3 -0
  24. data/app_generators/ahn/templates/events.rb +32 -0
  25. data/bin/ahn +28 -0
  26. data/bin/ahnctl +68 -0
  27. data/bin/jahn +42 -0
  28. data/examples/asterisk_manager_interface/standalone.rb +51 -0
  29. data/lib/adhearsion/cli.rb +223 -0
  30. data/lib/adhearsion/component_manager/spec_framework.rb +24 -0
  31. data/lib/adhearsion/component_manager.rb +208 -0
  32. data/lib/adhearsion/events_support.rb +84 -0
  33. data/lib/adhearsion/foundation/all.rb +9 -0
  34. data/lib/adhearsion/foundation/blank_slate.rb +5 -0
  35. data/lib/adhearsion/foundation/custom_daemonizer.rb +45 -0
  36. data/lib/adhearsion/foundation/event_socket.rb +203 -0
  37. data/lib/adhearsion/foundation/future_resource.rb +36 -0
  38. data/lib/adhearsion/foundation/global.rb +1 -0
  39. data/lib/adhearsion/foundation/metaprogramming.rb +17 -0
  40. data/lib/adhearsion/foundation/numeric.rb +13 -0
  41. data/lib/adhearsion/foundation/pseudo_guid.rb +10 -0
  42. data/lib/adhearsion/foundation/relationship_properties.rb +42 -0
  43. data/lib/adhearsion/foundation/string.rb +26 -0
  44. data/lib/adhearsion/foundation/synchronized_hash.rb +96 -0
  45. data/lib/adhearsion/foundation/thread_safety.rb +7 -0
  46. data/lib/adhearsion/host_definitions.rb +67 -0
  47. data/lib/adhearsion/initializer/asterisk.rb +81 -0
  48. data/lib/adhearsion/initializer/configuration.rb +254 -0
  49. data/lib/adhearsion/initializer/database.rb +49 -0
  50. data/lib/adhearsion/initializer/drb.rb +31 -0
  51. data/lib/adhearsion/initializer/freeswitch.rb +22 -0
  52. data/lib/adhearsion/initializer/rails.rb +40 -0
  53. data/lib/adhearsion/initializer.rb +373 -0
  54. data/lib/adhearsion/logging.rb +92 -0
  55. data/lib/adhearsion/tasks/database.rb +5 -0
  56. data/lib/adhearsion/tasks/deprecations.rb +59 -0
  57. data/lib/adhearsion/tasks/generating.rb +20 -0
  58. data/lib/adhearsion/tasks/lint.rb +4 -0
  59. data/lib/adhearsion/tasks/testing.rb +37 -0
  60. data/lib/adhearsion/tasks.rb +16 -0
  61. data/lib/adhearsion/version.rb +9 -0
  62. data/lib/adhearsion/voip/asterisk/agi_server.rb +81 -0
  63. data/lib/adhearsion/voip/asterisk/commands.rb +1284 -0
  64. data/lib/adhearsion/voip/asterisk/config_generators/agents.conf.rb +140 -0
  65. data/lib/adhearsion/voip/asterisk/config_generators/config_generator.rb +101 -0
  66. data/lib/adhearsion/voip/asterisk/config_generators/queues.conf.rb +250 -0
  67. data/lib/adhearsion/voip/asterisk/config_generators/voicemail.conf.rb +240 -0
  68. data/lib/adhearsion/voip/asterisk/config_manager.rb +71 -0
  69. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb +1754 -0
  70. data/lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb +286 -0
  71. data/lib/adhearsion/voip/asterisk/manager_interface/ami_messages.rb +78 -0
  72. data/lib/adhearsion/voip/asterisk/manager_interface/ami_protocol_lexer_machine.rl +87 -0
  73. data/lib/adhearsion/voip/asterisk/manager_interface.rb +562 -0
  74. data/lib/adhearsion/voip/asterisk/special_dial_plan_managers.rb +80 -0
  75. data/lib/adhearsion/voip/asterisk/super_manager.rb +19 -0
  76. data/lib/adhearsion/voip/asterisk.rb +4 -0
  77. data/lib/adhearsion/voip/call.rb +440 -0
  78. data/lib/adhearsion/voip/call_routing.rb +64 -0
  79. data/lib/adhearsion/voip/commands.rb +9 -0
  80. data/lib/adhearsion/voip/constants.rb +39 -0
  81. data/lib/adhearsion/voip/conveniences.rb +18 -0
  82. data/lib/adhearsion/voip/dial_plan.rb +218 -0
  83. data/lib/adhearsion/voip/dsl/dialing_dsl/dialing_dsl_monkey_patches.rb +37 -0
  84. data/lib/adhearsion/voip/dsl/dialing_dsl.rb +151 -0
  85. data/lib/adhearsion/voip/dsl/dialplan/control_passing_exception.rb +27 -0
  86. data/lib/adhearsion/voip/dsl/dialplan/dispatcher.rb +124 -0
  87. data/lib/adhearsion/voip/dsl/dialplan/parser.rb +71 -0
  88. data/lib/adhearsion/voip/dsl/dialplan/thread_mixin.rb +16 -0
  89. data/lib/adhearsion/voip/dsl/numerical_string.rb +117 -0
  90. data/lib/adhearsion/voip/freeswitch/basic_connection_manager.rb +48 -0
  91. data/lib/adhearsion/voip/freeswitch/event_handler.rb +58 -0
  92. data/lib/adhearsion/voip/freeswitch/freeswitch_dialplan_command_factory.rb +129 -0
  93. data/lib/adhearsion/voip/freeswitch/inbound_connection_manager.rb +38 -0
  94. data/lib/adhearsion/voip/freeswitch/oes_server.rb +195 -0
  95. data/lib/adhearsion/voip/menu_state_machine/calculated_match.rb +80 -0
  96. data/lib/adhearsion/voip/menu_state_machine/matchers.rb +123 -0
  97. data/lib/adhearsion/voip/menu_state_machine/menu_builder.rb +58 -0
  98. data/lib/adhearsion/voip/menu_state_machine/menu_class.rb +149 -0
  99. data/lib/adhearsion.rb +37 -0
  100. data/lib/theatre/README.markdown +64 -0
  101. data/lib/theatre/callback_definition_loader.rb +84 -0
  102. data/lib/theatre/guid.rb +23 -0
  103. data/lib/theatre/invocation.rb +121 -0
  104. data/lib/theatre/namespace_manager.rb +153 -0
  105. data/lib/theatre/version.rb +2 -0
  106. data/lib/theatre.rb +151 -0
  107. metadata +177 -0
@@ -0,0 +1,1754 @@
1
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
2
+ require File.join(File.dirname(__FILE__), 'ami_messages.rb')
3
+
4
+ module Adhearsion
5
+ module VoIP
6
+ module Asterisk
7
+ module Manager
8
+ class AbstractAsteriskManagerInterfaceStreamLexer
9
+
10
+ BUFFER_SIZE = 8.kilobytes unless defined? BUFFER_SIZE
11
+
12
+ # line 52 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
13
+ ##
14
+
15
+ attr_accessor(:ami_version)
16
+ def initialize
17
+
18
+ @data = ""
19
+ @current_pointer = 0
20
+ @ragel_stack = []
21
+
22
+
23
+ # line 24 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
24
+ class << self
25
+ attr_accessor :_ami_protocol_parser_actions
26
+ private :_ami_protocol_parser_actions, :_ami_protocol_parser_actions=
27
+ end
28
+ self._ami_protocol_parser_actions = [
29
+ 0, 1, 0, 1, 2, 1, 5, 1,
30
+ 6, 1, 7, 1, 8, 1, 9, 1,
31
+ 10, 1, 13, 1, 17, 1, 18, 1,
32
+ 19, 1, 20, 1, 28, 1, 30, 1,
33
+ 31, 1, 35, 1, 36, 1, 37, 1,
34
+ 38, 1, 39, 1, 40, 1, 41, 1,
35
+ 46, 1, 47, 1, 48, 1, 49, 1,
36
+ 50, 1, 53, 1, 54, 1, 55, 1,
37
+ 56, 1, 57, 2, 1, 24, 2, 3,
38
+ 26, 2, 4, 45, 2, 7, 17, 2,
39
+ 8, 9, 2, 9, 10, 2, 11, 9,
40
+ 2, 12, 10, 2, 14, 34, 2, 15,
41
+ 13, 2, 19, 20, 2, 21, 42, 2,
42
+ 22, 43, 2, 23, 44, 2, 28, 29,
43
+ 2, 31, 51, 3, 11, 8, 9, 3,
44
+ 12, 9, 10, 3, 16, 25, 33, 3,
45
+ 31, 27, 52, 4, 11, 12, 9, 10,
46
+ 4, 16, 25, 33, 14, 4, 31, 16,
47
+ 25, 32
48
+ ]
49
+
50
+ class << self
51
+ attr_accessor :_ami_protocol_parser_key_offsets
52
+ private :_ami_protocol_parser_key_offsets, :_ami_protocol_parser_key_offsets=
53
+ end
54
+ self._ami_protocol_parser_key_offsets = [
55
+ 0, 0, 1, 2, 3, 4, 5, 6,
56
+ 7, 8, 9, 10, 11, 12, 13, 14,
57
+ 15, 16, 17, 18, 19, 20, 22, 25,
58
+ 27, 30, 31, 34, 37, 40, 43, 44,
59
+ 46, 49, 50, 53, 54, 55, 56, 57,
60
+ 58, 59, 60, 61, 62, 63, 64, 65,
61
+ 66, 67, 68, 69, 70, 71, 72, 73,
62
+ 75, 78, 80, 83, 84, 87, 90, 92,
63
+ 94, 96, 97, 99, 100, 102, 104, 106,
64
+ 108, 110, 112, 114, 116, 117, 126, 135,
65
+ 137, 139, 141, 143, 144, 145, 161, 176,
66
+ 191, 206, 223, 224, 226, 243, 244, 259,
67
+ 274, 289, 306, 307, 309, 326, 341, 358,
68
+ 375, 392, 409, 426, 443, 458, 475, 476,
69
+ 478, 495, 512, 528, 544, 561, 578, 595,
70
+ 611, 627, 644, 661, 677, 693, 710, 725,
71
+ 742, 759, 776, 793, 810, 827, 842, 859,
72
+ 860, 862, 879, 896, 912, 928, 945, 962,
73
+ 964, 966, 968, 970, 972, 974, 975, 976,
74
+ 977, 978, 980, 982, 984, 985, 986, 988,
75
+ 990, 992, 994, 996, 998, 999, 1000, 1015,
76
+ 1016, 1031, 1046, 1061, 1078, 1079, 1081, 1096,
77
+ 1111, 1128, 1144, 1160, 1177, 1178, 1180, 1182,
78
+ 1184, 1186, 1188, 1190, 1192, 1194, 1196, 1198,
79
+ 1200, 1202, 1204, 1206, 1208, 1210, 1211, 1212,
80
+ 1214, 1230, 1246, 1262, 1279, 1280, 1282, 1298,
81
+ 1314, 1330, 1347, 1348, 1350, 1367, 1384, 1401,
82
+ 1418, 1435, 1452, 1469, 1486, 1503, 1520, 1537,
83
+ 1554, 1571, 1588, 1604, 1619, 1634, 1651, 1652,
84
+ 1654, 1669, 1684, 1701, 1717, 1733, 1750, 1766,
85
+ 1783, 1799, 1815, 1832, 1849, 1865, 1881, 1898,
86
+ 1914, 1915, 1916, 1919, 1920, 1926, 1927, 1928,
87
+ 1930, 1932, 1932, 1947, 1949, 1965, 1981
88
+ ]
89
+
90
+ class << self
91
+ attr_accessor :_ami_protocol_parser_trans_keys
92
+ private :_ami_protocol_parser_trans_keys, :_ami_protocol_parser_trans_keys=
93
+ end
94
+ self._ami_protocol_parser_trans_keys = [
95
+ 116, 101, 114, 105, 115, 107, 32, 67,
96
+ 97, 108, 108, 32, 77, 97, 110, 97,
97
+ 103, 101, 114, 47, 48, 57, 46, 48,
98
+ 57, 48, 57, 13, 48, 57, 10, 13,
99
+ 48, 57, 46, 48, 57, 10, 13, 58,
100
+ 10, 13, 58, 13, 10, 13, 10, 13,
101
+ 58, 13, 10, 13, 58, 116, 101, 114,
102
+ 105, 115, 107, 32, 67, 97, 108, 108,
103
+ 32, 77, 97, 110, 97, 103, 101, 114,
104
+ 47, 48, 57, 46, 48, 57, 48, 57,
105
+ 13, 48, 57, 10, 13, 48, 57, 46,
106
+ 48, 57, 69, 101, 78, 110, 84, 116,
107
+ 58, 13, 32, 13, 10, 13, 13, 32,
108
+ 83, 115, 80, 112, 79, 111, 78, 110,
109
+ 83, 115, 69, 101, 58, 32, 69, 70,
110
+ 80, 83, 101, 102, 112, 115, 32, 69,
111
+ 70, 80, 83, 101, 102, 112, 115, 82,
112
+ 114, 82, 114, 79, 111, 82, 114, 13,
113
+ 10, 77, 109, 32, 47, 48, 57, 58,
114
+ 64, 65, 90, 91, 96, 97, 122, 123,
115
+ 126, 58, 32, 47, 48, 57, 59, 64,
116
+ 65, 90, 91, 96, 97, 122, 123, 126,
117
+ 58, 32, 47, 48, 57, 59, 64, 65,
118
+ 90, 91, 96, 97, 122, 123, 126, 58,
119
+ 32, 47, 48, 57, 59, 64, 65, 90,
120
+ 91, 96, 97, 122, 123, 126, 13, 32,
121
+ 58, 33, 47, 48, 57, 59, 64, 65,
122
+ 90, 91, 96, 97, 122, 123, 126, 13,
123
+ 10, 13, 13, 77, 109, 32, 47, 48,
124
+ 57, 58, 64, 65, 90, 91, 96, 97,
125
+ 122, 123, 126, 10, 58, 32, 47, 48,
126
+ 57, 59, 64, 65, 90, 91, 96, 97,
127
+ 122, 123, 126, 58, 32, 47, 48, 57,
128
+ 59, 64, 65, 90, 91, 96, 97, 122,
129
+ 123, 126, 58, 32, 47, 48, 57, 59,
130
+ 64, 65, 90, 91, 96, 97, 122, 123,
131
+ 126, 13, 32, 58, 33, 47, 48, 57,
132
+ 59, 64, 65, 90, 91, 96, 97, 122,
133
+ 123, 126, 13, 10, 13, 13, 77, 109,
134
+ 32, 47, 48, 57, 58, 64, 65, 90,
135
+ 91, 96, 97, 122, 123, 126, 58, 32,
136
+ 47, 48, 57, 59, 64, 65, 90, 91,
137
+ 96, 97, 122, 123, 126, 58, 69, 101,
138
+ 32, 47, 48, 57, 59, 64, 65, 90,
139
+ 91, 96, 97, 122, 123, 126, 58, 83,
140
+ 115, 32, 47, 48, 57, 59, 64, 65,
141
+ 90, 91, 96, 97, 122, 123, 126, 58,
142
+ 83, 115, 32, 47, 48, 57, 59, 64,
143
+ 65, 90, 91, 96, 97, 122, 123, 126,
144
+ 58, 65, 97, 32, 47, 48, 57, 59,
145
+ 64, 66, 90, 91, 96, 98, 122, 123,
146
+ 126, 58, 71, 103, 32, 47, 48, 57,
147
+ 59, 64, 65, 90, 91, 96, 97, 122,
148
+ 123, 126, 58, 69, 101, 32, 47, 48,
149
+ 57, 59, 64, 65, 90, 91, 96, 97,
150
+ 122, 123, 126, 58, 32, 47, 48, 57,
151
+ 59, 64, 65, 90, 91, 96, 97, 122,
152
+ 123, 126, 13, 32, 58, 33, 47, 48,
153
+ 57, 59, 64, 65, 90, 91, 96, 97,
154
+ 122, 123, 126, 13, 10, 13, 13, 77,
155
+ 109, 32, 47, 48, 57, 58, 64, 65,
156
+ 90, 91, 96, 97, 122, 123, 126, 13,
157
+ 32, 58, 33, 47, 48, 57, 59, 64,
158
+ 65, 90, 91, 96, 97, 122, 123, 126,
159
+ 13, 58, 32, 47, 48, 57, 59, 64,
160
+ 65, 90, 91, 96, 97, 122, 123, 126,
161
+ 13, 58, 32, 47, 48, 57, 59, 64,
162
+ 65, 90, 91, 96, 97, 122, 123, 126,
163
+ 13, 32, 58, 33, 47, 48, 57, 59,
164
+ 64, 65, 90, 91, 96, 97, 122, 123,
165
+ 126, 13, 32, 58, 33, 47, 48, 57,
166
+ 59, 64, 65, 90, 91, 96, 97, 122,
167
+ 123, 126, 13, 32, 58, 33, 47, 48,
168
+ 57, 59, 64, 65, 90, 91, 96, 97,
169
+ 122, 123, 126, 13, 58, 32, 47, 48,
170
+ 57, 59, 64, 65, 90, 91, 96, 97,
171
+ 122, 123, 126, 13, 58, 32, 47, 48,
172
+ 57, 59, 64, 65, 90, 91, 96, 97,
173
+ 122, 123, 126, 13, 32, 58, 33, 47,
174
+ 48, 57, 59, 64, 65, 90, 91, 96,
175
+ 97, 122, 123, 126, 13, 32, 58, 33,
176
+ 47, 48, 57, 59, 64, 65, 90, 91,
177
+ 96, 97, 122, 123, 126, 13, 58, 32,
178
+ 47, 48, 57, 59, 64, 65, 90, 91,
179
+ 96, 97, 122, 123, 126, 13, 58, 32,
180
+ 47, 48, 57, 59, 64, 65, 90, 91,
181
+ 96, 97, 122, 123, 126, 13, 32, 58,
182
+ 33, 47, 48, 57, 59, 64, 65, 90,
183
+ 91, 96, 97, 122, 123, 126, 58, 32,
184
+ 47, 48, 57, 59, 64, 65, 90, 91,
185
+ 96, 97, 122, 123, 126, 58, 69, 101,
186
+ 32, 47, 48, 57, 59, 64, 65, 90,
187
+ 91, 96, 97, 122, 123, 126, 58, 83,
188
+ 115, 32, 47, 48, 57, 59, 64, 65,
189
+ 90, 91, 96, 97, 122, 123, 126, 58,
190
+ 83, 115, 32, 47, 48, 57, 59, 64,
191
+ 65, 90, 91, 96, 97, 122, 123, 126,
192
+ 58, 65, 97, 32, 47, 48, 57, 59,
193
+ 64, 66, 90, 91, 96, 98, 122, 123,
194
+ 126, 58, 71, 103, 32, 47, 48, 57,
195
+ 59, 64, 65, 90, 91, 96, 97, 122,
196
+ 123, 126, 58, 69, 101, 32, 47, 48,
197
+ 57, 59, 64, 65, 90, 91, 96, 97,
198
+ 122, 123, 126, 58, 32, 47, 48, 57,
199
+ 59, 64, 65, 90, 91, 96, 97, 122,
200
+ 123, 126, 13, 32, 58, 33, 47, 48,
201
+ 57, 59, 64, 65, 90, 91, 96, 97,
202
+ 122, 123, 126, 13, 10, 13, 13, 77,
203
+ 109, 32, 47, 48, 57, 58, 64, 65,
204
+ 90, 91, 96, 97, 122, 123, 126, 13,
205
+ 32, 58, 33, 47, 48, 57, 59, 64,
206
+ 65, 90, 91, 96, 97, 122, 123, 126,
207
+ 13, 58, 32, 47, 48, 57, 59, 64,
208
+ 65, 90, 91, 96, 97, 122, 123, 126,
209
+ 13, 58, 32, 47, 48, 57, 59, 64,
210
+ 65, 90, 91, 96, 97, 122, 123, 126,
211
+ 13, 32, 58, 33, 47, 48, 57, 59,
212
+ 64, 65, 90, 91, 96, 97, 122, 123,
213
+ 126, 13, 32, 58, 33, 47, 48, 57,
214
+ 59, 64, 65, 90, 91, 96, 97, 122,
215
+ 123, 126, 79, 111, 76, 108, 76, 108,
216
+ 79, 111, 87, 119, 83, 115, 13, 10,
217
+ 13, 10, 79, 111, 78, 110, 71, 103,
218
+ 13, 10, 85, 117, 67, 99, 67, 99,
219
+ 69, 101, 83, 115, 83, 115, 13, 10,
220
+ 13, 32, 47, 48, 57, 58, 64, 65,
221
+ 90, 91, 96, 97, 122, 123, 126, 10,
222
+ 58, 32, 47, 48, 57, 59, 64, 65,
223
+ 90, 91, 96, 97, 122, 123, 126, 58,
224
+ 32, 47, 48, 57, 59, 64, 65, 90,
225
+ 91, 96, 97, 122, 123, 126, 58, 32,
226
+ 47, 48, 57, 59, 64, 65, 90, 91,
227
+ 96, 97, 122, 123, 126, 13, 32, 58,
228
+ 33, 47, 48, 57, 59, 64, 65, 90,
229
+ 91, 96, 97, 122, 123, 126, 13, 10,
230
+ 13, 13, 32, 47, 48, 57, 58, 64,
231
+ 65, 90, 91, 96, 97, 122, 123, 126,
232
+ 58, 32, 47, 48, 57, 59, 64, 65,
233
+ 90, 91, 96, 97, 122, 123, 126, 13,
234
+ 32, 58, 33, 47, 48, 57, 59, 64,
235
+ 65, 90, 91, 96, 97, 122, 123, 126,
236
+ 13, 58, 32, 47, 48, 57, 59, 64,
237
+ 65, 90, 91, 96, 97, 122, 123, 126,
238
+ 13, 58, 32, 47, 48, 57, 59, 64,
239
+ 65, 90, 91, 96, 97, 122, 123, 126,
240
+ 13, 32, 58, 33, 47, 48, 57, 59,
241
+ 64, 65, 90, 91, 96, 97, 122, 123,
242
+ 126, 13, 10, 13, 13, 45, 13, 45,
243
+ 13, 69, 13, 78, 13, 68, 13, 32,
244
+ 13, 67, 13, 79, 13, 77, 13, 77,
245
+ 13, 65, 13, 78, 13, 68, 13, 45,
246
+ 13, 45, 13, 10, 10, 13, 13, 58,
247
+ 32, 47, 48, 57, 59, 64, 65, 90,
248
+ 91, 96, 97, 122, 123, 126, 13, 58,
249
+ 32, 47, 48, 57, 59, 64, 65, 90,
250
+ 91, 96, 97, 122, 123, 126, 13, 58,
251
+ 32, 47, 48, 57, 59, 64, 65, 90,
252
+ 91, 96, 97, 122, 123, 126, 13, 32,
253
+ 58, 33, 47, 48, 57, 59, 64, 65,
254
+ 90, 91, 96, 97, 122, 123, 126, 13,
255
+ 10, 13, 13, 58, 32, 47, 48, 57,
256
+ 59, 64, 65, 90, 91, 96, 97, 122,
257
+ 123, 126, 13, 58, 32, 47, 48, 57,
258
+ 59, 64, 65, 90, 91, 96, 97, 122,
259
+ 123, 126, 13, 58, 32, 47, 48, 57,
260
+ 59, 64, 65, 90, 91, 96, 97, 122,
261
+ 123, 126, 13, 32, 58, 33, 47, 48,
262
+ 57, 59, 64, 65, 90, 91, 96, 97,
263
+ 122, 123, 126, 13, 10, 13, 13, 45,
264
+ 58, 32, 47, 48, 57, 59, 64, 65,
265
+ 90, 91, 96, 97, 122, 123, 126, 13,
266
+ 58, 69, 32, 47, 48, 57, 59, 64,
267
+ 65, 90, 91, 96, 97, 122, 123, 126,
268
+ 13, 58, 78, 32, 47, 48, 57, 59,
269
+ 64, 65, 90, 91, 96, 97, 122, 123,
270
+ 126, 13, 58, 68, 32, 47, 48, 57,
271
+ 59, 64, 65, 90, 91, 96, 97, 122,
272
+ 123, 126, 13, 32, 58, 33, 47, 48,
273
+ 57, 59, 64, 65, 90, 91, 96, 97,
274
+ 122, 123, 126, 13, 58, 67, 32, 47,
275
+ 48, 57, 59, 64, 65, 90, 91, 96,
276
+ 97, 122, 123, 126, 13, 58, 79, 32,
277
+ 47, 48, 57, 59, 64, 65, 90, 91,
278
+ 96, 97, 122, 123, 126, 13, 58, 77,
279
+ 32, 47, 48, 57, 59, 64, 65, 90,
280
+ 91, 96, 97, 122, 123, 126, 13, 58,
281
+ 77, 32, 47, 48, 57, 59, 64, 65,
282
+ 90, 91, 96, 97, 122, 123, 126, 13,
283
+ 58, 65, 32, 47, 48, 57, 59, 64,
284
+ 66, 90, 91, 96, 97, 122, 123, 126,
285
+ 13, 58, 78, 32, 47, 48, 57, 59,
286
+ 64, 65, 90, 91, 96, 97, 122, 123,
287
+ 126, 13, 58, 68, 32, 47, 48, 57,
288
+ 59, 64, 65, 90, 91, 96, 97, 122,
289
+ 123, 126, 13, 45, 58, 32, 47, 48,
290
+ 57, 59, 64, 65, 90, 91, 96, 97,
291
+ 122, 123, 126, 13, 45, 58, 32, 47,
292
+ 48, 57, 59, 64, 65, 90, 91, 96,
293
+ 97, 122, 123, 126, 13, 58, 32, 47,
294
+ 48, 57, 59, 64, 65, 90, 91, 96,
295
+ 97, 122, 123, 126, 58, 32, 47, 48,
296
+ 57, 59, 64, 65, 90, 91, 96, 97,
297
+ 122, 123, 126, 58, 32, 47, 48, 57,
298
+ 59, 64, 65, 90, 91, 96, 97, 122,
299
+ 123, 126, 13, 32, 58, 33, 47, 48,
300
+ 57, 59, 64, 65, 90, 91, 96, 97,
301
+ 122, 123, 126, 13, 10, 13, 58, 32,
302
+ 47, 48, 57, 59, 64, 65, 90, 91,
303
+ 96, 97, 122, 123, 126, 58, 32, 47,
304
+ 48, 57, 59, 64, 65, 90, 91, 96,
305
+ 97, 122, 123, 126, 13, 32, 58, 33,
306
+ 47, 48, 57, 59, 64, 65, 90, 91,
307
+ 96, 97, 122, 123, 126, 13, 58, 32,
308
+ 47, 48, 57, 59, 64, 65, 90, 91,
309
+ 96, 97, 122, 123, 126, 13, 58, 32,
310
+ 47, 48, 57, 59, 64, 65, 90, 91,
311
+ 96, 97, 122, 123, 126, 13, 32, 58,
312
+ 33, 47, 48, 57, 59, 64, 65, 90,
313
+ 91, 96, 97, 122, 123, 126, 13, 58,
314
+ 32, 47, 48, 57, 59, 64, 65, 90,
315
+ 91, 96, 97, 122, 123, 126, 13, 32,
316
+ 58, 33, 47, 48, 57, 59, 64, 65,
317
+ 90, 91, 96, 97, 122, 123, 126, 13,
318
+ 58, 32, 47, 48, 57, 59, 64, 65,
319
+ 90, 91, 96, 97, 122, 123, 126, 13,
320
+ 58, 32, 47, 48, 57, 59, 64, 65,
321
+ 90, 91, 96, 97, 122, 123, 126, 13,
322
+ 32, 58, 33, 47, 48, 57, 59, 64,
323
+ 65, 90, 91, 96, 97, 122, 123, 126,
324
+ 13, 32, 58, 33, 47, 48, 57, 59,
325
+ 64, 65, 90, 91, 96, 97, 122, 123,
326
+ 126, 13, 58, 32, 47, 48, 57, 59,
327
+ 64, 65, 90, 91, 96, 97, 122, 123,
328
+ 126, 13, 58, 32, 47, 48, 57, 59,
329
+ 64, 65, 90, 91, 96, 97, 122, 123,
330
+ 126, 13, 32, 58, 33, 47, 48, 57,
331
+ 59, 64, 65, 90, 91, 96, 97, 122,
332
+ 123, 126, 13, 58, 32, 47, 48, 57,
333
+ 59, 64, 65, 90, 91, 96, 97, 122,
334
+ 123, 126, 65, 115, 10, 13, 58, 13,
335
+ 13, 65, 69, 82, 101, 114, 10, 115,
336
+ 86, 118, 69, 101, 13, 32, 47, 48,
337
+ 57, 58, 64, 65, 90, 91, 96, 97,
338
+ 122, 123, 126, 13, 45, 13, 45, 32,
339
+ 47, 48, 57, 58, 64, 65, 90, 91,
340
+ 96, 97, 122, 123, 126, 13, 45, 32,
341
+ 47, 48, 57, 58, 64, 65, 90, 91,
342
+ 96, 97, 122, 123, 126, 32, 47, 48,
343
+ 57, 58, 64, 65, 90, 91, 96, 97,
344
+ 122, 123, 126, 0
345
+ ]
346
+
347
+ class << self
348
+ attr_accessor :_ami_protocol_parser_single_lengths
349
+ private :_ami_protocol_parser_single_lengths, :_ami_protocol_parser_single_lengths=
350
+ end
351
+ self._ami_protocol_parser_single_lengths = [
352
+ 0, 1, 1, 1, 1, 1, 1, 1,
353
+ 1, 1, 1, 1, 1, 1, 1, 1,
354
+ 1, 1, 1, 1, 1, 0, 1, 0,
355
+ 1, 1, 1, 1, 3, 3, 1, 2,
356
+ 3, 1, 3, 1, 1, 1, 1, 1,
357
+ 1, 1, 1, 1, 1, 1, 1, 1,
358
+ 1, 1, 1, 1, 1, 1, 1, 0,
359
+ 1, 0, 1, 1, 1, 1, 2, 2,
360
+ 2, 1, 2, 1, 2, 2, 2, 2,
361
+ 2, 2, 2, 2, 1, 9, 9, 2,
362
+ 2, 2, 2, 1, 1, 2, 1, 1,
363
+ 1, 3, 1, 2, 3, 1, 1, 1,
364
+ 1, 3, 1, 2, 3, 1, 3, 3,
365
+ 3, 3, 3, 3, 1, 3, 1, 2,
366
+ 3, 3, 2, 2, 3, 3, 3, 2,
367
+ 2, 3, 3, 2, 2, 3, 1, 3,
368
+ 3, 3, 3, 3, 3, 1, 3, 1,
369
+ 2, 3, 3, 2, 2, 3, 3, 2,
370
+ 2, 2, 2, 2, 2, 1, 1, 1,
371
+ 1, 2, 2, 2, 1, 1, 2, 2,
372
+ 2, 2, 2, 2, 1, 1, 1, 1,
373
+ 1, 1, 1, 3, 1, 2, 1, 1,
374
+ 3, 2, 2, 3, 1, 2, 2, 2,
375
+ 2, 2, 2, 2, 2, 2, 2, 2,
376
+ 2, 2, 2, 2, 2, 1, 1, 2,
377
+ 2, 2, 2, 3, 1, 2, 2, 2,
378
+ 2, 3, 1, 2, 3, 3, 3, 3,
379
+ 3, 3, 3, 3, 3, 3, 3, 3,
380
+ 3, 3, 2, 1, 1, 3, 1, 2,
381
+ 1, 1, 3, 2, 2, 3, 2, 3,
382
+ 2, 2, 3, 3, 2, 2, 3, 2,
383
+ 1, 1, 3, 1, 6, 1, 1, 2,
384
+ 2, 0, 1, 2, 2, 2, 0
385
+ ]
386
+
387
+ class << self
388
+ attr_accessor :_ami_protocol_parser_range_lengths
389
+ private :_ami_protocol_parser_range_lengths, :_ami_protocol_parser_range_lengths=
390
+ end
391
+ self._ami_protocol_parser_range_lengths = [
392
+ 0, 0, 0, 0, 0, 0, 0, 0,
393
+ 0, 0, 0, 0, 0, 0, 0, 0,
394
+ 0, 0, 0, 0, 0, 1, 1, 1,
395
+ 1, 0, 1, 1, 0, 0, 0, 0,
396
+ 0, 0, 0, 0, 0, 0, 0, 0,
397
+ 0, 0, 0, 0, 0, 0, 0, 0,
398
+ 0, 0, 0, 0, 0, 0, 0, 1,
399
+ 1, 1, 1, 0, 1, 1, 0, 0,
400
+ 0, 0, 0, 0, 0, 0, 0, 0,
401
+ 0, 0, 0, 0, 0, 0, 0, 0,
402
+ 0, 0, 0, 0, 0, 7, 7, 7,
403
+ 7, 7, 0, 0, 7, 0, 7, 7,
404
+ 7, 7, 0, 0, 7, 7, 7, 7,
405
+ 7, 7, 7, 7, 7, 7, 0, 0,
406
+ 7, 7, 7, 7, 7, 7, 7, 7,
407
+ 7, 7, 7, 7, 7, 7, 7, 7,
408
+ 7, 7, 7, 7, 7, 7, 7, 0,
409
+ 0, 7, 7, 7, 7, 7, 7, 0,
410
+ 0, 0, 0, 0, 0, 0, 0, 0,
411
+ 0, 0, 0, 0, 0, 0, 0, 0,
412
+ 0, 0, 0, 0, 0, 0, 7, 0,
413
+ 7, 7, 7, 7, 0, 0, 7, 7,
414
+ 7, 7, 7, 7, 0, 0, 0, 0,
415
+ 0, 0, 0, 0, 0, 0, 0, 0,
416
+ 0, 0, 0, 0, 0, 0, 0, 0,
417
+ 7, 7, 7, 7, 0, 0, 7, 7,
418
+ 7, 7, 0, 0, 7, 7, 7, 7,
419
+ 7, 7, 7, 7, 7, 7, 7, 7,
420
+ 7, 7, 7, 7, 7, 7, 0, 0,
421
+ 7, 7, 7, 7, 7, 7, 7, 7,
422
+ 7, 7, 7, 7, 7, 7, 7, 7,
423
+ 0, 0, 0, 0, 0, 0, 0, 0,
424
+ 0, 0, 7, 0, 7, 7, 7
425
+ ]
426
+
427
+ class << self
428
+ attr_accessor :_ami_protocol_parser_index_offsets
429
+ private :_ami_protocol_parser_index_offsets, :_ami_protocol_parser_index_offsets=
430
+ end
431
+ self._ami_protocol_parser_index_offsets = [
432
+ 0, 0, 2, 4, 6, 8, 10, 12,
433
+ 14, 16, 18, 20, 22, 24, 26, 28,
434
+ 30, 32, 34, 36, 38, 40, 42, 45,
435
+ 47, 50, 52, 55, 58, 62, 66, 68,
436
+ 71, 75, 77, 81, 83, 85, 87, 89,
437
+ 91, 93, 95, 97, 99, 101, 103, 105,
438
+ 107, 109, 111, 113, 115, 117, 119, 121,
439
+ 123, 126, 128, 131, 133, 136, 139, 142,
440
+ 145, 148, 150, 153, 155, 158, 161, 164,
441
+ 167, 170, 173, 176, 179, 181, 191, 201,
442
+ 204, 207, 210, 213, 215, 217, 227, 236,
443
+ 245, 254, 265, 267, 270, 281, 283, 292,
444
+ 301, 310, 321, 323, 326, 337, 346, 357,
445
+ 368, 379, 390, 401, 412, 421, 432, 434,
446
+ 437, 448, 459, 469, 479, 490, 501, 512,
447
+ 522, 532, 543, 554, 564, 574, 585, 594,
448
+ 605, 616, 627, 638, 649, 660, 669, 680,
449
+ 682, 685, 696, 707, 717, 727, 738, 749,
450
+ 752, 755, 758, 761, 764, 767, 769, 771,
451
+ 773, 775, 778, 781, 784, 786, 788, 791,
452
+ 794, 797, 800, 803, 806, 808, 810, 819,
453
+ 821, 830, 839, 848, 859, 861, 864, 873,
454
+ 882, 893, 903, 913, 924, 926, 929, 932,
455
+ 935, 938, 941, 944, 947, 950, 953, 956,
456
+ 959, 962, 965, 968, 971, 974, 976, 978,
457
+ 981, 991, 1001, 1011, 1022, 1024, 1027, 1037,
458
+ 1047, 1057, 1068, 1070, 1073, 1084, 1095, 1106,
459
+ 1117, 1128, 1139, 1150, 1161, 1172, 1183, 1194,
460
+ 1205, 1216, 1227, 1237, 1246, 1255, 1266, 1268,
461
+ 1271, 1280, 1289, 1300, 1310, 1320, 1331, 1341,
462
+ 1352, 1362, 1372, 1383, 1394, 1404, 1414, 1425,
463
+ 1435, 1437, 1439, 1443, 1445, 1452, 1454, 1456,
464
+ 1459, 1462, 1463, 1472, 1475, 1485, 1495
465
+ ]
466
+
467
+ class << self
468
+ attr_accessor :_ami_protocol_parser_indicies
469
+ private :_ami_protocol_parser_indicies, :_ami_protocol_parser_indicies=
470
+ end
471
+ self._ami_protocol_parser_indicies = [
472
+ 1, 0, 2, 0, 3, 0, 4, 0,
473
+ 5, 0, 6, 0, 7, 0, 8, 0,
474
+ 9, 0, 10, 0, 11, 0, 12, 0,
475
+ 13, 0, 14, 0, 15, 0, 16, 0,
476
+ 17, 0, 18, 0, 19, 0, 20, 0,
477
+ 21, 0, 22, 23, 0, 24, 0, 25,
478
+ 26, 0, 27, 0, 25, 26, 0, 22,
479
+ 23, 0, 29, 30, 31, 28, 29, 30,
480
+ 31, 28, 33, 31, 34, 33, 31, 35,
481
+ 30, 31, 28, 33, 31, 36, 30, 31,
482
+ 28, 38, 37, 39, 37, 40, 37, 41,
483
+ 37, 42, 37, 43, 37, 44, 37, 45,
484
+ 37, 46, 37, 47, 37, 48, 37, 49,
485
+ 37, 50, 37, 51, 37, 52, 37, 53,
486
+ 37, 54, 37, 55, 37, 56, 37, 57,
487
+ 37, 58, 37, 59, 60, 37, 61, 37,
488
+ 62, 63, 37, 64, 37, 62, 63, 37,
489
+ 59, 60, 37, 65, 65, 37, 66, 66,
490
+ 37, 67, 67, 37, 68, 37, 70, 71,
491
+ 69, 73, 72, 74, 73, 72, 70, 71,
492
+ 69, 75, 75, 37, 76, 76, 37, 77,
493
+ 77, 37, 78, 78, 37, 79, 79, 37,
494
+ 80, 80, 37, 81, 37, 82, 83, 84,
495
+ 85, 86, 83, 84, 85, 86, 37, 82,
496
+ 83, 84, 85, 86, 83, 84, 85, 86,
497
+ 37, 87, 87, 37, 88, 88, 37, 89,
498
+ 89, 37, 90, 90, 37, 91, 37, 92,
499
+ 37, 95, 95, 93, 94, 93, 94, 93,
500
+ 94, 93, 37, 98, 96, 97, 96, 97,
501
+ 96, 97, 96, 37, 98, 96, 97, 96,
502
+ 97, 96, 97, 96, 37, 98, 96, 97,
503
+ 96, 97, 96, 97, 96, 37, 100, 101,
504
+ 104, 102, 103, 102, 103, 102, 103, 102,
505
+ 99, 106, 105, 107, 106, 105, 108, 111,
506
+ 111, 109, 110, 109, 110, 109, 110, 109,
507
+ 37, 112, 37, 115, 113, 114, 113, 114,
508
+ 113, 114, 113, 37, 115, 113, 114, 113,
509
+ 114, 113, 114, 113, 37, 115, 113, 114,
510
+ 113, 114, 113, 114, 113, 37, 117, 118,
511
+ 121, 119, 120, 119, 120, 119, 120, 119,
512
+ 116, 123, 122, 124, 123, 122, 108, 111,
513
+ 111, 109, 110, 109, 110, 109, 110, 109,
514
+ 37, 115, 113, 114, 113, 114, 113, 114,
515
+ 113, 37, 115, 125, 125, 113, 114, 113,
516
+ 114, 113, 114, 113, 37, 115, 126, 126,
517
+ 113, 114, 113, 114, 113, 114, 113, 37,
518
+ 115, 127, 127, 113, 114, 113, 114, 113,
519
+ 114, 113, 37, 115, 128, 128, 113, 114,
520
+ 113, 114, 113, 114, 113, 37, 115, 129,
521
+ 129, 113, 114, 113, 114, 113, 114, 113,
522
+ 37, 115, 130, 130, 113, 114, 113, 114,
523
+ 113, 114, 113, 37, 131, 113, 114, 113,
524
+ 114, 113, 114, 113, 37, 133, 134, 137,
525
+ 135, 136, 135, 136, 135, 136, 135, 132,
526
+ 139, 138, 140, 139, 138, 108, 111, 111,
527
+ 109, 110, 109, 110, 109, 110, 109, 37,
528
+ 133, 134, 137, 135, 136, 135, 136, 135,
529
+ 136, 135, 132, 139, 143, 141, 142, 141,
530
+ 142, 141, 142, 141, 138, 139, 143, 141,
531
+ 142, 141, 142, 141, 142, 141, 138, 145,
532
+ 146, 149, 147, 148, 147, 148, 147, 148,
533
+ 147, 144, 145, 146, 149, 147, 148, 147,
534
+ 148, 147, 148, 147, 144, 117, 118, 121,
535
+ 119, 120, 119, 120, 119, 120, 119, 116,
536
+ 123, 152, 150, 151, 150, 151, 150, 151,
537
+ 150, 122, 123, 152, 150, 151, 150, 151,
538
+ 150, 151, 150, 122, 117, 118, 121, 119,
539
+ 120, 119, 120, 119, 120, 119, 116, 100,
540
+ 101, 104, 102, 103, 102, 103, 102, 103,
541
+ 102, 99, 106, 155, 153, 154, 153, 154,
542
+ 153, 154, 153, 105, 106, 155, 153, 154,
543
+ 153, 154, 153, 154, 153, 105, 100, 101,
544
+ 104, 102, 103, 102, 103, 102, 103, 102,
545
+ 99, 98, 96, 97, 96, 97, 96, 97,
546
+ 96, 37, 98, 156, 156, 96, 97, 96,
547
+ 97, 96, 97, 96, 37, 98, 157, 157,
548
+ 96, 97, 96, 97, 96, 97, 96, 37,
549
+ 98, 158, 158, 96, 97, 96, 97, 96,
550
+ 97, 96, 37, 98, 159, 159, 96, 97,
551
+ 96, 97, 96, 97, 96, 37, 98, 160,
552
+ 160, 96, 97, 96, 97, 96, 97, 96,
553
+ 37, 98, 161, 161, 96, 97, 96, 97,
554
+ 96, 97, 96, 37, 162, 96, 97, 96,
555
+ 97, 96, 97, 96, 37, 164, 165, 168,
556
+ 166, 167, 166, 167, 166, 167, 166, 163,
557
+ 170, 169, 171, 170, 169, 108, 111, 111,
558
+ 109, 110, 109, 110, 109, 110, 109, 37,
559
+ 164, 165, 168, 166, 167, 166, 167, 166,
560
+ 167, 166, 163, 170, 174, 172, 173, 172,
561
+ 173, 172, 173, 172, 169, 170, 174, 172,
562
+ 173, 172, 173, 172, 173, 172, 169, 176,
563
+ 177, 180, 178, 179, 178, 179, 178, 179,
564
+ 178, 175, 176, 177, 180, 178, 179, 178,
565
+ 179, 178, 179, 178, 175, 181, 181, 37,
566
+ 182, 182, 37, 183, 183, 37, 184, 184,
567
+ 37, 185, 185, 37, 186, 186, 37, 187,
568
+ 37, 188, 37, 189, 37, 190, 37, 191,
569
+ 191, 37, 192, 192, 37, 193, 193, 37,
570
+ 194, 37, 195, 37, 196, 196, 37, 197,
571
+ 197, 37, 198, 198, 37, 199, 199, 37,
572
+ 200, 200, 37, 201, 201, 37, 202, 37,
573
+ 203, 37, 204, 206, 207, 206, 207, 206,
574
+ 207, 206, 205, 208, 205, 211, 209, 210,
575
+ 209, 210, 209, 210, 209, 205, 211, 209,
576
+ 210, 209, 210, 209, 210, 209, 205, 211,
577
+ 209, 210, 209, 210, 209, 210, 209, 205,
578
+ 213, 214, 217, 215, 216, 215, 216, 215,
579
+ 216, 215, 212, 219, 218, 220, 219, 218,
580
+ 204, 206, 207, 206, 207, 206, 207, 206,
581
+ 205, 211, 209, 210, 209, 210, 209, 210,
582
+ 209, 205, 213, 214, 217, 215, 216, 215,
583
+ 216, 215, 216, 215, 212, 219, 223, 221,
584
+ 222, 221, 222, 221, 222, 221, 218, 219,
585
+ 223, 221, 222, 221, 222, 221, 222, 221,
586
+ 218, 213, 214, 217, 215, 216, 215, 216,
587
+ 215, 216, 215, 212, 226, 225, 227, 226,
588
+ 225, 226, 228, 225, 226, 229, 225, 226,
589
+ 230, 225, 226, 231, 225, 226, 232, 225,
590
+ 226, 233, 225, 226, 234, 225, 226, 235,
591
+ 225, 226, 236, 225, 226, 237, 225, 226,
592
+ 238, 225, 226, 239, 225, 226, 240, 225,
593
+ 226, 241, 225, 226, 242, 225, 243, 224,
594
+ 244, 224, 245, 226, 225, 226, 248, 246,
595
+ 247, 246, 247, 246, 247, 246, 225, 226,
596
+ 248, 246, 247, 246, 247, 246, 247, 246,
597
+ 225, 226, 248, 246, 247, 246, 247, 246,
598
+ 247, 246, 225, 250, 251, 254, 252, 253,
599
+ 252, 253, 252, 253, 252, 249, 256, 255,
600
+ 257, 256, 255, 226, 261, 259, 260, 259,
601
+ 260, 259, 260, 259, 225, 226, 261, 259,
602
+ 260, 259, 260, 259, 260, 259, 225, 226,
603
+ 261, 259, 260, 259, 260, 259, 260, 259,
604
+ 225, 263, 264, 267, 265, 266, 265, 266,
605
+ 265, 266, 265, 262, 269, 268, 270, 269,
606
+ 268, 226, 271, 261, 259, 260, 259, 260,
607
+ 259, 260, 259, 225, 226, 261, 272, 259,
608
+ 260, 259, 260, 259, 260, 259, 225, 226,
609
+ 261, 273, 259, 260, 259, 260, 259, 260,
610
+ 259, 225, 226, 261, 274, 259, 260, 259,
611
+ 260, 259, 260, 259, 225, 226, 275, 261,
612
+ 259, 260, 259, 260, 259, 260, 259, 225,
613
+ 226, 261, 276, 259, 260, 259, 260, 259,
614
+ 260, 259, 225, 226, 261, 277, 259, 260,
615
+ 259, 260, 259, 260, 259, 225, 226, 261,
616
+ 278, 259, 260, 259, 260, 259, 260, 259,
617
+ 225, 226, 261, 279, 259, 260, 259, 260,
618
+ 259, 260, 259, 225, 226, 261, 280, 259,
619
+ 260, 259, 260, 259, 260, 259, 225, 226,
620
+ 261, 281, 259, 260, 259, 260, 259, 260,
621
+ 259, 225, 226, 261, 282, 259, 260, 259,
622
+ 260, 259, 260, 259, 225, 226, 283, 261,
623
+ 259, 260, 259, 260, 259, 260, 259, 225,
624
+ 226, 284, 261, 259, 260, 259, 260, 259,
625
+ 260, 259, 225, 243, 287, 285, 286, 285,
626
+ 286, 285, 286, 285, 258, 287, 285, 286,
627
+ 285, 286, 285, 286, 285, 258, 287, 285,
628
+ 286, 285, 286, 285, 286, 285, 258, 289,
629
+ 290, 293, 291, 292, 291, 292, 291, 292,
630
+ 291, 288, 295, 294, 296, 295, 294, 287,
631
+ 285, 286, 285, 286, 285, 286, 285, 258,
632
+ 287, 285, 286, 285, 286, 285, 286, 285,
633
+ 258, 289, 290, 293, 291, 292, 291, 292,
634
+ 291, 292, 291, 288, 295, 299, 297, 298,
635
+ 297, 298, 297, 298, 297, 294, 295, 299,
636
+ 297, 298, 297, 298, 297, 298, 297, 294,
637
+ 289, 290, 293, 291, 292, 291, 292, 291,
638
+ 292, 291, 288, 226, 261, 259, 260, 259,
639
+ 260, 259, 260, 259, 225, 263, 264, 267,
640
+ 265, 266, 265, 266, 265, 266, 265, 262,
641
+ 269, 302, 300, 301, 300, 301, 300, 301,
642
+ 300, 268, 269, 302, 300, 301, 300, 301,
643
+ 300, 301, 300, 268, 263, 264, 267, 265,
644
+ 266, 265, 266, 265, 266, 265, 262, 250,
645
+ 251, 254, 252, 253, 252, 253, 252, 253,
646
+ 252, 249, 256, 305, 303, 304, 303, 304,
647
+ 303, 304, 303, 255, 256, 305, 303, 304,
648
+ 303, 304, 303, 304, 303, 255, 250, 251,
649
+ 254, 252, 253, 252, 253, 252, 253, 252,
650
+ 249, 226, 248, 246, 247, 246, 247, 246,
651
+ 247, 246, 225, 307, 306, 309, 308, 311,
652
+ 312, 311, 310, 33, 31, 315, 316, 317,
653
+ 318, 317, 318, 314, 320, 319, 321, 319,
654
+ 322, 322, 319, 323, 323, 319, 205, 325,
655
+ 326, 327, 326, 327, 326, 327, 326, 324,
656
+ 226, 228, 225, 226, 331, 330, 332, 330,
657
+ 332, 330, 332, 330, 225, 226, 331, 330,
658
+ 332, 330, 332, 330, 332, 330, 225, 333,
659
+ 334, 333, 334, 333, 334, 333, 329, 0
660
+ ]
661
+
662
+ class << self
663
+ attr_accessor :_ami_protocol_parser_trans_targs
664
+ private :_ami_protocol_parser_trans_targs, :_ami_protocol_parser_trans_targs=
665
+ end
666
+ self._ami_protocol_parser_trans_targs = [
667
+ 248, 2, 3, 4, 5, 6, 7, 8,
668
+ 9, 10, 11, 12, 13, 14, 15, 16,
669
+ 17, 18, 19, 20, 21, 22, 23, 27,
670
+ 24, 25, 26, 248, 29, 251, 32, 30,
671
+ 250, 31, 250, 250, 250, 252, 36, 37,
672
+ 38, 39, 40, 41, 42, 43, 44, 45,
673
+ 46, 47, 48, 49, 50, 51, 52, 53,
674
+ 54, 55, 56, 57, 61, 58, 59, 60,
675
+ 252, 63, 64, 65, 66, 67, 68, 69,
676
+ 67, 68, 252, 71, 72, 73, 74, 75,
677
+ 76, 77, 78, 79, 143, 153, 158, 80,
678
+ 81, 82, 83, 84, 85, 86, 126, 127,
679
+ 87, 88, 89, 90, 91, 122, 123, 124,
680
+ 125, 90, 91, 92, 93, 94, 101, 102,
681
+ 252, 95, 96, 97, 98, 99, 118, 119,
682
+ 120, 121, 98, 99, 100, 103, 104, 105,
683
+ 106, 107, 108, 109, 110, 111, 113, 114,
684
+ 115, 116, 110, 111, 112, 114, 115, 116,
685
+ 110, 111, 117, 114, 115, 116, 119, 120,
686
+ 121, 123, 124, 125, 128, 129, 130, 131,
687
+ 132, 133, 134, 135, 136, 138, 139, 140,
688
+ 141, 135, 136, 137, 139, 140, 141, 135,
689
+ 136, 142, 139, 140, 141, 144, 145, 146,
690
+ 147, 148, 149, 150, 151, 152, 252, 154,
691
+ 155, 156, 157, 252, 159, 160, 161, 162,
692
+ 163, 164, 165, 252, 167, 0, 168, 175,
693
+ 257, 169, 170, 171, 172, 173, 176, 177,
694
+ 178, 179, 172, 173, 174, 177, 178, 179,
695
+ 258, 180, 181, 182, 183, 184, 185, 186,
696
+ 187, 188, 189, 190, 191, 192, 193, 194,
697
+ 195, 196, 197, 198, 258, 259, 201, 202,
698
+ 203, 204, 205, 243, 244, 245, 246, 204,
699
+ 205, 260, 258, 207, 208, 209, 210, 211,
700
+ 239, 240, 241, 242, 210, 211, 261, 213,
701
+ 214, 215, 216, 217, 218, 219, 220, 221,
702
+ 222, 223, 224, 225, 226, 227, 228, 229,
703
+ 230, 231, 234, 235, 236, 237, 230, 231,
704
+ 262, 235, 236, 237, 240, 241, 242, 244,
705
+ 245, 246, 248, 249, 248, 1, 28, 33,
706
+ 34, 250, 252, 253, 254, 255, 256, 252,
707
+ 252, 35, 62, 70, 180, 199, 200, 247,
708
+ 258, 258, 206, 212, 238, 232, 233
709
+ ]
710
+
711
+ class << self
712
+ attr_accessor :_ami_protocol_parser_trans_actions
713
+ private :_ami_protocol_parser_trans_actions, :_ami_protocol_parser_trans_actions=
714
+ end
715
+ self._ami_protocol_parser_trans_actions = [
716
+ 43, 0, 0, 0, 0, 0, 0, 0,
717
+ 0, 0, 0, 0, 0, 0, 0, 0,
718
+ 0, 0, 0, 0, 0, 5, 0, 0,
719
+ 0, 7, 0, 37, 0, 141, 0, 0,
720
+ 35, 0, 91, 136, 123, 55, 0, 0,
721
+ 0, 0, 0, 0, 0, 0, 0, 0,
722
+ 0, 0, 0, 0, 0, 0, 0, 0,
723
+ 0, 0, 5, 0, 0, 0, 7, 0,
724
+ 45, 0, 0, 0, 0, 23, 97, 23,
725
+ 0, 25, 106, 0, 0, 0, 0, 0,
726
+ 0, 0, 0, 0, 0, 0, 0, 0,
727
+ 0, 0, 0, 3, 0, 9, 9, 9,
728
+ 0, 0, 11, 13, 82, 13, 13, 13,
729
+ 79, 0, 15, 0, 0, 9, 9, 9,
730
+ 73, 0, 0, 11, 13, 82, 13, 13,
731
+ 13, 79, 0, 15, 0, 0, 0, 0,
732
+ 0, 0, 0, 11, 85, 131, 85, 85,
733
+ 85, 115, 0, 88, 0, 0, 0, 11,
734
+ 13, 119, 13, 13, 13, 79, 0, 0,
735
+ 11, 0, 0, 11, 0, 0, 0, 0,
736
+ 0, 0, 11, 85, 131, 85, 85, 85,
737
+ 115, 0, 88, 0, 0, 0, 11, 13,
738
+ 119, 13, 13, 13, 79, 0, 0, 0,
739
+ 0, 0, 0, 0, 67, 0, 47, 0,
740
+ 0, 0, 1, 103, 0, 0, 0, 0,
741
+ 0, 0, 1, 100, 0, 0, 9, 9,
742
+ 70, 0, 0, 11, 13, 82, 13, 13,
743
+ 13, 79, 0, 15, 0, 0, 0, 11,
744
+ 65, 0, 0, 0, 0, 0, 0, 0,
745
+ 0, 0, 0, 0, 0, 0, 0, 0,
746
+ 0, 0, 21, 0, 57, 127, 0, 0,
747
+ 11, 13, 82, 13, 13, 13, 79, 0,
748
+ 15, 112, 63, 0, 0, 11, 13, 82,
749
+ 13, 13, 13, 79, 0, 15, 112, 0,
750
+ 0, 0, 0, 0, 0, 0, 0, 0,
751
+ 0, 0, 0, 0, 21, 0, 0, 11,
752
+ 13, 82, 13, 13, 13, 79, 0, 15,
753
+ 31, 0, 0, 11, 0, 0, 11, 0,
754
+ 0, 11, 39, 31, 41, 0, 94, 17,
755
+ 94, 33, 51, 0, 31, 31, 31, 53,
756
+ 49, 0, 0, 0, 19, 19, 76, 76,
757
+ 61, 59, 9, 9, 9, 9, 9
758
+ ]
759
+
760
+ class << self
761
+ attr_accessor :_ami_protocol_parser_to_state_actions
762
+ private :_ami_protocol_parser_to_state_actions, :_ami_protocol_parser_to_state_actions=
763
+ end
764
+ self._ami_protocol_parser_to_state_actions = [
765
+ 0, 0, 0, 0, 0, 0, 0, 0,
766
+ 0, 0, 0, 0, 0, 0, 0, 0,
767
+ 0, 0, 0, 0, 0, 0, 0, 0,
768
+ 0, 0, 0, 0, 0, 0, 0, 0,
769
+ 0, 0, 0, 0, 0, 0, 0, 0,
770
+ 0, 0, 0, 0, 0, 0, 0, 0,
771
+ 0, 0, 0, 0, 0, 0, 0, 0,
772
+ 0, 0, 0, 0, 0, 0, 0, 0,
773
+ 0, 0, 0, 0, 0, 0, 0, 0,
774
+ 0, 0, 0, 0, 0, 0, 0, 0,
775
+ 0, 0, 0, 0, 0, 0, 0, 0,
776
+ 0, 0, 0, 0, 0, 0, 0, 0,
777
+ 0, 0, 0, 0, 0, 0, 0, 0,
778
+ 0, 0, 0, 0, 0, 0, 0, 0,
779
+ 0, 0, 0, 0, 0, 0, 0, 0,
780
+ 0, 0, 0, 0, 0, 0, 0, 0,
781
+ 0, 0, 0, 0, 0, 0, 0, 0,
782
+ 0, 0, 0, 0, 0, 0, 0, 0,
783
+ 0, 0, 0, 0, 0, 0, 0, 0,
784
+ 0, 0, 0, 0, 0, 0, 0, 0,
785
+ 0, 0, 0, 0, 0, 0, 27, 0,
786
+ 0, 0, 0, 0, 0, 0, 0, 0,
787
+ 0, 0, 0, 0, 0, 0, 0, 0,
788
+ 0, 0, 0, 0, 0, 0, 0, 0,
789
+ 0, 0, 0, 0, 0, 0, 0, 0,
790
+ 0, 0, 0, 0, 0, 0, 0, 0,
791
+ 0, 0, 0, 0, 0, 0, 0, 0,
792
+ 0, 0, 0, 0, 0, 0, 0, 0,
793
+ 0, 0, 0, 0, 0, 0, 0, 0,
794
+ 0, 0, 0, 0, 0, 0, 0, 0,
795
+ 0, 0, 0, 0, 0, 0, 0, 0,
796
+ 27, 0, 109, 0, 27, 0, 0, 0,
797
+ 0, 0, 109, 0, 0, 0, 0
798
+ ]
799
+
800
+ class << self
801
+ attr_accessor :_ami_protocol_parser_from_state_actions
802
+ private :_ami_protocol_parser_from_state_actions, :_ami_protocol_parser_from_state_actions=
803
+ end
804
+ self._ami_protocol_parser_from_state_actions = [
805
+ 0, 0, 0, 0, 0, 0, 0, 0,
806
+ 0, 0, 0, 0, 0, 0, 0, 0,
807
+ 0, 0, 0, 0, 0, 0, 0, 0,
808
+ 0, 0, 0, 0, 0, 0, 0, 0,
809
+ 0, 0, 0, 0, 0, 0, 0, 0,
810
+ 0, 0, 0, 0, 0, 0, 0, 0,
811
+ 0, 0, 0, 0, 0, 0, 0, 0,
812
+ 0, 0, 0, 0, 0, 0, 0, 0,
813
+ 0, 0, 0, 0, 0, 0, 0, 0,
814
+ 0, 0, 0, 0, 0, 0, 0, 0,
815
+ 0, 0, 0, 0, 0, 0, 0, 0,
816
+ 0, 0, 0, 0, 0, 0, 0, 0,
817
+ 0, 0, 0, 0, 0, 0, 0, 0,
818
+ 0, 0, 0, 0, 0, 0, 0, 0,
819
+ 0, 0, 0, 0, 0, 0, 0, 0,
820
+ 0, 0, 0, 0, 0, 0, 0, 0,
821
+ 0, 0, 0, 0, 0, 0, 0, 0,
822
+ 0, 0, 0, 0, 0, 0, 0, 0,
823
+ 0, 0, 0, 0, 0, 0, 0, 0,
824
+ 0, 0, 0, 0, 0, 0, 0, 0,
825
+ 0, 0, 0, 0, 0, 0, 0, 0,
826
+ 0, 0, 0, 0, 0, 0, 0, 0,
827
+ 0, 0, 0, 0, 0, 0, 0, 0,
828
+ 0, 0, 0, 0, 0, 0, 0, 0,
829
+ 0, 0, 0, 0, 0, 0, 0, 0,
830
+ 0, 0, 0, 0, 0, 0, 0, 0,
831
+ 0, 0, 0, 0, 0, 0, 0, 0,
832
+ 0, 0, 0, 0, 0, 0, 0, 0,
833
+ 0, 0, 0, 0, 0, 0, 0, 0,
834
+ 0, 0, 0, 0, 0, 0, 0, 0,
835
+ 0, 0, 0, 0, 0, 0, 0, 0,
836
+ 29, 0, 29, 0, 29, 0, 0, 0,
837
+ 0, 0, 29, 0, 0, 0, 0
838
+ ]
839
+
840
+ class << self
841
+ attr_accessor :_ami_protocol_parser_eof_trans
842
+ private :_ami_protocol_parser_eof_trans, :_ami_protocol_parser_eof_trans=
843
+ end
844
+ self._ami_protocol_parser_eof_trans = [
845
+ 0, 1, 1, 1, 1, 1, 1, 1,
846
+ 1, 1, 1, 1, 1, 1, 1, 1,
847
+ 1, 1, 1, 1, 1, 1, 1, 1,
848
+ 1, 1, 1, 1, 0, 0, 33, 33,
849
+ 0, 0, 0, 38, 38, 38, 38, 38,
850
+ 38, 38, 38, 38, 38, 38, 38, 38,
851
+ 38, 38, 38, 38, 38, 38, 38, 38,
852
+ 38, 38, 38, 38, 38, 38, 38, 38,
853
+ 38, 38, 38, 38, 38, 38, 38, 38,
854
+ 38, 38, 38, 38, 38, 38, 38, 38,
855
+ 38, 38, 38, 38, 38, 38, 38, 38,
856
+ 38, 38, 38, 38, 38, 38, 38, 38,
857
+ 38, 38, 38, 38, 38, 38, 38, 38,
858
+ 38, 38, 38, 38, 38, 38, 38, 38,
859
+ 38, 38, 38, 38, 38, 38, 38, 38,
860
+ 38, 38, 38, 38, 38, 38, 38, 38,
861
+ 38, 38, 38, 38, 38, 38, 38, 38,
862
+ 38, 38, 38, 38, 38, 38, 38, 38,
863
+ 38, 38, 38, 38, 38, 38, 38, 38,
864
+ 38, 38, 38, 38, 38, 38, 38, 38,
865
+ 38, 38, 38, 38, 38, 38, 0, 0,
866
+ 0, 0, 0, 0, 0, 0, 0, 0,
867
+ 0, 0, 0, 0, 225, 225, 225, 225,
868
+ 225, 225, 225, 225, 225, 225, 225, 225,
869
+ 225, 225, 225, 225, 225, 225, 225, 0,
870
+ 0, 0, 0, 0, 0, 0, 259, 259,
871
+ 259, 259, 259, 259, 259, 259, 259, 259,
872
+ 259, 259, 259, 259, 259, 259, 259, 259,
873
+ 259, 259, 259, 259, 259, 259, 259, 259,
874
+ 259, 259, 259, 259, 259, 259, 259, 259,
875
+ 259, 259, 259, 0, 0, 0, 0, 0,
876
+ 0, 309, 0, 314, 0, 320, 320, 320,
877
+ 320, 0, 0, 329, 330, 330, 330
878
+ ]
879
+
880
+ class << self
881
+ attr_accessor :ami_protocol_parser_start
882
+ end
883
+ self.ami_protocol_parser_start = 248;
884
+ class << self
885
+ attr_accessor :ami_protocol_parser_first_final
886
+ end
887
+ self.ami_protocol_parser_first_final = 248;
888
+ class << self
889
+ attr_accessor :ami_protocol_parser_error
890
+ end
891
+ self.ami_protocol_parser_error = 0;
892
+
893
+ class << self
894
+ attr_accessor :ami_protocol_parser_en_irregularity
895
+ end
896
+ self.ami_protocol_parser_en_irregularity = 250;
897
+ class << self
898
+ attr_accessor :ami_protocol_parser_en_main
899
+ end
900
+ self.ami_protocol_parser_en_main = 248;
901
+ class << self
902
+ attr_accessor :ami_protocol_parser_en_protocol
903
+ end
904
+ self.ami_protocol_parser_en_protocol = 252;
905
+ class << self
906
+ attr_accessor :ami_protocol_parser_en_success
907
+ end
908
+ self.ami_protocol_parser_en_success = 166;
909
+ class << self
910
+ attr_accessor :ami_protocol_parser_en_response_follows
911
+ end
912
+ self.ami_protocol_parser_en_response_follows = 258;
913
+
914
+
915
+ # line 916 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
916
+ begin
917
+ @current_pointer ||= 0
918
+ @data_ending_pointer ||= @data.length
919
+ @current_state = ami_protocol_parser_start
920
+ @ragel_stack_top = 0
921
+ @token_start = nil
922
+ @token_end = nil
923
+ @ragel_act = 0
924
+ end
925
+ # line 79 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
926
+ ##
927
+
928
+ end
929
+
930
+ def <<(new_data)
931
+ extend_buffer_with new_data
932
+ resume!
933
+ end
934
+
935
+ def resume!
936
+
937
+ # line 938 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
938
+ begin
939
+ _klen, _trans, _keys, _acts, _nacts = nil
940
+ _goto_level = 0
941
+ _resume = 10
942
+ _eof_trans = 15
943
+ _again = 20
944
+ _test_eof = 30
945
+ _out = 40
946
+ while true
947
+ _trigger_goto = false
948
+ if _goto_level <= 0
949
+ if @current_pointer == @data_ending_pointer
950
+ _goto_level = _test_eof
951
+ next
952
+ end
953
+ if @current_state == 0
954
+ _goto_level = _out
955
+ next
956
+ end
957
+ end
958
+ if _goto_level <= _resume
959
+ _acts = _ami_protocol_parser_from_state_actions[ @current_state]
960
+ _nacts = _ami_protocol_parser_actions[_acts]
961
+ _acts += 1
962
+ while _nacts > 0
963
+ _nacts -= 1
964
+ _acts += 1
965
+ case _ami_protocol_parser_actions[_acts - 1]
966
+ when 30 then
967
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
968
+ begin
969
+ @token_start = @current_pointer
970
+ end
971
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
972
+ # line 973 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
973
+ end # from state action switch
974
+ end
975
+ if _trigger_goto
976
+ next
977
+ end
978
+ _keys = _ami_protocol_parser_key_offsets[ @current_state]
979
+ _trans = _ami_protocol_parser_index_offsets[ @current_state]
980
+ _klen = _ami_protocol_parser_single_lengths[ @current_state]
981
+ _break_match = false
982
+
983
+ begin
984
+ if _klen > 0
985
+ _lower = _keys
986
+ _upper = _keys + _klen - 1
987
+
988
+ loop do
989
+ break if _upper < _lower
990
+ _mid = _lower + ( (_upper - _lower) >> 1 )
991
+
992
+ if @data[ @current_pointer] < _ami_protocol_parser_trans_keys[_mid]
993
+ _upper = _mid - 1
994
+ elsif @data[ @current_pointer] > _ami_protocol_parser_trans_keys[_mid]
995
+ _lower = _mid + 1
996
+ else
997
+ _trans += (_mid - _keys)
998
+ _break_match = true
999
+ break
1000
+ end
1001
+ end # loop
1002
+ break if _break_match
1003
+ _keys += _klen
1004
+ _trans += _klen
1005
+ end
1006
+ _klen = _ami_protocol_parser_range_lengths[ @current_state]
1007
+ if _klen > 0
1008
+ _lower = _keys
1009
+ _upper = _keys + (_klen << 1) - 2
1010
+ loop do
1011
+ break if _upper < _lower
1012
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1)
1013
+ if @data[ @current_pointer] < _ami_protocol_parser_trans_keys[_mid]
1014
+ _upper = _mid - 2
1015
+ elsif @data[ @current_pointer] > _ami_protocol_parser_trans_keys[_mid+1]
1016
+ _lower = _mid + 2
1017
+ else
1018
+ _trans += ((_mid - _keys) >> 1)
1019
+ _break_match = true
1020
+ break
1021
+ end
1022
+ end # loop
1023
+ break if _break_match
1024
+ _trans += _klen
1025
+ end
1026
+ end while false
1027
+ _trans = _ami_protocol_parser_indicies[_trans]
1028
+ end
1029
+ if _goto_level <= _eof_trans
1030
+ @current_state = _ami_protocol_parser_trans_targs[_trans]
1031
+ if _ami_protocol_parser_trans_actions[_trans] != 0
1032
+ _acts = _ami_protocol_parser_trans_actions[_trans]
1033
+ _nacts = _ami_protocol_parser_actions[_acts]
1034
+ _acts += 1
1035
+ while _nacts > 0
1036
+ _nacts -= 1
1037
+ _acts += 1
1038
+ case _ami_protocol_parser_actions[_acts - 1]
1039
+ when 0 then
1040
+ # line 17 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1041
+ begin
1042
+ init_success end
1043
+ # line 17 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1044
+ when 1 then
1045
+ # line 19 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1046
+ begin
1047
+ init_response_follows end
1048
+ # line 19 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1049
+ when 2 then
1050
+ # line 21 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1051
+ begin
1052
+ init_error end
1053
+ # line 21 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1054
+ when 3 then
1055
+ # line 23 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1056
+ begin
1057
+ message_received @current_message end
1058
+ # line 23 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1059
+ when 4 then
1060
+ # line 24 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1061
+ begin
1062
+ error_received @current_message end
1063
+ # line 24 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1064
+ when 5 then
1065
+ # line 26 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1066
+ begin
1067
+ version_starts end
1068
+ # line 26 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1069
+ when 6 then
1070
+ # line 27 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1071
+ begin
1072
+ version_stops end
1073
+ # line 27 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1074
+ when 7 then
1075
+ # line 29 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1076
+ begin
1077
+ key_starts end
1078
+ # line 29 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1079
+ when 8 then
1080
+ # line 30 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1081
+ begin
1082
+ key_stops end
1083
+ # line 30 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1084
+ when 9 then
1085
+ # line 32 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1086
+ begin
1087
+ value_starts end
1088
+ # line 32 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1089
+ when 10 then
1090
+ # line 33 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1091
+ begin
1092
+ value_stops end
1093
+ # line 33 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1094
+ when 11 then
1095
+ # line 35 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1096
+ begin
1097
+ error_reason_starts end
1098
+ # line 35 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1099
+ when 12 then
1100
+ # line 36 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1101
+ begin
1102
+ error_reason_stops end
1103
+ # line 36 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1104
+ when 13 then
1105
+ # line 38 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1106
+ begin
1107
+ syntax_error_starts end
1108
+ # line 38 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1109
+ when 14 then
1110
+ # line 39 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1111
+ begin
1112
+ syntax_error_stops end
1113
+ # line 39 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1114
+ when 15 then
1115
+ # line 41 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1116
+ begin
1117
+ immediate_response_starts end
1118
+ # line 41 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1119
+ when 16 then
1120
+ # line 42 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1121
+ begin
1122
+ immediate_response_stops end
1123
+ # line 42 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1124
+ when 17 then
1125
+ # line 44 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1126
+ begin
1127
+ follows_text_starts end
1128
+ # line 44 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1129
+ when 18 then
1130
+ # line 45 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1131
+ begin
1132
+ follows_text_stops end
1133
+ # line 45 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1134
+ when 19 then
1135
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1136
+ begin
1137
+ event_name_starts end
1138
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1139
+ when 20 then
1140
+ # line 48 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1141
+ begin
1142
+ event_name_stops end
1143
+ # line 48 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1144
+ when 21 then
1145
+ # line 34 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1146
+ begin
1147
+ begin
1148
+ @current_state = 166
1149
+ _trigger_goto = true
1150
+ _goto_level = _again
1151
+ break
1152
+ end
1153
+ end
1154
+ # line 34 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1155
+ when 22 then
1156
+ # line 35 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1157
+ begin
1158
+ begin
1159
+ @current_state = 166
1160
+ _trigger_goto = true
1161
+ _goto_level = _again
1162
+ break
1163
+ end
1164
+ end
1165
+ # line 35 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1166
+ when 23 then
1167
+ # line 36 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1168
+ begin
1169
+ begin
1170
+ @current_state = 166
1171
+ _trigger_goto = true
1172
+ _goto_level = _again
1173
+ break
1174
+ end
1175
+ end
1176
+ # line 36 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1177
+ when 24 then
1178
+ # line 38 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1179
+ begin
1180
+ begin
1181
+ @current_state = 258
1182
+ _trigger_goto = true
1183
+ _goto_level = _again
1184
+ break
1185
+ end
1186
+ end
1187
+ # line 38 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1188
+ when 25 then
1189
+ # line 43 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1190
+ begin
1191
+ begin
1192
+ @ragel_stack_top -= 1
1193
+ @current_state = @ragel_stack[ @ragel_stack_top]
1194
+ _trigger_goto = true
1195
+ _goto_level = _again
1196
+ break
1197
+ end
1198
+ end
1199
+ # line 43 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1200
+ when 26 then
1201
+ # line 78 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1202
+ begin
1203
+ begin
1204
+ @current_state = 252
1205
+ _trigger_goto = true
1206
+ _goto_level = _again
1207
+ break
1208
+ end
1209
+ end
1210
+ # line 78 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1211
+ when 27 then
1212
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1213
+ begin
1214
+ message_received; begin
1215
+ @current_state = 252
1216
+ _trigger_goto = true
1217
+ _goto_level = _again
1218
+ break
1219
+ end
1220
+ end
1221
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1222
+ when 31 then
1223
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1224
+ begin
1225
+ @token_end = @current_pointer+1
1226
+ end
1227
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1228
+ when 32 then
1229
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1230
+ begin
1231
+ @ragel_act = 1; end
1232
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1233
+ when 33 then
1234
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1235
+ begin
1236
+ @token_end = @current_pointer+1
1237
+ end
1238
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1239
+ when 34 then
1240
+ # line 48 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1241
+ begin
1242
+ @token_end = @current_pointer+1
1243
+ begin begin
1244
+ @ragel_stack_top -= 1
1245
+ @current_state = @ragel_stack[ @ragel_stack_top]
1246
+ _trigger_goto = true
1247
+ _goto_level = _again
1248
+ break
1249
+ end
1250
+ end
1251
+ end
1252
+ # line 48 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1253
+ when 35 then
1254
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1255
+ begin
1256
+ @token_end = @current_pointer
1257
+ @current_pointer = @current_pointer - 1; end
1258
+ # line 47 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1259
+ when 36 then
1260
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1261
+ begin
1262
+ case @ragel_act
1263
+ when 0 then
1264
+ begin begin
1265
+ @current_state = 0
1266
+ _trigger_goto = true
1267
+ _goto_level = _again
1268
+ break
1269
+ end
1270
+ end
1271
+ else
1272
+ begin begin @current_pointer = (( @token_end))-1; end
1273
+ end
1274
+ end
1275
+ end
1276
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1277
+ when 37 then
1278
+ # line 55 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1279
+ begin
1280
+ @token_end = @current_pointer+1
1281
+ begin begin
1282
+ @current_state = 252
1283
+ _trigger_goto = true
1284
+ _goto_level = _again
1285
+ break
1286
+ end
1287
+ end
1288
+ end
1289
+ # line 55 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1290
+ when 38 then
1291
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1292
+ begin
1293
+ @token_end = @current_pointer+1
1294
+ begin
1295
+ # If this scanner's look-ahead capability didn't match the prompt, let's ignore the need for a prompt
1296
+ @current_pointer = @current_pointer - 1;
1297
+ begin
1298
+ @current_state = 252
1299
+ _trigger_goto = true
1300
+ _goto_level = _again
1301
+ break
1302
+ end
1303
+
1304
+ end
1305
+ end
1306
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1307
+ when 39 then
1308
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1309
+ begin
1310
+ @token_end = @current_pointer
1311
+ @current_pointer = @current_pointer - 1; begin
1312
+ # If this scanner's look-ahead capability didn't match the prompt, let's ignore the need for a prompt
1313
+ @current_pointer = @current_pointer - 1;
1314
+ begin
1315
+ @current_state = 252
1316
+ _trigger_goto = true
1317
+ _goto_level = _again
1318
+ break
1319
+ end
1320
+
1321
+ end
1322
+ end
1323
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1324
+ when 40 then
1325
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1326
+ begin
1327
+ begin @current_pointer = (( @token_end))-1; end
1328
+ begin
1329
+ # If this scanner's look-ahead capability didn't match the prompt, let's ignore the need for a prompt
1330
+ @current_pointer = @current_pointer - 1;
1331
+ begin
1332
+ @current_state = 252
1333
+ _trigger_goto = true
1334
+ _goto_level = _again
1335
+ break
1336
+ end
1337
+
1338
+ end
1339
+ end
1340
+ # line 56 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1341
+ when 41 then
1342
+ # line 64 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1343
+ begin
1344
+ @token_end = @current_pointer+1
1345
+ end
1346
+ # line 64 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1347
+ when 42 then
1348
+ # line 65 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1349
+ begin
1350
+ @token_end = @current_pointer+1
1351
+ end
1352
+ # line 65 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1353
+ when 43 then
1354
+ # line 66 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1355
+ begin
1356
+ @token_end = @current_pointer+1
1357
+ end
1358
+ # line 66 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1359
+ when 44 then
1360
+ # line 67 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1361
+ begin
1362
+ @token_end = @current_pointer+1
1363
+ end
1364
+ # line 67 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1365
+ when 45 then
1366
+ # line 68 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1367
+ begin
1368
+ @token_end = @current_pointer+1
1369
+ end
1370
+ # line 68 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1371
+ when 46 then
1372
+ # line 69 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1373
+ begin
1374
+ @token_end = @current_pointer+1
1375
+ end
1376
+ # line 69 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1377
+ when 47 then
1378
+ # line 70 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1379
+ begin
1380
+ @token_end = @current_pointer+1
1381
+ begin begin
1382
+ @current_state = 252
1383
+ _trigger_goto = true
1384
+ _goto_level = _again
1385
+ break
1386
+ end
1387
+ end
1388
+ end
1389
+ # line 70 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1390
+ when 48 then
1391
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1392
+ begin
1393
+ @token_end = @current_pointer+1
1394
+ begin
1395
+ # If NONE of the above patterns match, we consider this a syntax error. The irregularity machine can recover gracefully.
1396
+ @current_pointer = @current_pointer - 1;
1397
+ begin
1398
+ @ragel_stack[ @ragel_stack_top] = @current_state
1399
+ @ragel_stack_top+= 1
1400
+ @current_state = 250
1401
+ _trigger_goto = true
1402
+ _goto_level = _again
1403
+ break
1404
+ end
1405
+
1406
+ end
1407
+ end
1408
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1409
+ when 49 then
1410
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1411
+ begin
1412
+ @token_end = @current_pointer
1413
+ @current_pointer = @current_pointer - 1; begin
1414
+ # If NONE of the above patterns match, we consider this a syntax error. The irregularity machine can recover gracefully.
1415
+ @current_pointer = @current_pointer - 1;
1416
+ begin
1417
+ @ragel_stack[ @ragel_stack_top] = @current_state
1418
+ @ragel_stack_top+= 1
1419
+ @current_state = 250
1420
+ _trigger_goto = true
1421
+ _goto_level = _again
1422
+ break
1423
+ end
1424
+
1425
+ end
1426
+ end
1427
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1428
+ when 50 then
1429
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1430
+ begin
1431
+ begin @current_pointer = (( @token_end))-1; end
1432
+ begin
1433
+ # If NONE of the above patterns match, we consider this a syntax error. The irregularity machine can recover gracefully.
1434
+ @current_pointer = @current_pointer - 1;
1435
+ begin
1436
+ @ragel_stack[ @ragel_stack_top] = @current_state
1437
+ @ragel_stack_top+= 1
1438
+ @current_state = 250
1439
+ _trigger_goto = true
1440
+ _goto_level = _again
1441
+ break
1442
+ end
1443
+
1444
+ end
1445
+ end
1446
+ # line 71 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1447
+ when 51 then
1448
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1449
+ begin
1450
+ @ragel_act = 13; end
1451
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1452
+ when 52 then
1453
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1454
+ begin
1455
+ @ragel_act = 15; end
1456
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1457
+ when 53 then
1458
+ # line 83 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1459
+ begin
1460
+ @token_end = @current_pointer+1
1461
+ end
1462
+ # line 83 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1463
+ when 54 then
1464
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1465
+ begin
1466
+ @token_end = @current_pointer
1467
+ @current_pointer = @current_pointer - 1; end
1468
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1469
+ when 55 then
1470
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1471
+ begin
1472
+ @token_end = @current_pointer
1473
+ @current_pointer = @current_pointer - 1; end
1474
+ # line 84 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1475
+ when 56 then
1476
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1477
+ begin
1478
+ begin @current_pointer = (( @token_end))-1; end
1479
+ end
1480
+ # line 82 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1481
+ when 57 then
1482
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1483
+ begin
1484
+ case @ragel_act
1485
+ when 0 then
1486
+ begin begin
1487
+ @current_state = 0
1488
+ _trigger_goto = true
1489
+ _goto_level = _again
1490
+ break
1491
+ end
1492
+ end
1493
+ else
1494
+ begin begin @current_pointer = (( @token_end))-1; end
1495
+ end
1496
+ end
1497
+ end
1498
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1499
+ # line 1500 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1500
+ end # action switch
1501
+ end
1502
+ end
1503
+ if _trigger_goto
1504
+ next
1505
+ end
1506
+ end
1507
+ if _goto_level <= _again
1508
+ _acts = _ami_protocol_parser_to_state_actions[ @current_state]
1509
+ _nacts = _ami_protocol_parser_actions[_acts]
1510
+ _acts += 1
1511
+ while _nacts > 0
1512
+ _nacts -= 1
1513
+ _acts += 1
1514
+ case _ami_protocol_parser_actions[_acts - 1]
1515
+ when 28 then
1516
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1517
+ begin
1518
+ @token_start = nil; end
1519
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1520
+ when 29 then
1521
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1522
+ begin
1523
+ @ragel_act = 0
1524
+ end
1525
+ # line 1 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1526
+ # line 1527 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rb"
1527
+ end # to state action switch
1528
+ end
1529
+ if _trigger_goto
1530
+ next
1531
+ end
1532
+ if @current_state == 0
1533
+ _goto_level = _out
1534
+ next
1535
+ end
1536
+ @current_pointer += 1
1537
+ if @current_pointer != @data_ending_pointer
1538
+ _goto_level = _resume
1539
+ next
1540
+ end
1541
+ end
1542
+ if _goto_level <= _test_eof
1543
+ if @current_pointer == @eof
1544
+ if _ami_protocol_parser_eof_trans[ @current_state] > 0
1545
+ _trans = _ami_protocol_parser_eof_trans[ @current_state] - 1;
1546
+ _goto_level = _eof_trans
1547
+ next;
1548
+ end
1549
+ end
1550
+ end
1551
+ if _goto_level <= _out
1552
+ break
1553
+ end
1554
+ end
1555
+ end
1556
+ # line 89 "lib/adhearsion/voip/asterisk/manager_interface/ami_lexer.rl.rb"
1557
+ ##
1558
+ end
1559
+
1560
+ def extend_buffer_with(new_data)
1561
+ if new_data.size + @data.size > BUFFER_SIZE
1562
+ @data.slice! 0...new_data.size
1563
+ # TODO: What if the current_pointer wasn't at the end of the data for some reason?
1564
+ @current_pointer = @data.size
1565
+ end
1566
+ @data << new_data
1567
+ @data_ending_pointer = @data.size
1568
+ end
1569
+
1570
+ protected
1571
+
1572
+ ##
1573
+ # Called after a response or event has been successfully parsed.
1574
+ #
1575
+ # @param [ManagerInterfaceResponse, ManagerInterfaceEvent] message The message just received
1576
+ #
1577
+ def message_received(message)
1578
+ raise NotImplementedError, "Must be implemented in subclass!"
1579
+ end
1580
+
1581
+ ##
1582
+ # Called when there is an Error: stanza on the socket. Could be caused by executing an unrecognized command, trying
1583
+ # to originate into an invalid priority, etc. Note: many errors' responses are actually tightly coupled to a
1584
+ # ManagerInterfaceEvent which comes directly after it. Often the message will say something like "Channel status
1585
+ # will follow".
1586
+ #
1587
+ # @param [String] reason The reason given in the Message: header for the error stanza.
1588
+ #
1589
+ def error_received(reason)
1590
+ raise NotImplementedError, "Must be implemented in subclass!"
1591
+ end
1592
+
1593
+ ##
1594
+ # Called when there's a syntax error on the socket. This doesn't happen as often as it should because, in many cases,
1595
+ # it's impossible to distinguish between a syntax error and an immediate packet.
1596
+ #
1597
+ # @param [String] ignored_chunk The offending text which caused the syntax error.
1598
+ def syntax_error_encountered(ignored_chunk)
1599
+ raise NotImplementedError, "Must be implemented in subclass!"
1600
+ end
1601
+
1602
+ def init_success
1603
+ @current_message = ManagerInterfaceResponse.new
1604
+ end
1605
+
1606
+ def init_response_follows
1607
+ @current_message = ManagerInterfaceResponse.new
1608
+ end
1609
+
1610
+ def init_error
1611
+ @current_message = ManagerInterfaceError.new()
1612
+ end
1613
+
1614
+ def version_starts
1615
+ @start_of_version = @current_pointer
1616
+ end
1617
+
1618
+ def version_stops
1619
+ self.ami_version = @data[@start_of_version...@current_pointer].to_f
1620
+ @start_of_version = nil
1621
+ end
1622
+
1623
+ def event_name_starts
1624
+ @event_name_start = @current_pointer
1625
+ end
1626
+
1627
+ def event_name_stops
1628
+ event_name = @data[@event_name_start...@current_pointer]
1629
+ @event_name_start = nil
1630
+ @current_message = ManagerInterfaceEvent.new(event_name)
1631
+ end
1632
+
1633
+ def key_starts
1634
+ @current_key_position = @current_pointer
1635
+ end
1636
+
1637
+ def key_stops
1638
+ @current_key = @data[@current_key_position...@current_pointer]
1639
+ end
1640
+
1641
+ def value_starts
1642
+ @current_value_position = @current_pointer
1643
+ end
1644
+
1645
+ def value_stops
1646
+ @current_value = @data[@current_value_position...@current_pointer]
1647
+ @last_seen_value_end = @current_pointer + 2 # 2 for \r\n
1648
+ add_pair_to_current_message
1649
+ end
1650
+
1651
+ def error_reason_starts
1652
+ @error_reason_start = @current_pointer
1653
+ end
1654
+
1655
+ def error_reason_stops
1656
+ @current_message.message = @data[@error_reason_start...@current_pointer]
1657
+ end
1658
+
1659
+ def follows_text_starts
1660
+ @follows_text_start = @current_pointer
1661
+ end
1662
+
1663
+ def follows_text_stops
1664
+ text = @data[@last_seen_value_end..(@current_pointer - "\r\n--END COMMAND--".size)]
1665
+ @current_message.text_body = text
1666
+ @follows_text_start = nil
1667
+ end
1668
+
1669
+ def add_pair_to_current_message
1670
+ @current_message[@current_key] = @current_value
1671
+ reset_key_and_value_positions
1672
+ end
1673
+
1674
+ def reset_key_and_value_positions
1675
+ @current_key, @current_value, @current_key_position, @current_value_position = nil
1676
+ end
1677
+
1678
+ def syntax_error_starts
1679
+ @current_syntax_error_start = @current_pointer # Adding 1 since the pointer is still set to the last successful match
1680
+ end
1681
+
1682
+ def syntax_error_stops
1683
+ # Subtracting 3 from @current_pointer below for "\r\n" which separates a stanza
1684
+ offending_data = @data[@current_syntax_error_start...@current_pointer - 1]
1685
+ syntax_error_encountered offending_data
1686
+ @current_syntax_error_start = nil
1687
+ end
1688
+
1689
+ def immediate_response_starts
1690
+ @immediate_response_start = @current_pointer
1691
+ end
1692
+
1693
+ def immediate_response_stops
1694
+ message = @data[@immediate_response_start...(@current_pointer -1)]
1695
+ message_received ManagerInterfaceResponse.from_immediate_response(message)
1696
+ end
1697
+
1698
+ ##
1699
+ # This method is used primarily in debugging.
1700
+ #
1701
+ def view_buffer(message=nil)
1702
+
1703
+ message ||= "Viewing the buffer"
1704
+
1705
+ buffer = @data.clone
1706
+ buffer.insert(@current_pointer, "\033[0;31m\033[1;31m^\033[0m")
1707
+
1708
+ buffer.gsub!("\r", "\\\\r")
1709
+ buffer.gsub!("\n", "\\n\n")
1710
+
1711
+ puts <<-INSPECTION
1712
+ VVVVVVVVVVVVVVVVVVVVVVVVVVVVV
1713
+ #### #{message}
1714
+ #############################
1715
+ #{buffer}
1716
+ #############################
1717
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1718
+ INSPECTION
1719
+
1720
+ end
1721
+ end
1722
+ class DelegatingAsteriskManagerInterfaceLexer < AbstractAsteriskManagerInterfaceStreamLexer
1723
+
1724
+ def initialize(delegate, method_delegation_map=nil)
1725
+ super()
1726
+ @delegate = delegate
1727
+
1728
+ @message_received_method = method_delegation_map && method_delegation_map.has_key?(:message_received) ?
1729
+ method_delegation_map[:message_received] : :message_received
1730
+
1731
+ @error_received_method = method_delegation_map && method_delegation_map.has_key?(:error_received) ?
1732
+ method_delegation_map[:error_received] : :error_received
1733
+
1734
+ @syntax_error_method = method_delegation_map && method_delegation_map.has_key?(:syntax_error_encountered) ?
1735
+ method_delegation_map[:syntax_error_encountered] : :syntax_error_encountered
1736
+ end
1737
+
1738
+ def message_received(message)
1739
+ @delegate.send(@message_received_method, message)
1740
+ end
1741
+
1742
+ def error_received(message)
1743
+ @delegate.send(@error_received_method, message)
1744
+ end
1745
+
1746
+ def syntax_error_encountered(ignored_chunk)
1747
+ @delegate.send(@syntax_error_method, ignored_chunk)
1748
+ end
1749
+
1750
+ end
1751
+ end
1752
+ end
1753
+ end
1754
+ end