rene-adhearsion 0.8.6

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