1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2006-2020. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22%%----------------------------------------------------------------------
23%% Purpose: Test encoding/decoding (codec) module of Megaco/H.248
24%%----------------------------------------------------------------------
25
26-module(megaco_codec_v3_SUITE).
27
28%% ----
29
30-include_lib("megaco/include/megaco.hrl").
31-include_lib("megaco/include/megaco_message_v3.hrl").
32-include("megaco_test_lib.hrl").
33
34%% ----
35
36-export([msgs/0]).
37-export([rfc3525_msgs_display/0, rfc3525_msgs_test/0]).
38
39-export([
40 	 suite/0, all/0, groups/0,
41         init_per_suite/1, end_per_suite/1,
42         init_per_group/2, end_per_group/2,
43         init_per_testcase/2, end_per_testcase/2,
44
45	 pretty_test_msgs/1,
46
47	 compact_test_msgs/1,
48
49	 flex_pretty_init/1,
50	 flex_pretty_finish/1,
51	 flex_pretty_test_msgs/1,
52
53	 flex_compact_init/1,
54	 flex_compact_finish/1,
55	 flex_compact_test_msgs/1,
56
57	 flex_compact_dm_timers1/1,
58	 flex_compact_dm_timers2/1,
59	 flex_compact_dm_timers3/1,
60	 flex_compact_dm_timers4/1,
61	 flex_compact_dm_timers5/1,
62	 flex_compact_dm_timers6/1,
63	 flex_compact_dm_timers7/1,
64	 flex_compact_dm_timers8/1,
65
66	 bin_test_msgs/1,
67
68	 ber_test_msgs/1,
69
70	 per_test_msgs/1,
71
72	 erl_dist_m_test_msgs/1,
73
74	 compact_otp4011_msg1/1,
75	 compact_otp4011_msg2/1,
76	 compact_otp4011_msg3/1,
77	 compact_otp4013_msg1/1,
78	 compact_otp4085_msg1/1,
79	 compact_otp4085_msg2/1,
80	 compact_otp4280_msg1/1,
81	 compact_otp4299_msg1/1,
82	 compact_otp4359_msg1/1,
83	 compact_otp4920_msg0/1,
84	 compact_otp4920_msg1/1,
85	 compact_otp4920_msg2/1,
86	 compact_otp4920_msg3/1,
87	 compact_otp4920_msg4/1,
88	 compact_otp4920_msg5/1,
89	 compact_otp4920_msg6/1,
90	 compact_otp4920_msg7/1,
91	 compact_otp4920_msg8/1,
92	 compact_otp4920_msg9/1,
93	 compact_otp4920_msg10/1,
94	 compact_otp4920_msg11/1,
95	 compact_otp4920_msg12/1,
96	 compact_otp4920_msg20/1,
97	 compact_otp4920_msg21/1,
98	 compact_otp4920_msg22/1,
99	 compact_otp4920_msg23/1,
100	 compact_otp4920_msg24/1,
101	 compact_otp4920_msg25/1,
102	 compact_otp5186_msg01/1,
103	 compact_otp5186_msg02/1,
104	 compact_otp5186_msg03/1,
105	 compact_otp5186_msg04/1,
106	 compact_otp5186_msg05/1,
107	 compact_otp5186_msg06/1,
108	 compact_otp5793_msg01/1,
109	 compact_otp5836_msg01/1,
110         compact_otp5993_msg01/1,
111         compact_otp5993_msg02/1,
112         compact_otp5993_msg03/1,
113         compact_otp6017_msg01/1,
114         compact_otp6017_msg02/1,
115         compact_otp6017_msg03/1,
116         compact_otp16818_msg01/1,
117         compact_otp16818_msg02/1,
118         compact_otp16818_msg03/1,
119         compact_otp16818_msg04/1,
120         compact_otp16818_msg05/1,
121         compact_otp16818_msg06/1,
122         compact_otp16818_msg11/1,
123         compact_otp16818_msg12/1,
124         compact_otp16818_msg13/1,
125         compact_otp16818_msg14/1,
126         compact_otp16818_msg15/1,
127         compact_otp16818_msg16/1,
128         compact_otp16818_msg21/1,
129         compact_otp16818_msg22/1,
130         compact_otp16818_msg23/1,
131         compact_otp16818_msg24/1,
132         compact_otp16818_msg25/1,
133         compact_otp16818_msg26/1,
134         compact_otp16818_msg31/1,
135         compact_otp16818_msg32/1,
136         compact_otp16818_msg33/1,
137         compact_otp16818_msg34/1,
138         compact_otp16818_msg35/1,
139         compact_otp16818_msg36/1,
140         compact_erl1405_msg01/1,
141         compact_erl1405_msg02/1,
142
143	 flex_compact_otp4299_msg1/1,
144         flex_compact_otp7431_msg01/1,
145         flex_compact_otp7431_msg02/1,
146         flex_compact_otp7431_msg03/1,
147         flex_compact_otp7431_msg04/1,
148         flex_compact_otp7431_msg05/1,
149         flex_compact_otp7431_msg06/1,
150         flex_compact_otp7431_msg07/1,
151
152	 pretty_otp4632_msg1/1,
153	 pretty_otp4632_msg2/1,
154	 pretty_otp4632_msg3/1,
155	 pretty_otp4632_msg4/1,
156	 pretty_otp4710_msg1/1,
157	 pretty_otp4710_msg2/1,
158	 pretty_otp4945_msg1/1,
159	 pretty_otp4945_msg2/1,
160	 pretty_otp4945_msg3/1,
161	 pretty_otp4945_msg4/1,
162	 pretty_otp4945_msg5/1,
163	 pretty_otp4945_msg6/1,
164	 pretty_otp4949_msg1/1,
165	 pretty_otp4949_msg2/1,
166	 pretty_otp4949_msg3/1,
167	 pretty_otp5042_msg1/1,
168	 pretty_otp5068_msg1/1,
169	 pretty_otp5085_msg1/1,
170	 pretty_otp5085_msg2/1,
171	 pretty_otp5085_msg3/1,
172	 pretty_otp5085_msg4/1,
173	 pretty_otp5085_msg5/1,
174	 pretty_otp5085_msg6/1,
175	 pretty_otp5085_msg7/1,
176	 pretty_otp5085_msg8/1,
177         pretty_otp5600_msg1/1,
178         pretty_otp5600_msg2/1,
179         pretty_otp5601_msg1/1,
180         pretty_otp5793_msg01/1,
181	 pretty_otp5803_msg01/1,
182	 pretty_otp5803_msg02/1,
183	 pretty_otp5805_msg01/1,
184	 pretty_otp5836_msg01/1,
185	 pretty_otp5882_msg01/1,
186	 pretty_otp6490_msg01/1,
187	 pretty_otp6490_msg02/1,
188	 pretty_otp6490_msg03/1,
189	 pretty_otp6490_msg04/1,
190	 pretty_otp6490_msg05/1,
191	 pretty_otp6490_msg06/1,
192         pretty_otp7671_msg01/1,
193         pretty_otp7671_msg02/1,
194         pretty_otp7671_msg03/1,
195         pretty_otp7671_msg04/1,
196         pretty_otp7671_msg05/1,
197         pretty_otp8114_msg01/1,
198         pretty_erl1405_msg01/1,
199         pretty_erl1405_msg02/1,
200
201	 flex_pretty_otp5042_msg1/1,
202	 flex_pretty_otp5085_msg1/1,
203	 flex_pretty_otp5085_msg2/1,
204	 flex_pretty_otp5085_msg3/1,
205	 flex_pretty_otp5085_msg4/1,
206	 flex_pretty_otp5085_msg5/1,
207	 flex_pretty_otp5085_msg6/1,
208	 flex_pretty_otp5085_msg7/1,
209	 flex_pretty_otp5085_msg8/1,
210         flex_pretty_otp5600_msg1/1,
211         flex_pretty_otp5600_msg2/1,
212         flex_pretty_otp5601_msg1/1,
213         flex_pretty_otp5793_msg01/1,
214	 flex_pretty_otp5803_msg01/1,
215	 flex_pretty_otp5803_msg02/1,
216	 flex_pretty_otp5805_msg01/1,
217	 flex_pretty_otp5836_msg01/1,
218         flex_pretty_otp7431_msg01/1,
219         flex_pretty_otp7431_msg02/1,
220         flex_pretty_otp7431_msg03/1,
221         flex_pretty_otp7431_msg04/1,
222         flex_pretty_otp7431_msg05/1,
223         flex_pretty_otp7431_msg06/1,
224         flex_pretty_otp7431_msg07/1
225
226       ]).
227
228-export([display_text_messages/0, generate_text_messages/0]).
229
230
231%% ----
232
233-define(V3,    v3).
234-define(EC_V3, {version3,?V3}).
235-define(EC,    [?EC_V3]).
236
237-define(VERSION,      3).
238-define(VERSION_STR,  "3").
239-define(MSG_LIB,      megaco_test_msg_v3_lib).
240-define(DEFAULT_PORT, 55555).
241-define(MG1_MID_NO_PORT, {ip4Address,
242                          #'IP4Address'{address = [124, 124, 124, 222]}}).
243-define(MG1_MID, {ip4Address, #'IP4Address'{address = [124, 124, 124, 222],
244                                            portNumber = ?DEFAULT_PORT}}).
245-define(MG2_MID, {ip4Address, #'IP4Address'{address = [125, 125, 125, 111],
246                                            portNumber = ?DEFAULT_PORT}}).
247-define(MG3_MID, {ip4Address, #'IP4Address'{address = [125, 124, 123, 122],
248                                            portNumber = ?DEFAULT_PORT}}).
249-define(MGC_MID, {ip4Address, #'IP4Address'{address = [123, 123, 123, 4],
250                                            portNumber = ?DEFAULT_PORT}}).
251
252-define(A4444, ["11111111", "00000000", "00000000"]).
253-define(A4445, ["11111111", "00000000", "11111111"]).
254-define(A5555, ["11111111", "11111111", "00000000"]).
255-define(A5556, ["11111111", "11111111", "11111111"]).
256
257
258%%======================================================================
259%% Common Test interface functions
260%%======================================================================
261
262suite() ->
263    [{ct_hooks, [ts_install_cth]}].
264
265all() ->
266    [
267     {group, text},
268     {group, binary},
269     {group, erl_dist},
270     {group, tickets}
271    ].
272
273groups() ->
274    [
275     {text,                 [], text_cases()},
276     {binary,               [], binary_cases()},
277     {erl_dist,             [], erl_dist_cases()},
278     {pretty,               [], pretty_cases()},
279     {compact,              [], compact_cases()},
280     {flex_pretty,          [], flex_pretty_cases()},
281     {flex_compact,         [], flex_compact_cases()},
282     {bin,                  [], bin_cases()},
283     {ber,                  [], ber_cases()},
284     {per,                  [], per_cases()},
285     {erl_dist_m,           [], erl_dist_m_cases()},
286     {tickets,              [], tickets_cases()},
287     {compact_tickets,      [], compact_tickets_cases()},
288     {flex_compact_tickets, [], flex_compact_tickets_cases()},
289     {pretty_tickets,       [], pretty_tickets_cases()},
290     {flex_pretty_tickets,  [], flex_pretty_tickets_cases()}
291    ].
292
293text_cases() ->
294    [
295     {group, pretty},
296     {group, flex_pretty},
297     {group, compact},
298     {group, flex_compact}
299    ].
300
301binary_cases() ->
302    [
303     {group, bin},
304     {group, ber},
305     {group, per}
306    ].
307
308erl_dist_cases() ->
309    [
310     {group, erl_dist_m}
311    ].
312
313pretty_cases() ->
314    [
315     pretty_test_msgs
316    ].
317
318compact_cases() ->
319    [
320     compact_test_msgs
321    ].
322
323flex_pretty_cases() ->
324    [
325     flex_pretty_test_msgs
326    ].
327
328bin_cases() ->
329    [
330     bin_test_msgs
331    ].
332
333ber_cases() ->
334    [
335     ber_test_msgs
336    ].
337
338per_cases() ->
339    [
340     per_test_msgs
341    ].
342
343erl_dist_m_cases() ->
344    [
345     erl_dist_m_test_msgs
346    ].
347
348flex_compact_cases() ->
349    [
350     flex_compact_test_msgs,
351     flex_compact_dm_timers1,
352     flex_compact_dm_timers2,
353     flex_compact_dm_timers3,
354     flex_compact_dm_timers4,
355     flex_compact_dm_timers5,
356     flex_compact_dm_timers6,
357     flex_compact_dm_timers7,
358     flex_compact_dm_timers8
359    ].
360
361tickets_cases() ->
362    [
363     {group, compact_tickets},
364     {group, flex_compact_tickets},
365     {group, pretty_tickets},
366     {group, flex_pretty_tickets}
367    ].
368
369compact_tickets_cases() ->
370    [
371     compact_otp4011_msg1,
372     compact_otp4011_msg2,
373     compact_otp4011_msg3,
374     compact_otp4013_msg1,
375     compact_otp4085_msg1,
376     compact_otp4085_msg2,
377     compact_otp4280_msg1,
378     compact_otp4299_msg1,
379     compact_otp4359_msg1,
380     compact_otp4920_msg0,
381     compact_otp4920_msg1,
382     compact_otp4920_msg2,
383     compact_otp4920_msg3,
384     compact_otp4920_msg4,
385     compact_otp4920_msg5,
386     compact_otp4920_msg6,
387     compact_otp4920_msg7,
388     compact_otp4920_msg8,
389     compact_otp4920_msg9,
390     compact_otp4920_msg10,
391     compact_otp4920_msg11,
392     compact_otp4920_msg12,
393     compact_otp4920_msg20,
394     compact_otp4920_msg21,
395     compact_otp4920_msg22,
396     compact_otp4920_msg23,
397     compact_otp4920_msg24,
398     compact_otp4920_msg25,
399     compact_otp5186_msg01,
400     compact_otp5186_msg02,
401     compact_otp5186_msg03,
402     compact_otp5186_msg04,
403     compact_otp5186_msg05,
404     compact_otp5186_msg06,
405     compact_otp5793_msg01,
406     compact_otp5836_msg01,
407     compact_otp5993_msg01,
408     compact_otp5993_msg02,
409     compact_otp5993_msg03,
410     compact_otp6017_msg01,
411     compact_otp6017_msg02,
412     compact_otp6017_msg03,
413     compact_otp16818_msg01,
414     compact_otp16818_msg02,
415     compact_otp16818_msg03,
416     compact_otp16818_msg04,
417     compact_otp16818_msg05,
418     compact_otp16818_msg06,
419     compact_otp16818_msg11,
420     compact_otp16818_msg12,
421     compact_otp16818_msg13,
422     compact_otp16818_msg14,
423     compact_otp16818_msg15,
424     compact_otp16818_msg16,
425     compact_otp16818_msg21,
426     compact_otp16818_msg22,
427     compact_otp16818_msg23,
428     compact_otp16818_msg24,
429     compact_otp16818_msg25,
430     compact_otp16818_msg26,
431     compact_otp16818_msg31,
432     compact_otp16818_msg32,
433     compact_otp16818_msg33,
434     compact_otp16818_msg34,
435     compact_otp16818_msg35,
436     compact_otp16818_msg36,
437     compact_erl1405_msg01,
438     compact_erl1405_msg02
439    ].
440
441flex_compact_tickets_cases() ->
442    [
443     flex_compact_otp4299_msg1,
444     flex_compact_otp7431_msg01,
445     flex_compact_otp7431_msg02,
446     flex_compact_otp7431_msg03,
447     flex_compact_otp7431_msg04,
448     flex_compact_otp7431_msg05,
449     flex_compact_otp7431_msg06,
450     flex_compact_otp7431_msg07
451    ].
452
453pretty_tickets_cases() ->
454    [
455     pretty_otp4632_msg1,
456     pretty_otp4632_msg2,
457     pretty_otp4632_msg3,
458     pretty_otp4632_msg4,
459     pretty_otp4710_msg1,
460     pretty_otp4710_msg2,
461     pretty_otp4945_msg1,
462     pretty_otp4945_msg2,
463     pretty_otp4945_msg3,
464     pretty_otp4945_msg4,
465     pretty_otp4945_msg5,
466     pretty_otp4945_msg6,
467     pretty_otp4949_msg1,
468     pretty_otp4949_msg2,
469     pretty_otp4949_msg3,
470     pretty_otp5042_msg1,
471     pretty_otp5068_msg1,
472     pretty_otp5085_msg1,
473     pretty_otp5085_msg2,
474     pretty_otp5085_msg3,
475     pretty_otp5085_msg4,
476     pretty_otp5085_msg5,
477     pretty_otp5085_msg6,
478     pretty_otp5085_msg7,
479     pretty_otp5085_msg8,
480     pretty_otp5600_msg1,
481     pretty_otp5600_msg2,
482     pretty_otp5601_msg1,
483     pretty_otp5793_msg01,
484     pretty_otp5803_msg01,
485     pretty_otp5803_msg02,
486     pretty_otp5805_msg01,
487     pretty_otp5836_msg01,
488     pretty_otp5882_msg01,
489     pretty_otp6490_msg01,
490     pretty_otp6490_msg02,
491     pretty_otp6490_msg03,
492     pretty_otp6490_msg04,
493     pretty_otp6490_msg05,
494     pretty_otp6490_msg06,
495     pretty_otp7671_msg01,
496     pretty_otp7671_msg02,
497     pretty_otp7671_msg03,
498     pretty_otp7671_msg04,
499     pretty_otp7671_msg05,
500     pretty_otp8114_msg01,
501     pretty_erl1405_msg01,
502     pretty_erl1405_msg02
503    ].
504
505flex_pretty_tickets_cases() ->
506    [
507     flex_pretty_otp5042_msg1,
508     flex_pretty_otp5085_msg1,
509     flex_pretty_otp5085_msg2,
510     flex_pretty_otp5085_msg3,
511     flex_pretty_otp5085_msg4,
512     flex_pretty_otp5085_msg5,
513     flex_pretty_otp5085_msg6,
514     flex_pretty_otp5085_msg7,
515     flex_pretty_otp5085_msg8,
516     flex_pretty_otp5600_msg1,
517     flex_pretty_otp5600_msg2,
518     flex_pretty_otp5601_msg1,
519     flex_pretty_otp5793_msg01,
520     flex_pretty_otp5803_msg01,
521     flex_pretty_otp5803_msg02,
522     flex_pretty_otp5805_msg01,
523     flex_pretty_otp5836_msg01,
524     flex_pretty_otp7431_msg01,
525     flex_pretty_otp7431_msg02,
526     flex_pretty_otp7431_msg03,
527     flex_pretty_otp7431_msg04,
528     flex_pretty_otp7431_msg05,
529     flex_pretty_otp7431_msg06,
530     flex_pretty_otp7431_msg07
531    ].
532
533
534%%
535%% -----
536%%
537
538init_per_suite(suite) ->
539    [];
540init_per_suite(doc) ->
541    [];
542init_per_suite(Config0) when is_list(Config0) ->
543
544    ?ANNOUNCE_SUITE_INIT(),
545
546    p("init_per_suite -> entry with"
547      "~n      Config: ~p"
548      "~n      Nodes:  ~p", [Config0, erlang:nodes()]),
549
550    case ?LIB:init_per_suite(Config0) of
551        {skip, _} = SKIP ->
552            SKIP;
553
554        Config1 when is_list(Config1) ->
555
556            %% We need a (local) monitor on this node also
557            megaco_test_sys_monitor:start(),
558
559            p("init_per_suite -> end when"
560              "~n      Config: ~p"
561              "~n      Nodes:  ~p", [Config1, erlang:nodes()]),
562
563            Config1
564    end.
565
566end_per_suite(suite) -> [];
567end_per_suite(doc) -> [];
568end_per_suite(Config0) when is_list(Config0) ->
569
570    p("end_per_suite -> entry with"
571      "~n      Config: ~p"
572      "~n      Nodes:  ~p", [Config0, erlang:nodes()]),
573
574    megaco_test_sys_monitor:stop(),
575    Config1 = ?LIB:end_per_suite(Config0),
576
577    p("end_per_suite -> end when"
578      "~n      Nodes:  ~p", [erlang:nodes()]),
579
580    Config1.
581
582
583%%
584%% -----
585%%
586
587init_per_group(flex_pretty_tickets = Group, Config) ->
588    ?ANNOUNCE_GROUP_INIT(Group),
589    flex_pretty_init(Config);
590init_per_group(flex_compact_tickets = Group, Config) ->
591    ?ANNOUNCE_GROUP_INIT(Group),
592    flex_compact_init(Config);
593init_per_group(flex_compact = Group, Config) ->
594    ?ANNOUNCE_GROUP_INIT(Group),
595    flex_compact_init(Config);
596init_per_group(flex_pretty = Group, Config) ->
597    ?ANNOUNCE_GROUP_INIT(Group),
598    flex_pretty_init(Config);
599init_per_group(Group, Config) ->
600    ?ANNOUNCE_GROUP_INIT(Group),
601    Config.
602
603end_per_group(flex_pretty_tickets = _Group, Config) ->
604    flex_pretty_finish(Config);
605end_per_group(flex_compact_tickets = _Group, Config) ->
606    flex_compact_finish(Config);
607end_per_group(flex_compact = _Group, Config) ->
608    flex_compact_finish(Config);
609end_per_group(flex_pretty = _Group, Config) ->
610    flex_pretty_finish(Config);
611end_per_group(_Group, Config) ->
612    Config.
613
614
615%%
616%% -----
617%%
618
619init_per_testcase(Case, Config) ->
620    %% We do *not* reset events with each test case
621    %% The test cases are so short we don't bother,
622    %% and also we would drown in mprintouts...
623    put(verbosity,trc),
624    megaco_test_lib:init_per_testcase(Case, Config).
625
626end_per_testcase(Case, Config) ->
627    erase(verbosity),
628    megaco_test_lib:end_per_testcase(Case, Config).
629
630
631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632
633display_text_messages() ->
634    Msgs =
635	msgs7(text)  ++
636	msgs8(text),
637    megaco_codec_test_lib:display_text_messages(?VERSION, ?EC, Msgs).
638
639
640generate_text_messages() ->
641    Msgs =
642	msgs7(text)  ++
643	msgs8(text),
644    megaco_codec_test_lib:generate_text_messages(?V3, ?VERSION, ?EC, Msgs).
645
646
647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
648
649pretty_test_msgs(suite) ->
650    [];
651pretty_test_msgs(Config) when is_list(Config) ->
652    ?ACQUIRE_NODES(1, Config),
653    Msgs =
654        msgs1a(text) ++
655        msgs1b(text) ++
656        msgs3525(text) ++
657        msgs5(text) ++
658        msgs6(text) ++
659        msgs7(text) ++
660        msgs8(text),
661    %% Msgs = msgs1a(text),
662    %% Msgs = msgs1b(text),
663    %% Msgs = msgs35525(text),
664    %% Msgs = msgs5(text),
665    %% Msgs = msgs6(text),
666    %% Msgs = msgs7(text),
667    DynamicDecode = false,
668    test_msgs(megaco_pretty_text_encoder, DynamicDecode, ?EC, Msgs).
669
670
671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
672
673flex_pretty_init(Config) ->
674    flex_init(Config).
675
676flex_pretty_finish(Config) ->
677    flex_finish(Config).
678
679
680flex_pretty_test_msgs(suite) ->
681    [];
682flex_pretty_test_msgs(Config) when is_list(Config) ->
683    ?ACQUIRE_NODES(1, Config),
684    Msgs =
685	msgs1a(text) ++
686	msgs1b(text) ++
687	msgs3525(text) ++
688	msgs5(text) ++
689	msgs6(text) ++
690	msgs7(text) ++
691	msgs8(text),
692    Conf = flex_scanner_conf(Config),
693    DynamicDecode = false,
694    test_msgs(megaco_pretty_text_encoder, DynamicDecode, [?EC_V3,Conf], Msgs).
695
696
697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
698
699compact_test_msgs(suite) ->
700    [];
701compact_test_msgs(Config) when is_list(Config) ->
702    ?ACQUIRE_NODES(1, Config),
703    Msgs =
704	msgs1a(text) ++
705	msgs1b(text) ++
706	msgs3525(text) ++
707	msgs5(text) ++
708        msgs6(text) ++
709	msgs7(text) ++
710	msgs8(text),
711    %% Msgs = msgs7(text),
712    DynamicDecode = false,
713    test_msgs(megaco_compact_text_encoder, DynamicDecode, ?EC, Msgs).
714
715
716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
717
718flex_compact_init(Config) ->
719    flex_init(Config).
720
721flex_compact_finish(Config) ->
722    flex_finish(Config).
723
724
725flex_compact_test_msgs(suite) ->
726    [];
727flex_compact_test_msgs(Config) when is_list(Config) ->
728    ?ACQUIRE_NODES(1, Config),
729    Msgs =
730	msgs1a(text) ++
731	msgs1b(text) ++
732	msgs3525(text) ++
733	msgs5(text) ++
734	msgs6(text) ++
735	msgs7(text) ++
736	msgs8(text),
737    Conf = flex_scanner_conf(Config),
738    DynamicDecode = true,
739    test_msgs(megaco_compact_text_encoder, DynamicDecode, [?EC_V3,Conf], Msgs).
740
741
742flex_compact_dm_timers1(suite) ->
743    [];
744flex_compact_dm_timers1(Config) when is_list(Config) ->
745    ?ACQUIRE_NODES(1, Config),
746    M = build_dm_timers_message("1", "2", "3"),
747    B = list_to_binary(M),
748    Conf = flex_scanner_conf(Config),
749    case decode_message(megaco_compact_text_encoder, false,
750			[?EC_V3,Conf], B) of
751	{ok, M1} when is_record(M1,'MegacoMessage') ->
752	    t("flex_compact_dm_timers1 -> "
753	      "~n   M:  ~s"
754	      "~n   M1: ~p", [M, M1]),
755	    verify_dm_timers({1,2,3}, M1);
756	Else ->
757	    exit({decode_failed, M, Else})
758    end.
759
760
761flex_compact_dm_timers2(suite) ->
762    [];
763flex_compact_dm_timers2(Config) when is_list(Config) ->
764    ?ACQUIRE_NODES(1, Config),
765    M = build_dm_timers_message("02", "03", "04"),
766    B = list_to_binary(M),
767    Conf = flex_scanner_conf(Config),
768    case decode_message(megaco_compact_text_encoder, false,
769			[?EC_V3,Conf], B) of
770	{ok, M1} when is_record(M1,'MegacoMessage') ->
771	    t("flex_compact_dm_timers2 -> "
772	      "~n   M:  ~s"
773	      "~n   M1: ~p", [M, M1]),
774	    verify_dm_timers({2,3,4}, M1);
775	Else ->
776	    exit({decode_failed, M, Else})
777    end.
778
779
780flex_compact_dm_timers3(suite) ->
781    [];
782flex_compact_dm_timers3(Config) when is_list(Config) ->
783    ?ACQUIRE_NODES(1, Config),
784    M = build_dm_timers_message("1", "02", "31"),
785    B = list_to_binary(M),
786    Conf = flex_scanner_conf(Config),
787    case decode_message(megaco_compact_text_encoder, false,
788			[?EC_V3,Conf], B) of
789	{ok, M1} when is_record(M1,'MegacoMessage') ->
790	    t("flex_compact_dm_timers3 -> "
791	      "~n   M:  ~s"
792	      "~n   M1: ~p", [M, M1]),
793	    verify_dm_timers({1,2,31}, M1);
794	Else ->
795	    exit({decode_failed, M, Else})
796    end.
797
798
799flex_compact_dm_timers4(suite) ->
800    [];
801flex_compact_dm_timers4(Config) when is_list(Config) ->
802    ?ACQUIRE_NODES(1, Config),
803    M = build_dm_timers_message("10", "21", "99"),
804    B = list_to_binary(M),
805    Conf = flex_scanner_conf(Config),
806    case decode_message(megaco_compact_text_encoder, false,
807			[?EC_V3,Conf], B) of
808	{ok, M1} when is_record(M1,'MegacoMessage') ->
809	    t("flex_compact_dm_timers4 -> "
810	      "~n   M:  ~s"
811	      "~n   M1: ~p", [M, M1]),
812	    verify_dm_timers({10,21,99}, M1);
813	Else ->
814	    exit({decode_failed, M, Else})
815    end.
816
817
818flex_compact_dm_timers5(suite) ->
819    [];
820flex_compact_dm_timers5(Config) when is_list(Config) ->
821    ?ACQUIRE_NODES(1, Config),
822    M = build_dm_timers_message("99", "23", "11"),
823    B = list_to_binary(M),
824    Conf = flex_scanner_conf(Config),
825    case decode_message(megaco_compact_text_encoder, false,
826			[?EC_V3,Conf], B) of
827	{ok, M1} when is_record(M1,'MegacoMessage') ->
828	    t("flex_compact_dm_timers5 -> "
829	      "~n   M:  ~s"
830	      "~n   M1: ~p", [M, M1]),
831	    verify_dm_timers({99,23,11}, M1);
832	Else ->
833	    exit({decode_failed, M, Else})
834    end.
835
836
837flex_compact_dm_timers6(suite) ->
838    [];
839flex_compact_dm_timers6(Config) when is_list(Config) ->
840    ?ACQUIRE_NODES(1, Config),
841    M = build_dm_timers_message("77", "09", "1"),
842    B = list_to_binary(M),
843    Conf = flex_scanner_conf(Config),
844    case decode_message(megaco_compact_text_encoder, false,
845			[?EC_V3,Conf], B) of
846	{ok, M1} when is_record(M1,'MegacoMessage') ->
847	    t("flex_compact_dm_timers6 -> "
848	      "~n   M:  ~s"
849	      "~n   M1: ~p", [M, M1]),
850	    verify_dm_timers({77,9,1}, M1);
851	Else ->
852	    exit({decode_failed, M, Else})
853    end.
854
855
856flex_compact_dm_timers7(suite) ->
857    [];
858flex_compact_dm_timers7(Config) when is_list(Config) ->
859    ?ACQUIRE_NODES(1, Config),
860    M = build_dm_timers_message("77", "09", "1", "99"),
861    B = list_to_binary(M),
862    Conf = flex_scanner_conf(Config),
863    case decode_message(megaco_compact_text_encoder, false,
864			[?EC_V3,Conf], B) of
865	{ok, M1} when is_record(M1,'MegacoMessage') ->
866	    t("flex_compact_dm_timers7 -> "
867	      "~n   M:  ~s"
868	      "~n   M1: ~p", [M, M1]),
869	    verify_dm_timers({77,9,1,99}, M1);
870	Else ->
871	    exit({decode_failed, M, Else})
872    end.
873
874
875flex_compact_dm_timers8(suite) ->
876    [];
877flex_compact_dm_timers8(Config) when is_list(Config) ->
878    ?ACQUIRE_NODES(1, Config),
879    M = build_dm_timers_message("01", "09", "01", "02"),
880    B = list_to_binary(M),
881    Conf = flex_scanner_conf(Config),
882    case decode_message(megaco_compact_text_encoder, false,
883			[?EC_V3,Conf], B) of
884	{ok, M1} when is_record(M1,'MegacoMessage') ->
885	    t("flex_compact_dm_timers8 -> "
886	      "~n   M:  ~s"
887	      "~n   M1: ~p", [M, M1]),
888	    verify_dm_timers({1,9,1,2}, M1);
889	Else ->
890	    exit({decode_failed, M, Else})
891    end.
892
893
894build_dm_timers_message(T, S, L) ->
895    TMRs = lists:flatten(io_lib:format("T:~s,S:~s,L:~s", [T, S, L])),
896    build_dm_timers_message(TMRs).
897
898build_dm_timers_message(T, S, L, Z) ->
899    TMRs = lists:flatten(io_lib:format("T:~s,S:~s,L:~s,Z:~s", [T, S, L,Z])),
900    build_dm_timers_message(TMRs).
901
902build_dm_timers_message(TMRs) ->
903    M = io_lib:format("!/" ?VERSION_STR " [123.123.123.4]:55555\nT=10001{C=-{MF=11111111/00000000/00000000{E=2223{al/on,dd/ce{DM=dialplan00}},SG{cg/rt},DM=dialplan00{~s,(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)}}}}", [TMRs]),
904    lists:flatten(M).
905
906
907verify_dm_timers(TMRs, #'MegacoMessage'{mess = Mess}) ->
908    #'Message'{messageBody = Body} = Mess,
909    case get_dm_timers(Body) of
910	TMRs ->
911	    ok;
912	{error, Reason} ->
913	    exit({invalid_timer, {TMRs, Reason}});
914	TMRs1 ->
915	    exit({invalid_timer_values, {TMRs, TMRs1}})
916    end.
917
918get_dm_timers({transactions, T}) when is_list(T) ->
919    get_dm_timers1(T);
920get_dm_timers(Other) ->
921    {error, {invalid_transactions, Other}}.
922
923get_dm_timers1([{transactionRequest,T}|Ts])
924  when is_record(T,'TransactionRequest') ->
925    case get_dm_timers2(T) of
926	{ok, Timers} ->
927	    Timers;
928	_ ->
929	    get_dm_timers1(Ts)
930    end;
931get_dm_timers1([_|Ts]) ->
932    get_dm_timers1(Ts);
933get_dm_timers1([]) ->
934    {error, {no_timers, 'TransactionRequest'}}.
935
936
937get_dm_timers2(#'TransactionRequest'{actions = Actions}) when is_list(Actions) ->
938    get_dm_timers3(Actions).
939
940
941get_dm_timers3([#'ActionRequest'{commandRequests = Cmds}|Ars]) when is_list(Cmds) ->
942    case get_dm_timers4(Cmds) of
943	{ok, Timers} ->
944	    {ok, Timers};
945	_ ->
946	    get_dm_timers3(Ars)
947    end;
948get_dm_timers3([_|Ars]) ->
949    get_dm_timers3(Ars);
950get_dm_timers3([]) ->
951    {error, {no_timers, 'ActionRequest'}}.
952
953get_dm_timers4([#'CommandRequest'{command = Cmd}|Cmds]) ->
954    case get_dm_timers5(Cmd) of
955	{ok, Timers} ->
956	    {ok, Timers};
957	_ ->
958	    get_dm_timers4(Cmds)
959    end;
960get_dm_timers4([_|Cmds]) ->
961    get_dm_timers4(Cmds);
962get_dm_timers4([]) ->
963    {error, {no_timers, 'CommandRequest'}}.
964
965
966get_dm_timers5({modReq, #'AmmRequest'{descriptors = Descriptors}}) ->
967    get_dm_timers6(Descriptors);
968get_dm_timers5(R) ->
969    {error, {no_modReq, R}}.
970
971
972get_dm_timers6([{digitMapDescriptor, #'DigitMapDescriptor'{digitMapValue = Val}}|_]) ->
973    case Val of
974	#'DigitMapValue'{startTimer    = T,
975			 shortTimer    = S,
976			 longTimer     = L,
977			 durationTimer = asn1_NOVALUE} ->
978	    {ok, {T, S, L}};
979	#'DigitMapValue'{startTimer    = T,
980			 shortTimer    = S,
981			 longTimer     = L,
982			 durationTimer = Z} ->
983	    {ok, {T, S, L, Z}};
984	_ ->
985	    {error, no_value_in_dm}
986    end;
987get_dm_timers6([_|Descs]) ->
988    get_dm_timers6(Descs);
989get_dm_timers6([]) ->
990    {error, {no_timers, descriptors}}.
991
992
993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
994
995bin_test_msgs(suite) ->
996    [];
997bin_test_msgs(Config) when is_list(Config) ->
998    ?ACQUIRE_NODES(1, Config),
999    Msgs =
1000	msgs1a(binary) ++
1001	msgs5(binary) ++
1002	msgs6(binary) ++
1003	msgs7(binary) ++
1004	msgs8(binary),
1005    %% Msgs = msgs6(binary),
1006    DynamicDecode = false,
1007    test_msgs(megaco_binary_encoder, DynamicDecode, ?EC, Msgs).
1008
1009
1010%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1011
1012ber_test_msgs(suite) ->
1013    [];
1014ber_test_msgs(Config) when is_list(Config) ->
1015    ?ACQUIRE_NODES(1, Config),
1016    Msgs =
1017	msgs1a(binary) ++
1018	msgs5(binary) ++
1019	msgs6(binary) ++
1020	msgs7(binary) ++
1021	msgs8(binary),
1022    %% Msgs = msgs7(binary),
1023    DynamicDecode = false,
1024    test_msgs(megaco_ber_encoder, DynamicDecode, ?EC, Msgs).
1025
1026
1027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1028
1029per_test_msgs(suite) ->
1030    [];
1031per_test_msgs(Config) when is_list(Config) ->
1032    ?ACQUIRE_NODES(1, Config),
1033    Msgs =
1034	msgs1a(binary) ++
1035	msgs5(binary) ++
1036	msgs6(binary) ++
1037	msgs7(binary) ++
1038	msgs8(binary),
1039    DynamicDecode = false,
1040    test_msgs(megaco_per_encoder, DynamicDecode, ?EC, Msgs).
1041
1042
1043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044
1045erl_dist_m_test_msgs(suite) ->
1046    [];
1047erl_dist_m_test_msgs(Config) when is_list(Config) ->
1048    ?ACQUIRE_NODES(1, Config),
1049    Msgs =
1050	msgs1a(erlang) ++
1051	msgs1b(erlang) ++
1052	msgs3525(erlang) ++
1053	msgs5(erlang) ++
1054	msgs6(erlang) ++
1055	msgs7(erlang) ++
1056	msgs8(erlang),
1057    DynamicDecode = false,
1058    Conf = [megaco_compressed],
1059    test_msgs(megaco_erl_dist_encoder, DynamicDecode, Conf, Msgs).
1060
1061
1062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1063
1064%% # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
1065%% Ticket test cases:
1066
1067
1068%% --------------------------------------------------------------
1069%% Observe that this decode SHALL fail
1070compact_otp4011_msg1(suite) ->
1071    [];
1072compact_otp4011_msg1(Config) when is_list(Config) ->
1073    %%     put(severity,trc),
1074    %%     put(dbg,true),
1075    d("compact_otp4011_msg1 -> entry", []),
1076    ?ACQUIRE_NODES(1, Config),
1077    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SR}}}}}",
1078    ok = compact_otp4011(M),
1079    %%     erase(severity),
1080    %%     erase(dbg),
1081    ok.
1082
1083
1084%% --------------------------------------------------------------
1085%% Observe that this decode SHALL fail
1086compact_otp4011_msg2(suite) ->
1087    [];
1088compact_otp4011_msg2(Config) when is_list(Config) ->
1089    %%     put(severity,trc),
1090    %%     put(dbg,true),
1091    d("compact_otp4011_msg2 -> entry", []),
1092    ?ACQUIRE_NODES(1, Config),
1093    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SO,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SR}}}}}",
1094    ok = compact_otp4011(M),
1095    %%     erase(severity),
1096    %%     erase(dbg),
1097    ok.
1098
1099%% --------------------------------------------------------------
1100%% Observe that this decode SHALL fail
1101%%
1102
1103compact_otp4011_msg3(suite) ->
1104    [];
1105compact_otp4011_msg3(Config) when is_list(Config) ->
1106    %%     put(severity,trc),
1107    %%     put(dbg,true),
1108    d("compact_otp4011_msg3 -> entry", []),
1109    ?ACQUIRE_NODES(1, Config),
1110    M = "!/" ?VERSION_STR " ML T=233350{C=${A=stedevice/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=OFF,MO=SO}}}}}",
1111    ok = compact_otp4011(M),
1112    %%     erase(severity),
1113    %%     erase(dbg),
1114    ok.
1115
1116compact_otp4011(Msg) ->
1117    compact_otp4011(Msg, ?EC).
1118
1119compact_otp4011(Msg, Conf) ->
1120    Codec  = megaco_compact_text_encoder,
1121    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1122    Check  = fun(Reason) when is_list(Reason) ->
1123		     compact_otp4011_chk1(Reason);
1124		(Crap) ->
1125		     {error, {unexpected_decode_result, Crap}}
1126	     end,
1127    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).
1128
1129compact_otp4011_chk1(R1) ->
1130    case lists:keysearch(reason, 1, R1) of
1131	{value, {reason, R2}} ->
1132	    compact_otp4011_chk2(R2);
1133	false ->
1134	    {error, {unexpected_result, R1}}
1135    end.
1136
1137compact_otp4011_chk2({0, ParserMod, {ParserFunc, [A, B]}})
1138  when (ParserMod  =:= megaco_text_parser_v3) andalso
1139       (ParserFunc =:= do_merge_control_streamParms) andalso
1140       is_list(A) andalso
1141       is_record(B, 'LocalControlDescriptor') ->
1142    SM = B#'LocalControlDescriptor'.streamMode,
1143    case lists:keysearch(mode, 1, A) of
1144	{value, {mode, _Mode}} when SM /= asn1_NOVALUE ->
1145	    ok;
1146	{value, {mode, _Mode}} ->
1147	    {error, {unexpected_streamMode_reason, {A, B}}};
1148	false ->
1149	    {error, {unexpected_mode_reason, {A, B}}}
1150    end;
1151compact_otp4011_chk2(Bad) ->
1152    {error, {unexpected_reason, Bad}}.
1153
1154
1155%% --------------------------------------------------------------
1156%% Note that this decode SHALL fail, because of the misspelled
1157%% MEGCAO instead of the correct MEGACO.
1158compact_otp4013_msg1(suite) ->
1159    [];
1160compact_otp4013_msg1(Config) when is_list(Config) ->
1161    %%     put(severity,trc),
1162    %%     put(dbg,true),
1163    d("compact_otp4013_msg1 -> entry", []),
1164    ?ACQUIRE_NODES(1, Config),
1165    M = "MEGCAO/3 MG1 T=12345678{C=-{SC=root{SV{MT=RS,RE=901}}}}",
1166    ok = compact_otp4013(M),
1167    %%     erase(severity),
1168    %%     erase(dbg),
1169    ok.
1170
1171compact_otp4013(Msg) ->
1172    compact_otp4013(Msg, ?EC).
1173
1174compact_otp4013(Msg, Conf) ->
1175    Codec  = megaco_compact_text_encoder,
1176    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1177    Check  = fun(Reason) when is_list(Reason) ->
1178		     compact_otp4013_chk1(Reason);
1179		(Crap) ->
1180		     {error, {unexpected_decode_result, Crap}}
1181	     end,
1182    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).
1183
1184compact_otp4013_chk1(Reason) ->
1185    case lists:keysearch(reason, 1, Reason) of
1186	{value, {reason, no_version_found, _}} ->
1187	    case lists:keysearch(token, 1, Reason) of
1188		{value, {token, [{'SafeChars',_,"megcao/3"}|_]}} ->
1189		    ok;
1190		{value, {token, Tokens}} ->
1191		    {error, {unexpected_tokens, Tokens}};
1192		false ->
1193		    {error, {tokens_not_found, Reason}}
1194	    end;
1195	{value, {reason, BadReason, _}} ->
1196	    {error, {unexpected_reason, BadReason}};
1197	false ->
1198	    {error, {reason_not_found, Reason}}
1199    end.
1200
1201
1202%% --------------------------------------------------------------
1203%%
1204%%
1205compact_otp4085_msg1(suite) ->
1206    [];
1207compact_otp4085_msg1(Config) when is_list(Config) ->
1208    %% put(severity,trc),
1209    %% put(dbg,true),
1210    d("compact_otp4085_msg1 -> entry", []),
1211    ?ACQUIRE_NODES(1, Config),
1212    M = compact_otp4085_erroneous_msg(),
1213    ok = compact_otp4085_1(M),
1214    %% erase(severity),
1215    %% erase(dbg),
1216    ok.
1217
1218compact_otp4085_1(Msg) ->
1219    compact_otp4085_1(Msg, ?EC).
1220
1221compact_otp4085_1(Msg, Conf) ->
1222    Codec  = megaco_compact_text_encoder,
1223    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1224    Check  = fun(Reason) when is_list(Reason) ->
1225		     compact_otp4085_1_chk1(Reason);
1226		(Crap) ->
1227		     {error, {unexpected_decode_result, Crap}}
1228	     end,
1229    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).
1230
1231compact_otp4085_1_chk1(Reason) ->
1232    case lists:keysearch(reason, 1, Reason) of
1233	{value, {reason, {Line, Module, Crap}}} when is_integer(Line) and
1234						     is_atom(Module) ->
1235	    Crap2 =
1236		case (catch lists:flatten(Crap)) of
1237		    L when is_list(L) ->
1238			L;
1239		    _ ->
1240			Crap
1241		end,
1242	    t("compact_otp4085_1_chk1 -> Expected: "
1243	      "~n   Line:   ~p"
1244	      "~n   Module: ~p"
1245	      "~n   Crap2:  ~p", [Line, Module, Crap2]),
1246	    ok;
1247	{value, BadReason} ->
1248	    e("compact_otp4085_1_chk1 -> error: "
1249	      "~n   BadReason:   ~p", [BadReason]),
1250	    {error, {unexpected_reason, Reason}};
1251	false ->
1252	    {error, {reason_not_found, Reason}}
1253    end.
1254
1255
1256%% --------------------------------------------------------------
1257%% This test case is just to show that the message used in
1258%% compact_otp4085_msg1 is actually ok when you add '}' at the end.
1259compact_otp4085_msg2(suite) ->
1260    [];
1261compact_otp4085_msg2(Config) when is_list(Config) ->
1262    %% put(severity,trc),
1263    %% put(dbg,true),
1264    d("compact_otp4085_msg1 -> entry", []),
1265    ?ACQUIRE_NODES(1, Config),
1266    M = compact_otp4085_erroneous_msg() ++ "}",
1267    ok = compact_otp4085_2(M),
1268    %% erase(severity),
1269    %% erase(dbg),
1270    ok.
1271
1272compact_otp4085_2(Msg) ->
1273    compact_otp4085_2(Msg, ?EC).
1274
1275compact_otp4085_2(Msg, Conf) ->
1276    Codec  = megaco_compact_text_encoder,
1277    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1278    Check  = fun(M) when is_record(M, 'MegacoMessage') ->
1279		     ok;
1280		(Crap) ->
1281		     {error, {unexpected_decode_result, Crap}}
1282	     end,
1283    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).
1284
1285
1286%% This message lack the ending parentesis (}).
1287compact_otp4085_erroneous_msg() ->
1288    M = "!/"
1289	?VERSION_STR
1290	" ML T=11223342{C=${A=${M{O{MO=SR,RV=OFF,RG=OFF},L{v=0,"
1291	"c=ATM NSAP $ ,"
1292	"a=eecid:$ ,"
1293	"m=audio - AAL1/ATMF -,"
1294	"}}},A=stee1181/01{M{O{MO=SR,RV=OFF,RG=OFF,tdmc/ec=off}}}}",
1295    M.
1296
1297%% --------------------------------------------------------------
1298%%
1299%%
1300compact_otp4280_msg1(suite) ->
1301    [];
1302compact_otp4280_msg1(Config) when is_list(Config) ->
1303    %% put(severity,trc),
1304    %% put(dbg,true),
1305    d("compact_otp4280_msg1 -> entry", []),
1306    ?ACQUIRE_NODES(1, Config),
1307    M = compact_otp4280_msg(),
1308    ok = compact_otp4280(M),
1309    %% erase(severity),
1310    %% erase(dbg),
1311    ok.
1312
1313compact_otp4280(Msg) ->
1314    compact_otp4280(Msg, ?EC).
1315
1316compact_otp4280(Msg, Conf) ->
1317    Codec  = megaco_compact_text_encoder,
1318    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1319    Check  = fun(M) when is_record(M, 'MegacoMessage') ->
1320		     ok;
1321		(Crap) ->
1322		     {error, {unexpected_decode_result, Crap}}
1323	     end,
1324    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).
1325
1326compact_otp4280_msg() ->
1327    M = "!/"
1328	?VERSION_STR
1329	" mgw1 P=71853646{C=-{AV=root{M{TS{root/maxnumberofcontexts=49500,"
1330	"root/maxterminationspercontext=2,root/normalmgexecutiontime=200,"
1331	"root/normalmgcexecutiontime=150,"
1332	"root/provisionalresponsetimervalue=2000,BF=OFF,SI=IV}}}}}",
1333    M.
1334
1335
1336%% --------------------------------------------------------------
1337%% This ticket is about comments in a message
1338%%
1339compact_otp4299_msg1(suite) ->
1340    [];
1341compact_otp4299_msg1(Config) when is_list(Config) ->
1342    %% put(severity,trc),
1343    %% put(dbg,true),
1344    d("compact_otp4299_msg1 -> entry", []),
1345    ?ACQUIRE_NODES(1, Config),
1346    Msg = compact_otp4299_msg(),
1347    ok = compact_otp4299(Msg),
1348    %% erase(severity),
1349    %% erase(dbg),
1350    ok.
1351
1352compact_otp4299(Msg) ->
1353    compact_otp4299(Msg, ?EC).
1354
1355compact_otp4299(Msg, Conf) ->
1356    Codec  = megaco_compact_text_encoder,
1357    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1358    Check  = fun(M) when is_record(M, 'MegacoMessage') ->
1359		     ok;
1360		(Crap) ->
1361		     {error, {unexpected_decode_result, Crap}}
1362	     end,
1363    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).
1364
1365compact_otp4299_msg() ->
1366    M = ";KALLE\n"
1367	"!/"
1368	?VERSION_STR
1369	" mg58_1 P=005197711{; YET ANOTHER COMMENT\n"
1370	"C=035146207{A=mg58_1_1_4_1_23/19; BEFORE COMMA\n"
1371	",; AFTER COMMA\n"
1372	"A=eph58_1/0xA4023371{M{L{\n"
1373	"v=0\n"
1374	"c=ATM NSAP 39.0102.0304.0506.0708.090a.0b58.0100.0000.0000.00\n"
1375	"m=audio - AAL1/ATMF -\n"
1376	"a=eecid:A4023371\n"
1377	"}}; HOBBE\n}; KALLE \"HOBBE \n}}"
1378	";KALLE\n\n",
1379    M.
1380
1381
1382%% --------------------------------------------------------------
1383%%
1384
1385compact_otp4359_msg1(suite) ->
1386    [];
1387compact_otp4359_msg1(Config) when is_list(Config) ->
1388    %% put(severity,trc),
1389    %% put(dbg,true),
1390    d("compact_otp4359_msg1 -> entry", []),
1391    ?ACQUIRE_NODES(1, Config),
1392    Msg = compact_otp4359_msg(),
1393    ok = compact_otp4359(Msg),
1394    %% erase(severity),
1395    %% erase(dbg),
1396    ok.
1397
1398compact_otp4359_msg() ->
1399    M = "!/" ?VERSION_STR " ml2 T={C=${A=${M{O {MO=SR,RG=OFF,RV=OFF}}}}}",
1400    M.
1401
1402compact_otp4359(Msg) ->
1403    compact_otp4359(Msg, ?EC).
1404
1405compact_otp4359(Msg, Conf) ->
1406    Codec  = megaco_compact_text_encoder,
1407    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1408    Check  = fun(M) when is_record(M, 'MegacoMessage') ->
1409		     compact_otp4359_chk(M);
1410		(Crap) ->
1411		     {error, {unexpected_decode_result, Crap}}
1412	     end,
1413    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).
1414
1415compact_otp4359_chk(#'MegacoMessage'{mess = Mess}) ->
1416    case Mess#'Message'.messageBody of
1417	{transactions, Trans} ->
1418	    case Trans of
1419		[{transactionRequest, TR}] ->
1420		    case TR of
1421			#'TransactionRequest'{transactionId = asn1_NOVALUE} ->
1422			    ok;
1423			_ ->
1424			    {error, {unexpected_trans_req, TR}}
1425		    end;
1426		_ ->
1427		    {error, {unexpected_trans, Trans}}
1428	    end;
1429	Body ->
1430	    {error, {unexpected_messageBody, Body}}
1431    end.
1432
1433
1434%% --------------------------------------------------------------
1435%%
1436compact_otp4920_msg0(suite) ->
1437    [];
1438compact_otp4920_msg0(Config) when is_list(Config) ->
1439    %% put(severity,trc),
1440    %% put(dbg,true),
1441    d("compact_otp4920_msg0 -> entry", []),
1442    ?ACQUIRE_NODES(1, Config),
1443    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg0() ),
1444    %% erase(severity),
1445    %% erase(dbg),
1446    ok.
1447
1448compact_otp4920_msg1(suite) ->
1449    [];
1450compact_otp4920_msg1(Config) when is_list(Config) ->
1451    %% put(severity,trc),
1452    %% put(dbg,true),
1453    d("compact_otp4920_msg1 -> entry", []),
1454    ?ACQUIRE_NODES(1, Config),
1455    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg1() ),
1456    %% erase(severity),
1457    %% erase(dbg),
1458    ok.
1459
1460compact_otp4920_msg2(suite) ->
1461    [];
1462compact_otp4920_msg2(Config) when is_list(Config) ->
1463    %% put(severity,trc),
1464    %% put(dbg,true),
1465    d("compact_otp4920_msg2 -> entry", []),
1466    ?ACQUIRE_NODES(1, Config),
1467    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg2() ),
1468    %% erase(severity),
1469    %% erase(dbg),
1470    ok.
1471
1472compact_otp4920_msg3(suite) ->
1473    [];
1474compact_otp4920_msg3(Config) when is_list(Config) ->
1475    %% put(severity,trc),
1476    %% put(dbg,true),
1477    d("compact_otp4920_msg3 -> entry", []),
1478    ?ACQUIRE_NODES(1, Config),
1479    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg3() ),
1480    %% erase(severity),
1481    %% erase(dbg),
1482    ok.
1483
1484compact_otp4920_msg4(suite) ->
1485    [];
1486compact_otp4920_msg4(Config) when is_list(Config) ->
1487    %% put(severity,trc),
1488    %% put(dbg,true),
1489    d("compact_otp4920_msg4 -> entry", []),
1490    ?ACQUIRE_NODES(1, Config),
1491    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg4() ),
1492    %% erase(severity),
1493    %% erase(dbg),
1494    ok.
1495
1496compact_otp4920_msg5(suite) ->
1497    [];
1498compact_otp4920_msg5(Config) when is_list(Config) ->
1499    %% put(severity,trc),
1500    %% put(dbg,true),
1501    d("compact_otp4920_msg5 -> entry", []),
1502    ?ACQUIRE_NODES(1, Config),
1503    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg5() ),
1504    %% erase(severity),
1505    %% erase(dbg),
1506    ok.
1507
1508compact_otp4920_msg6(suite) ->
1509    [];
1510compact_otp4920_msg6(Config) when is_list(Config) ->
1511    %% put(severity,trc),
1512    %% put(dbg,true),
1513    d("compact_otp4920_msg6 -> entry", []),
1514    ?ACQUIRE_NODES(1, Config),
1515    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg6() ),
1516    %% erase(severity),
1517    %% erase(dbg),
1518    ok.
1519
1520compact_otp4920_msg7(suite) ->
1521    [];
1522compact_otp4920_msg7(Config) when is_list(Config) ->
1523    %% put(severity,trc),
1524    %% put(dbg,true),
1525    d("compact_otp4920_msg7 -> entry", []),
1526    ?ACQUIRE_NODES(1, Config),
1527    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg7() ),
1528    %% erase(severity),
1529    %% erase(dbg),
1530    ok.
1531
1532compact_otp4920_msg8(suite) ->
1533    [];
1534compact_otp4920_msg8(Config) when is_list(Config) ->
1535    %% put(severity,trc),
1536    %% put(dbg,true),
1537    d("compact_otp4920_msg8 -> entry", []),
1538    ?ACQUIRE_NODES(1, Config),
1539    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg8() ),
1540    %% erase(severity),
1541    %% erase(dbg),
1542    ok.
1543
1544compact_otp4920_msg9(suite) ->
1545    [];
1546compact_otp4920_msg9(Config) when is_list(Config) ->
1547    %% put(severity,trc),
1548    %% put(dbg,true),
1549    d("compact_otp4920_msg9 -> entry", []),
1550    ?ACQUIRE_NODES(1, Config),
1551    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg9() ),
1552    %% erase(severity),
1553    %% erase(dbg),
1554    ok.
1555
1556compact_otp4920_msg10(suite) ->
1557    [];
1558compact_otp4920_msg10(Config) when is_list(Config) ->
1559    %% put(severity,trc),
1560    %% put(dbg,true),
1561    d("compact_otp4920_msg10 -> entry", []),
1562    ?ACQUIRE_NODES(1, Config),
1563    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg10() ),
1564    %% erase(severity),
1565    %% erase(dbg),
1566    ok.
1567
1568compact_otp4920_msg11(suite) ->
1569    [];
1570compact_otp4920_msg11(Config) when is_list(Config) ->
1571    %% put(severity,trc),
1572    %% put(dbg,true),
1573    d("compact_otp4920_msg11 -> entry", []),
1574    ?ACQUIRE_NODES(1, Config),
1575    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg11() ),
1576    %% erase(severity),
1577    %% erase(dbg),
1578    ok.
1579
1580compact_otp4920_msg12(suite) ->
1581    [];
1582compact_otp4920_msg12(Config) when is_list(Config) ->
1583    %% put(severity,trc),
1584    %% put(dbg,true),
1585    d("compact_otp4920_msg12 -> entry", []),
1586    ?ACQUIRE_NODES(1, Config),
1587    ok = ticket_compact_decode_encode_ok( compact_otp4920_msg12() ),
1588    %% erase(severity),
1589    %% erase(dbg),
1590    ok.
1591
1592%% Duplicate padding
1593compact_otp4920_msg20(suite) ->
1594    [];
1595compact_otp4920_msg20(Config) when is_list(Config) ->
1596    %% put(severity,trc),
1597    %% put(dbg,true),
1598    d("compact_otp4920_msg20 -> entry", []),
1599    ?ACQUIRE_NODES(1, Config),
1600    ok = compact_otp4920(compact_otp4920_msg20(), bad_mid_duplicate_padding),
1601    %% erase(severity),
1602    %% erase(dbg),
1603    ok.
1604
1605%% Length
1606compact_otp4920_msg21(suite) ->
1607    [];
1608compact_otp4920_msg21(Config) when is_list(Config) ->
1609    %% put(severity,trc),
1610    %% put(dbg,true),
1611    d("compact_otp4920_msg21 -> entry", []),
1612    ?ACQUIRE_NODES(1, Config),
1613    ok = compact_otp4920(compact_otp4920_msg21(), bad_mid_ip6addr_length),
1614    %% erase(severity),
1615    %% erase(dbg),
1616    ok.
1617
1618%% Length
1619compact_otp4920_msg22(suite) ->
1620    [];
1621compact_otp4920_msg22(Config) when is_list(Config) ->
1622    %% put(severity,trc),
1623    %% put(dbg,true),
1624    d("compact_otp4920_msg22 -> entry", []),
1625    ?ACQUIRE_NODES(1, Config),
1626    ok = compact_otp4920(compact_otp4920_msg22(), bad_mid_ip6addr_length),
1627    %% erase(severity),
1628    %% erase(dbg),
1629    ok.
1630
1631%% Length
1632compact_otp4920_msg23(suite) ->
1633    [];
1634compact_otp4920_msg23(Config) when is_list(Config) ->
1635    %% put(severity,trc),
1636    %% put(dbg,true),
1637    d("compact_otp4920_msg23 -> entry", []),
1638    ?ACQUIRE_NODES(1, Config),
1639    ok = compact_otp4920(compact_otp4920_msg23(), bad_mid_ip6addr_length),
1640    %% erase(severity),
1641    %% erase(dbg),
1642    ok.
1643
1644%% Length
1645compact_otp4920_msg24(suite) ->
1646    [];
1647compact_otp4920_msg24(Config) when is_list(Config) ->
1648    %% put(severity,trc),
1649    %% put(dbg,true),
1650    d("compact_otp4920_msg24 -> entry", []),
1651    ?ACQUIRE_NODES(1, Config),
1652    ok = compact_otp4920(compact_otp4920_msg24(), bad_mid_ip6addr_length),
1653    %% erase(severity),
1654    %% erase(dbg),
1655    ok.
1656
1657%% Length
1658compact_otp4920_msg25(suite) ->
1659    [];
1660compact_otp4920_msg25(Config) when is_list(Config) ->
1661    %% put(severity,trc),
1662    %% put(dbg,true),
1663    d("compact_otp4920_msg25 -> entry", []),
1664    ?ACQUIRE_NODES(1, Config),
1665    ok = compact_otp4920(compact_otp4920_msg25(), bad_mid_ip6addr_length),
1666    %% erase(severity),
1667    %% erase(dbg),
1668    ok.
1669
1670
1671compact_otp4920(Msg, ExpectedReason) ->
1672    compact_otp4920(Msg, ?EC, ExpectedReason).
1673
1674compact_otp4920(Msg, Conf, ExpectedReason) ->
1675    Codec  = megaco_compact_text_encoder,
1676    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
1677    Check  = fun(Reason) when is_list(Reason) ->
1678		     compact_otp4920_chk(Reason, ExpectedReason);
1679		(Crap) ->
1680		     {error, {unexpected_decode_result, Crap}}
1681	     end,
1682    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).
1683
1684compact_otp4920_chk(Reason, ExpectedReason) ->
1685    case lists:keysearch(reason, 1, Reason) of
1686	{value, {reason, {__Line, _Mod, ActualReason}}} ->
1687	    case element(1, ActualReason) of
1688		ExpectedReason ->
1689		    ok;
1690		_ ->
1691		    {error, {unexpected_decode_reason,
1692			     {ActualReason, ExpectedReason}}}
1693	    end;
1694	{value, {reason, {_Mod, ActualReason}}} ->
1695	    case element(1, ActualReason) of
1696		ExpectedReason ->
1697		    ok;
1698		_ ->
1699		    {error, {unexpected_decode_reason,
1700			     {ActualReason, ExpectedReason}}}
1701	    end;
1702	{value, UnknownReason} ->
1703	    {error, {unexpected_decode_reason, UnknownReason}};
1704	false ->
1705	    {error, {reason_not_found, Reason}}
1706    end.
1707
1708compact_otp4920_msg0() ->
1709    M = "!/" ?VERSION_STR " [192.168.30.1]\nT=100{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1710    M.
1711
1712compact_otp4920_msg1() ->
1713    M = "!/" ?VERSION_STR " [2031:0000:130F:0000:0000:09C0:876A:130B]\nT=101{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1714    M.
1715
1716compact_otp4920_msg2() ->
1717    M = "!/" ?VERSION_STR " [2031:0:130F:0:0:9C0:876A:130B]\nT=102{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1718    M.
1719
1720compact_otp4920_msg3() ->
1721    M = "!/" ?VERSION_STR " [2031:0:130F::9C0:876A:130B]\nT=103{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1722    M.
1723
1724compact_otp4920_msg4() ->
1725    M = "!/" ?VERSION_STR " [::1]\nT=104{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1726    M.
1727
1728compact_otp4920_msg5() ->
1729    M = "!/" ?VERSION_STR " [::]\nT=105{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1730    M.
1731
1732compact_otp4920_msg6() ->
1733    M = "!/" ?VERSION_STR " [1::]\nT=106{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1734    M.
1735
1736compact_otp4920_msg7() ->
1737    M = "!/" ?VERSION_STR " [FEDC:1::]\nT=107{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1738    M.
1739
1740compact_otp4920_msg8() ->
1741    M = "!/" ?VERSION_STR " [2031:0:130F:0:0:9C0:135.106.19.11]\nT=108{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1742    M.
1743
1744compact_otp4920_msg9() ->
1745    M = "!/" ?VERSION_STR " [2031:0:130F::9C0:135.106.19.11]\nT=109{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1746    M.
1747
1748compact_otp4920_msg10() ->
1749    M = "!/" ?VERSION_STR " [::FFFF:192.168.30.1]\nT=110{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1750    M.
1751
1752compact_otp4920_msg11() ->
1753    M = "!/" ?VERSION_STR " [::192.168.30.1]\nT=111{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1754    M.
1755
1756compact_otp4920_msg12() ->
1757    M = "!/" ?VERSION_STR " [::C0A8:1E01]\nT=112{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1758    M.
1759
1760%% Illegal: only one :: allowed
1761compact_otp4920_msg20() ->
1762    M = "!/" ?VERSION_STR " [2031::130F::9C0]\nT=120{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1763    M.
1764
1765%% Illegal: length
1766compact_otp4920_msg21() ->
1767    M = "!/" ?VERSION_STR " [2031:FFEE:0000:130F:0000:0000:09C0:876A:130B]\nT=121{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1768    M.
1769
1770%% Illegal: length
1771compact_otp4920_msg22() ->
1772    M = "!/" ?VERSION_STR " [2031:FFEE:0:130F:0:0:9C0:135.106.19.11]\nT=122{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1773    M.
1774
1775%% Illegal: length
1776compact_otp4920_msg23() ->
1777    M = "!/" ?VERSION_STR " [2031:FFEE:0000:130F:2132:4354::09C0:876A:130B]\nT=123{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1778    M.
1779
1780%% Illegal: length
1781compact_otp4920_msg24() ->
1782    M = "!/" ?VERSION_STR " [::2031:FFEE:0000:130F:2132:4354:09C0:876A:130B]\nT=124{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1783    M.
1784
1785%% Illegal: length
1786compact_otp4920_msg25() ->
1787    M = "!/" ?VERSION_STR " [2031:FFEE:0000:130F:2132:4354:09C0:876A:130B::]\nT=125{C=${A=${M{O{MO=SR,RG=OFF,RV=OFF}}}}}",
1788    M.
1789
1790
1791%% --------------------------------------------------------------
1792%%
1793
1794compact_otp5186_msg01(suite) ->
1795    [];
1796compact_otp5186_msg01(Config) when is_list(Config) ->
1797    %% put(severity,trc),
1798    %% put(dbg,true),
1799    d("compact_otp5186_msg01 -> entry", []),
1800    ?ACQUIRE_NODES(1, Config),
1801    ok = ticket_compact_decode_error( compact_otp5186_msg01() ),
1802    %% erase(severity),
1803    %% erase(dbg),
1804    ok.
1805
1806compact_otp5186_msg02(suite) ->
1807    [];
1808compact_otp5186_msg02(Config) when is_list(Config) ->
1809    %% put(severity,trc),
1810    %% put(dbg,true),
1811    d("compact_otp5186_msg02 -> entry", []),
1812    ?ACQUIRE_NODES(1, Config),
1813    ok = ticket_compact_decode_encode_ok( compact_otp5186_msg02() ),
1814    %% erase(severity),
1815    %% erase(dbg),
1816    ok.
1817
1818compact_otp5186_msg03(suite) ->
1819    [];
1820compact_otp5186_msg03(Config) when is_list(Config) ->
1821    %% put(severity,trc),
1822    %% put(dbg,true),
1823    d("compact_otp5186_msg03 -> entry", []),
1824    ?ACQUIRE_NODES(1, Config),
1825    %% ok = compact_otp5186_msg_2(compact_otp5186_msg03(), ok, ok),
1826    ok = ticket_compact_encode_decode_ok( compact_otp5186_msg03() ),
1827    %% erase(severity),
1828    %% erase(dbg),
1829    ok.
1830
1831compact_otp5186_msg04(suite) ->
1832    [];
1833compact_otp5186_msg04(Config) when is_list(Config) ->
1834    %% put(severity,trc),
1835    %% put(dbg,true),
1836    d("compact_otp5186_msg04 -> entry", []),
1837    ?ACQUIRE_NODES(1, Config),
1838    %% ok = compact_otp5186_msg_2(compact_otp5186_msg04(), ok, ok),
1839    ok = ticket_compact_encode_decode_ok( compact_otp5186_msg04() ),
1840    %% erase(severity),
1841    %% erase(dbg),
1842    ok.
1843
1844compact_otp5186_msg05(suite) ->
1845    [];
1846compact_otp5186_msg05(Config) when is_list(Config) ->
1847    %% put(severity,trc),
1848    %% put(dbg,true),
1849    d("compact_otp5186_msg05 -> entry", []),
1850    ?ACQUIRE_NODES(1, Config),
1851    %% ok = compact_otp5186_msg_2(compact_otp5186_msg05(), ok, ok),
1852    ok = ticket_compact_encode_decode_ok( compact_otp5186_msg05() ),
1853    %% erase(severity),
1854    %% erase(dbg),
1855    ok.
1856
1857compact_otp5186_msg06(suite) ->
1858    [];
1859compact_otp5186_msg06(Config) when is_list(Config) ->
1860    %% put(severity,trc),
1861    %% put(dbg,true),
1862    d("compact_otp5186_msg06 -> entry", []),
1863    ?ACQUIRE_NODES(1, Config),
1864    %% ok = compact_otp5186_msg_2(compact_otp5186_msg06(), ok, ok),
1865    ok = ticket_compact_encode_decode_ok( compact_otp5186_msg06() ),
1866    %% erase(severity),
1867    %% erase(dbg),
1868    ok.
1869
1870%% --
1871
1872compact_otp5186_msg01() ->
1873    "!/" ?VERSION_STR " <mg5>\nP=67111298{C=2699{AV=mg5_ipeph/0x0f0001{}}}".
1874
1875compact_otp5186_msg02() ->
1876    "!/" ?VERSION_STR " <mg5>\nP=67111298{C=2699{AV=mg5_ipeph/0x0f0001}}".
1877
1878compact_otp5186_msg03() ->
1879    {'MegacoMessage',
1880     asn1_NOVALUE,
1881     {'Message',
1882      ?VERSION,
1883      {domainName,{'DomainName',"mg5",asn1_NOVALUE}},
1884      {transactions,
1885       [{transactionReply,
1886	 {'TransactionReply',67111298,asn1_NOVALUE,
1887	  {actionReplies,[
1888			  {'ActionReply',2699,asn1_NOVALUE,asn1_NOVALUE,
1889			   [
1890			    {auditValueReply,
1891			     {auditResult,
1892			      {'AuditResult',
1893			       {megaco_term_id,false,["mg5_ipeph","0x0f0001"]},
1894			       [
1895			       ]
1896			      }
1897			     }
1898			    }
1899			   ]
1900			  }
1901			 ]
1902	  },asn1_NOVALUE,asn1_NOVALUE
1903	 }
1904	}
1905       ]
1906      }
1907     }
1908    }.
1909
1910compact_otp5186_msg04() ->
1911    {'MegacoMessage',asn1_NOVALUE,
1912     {'Message',?VERSION,{domainName,{'DomainName',"mg5",asn1_NOVALUE}},
1913      {transactions,
1914       [{transactionReply,
1915	 {'TransactionReply',67111298,asn1_NOVALUE,
1916	  {actionReplies,[
1917			  {'ActionReply',2699,asn1_NOVALUE,asn1_NOVALUE,
1918			   [
1919			    {auditValueReply,
1920			     {auditResult,
1921			      {'AuditResult',
1922			       {megaco_term_id,false,["mg5_ipeph","0x0f0001"]},
1923			       [
1924				{emptyDescriptors,
1925				 {'AuditDescriptor',asn1_NOVALUE,asn1_NOVALUE}
1926				}
1927			       ]
1928			      }
1929			     }
1930			    }
1931			   ]
1932			  }
1933			 ]
1934	  },asn1_NOVALUE,asn1_NOVALUE
1935	 }
1936	}
1937       ]
1938      }
1939     }
1940    }.
1941
1942compact_otp5186_msg05() ->
1943    {'MegacoMessage',
1944     asn1_NOVALUE,
1945     {'Message',
1946      ?VERSION,
1947      {domainName,{'DomainName',"mg5",asn1_NOVALUE}},
1948      {transactions,
1949       [{transactionReply,
1950	 {'TransactionReply',67111298,asn1_NOVALUE,
1951	  {actionReplies,[
1952			  {'ActionReply',2699,asn1_NOVALUE,asn1_NOVALUE,
1953			   [
1954			    {addReply,
1955			     {'AmmsReply',
1956			      [
1957			       {megaco_term_id,false,["mg5_ipeph","0x0f0001"]}
1958			      ],
1959			      [
1960			      ]
1961			     }
1962			    }
1963			   ]
1964			  }
1965			 ]
1966	  },asn1_NOVALUE,asn1_NOVALUE
1967	 }
1968	}
1969       ]
1970      }
1971     }
1972    }.
1973
1974compact_otp5186_msg06() ->
1975    {'MegacoMessage',asn1_NOVALUE,
1976     {'Message',?VERSION,{domainName,{'DomainName',"mg5",asn1_NOVALUE}},
1977      {transactions,
1978       [{transactionReply,
1979	 {'TransactionReply',67111298,asn1_NOVALUE,
1980	  {actionReplies,[
1981			  {'ActionReply',2699,asn1_NOVALUE,asn1_NOVALUE,
1982			   [
1983			    {addReply,
1984			     {'AmmsReply',
1985			      [
1986			       {megaco_term_id,false,["mg5_ipeph","0x0f0001"]}
1987			      ],
1988			      [
1989			       {emptyDescriptors,
1990				{'AuditDescriptor',asn1_NOVALUE,asn1_NOVALUE}
1991			       }
1992			      ]
1993			     }
1994			    }
1995			   ]
1996			  }
1997			 ]
1998	  },asn1_NOVALUE,asn1_NOVALUE
1999	 }
2000	}
2001       ]
2002      }
2003     }
2004    }.
2005
2006
2007%% --------------------------------------------------------------
2008
2009compact_otp5793_msg01(suite) ->
2010    [];
2011compact_otp5793_msg01(Config) when is_list(Config) ->
2012    %%     put(severity,trc),
2013    %%     put(dbg,true),
2014    d("compact_otp5793_msg01 -> entry", []),
2015    ?ACQUIRE_NODES(1, Config),
2016    ok = ticket_compact_encode_decode_ok(pretty_otp5793_msg1()),
2017    %% erase(severity),
2018    %% erase(dbg),
2019    ok.
2020
2021
2022%% --------------------------------------------------------------
2023
2024compact_otp5836_msg01(suite) ->
2025    [];
2026compact_otp5836_msg01(Config) when is_list(Config) ->
2027    %%     put(severity,trc),
2028    %%     put(dbg,true),
2029    d("compact_otp5836_msg01 -> entry", []),
2030    ?ACQUIRE_NODES(1, Config),
2031    ok = ticket_compact_encode_decode_ok(compact_otp5836_msg1()),
2032    %% erase(severity),
2033    %% erase(dbg),
2034    ok.
2035
2036
2037compact_otp5836_msg1() ->
2038    {'MegacoMessage',
2039     asn1_NOVALUE,
2040     {'Message',
2041      ?VERSION,
2042      {deviceName,"bs_sbg_4/34"},
2043      {transactions,
2044       [{transactionReply,
2045	 {'TransactionReply',
2046	  12,
2047	  asn1_NOVALUE,
2048	  {actionReplies,
2049	   [{'ActionReply',
2050	     4294967295,
2051	     asn1_NOVALUE,
2052	     asn1_NOVALUE,
2053	     [{auditValueReply,
2054	       {error, {'ErrorDescriptor', 431, asn1_NOVALUE}}}
2055	     ]
2056	    }
2057	   ]
2058	  },asn1_NOVALUE,asn1_NOVALUE
2059	 }
2060	}
2061       ]
2062      }
2063     }
2064    }.
2065
2066
2067%% --------------------------------------------------------------
2068
2069compact_otp5993_msg01(suite) ->
2070    [];
2071compact_otp5993_msg01(Config) when is_list(Config) ->
2072    %% put(severity,trc),
2073    %% put(dbg,true),
2074    d("compact_otp5993_msg01 -> entry", []),
2075    ?ACQUIRE_NODES(1, Config),
2076    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg01() ),
2077    %% erase(severity),
2078    %% erase(dbg),
2079    ok.
2080
2081compact_otp5993_msg01() ->
2082    MT = h221,
2083    T  = #megaco_term_id{id = ?A4444},
2084    TL = [T],
2085    MD = #'MuxDescriptor'{muxType  = MT,
2086                          termList = TL},
2087    compact_otp5993_msg(MD).
2088
2089
2090compact_otp5993_msg02(suite) ->
2091    [];
2092compact_otp5993_msg02(Config) when is_list(Config) ->
2093    %% put(severity,trc),
2094    %% put(dbg,true),
2095    d("compact_otp5993_msg02 -> entry", []),
2096    ?ACQUIRE_NODES(1, Config),
2097    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg02() ),
2098    %% erase(severity),
2099    %% erase(dbg),
2100    ok.
2101
2102compact_otp5993_msg02() ->
2103    MT = h223,
2104    T1 = #megaco_term_id{id = ?A4445},
2105    T2 = #megaco_term_id{id = ?A5556},
2106    TL = [T1, T2],
2107    MD = #'MuxDescriptor'{muxType  = MT,
2108                          termList = TL},
2109    compact_otp5993_msg(MD).
2110
2111
2112compact_otp5993_msg03(suite) ->
2113    [];
2114compact_otp5993_msg03(Config) when is_list(Config) ->
2115    %% put(severity,trc),
2116    %% put(dbg,true),
2117    d("compact_otp5993_msg03 -> entry", []),
2118    ?ACQUIRE_NODES(1, Config),
2119    ok = ticket_compact_encode_decode_ok( compact_otp5993_msg03() ),
2120    %% erase(severity),
2121    %% erase(dbg),
2122    ok.
2123
2124compact_otp5993_msg03() ->
2125    T1       = #megaco_term_id{id = ?A4445},
2126    T2       = #megaco_term_id{id = ?A5556},
2127    TIDs     = [T1, T2],
2128    AudRep   = {contextAuditResult, TIDs},
2129    CmdRep   = {auditValueReply, AudRep},
2130    ActRep   = #'ActionReply'{contextId    = 5993,
2131                              commandReply = [CmdRep]},
2132    TransRes = {actionReplies, [ActRep]},
2133    TransRep = #'TransactionReply'{transactionId     = 3995,
2134                                   transactionResult = TransRes},
2135    Trans    = {transactionReply, TransRep},
2136    Body     = {transactions, [Trans]},
2137    Msg      = #'Message'{version     = ?VERSION,
2138                          mId         = ?MG1_MID,
2139                          messageBody = Body},
2140    #'MegacoMessage'{mess = Msg}.
2141
2142
2143compact_otp5993_msg(MD) when is_record(MD, 'MuxDescriptor') ->
2144    AmmDesc  = {muxDescriptor, MD},
2145    AmmReq   = #'AmmRequest'{terminationID = [hd(MD#'MuxDescriptor'.termList)],
2146                             descriptors   = [AmmDesc]},
2147    Cmd      = {addReq, AmmReq},
2148    CmdReq   = #'CommandRequest'{command = Cmd},
2149    ActReq   = #'ActionRequest'{contextId       = 5993,
2150                                commandRequests = [CmdReq]},
2151    TransReq = #'TransactionRequest'{transactionId = 3995,
2152                                     actions       = [ActReq]},
2153    Trans    = {transactionRequest, TransReq},
2154    Body     = {transactions, [Trans]},
2155    Msg      = #'Message'{version = ?VERSION,
2156                          mId     = ?MG1_MID,
2157                          messageBody = Body},
2158    #'MegacoMessage'{mess = Msg}.
2159
2160
2161%% --------------------------------------------------------------
2162
2163compact_otp6017_msg01(suite) ->
2164    [];
2165compact_otp6017_msg01(Config) when is_list(Config) ->
2166    %% put(severity,trc),
2167    %% put(dbg,true),
2168    d("compact_otp6017_msg01 -> entry", []),
2169    ?ACQUIRE_NODES(1, Config),
2170    ok = compact_otp6017(0),
2171    %% erase(severity),
2172    %% erase(dbg),
2173    ok.
2174
2175compact_otp6017_msg02(suite) ->
2176    [];
2177compact_otp6017_msg02(Config) when is_list(Config) ->
2178    %% put(severity,trc),
2179    %% put(dbg,true),
2180    d("compact_otp6017_msg02 -> entry", []),
2181    ?ACQUIRE_NODES(1, Config),
2182    ok = compact_otp6017(16#FFFFFFFE),
2183    %% erase(severity),
2184    %% erase(dbg),
2185    ok.
2186
2187compact_otp6017_msg03(suite) ->
2188    [];
2189compact_otp6017_msg03(Config) when is_list(Config) ->
2190    %% put(severity,trc),
2191    %% put(dbg,true),
2192    d("compact_otp6017_msg03 -> entry", []),
2193    ?ACQUIRE_NODES(1, Config),
2194    ok = compact_otp6017(16#FFFFFFFF),
2195    %% erase(severity),
2196    %% erase(dbg),
2197    ok.
2198
2199compact_otp6017(BadCID) ->
2200    d("compact_otp6017 -> entry with"
2201      "~n   BadCID: ~p", [BadCID]),
2202    Conf = ?EC,
2203    M   = compact_otp6017_msg(BadCID),
2204    Bin = list_to_binary(M),
2205    case decode_message(megaco_compact_text_encoder, false, Conf, Bin) of
2206        {ok, Msg} ->
2207	    d("compact_otp6017 -> Msg: ~n~p", [Msg]),
2208            exit({unexpected_decode_success, {Msg, M}});
2209        {error, Reason} when is_list(Reason) -> % Expected result
2210            case lists:keysearch(reason, 1, Reason) of
2211                {value, {reason, {_Line, _Mod, {bad_ContextID, BadCID}}}} ->
2212                    io:format(" ~w", [BadCID]),
2213                    ok;
2214                {value, {reason, ActualReason}} ->
2215		    d("compact_otp6017 -> wrong reason: ~n~p", [ActualReason]),
2216                    exit({unexpected_reason, ActualReason});
2217                false ->
2218		    d("compact_otp6017 -> no reason: ~n~p", [Reason]),
2219                    exit({reason_not_found, Reason})
2220            end;
2221        Crap ->
2222	    d("compact_otp6017 -> unexpected decode result: ~n~p", [Crap]),
2223            exit({unexpected_decode_result, Crap})
2224    end.
2225
2226compact_otp6017_msg(CID) when is_integer(CID) ->
2227    "!/" ?VERSION_STR " MG1 T=12345678{C=" ++
2228        integer_to_list(CID) ++
2229        "{SC=root{SV{MT=RS,RE=901}}}}".
2230
2231
2232%% --------------------------------------------------------------
2233%%
2234compact_otp16818_msg01(suite) ->
2235    [];
2236compact_otp16818_msg01(Config) when is_list(Config) ->
2237    d("compact_otp16818_msg01 -> entry", []),
2238    ok = compact_otp16818( compact_otp16818_msg01() ),
2239    ok.
2240
2241compact_otp16818_msg01() ->
2242    compact_otp16818_msg("a").
2243
2244
2245%% --
2246
2247compact_otp16818_msg02(suite) ->
2248    [];
2249compact_otp16818_msg02(Config) when is_list(Config) ->
2250    d("compact_otp16818_msg02 -> entry", []),
2251    ok = compact_otp16818( compact_otp16818_msg02() ),
2252    ok.
2253
2254compact_otp16818_msg02() ->
2255    compact_otp16818_msg("b").
2256
2257
2258%% --
2259
2260compact_otp16818_msg03(suite) ->
2261    [];
2262compact_otp16818_msg03(Config) when is_list(Config) ->
2263    d("compact_otp16818_msg03 -> entry", []),
2264    ok = compact_otp16818( compact_otp16818_msg03() ),
2265    ok.
2266
2267compact_otp16818_msg03() ->
2268    compact_otp16818_msg("c").
2269
2270
2271%% --
2272
2273compact_otp16818_msg04(suite) ->
2274    [];
2275compact_otp16818_msg04(Config) when is_list(Config) ->
2276    d("compact_otp16818_msg04 -> entry", []),
2277    ok = compact_otp16818( compact_otp16818_msg04() ),
2278    ok.
2279
2280compact_otp16818_msg04() ->
2281    compact_otp16818_msg("d").
2282
2283
2284%% --
2285
2286compact_otp16818_msg05(suite) ->
2287    [];
2288compact_otp16818_msg05(Config) when is_list(Config) ->
2289    d("compact_otp16818_msg05 -> entry", []),
2290    ok = compact_otp16818( compact_otp16818_msg05() ),
2291    ok.
2292
2293compact_otp16818_msg05() ->
2294    compact_otp16818_msg("e").
2295
2296
2297%% --
2298
2299compact_otp16818_msg06(suite) ->
2300    [];
2301compact_otp16818_msg06(Config) when is_list(Config) ->
2302    d("compact_otp16818_msg06 -> entry", []),
2303    ok = compact_otp16818( compact_otp16818_msg06() ),
2304    ok.
2305
2306compact_otp16818_msg06() ->
2307    compact_otp16818_msg("f").
2308
2309
2310%% --
2311
2312compact_otp16818_msg11(suite) ->
2313    [];
2314compact_otp16818_msg11(Config) when is_list(Config) ->
2315    d("compact_otp16818_msg11 -> entry", []),
2316    ok = compact_otp16818( compact_otp16818_msg11() ),
2317    ok.
2318
2319compact_otp16818_msg11() ->
2320    compact_otp16818_msg("000a").
2321
2322
2323%% --
2324
2325compact_otp16818_msg12(suite) ->
2326    [];
2327compact_otp16818_msg12(Config) when is_list(Config) ->
2328    d("compact_otp16818_msg12 -> entry", []),
2329    ok = compact_otp16818( compact_otp16818_msg12() ),
2330    ok.
2331
2332compact_otp16818_msg12() ->
2333    compact_otp16818_msg("000b").
2334
2335
2336%% --
2337
2338compact_otp16818_msg13(suite) ->
2339    [];
2340compact_otp16818_msg13(Config) when is_list(Config) ->
2341    d("compact_otp16818_msg13 -> entry", []),
2342    ok = compact_otp16818( compact_otp16818_msg13() ),
2343    ok.
2344
2345compact_otp16818_msg13() ->
2346    compact_otp16818_msg("000c").
2347
2348
2349%% --
2350
2351compact_otp16818_msg14(suite) ->
2352    [];
2353compact_otp16818_msg14(Config) when is_list(Config) ->
2354    d("compact_otp16818_msg14 -> entry", []),
2355    ok = compact_otp16818( compact_otp16818_msg14() ),
2356    ok.
2357
2358compact_otp16818_msg14() ->
2359    compact_otp16818_msg("000d").
2360
2361
2362%% --
2363
2364compact_otp16818_msg15(suite) ->
2365    [];
2366compact_otp16818_msg15(Config) when is_list(Config) ->
2367    d("compact_otp16818_msg15 -> entry", []),
2368    ok = compact_otp16818( compact_otp16818_msg15() ),
2369    ok.
2370
2371compact_otp16818_msg15() ->
2372    compact_otp16818_msg("000e").
2373
2374
2375%% --
2376
2377compact_otp16818_msg16(suite) ->
2378    [];
2379compact_otp16818_msg16(Config) when is_list(Config) ->
2380    d("compact_otp16818_msg16 -> entry", []),
2381    ok = compact_otp16818( compact_otp16818_msg16() ),
2382    ok.
2383
2384compact_otp16818_msg16() ->
2385    compact_otp16818_msg("000f").
2386
2387
2388%% --
2389
2390compact_otp16818_msg21(suite) ->
2391    [];
2392compact_otp16818_msg21(Config) when is_list(Config) ->
2393    d("compact_otp16818_msg21 -> entry", []),
2394    ok = compact_otp16818( compact_otp16818_msg21() ),
2395    ok.
2396
2397compact_otp16818_msg21() ->
2398    compact_otp16818_msg("0a12").
2399
2400
2401%% --
2402
2403compact_otp16818_msg22(suite) ->
2404    [];
2405compact_otp16818_msg22(Config) when is_list(Config) ->
2406    d("compact_otp16818_msg22 -> entry", []),
2407    ok = compact_otp16818( compact_otp16818_msg22() ),
2408    ok.
2409
2410compact_otp16818_msg22() ->
2411    compact_otp16818_msg("0b12").
2412
2413
2414%% --
2415
2416compact_otp16818_msg23(suite) ->
2417    [];
2418compact_otp16818_msg23(Config) when is_list(Config) ->
2419    d("compact_otp16818_msg23 -> entry", []),
2420    ok = compact_otp16818( compact_otp16818_msg23() ),
2421    ok.
2422
2423compact_otp16818_msg23() ->
2424    compact_otp16818_msg("0c12").
2425
2426
2427%% --
2428
2429compact_otp16818_msg24(suite) ->
2430    [];
2431compact_otp16818_msg24(Config) when is_list(Config) ->
2432    d("compact_otp16818_msg24 -> entry", []),
2433    ok = compact_otp16818( compact_otp16818_msg24() ),
2434    ok.
2435
2436compact_otp16818_msg24() ->
2437    compact_otp16818_msg("0d12").
2438
2439
2440%% --
2441
2442compact_otp16818_msg25(suite) ->
2443    [];
2444compact_otp16818_msg25(Config) when is_list(Config) ->
2445    d("compact_otp16818_msg25 -> entry", []),
2446    ok = compact_otp16818( compact_otp16818_msg25() ),
2447    ok.
2448
2449compact_otp16818_msg25() ->
2450    compact_otp16818_msg("0e12").
2451
2452
2453%% --
2454
2455compact_otp16818_msg26(suite) ->
2456    [];
2457compact_otp16818_msg26(Config) when is_list(Config) ->
2458    d("compact_otp16818_msg26 -> entry", []),
2459    ok = compact_otp16818( compact_otp16818_msg26() ),
2460    ok.
2461
2462compact_otp16818_msg26() ->
2463    compact_otp16818_msg("0f12").
2464
2465
2466%% --
2467
2468compact_otp16818_msg31(suite) ->
2469    [];
2470compact_otp16818_msg31(Config) when is_list(Config) ->
2471    d("compact_otp16818_msg31 -> entry", []),
2472    ok = compact_otp16818( compact_otp16818_msg31() ),
2473    ok.
2474
2475compact_otp16818_msg31() ->
2476    compact_otp16818_msg("a123").
2477
2478
2479%% --
2480
2481compact_otp16818_msg32(suite) ->
2482    [];
2483compact_otp16818_msg32(Config) when is_list(Config) ->
2484    d("compact_otp16818_msg32 -> entry", []),
2485    ok = compact_otp16818( compact_otp16818_msg32() ),
2486    ok.
2487
2488compact_otp16818_msg32() ->
2489    compact_otp16818_msg("b123").
2490
2491
2492%% --
2493
2494compact_otp16818_msg33(suite) ->
2495    [];
2496compact_otp16818_msg33(Config) when is_list(Config) ->
2497    d("compact_otp16818_msg33 -> entry", []),
2498    ok = compact_otp16818( compact_otp16818_msg33() ),
2499    ok.
2500
2501compact_otp16818_msg33() ->
2502    compact_otp16818_msg("c123").
2503
2504
2505%% --
2506
2507compact_otp16818_msg34(suite) ->
2508    [];
2509compact_otp16818_msg34(Config) when is_list(Config) ->
2510    d("compact_otp16818_msg34 -> entry", []),
2511    ok = compact_otp16818( compact_otp16818_msg34() ),
2512    ok.
2513
2514compact_otp16818_msg34() ->
2515    compact_otp16818_msg("d123").
2516
2517
2518%% --
2519
2520compact_otp16818_msg35(suite) ->
2521    [];
2522compact_otp16818_msg35(Config) when is_list(Config) ->
2523    d("compact_otp16818_msg35 -> entry", []),
2524    ok = compact_otp16818( compact_otp16818_msg35() ),
2525    ok.
2526
2527compact_otp16818_msg35() ->
2528    compact_otp16818_msg("e123").
2529
2530
2531%% --
2532
2533compact_otp16818_msg36(suite) ->
2534    [];
2535compact_otp16818_msg36(Config) when is_list(Config) ->
2536    d("compact_otp16818_msg36 -> entry", []),
2537    ok = compact_otp16818( compact_otp16818_msg36() ),
2538    ok.
2539
2540compact_otp16818_msg36() ->
2541    compact_otp16818_msg("f123").
2542
2543
2544%% -----
2545
2546compact_otp16818( Msg ) ->
2547    Bin = erlang:list_to_binary(Msg),
2548    try megaco_compact_text_encoder:decode_message([], dynamic, Bin) of
2549        {ok, _} ->
2550            ok;
2551        {error, _} = ERROR ->
2552            ERROR
2553     catch
2554        C:E:S ->
2555            {error, {C, E, S}}
2556    end.
2557
2558compact_otp16818_msg(X) when is_list(X) ->
2559    "!/3 [2409:8050:5005:1243:1011::" ++ X ++
2560        "] T=2523{C=-{SC=ROOT{SV{MT=RS,RE=901,PF=ETSI_BGF/2,V=3}}}}".
2561
2562
2563%% --------------------------------------------------------------
2564
2565compact_erl1405_msg01(suite) ->
2566    [];
2567compact_erl1405_msg01(Config) when is_list(Config) ->
2568    put(severity,trc),
2569    put(dbg,true),
2570    d("compact_erl1405_msg01 -> entry", []),
2571    ?ACQUIRE_NODES(1, Config),
2572    ok = compact_erl1405(statisticsDescriptor),
2573    erase(severity),
2574    erase(dbg),
2575    ok.
2576
2577compact_erl1405_msg02(suite) ->
2578    [];
2579compact_erl1405_msg02(Config) when is_list(Config) ->
2580    put(severity,trc),
2581    put(dbg,true),
2582    d("compact_erl1405_msg02 -> entry", []),
2583    ?ACQUIRE_NODES(1, Config),
2584    ok = compact_erl1405({statisticsDescriptor, []}),
2585    erase(severity),
2586    erase(dbg),
2587    ok.
2588
2589compact_erl1405(Descriptor) ->
2590    ticket_compact_encode_decode_ok( erl1405_msg(Descriptor) ).
2591
2592erl1405_msg(Descriptor) ->
2593    #'MegacoMessage'{
2594        mess = #'Message'{
2595            version = ?VERSION,
2596            mId = {deviceName, "test"},
2597            messageBody = {transactions, [
2598                {transactionRequest, #'TransactionRequest'{
2599                    transactionId = 1,
2600                    actions = [
2601                        #'ActionRequest'{
2602                            contextId = ?megaco_choose_context_id,
2603                            commandRequests = [
2604                                #'CommandRequest'{
2605                                    command = {addReq, #'AmmRequest'{
2606                                        terminationID = [#megaco_term_id{id = ["test"]}],
2607                                        descriptors = [Descriptor]
2608                                    }}
2609                                }
2610                            ]
2611                        }
2612                    ]
2613                }}
2614            ]}
2615        }
2616    }.
2617
2618
2619%% ==============================================================
2620%%
2621%% F l e x   C o m p a c t   T e s t c a s e s
2622%%
2623
2624flex_compact_otp4299_msg1(suite) ->
2625    [];
2626flex_compact_otp4299_msg1(Config) when is_list(Config) ->
2627    %% put(severity,trc),
2628    %% put(dbg,true),
2629    d("flex_comppact_otp4299_msg1 -> entry", []),
2630    ?ACQUIRE_NODES(1, Config),
2631    Msg  = compact_otp4299_msg(),
2632    Conf = flex_scanner_conf(Config),
2633    ok = compact_otp4299(Msg, [?EC_V3,Conf]),
2634    %% erase(severity),
2635    %% erase(dbg),
2636    ok.
2637
2638flex_compact_otp7431_msg01(suite) ->
2639    [];
2640flex_compact_otp7431_msg01(Config) when is_list(Config) ->
2641    %% put(severity,trc),
2642    %% put(dbg,true),
2643    d("flex_comppact_otp7431_msg01 -> entry", []),
2644    Conf = flex_scanner_conf(Config),
2645    flex_compact_otp7431(ok, flex_compact_otp7431_msg1(), [Conf]).
2646
2647flex_compact_otp7431_msg02(suite) ->
2648    [];
2649flex_compact_otp7431_msg02(Config) when is_list(Config) ->
2650    %% put(severity,trc),
2651    %% put(dbg,true),
2652    d("flex_comppact_otp7431_msg02 -> entry", []),
2653    Conf = flex_scanner_conf(Config),
2654    flex_compact_otp7431(error, flex_compact_otp7431_msg2(), [Conf]).
2655
2656flex_compact_otp7431_msg03(suite) ->
2657    [];
2658flex_compact_otp7431_msg03(Config) when is_list(Config) ->
2659    %% put(severity,trc),
2660    %% put(dbg,true),
2661    d("flex_comppact_otp7431_msg03 -> entry", []),
2662    Conf = flex_scanner_conf(Config),
2663    flex_compact_otp7431(error, flex_compact_otp7431_msg3(), [Conf]).
2664
2665flex_compact_otp7431_msg04(suite) ->
2666    [];
2667flex_compact_otp7431_msg04(Config) when is_list(Config) ->
2668    %% put(severity,trc),
2669    %% put(dbg,true),
2670    d("flex_comppact_otp7431_msg04 -> entry", []),
2671    Conf = flex_scanner_conf(Config),
2672    flex_compact_otp7431(error, flex_compact_otp7431_msg4(), [Conf]).
2673
2674flex_compact_otp7431_msg05(suite) ->
2675    [];
2676flex_compact_otp7431_msg05(Config) when is_list(Config) ->
2677    %% put(severity,trc),
2678    %% put(dbg,true),
2679    d("flex_comppact_otp7431_msg05 -> entry", []),
2680    Conf = flex_scanner_conf(Config),
2681    flex_compact_otp7431(error, flex_compact_otp7431_msg5(), [Conf]).
2682
2683flex_compact_otp7431_msg06(suite) ->
2684    [];
2685flex_compact_otp7431_msg06(Config) when is_list(Config) ->
2686    %% put(severity,trc),
2687    %% put(dbg,true),
2688    d("flex_comppact_otp7431_msg06 -> entry", []),
2689    Conf = flex_scanner_conf(Config),
2690    flex_compact_otp7431(error, flex_compact_otp7431_msg6(), [Conf]).
2691
2692flex_compact_otp7431_msg07(suite) ->
2693    [];
2694flex_compact_otp7431_msg07(Config) when is_list(Config) ->
2695    %% put(severity,trc),
2696    %% put(dbg,true),
2697    d("flex_comppact_otp7431_msg07 -> entry", []),
2698    Conf = flex_scanner_conf(Config),
2699    flex_compact_otp7431(error, flex_compact_otp7431_msg7(), [Conf]).
2700
2701
2702flex_compact_otp7431(Expected, Msg, Conf) ->
2703    otp7431(Expected, megaco_compact_text_encoder, Msg, Conf).
2704
2705flex_compact_otp7431_msg1() ->
2706    "!/1 [124.124.124.222]:55555
2707P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2708v=0
2709o=- 2890844526 2890842807 IN IP4 124.124.124.222
2710s=-
2711t= 0 0
2712c=IN IP4 124.124.124.222
2713m=audio 2222 RTP/AVP 4
2714a=ptime:30
2715a=recvonly
2716}}}}}}".
2717
2718flex_compact_otp7431_msg2() ->
2719    "!/1 [124.124.124.222]:55555
2720P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2721v=0
2722o=- 2890844526 2890842807 IN IP4 124.124.124.222
2723s=-
2724t= 0 0
2725c=IN IP4 124.124.124.222
2726m=audio 2222 RTP/AVP 4
2727a=ptime:30
2728a=     }
2729}}}}}".
2730
2731
2732flex_compact_otp7431_msg3() ->
2733    "!/1 [124.124.124.222]:55555
2734P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2735v=0
2736o=- 2890844526 2890842807 IN IP4 124.124.124.222
2737s=-
2738t= 0 0
2739c=IN IP4 124.124.124.222
2740m=audio 2222 RTP/AVP 4
2741a=ptime:30
2742a     }
2743}}}}}".
2744
2745
2746flex_compact_otp7431_msg4() ->
2747    "!/1 [124.124.124.222]:55555
2748P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2749v=0
2750o=- 2890844526 2890842807 IN IP4 124.124.124.222
2751s=-
2752t= 0 0
2753c=IN IP4 124.124.124.222
2754m=audio 2222 RTP/AVP 4
2755a=ptime:30
2756a}
2757}}}}}".
2758
2759
2760flex_compact_otp7431_msg5() ->
2761    "!/1 [124.124.124.222]:55555
2762P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2763v=       }
2764}}}}}".
2765
2766
2767flex_compact_otp7431_msg6() ->
2768    "!/1 [124.124.124.222]:55555
2769P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2770v       }
2771}}}}}".
2772
2773flex_compact_otp7431_msg7() ->
2774    "!/1 [124.124.124.222]:55555
2775P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
2776v}
2777}}}}}".
2778
2779
2780%% ==============================================================
2781%%
2782%% P r e t t y   T e s t c a s e s
2783%%
2784
2785pretty_otp4632_msg1(suite) ->
2786    [];
2787pretty_otp4632_msg1(Config) when is_list(Config) ->
2788    %% put(severity,trc),
2789    %% put(dbg,true),
2790    d("pretty_otp4632_msg1 -> entry", []),
2791    ?ACQUIRE_NODES(1, Config),
2792    ok = ticket_pretty_encode_decode_ok( pretty_otp4632_msg1() ),
2793    %% erase(severity),
2794    %% erase(dbg),
2795    ok.
2796
2797pretty_otp4632_msg1() ->
2798    msg4(?MG1_MID_NO_PORT, "901 mg col boot").
2799
2800pretty_otp4632_msg2(suite) ->
2801    [];
2802pretty_otp4632_msg2(Config) when is_list(Config) ->
2803    %% put(severity,trc),
2804    %% put(dbg,true),
2805    d("pretty_otp4632_msg2 -> entry", []),
2806    ?ACQUIRE_NODES(1, Config),
2807    ok = ticket_pretty_encode_decode_ok( pretty_otp4632_msg2() ),
2808    %% erase(severity),
2809    %% erase(dbg),
2810    ok.
2811
2812pretty_otp4632_msg2() ->
2813    msg4(?MG1_MID_NO_PORT, "901").
2814
2815
2816pretty_otp4632_msg3(suite) ->
2817    [];
2818pretty_otp4632_msg3(Config) when is_list(Config) ->
2819    %% put(severity,trc),
2820    %% put(dbg,true),
2821    d("pretty_otp4632_msg3 -> entry", []),
2822    ?ACQUIRE_NODES(1, Config),
2823    ok = ticket_pretty_decode_encode_ok( pretty_otp4632_msg3() ),
2824    %% erase(severity),
2825    %% erase(dbg),
2826    ok.
2827
2828pretty_otp4632_msg3() ->
2829    M = "MEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = \"901\"\n\t\t\t}\n\t\t}\n\t}\n}",
2830    M.
2831
2832
2833pretty_otp4632_msg4(suite) ->
2834    [];
2835pretty_otp4632_msg4(Config) when is_list(Config) ->
2836    %% put(severity,trc),
2837    %% put(dbg,true),
2838    d("pretty_otp4632_msg4 -> entry", []),
2839    ?ACQUIRE_NODES(1, Config),
2840    Check = fun(B2, B1) -> pretty_otp4632_msg4_chk(B1, B2) end,
2841    ok = ticket_pretty_decode_encode_only(pretty_otp4632_msg4(), Check),
2842    %% erase(severity),
2843    %% erase(dbg),
2844    ok.
2845
2846
2847pretty_otp4632_msg4() ->
2848    M = "MEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = 901\n\t\t\t}\n\t\t}\n\t}\n}",
2849    M.
2850
2851pretty_otp4632_msg4_chk(B1, B2) when is_binary(B1) and is_binary(B2) ->
2852    S1 = binary_to_list(B1),
2853    S2 = binary_to_list(B2),
2854    %%     io:format("~n"
2855    %% 		 "S1: ~s~n"
2856    %% 		 "S2: ~s~n", [S1, S2]),
2857    pretty_otp4632_msg4_chk(S1, S2);
2858
2859pretty_otp4632_msg4_chk([], []) ->
2860    messages_not_eq;
2861pretty_otp4632_msg4_chk([], Rest2) ->
2862    {messages_not_eq2, Rest2};
2863pretty_otp4632_msg4_chk(Rest1, []) ->
2864    {messages_not_eq1, Rest1};
2865pretty_otp4632_msg4_chk([$R,$e,$a,$s,$o,$n,$ ,$=,$ ,$",$9,$0,$1,$"|_Rest1],
2866			[$R,$e,$a,$s,$o,$n,$ ,$=,$ ,$9,$0,$1|_Rest2]) ->
2867    ok;
2868pretty_otp4632_msg4_chk([_H1|Rest1], [_H2|Rest2]) ->
2869    pretty_otp4632_msg4_chk(Rest1, Rest2).
2870
2871
2872%% --------------------------------------------------------------
2873%%
2874pretty_otp4710_msg1(suite) ->
2875    [];
2876pretty_otp4710_msg1(Config) when is_list(Config) ->
2877    %% put(severity,trc),
2878    %% put(dbg,true),
2879    d("pretty_otp4710_msg1 -> entry", []),
2880    ?ACQUIRE_NODES(1, Config),
2881    ok = ticket_pretty_encode_decode_ok( pretty_otp4710_msg1() ),
2882    %% erase(severity),
2883    %% erase(dbg),
2884    ok.
2885
2886pretty_otp4710_msg1() ->
2887    msg40().
2888
2889
2890pretty_otp4710_msg2(suite) ->
2891    [];
2892pretty_otp4710_msg2(Config) when is_list(Config) ->
2893    %% put(severity,trc),
2894    %% put(dbg,true),
2895    d("pretty_otp4710_msg2 -> entry", []),
2896    ?ACQUIRE_NODES(1, Config),
2897    Check = fun(B1, B2) -> pretty_otp4710_msg2_chk(B1, B2) end,
2898    ok = ticket_pretty_decode_encode_only(pretty_otp4710_msg2(), Check),
2899    %% erase(severity),
2900    %% erase(dbg),
2901    ok.
2902
2903pretty_otp4710_msg2() ->
2904    "Authentication = 0xEFCDAB89:0x12345678:0x1234567889ABCDEF76543210\nMEGACO/" ?VERSION_STR " [124.124.124.222]\nTransaction = 9998 {\n\tContext = - {\n\t\tServiceChange = root {\n\t\t\tServices {\n\t\t\t\tMethod = Restart,\n\t\t\t\tServiceChangeAddress = 55555,\n\t\t\t\tProfile = resgw/1,\n\t\t\t\tReason = \"901 mg col boot\"\n\t\t\t}\n\t\t}\n\t}\n}".
2905
2906pretty_otp4710_msg2_chk(B1, B2) when is_binary(B1) and is_binary(B2) ->
2907    S1 = binary_to_list(B1),
2908    S2 = binary_to_list(B2),
2909    pretty_otp4710_msg2_chk(S1, S2);
2910
2911pretty_otp4710_msg2_chk(Msg, Msg) ->
2912    ok;
2913
2914pretty_otp4710_msg2_chk(
2915  [$A,$u,$t,$h,$e,$n,$t,$i,$c,$a,$t,$i,$o,$n,$=,$ |Msg0],
2916  [$A,$u,$t,$h,$e,$n,$t,$i,$c,$a,$t,$i,$o,$n,$=,$ |Msg1]) ->
2917    {AH0, Rest0} = pretty_otp4710_msg2_chk_ah(Msg0, []),
2918    {AH1, Rest1} = pretty_otp4710_msg2_chk_ah(Msg1, []),
2919    case AH0 == AH1 of
2920	true ->
2921	    exit({message_not_equal, Rest0, Rest1});
2922	false ->
2923	    exit({auth_header_not_equal, AH0, AH1})
2924    end.
2925
2926pretty_otp4710_msg2_chk_ah([], _Acc) ->
2927    exit(no_auth_header_found);
2928pretty_otp4710_msg2_chk_ah([$M,$E,$G,$A,$C,$O,$/,_|Rest], Acc) ->
2929    {lists:reverse(Acc), Rest};
2930pretty_otp4710_msg2_chk_ah([C|R], Acc) ->
2931    pretty_otp4710_msg2_chk_ah(R, [C|Acc]).
2932
2933
2934%% --------------------------------------------------------------
2935%%
2936pretty_otp4945_msg1(suite) ->
2937    [];
2938pretty_otp4945_msg1(Config) when is_list(Config) ->
2939    %% put(severity,trc),
2940    %% put(dbg,true),
2941    d("pretty_otp4945_msg1 -> entry", []),
2942    ?ACQUIRE_NODES(1, Config),
2943    Check = fun(R) -> pretty_otp4945_msg1_chk(R) end,
2944    ok = ticket_pretty_decode_error(pretty_otp4945_msg1(), Check),
2945    %% erase(severity),
2946    %% erase(dbg),
2947    ok.
2948
2949pretty_otp4945_msg1() ->
2950"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
2951   Context = - {
2952      ServiceChange = ROOT {
2953         Services {
2954            Method = Restart,
2955            ServiceChangeAddress = 55555,
2956            Profile = ResGW/1
2957         }
2958      }
2959   }
2960}".
2961
2962pretty_otp4945_msg1_chk(R) when is_list(R) ->
2963    ExpMissing = [serviceChangeReason],
2964    Check = fun(Reason) ->
2965		    pretty_otp4945_chk(Reason, ExpMissing)
2966	    end,
2967    ticket_check_decode_only_error_reason(R, Check).
2968
2969
2970pretty_otp4945_msg2(suite) ->
2971    [];
2972pretty_otp4945_msg2(Config) when is_list(Config) ->
2973    %% put(severity,trc),
2974    %% put(dbg,true),
2975    d("pretty_otp4945_msg2 -> entry", []),
2976    ?ACQUIRE_NODES(1, Config),
2977    Check = fun(R) -> pretty_otp4945_msg2_chk(R) end,
2978    ok = ticket_pretty_decode_error(pretty_otp4945_msg2(), Check),
2979    %% erase(severity),
2980    %% erase(dbg),
2981    ok.
2982
2983pretty_otp4945_msg2() ->
2984"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
2985   Context = - {
2986      ServiceChange = ROOT {
2987         Services {
2988            Reason = 901,
2989            ServiceChangeAddress = 55555,
2990            Profile = ResGW/1
2991         }
2992      }
2993   }
2994}".
2995
2996pretty_otp4945_msg2_chk(R) when is_list(R) ->
2997    ExpMissing = [serviceChangeMethod],
2998    Check = fun(Reason) ->
2999		    pretty_otp4945_chk(Reason, ExpMissing)
3000	    end,
3001    ticket_check_decode_only_error_reason(R, Check).
3002
3003
3004pretty_otp4945_msg3(suite) ->
3005    [];
3006pretty_otp4945_msg3(Config) when is_list(Config) ->
3007    %% put(severity,trc),
3008    %% put(dbg,true),
3009    d("pretty_otp4945_msg3 -> entry", []),
3010    ?ACQUIRE_NODES(1, Config),
3011    Check = fun(R) -> pretty_otp4945_msg3_chk(R) end,
3012    ok = ticket_pretty_decode_error(pretty_otp4945_msg3(), Check),
3013    %% erase(severity),
3014    %% erase(dbg),
3015    ok.
3016
3017pretty_otp4945_msg3() ->
3018"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
3019   Context = - {
3020      ServiceChange = ROOT {
3021         Services {
3022            ServiceChangeAddress = 55555,
3023            Profile = ResGW/1
3024         }
3025      }
3026   }
3027}".
3028
3029pretty_otp4945_msg3_chk(R) when is_list(R) ->
3030    ExpMissing = [serviceChangeReason, serviceChangeMethod],
3031    Check = fun(Reason) ->
3032		    pretty_otp4945_chk(Reason, ExpMissing)
3033	    end,
3034    ticket_check_decode_only_error_reason(R, Check).
3035
3036
3037pretty_otp4945_msg4(suite) ->
3038    [];
3039pretty_otp4945_msg4(Config) when is_list(Config) ->
3040    %% put(severity,trc),
3041    %% put(dbg,true),
3042    d("pretty_otp4945_msg4 -> entry", []),
3043    ?ACQUIRE_NODES(1, Config),
3044    ok = ticket_pretty_decode_only( pretty_otp4945_msg4() ),
3045    %% erase(severity),
3046    %% erase(dbg),
3047    ok.
3048
3049pretty_otp4945_msg4() ->
3050"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
3051   Context = - {
3052      ServiceChange = ROOT {
3053         Services {
3054            Method = Restart,
3055            Reason = 901,
3056            ServiceChangeAddress = 55555,
3057            Profile = ResGW/1
3058         }
3059      }
3060   }
3061}".
3062
3063
3064pretty_otp4945_msg5(suite) ->
3065    [];
3066pretty_otp4945_msg5(Config) when is_list(Config) ->
3067    %% put(severity,trc),
3068    %% put(dbg,true),
3069    d("pretty_otp4945_msg5 -> entry", []),
3070    ?ACQUIRE_NODES(1, Config),
3071    Check = fun(R) -> pretty_otp4945_msg5_chk(R) end,
3072    ok = ticket_pretty_decode_error(pretty_otp4945_msg5(), Check),
3073    %% erase(severity),
3074    %% erase(dbg),
3075    ok.
3076
3077pretty_otp4945_msg5() ->
3078"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
3079   Context = - {
3080      ServiceChange = ROOT {
3081         Services {
3082            Method = Restart,
3083            Reason = 901,
3084            Profile = ResGW/1,
3085            ServiceChangeAddress = 55555,
3086            Profile = ResGW/2
3087         }
3088      }
3089   }
3090}".
3091
3092pretty_otp4945_msg5_chk(R) when is_list(R) ->
3093    Check = fun({at_most_once_serviceChangeParm, {profile, _, _}}) ->
3094		    ok;
3095	       (Reason) ->
3096		    {error, {unexpected_reason, Reason}}
3097	    end,
3098    ticket_check_decode_only_error_reason(R, Check).
3099
3100
3101pretty_otp4945_msg6(suite) ->
3102    [];
3103pretty_otp4945_msg6(Config) when is_list(Config) ->
3104    %% put(severity,trc),
3105    %% put(dbg,true),
3106    d("pretty_otp4945_msg6 -> entry", []),
3107    ?ACQUIRE_NODES(1, Config),
3108    Check = fun(R) -> pretty_otp4945_msg6_chk(R) end,
3109    ok = ticket_pretty_decode_error(pretty_otp4945_msg6(), Check),
3110    %% erase(severity),
3111    %% erase(dbg),
3112    ok.
3113
3114pretty_otp4945_msg6() ->
3115"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
3116   Context = - {
3117      ServiceChange = ROOT {
3118         Services {
3119            Method = Restart,
3120               Reason = 901,
3121               ServiceChangeAddress = 55555,
3122               MgcIdToTry = kalle,
3123               Profile = ResGW/1
3124            }
3125         }
3126   }
3127}".
3128
3129pretty_otp4945_msg6_chk(R) when is_list(R) ->
3130    Check = fun({not_both_address_mgcid_serviceChangeParm, _, _}) ->
3131		    ok;
3132	       (Reason) ->
3133		    {error, {unexpected_reason, Reason}}
3134	    end,
3135    ticket_check_decode_only_error_reason(R, Check).
3136
3137
3138pretty_otp4945_chk({missing_required_serviceChangeParm, Missing},
3139		    ExpMissing) when is_list(Missing) ->
3140    case ExpMissing -- Missing of
3141	[] ->
3142	    ok;
3143	Diff ->
3144	    {error, {unexpected_missing_serviceChangeParm, Diff}}
3145    end;
3146pretty_otp4945_chk(Reason, _ExpMissing) ->
3147    {error, {unexpected_reason, Reason}}.
3148
3149
3150%% --------------------------------------------------------------
3151%%
3152pretty_otp4949_msg1(suite) ->
3153    [];
3154pretty_otp4949_msg1(Config) when is_list(Config) ->
3155    %% put(severity,trc),
3156    %% put(dbg,true),
3157    d("pretty_otp4949_msg1 -> entry", []),
3158    ?ACQUIRE_NODES(1, Config),
3159    ok = ticket_pretty_decode_only( pretty_otp4949_msg1() ),
3160    %% erase(severity),
3161    %% erase(dbg),
3162    ok.
3163
3164pretty_otp4949_msg1() ->
3165"MEGACO/" ?VERSION_STR " [124.124.124.222] Reply = 9998 {
3166   Context = - {
3167      ServiceChange = ROOT {
3168         Services {
3169            ServiceChangeAddress = 55555,
3170            Profile = ResGW/1
3171         }
3172      }
3173   }
3174}".
3175
3176
3177pretty_otp4949_msg2(suite) ->
3178    [];
3179pretty_otp4949_msg2(Config) when is_list(Config) ->
3180    %% put(severity,trc),
3181    %% put(dbg,true),
3182    d("pretty_otp4949_msg2 -> entry", []),
3183    ?ACQUIRE_NODES(1, Config),
3184    Check = fun(R) -> pretty_otp4949_msg2_chk(R) end,
3185    ok = ticket_pretty_decode_error( pretty_otp4949_msg2(), Check),
3186    %% erase(severity),
3187    %% erase(dbg),
3188    ok.
3189
3190pretty_otp4949_msg2() ->
3191"MEGACO/" ?VERSION_STR " [124.124.124.222] Reply = 9998 {
3192   Context = - {
3193      ServiceChange = ROOT {
3194         Services {
3195            Profile = ResGW/1,
3196            ServiceChangeAddress = 55555,
3197            Profile = ResGW/2
3198         }
3199      }
3200   }
3201}".
3202
3203pretty_otp4949_msg2_chk(R) when is_list(R) ->
3204    Check = fun({at_most_once_servChgReplyParm, {profile, _, _}}) ->
3205		    ok;
3206	       (Reason) ->
3207		    {error, {unexpected_reason, Reason}}
3208	    end,
3209    ticket_check_decode_only_error_reason(R, Check).
3210
3211
3212pretty_otp4949_msg3(suite) ->
3213    [];
3214pretty_otp4949_msg3(Config) when is_list(Config) ->
3215    %% put(severity,trc),
3216    %% put(dbg,true),
3217    d("pretty_otp4949_msg3 -> entry", []),
3218    ?ACQUIRE_NODES(1, Config),
3219    Check = fun(R) -> pretty_otp4949_msg3_chk(R) end,
3220    ok = ticket_pretty_decode_error( pretty_otp4949_msg3(), Check ),
3221    %% erase(severity),
3222    %% erase(dbg),
3223    ok.
3224
3225pretty_otp4949_msg3() ->
3226"MEGACO/" ?VERSION_STR " [124.124.124.222] Reply = 9998 {
3227   Context = - {
3228      ServiceChange = ROOT {
3229         Services {
3230            ServiceChangeAddress = 55555,
3231            MgcIdToTry = kalle,
3232            Profile = ResGW/1
3233         }
3234      }
3235   }
3236}".
3237
3238pretty_otp4949_msg3_chk(R) when is_list(R) ->
3239    Check = fun({not_both_address_mgcid_servChgReplyParm, _, _}) ->
3240		    ok;
3241	       (Reason) ->
3242		    {error, {unexpected_reason, Reason}}
3243	    end,
3244    ticket_check_decode_only_error_reason(R, Check).
3245
3246
3247%% --------------------------------------------------------------
3248%%
3249pretty_otp5042_msg1(suite) ->
3250    [];
3251pretty_otp5042_msg1(Config) when is_list(Config) ->
3252    %% put(severity,trc),
3253    %% put(dbg,true),
3254    d("pretty_otp5042_msg1 -> entry", []),
3255    ?ACQUIRE_NODES(1, Config),
3256    ok = ticket_pretty_decode_only( pretty_otp5042_msg1() ),
3257    %% erase(severity),
3258    %% erase(dbg),
3259    ok.
3260
3261pretty_otp5042_msg1() ->
3262"MEGACO/" ?VERSION_STR " <CATAPULT>:2944
3263Transaction = 102 {
3264Context =  5 { Notify =  MUX/1 { ObservedEvents = 1 {
3265h245bh/h245msgin { Stream =  1
3266, h245enc =
32670270020600088175000653401004100403E802E00180018001780680000034301160000700088175010101007A0100020001800001320000C0000219D005027F0070500100040100021080000319D005027F00504001008000041C001250000700088175010000400280010003000880000518AA027F400006850130008011020100000001030002000300040005000006
3268 }  }
3269 }  }  }".
3270
3271
3272%% --------------------------------------------------------------
3273%%
3274pretty_otp5068_msg1(suite) ->
3275    [];
3276pretty_otp5068_msg1(Config) when is_list(Config) ->
3277    %% put(severity,trc),
3278    %% put(dbg,true),
3279    d("pretty_otp5068_msg1 -> entry", []),
3280    ?ACQUIRE_NODES(1, Config),
3281    ok = ticket_pretty_encode_decode_only( pretty_otp5068_msg1() ),
3282    %% erase(severity),
3283    %% erase(dbg),
3284    ok.
3285
3286pretty_otp5068_msg1() ->
3287{'MegacoMessage',
3288 asn1_NOVALUE,
3289 {'Message',
3290  ?VERSION,
3291  {deviceName,[109,103,51,51]},
3292  {transactions,
3293   [{transactionReply,
3294     {'TransactionReply',
3295      190,
3296      asn1_NOVALUE,
3297      {actionReplies,
3298       [{'ActionReply',  %% Comments: This is repeated many times.
3299	 0,
3300	 asn1_NOVALUE,
3301	 asn1_NOVALUE,
3302	 [{auditValueReply,
3303	   {auditResult,
3304	    {'AuditResult',
3305	     {megaco_term_id,false,
3306	      [[99,101,100,101,118,49,47,52,47,49,47,49],[51,49]]},
3307	     [{mediaDescriptor,
3308	       {'MediaDescriptor',
3309		{'TerminationStateDescriptor',
3310		 [],
3311		 asn1_NOVALUE,
3312		 inSvc},
3313		asn1_NOVALUE}
3314	      }
3315	     ]
3316	    }
3317	   }
3318	  }
3319	 ]
3320	}
3321       ]
3322      },asn1_NOVALUE,asn1_NOVALUE
3323     }
3324    }
3325   ]
3326  }
3327 }
3328}.
3329
3330
3331
3332%% --------------------------------------------------------------
3333%%
3334pretty_otp5085_msg1(suite) ->
3335    [];
3336pretty_otp5085_msg1(Config) when is_list(Config) ->
3337    %% put(severity,trc),
3338    %% put(dbg,true),
3339    d("pretty_otp5085_msg1 -> entry", []),
3340    ?ACQUIRE_NODES(1, Config),
3341    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1() ),
3342    %% erase(severity),
3343    %% erase(dbg),
3344    ok.
3345
3346pretty_otp5085_msg1() ->
3347    {'MegacoMessage',
3348     asn1_NOVALUE,
3349     {'Message',
3350      ?VERSION,
3351      {deviceName,"mg36"},
3352      {transactions,
3353       [{transactionReply,
3354	 {'TransactionReply',
3355	  230,
3356	  asn1_NOVALUE,
3357	  {actionReplies,
3358	   [{'ActionReply',
3359	     400,
3360	     {'ErrorDescriptor',504,asn1_NOVALUE},
3361	     asn1_NOVALUE,
3362	     []
3363	    }
3364	   ]
3365	  },asn1_NOVALUE,asn1_NOVALUE
3366	 }
3367	}
3368       ]
3369      }
3370     }
3371    }.
3372
3373
3374pretty_otp5085_msg2(suite) ->
3375    [];
3376pretty_otp5085_msg2(Config) when is_list(Config) ->
3377    %% put(severity,trc),
3378    %% put(dbg,true),
3379    d("pretty_otp5085_msg2 -> entry", []),
3380    ?ACQUIRE_NODES(1, Config),
3381    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg2() ),
3382    %% erase(severity),
3383    %% erase(dbg),
3384    ok.
3385
3386pretty_otp5085_msg2() ->
3387    {'MegacoMessage',
3388     asn1_NOVALUE,
3389     {'Message',
3390      ?VERSION,
3391      {deviceName,"mg36"},
3392      {transactions,
3393       [{transactionReply,
3394	 {'TransactionReply',
3395	  230,
3396	  asn1_NOVALUE,
3397	  {actionReplies,
3398	   [{'ActionReply',
3399	     400,
3400	     asn1_NOVALUE,
3401	     asn1_NOVALUE,
3402	     []
3403	    }
3404	   ]
3405	  },asn1_NOVALUE,asn1_NOVALUE
3406	 }
3407	}
3408       ]
3409      }
3410     }
3411    }.
3412
3413
3414pretty_otp5085_msg3(suite) ->
3415    [];
3416pretty_otp5085_msg3(Config) when is_list(Config) ->
3417    %% put(severity,trc),
3418    %% put(dbg,true),
3419    d("pretty_otp5085_msg3 -> entry", []),
3420    ?ACQUIRE_NODES(1, Config),
3421    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg3() ),
3422    %% erase(severity),
3423    %% erase(dbg),
3424    ok.
3425
3426pretty_otp5085_msg3() ->
3427    {'MegacoMessage',
3428     asn1_NOVALUE,
3429     {'Message',
3430      ?VERSION,
3431      {deviceName,"mg36"},
3432      {transactions,
3433       [{transactionReply,
3434	 {'TransactionReply',
3435	  230,
3436	  asn1_NOVALUE,
3437	  {actionReplies,
3438	   [{'ActionReply',
3439	     400,
3440	     asn1_NOVALUE,
3441	     #'ContextRequest'{priority = 3},
3442	     []
3443	    }
3444	   ]
3445	  },asn1_NOVALUE,asn1_NOVALUE
3446	 }
3447	}
3448       ]
3449      }
3450     }
3451    }.
3452
3453
3454pretty_otp5085_msg4(suite) ->
3455    [];
3456pretty_otp5085_msg4(Config) when is_list(Config) ->
3457    %% put(severity,trc),
3458    %% put(dbg,true),
3459    d("pretty_otp5085_msg4 -> entry", []),
3460    ?ACQUIRE_NODES(1, Config),
3461    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg4() ),
3462    %% erase(severity),
3463    %% erase(dbg),
3464    ok.
3465
3466pretty_otp5085_msg4() ->
3467    {'MegacoMessage',
3468     asn1_NOVALUE,
3469     {'Message',
3470      ?VERSION,
3471      {deviceName,"mg36"},
3472      {transactions,
3473       [{transactionReply,
3474	 {'TransactionReply',
3475	  230,
3476	  asn1_NOVALUE,
3477	  {actionReplies,
3478	   [{'ActionReply',
3479	     400,
3480	     asn1_NOVALUE,
3481	     asn1_NOVALUE,
3482	     [{addReply,    cre_AmmsReply([#megaco_term_id{id = ?A4444}])},
3483	      {notifyReply, cre_NotifyRep([#megaco_term_id{id = ?A5555}])}]
3484	    }
3485	   ]
3486	  },asn1_NOVALUE,asn1_NOVALUE
3487	 }
3488	}
3489       ]
3490      }
3491     }
3492    }.
3493
3494
3495pretty_otp5085_msg5(suite) ->
3496    [];
3497pretty_otp5085_msg5(Config) when is_list(Config) ->
3498    %% put(severity,trc),
3499    %% put(dbg,true),
3500    d("pretty_otp5085_msg5 -> entry", []),
3501    ?ACQUIRE_NODES(1, Config),
3502    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg5() ),
3503    %% erase(severity),
3504    %% erase(dbg),
3505    ok.
3506
3507pretty_otp5085_msg5() ->
3508    {'MegacoMessage',
3509     asn1_NOVALUE,
3510     {'Message',
3511      ?VERSION,
3512      {deviceName,"mg36"},
3513      {transactions,
3514       [{transactionReply,
3515	 {'TransactionReply',
3516	  230,
3517	  asn1_NOVALUE,
3518	  {actionReplies,
3519	   [{'ActionReply',
3520	     400,
3521	     asn1_NOVALUE,
3522	     #'ContextRequest'{priority = 5},
3523	     [{addReply,    cre_AmmsReply([#megaco_term_id{id = ?A4444}])},
3524	      {notifyReply, cre_NotifyRep([#megaco_term_id{id = ?A5555}])}]
3525	    }
3526	   ]
3527	  },asn1_NOVALUE,asn1_NOVALUE
3528	 }
3529	}
3530       ]
3531      }
3532     }
3533    }.
3534
3535
3536pretty_otp5085_msg6(suite) ->
3537    [];
3538pretty_otp5085_msg6(Config) when is_list(Config) ->
3539    %% put(severity,trc),
3540    %% put(dbg,true),
3541    d("pretty_otp5085_msg6 -> entry", []),
3542    ?ACQUIRE_NODES(1, Config),
3543    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg6() ),
3544    %% erase(severity),
3545    %% erase(dbg),
3546    ok.
3547
3548pretty_otp5085_msg6() ->
3549    {'MegacoMessage',
3550     asn1_NOVALUE,
3551     {'Message',
3552      ?VERSION,
3553      {deviceName,"msg36"},
3554      {transactions,
3555       [{transactionReply,
3556	 {'TransactionReply',
3557	  230,
3558	  asn1_NOVALUE,
3559	  {actionReplies,
3560	   [{'ActionReply',
3561	     400,
3562	     {'ErrorDescriptor',504,asn1_NOVALUE},
3563	     #'ContextRequest'{priority = 6},
3564	     [{addReply,    cre_AmmsReply([#megaco_term_id{id = ?A4444}])},
3565	      {notifyReply, cre_NotifyRep([#megaco_term_id{id = ?A5555}])}]
3566	    }
3567	   ]
3568	  },asn1_NOVALUE,asn1_NOVALUE
3569	 }
3570	}
3571       ]
3572      }
3573     }
3574    }.
3575
3576
3577pretty_otp5085_msg7(suite) ->
3578    [];
3579pretty_otp5085_msg7(Config) when is_list(Config) ->
3580    %% put(severity,trc),
3581    %% put(dbg,true),
3582    d("pretty_otp5085_msg7 -> entry", []),
3583    ?ACQUIRE_NODES(1, Config),
3584    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg7() ),
3585    %% erase(severity),
3586    %% erase(dbg),
3587    ok.
3588
3589pretty_otp5085_msg7() ->
3590    {'MegacoMessage',
3591     asn1_NOVALUE,
3592     {'Message',
3593      ?VERSION,
3594      {deviceName,"msg36"},
3595      {transactions,
3596       [{transactionReply,
3597	 {'TransactionReply',
3598	  230,
3599	  asn1_NOVALUE,
3600	  {actionReplies,
3601	   [{'ActionReply',
3602	     400,
3603	     {'ErrorDescriptor',504,asn1_NOVALUE},
3604	     #'ContextRequest'{priority = 7},
3605	     [{notifyReply, cre_NotifyRep([#megaco_term_id{id = ?A5555}])}]
3606	    }
3607	   ]
3608	  },asn1_NOVALUE,asn1_NOVALUE
3609	 }
3610	}
3611       ]
3612      }
3613     }
3614    }.
3615
3616
3617pretty_otp5085_msg8(suite) ->
3618    [];
3619pretty_otp5085_msg8(Config) when is_list(Config) ->
3620    %% put(severity,trc),
3621    %% put(dbg,true),
3622    d("pretty_otp5085_msg8 -> entry", []),
3623    ?ACQUIRE_NODES(1, Config),
3624    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg8() ),
3625    %% erase(severity),
3626    %% erase(dbg),
3627    ok.
3628
3629pretty_otp5085_msg8() ->
3630    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
3631    To1 = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
3632    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
3633    To2 = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
3634    {'MegacoMessage',
3635     asn1_NOVALUE,
3636     {'Message',
3637      ?VERSION,
3638      {deviceName,"msg36"},
3639      {transactions,
3640       [{transactionReply,
3641	 {'TransactionReply',
3642	  230,
3643	  asn1_NOVALUE,
3644	  {actionReplies,
3645	   [{'ActionReply',
3646	     400,
3647	     {'ErrorDescriptor',504,asn1_NOVALUE},
3648	     #'ContextRequest'{priority = 8,
3649			       emergency = true,
3650			       topologyReq =
3651			       [#'TopologyRequest'{terminationFrom = From1,
3652						   terminationTo   = To1,
3653						   topologyDirection = bothway},
3654				#'TopologyRequest'{terminationFrom = From2,
3655						   terminationTo   = To2,
3656						   topologyDirection = oneway}
3657			       ],
3658			       iepscallind = true,
3659			       contextProp = [cre_PropParm("tdmc/gain", "2")]},
3660	     [{notifyReply, cre_NotifyRep([#megaco_term_id{id = ?A5555}])}]
3661	    }
3662	   ]
3663	  },asn1_NOVALUE,asn1_NOVALUE
3664	 }
3665	}
3666       ]
3667      }
3668     }
3669    }.
3670
3671
3672%% --------------------------------------------------------------
3673%%
3674pretty_otp5600_msg1(suite) ->
3675    [];
3676pretty_otp5600_msg1(Config) when is_list(Config) ->
3677    %% put(severity,trc),
3678    %% put(dbg,true),
3679    d("pretty_otp5600_msg1 -> entry", []),
3680    ?ACQUIRE_NODES(1, Config),
3681    ok = ticket_pretty_encode_decode_ok( pretty_otp5600_msg1() ),
3682    %% erase(severity),
3683    %% erase(dbg),
3684    ok.
3685
3686pretty_otp5600_msg1() ->
3687    SRE = #'SecondRequestedEvent'{ pkgdName = "al/on",
3688                                   evParList = [] },
3689
3690    SED = #'SecondEventsDescriptor'{ requestID = 2,
3691                                     eventList = [ SRE ] },
3692
3693    SIG = { signal, #'Signal'{ signalName = "cg/dt",
3694                               sigParList = [] } },
3695
3696    RA = #'RequestedActions'{ secondEvent = SED,
3697                              signalsDescriptor = [ SIG ] },
3698
3699    RE = #'RequestedEvent'{ pkgdName = "al/of",
3700                            eventAction = RA,
3701                            evParList = [] },
3702
3703    EV = #'EventsDescriptor'{ requestID = 1, eventList = [ RE ] },
3704
3705    TermID = {megaco_term_id, true, [[$*]] },
3706
3707    AMMR = #'AmmRequest'{ terminationID = [ TermID ],
3708                          descriptors = [ { eventsDescriptor, EV } ] },
3709
3710    CR = #'CommandRequest'{command = {modReq, AMMR}},
3711
3712    AR = #'ActionRequest'{contextId = ?megaco_null_context_id,
3713                          commandRequests = [CR]},
3714    ARs = [AR],
3715    TR = #'TransactionRequest'{transactionId = 5600, actions = ARs},
3716    TRs = [{transactionRequest, TR}],
3717    Mess = #'Message'{version = ?VERSION,
3718                      mId = ?MGC_MID,
3719                      messageBody = {transactions, TRs}},
3720    #'MegacoMessage'{mess = Mess}.
3721
3722
3723pretty_otp5600_msg2(suite) ->
3724    [];
3725pretty_otp5600_msg2(Config) when is_list(Config) ->
3726    %% put(severity,trc),
3727    %% put(dbg,true),
3728    d("pretty_otp5600_msg2 -> entry", []),
3729    ?ACQUIRE_NODES(1, Config),
3730    ok = ticket_pretty_encode_decode_ok( pretty_otp5600_msg2() ),
3731    %% erase(severity),
3732    %% erase(dbg),
3733    ok.
3734
3735pretty_otp5600_msg2() ->
3736    SIG = { signal, #'Signal'{ signalName = "cg/dt",
3737                               sigParList = [] } },
3738
3739    SRA = #'SecondRequestedActions'{ signalsDescriptor = [ SIG ] },
3740
3741    SRE = #'SecondRequestedEvent'{ pkgdName    = "al/on",
3742                                   eventAction = SRA,
3743                                   evParList   = [] },
3744
3745    SED = #'SecondEventsDescriptor'{ requestID = 2,
3746				     eventList = [ SRE ] },
3747
3748    RA = #'RequestedActions'{ secondEvent = SED },
3749
3750    RE = #'RequestedEvent'{ pkgdName = "al/of",
3751			    eventAction = RA,
3752			    evParList = [] },
3753
3754    EV = #'EventsDescriptor'{ requestID = 1, eventList = [ RE ] },
3755
3756    TermID = {megaco_term_id, true, [[$*]] },
3757
3758    AMMR = #'AmmRequest'{ terminationID = [ TermID ],
3759			  descriptors = [ { eventsDescriptor, EV } ] },
3760
3761    CR = #'CommandRequest'{command = {modReq, AMMR}},
3762
3763    AR = #'ActionRequest'{contextId = ?megaco_null_context_id,
3764                          commandRequests = [CR]},
3765    ARs = [AR],
3766    TR = #'TransactionRequest'{transactionId = 5600, actions = ARs},
3767    TRs = [{transactionRequest, TR}],
3768    Mess = #'Message'{version = ?VERSION,
3769                      mId = ?MGC_MID,
3770                      messageBody = {transactions, TRs}},
3771    #'MegacoMessage'{mess = Mess}.
3772
3773
3774%% --------------------------------------------------------------
3775%%
3776pretty_otp5601_msg1(suite) ->
3777    [];
3778pretty_otp5601_msg1(Config) when is_list(Config) ->
3779    %% put(severity,trc),
3780    %% put(dbg,true),
3781    d("pretty_otp5601_msg1 -> entry", []),
3782    ?ACQUIRE_NODES(1, Config),
3783    ok = ticket_pretty_encode_decode_ok( pretty_otp5601_msg1() ),
3784    %% erase(severity),
3785    %% erase(dbg),
3786    ok.
3787
3788pretty_otp5601_msg1() ->
3789    SRE1 = #'SecondRequestedEvent'{ pkgdName = "al/on",
3790				    evParList = [] },
3791
3792    SRA = #'SecondRequestedActions'{ eventDM = { digitMapName, "dialllan0" }},
3793
3794    SRE2 = #'SecondRequestedEvent'{ pkgdName = "dd/ce",
3795				    eventAction = SRA,
3796				    evParList = [] },
3797
3798    SED = #'SecondEventsDescriptor'{ requestID = 2,
3799				     eventList = [ SRE1, SRE2 ] },
3800
3801    RA = #'RequestedActions'{ secondEvent = SED },
3802
3803    RE = #'RequestedEvent'{ pkgdName = "al/of",
3804			    eventAction = RA,
3805			    evParList = [] },
3806
3807    EV = #'EventsDescriptor'{ requestID = 1, eventList = [ RE ] },
3808
3809    TermID = {megaco_term_id, true, [[$*]] },
3810
3811    AMMR = #'AmmRequest'{ terminationID = [ TermID ],
3812			  descriptors = [ { eventsDescriptor, EV } ] },
3813
3814    CR = #'CommandRequest'{command = {modReq, AMMR}},
3815
3816    AR = #'ActionRequest'{contextId = ?megaco_null_context_id,
3817			  commandRequests = [CR]},
3818    ARs = [AR],
3819    TR = #'TransactionRequest'{transactionId = 5600, actions = ARs},
3820    TRs = [{transactionRequest, TR}],
3821    Mess = #'Message'{version = ?VERSION,
3822		      mId = ?MGC_MID,
3823		      messageBody = {transactions, TRs}},
3824    #'MegacoMessage'{mess = Mess}.
3825
3826
3827%% --------------------------------------------------------------
3828%%
3829pretty_otp5793_msg01(suite) ->
3830    [];
3831pretty_otp5793_msg01(Config) when is_list(Config) ->
3832    %% put(severity,trc),
3833    %% put(dbg,true),
3834    d("pretty_otp5793_msg01 -> entry", []),
3835    ?ACQUIRE_NODES(1, Config),
3836    ok = ticket_pretty_encode_decode_ok( pretty_otp5793_msg1() ),
3837    %% erase(severity),
3838    %% erase(dbg),
3839    ok.
3840
3841pretty_otp5793_msg1() ->
3842    {'MegacoMessage',asn1_NOVALUE,
3843     {'Message',3,
3844      {deviceName,"bs_sbg_4/99"},
3845      {transactions,
3846       [{transactionReply,
3847	 {'TransactionReply',
3848	  370,
3849	  asn1_NOVALUE,
3850	  {actionReplies,
3851	   [{'ActionReply',
3852	     3,
3853	     asn1_NOVALUE,
3854	     asn1_NOVALUE,
3855	     [{auditValueReply,
3856	       {contextAuditResult,
3857		[{megaco_term_id,
3858		  false,
3859		  ["ip",
3860		   "104",
3861		   "1",
3862		   "18"]}]}},
3863	      {auditValueReply,
3864	       {contextAuditResult,
3865		[{megaco_term_id,
3866		  false,
3867		  ["ip",
3868		   "104",
3869		   "2",
3870		   "19"]
3871		 }
3872		]
3873	       }
3874	      }
3875	     ]
3876	    }
3877	   ]
3878	  },asn1_NOVALUE,asn1_NOVALUE
3879	 }
3880	}
3881       ]
3882      }
3883     }
3884    }.
3885
3886
3887
3888%% --------------------------------------------------------------
3889%%
3890pretty_otp5803_msg01(suite) ->
3891    [];
3892pretty_otp5803_msg01(Config) when is_list(Config) ->
3893    %% put(severity,trc),
3894    %% put(dbg,true),
3895    d("pretty_otp5803_msg01 -> entry", []),
3896    ?ACQUIRE_NODES(1, Config),
3897    ok = ticket_pretty_decode_encode_ok( pretty_otp5803_msg1() ),
3898    %% erase(severity),
3899    %% erase(dbg),
3900    ok.
3901
3902pretty_otp5803_msg1() ->
3903"MEGACO/" ?VERSION_STR " [134.138.234.29]Transaction=384{
3904  Context=27{
3905    Modify=ip/104/1/76{
3906      Media{
3907        Stream=1{
3908          Local{},
3909          Remote{}
3910        },
3911        Stream=2{
3912          Local{},
3913          Remote{}
3914        }
3915      },
3916      Audit{
3917        Media{
3918          Stream=1{
3919            Statistics{*/*}
3920          },
3921          Stream=2{
3922            Statistics{*/*}
3923          }
3924        }
3925      }
3926    },
3927    Modify=ip/104/2/77{
3928      Media{
3929        Stream=1{
3930          Local{},
3931          Remote{}
3932        },
3933        Stream=2{
3934          Local{},
3935          Remote{}
3936        }
3937      }
3938    }
3939  }
3940}".
3941
3942
3943pretty_otp5803_msg02(suite) ->
3944    [];
3945pretty_otp5803_msg02(Config) when is_list(Config) ->
3946    %% put(severity,trc),
3947    %% put(dbg,true),
3948    d("pretty_otp5803_msg02 -> entry", []),
3949    ?ACQUIRE_NODES(1, Config),
3950    ok = ticket_pretty_decode_encode_ok( pretty_otp5803_msg2() ),
3951    %% erase(severity),
3952    %% erase(dbg),
3953    ok.
3954
3955pretty_otp5803_msg2() ->
3956"MEGACO/" ?VERSION_STR " [134.138.234.29]Transaction=384{
3957  Context=27{
3958    Modify=ip/104/1/76{
3959      Media{
3960        Stream=1{
3961           Local{},
3962           Remote{}
3963        },
3964        Stream=2{
3965          Local{},
3966          Remote{}
3967        }
3968      },
3969      Audit{
3970        Media{
3971          Stream=1{
3972            Statistics{*/*}
3973          }
3974        }
3975      }
3976    },
3977    Modify=ip/104/2/77{
3978      Media{
3979        Stream=1{
3980          Local{},
3981          Remote{}
3982        },
3983        Stream=2{
3984          Local{},
3985          Remote{}
3986        }
3987      }
3988    }
3989  }
3990}".
3991
3992
3993%% --------------------------------------------------------------
3994%%
3995pretty_otp5805_msg01(suite) ->
3996    [];
3997pretty_otp5805_msg01(Config) when is_list(Config) ->
3998    %% put(severity,trc),
3999    %% put(dbg,true),
4000    d("pretty_otp5805_msg01 -> entry", []),
4001    ?ACQUIRE_NODES(1, Config),
4002    ok = ticket_pretty_decode_error( pretty_otp5805_msg1() ),
4003    %% erase(severity),
4004    %% erase(dbg),
4005    ok.
4006
4007pretty_otp5805_msg1() ->
4008"MEGACO/4 [134.138.234.29]
4009Transaction=1{
4010  Context=*{
4011    AuditValue=ip/0/*{
4012      Audit{}
4013    }
4014  }
4015}".
4016
4017
4018%% --------------------------------------------------------------
4019%%
4020pretty_otp5836_msg01(suite) ->
4021    [];
4022pretty_otp5836_msg01(Config) when is_list(Config) ->
4023    %% put(severity,trc),
4024    %% put(dbg,true),
4025    d("pretty_otp5836_msg01 -> entry", []),
4026    ?ACQUIRE_NODES(1, Config),
4027    ok = ticket_pretty_encode_decode_ok( compact_otp5836_msg1() ),
4028    %% erase(severity),
4029    %% erase(dbg),
4030    ok.
4031
4032
4033%% --------------------------------------------------------------
4034%%
4035pretty_otp5882_msg01(suite) ->
4036    [];
4037pretty_otp5882_msg01(Config) when is_list(Config) ->
4038    %% put(severity,trc),
4039    %% put(dbg,true),
4040    d("pretty_otp5882_msg01 -> entry", []),
4041    ?ACQUIRE_NODES(1, Config),
4042    Check = fun(R) -> pretty_otp5882_msg01_chk(R) end,
4043    ok = ticket_pretty_encode_error( pretty_otp5882_msg01(), Check ),
4044    %% erase(severity),
4045    %% erase(dbg),
4046    ok.
4047
4048pretty_otp5882_msg01_chk({message_encode_failed, {error, {Reason, _}}, _}) ->
4049    case Reason of
4050	{invalid_LocalControlDescriptor, empty} ->
4051	    ok;
4052	_ ->
4053	    {error, {unexpected_error_actual_reason, Reason}}
4054    end;
4055pretty_otp5882_msg01_chk(Reason) ->
4056    {error, {unexpected_reason, Reason}}.
4057
4058
4059pretty_otp5882_msg01() ->
4060    LCD = #'LocalControlDescriptor'{}, % Create illegal LCD
4061    Parms      = cre_StreamParms(LCD),
4062    StreamDesc = cre_StreamDesc(1, Parms),
4063    MediaDesc  = cre_MediaDesc(StreamDesc),
4064    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A4445}],
4065			    [{mediaDescriptor, MediaDesc}]),
4066    CmdReq     = cre_CmdReq({modReq, AmmReq}),
4067    CID        = cre_CtxID(7301),
4068    ActReq     = cre_ActReq(CID, [CmdReq]),
4069    Actions    = [ActReq],
4070    TransId    = cre_TransId(7302),
4071    TransReq   = cre_TransReq(TransId, Actions),
4072    Trans      = cre_Trans(TransReq),
4073    Mid        = ?MG1_MID,
4074    Mess       = cre_Msg(Mid, [Trans]),
4075    cre_MegacoMessage(Mess).
4076
4077
4078
4079%% --------------------------------------------------------------
4080%%
4081pretty_otp6490_msg01(suite) ->
4082    [];
4083pretty_otp6490_msg01(Config) when is_list(Config) ->
4084    %% put(severity, trc),
4085    %% put(dbg,      true),
4086    d("pretty_otp6490_msg01 -> entry", []),
4087    %% ?ACQUIRE_NODES(1, Config),
4088    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg01(), [] ),
4089    %% erase(dbg),
4090    erase(severity),
4091    ok.
4092
4093pretty_otp6490_msg02(suite) ->
4094    [];
4095pretty_otp6490_msg02(Config) when is_list(Config) ->
4096    %% put(severity, trc),
4097    %% put(dbg,      true),
4098    d("pretty_otp6490_msg02 -> entry", []),
4099    %% ?ACQUIRE_NODES(1, Config),
4100    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg02(), [] ),
4101    %% erase(severity),
4102    %% erase(dbg),
4103    ok.
4104
4105pretty_otp6490_msg03(suite) ->
4106    [];
4107pretty_otp6490_msg03(Config) when is_list(Config) ->
4108    %% put(severity, trc),
4109    %% put(dbg,      true),
4110    d("pretty_otp6490_msg03 -> entry", []),
4111    %% ?ACQUIRE_NODES(1, Config),
4112    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg03(), [] ),
4113    %% erase(severity),
4114    %% erase(dbg),
4115    ok.
4116
4117pretty_otp6490_msg04(suite) ->
4118    [];
4119pretty_otp6490_msg04(Config) when is_list(Config) ->
4120    %% put(severity, trc),
4121    %% put(dbg,      true),
4122    d("pretty_otp6490_msg04 -> entry", []),
4123    %% ?ACQUIRE_NODES(1, Config),
4124    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg04(), [] ),
4125    %% erase(severity),
4126    %% erase(dbg),
4127    ok.
4128
4129pretty_otp6490_msg05(suite) ->
4130    [];
4131pretty_otp6490_msg05(Config) when is_list(Config) ->
4132    %% put(severity, trc),
4133    %% put(dbg,      true),
4134    d("pretty_otp6490_msg05 -> entry", []),
4135    %% ?ACQUIRE_NODES(1, Config),
4136    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg05(), [] ),
4137    %% erase(severity),
4138    %% erase(dbg),
4139    ok.
4140
4141pretty_otp6490_msg06(suite) ->
4142    [];
4143pretty_otp6490_msg06(Config) when is_list(Config) ->
4144    %% put(severity, trc),
4145    %% put(dbg,      true),
4146    d("pretty_otp6490_msg06 -> entry", []),
4147    %% ?ACQUIRE_NODES(1, Config),
4148    ok = ticket_pretty_encode_decode_ok( pretty_otp6490_msg06(), [] ),
4149    %% erase(severity),
4150    %% erase(dbg),
4151    ok.
4152
4153pretty_otp6490_msg(EBD) ->
4154    AmmDesc    = ?MSG_LIB:cre_AmmDescriptor(EBD),
4155    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A4445}], [AmmDesc]),
4156    CmdReq     = cre_CmdReq({modReq, AmmReq}),
4157    CID        = cre_CtxID(64901),
4158    ActReq     = cre_ActReq(CID, [CmdReq]),
4159    Actions    = [ActReq],
4160    TransId    = cre_TransId(64902),
4161    TransReq   = cre_TransReq(TransId, Actions),
4162    Trans      = cre_Trans(TransReq),
4163    Mid        = ?MG1_MID,
4164    Mess       = cre_Msg(Mid, [Trans]),
4165    cre_MegacoMessage(Mess).
4166
4167pretty_otp6490_msg01() ->
4168    EvSpecs = [], % This will result in an error
4169    EBD     = EvSpecs, % This is because the lib checks that the size is valid
4170    pretty_otp6490_msg(EBD).
4171
4172pretty_otp6490_msg02() ->
4173    EvPar    = ?MSG_LIB:cre_EventParameter("sune", ["mangs"]),
4174    PkgdName = ?MSG_LIB:cre_PkgdName("foo", "a"),
4175    EvName   = ?MSG_LIB:cre_EventName(PkgdName),
4176    EvSpec   = ?MSG_LIB:cre_EventSpec(EvName, [EvPar]),
4177    EvSpecs  = [EvSpec],
4178    EBD      = ?MSG_LIB:cre_EventBufferDescriptor(EvSpecs),
4179    pretty_otp6490_msg(EBD).
4180
4181pretty_otp6490_msg03() ->
4182    EvPar1   = ?MSG_LIB:cre_EventParameter("sune",   ["mangs"]),
4183    EvPar2   = ?MSG_LIB:cre_EventParameter("kalle",  ["anka"]),
4184    EvPar3   = ?MSG_LIB:cre_EventParameter("flippa", ["ur"]),
4185    PkgdName = ?MSG_LIB:cre_PkgdName("foo", "a"),
4186    EvName   = ?MSG_LIB:cre_EventName(PkgdName),
4187    EvSpec   = ?MSG_LIB:cre_EventSpec(EvName, [EvPar1,EvPar2,EvPar3]),
4188    EvSpecs  = [EvSpec],
4189    EBD      = ?MSG_LIB:cre_EventBufferDescriptor(EvSpecs),
4190    pretty_otp6490_msg(EBD).
4191
4192pretty_otp6490_msg04() ->
4193    EvPar1    = ?MSG_LIB:cre_EventParameter("sune",   ["mangs"]),
4194    EvPar2    = ?MSG_LIB:cre_EventParameter("kalle",  ["anka"]),
4195    EvPar3    = ?MSG_LIB:cre_EventParameter("flippa", ["ur"]),
4196    PkgdName1 = ?MSG_LIB:cre_PkgdName("foo", "a"),
4197    EvName1   = ?MSG_LIB:cre_EventName(PkgdName1),
4198    EvSpec1   = ?MSG_LIB:cre_EventSpec(EvName1, [EvPar1,EvPar2,EvPar3]),
4199    EvPar4    = ?MSG_LIB:cre_EventParameter("hej",    ["hopp"]),
4200    PkgdName2 = ?MSG_LIB:cre_PkgdName("bar", "b"),
4201    EvName2   = ?MSG_LIB:cre_EventName(PkgdName2),
4202    EvSpec2   = ?MSG_LIB:cre_EventSpec(EvName2, [EvPar4]),
4203    EvSpecs   = [EvSpec1,EvSpec2],
4204    EBD       = ?MSG_LIB:cre_EventBufferDescriptor(EvSpecs),
4205    pretty_otp6490_msg(EBD).
4206
4207pretty_otp6490_msg05() ->
4208    EvPar    = ?MSG_LIB:cre_EventParameter("sune", ["mangs"]),
4209    PkgdName = ?MSG_LIB:cre_PkgdName("foo", root),
4210    EvName   = ?MSG_LIB:cre_EventName(PkgdName),
4211    EvSpec   = ?MSG_LIB:cre_EventSpec(EvName, [EvPar]),
4212    EvSpecs  = [EvSpec],
4213    EBD      = ?MSG_LIB:cre_EventBufferDescriptor(EvSpecs),
4214    pretty_otp6490_msg(EBD).
4215
4216pretty_otp6490_msg06() ->
4217    EvPar    = ?MSG_LIB:cre_EventParameter("sune", ["mangs"]),
4218    PkgdName = ?MSG_LIB:cre_PkgdName(root, root),
4219    EvName   = ?MSG_LIB:cre_EventName(PkgdName),
4220    EvSpec   = ?MSG_LIB:cre_EventSpec(EvName, [EvPar]),
4221    EvSpecs  = [EvSpec],
4222    EBD      = ?MSG_LIB:cre_EventBufferDescriptor(EvSpecs),
4223    pretty_otp6490_msg(EBD).
4224
4225
4226%% --------------------------------------------------------------
4227%%
4228
4229pretty_otp7671_msg01(suite) ->
4230    [];
4231pretty_otp7671_msg01(Config) when is_list(Config) ->
4232%%     put(severity, trc),
4233%%     put(dbg,      true),
4234    d("pretty_otp7671_msg01 -> entry", []),
4235    %% ?ACQUIRE_NODES(1, Config),
4236    ok = pretty_otp7671( pretty_otp7671_msg01(), [] ),
4237%%     erase(dbg),
4238%%     erase(severity),
4239    ok.
4240
4241pretty_otp7671_msg02(suite) ->
4242    [];
4243pretty_otp7671_msg02(Config) when is_list(Config) ->
4244%%     put(severity, trc),
4245%%     put(dbg,      true),
4246    d("pretty_otp7671_msg02 -> entry", []),
4247    %% ?ACQUIRE_NODES(1, Config),
4248    ok = pretty_otp7671( pretty_otp7671_msg02(), [] ),
4249%%     erase(dbg),
4250%%     erase(severity),
4251   ok.
4252
4253pretty_otp7671_msg03(suite) ->
4254    [];
4255pretty_otp7671_msg03(Config) when is_list(Config) ->
4256%%     put(severity, trc),
4257%%     put(dbg,      true),
4258    d("pretty_otp7671_msg03 -> entry", []),
4259    %% ?ACQUIRE_NODES(1, Config),
4260    ok = pretty_otp7671( pretty_otp7671_msg03(), [] ),
4261%%     erase(dbg),
4262%%     erase(severity),
4263    ok.
4264
4265pretty_otp7671_msg04(suite) ->
4266    [];
4267pretty_otp7671_msg04(Config) when is_list(Config) ->
4268%%     put(severity, trc),
4269%%     put(dbg,      true),
4270    d("pretty_otp7671_msg04 -> entry", []),
4271    %% ?ACQUIRE_NODES(1, Config),
4272    ok = pretty_otp7671( pretty_otp7671_msg04(), [] , error, ignore),
4273%%     erase(dbg),
4274%%     erase(severity),
4275    ok.
4276
4277pretty_otp7671_msg05(suite) ->
4278    [];
4279pretty_otp7671_msg05(Config) when is_list(Config) ->
4280%%     put(severity, trc),
4281%%     put(dbg,      true),
4282    d("pretty_otp7671_msg05 -> entry", []),
4283    Check = fun(M1, M2) -> cmp_otp7671_msg05(M1, M2) end,
4284    ok = pretty_otp7671( pretty_otp7671_msg05(), [] , ok, ok, Check),
4285%%     erase(dbg),
4286%%     erase(severity),
4287    ok.
4288
4289pretty_otp7671(Msg, Conf) ->
4290    pretty_otp7671(Msg, Conf, ok).
4291
4292pretty_otp7671(Msg, Conf, ExpectedEncode) ->
4293    pretty_otp7671(Msg, Conf, ExpectedEncode, ok).
4294
4295pretty_otp7671(Msg, Conf, ExpectedEncode, ExpectedDecode) ->
4296    otp7671(Msg, megaco_pretty_text_encoder, Conf,
4297            ExpectedEncode, ExpectedDecode).
4298
4299pretty_otp7671(Msg, Conf, ExpectedEncode, ExpectedDecode, Check) ->
4300    otp7671(Msg, megaco_pretty_text_encoder, Conf,
4301            ExpectedEncode, ExpectedDecode, Check).
4302
4303otp7671(Msg, Codec, Conf, ExpectedEncode, ExpectedDecode) ->
4304    Check = fun(M1, M2) ->
4305		    exit({unexpected_decode_result, M1, M2})
4306	    end,
4307    otp7671(Msg, Codec, Conf, ExpectedEncode, ExpectedDecode, Check).
4308
4309otp7671(Msg, Codec, Conf, ExpectedEncode, ExpectedDecode, Check) ->
4310    case (catch encode_message(Codec, Conf, Msg)) of
4311        {error, _Reason} when ExpectedEncode =:= error ->
4312            ok;
4313        {error, Reason} when ExpectedEncode =:= ok ->
4314            exit({unexpected_encode_failure, Reason});
4315        {ok, Bin} when ExpectedEncode =:= error ->
4316            exit({unexpected_encode_success, Msg, binary_to_list(Bin)});
4317        {ok, Bin} when ExpectedEncode =:= ok ->
4318            case decode_message(Codec, false, Conf, Bin) of
4319                {ok, Msg} when ExpectedDecode =:= ok ->
4320                    ok;
4321                {ok, Msg2} when ExpectedDecode =:= ok ->
4322		    Check(Msg, Msg2);
4323                {ok, Msg} when ExpectedDecode =:= error ->
4324                    exit({unexpected_decode_success, Msg});
4325                {ok, Msg2} when ExpectedDecode =:= error ->
4326                    exit({unexpected_decode_success, Msg, Msg2});
4327                {error, _Reason} when ExpectedDecode =:= error ->
4328                    ok;
4329                {error, Reason} when ExpectedDecode == ok ->
4330                    exit({unexpected_decode_failure, Msg, Reason})
4331            end
4332    end.
4333
4334
4335pretty_otp7671_msg(DigitMapDesc) ->
4336    AmmReq = cre_AmmReq([#megaco_term_id{id = ?A4444}],
4337			[{digitMapDescriptor, DigitMapDesc}]),
4338    CmdReq = cre_CmdReq({modReq, AmmReq}),
4339    msg_request(?MGC_MID, 10001, ?megaco_null_context_id, [CmdReq]).
4340
4341pretty_otp7671_msg01() ->
4342    Name         = "dialplan01",
4343    DigitMapDesc = cre_DigitMapDesc(Name),
4344    pretty_otp7671_msg(DigitMapDesc).
4345
4346pretty_otp7671_msg02() ->
4347    Name         = "dialplan02",
4348    Body         = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",
4349    Value        = cre_DigitMapValue(Body),
4350    DigitMapDesc = cre_DigitMapDesc(Name, Value),
4351    pretty_otp7671_msg(DigitMapDesc).
4352
4353pretty_otp7671_msg03() ->
4354    Body         = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",
4355    Value        = cre_DigitMapValue(Body),
4356    DigitMapDesc = cre_DigitMapDesc(Value),
4357    pretty_otp7671_msg(DigitMapDesc).
4358
4359pretty_otp7671_msg04() ->
4360    DigitMapDesc = cre_DigitMapDesc(),
4361    pretty_otp7671_msg(DigitMapDesc).
4362
4363pretty_otp7671_msg05() ->
4364    {'MegacoMessage',asn1_NOVALUE,
4365     {'Message',?VERSION,
4366      {domainName,{'DomainName',"tgc",asn1_NOVALUE}},
4367      {transactions,
4368       [{transactionRequest,
4369	 {'TransactionRequest',12582952,
4370	  [{'ActionRequest',0,asn1_NOVALUE,asn1_NOVALUE,
4371	    [{'CommandRequest',
4372	      {modReq,
4373	       {'AmmRequest',
4374		[{megaco_term_id,false,["root"]}],
4375		[{digitMapDescriptor,
4376		  {'DigitMapDescriptor',"dialplan1",
4377		   {'DigitMapValue',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,[],
4378		    asn1_NOVALUE}}}]}},
4379	      asn1_NOVALUE,asn1_NOVALUE}]}]}}]}}}.
4380
4381cmp_otp7671_msg05(#'MegacoMessage'{authHeader = asn1_NOVALUE,
4382				   mess       = M1},
4383		  #'MegacoMessage'{authHeader = asn1_NOVALUE,
4384				   mess       = M2}) ->
4385    #'Message'{messageBody = Body1} = M1,
4386    #'Message'{messageBody = Body2} = M2,
4387    {transactions, Trans1} = Body1,
4388    {transactions, Trans2} = Body2,
4389    [{transactionRequest, TR1}] = Trans1,
4390    [{transactionRequest, TR2}] = Trans2,
4391    #'TransactionRequest'{actions = Acts1} = TR1,
4392    #'TransactionRequest'{actions = Acts2} = TR2,
4393    [#'ActionRequest'{commandRequests = CR1}] = Acts1,
4394    [#'ActionRequest'{commandRequests = CR2}] = Acts2,
4395    [#'CommandRequest'{command = Cmd1}] = CR1,
4396    [#'CommandRequest'{command = Cmd2}] = CR2,
4397    {modReq, #'AmmRequest'{descriptors = Descs1}} = Cmd1,
4398    {modReq, #'AmmRequest'{descriptors = Descs2}} = Cmd2,
4399    [{digitMapDescriptor,
4400      #'DigitMapDescriptor'{digitMapName = Name,
4401			    digitMapValue = Value1}}] = Descs1,
4402    [{digitMapDescriptor,
4403      #'DigitMapDescriptor'{digitMapName = Name,
4404			    digitMapValue = Value2}}] = Descs2,
4405    #'DigitMapValue'{startTimer    = asn1_NOVALUE,
4406		     shortTimer    = asn1_NOVALUE,
4407		     longTimer     = asn1_NOVALUE,
4408		     digitMapBody  = [],
4409		     durationTimer = asn1_NOVALUE} = Value1,
4410    asn1_NOVALUE = Value2,
4411    ok.
4412
4413
4414%% --------------------------------------------------------------
4415%%
4416
4417pretty_otp8114_msg01(suite) ->
4418    [];
4419pretty_otp8114_msg01(Config) when is_list(Config) ->
4420    put(severity, trc),
4421    put(dbg,      true),
4422    d("pretty_otp8114_msg01 -> entry", []),
4423    ok = otp8114( pretty_otp8114_msg01(), megaco_pretty_text_encoder, ?EC),
4424    erase(dbg),
4425    erase(severity),
4426    ok.
4427
4428pretty_otp8114_msg01() ->
4429    "MEGACO/" ?VERSION_STR  " [10.10.10.10]:1234\nTransaction = 1 {\n\tContext =\n1 {\n\t\tModify = ip/1/1/1 {\n\t\t\tMedia {\n\t\t\t\tStream = 1\n{\n\t\t\t\t\t\tLocalControl {\n\t\t\t\t\t\tMode =\nSendReceive\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tEvents = 1\n{\n\t\t\t\tadid/ipstop\n{\n\t\t\t\t\tdt=30,\n\t\t\t\t\tdir=\"BOTH\"\n\t\t\t\t},\n\t\t\t\tg/cause\n\n\t\t\t}\n\t\t}\n\t}\n}".
4430
4431
4432otp8114(InitialMessage, Codec, Conf) ->
4433    Decode = fun(M) -> Codec:decode_message(Conf, M) end,
4434    Encode = fun(B) -> Codec:encode_message(Conf, B) end,
4435    InitialData = InitialMessage,
4436    Instructions =
4437	[
4438	 %% List to binary
4439	 megaco_codec_test_lib:expect_instruction(
4440	   "Convert (initial) message to a binary",
4441	   fun(Msg) when is_list(Msg) ->
4442		   %% io:format("~s~n", [Msg]),
4443		   {ok, list_to_binary(Msg)};
4444	      (Bad) ->
4445		   {error, {invalid_data, Bad}}
4446	   end,
4447	   fun({ok, Bin}, _Msg) when is_binary(Bin) ->
4448		   {ok, Bin};
4449	      (Bad, _Msg) ->
4450		   {error, {failed_to_binary, Bad}}
4451	   end),
4452
4453	 %% Initial decode
4454	 megaco_codec_test_lib:expect_instruction(
4455	   "Decode (initial) message",
4456	   fun(Bin) when is_binary(Bin) ->
4457		   (catch Decode(Bin));
4458	      (Bad) ->
4459		   {error, {invalid_data, Bad}}
4460	   end,
4461	   fun({ok, Msg}, _Bin) when is_record(Msg, 'MegacoMessage') ->
4462		   %% io:format("~p~n", [Msg]),
4463		   {ok, Msg};
4464	      (Bad, _) ->
4465		   {error, {initial_decode_failed, Bad}}
4466	   end),
4467
4468	 %% Encode
4469	 megaco_codec_test_lib:expect_instruction(
4470	   "Encode message",
4471	   fun(Msg) when is_record(Msg, 'MegacoMessage') ->
4472		   (catch Encode(Msg));
4473	      (Bad) ->
4474		   {error, {invalid_data, Bad}}
4475	   end,
4476	   fun({ok, Bin}, _Msg) when is_binary(Bin) ->
4477		   %% io:format("~s~n", [binary_to_list(Bin)]),
4478		   {ok, Bin};
4479	      (Bad, _) ->
4480		   {error, {encode_failed, Bad}}
4481	   end),
4482
4483	 %% Decode
4484	 megaco_codec_test_lib:expect_instruction(
4485	   "(final) Decode message",
4486	   fun(Bin) when is_binary(Bin) ->
4487		   (catch Decode(Bin));
4488	      (Bad) ->
4489		   {error, {invalid_data, Bad}}
4490	   end,
4491	   fun({ok, Msg}, _Bin) when is_record(Msg, 'MegacoMessage') ->
4492		   %% io:format("~p~n", [Msg]),
4493		   {ok, Msg};
4494	      (Bad, _) ->
4495		   {error, {decode_failed, Bad}}
4496	   end)
4497	],
4498    megaco_codec_test_lib:expect_exec(Instructions, InitialData).
4499
4500
4501
4502%% --------------------------------------------------------------
4503%%
4504
4505pretty_erl1405_msg01(suite) ->
4506    [];
4507pretty_erl1405_msg01(Config) when is_list(Config) ->
4508    put(severity,trc),
4509    put(dbg,true),
4510    d("pretty_erl1405_msg01 -> entry", []),
4511    ?ACQUIRE_NODES(1, Config),
4512    ok = pretty_erl1405(statisticsDescriptor),
4513    erase(severity),
4514    erase(dbg),
4515    ok.
4516
4517pretty_erl1405_msg02(suite) ->
4518    [];
4519pretty_erl1405_msg02(Config) when is_list(Config) ->
4520    put(severity,trc),
4521    put(dbg,true),
4522    d("pretty_erl1405_msg02 -> entry", []),
4523    ?ACQUIRE_NODES(1, Config),
4524    ok = pretty_erl1405({statisticsDescriptor, []}),
4525    erase(severity),
4526    erase(dbg),
4527    ok.
4528
4529pretty_erl1405(Descriptor) ->
4530    ticket_pretty_encode_decode_ok( erl1405_msg(Descriptor) ).
4531
4532
4533%% ==============================================================
4534%%
4535%% F l e x   P r e t t y   T e s t c a s e s
4536%%
4537
4538flex_pretty_otp5042_msg1(suite) ->
4539    [];
4540flex_pretty_otp5042_msg1(Config) when is_list(Config) ->
4541    %% put(severity,trc),
4542    %% put(dbg,true),
4543    d("flex_pretty_otp5042_msg1 -> entry", []),
4544    ?ACQUIRE_NODES(1, Config),
4545    ok = ticket_pretty_decode_only( pretty_otp5042_msg1() ),
4546    %% erase(severity),
4547    %% erase(dbg),
4548    ok.
4549
4550
4551%% --------------------------------------------------------------
4552%%
4553flex_pretty_otp5085_msg1(suite) ->
4554    [];
4555flex_pretty_otp5085_msg1(Config) when is_list(Config) ->
4556    %% put(severity,trc),
4557    %% put(dbg,true),
4558    d("flex_pretty_otp5085_msg1 -> entry", []),
4559    ?ACQUIRE_NODES(1, Config),
4560    Conf = flex_scanner_conf(Config),
4561    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4562    %% erase(severity),
4563    %% erase(dbg),
4564    ok.
4565
4566flex_pretty_otp5085_msg2(suite) ->
4567    [];
4568flex_pretty_otp5085_msg2(Config) when is_list(Config) ->
4569    %% put(severity,trc),
4570    %% put(dbg,true),
4571    d("flex_pretty_otp5085_msg2 -> entry", []),
4572    ?ACQUIRE_NODES(1, Config),
4573    Conf = flex_scanner_conf(Config),
4574    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4575    %% erase(severity),
4576    %% erase(dbg),
4577    ok.
4578
4579flex_pretty_otp5085_msg3(suite) ->
4580    [];
4581flex_pretty_otp5085_msg3(Config) when is_list(Config) ->
4582    %% put(severity,trc),
4583    %% put(dbg,true),
4584    d("flex_pretty_otp5085_msg3 -> entry", []),
4585    ?ACQUIRE_NODES(1, Config),
4586    Conf = flex_scanner_conf(Config),
4587    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4588    %% erase(severity),
4589    %% erase(dbg),
4590    ok.
4591
4592flex_pretty_otp5085_msg4(suite) ->
4593    [];
4594flex_pretty_otp5085_msg4(Config) when is_list(Config) ->
4595    %% put(severity,trc),
4596    %% put(dbg,true),
4597    d("flex_pretty_otp5085_msg4 -> entry", []),
4598    ?ACQUIRE_NODES(1, Config),
4599    Conf = flex_scanner_conf(Config),
4600    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4601    %% erase(severity),
4602    %% erase(dbg),
4603    ok.
4604
4605flex_pretty_otp5085_msg5(suite) ->
4606    [];
4607flex_pretty_otp5085_msg5(Config) when is_list(Config) ->
4608    %% put(severity,trc),
4609    %% put(dbg,true),
4610    d("flex_pretty_otp5085_msg5 -> entry", []),
4611    ?ACQUIRE_NODES(1, Config),
4612    Conf = flex_scanner_conf(Config),
4613    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4614    %% erase(severity),
4615    %% erase(dbg),
4616    ok.
4617
4618flex_pretty_otp5085_msg6(suite) ->
4619    [];
4620flex_pretty_otp5085_msg6(Config) when is_list(Config) ->
4621    %% put(severity,trc),
4622    %% put(dbg,true),
4623    d("flex_pretty_otp5085_msg6 -> entry", []),
4624    ?ACQUIRE_NODES(1, Config),
4625    Conf = flex_scanner_conf(Config),
4626    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4627    %% erase(severity),
4628    %% erase(dbg),
4629    ok.
4630
4631flex_pretty_otp5085_msg7(suite) ->
4632    [];
4633flex_pretty_otp5085_msg7(Config) when is_list(Config) ->
4634    %% put(severity,trc),
4635    %% put(dbg,true),
4636    d("flex_pretty_otp5085_msg7 -> entry", []),
4637    ?ACQUIRE_NODES(1, Config),
4638    Conf = flex_scanner_conf(Config),
4639    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4640    %% erase(severity),
4641    %% erase(dbg),
4642    ok.
4643
4644flex_pretty_otp5085_msg8(suite) ->
4645    [];
4646flex_pretty_otp5085_msg8(Config) when is_list(Config) ->
4647    %% put(severity,trc),
4648    %% put(dbg,true),
4649    d("flex_pretty_otp5085_msg8 -> entry", []),
4650    ?ACQUIRE_NODES(1, Config),
4651    Conf = flex_scanner_conf(Config),
4652    ok = ticket_pretty_encode_decode_ok( pretty_otp5085_msg1(), [Conf] ),
4653    %% erase(severity),
4654    %% erase(dbg),
4655    ok.
4656
4657
4658%% --------------------------------------------------------------
4659%%
4660flex_pretty_otp5600_msg1(suite) ->
4661    [];
4662flex_pretty_otp5600_msg1(Config) when is_list(Config) ->
4663    %% put(severity,trc),
4664    %% put(dbg,true),
4665    d("flex_pretty_otp5600_msg1 -> entry", []),
4666    ?ACQUIRE_NODES(1, Config),
4667    Conf = flex_scanner_conf(Config),
4668    ok = ticket_pretty_encode_decode_ok( pretty_otp5600_msg1(), [Conf] ),
4669    %% erase(severity),
4670    %% erase(dbg),
4671    ok.
4672
4673flex_pretty_otp5600_msg2(suite) ->
4674    [];
4675flex_pretty_otp5600_msg2(Config) when is_list(Config) ->
4676    %% put(severity,trc),
4677    %% put(dbg,true),
4678    d("flex_pretty_otp5600_msg2 -> entry", []),
4679    ?ACQUIRE_NODES(1, Config),
4680    Conf = flex_scanner_conf(Config),
4681    ok = ticket_pretty_encode_decode_ok( pretty_otp5600_msg2(), [Conf] ),
4682    %% erase(severity),
4683    %% erase(dbg),
4684    ok.
4685
4686
4687%% --------------------------------------------------------------
4688%%
4689flex_pretty_otp5601_msg1(suite) ->
4690    [];
4691flex_pretty_otp5601_msg1(Config) when is_list(Config) ->
4692    %% put(severity,trc),
4693    %% put(dbg,true),
4694    d("flex_pretty_otp5601_msg1 -> entry", []),
4695    ?ACQUIRE_NODES(1, Config),
4696    Conf = flex_scanner_conf(Config),
4697    ok = ticket_pretty_encode_decode_ok( pretty_otp5601_msg1(), [Conf] ),
4698    %% erase(severity),
4699    %% erase(dbg),
4700    ok.
4701
4702
4703%% --------------------------------------------------------------
4704%%
4705flex_pretty_otp5793_msg01(suite) ->
4706    [];
4707flex_pretty_otp5793_msg01(Config) when is_list(Config) ->
4708    %% put(severity,trc),
4709    %% put(dbg,true),
4710    d("flex_pretty_otp5793_msg01 -> entry", []),
4711    ?ACQUIRE_NODES(1, Config),
4712    Conf = flex_scanner_conf(Config),
4713    ok = ticket_pretty_encode_decode_ok( pretty_otp5793_msg1(), [Conf] ),
4714    %% erase(severity),
4715    %% erase(dbg),
4716    ok.
4717
4718
4719%% --------------------------------------------------------------
4720%%
4721flex_pretty_otp5803_msg01(suite) ->
4722    [];
4723flex_pretty_otp5803_msg01(Config) when is_list(Config) ->
4724    %% put(severity,trc),
4725    %% put(dbg,true),
4726    d("flex_pretty_otp5803_msg01 -> entry", []),
4727    ?ACQUIRE_NODES(1, Config),
4728    Conf = flex_scanner_conf(Config),
4729    ok = ticket_pretty_decode_encode_ok( pretty_otp5803_msg1(), [Conf] ),
4730    %% erase(severity),
4731    %% erase(dbg),
4732    ok.
4733
4734flex_pretty_otp5803_msg02(suite) ->
4735    [];
4736flex_pretty_otp5803_msg02(Config) when is_list(Config) ->
4737    %% put(severity,trc),
4738    %% put(dbg,true),
4739    d("flex_pretty_otp5803_msg02 -> entry", []),
4740    ?ACQUIRE_NODES(1, Config),
4741    Conf = flex_scanner_conf(Config),
4742    ok = ticket_pretty_decode_encode_ok( pretty_otp5803_msg2(), [Conf] ),
4743    %% erase(severity),
4744    %% erase(dbg),
4745    ok.
4746
4747
4748%% --------------------------------------------------------------
4749%%
4750flex_pretty_otp5805_msg01(suite) ->
4751    [];
4752flex_pretty_otp5805_msg01(Config) when is_list(Config) ->
4753    %% put(severity,trc),
4754    %% put(dbg,true),
4755    d("flex_pretty_otp5805_msg01 -> entry", []),
4756    ?ACQUIRE_NODES(1, Config),
4757    Conf = flex_scanner_conf(Config),
4758    ok = ticket_pretty_decode_error( pretty_otp5805_msg1(), [Conf] ),
4759    %% erase(severity),
4760    %% erase(dbg),
4761    ok.
4762
4763
4764%% --------------------------------------------------------------
4765%%
4766flex_pretty_otp5836_msg01(suite) ->
4767    [];
4768flex_pretty_otp5836_msg01(Config) when is_list(Config) ->
4769    %% put(severity,trc),
4770    %% put(dbg,true),
4771    d("flex_pretty_otp5836_msg01 -> entry", []),
4772    ?ACQUIRE_NODES(1, Config),
4773    Conf = flex_scanner_conf(Config),
4774    ok = ticket_pretty_encode_decode_ok( compact_otp5836_msg1(), [Conf] ),
4775    %% erase(severity),
4776    %% erase(dbg),
4777    ok.
4778
4779
4780flex_pretty_otp7431_msg01(suite) ->
4781    [];
4782flex_pretty_otp7431_msg01(Config) when is_list(Config) ->
4783    d("flex_pretty_otp7431_msg01 -> entry", []),
4784    ?ACQUIRE_NODES(1, Config),
4785    Conf = flex_scanner_conf(Config),
4786    flex_pretty_otp7431(ok, flex_pretty_otp7431_msg1(), [Conf]).
4787
4788flex_pretty_otp7431_msg02(suite) ->
4789    [];
4790flex_pretty_otp7431_msg02(Config) when is_list(Config) ->
4791    %%     put(severity,trc),
4792    %%     put(dbg,true),
4793    d("flex_pretty_otp7431_msg02 -> entry", []),
4794    ?ACQUIRE_NODES(1, Config),
4795    Conf = flex_scanner_conf(Config),
4796    flex_pretty_otp7431(error, flex_pretty_otp7431_msg2(), [Conf]).
4797
4798flex_pretty_otp7431_msg03(suite) ->
4799    [];
4800flex_pretty_otp7431_msg03(Config) when is_list(Config) ->
4801    %%     put(severity,trc),
4802    %%     put(dbg,true),
4803    d("flex_pretty_otp7431_msg03 -> entry", []),
4804    ?ACQUIRE_NODES(1, Config),
4805    Conf = flex_scanner_conf(Config),
4806    flex_pretty_otp7431(error, flex_pretty_otp7431_msg3(), [Conf]).
4807
4808flex_pretty_otp7431_msg04(suite) ->
4809    [];
4810flex_pretty_otp7431_msg04(Config) when is_list(Config) ->
4811    d("flex_pretty_otp7431_msg04 -> entry", []),
4812    ?ACQUIRE_NODES(1, Config),
4813    Conf = flex_scanner_conf(Config),
4814    flex_pretty_otp7431(error, flex_pretty_otp7431_msg4(), [Conf]).
4815
4816flex_pretty_otp7431_msg05(suite) ->
4817    [];
4818flex_pretty_otp7431_msg05(Config) when is_list(Config) ->
4819    d("flex_pretty_otp7431_msg05 -> entry", []),
4820    ?ACQUIRE_NODES(1, Config),
4821    Conf = flex_scanner_conf(Config),
4822    flex_pretty_otp7431(error, flex_pretty_otp7431_msg5(), [Conf]).
4823
4824flex_pretty_otp7431_msg06(suite) ->
4825    [];
4826flex_pretty_otp7431_msg06(Config) when is_list(Config) ->
4827    d("flex_pretty_otp7431_msg06 -> entry", []),
4828    ?ACQUIRE_NODES(1, Config),
4829    Conf = flex_scanner_conf(Config),
4830    flex_pretty_otp7431(error, flex_pretty_otp7431_msg6(), [Conf]).
4831
4832flex_pretty_otp7431_msg07(suite) ->
4833    [];
4834flex_pretty_otp7431_msg07(Config) when is_list(Config) ->
4835    d("flex_pretty_otp7431_msg07 -> entry", []),
4836    ?ACQUIRE_NODES(1, Config),
4837    Conf = flex_scanner_conf(Config),
4838    flex_pretty_otp7431(error, flex_pretty_otp7431_msg7(), [Conf]).
4839
4840flex_pretty_otp7431(Expected, Msg, Conf) ->
4841    otp7431(Expected, megaco_pretty_text_encoder, Msg, Conf).
4842
4843otp7431(Expected, Codec, Msg0, Conf0) ->
4844    Bin0 = list_to_binary(Msg0),
4845    Conf = [?EC_V3|Conf0],
4846    case decode_message(Codec, false, Conf, Bin0) of
4847	{ok, _Msg1} when Expected =:= ok ->
4848 	    io:format(" decoded", []);
4849	{error, {bad_property_parm, Reason}} when (Expected =:= error) andalso
4850						  is_list(Reason) ->
4851	    io:format("expected result: ~s", [Reason]),
4852	    ok;
4853	Else ->
4854	    io:format("unexpected result", []),
4855	    exit({unexpected_decode_result, Else})
4856    end.
4857
4858
4859flex_pretty_otp7431_msg1() ->
4860    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4861   Context = 2000 {
4862	       Add = A4444,
4863	       Add = A4445 {
4864		       Media {
4865			 Stream = 1 {
4866				    Local {
4867				      v=0
4868				      o=- 2890844526 2890842807 IN IP4 124.124.124.222
4869				      s=-
4870				      t= 0 0
4871				      c=IN IP4 124.124.124.222
4872				      m=audio 2222 RTP/AVP 4
4873				      a=ptime:30
4874				      a=recvonly
4875				     } ; RTP profile for G.723.1 is 4
4876				   }
4877			}
4878		      }
4879	      }
4880       }".
4881
4882flex_pretty_otp7431_msg2() ->
4883    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4884   Context = 2000 {
4885	       Add = A4444,
4886	       Add = A4445 {
4887		       Media {
4888			 Stream = 1 {
4889				    Local {
4890				      v=0
4891				      o=- 2890844526 2890842807 IN IP4 124.124.124.222
4892				      s=-
4893				      t= 0 0
4894				      c=IN IP4 124.124.124.222
4895				      m=audio 2222 RTP/AVP 4
4896				      a=ptime:30
4897				      a=             }
4898				   }
4899			}
4900		      }
4901	      }
4902       }".
4903
4904flex_pretty_otp7431_msg3() ->
4905    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4906   Context = 2000 {
4907	       Add = A4444,
4908	       Add = A4445 {
4909		       Media {
4910			 Stream = 1 {
4911				    Local {
4912				      v=0
4913				      o=- 2890844526 2890842807 IN IP4 124.124.124.222
4914				      s=-
4915				      t= 0 0
4916				      c=IN IP4 124.124.124.222
4917				      m=audio 2222 RTP/AVP 4
4918				      a=ptime:30
4919				      a             }
4920				   }
4921			}
4922		      }
4923	      }
4924       }".
4925
4926flex_pretty_otp7431_msg4() ->
4927    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4928   Context = 2000 {
4929	       Add = A4444,
4930	       Add = A4445 {
4931		       Media {
4932			 Stream = 1 {
4933				    Local {
4934				      v=0
4935				      o=- 2890844526 2890842807 IN IP4 124.124.124.222
4936				      s=-
4937				      t= 0 0
4938				      c=IN IP4 124.124.124.222
4939				      m=audio 2222 RTP/AVP 4
4940				      a=ptime:30
4941				      a}
4942				   }
4943			}
4944		      }
4945	      }
4946       }".
4947
4948flex_pretty_otp7431_msg5() ->
4949    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4950   Context = 2000 {
4951	       Add = A4444,
4952	       Add = A4445 {
4953		       Media {
4954			 Stream = 1 {
4955				    Local {
4956				      v=            }
4957				   }
4958			}
4959		      }
4960	      }
4961       }".
4962
4963flex_pretty_otp7431_msg6() ->
4964    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4965   Context = 2000 {
4966	       Add = A4444,
4967	       Add = A4445 {
4968		       Media {
4969			 Stream = 1 {
4970				    Local {
4971				      v            }
4972				   }
4973			}
4974		      }
4975	      }
4976       }".
4977
4978flex_pretty_otp7431_msg7() ->
4979    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
4980   Context = 2000 {
4981	       Add = A4444,
4982	       Add = A4445 {
4983		       Media {
4984			 Stream = 1 {
4985				    Local {
4986				      v}
4987				   }
4988			}
4989		      }
4990	      }
4991       }".
4992
4993
4994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4995
4996msgs() ->
4997    [M || {_, M, _, _} <- msgs(text)].
4998
4999msgs(Encoding) ->
5000    msgs1a(Encoding) ++
5001	msgs1b(Encoding) ++
5002	msgs3525(Encoding) ++
5003	msgs5(Encoding) ++
5004	msgs6(Encoding) ++
5005	msgs7(Encoding) ++
5006	msgs8(Encoding).
5007
5008msgs1a(_) ->
5009    Plain =
5010	fun(Codec, DD, Ver, EC, M) ->
5011		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5012							  EC, M)
5013	end,
5014    [
5015     {msg01a, msg1a(),  Plain, [{dbg,false}]},
5016     {msg01b, msg1b(),  Plain, [{dbg,false}]},
5017     {msg02,  msg2(),   Plain, [{dbg,false}]},
5018     {msg03,  msg3(),   Plain, [{dbg,false}]},
5019     {msg04,  msg4(),   Plain, [{dbg,false}]},
5020     {msg05,  msg5(),   Plain, [{dbg,false}]},
5021     {msg06a, msg6a(),  Plain, [{dbg,false}]},
5022     {msg06b, msg6b(),  Plain, [{dbg,false}]},
5023     {msg07,  msg7(),   Plain, [{dbg,false}]},
5024     {msg08a, msg8a(),  Plain, [{dbg,false}]},
5025     {msg08b, msg8b(),  Plain, [{dbg,false}]},
5026     {msg09,  msg9(),   Plain, [{dbg,false}]},
5027     {msg10,  msg10(),  Plain, [{dbg,false}]},
5028     {msg11,  msg11(),  Plain, [{dbg,false}]},
5029     {msg12,  msg12(),  Plain, [{dbg,false}]},
5030     {msg13,  msg13(),  Plain, [{dbg,false}]},
5031     {msg14,  msg14(),  Plain, [{dbg,false}]},
5032     {msg15,  msg15(),  Plain, [{dbg,false}]},
5033     {msg16,  msg16(),  Plain, [{dbg,false}]},
5034     {msg17,  msg17(),  Plain, [{dbg,false}]},
5035     {msg18,  msg18(),  Plain, [{dbg,false}]},
5036     {msg19,  msg19(),  Plain, [{dbg,false}]},
5037     {msg20,  msg20(),  Plain, [{dbg,false}]},
5038     {msg21,  msg21(),  Plain, [{dbg,false}]},
5039     {msg22a, msg22a(), Plain, [{dbg,false}]},
5040     {msg22b, msg22b(), Plain, [{dbg,false}]},
5041     {msg22c, msg22c(), Plain, [{dbg,false}]},
5042     {msg22d, msg22d(), Plain, [{dbg,false}]},
5043     {msg22e, msg22e(), Plain, [{dbg,false}]},
5044     {msg22f, msg22f(), Plain, [{dbg,false}]},
5045     {msg23a, msg23a(), Plain, [{dbg,false}]},
5046     {msg23b, msg23b(), Plain, [{dbg,false}]},
5047     {msg23c, msg23c(), Plain, [{dbg,false}]},
5048     {msg23d, msg23d(), Plain, [{dbg,false}]},
5049     {msg24,  msg24(),  Plain, [{dbg,false}]},
5050     {msg25,  msg25(),  Plain, [{dbg,false}]},
5051     {msg30a, msg30a(), Plain, [{dbg,false}]},
5052     {msg30b, msg30b(), Plain, [{dbg,false}]},
5053     {msg30c, msg30c(), Plain, [{dbg,false}]},
5054     {msg30d, msg30d(), Plain, [{dbg,false}]}
5055    ].
5056
5057
5058msgs1b(_) ->
5059    TransFirst =
5060	fun(Codec, DD, Ver, EC, M) ->
5061		megaco_codec_test_lib:trans_first_encode_decode(Codec, DD,
5062								Ver, EC, M)
5063	end,
5064    ActionsFirst =
5065	fun(Codec, DD, Ver, EC, M) ->
5066		megaco_codec_test_lib:actions_first_encode_decode(Codec, DD,
5067								  Ver, EC, M)
5068	end,
5069    ActionFirst =
5070	fun(Codec, DD, Ver, EC, M) ->
5071		megaco_codec_test_lib:action_first_encode_decode(Codec, DD,
5072								 Ver, EC, M)
5073	end,
5074    [
5075     {msg01a_tf,  msg1a(),  TransFirst,   [{dbg,false}]},
5076     {msg02_tf,   msg2(),   TransFirst,   [{dbg,false}]},
5077     {msg10_tf,   msg10(),  TransFirst,   [{dbg,false}]},
5078     {msg11_tf,   msg11(),  TransFirst,   [{dbg,false}]},
5079     {msg23d_tf,  msg23d(), TransFirst,   [{dbg,false}]},
5080     {msg30b_tf,  msg30b(), TransFirst,   [{dbg,false}]},
5081     {msg30c_tf,  msg30c(), TransFirst,   [{dbg,false}]},
5082     {msg01a_asf, msg1a(),  ActionsFirst, [{dbg,false}]},
5083     {msg02_asf,  msg2(),   ActionsFirst, [{dbg,false}]},
5084     {msg10_asf,  msg10(),  ActionsFirst, [{dbg,false}]},
5085     {msg23d_asf, msg23d(), ActionsFirst, [{dbg,false}]},
5086     {msg01a_af,  msg1a(),  ActionFirst,  [{dbg,false}]},
5087     {msg02_af,   msg2(),   ActionFirst,  [{dbg,false}]},
5088     {msg10_af,   msg10(),  ActionFirst,  [{dbg,false}]},
5089     {msg23d_af,  msg23d(), ActionFirst,  [{dbg,false}]}
5090    ].
5091
5092
5093msgs3525(_) ->
5094    Plain =
5095	fun(Codec, DD, Ver, EC, M) ->
5096		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5097							  EC, M)
5098	end,
5099    [{msgs3_name(Name), rfc3525_decode(M), Plain, [{dbg, false}]} ||
5100	{Name, M} <- rfc3525_msgs()].
5101
5102msgs3_name(N) ->
5103    list_to_atom("rfc3525_" ++ atom_to_list(N)).
5104
5105rfc3525_decode(M) when is_list(M) ->
5106    rfc3525_decode(list_to_binary(M));
5107rfc3525_decode(M) when is_binary(M) ->
5108    case (catch decode_message(megaco_pretty_text_encoder, false, ?EC, M)) of
5109	{ok, Msg} ->
5110	    Msg;
5111	Error ->
5112	    {error, {rfc3525_decode_error, Error}}
5113    end.
5114
5115
5116msgs5(_) ->
5117    Plain =
5118	fun(Codec, DD, Ver, EC, M) ->
5119		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5120							  EC, M)
5121	end,
5122    [
5123     {msg51a, msg51a(), Plain, [{dbg, false}]},
5124     {msg51b, msg51b(), Plain, [{dbg, false}]},
5125     {msg51c, msg51c(), Plain, [{dbg, false}]},
5126     {msg51d, msg51d(), Plain, [{dbg, false}]},
5127     {msg51e, msg51e(), Plain, [{dbg, false}]},
5128     {msg51f, msg51f(), Plain, [{dbg, false}]},
5129     {msg51g, msg51g(), Plain, [{dbg, false}]},
5130     {msg51h, msg51h(), Plain, [{dbg, false}]},
5131     {msg51i, msg51i(), Plain, [{dbg, false}]},
5132     {msg52,  msg52(),  Plain, [{dbg, false}]},
5133     {msg53,  msg53(),  Plain, [{dbg, false}]},
5134     {msg54a, msg54a(), Plain, [{dbg, false}]},
5135     {msg54b, msg54b(), Plain, [{dbg, false}]},
5136     {msg54c, msg54c(), Plain, [{dbg, false}]},
5137     {msg55,  msg55(),  Plain, [{dbg, false}]},
5138     {msg56,  msg56(),  Plain, [{dbg, false}]},
5139     {msg57,  msg57(),  Plain, [{dbg, false}]},
5140     {msg58a, msg58a(), Plain, [{dbg, false}]},
5141     {msg58b, msg58b(), Plain, [{dbg, false}]}
5142    ].
5143
5144
5145msgs6(Encoding) ->
5146    Plain =
5147	fun(Codec, DD, Ver, EC, M) ->
5148		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5149							  EC, M)
5150	end,
5151
5152    PlainEDFail =
5153	fun(Codec, DD, Ver, EC, M) ->
5154		Res =
5155		    megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5156							      EC, M),
5157		case Res of
5158		    {error, {message_encode_failed, Reason, _M}} ->
5159			case Reason of
5160			    {error, {{deprecated, _}, _}} ->
5161				ok;
5162			    _ ->
5163				Res
5164			end;
5165		    _ ->
5166			Res
5167		end
5168	end,
5169
5170    PlainDE =
5171	fun(Codec, _DD, Ver, EC, B) ->
5172		Res =
5173		    megaco_codec_test_lib:decode_message(Codec, false, Ver,
5174							 EC, B),
5175		case Res of
5176		    {ok, M} ->
5177			#'MegacoMessage'{mess = Mess} = M,
5178			#'Message'{messageBody = {transactions, TRs}} = Mess,
5179			[{transactionRequest, TR}] = TRs,
5180			#'TransactionRequest'{actions = Actions} = TR,
5181			[Action] = Actions,
5182			#'ActionRequest'{commandRequests = CmdReqs} = Action,
5183			[CmdReq] = CmdReqs,
5184			#'CommandRequest'{command = Cmd} = CmdReq,
5185			{addReq,AmmReq} = Cmd,
5186			#'AmmRequest'{descriptors = []} = AmmReq,
5187			ok;
5188		    _ ->
5189			Res
5190		end
5191	end,
5192
5193    Msgs =
5194	[
5195	 {msg61a, msg61a(), Plain,       [{dbg,false}],[text,binary,erlang]},
5196	 {msg61b, msg61b(), Plain,       [{dbg,false}],[text,binary,erlang]},
5197	 {msg61c, msg61c(), Plain,       [{dbg,false}],[text,binary,erlang]},
5198	 {msg62a, msg62a(), PlainEDFail, [{dbg,false}],[text,binary,erlang]},
5199	 {msg62b, msg62b(), PlainDE,     [{dbg,false}],[text]}
5200	],
5201    [{N,M,F,C}||{N,M,F,C,E} <- Msgs,lists:member(Encoding,E)].
5202
5203
5204msgs7(Encoding) ->
5205    Plain =
5206	fun(Codec, DD, Ver, EC, M) ->
5207		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5208							  EC, M)
5209	end,
5210
5211    Msgs =
5212	[
5213  	 {msg71a,   msg71a(),   Plain, [{dbg,false}],[text,binary,erlang]},
5214  	 {msg71b01, msg71b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5215  	 {msg71b02, msg71b02(), Plain, [{dbg,false}],[text,binary,erlang]},
5216  	 {msg71b03, msg71b03(), Plain, [{dbg,false}],[text,binary,erlang]},
5217  	 {msg71b04, msg71b04(), Plain, [{dbg,false}],[text,binary,erlang]},
5218  	 {msg71b05, msg71b05(), Plain, [{dbg,false}],[text,binary,erlang]},
5219  	 {msg71b06, msg71b06(), Plain, [{dbg,false}],[text,binary,erlang]},
5220  	 {msg71b07, msg71b07(), Plain, [{dbg,false}],[text,binary,erlang]},
5221  	 {msg71b08, msg71b08(), Plain, [{dbg,false}],[text,binary,erlang]},
5222  	 {msg71b09, msg71b09(), Plain, [{dbg,false}],[text,binary,erlang]},
5223     	 {msg71b10, msg71b10(), Plain, [{dbg,false}],[text,binary,erlang]},
5224     	 {msg71b11, msg71b11(), Plain, [{dbg,false}],[text,binary,erlang]},
5225     	 {msg71b12, msg71b12(), Plain, [{dbg,false}],[text,binary,erlang]},
5226     	 {msg71b13, msg71b13(), Plain, [{dbg,false}],[text,binary,erlang]},
5227     	 {msg71b14, msg71b14(), Plain, [{dbg,false}],[text,binary,erlang]},
5228     	 {msg71b15, msg71b15(), Plain, [{dbg,false}],[text,binary,erlang]},
5229     	 {msg71b16, msg71b16(), Plain, [{dbg,false}],[text,binary,erlang]},
5230     	 {msg71b17, msg71b17(), Plain, [{dbg,false}],[text,binary,erlang]},
5231     	 {msg71b18, msg71b18(), Plain, [{dbg,false}],[text,binary,erlang]},
5232     	 {msg71b19, msg71b19(), Plain, [{dbg,false}],[text,binary,erlang]},
5233     	 {msg71b20, msg71b20(), Plain, [{dbg,false}],[text,binary,erlang]},
5234     	 {msg71b21, msg71b21(), Plain, [{dbg,false}],[text,binary,erlang]},
5235     	 {msg71b22, msg71b22(), Plain, [{dbg,false}],[text,binary,erlang]},
5236     	 {msg71c01, msg71c01(), Plain, [{dbg,false}],[text,binary,erlang]},
5237     	 {msg71c02, msg71c02(), Plain, [{dbg,false}],[text,binary,erlang]},
5238     	 {msg71c03, msg71c03(), Plain, [{dbg,false}],[text,binary,erlang]},
5239     	 {msg71c04, msg71c04(), Plain, [{dbg,false}],[text,binary,erlang]},
5240     	 {msg71c05, msg71c05(), Plain, [{dbg,false}],[text,binary,erlang]},
5241     	 {msg71c06, msg71c06(), Plain, [{dbg,false}],[text,binary,erlang]},
5242     	 {msg71c07, msg71c07(), Plain, [{dbg,false}],[text,binary,erlang]},
5243     	 {msg71c08, msg71c08(), Plain, [{dbg,false}],[text,binary,erlang]},
5244   	 {msg71c09, msg71c09(), Plain, [{dbg,false}],[text,binary,erlang]},
5245   	 {msg71c10, msg71c10(), Plain, [{dbg,false}],[text,binary,erlang]},
5246   	 {msg71c11, msg71c11(), Plain, [{dbg,false}],[text,binary,erlang]},
5247   	 {msg71c12, msg71c12(), Plain, [{dbg,false}],[text,binary,erlang]},
5248   	 {msg71c13, msg71c13(), Plain, [{dbg,false}],[text,binary,erlang]},
5249   	 {msg71c14, msg71c14(), Plain, [{dbg,false}],[text,binary,erlang]},
5250   	 {msg71c15, msg71c15(), Plain, [{dbg,false}],[text,binary,erlang]},
5251     	 {msg71d01, msg71d01(), Plain, [{dbg,false}],[text,binary,erlang]},
5252     	 {msg71d02, msg71d02(), Plain, [{dbg,false}],[text,binary,erlang]},
5253     	 {msg71d03, msg71d03(), Plain, [{dbg,false}],[text,binary,erlang]},
5254     	 {msg71d04, msg71d04(), Plain, [{dbg,false}],[text,binary,erlang]},
5255     	 {msg72a01, msg72a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5256     	 {msg72a02, msg72a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5257     	 {msg72a03, msg72a03(), Plain, [{dbg,false}],[text,binary,erlang]},
5258     	 {msg72b01, msg72b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5259     	 {msg72b02, msg72b02(), Plain, [{dbg,false}],[text,binary,erlang]},
5260     	 {msg72b03, msg72b03(), Plain, [{dbg,false}],[text,binary,erlang]},
5261     	 {msg72b04, msg72b04(), Plain, [{dbg,false}],[text,binary,erlang]},
5262     	 {msg72c01, msg72c01(), Plain, [{dbg,false}],[text,binary,erlang]},
5263     	 {msg72c02, msg72c02(), Plain, [{dbg,false}],[text,binary,erlang]},
5264     	 {msg72c03, msg72c03(), Plain, [{dbg,false}],[text,binary,erlang]},
5265     	 {msg72c04, msg72c04(), Plain, [{dbg,false}],[text,binary,erlang]},
5266     	 {msg73a,   msg73a(),   Plain, [{dbg,false}],[text,binary,erlang]},
5267     	 {msg73b01, msg73b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5268     	 {msg73b02, msg73b02(), Plain, [{dbg,false}],[text,binary,erlang]},
5269     	 {msg73c01, msg73c01(), Plain, [{dbg,false}],[text,binary,erlang]},
5270     	 {msg73c02, msg73c02(), Plain, [{dbg,false}],[text,binary,erlang]},
5271     	 {msg74a01, msg74a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5272     	 {msg74a02, msg74a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5273     	 {msg74a03, msg74a03(), Plain, [{dbg,false}],[text,binary,erlang]},
5274     	 {msg74a04, msg74a04(), Plain, [{dbg,false}],[text,binary,erlang]},
5275     	 {msg74a05, msg74a05(), Plain, [{dbg,false}],[text,binary,erlang]},
5276     	 {msg74a06, msg74a06(), Plain, [{dbg,false}],[text,binary,erlang]},
5277     	 {msg75a01, msg75a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5278     	 {msg75a02, msg75a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5279     	 {msg76a01, msg76a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5280     	 {msg76a02, msg76a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5281     	 {msg76b01, msg76b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5282  	 %% {msg76b02, msg76b02(), Plain, [{dbg,true}],[text,binary,erlang]},
5283     	 {msg77a01, msg77a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5284     	 {msg78a01, msg78a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5285     	 {msg78a02, msg78a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5286     	 {msg78a03, msg78a03(), Plain, [{dbg,false}],[text,binary,erlang]},
5287     	 {msg78a04, msg78a04(), Plain, [{dbg,false}],[text,binary,erlang]},
5288     	 {msg78a05, msg78a05(), Plain, [{dbg,false}],[text,binary,erlang]},
5289     	 {msg78a06, msg78a06(), Plain, [{dbg,false}],[text,binary,erlang]},
5290     	 {msg78a07, msg78a07(), Plain, [{dbg,false}],[text,binary,erlang]},
5291     	 {msg78a08, msg78a08(), Plain, [{dbg,false}],[text,binary,erlang]},
5292     	 {msg78a09, msg78a09(), Plain, [{dbg,false}],[text,binary,erlang]},
5293  	 {msg79a01, msg79a01(), Plain, [{dbg,true}],[text,binary,erlang]}
5294	],
5295    [{N,M,F,C}||{N,M,F,C,E} <- Msgs,lists:member(Encoding,E)].
5296
5297
5298msgs8(Encoding) ->
5299    Plain =
5300	fun(Codec, DD, Ver, EC, M) ->
5301		megaco_codec_test_lib:plain_encode_decode(Codec, DD, Ver,
5302							  EC, M)
5303	end,
5304
5305    Msgs =
5306	[
5307   	 {msg80a01, msg80a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5308    	 {msg80a02, msg80a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5309    	 {msg80a03, msg80a03(), Plain, [{dbg,false}],[text,binary,erlang]},
5310    	 {msg80b01, msg80b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5311    	 {msg80b02, msg80b02(), Plain, [{dbg,false}],[text,binary,erlang]},
5312    	 {msg80b03, msg80b03(), Plain, [{dbg,false}],[text,binary,erlang]},
5313    	 {msg81a01, msg81a01(), Plain, [{dbg,false}],[text,binary,erlang]},
5314    	 {msg81a02, msg81a02(), Plain, [{dbg,false}],[text,binary,erlang]},
5315   	 {msg81a03, msg81a03(), Plain, [{dbg,false}],[text,binary,erlang]},
5316    	 {msg81b01, msg81b01(), Plain, [{dbg,false}],[text,binary,erlang]},
5317    	 {msg81b02, msg81b02(), Plain, [{dbg,false}],[text,binary,erlang]},
5318    	 {msg81b03, msg81b03(), Plain, [{dbg,false}],[text,binary,erlang]}
5319	],
5320    [{N,M,F,C}||{N,M,F,C,E} <- Msgs,lists:member(Encoding,E)].
5321
5322
5323
5324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5325
5326msg_actions([], Actions) ->
5327    lists:reverse(Actions);
5328msg_actions([{CtxId, CmdReqs}|ActionInfo], Actions) ->
5329    Action = ?MSG_LIB:cre_ActionRequest(CtxId,CmdReqs),
5330    msg_actions(ActionInfo, [Action|Actions]).
5331
5332megaco_trans_req([], Transactions) ->
5333    {transactions, lists:reverse(Transactions)};
5334megaco_trans_req([{TransId, ActionInfo}|TransInfo], Transactions) ->
5335    Actions = msg_actions(ActionInfo, []),
5336    TR      = ?MSG_LIB:cre_TransactionRequest(TransId, Actions),
5337    Trans   = ?MSG_LIB:cre_Transaction(TR),
5338    megaco_trans_req(TransInfo, [Trans|Transactions]).
5339
5340megaco_message(Version, Mid, Body) ->
5341    Mess = ?MSG_LIB:cre_Message(Version, Mid, Body),
5342    cre_MegacoMessage(Mess).
5343
5344msg_request(Mid, TransInfo) ->
5345    TransReq = megaco_trans_req(TransInfo, []),
5346    megaco_message(?VERSION, Mid, TransReq).
5347
5348msg_request(Mid, TransId, ContextId, CmdReq) ->
5349    Action  = ?MSG_LIB:cre_ActionRequest(ContextId, CmdReq),
5350    Actions = [Action],
5351    TR      = ?MSG_LIB:cre_TransactionRequest(TransId, Actions),
5352    Trans   = ?MSG_LIB:cre_Transaction(TR),
5353    Mess    = ?MSG_LIB:cre_Message(?VERSION, Mid, [Trans]),
5354    cre_MegacoMessage(Mess).
5355
5356msg_request(Auth, Mid, TransId, ContextId, CmdReq) ->
5357    Action  = ?MSG_LIB:cre_ActionRequest(ContextId, CmdReq),
5358    Actions = [Action],
5359    TR      = ?MSG_LIB:cre_TransactionRequest(TransId, Actions),
5360    Trans   = ?MSG_LIB:cre_Transaction(TR),
5361    Mess    = ?MSG_LIB:cre_Message(?VERSION, Mid, [Trans]),
5362    cre_MegacoMessage(Auth, Mess).
5363
5364msg_reply(Mid, TransId, Actions) ->
5365    TR    = cre_TransRep(TransId, Actions),
5366    Trans = ?MSG_LIB:cre_Transaction(TR),
5367    Mess  = ?MSG_LIB:cre_Message(?VERSION, Mid, [Trans]),
5368    cre_MegacoMessage(Mess).
5369
5370msg_reply(Mid, TransId, ContextId, CmdReply) ->
5371    Action  = cre_ActRep(ContextId, CmdReply),
5372    Actions = [Action],
5373    msg_reply(Mid, TransId, Actions).
5374
5375msg_ack(Mid, [Range|_] = Ranges) when is_tuple(Range) ->
5376    msg_ack(Mid, [Ranges]);
5377
5378msg_ack(Mid, Ranges) ->
5379    %% TRAs = make_tras(Ranges, []),
5380    TRAs = make_tras(Ranges),
5381    Req  = {transactions, TRAs},
5382    cre_MegacoMessage(?VERSION, Mid, Req).
5383
5384make_tras(TRARanges) ->
5385    F = fun(R) -> {transactionResponseAck, make_tra(R)} end,
5386    lists:map(F, TRARanges).
5387
5388make_tra(Ranges) ->
5389    F = fun({F,L}) -> cre_TransAck(F,L) end,
5390    lists:map(F, Ranges).
5391
5392
5393%% -------------------------------------------------------------------------
5394
5395
5396msg1(Mid, Tid) ->
5397    Gain  = cre_PropParm("tdmc/gain", "2"),
5398    Ec    = cre_PropParm("tdmc/ec", "g165"),
5399    LCD   = cre_LocalControlDesc(sendRecv,[Gain, Ec]),
5400    V     = cre_PropParm("v", "0"),
5401    %% C    = cre_PropParm("c", "IN IP4 $ "),
5402    C     = cre_PropParm("c", [$I,$N,$ ,$I,$P,$4,$ ,$$,$ ]),
5403    M     = cre_PropParm("m", "audio $ RTP/AVP 0"),
5404    A     = cre_PropParm("a", "fmtp:PCMU VAD=X-NNVAD"),
5405    LD    = cre_LocalRemoteDesc([[V, C, M, A]]),
5406    Parms = cre_StreamParms(LCD,LD),
5407    StreamDesc = cre_StreamDesc(1,Parms),
5408    MediaDesc  = cre_MediaDesc(StreamDesc),
5409    ReqEvent   = cre_ReqEv("al/of"),
5410    EventsDesc = cre_EvsDesc(2222,[ReqEvent]),
5411    AmmReq     = cre_AmmReq([#megaco_term_id{id = Tid}],
5412			    [{mediaDescriptor, MediaDesc},
5413			     {eventsDescriptor, EventsDesc}]),
5414    CmdReq     = cre_CmdReq({modReq, AmmReq}),
5415    Msg = msg_request(Mid, 9999, ?megaco_null_context_id, [CmdReq]),
5416    Msg.
5417
5418msg1a() ->
5419    msg1a(?MGC_MID).
5420msg1a(Mid) ->
5421    msg1(Mid, ?A4444).
5422
5423msg1b() ->
5424    msg1b(?MGC_MID).
5425msg1b(Mid) ->
5426    msg1(Mid, ?A4445).
5427
5428
5429%% --------------------------
5430
5431
5432msg2() ->
5433    msg2(?MGC_MID).
5434msg2(Mid) ->
5435    msg2(Mid, ?A4444).
5436msg2(Mid, Tid) ->
5437    Gain  = cre_PropParm("tdmc/gain", "2"),
5438    Ec    = cre_PropParm("tdmc/ec", "g165"),
5439    LCD   = cre_LocalControlDesc(sendRecv,[Gain, Ec]),
5440    V     = cre_PropParm("v", "0"),
5441    %% C    = cre_PropParm("c", "IN IP4 $ "),
5442    C     = cre_PropParm("c", [$I,$N,$ ,$I,$P,$4,$ ,$$,$ ]),
5443    M     = cre_PropParm("m", "audio $ RTP/AVP 0"),
5444    A     = cre_PropParm("a", "fmtp:PCMU VAD=X-NNVAD"),
5445    LD    = cre_LocalRemoteDesc([[V, C, M, A]]),
5446    Parms = cre_StreamParms(LCD,LD),
5447    StreamDesc = cre_StreamDesc(1,Parms),
5448    MediaDesc  = cre_MediaDesc(StreamDesc),
5449    EventParm  = cre_EvParm("strict",["exact"]),
5450    ReqEvent   = cre_ReqEv("al/of", [EventParm]),
5451    EventsDesc = cre_EvsDesc(2222,[ReqEvent]),
5452    AmmReq     = cre_AmmReq([#megaco_term_id{id = Tid}],
5453			    [{mediaDescriptor, MediaDesc},
5454			     {eventsDescriptor, EventsDesc}]),
5455    CmdReq     = cre_CmdReq({modReq, AmmReq}),
5456    msg_request(Mid, 9999, ?megaco_null_context_id, [CmdReq]).
5457
5458
5459%% --------------------------
5460
5461msg3() ->
5462    msg3(?MG1_MID).
5463msg3(Mid) ->
5464    TimeStamp = cre_TimeNot("19990729", "22000000"),
5465    Event     = cre_ObsEv("al/of",TimeStamp),
5466    Desc      = cre_ObsEvsDesc(2222,[Event]),
5467    NotifyReq = cre_NotifyReq([#megaco_term_id{id = ?A4444}],Desc),
5468    CmdReq    = cre_CmdReq({notifyReq, NotifyReq}),
5469    msg_request(Mid, 10000, ?megaco_null_context_id, [CmdReq]).
5470
5471
5472%% --------------------------
5473
5474msg4() ->
5475    msg4(?MG1_MID_NO_PORT, "901 mg col boot").
5476msg4(Mid, Reason) when is_list(Reason) ->
5477    Address = {portNumber, ?DEFAULT_PORT},
5478    Profile = cre_SvcChProf("resgw",1),
5479    Parm    = cre_SvcChParm(restart,Address,[Reason],Profile),
5480    Req     = cre_SvcChReq([?megaco_root_termination_id],Parm),
5481    CmdReq  = cre_CmdReq({serviceChangeReq, Req}),
5482    msg_request(Mid, 9998, ?megaco_null_context_id, [CmdReq]).
5483
5484
5485%% --------------------------
5486
5487msg5() ->
5488    msg5(?MGC_MID).
5489msg5(Mid) ->
5490    Address = {portNumber, ?DEFAULT_PORT},
5491    Profile = cre_SvcChProf("resgw",1),
5492    Parm    = cre_SvcChResParm(Address,Profile),
5493    Reply   = cre_SvcChRep([?megaco_root_termination_id],
5494			   {serviceChangeResParms,Parm}),
5495    msg_reply(Mid, 9998, ?megaco_null_context_id,
5496	      [{serviceChangeReply, Reply}]).
5497
5498
5499%% --------------------------
5500
5501msg6(Mid, Tid) ->
5502    Reply = cre_AmmsReply([#megaco_term_id{id = Tid}]),
5503    msg_reply(Mid, 9999, ?megaco_null_context_id, [{modReply, Reply}]).
5504
5505msg6a() ->
5506    msg6a(?MG1_MID).
5507msg6a(Mid) ->
5508    msg6(Mid, ?A4444).
5509
5510msg6b() ->
5511    msg6b(?MG2_MID).
5512msg6b(Mid) ->
5513    msg6(Mid, ?A5555).
5514
5515
5516%% --------------------------
5517
5518msg7() ->
5519    msg7(?MGC_MID).
5520msg7(Mid) ->
5521    Reply = cre_NotifyRep([#megaco_term_id{id = ?A4444}]),
5522    msg_reply(Mid, 10000, ?megaco_null_context_id, [{notifyReply, Reply}]).
5523
5524
5525%% --------------------------
5526
5527msg8(Mid, DigitMapValue) ->
5528    Strict = cre_EvParm("strict",["state"]),
5529    On     = cre_ReqEv("al/on", [Strict]),
5530    Name   = "dialplan00",
5531    EDM    = cre_EvDM(Name),
5532    Action = cre_ReqActs(EDM),
5533    Ce     = cre_ReqEv("dd/ce", Action),
5534    EventsDesc = cre_EvsDesc(2223, [On, Ce]),
5535    Signal     = cre_Sig("cg/rt"),
5536    DigMapDesc = cre_DigitMapDesc(Name, DigitMapValue),
5537    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A4444}],
5538                           [{eventsDescriptor, EventsDesc},
5539			    {signalsDescriptor, [{signal, Signal}]},
5540			    {digitMapDescriptor, DigMapDesc}]),
5541    CmdReq     = cre_CmdReq({modReq, AmmReq}),
5542    msg_request(Mid, 10001, ?megaco_null_context_id, [CmdReq]).
5543
5544msg8a() ->
5545    msg8a(?MGC_MID).
5546msg8a(Mid) ->
5547    Body = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",
5548    Value = cre_DigitMapValue(Body),
5549    msg8(Mid, Value).
5550
5551msg8b() ->
5552    msg8b(?MGC_MID).
5553msg8b(Mid) ->
5554    Body = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",
5555    Value = cre_DigitMapValue(Body, 1, 23, 99),
5556    msg8(Mid, Value).
5557
5558
5559%% --------------------------
5560
5561msg9() ->
5562    msg9(?MG1_MID).
5563msg9(Mid) ->
5564    TimeStamp = cre_TimeNot("19990729","22010001"),
5565    Parm      = cre_EvParm("ds",["916135551212"]),
5566    Event     = cre_ObsEv("dd/ce",TimeStamp,[Parm]),
5567    Desc      = cre_ObsEvsDesc(2223,[Event]),
5568    NotifyReq = cre_NotifyReq([#megaco_term_id{id = ?A4444}], Desc),
5569    CmdReq    = cre_CmdReq({notifyReq, NotifyReq}),
5570    msg_request(Mid, 10002, ?megaco_null_context_id, [CmdReq]).
5571
5572
5573%% --------------------------
5574
5575msg10() ->
5576    msg10(?MGC_MID).
5577msg10(Mid) ->
5578    AmmReq = cre_AmmReq([#megaco_term_id{id = ?A4444}],[]),
5579    CmdReq = cre_CmdReq({addReq, AmmReq}),
5580    Jit = cre_PropParm("nt/jit", "40"),
5581    LCD = cre_LocalControlDesc(recvOnly,[Jit]),
5582    V   = cre_PropParm("v", "0"),
5583    C   = cre_PropParm("c", "IN IP4 $ "),
5584    M   = cre_PropParm("m", "audio $ RTP/AVP 4"),
5585    A   = cre_PropParm("a", "ptime:30"),
5586    V2  = cre_PropParm("v", "0"),
5587    C2  = cre_PropParm("c", "IN IP4 $ "),
5588    M2  = cre_PropParm("m", "audio $ RTP/AVP 0"),
5589    LD  = cre_LocalRemoteDesc([[V, C, M, A], [V2, C2, M2]]),
5590    Parms      = cre_StreamParms(LCD, LD),
5591    StreamDesc = cre_StreamDesc(1,Parms),
5592    MediaDesc  = cre_MediaDesc(StreamDesc),
5593    ChooseTid  = #megaco_term_id{contains_wildcards = true,
5594				 id = [[?megaco_choose]]},
5595    AmmReq2    = cre_AmmReq([ChooseTid],[{mediaDescriptor, MediaDesc}]),
5596    CmdReq2    = cre_CmdReq({addReq, AmmReq2}),
5597    msg_request(Mid, 10003, ?megaco_choose_context_id, [CmdReq, CmdReq2]).
5598
5599
5600msg11() ->
5601    msg11(?MG1_MID).
5602msg11(Mid) ->
5603    V  = cre_PropParm("v", "0"),
5604    C  = cre_PropParm("c", "IN IP4 124.124.124.222"),
5605    M  = cre_PropParm("m", "audio 2222 RTP/AVP 4"),
5606    A  = cre_PropParm("a", "ptime:30"),
5607    A2 = cre_PropParm("a", "recvonly"),
5608    LD = cre_LocalRemoteDesc([[V, C, M, A, A2]]),
5609    Parms      = cre_StreamParmsL(LD),
5610    StreamDesc = cre_StreamDesc(1, Parms),
5611    MediaDesc  = cre_MediaDesc(StreamDesc),
5612    Reply  = cre_AmmsReply([#megaco_term_id{id = ?A4444}]),
5613    Reply2 = cre_AmmsReply([#megaco_term_id{id = ?A4445}],
5614			   [{mediaDescriptor, MediaDesc}]),
5615    msg_reply(Mid, 10003, 2000, [{addReply, Reply}, {addReply, Reply2}]).
5616
5617
5618%% --------------------------
5619
5620msg12() ->
5621    msg12(?MGC_MID).
5622msg12(Mid) ->
5623    LCD        = cre_LocalControlDesc(sendRecv),
5624    Parms      = cre_StreamParms(LCD),
5625    StreamDesc = cre_StreamDesc(1,Parms),
5626    MediaDesc  = cre_MediaDesc(StreamDesc),
5627    Signal     = cre_Sig("al/ri"),
5628    Descs      = [{mediaDescriptor, MediaDesc},
5629		  {signalsDescriptor, [{signal, Signal}]}],
5630    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A5555}], Descs),
5631    CmdReq     = cre_CmdReq({addReq, AmmReq}),
5632    Jit        = cre_PropParm("nt/jit", "40"),
5633    LCD2       = cre_LocalControlDesc(sendRecv, [Jit]),
5634    V      = cre_PropParm("v", "0"),
5635    C      = cre_PropParm("c", "IN IP4 $ "),
5636    M      = cre_PropParm("m", "audio $ RTP/AVP 4"),
5637    A      = cre_PropParm("a", "ptime:30"),
5638    LD2    = cre_LocalRemoteDesc([[V, C, M, A]]),
5639    V2     = cre_PropParm("v", "0"),
5640    C2     = cre_PropParm("c", "IN IP4 124.124.124.222"),
5641    M2     = cre_PropParm("m", "audio 2222 RTP/AVP 4"),
5642    RD2    = cre_LocalRemoteDesc([[V2, C2, M2]]),
5643    Parms2 = cre_StreamParms(LCD2,LD2,RD2),
5644    StreamDesc2 = cre_StreamDesc(1,Parms2),
5645    MediaDesc2  = cre_MediaDesc(StreamDesc2),
5646    ChooseTid   = #megaco_term_id{contains_wildcards = true,
5647				  id = [[?megaco_choose]]},
5648    AmmReq2     = cre_AmmReq([ChooseTid],[{mediaDescriptor, MediaDesc2}]),
5649    CmdReq2     = cre_CmdReq({addReq, AmmReq2}),
5650    msg_request(Mid, 50003, ?megaco_choose_context_id, [CmdReq, CmdReq2]).
5651
5652
5653%% --------------------------
5654
5655msg13() ->
5656    msg13(?MG2_MID).
5657msg13(Mid) ->
5658    V     = cre_PropParm("v", "0"),
5659    C     = cre_PropParm("c", "IN IP4 125.125.125.111"),
5660    M     = cre_PropParm("m", "audio 1111 RTP/AVP 4"),
5661    LD    = cre_LocalRemoteDesc([[V, C, M]]),
5662    Parms = cre_StreamParmsL(LD),
5663    StreamDesc = cre_StreamDesc(1,Parms),
5664    MediaDesc  = cre_MediaDesc(StreamDesc),
5665    Reply      = cre_AmmsReply([#megaco_term_id{id = ?A5556}],
5666			       [{mediaDescriptor, MediaDesc}]),
5667    msg_reply(Mid, 50003, 5000, [{addReply, Reply}]).
5668
5669
5670%% --------------------------
5671
5672msg14() ->
5673    msg14(?MGC_MID).
5674msg14(Mid) ->
5675    Signal  = cre_Sig("cg/rt"),
5676    AmmReq1 = cre_AmmReq([#megaco_term_id{id = ?A4444}],
5677			[{signalsDescriptor, [{signal, Signal}]}]),
5678    CmdReq1 = cre_CmdReq({modReq, AmmReq1}),
5679
5680    Gain    = cre_PropParm("tdmc/gain", "2"),
5681    Ec      = cre_PropParm("tdmc/ec", "g165"),
5682    LCD     = cre_LocalControlDesc(sendRecv, [Gain, Ec]),
5683    Parms2  = cre_StreamParms(LCD),
5684    StreamDesc2 = cre_StreamDesc(1,Parms2),
5685    MediaDesc2  = cre_MediaDesc(StreamDesc2),
5686    AmmReq2     = cre_AmmReq([#megaco_term_id{id = ?A4445}],
5687			     [{mediaDescriptor, MediaDesc2}]),
5688    CmdReq2     = cre_CmdReq({modReq, AmmReq2}),
5689
5690    V      = cre_PropParm("v", "0"),
5691    C      = cre_PropParm("c", "IN IP4 125.125.125.111"),
5692    M      = cre_PropParm("m", "audio 1111 RTP/AVP 4"),
5693    RD     = cre_LocalRemoteDesc([[V, C, M]]),
5694    Parms3 = cre_StreamParmsR(RD),
5695    StreamDesc3 = cre_StreamDesc(2,Parms3),
5696    MediaDesc3  = cre_MediaDesc(StreamDesc3),
5697    AmmReq3     = cre_AmmReq([#megaco_term_id{id = ?A4445}],
5698			     [{mediaDescriptor, MediaDesc3}]),
5699    CmdReq3     = cre_CmdReq({modReq, AmmReq3}),
5700    msg_request(Mid, 10005, 2000, [CmdReq1, CmdReq2, CmdReq3]).
5701
5702
5703%% --------------------------
5704
5705msg15() ->
5706    msg15(?MG1_MID).
5707msg15(Mid) ->
5708    Reply  = cre_AmmsReply([#megaco_term_id{id = ?A4444}]),
5709    Reply2 = cre_AmmsReply([#megaco_term_id{id = ?A4445}]),
5710    msg_reply(Mid, 10005, 2000, [{modReply, Reply}, {modReply, Reply2}]).
5711
5712
5713%% --------------------------
5714
5715msg16() ->
5716    msg16(?MG2_MID).
5717msg16(Mid) ->
5718    TimeStamp = cre_TimeNot("19990729","22020002"),
5719    Event     = cre_ObsEv("al/of",TimeStamp),
5720    Desc      = cre_ObsEvsDesc(1234,[Event]),
5721    NotifyReq = cre_NotifyReq([#megaco_term_id{id = ?A5555}],Desc),
5722    CmdReq    = cre_CmdReq({notifyReq, NotifyReq}),
5723    msg_request(Mid, 50005, 5000, [CmdReq]).
5724
5725
5726%% --------------------------
5727
5728msg17() ->
5729    msg17(?MGC_MID).
5730msg17(Mid) ->
5731    Reply = cre_NotifyRep([#megaco_term_id{id = ?A5555}]),
5732    msg_reply(Mid, 50005, ?megaco_null_context_id, [{notifyReply, Reply}]).
5733
5734
5735%% --------------------------
5736
5737msg18() ->
5738    msg18(?MGC_MID).
5739msg18(Mid) ->
5740    On         = cre_ReqEv("al/on"),
5741    EventsDesc = cre_EvsDesc(1235,[On]),
5742    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A5555}],
5743			    [{eventsDescriptor, EventsDesc},
5744			     {signalsDescriptor, []}]),
5745    CmdReq     = cre_CmdReq({modReq, AmmReq}),
5746    msg_request(Mid, 50006, 5000, [CmdReq]).
5747
5748
5749%% --------------------------
5750
5751msg19() ->
5752    msg19(?MG2_MID).
5753msg19(Mid) ->
5754    Reply = cre_AmmsReply([#megaco_term_id{id = ?A4445}]),
5755    msg_reply(Mid, 50006, 5000, [{modReply, Reply}]).
5756
5757
5758%% --------------------------
5759
5760msg20() ->
5761    msg20(?MGC_MID).
5762msg20(Mid) ->
5763    LCD        = cre_LocalControlDesc(sendRecv),
5764    Parms      = cre_StreamParms(LCD),
5765    StreamDesc = cre_StreamDesc(1,Parms),
5766    MediaDesc  = cre_MediaDesc(StreamDesc),
5767    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A4445}],
5768			    [{mediaDescriptor, MediaDesc}]),
5769    CmdReq     = cre_CmdReq({modReq, AmmReq}),
5770    AmmReq2    = cre_AmmReq([#megaco_term_id{id = ?A4444}],
5771                            [{signalsDescriptor, []}]),
5772    CmdReq2    = cre_CmdReq({modReq, AmmReq2}),
5773    msg_request(Mid, 10006, 2000, [CmdReq, CmdReq2]).
5774
5775
5776%% --------------------------
5777
5778msg21() ->
5779    msg21(?MGC_MID).
5780msg21(Mid) ->
5781    Tokens    = [mediaToken, eventsToken, signalsToken,
5782		 digitMapToken, statsToken, packagesToken],
5783    AuditDesc = cre_AuditDesc(Tokens),
5784    Req       = cre_AuditReq(#megaco_term_id{id = ?A5556},AuditDesc),
5785    CmdReq    = cre_CmdReq({auditValueRequest, Req}),
5786    msg_request(Mid, 50007, ?megaco_null_context_id, [CmdReq]).
5787
5788
5789%% --------------------------
5790
5791msg22a() ->
5792    msg22(1).
5793
5794msg22b() ->
5795    msg22(10).
5796
5797msg22c() ->
5798    msg22(25).
5799
5800msg22d() ->
5801    msg22(50).
5802
5803msg22e() ->
5804    msg22(75).
5805
5806msg22f() ->
5807    msg22(100).
5808
5809msg22(N) ->
5810    msg22(?MG2_MID, N).
5811msg22(Mid, N) ->
5812    Jit = cre_PropParm("nt/jit", "40"),
5813    LCD = cre_LocalControlDesc(sendRecv,[Jit]),
5814    LDV = cre_PropParm("v", "0"),
5815    LDC = cre_PropParm("c", "IN IP4 125.125.125.111"),
5816    LDM = cre_PropParm("m", "audio 1111 RTP/AVP  4"),
5817    LDA = cre_PropParm("a", "ptime:30"),
5818    LD  = cre_LocalRemoteDesc([[LDV, LDC, LDM, LDA]]),
5819    RDV = cre_PropParm("v", "0"),
5820    RDC = cre_PropParm("c", "IN IP4 124.124.124.222"),
5821    RDM = cre_PropParm("m", "audio 2222 RTP/AVP  4"),
5822    RDA = cre_PropParm("a", "ptime:30"),
5823    RD  = cre_LocalRemoteDesc([[RDV, RDC, RDM, RDA]]),
5824    StreamParms   = cre_StreamParms(LCD,LD,RD),
5825    StreamDesc    = cre_StreamDesc(1,StreamParms),
5826    Media         = cre_MediaDesc(StreamDesc),
5827    PackagesItem  = cre_PkgsItem("nt",1),
5828    PackagesItem2 = cre_PkgsItem("rtp",1),
5829    Stat       = cre_StatsParm("rtp/ps","1200"),
5830    Stat2      = cre_StatsParm("nt/os","62300"),
5831    Stat3      = cre_StatsParm("rtp/pr","700"),
5832    Stat4      = cre_StatsParm("nt/or","45100"),
5833    Stat5      = cre_StatsParm("rtp/pl","0.2"),
5834    Stat6      = cre_StatsParm("rtp/jit","20"),
5835    Stat7      = cre_StatsParm("rtp/delay","40"),
5836    Statistics = [Stat, Stat2, Stat3, Stat4, Stat5, Stat6, Stat7],
5837    Audits     = [{mediaDescriptor, Media},
5838		  {packagesDescriptor, [PackagesItem, PackagesItem2]},
5839		  {statisticsDescriptor, Statistics}],
5840    Reply      = {auditResult,
5841		  cre_AuditRes(#megaco_term_id{id = ?A5556},Audits)},
5842    msg_reply(Mid, 50007, ?megaco_null_context_id,
5843	      lists:duplicate(N,{auditValueReply, Reply})).
5844%%     msg_reply(Mid, 50007, ?megaco_null_context_id,
5845%% 	      lists.duplicate([{auditValueReply, Reply}]).
5846
5847
5848%% --------------------------
5849
5850msg23a() ->
5851    msg23a(?MG2_MID).
5852msg23a(Mid) ->
5853    TimeStamp = cre_TimeNot("19990729","24020002"),
5854    Event     = cre_ObsEv("al/on",TimeStamp),
5855    Desc      = cre_ObsEvsDesc(1235,[Event]),
5856    NotifyReq = cre_NotifyReq([#megaco_term_id{id = ?A5555}],Desc),
5857    CmdReq    = cre_CmdReq({notifyReq, NotifyReq}),
5858    msg_request(Mid, 50008, 5000, [CmdReq]).
5859
5860
5861msg23b() ->
5862    msg23b(?MG2_MID).
5863msg23b(Mid) ->
5864    TimeStamp  = cre_TimeNot("19990729","24020002"),
5865    Event      = cre_ObsEv("al/on",TimeStamp),
5866    Desc       = cre_ObsEvsDesc(1235,[Event]),
5867    NotifyReq1 = cre_NotifyReq([#megaco_term_id{id = ?A5555}],Desc),
5868    CmdReq1    = cre_CmdReq({notifyReq, NotifyReq1}),
5869    NotifyReq2 = cre_NotifyReq([#megaco_term_id{id = ?A5556}],Desc),
5870    CmdReq2    = cre_CmdReq({notifyReq, NotifyReq2}),
5871    ActionInfo = [{5000, [CmdReq1]}, {5001, [CmdReq2]}],
5872    TransInfo  = [{50008, ActionInfo}],
5873    msg_request(Mid, TransInfo).
5874
5875
5876msg23c() ->
5877    msg23c(?MG2_MID).
5878msg23c(Mid) ->
5879    TimeStamp  = cre_TimeNot("19990729","24020002"),
5880    Event      = cre_ObsEv("al/on",TimeStamp),
5881    Desc       = cre_ObsEvsDesc(1235,[Event]),
5882    NotifyReq1 = cre_NotifyReq([#megaco_term_id{id = ?A5555}],Desc),
5883    CmdReq1    = cre_CmdReq({notifyReq, NotifyReq1}),
5884    NotifyReq2 = cre_NotifyReq([#megaco_term_id{id = ?A5556}],Desc),
5885    CmdReq2    = cre_CmdReq({notifyReq, NotifyReq2}),
5886    ActionInfo1 = [{5000, [CmdReq1]}],
5887    ActionInfo2 = [{5001, [CmdReq2]}],
5888    TransInfo   = [{50008, ActionInfo1}, {50009, ActionInfo2}],
5889    msg_request(Mid, TransInfo).
5890
5891
5892msg23d() ->
5893    msg23d(?MG2_MID).
5894msg23d(Mid) ->
5895    TimeStamp  = cre_TimeNot("19990729","24020002"),
5896    Event      = cre_ObsEv("al/on",TimeStamp),
5897    Desc       = cre_ObsEvsDesc(1235,[Event]),
5898    NotifyReq1 = cre_NotifyReq([#megaco_term_id{id = ?A5555}],Desc),
5899    CmdReq1    = cre_CmdReq({notifyReq, NotifyReq1}),
5900    NotifyReq2 = cre_NotifyReq([#megaco_term_id{id = ?A5556}],Desc),
5901    CmdReq2    = cre_CmdReq({notifyReq, NotifyReq2}),
5902    NotifyReq3 = cre_NotifyReq([#megaco_term_id{id = ?A4444}],Desc),
5903    CmdReq3    = cre_CmdReq({notifyReq, NotifyReq3}),
5904    NotifyReq4 = cre_NotifyReq([#megaco_term_id{id = ?A4445}],Desc),
5905    CmdReq4    = cre_CmdReq({notifyReq, NotifyReq4}),
5906    ActionInfo1 = [{5000, [CmdReq1]}, {5001, [CmdReq2]}],
5907    ActionInfo2 = [{5003, [CmdReq3]}, {5004, [CmdReq4]}],
5908    TransInfo   = [{50008, ActionInfo1}, {50009, ActionInfo2}],
5909    msg_request(Mid, TransInfo).
5910
5911
5912%% --------------------------
5913
5914msg24() ->
5915    msg24(?MGC_MID).
5916msg24(Mid) ->
5917    AuditDesc = cre_AuditDesc([statsToken]),
5918    SubReq    = cre_SubReq([#megaco_term_id{id = ?A5555}], AuditDesc),
5919    SubReq2   = cre_SubReq([#megaco_term_id{id = ?A5556}], AuditDesc),
5920    CmdReq    = cre_CmdReq({subtractReq, SubReq}),
5921    CmdReq2   = cre_CmdReq({subtractReq, SubReq2}),
5922    msg_request(Mid, 50009, 5000, [CmdReq, CmdReq2]).
5923
5924
5925%% --------------------------
5926
5927msg25() ->
5928    msg25(?MG2_MID).
5929msg25(Mid) ->
5930    Stat11 = cre_StatsParm("nt/os","45123"),
5931    Stat12 = cre_StatsParm("nt/dur", "40"),
5932    Stats1 = [Stat11, Stat12],
5933    Reply1 = cre_AmmsReply([#megaco_term_id{id = ?A5555}],
5934			   [{statisticsDescriptor, Stats1}]),
5935    Stat21 = cre_StatsParm("rtp/ps","1245"),
5936    Stat22 = cre_StatsParm("nt/os", "62345"),
5937    Stat23 = cre_StatsParm("rtp/pr", "780"),
5938    Stat24 = cre_StatsParm("nt/or", "45123"),
5939    Stat25 = cre_StatsParm("rtp/pl", "10"),
5940    Stat26 = cre_StatsParm("rtp/jit", "27"),
5941    Stat27 = cre_StatsParm("rtp/delay","48"),
5942    Stats2 = [Stat21, Stat22, Stat23, Stat24, Stat25, Stat26, Stat27],
5943    Reply2 = cre_AmmsReply([#megaco_term_id{id = ?A5556}],
5944                          [{statisticsDescriptor, Stats2}]),
5945    msg_reply(Mid, 50009, 5000,
5946	      [{subtractReply, Reply1}, {subtractReply, Reply2}]).
5947
5948
5949msg30a() ->
5950    msg_ack(?MG2_MID, [{9,9}]).
5951
5952msg30b() ->
5953    msg_ack(?MG2_MID, [{9,13}]).
5954
5955msg30c() ->
5956    msg_ack(?MG2_MID,
5957	    [{9,13},   {15,15},  {33,40},  {50,60},  {70,80},  {85,90},
5958	     {101,105},{109,119},{121,130},{140,160},{170,175},{180,189},
5959	     {201,205},{209,219},{221,230},{240,260},{270,275},{280,289},
5960	     {301,305},{309,319},{321,330},{340,360},{370,375},{380,389},
5961	     {401,405},{409,419},{421,430},{440,460},{470,475},{480,489},
5962	     {501,505},{509,519},{521,530},{540,560},{570,575},{580,589}
5963	    ]).
5964
5965%% Don't think this will be used by the megaco stack, but since it
5966%% seem's to be a valid construction...
5967msg30d() ->
5968    msg_ack(?MG2_MID,
5969	    [[{9,13},   {15,15},  {33,40},  {50,60},  {70,80},  {85,90}],
5970	     [{101,105},{109,119},{121,130},{140,160},{170,175},{180,189}],
5971	     [{201,205},{209,219},{221,230},{240,260},{270,275},{280,289}],
5972	     [{301,305},{309,319},{321,330},{340,360},{370,375},{380,389}],
5973	     [{401,405},{409,419},{421,430},{440,460},{470,475},{480,489}],
5974	     [{501,505},{509,519},{521,530},{540,560},{570,575},{580,589}]
5975	    ]).
5976
5977
5978
5979msg40() ->
5980    msg40(?MG1_MID_NO_PORT, "901 mg col boot").
5981msg40(Mid, Reason) when is_list(Reason) ->
5982    Address = {portNumber, ?DEFAULT_PORT},
5983    Profile = cre_SvcChProf("resgw",1),
5984    Parm    = cre_SvcChParm(restart,Address,[Reason],Profile),
5985    Req     = cre_SvcChReq([?megaco_root_termination_id],Parm),
5986    CmdReq  = cre_CmdReq({serviceChangeReq, Req}),
5987    Auth    = cre_AuthHeader(),
5988    msg_request(Auth, Mid, 9998, ?megaco_null_context_id, [CmdReq]).
5989
5990
5991msg50(Mid, APT) ->
5992    AD     = cre_AuditDesc(asn1_NOVALUE, APT),
5993    Req    = cre_AuditReq(#megaco_term_id{id = ?A5556},AD),
5994    CmdReq = cre_CmdReq({auditValueRequest, Req}),
5995    msg_request(Mid, 50007, ?megaco_null_context_id, [CmdReq]).
5996
5997%% IndAudMediaDescriptor:
5998msg51(Mid, IATSDorStream) ->
5999    IAMD   = cre_IndAudMediaDesc(IATSDorStream),
6000    IAP    = cre_IndAudParam(IAMD),
6001    APT    = [IAP],
6002    msg50(Mid, APT).
6003
6004msg51a() ->
6005    msg51a(?MG2_MID).
6006msg51a(Mid) ->
6007    PP    = cre_IndAudPropertyParm("tdmc/gain"),
6008    PPs   = [PP],
6009    IATSD = cre_IndAudTermStateDesc(PPs),
6010    msg51(Mid, IATSD).
6011
6012msg51b() ->
6013    msg51b(?MG2_MID).
6014msg51b(Mid) ->
6015    PP    = cre_IndAudPropertyParm("nt/jit"),
6016    PPs   = [PP],
6017    IATSD = cre_IndAudTermStateDesc(PPs),
6018    msg51(Mid, IATSD).
6019
6020msg51c() ->
6021    msg51c(?MG2_MID).
6022msg51c(Mid) ->
6023    IATSD = cre_IndAudTermStateDesc([], asn1_NOVALUE, 'NULL'),
6024    msg51(Mid, IATSD).
6025
6026msg51d() ->
6027    msg51d(?MG2_MID).
6028msg51d(Mid) ->
6029    IATSD = cre_IndAudTermStateDesc([], 'NULL', asn1_NOVALUE),
6030    msg51(Mid, IATSD).
6031
6032msg51e() ->
6033    msg51e(?MG2_MID).
6034msg51e(Mid) ->
6035    IALCD = cre_IndAudLocalControlDesc('NULL', asn1_NOVALUE,
6036				       asn1_NOVALUE, asn1_NOVALUE),
6037    IASP = cre_IndAudStreamParms(IALCD),
6038    msg51(Mid, IASP).
6039
6040msg51f() ->
6041    msg51f(?MG2_MID).
6042msg51f(Mid) ->
6043    IALCD = cre_IndAudLocalControlDesc(asn1_NOVALUE, 'NULL',
6044				       asn1_NOVALUE, asn1_NOVALUE),
6045    IASP = cre_IndAudStreamParms(IALCD),
6046    msg51(Mid, IASP).
6047
6048msg51g() ->
6049    msg51g(?MG2_MID).
6050msg51g(Mid) ->
6051    IALCD = cre_IndAudLocalControlDesc(asn1_NOVALUE, asn1_NOVALUE,
6052				       'NULL', asn1_NOVALUE),
6053    IASP  = cre_IndAudStreamParms(IALCD),
6054    msg51(Mid, IASP).
6055
6056msg51h() ->
6057    msg51h(?MG2_MID).
6058msg51h(Mid) ->
6059    Name  = "nt/jit",
6060    IAPP  = cre_IndAudPropertyParm(Name),
6061    IALCD = cre_IndAudLocalControlDesc(asn1_NOVALUE, asn1_NOVALUE,
6062				       asn1_NOVALUE, [IAPP]),
6063    IASP  = cre_IndAudStreamParms(IALCD),
6064    SID   = 123,
6065    IASD  = cre_IndAudStreamDesc(SID, IASP),
6066    msg51(Mid, [IASD]).
6067
6068
6069msg51i() ->
6070    msg51i(?MG2_MID).
6071msg51i(Mid) ->
6072    Name  = "nt/jit",
6073    Name2 = "tdmc/ec",
6074    IAPP  = cre_IndAudPropertyParm(Name),
6075    IAPP2 = cre_IndAudPropertyParm(Name2),
6076    IALCD = cre_IndAudLocalControlDesc('NULL', 'NULL', 'NULL',
6077				       [IAPP, IAPP2]),
6078    IASP  = cre_IndAudStreamParms(IALCD),
6079    SID   = 123,
6080    IASD  = cre_IndAudStreamDesc(SID, IASP),
6081    msg51(Mid, [IASD]).
6082
6083
6084%% IndAudEventsDescriptor:
6085msg52() ->
6086    msg52(?MG2_MID).
6087msg52(Mid) ->
6088    RequestID = 1235,
6089    PkgdName  = "tonedet/std",
6090    IAED = cre_IndAudEvsDesc(RequestID, PkgdName),
6091    IAP  = cre_IndAudParam(IAED),
6092    APT  = [IAP],
6093    msg50(Mid, APT).
6094
6095%% IndAudEventBufferDescriptor:
6096msg53() ->
6097    msg53(?MG2_MID).
6098msg53(Mid) ->
6099    EN    = "tonedet/std",
6100    SID   = 1,
6101    IAEBD = cre_IndAudEvBufDesc(EN, SID),
6102    IAP   = cre_IndAudParam(IAEBD),
6103    APT   = [IAP],
6104    msg50(Mid, APT).
6105
6106%% IndAudSignalsDescriptor:
6107msg54(Mid, Sig) ->
6108    IASD = cre_IndAudSigsDesc(Sig),
6109    IAP  = cre_IndAudParam(IASD),
6110    APT  = [IAP],
6111    msg50(Mid, APT).
6112
6113msg54a() ->
6114    msg54a(?MG2_MID).
6115msg54a(Mid) ->
6116    SN  = "tonegen/pt",
6117    Sig = cre_IndAudSig(SN),
6118    msg54(Mid, Sig).
6119
6120msg54b() ->
6121    msg54b(?MG2_MID).
6122msg54b(Mid) ->
6123    SN  = "dg/d0",
6124    Sig = cre_IndAudSig(SN),
6125    msg54(Mid, Sig).
6126
6127msg54c() ->
6128    msg54c(?MG2_MID).
6129msg54c(Mid) ->
6130    SN  = "ct/ct",
6131    Sig = cre_IndAudSig(SN),
6132    ID  = 4321,
6133    SSL = cre_IndAudSeqSigList(ID, Sig),
6134    msg54(Mid, SSL).
6135
6136%% IndAudDigitMapDescriptor:
6137msg55() ->
6138    msg55(?MG2_MID).
6139msg55(Mid) ->
6140    DMN   = "dialplan00",
6141    IADMD = cre_IndAudDigitMapDesc(DMN),
6142    IAP   = cre_IndAudParam(IADMD),
6143    APT   = [IAP],
6144    msg50(Mid, APT).
6145
6146%% IndAudStatisticsDescriptor:
6147msg56() ->
6148    msg56(?MG2_MID).
6149msg56(Mid) ->
6150    SN   = "nt/dur",
6151    IASD = cre_IndAudStatsDesc(SN),
6152    IAP  = cre_IndAudParam(IASD),
6153    APT  = [IAP],
6154    msg50(Mid, APT).
6155
6156%% IndAudPackagesDescriptor:
6157msg57() ->
6158    msg57(?MG2_MID).
6159msg57(Mid) ->
6160    PN   = "al",
6161    PV   = 1,
6162    IAPD = cre_IndAudPkgsDesc(PN, PV),
6163    IAP  = cre_IndAudParam(IAPD),
6164    APT  = [IAP],
6165    msg50(Mid, APT).
6166
6167%% Sum it up:
6168msg58_iaMediaDesc_iap(IATSD) ->
6169    IAMD  = cre_IndAudMediaDesc(IATSD),
6170    cre_IndAudParam(IAMD).
6171
6172msg58_iaMediaDesc_iap_a() ->
6173    PP    = cre_IndAudPropertyParm("tdmc/gain"),
6174    PPs   = [PP],
6175    IATSD = cre_IndAudTermStateDesc(PPs),
6176    msg58_iaMediaDesc_iap(IATSD).
6177
6178msg58_iaMediaDesc_iap_b() ->
6179    IATSD = cre_IndAudTermStateDesc([], 'NULL', asn1_NOVALUE),
6180    msg58_iaMediaDesc_iap(IATSD).
6181
6182msg58_iaEvsDesc_iap() ->
6183    RequestID = 1235,
6184    PkgdName  = "tonedet/std",
6185    IAED = cre_IndAudEvsDesc(RequestID, PkgdName),
6186    cre_IndAudParam(IAED).
6187
6188msg58_iaEvBufDesc_iap() ->
6189    EN    = "tonedet/std",
6190    SID   = 1,
6191    IAEBD = cre_IndAudEvBufDesc(EN, SID),
6192    cre_IndAudParam(IAEBD).
6193
6194msg58_iaSigsDesc_iap(S) ->
6195    IASD = cre_IndAudSigsDesc(S),
6196    cre_IndAudParam(IASD).
6197
6198msg58_iaSigsDesc_iap_a() ->
6199    SN  = "tonegen/pt",
6200    Sig = cre_IndAudSig(SN),
6201    msg58_iaSigsDesc_iap(Sig).
6202
6203msg58_iaSigsDesc_iap_b() ->
6204    SN  = "ct/ct",
6205    Sig = cre_IndAudSig(SN),
6206    ID  = 4321,
6207    SSL = cre_IndAudSeqSigList(ID, Sig),
6208    msg58_iaSigsDesc_iap(SSL).
6209
6210msg58_iaDigMapDesc_iap() ->
6211    DMN   = "dialplan00",
6212    IADMD = cre_IndAudDigitMapDesc(DMN),
6213    cre_IndAudParam(IADMD).
6214
6215msg58_iaStatsDesc_iap() ->
6216    SN   = "nt/dur",
6217    IASD = cre_IndAudStatsDesc(SN),
6218    cre_IndAudParam(IASD).
6219
6220msg58_iaPacksDesc_iap() ->
6221    PN   = "al",
6222    PV   = 1,
6223    IAPD = cre_IndAudPkgsDesc(PN, PV),
6224    cre_IndAudParam(IAPD).
6225
6226msg58a() ->
6227    msg58a(?MG2_MID).
6228msg58a(Mid) ->
6229    IAMD  = msg58_iaMediaDesc_iap_a(),
6230    IAED  = msg58_iaEvsDesc_iap(),
6231    IAEBD = msg58_iaEvBufDesc_iap(),
6232    IASiD = msg58_iaSigsDesc_iap_a(),
6233    IADMD = msg58_iaDigMapDesc_iap(),
6234    IAStD = msg58_iaStatsDesc_iap(),
6235    IAPD  = msg58_iaPacksDesc_iap(),
6236    APT   = [IAMD, IAED, IAEBD, IASiD, IADMD, IAStD, IAPD],
6237    msg50(Mid, APT).
6238
6239msg58b() ->
6240    msg58b(?MG2_MID).
6241msg58b(Mid) ->
6242    IAMD  = msg58_iaMediaDesc_iap_b(),
6243    IAED  = msg58_iaEvsDesc_iap(),
6244    IAEBD = msg58_iaEvBufDesc_iap(),
6245    IASiD = msg58_iaSigsDesc_iap_b(),
6246    IADMD = msg58_iaDigMapDesc_iap(),
6247    IAStD = msg58_iaStatsDesc_iap(),
6248    IAPD  = msg58_iaPacksDesc_iap(),
6249    APT   = [IAMD, IAED, IAEBD, IASiD, IADMD, IAStD, IAPD],
6250    msg50(Mid, APT).
6251
6252
6253%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6254%% Tests some of the changes in the v2 corr 1 (EmergencyOff and ModemDesc)
6255
6256%% Emergency On/Off (optional) tests
6257msg61(EM) ->
6258    TS     = cre_TimeNot("19990729", "22000000"),
6259    Event  = cre_ObsEv("al/of",TS),
6260    Desc   = cre_ObsEvsDesc(2222,[Event]),
6261    NotReq = cre_NotifyReq([#megaco_term_id{id = ?A4444}],Desc),
6262    Cmd    = ?MSG_LIB:cre_Command(notifyReq, NotReq),
6263    CmdReq = cre_CmdReq(Cmd),
6264    CtxReq = cre_CtxReq(15, EM),
6265    ActReq = ?MSG_LIB:cre_ActionRequest(1, CtxReq, [CmdReq]),
6266    Acts   = [ActReq],
6267    TR     = ?MSG_LIB:cre_TransactionRequest(9898, Acts),
6268    Trans  = ?MSG_LIB:cre_Transaction(TR),
6269    Mess   = ?MSG_LIB:cre_Message(?VERSION, ?MG1_MID, [Trans]),
6270    cre_MegacoMessage(Mess).
6271
6272msg61a() ->
6273    msg61(false).
6274
6275msg61b() ->
6276    msg61(true).
6277
6278msg61c() ->
6279    msg61(asn1_NOVALUE).
6280
6281
6282msg62a() ->
6283    MT      = ?MSG_LIB:cre_ModemType(v18),
6284    PP      = cre_PropParm("c", "IN IP4 $ "),
6285    MD      = ?MSG_LIB:cre_ModemDescriptor([MT], [PP]),
6286    AmmDesc = ?MSG_LIB:cre_AmmDescriptor(MD),
6287    TermIDs = [#megaco_term_id{id = ?A4444}],
6288    AmmReq  = ?MSG_LIB:cre_AmmRequest(TermIDs, [AmmDesc]),
6289    Cmd     = ?MSG_LIB:cre_Command(addReq, AmmReq),
6290    CmdReq  = ?MSG_LIB:cre_CommandRequest(Cmd),
6291    ActReq  = ?MSG_LIB:cre_ActionRequest(2, [CmdReq]),
6292    Acts    = [ActReq],
6293    TR      = ?MSG_LIB:cre_TransactionRequest(9898, Acts),
6294    Trans   = ?MSG_LIB:cre_Transaction(TR),
6295    Mess    = ?MSG_LIB:cre_Message(?VERSION, ?MG1_MID, [Trans]),
6296    cre_MegacoMessage(Mess).
6297
6298msg62b() ->
6299    MP =
6300"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555
6301Transaction = 9898 {
6302        Context = 2 {
6303                Add = 11111111/00000000/00000000 {
6304                        Modem[V18] {
6305                                tdmc/gain=2
6306                        }
6307                }
6308        }
6309}",
6310%     MC =
6311% "!/" ?VERSION_STR " [124.124.124.222]:55555\nT=9898{C=2{A=11111111/00000000/00000000{MD[V18]{tdmc/gain=2}}}}",
6312    list_to_binary(MP).
6313
6314%% ActionRequest with various combinations of ContextRequest and
6315%% ContextAttrAuditRequest
6316msg71(CR, CAAR) ->
6317    TS1    = cre_TimeNot("19990729", "22000000"),
6318    TS2    = cre_TimeNot("19990729", "22000111"),
6319    Event1 = cre_ObsEv("al/of",TS1),
6320    Event2 = cre_ObsEv("al/on",TS2),
6321    Desc1  = cre_ObsEvsDesc(2222,[Event1]),
6322    Desc2  = cre_ObsEvsDesc(2222,[Event2]),
6323    NR1    = cre_NotifyReq([#megaco_term_id{id = ?A4444}],Desc1),
6324    NR2    = cre_NotifyReq([#megaco_term_id{id = ?A4444}],Desc2),
6325    Cmd1   = ?MSG_LIB:cre_Command(notifyReq, NR1),
6326    Cmd2   = ?MSG_LIB:cre_Command(notifyReq, NR2),
6327    CR1    = cre_CmdReq(Cmd1),
6328    CR2    = cre_CmdReq(Cmd2),
6329    ActReq = ?MSG_LIB:cre_ActionRequest(1, CR, CAAR, [CR1, CR2]),
6330    Acts   = [ActReq],
6331    TR     = ?MSG_LIB:cre_TransactionRequest(9898, Acts),
6332    Trans  = ?MSG_LIB:cre_Transaction(TR),
6333    Mess   = ?MSG_LIB:cre_Message(?VERSION, ?MG1_MID, [Trans]),
6334    cre_MegacoMessage(Mess).
6335
6336msg71a() ->
6337    CR   = cre_CtxReq(),
6338    CAAR = cre_CtxAttrAuditReq(),
6339    msg71(CR, CAAR).
6340
6341msg71b(CR) ->
6342    CAAR = asn1_NOVALUE,
6343    msg71(CR, CAAR).
6344
6345msg71b01() ->
6346    CR = cre_CtxReq(15),
6347    msg71b(CR).
6348
6349msg71b02() ->
6350    CR = cre_CtxReq(true),
6351    msg71b(CR).
6352
6353msg71b03() ->
6354    CR = cre_CtxReq(false),
6355    msg71b(CR).
6356
6357msg71b04() ->
6358    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6359    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6360    Dir1  = bothway,
6361    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6362    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6363    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6364    Dir2  = isolate,
6365    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6366    Top   = [Top1, Top2],
6367    CR    = cre_CtxReq(Top),
6368    msg71b(CR).
6369
6370msg71b05() ->
6371    CR = cre_CtxReq(15, true),
6372    msg71b(CR).
6373
6374msg71b06() ->
6375    CR = cre_CtxReq(15, false),
6376    msg71b(CR).
6377
6378msg71b07() ->
6379    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6380    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6381    Dir1  = bothway,
6382    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6383    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6384    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6385    Dir2  = oneway,
6386    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6387    Top   = [Top1, Top2],
6388    CR    = cre_CtxReq(15, Top),
6389    msg71b(CR).
6390
6391msg71b08() ->
6392    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6393    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6394    Dir1  = bothway,
6395    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6396    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6397    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6398    Dir2  = bothway,
6399    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6400    Top   = [Top1, Top2],
6401    CR    = cre_CtxReq(15, true, Top),
6402    msg71b(CR).
6403
6404msg71b09() ->
6405    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6406    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6407    Dir1  = isolate,
6408    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6409    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6410    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6411    Dir2  = oneway,
6412    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6413    Top   = [Top1, Top2],
6414    CR    = cre_CtxReq(15, false, Top),
6415    msg71b(CR).
6416
6417msg71b10() ->
6418    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6419    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6420    Dir1  = isolate,
6421    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6422    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6423    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6424    Dir2  = onewayboth,
6425    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6426    Top   = [Top1, Top2],
6427    CR    = cre_CtxReq(15, false, Top),
6428    msg71b(CR).
6429
6430msg71b11() ->
6431    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6432    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6433    Dir1  = isolate,
6434    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6435    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6436    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6437    Dir2  = onewayexternal,
6438    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6439    Top   = [Top1, Top2],
6440    CR    = cre_CtxReq(15, false, Top),
6441    msg71b(CR).
6442
6443msg71b12() ->
6444    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6445    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6446    Dir1  = oneway,
6447    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6448    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6449    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6450    Dir2  = bothway,
6451    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6452    Top   = [Top1, Top2],
6453    CR    = cre_CtxReq(15, true, Top, true),
6454    msg71b(CR).
6455
6456msg71b13() ->
6457    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6458    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6459    Dir1  = bothway,
6460    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6461    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6462    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6463    Dir2  = bothway,
6464    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6465    Top   = [Top1, Top2],
6466    CR    = cre_CtxReq(15, true, Top, false),
6467    msg71b(CR).
6468
6469msg71b14() ->
6470    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6471    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6472    Dir1  = oneway,
6473    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6474    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6475    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6476    Dir2  = oneway,
6477    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6478    Top   = [Top1, Top2],
6479    PP    = cre_PropParm("tdmc/gain", "2"),
6480    Props = [PP],
6481    CR    = cre_CtxReq(15, true, Top, Props),
6482    msg71b(CR).
6483
6484msg71b15() ->
6485    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6486    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6487    Dir1  = isolate,
6488    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6489    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6490    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6491    Dir2  = isolate,
6492    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6493    Top   = [Top1, Top2],
6494    PP    = cre_PropParm("tdmc/gain", ["2"], relation, greaterThan),
6495    Props = [PP],
6496    CR    = cre_CtxReq(15, true, Top, Props),
6497    msg71b(CR).
6498
6499msg71b16() ->
6500    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6501    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6502    Dir1  = isolate,
6503    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6504    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6505    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6506    Dir2  = bothway,
6507    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6508    Top   = [Top1, Top2],
6509    PP    = cre_PropParm("tdmc/gain", ["2","10"], range, true),
6510    Props = [PP],
6511    CR    = cre_CtxReq(15, true, Top, Props),
6512    msg71b(CR).
6513
6514msg71b17() ->
6515    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6516    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6517    Dir1  = oneway,
6518    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6519    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6520    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6521    Dir2  = bothway,
6522    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6523    Top   = [Top1, Top2],
6524    PP    = cre_PropParm("nt/jit", ["40","50","50"], sublist, true),
6525    Props = [PP],
6526    CR    = cre_CtxReq(15, true, Top, Props),
6527    msg71b(CR).
6528
6529msg71b18() ->
6530    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6531    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6532    Dir1  = oneway,
6533    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6534    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6535    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6536    Dir2  = isolate,
6537    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6538    Top   = [Top1, Top2],
6539    PP    = cre_PropParm("tdmc/gain", ["2","4","8"], sublist, false),
6540    Props = [PP],
6541    CR    = cre_CtxReq(15, true, Top, true, Props),
6542    msg71b(CR).
6543
6544msg71b19() ->
6545    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6546    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6547    Dir1  = oneway,
6548    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6549    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6550    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6551    Dir2  = bothway,
6552    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6553    Top   = [Top1, Top2],
6554    CR    = cre_CtxReq(15, true, Top, false),
6555    msg71b(CR).
6556
6557msg71b20() ->
6558    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6559    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6560    Dir1  = oneway,
6561    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6562    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6563    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6564    Dir2  = isolate,
6565    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6566    Top   = [Top1, Top2],
6567    PP    = cre_PropParm("tdmc/gain", ["2","4","8"], sublist, false),
6568    Props = [PP],
6569    CR    = cre_CtxReq(15, true, Top, false, Props),
6570    msg71b(CR).
6571
6572msg71b21() ->
6573    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6574    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6575    Dir1  = oneway,
6576    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6577    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6578    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6579    Dir2  = isolate,
6580    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6581    Top   = [Top1, Top2],
6582    CID1  = cre_CtxID(10191),
6583    CID2  = cre_CtxID(10192),
6584    CIDs  = [CID1, CID2],
6585    CR    = cre_CtxReq(15, true, Top, false, CIDs),
6586    msg71b(CR).
6587
6588msg71b22() ->
6589    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6590    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6591    Dir1  = oneway,
6592    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6593    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6594    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6595    Dir2  = isolate,
6596    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6597    Top   = [Top1, Top2],
6598    PP    = cre_PropParm("tdmc/gain", ["2","4","8"], sublist, false),
6599    Props = [PP],
6600    CID1  = cre_CtxID(10191),
6601    CID2  = cre_CtxID(10192),
6602    CIDs  = [CID1, CID2],
6603    CR    = cre_CtxReq(15, true, Top, false, Props, CIDs),
6604    msg71b(CR).
6605
6606msg71c(CAAR) ->
6607    CR = asn1_NOVALUE,
6608    msg71(CR, CAAR).
6609
6610msg71c01() ->
6611    CAAR = cre_CtxAttrAuditReq('NULL', 'NULL', 'NULL'),
6612    msg71c(CAAR).
6613
6614msg71c02() ->
6615    CAAR = cre_CtxAttrAuditReq('NULL', 'NULL', asn1_NOVALUE),
6616    msg71c(CAAR).
6617
6618msg71c03() ->
6619    CAAR = cre_CtxAttrAuditReq('NULL', asn1_NOVALUE, 'NULL'),
6620    msg71c(CAAR).
6621
6622msg71c04() ->
6623    CAAR = cre_CtxAttrAuditReq(asn1_NOVALUE, 'NULL', 'NULL'),
6624    msg71c(CAAR).
6625
6626msg71c05() ->
6627    CAAR = cre_CtxAttrAuditReq(asn1_NOVALUE, asn1_NOVALUE, 'NULL'),
6628    msg71c(CAAR).
6629
6630msg71c06() ->
6631    CAAR = cre_CtxAttrAuditReq(asn1_NOVALUE, 'NULL', asn1_NOVALUE),
6632    msg71c(CAAR).
6633
6634msg71c07() ->
6635    CAAR = cre_CtxAttrAuditReq('NULL', asn1_NOVALUE, asn1_NOVALUE),
6636    msg71c(CAAR).
6637
6638msg71c08() ->
6639    CAAR = cre_CtxAttrAuditReq('NULL', asn1_NOVALUE, 'NULL', 'NULL'),
6640    msg71c(CAAR).
6641
6642msg71c09() ->
6643    Top   = 'NULL',
6644    Em    = 'NULL',
6645    Prio  = 'NULL',
6646    Ieps  = 'NULL',
6647    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6648    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6649    CPA   = [IAPP1, IAPP2],
6650    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA),
6651    msg71c(CAAR).
6652
6653msg71c10() ->
6654    Top   = 'NULL',
6655    Em    = 'NULL',
6656    Prio  = 'NULL',
6657    Ieps  = 'NULL',
6658    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6659    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6660    CPA   = [IAPP1, IAPP2],
6661    SPrio = 10,
6662    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA, SPrio),
6663    msg71c(CAAR).
6664
6665msg71c11() ->
6666    Top   = 'NULL',
6667    Em    = 'NULL',
6668    Prio  = 'NULL',
6669    Ieps  = 'NULL',
6670    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6671    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6672    CPA   = [IAPP1, IAPP2],
6673    SPrio = 10,
6674    SEm   = true,
6675    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA,
6676				SPrio, SEm, asn1_NOVALUE, asn1_NOVALUE),
6677    msg71c(CAAR).
6678
6679msg71c12() ->
6680    Top   = 'NULL',
6681    Em    = 'NULL',
6682    Prio  = 'NULL',
6683    Ieps  = 'NULL',
6684    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6685    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6686    CPA   = [IAPP1, IAPP2],
6687    SPrio = 10,
6688    SEm   = true,
6689    SIeps = false,
6690    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA,
6691					SPrio, SEm, SIeps),
6692    msg71c(CAAR).
6693
6694msg71c13() ->
6695    Top   = 'NULL',
6696    Em    = 'NULL',
6697    Prio  = 'NULL',
6698    Ieps  = 'NULL',
6699    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6700    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6701    CPA   = [IAPP1, IAPP2],
6702    SPrio = 10,
6703    SEm   = false,
6704    SIeps = true,
6705    SLog  = cre_SelectLogic(andAUDITSelect),
6706    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA,
6707				SPrio, SEm, SIeps, SLog),
6708    msg71c(CAAR).
6709
6710msg71c14() ->
6711    Top   = 'NULL',
6712    Em    = 'NULL',
6713    Prio  = 'NULL',
6714    Ieps  = 'NULL',
6715    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6716    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6717    CPA   = [IAPP1, IAPP2],
6718    SPrio = 10,
6719    SEm   = true,
6720    SIeps = true,
6721    SLog  = cre_SelectLogic(orAUDITSelect),
6722    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA,
6723					SPrio, SEm, SIeps, SLog),
6724    msg71c(CAAR).
6725
6726msg71c15() ->
6727    Top   = 'NULL',
6728    Em    = 'NULL',
6729    Prio  = 'NULL',
6730    Ieps  = 'NULL',
6731    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6732    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6733    CPA   = [IAPP1, IAPP2],
6734    SPrio = 10,
6735    SLog  = cre_SelectLogic(orAUDITSelect),
6736    CAAR  = cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, CPA,
6737				SPrio, SLog),
6738    msg71c(CAAR).
6739
6740msg71d01() ->
6741    CR   = cre_CtxReq(15, true),
6742    CAAR = cre_CtxAttrAuditReq('NULL', 'NULL', 'NULL'),
6743    msg71(CR, CAAR).
6744
6745msg71d02() ->
6746    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6747    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6748    Dir1  = bothway,
6749    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6750    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6751    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6752    Dir2  = oneway,
6753    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6754    Top   = [Top1, Top2],
6755    PP    = cre_PropParm("tdmc/gain", ["2"], relation, unequalTo),
6756    Props = [PP],
6757    CR    = cre_CtxReq(15, true, Top, true, Props),
6758
6759    CAAR_Top = 'NULL',
6760    Em   = 'NULL',
6761    Prio = 'NULL',
6762    Ieps = 'NULL',
6763    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6764    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6765    CPA   = [IAPP1, IAPP2],
6766    CAAR = cre_CtxAttrAuditReq(CAAR_Top, Em, Prio, Ieps, CPA),
6767
6768    msg71(CR, CAAR).
6769
6770msg71d03() ->
6771    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6772    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6773    Dir1  = bothway,
6774    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6775    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6776    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6777    Dir2  = oneway,
6778    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6779    Top   = [Top1, Top2],
6780    PP    = cre_PropParm("tdmc/gain", ["2"], relation, unequalTo),
6781    Props = [PP],
6782    CR    = cre_CtxReq(15, true, Top, false, Props),
6783
6784    CAAR_Top = 'NULL',
6785    Em   = 'NULL',
6786    Prio = 'NULL',
6787    Ieps = 'NULL',
6788    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6789    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6790    CPA   = [IAPP1, IAPP2],
6791    CAAR = cre_CtxAttrAuditReq(CAAR_Top, Em, Prio, Ieps, CPA),
6792
6793    msg71(CR, CAAR).
6794
6795msg71d04() ->
6796    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6797    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6798    Dir1  = bothway,
6799    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6800    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6801    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6802    Dir2  = oneway,
6803    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6804    Top   = [Top1, Top2],
6805    PP    = cre_PropParm("tdmc/gain", ["2"], relation, unequalTo),
6806    Props = [PP],
6807    CID1  = cre_CtxID(10191),
6808    CID2  = cre_CtxID(10192),
6809    CIDs  = [CID1, CID2],
6810    CR    = cre_CtxReq(15, true, Top, false, Props, CIDs),
6811
6812    CAAR_Top = 'NULL',
6813    Em   = 'NULL',
6814    Prio = 'NULL',
6815    Ieps = 'NULL',
6816    IAPP1 = cre_IndAudPropertyParm("tdmc/gain"),
6817    IAPP2 = cre_IndAudPropertyParm("nt/jit"),
6818    CPA   = [IAPP1, IAPP2],
6819    SPrio = 10,
6820    SEm   = true,
6821    SIeps = true,
6822    SLog  = cre_SelectLogic(orAUDITSelect),
6823    CAAR  = cre_CtxAttrAuditReq(CAAR_Top, Em, Prio, Ieps, CPA,
6824				SPrio, SEm, SIeps, SLog),
6825    msg71(CR, CAAR).
6826
6827msg72(ED, CR) ->
6828    V  = cre_PropParm("v", "0"),
6829    C  = cre_PropParm("c", "IN IP4 124.124.124.222"),
6830    M  = cre_PropParm("m", "audio 2222 RTP/AVP 4"),
6831    A  = cre_PropParm("a", "a=ptime:30"),
6832    A2 = cre_PropParm("a", "recvonly"),
6833    LD = cre_LocalRemoteDesc([[V, C, M, A, A2]]),
6834    Parms      = cre_StreamParmsL(LD),
6835    StreamDesc = cre_StreamDesc(1, Parms),
6836    MediaDesc  = cre_MediaDesc(StreamDesc),
6837    Reply  = cre_AmmsReply([#megaco_term_id{id = ?A4444}]),
6838    Reply2 = cre_AmmsReply([#megaco_term_id{id = ?A4445}],
6839			   [{mediaDescriptor, MediaDesc}]),
6840    CmdRep = [{addReply, Reply}, {addReply, Reply2}],
6841    Action = cre_ActRep(2000, ED, CR, CmdRep),
6842    msg_reply(?MGC_MID, 10003, [Action]).
6843
6844msg72a(CR) ->
6845    ED = asn1_NOVALUE,
6846    msg72(ED, CR).
6847
6848msg72a01() ->
6849    CR = cre_CtxReq(false),
6850    msg72a(CR).
6851
6852msg72a02() ->
6853    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6854    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6855    Dir1  = bothway,
6856    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6857    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6858    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6859    Dir2  = isolate,
6860    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6861    Top   = [Top1, Top2],
6862    CR    = cre_CtxReq(Top),
6863    msg72a(CR).
6864
6865msg72a03() ->
6866    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6867    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6868    Dir1  = bothway,
6869    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6870    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6871    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6872    Dir2  = oneway,
6873    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6874    Top   = [Top1, Top2],
6875    CR    = cre_CtxReq(15, Top),
6876    msg72a(CR).
6877
6878msg72b(CR) ->
6879    EC = ?MSG_LIB:cre_ErrorCode(?megaco_not_ready),
6880    ED = ?MSG_LIB:cre_ErrorDescriptor(EC),
6881    msg72(ED, CR).
6882
6883msg72b01() ->
6884    CR = cre_CtxReq(15, false),
6885    msg72b(CR).
6886
6887msg72b02() ->
6888    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6889    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6890    Dir1  = isolate,
6891    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6892    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6893    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6894    Dir2  = oneway,
6895    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6896    Top   = [Top1, Top2],
6897    CR    = cre_CtxReq(15, false, Top),
6898    msg72b(CR).
6899
6900msg72b03() ->
6901    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6902    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6903    Dir1  = oneway,
6904    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6905    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6906    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6907    Dir2  = bothway,
6908    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6909    Top   = [Top1, Top2],
6910    CR    = cre_CtxReq(15, true, Top, true),
6911    msg72b(CR).
6912
6913msg72b04() ->
6914    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6915    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6916    Dir1  = oneway,
6917    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6918    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6919    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6920    Dir2  = bothway,
6921    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6922    Top   = [Top1, Top2],
6923    CR    = cre_CtxReq(15, true, Top, false),
6924    msg72b(CR).
6925
6926msg72c(CR) ->
6927    EC = ?MSG_LIB:cre_ErrorCode(?megaco_not_ready),
6928    ET = ?MSG_LIB:cre_ErrorText("Just another error string"),
6929    ED = ?MSG_LIB:cre_ErrorDescriptor(EC, ET),
6930    msg72(ED, CR).
6931
6932msg72c01() ->
6933    CR = cre_CtxReq(15),
6934    msg72c(CR).
6935
6936msg72c02() ->
6937    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6938    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6939    Dir1  = oneway,
6940    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6941    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6942    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6943    Dir2  = oneway,
6944    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6945    Top   = [Top1, Top2],
6946    PP    = cre_PropParm("tdmc/gain", "2"),
6947    Props = [PP],
6948    CR    = cre_CtxReq(15, true, Top, Props),
6949    msg72c(CR).
6950
6951msg72c03() ->
6952    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6953    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6954    Dir1  = oneway,
6955    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6956    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6957    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6958    Dir2  = isolate,
6959    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6960    Top   = [Top1, Top2],
6961    PP    = cre_PropParm("tdmc/gain", ["2","4","8"], sublist, false),
6962    Props = [PP],
6963    CR    = cre_CtxReq(15, true, Top, true, Props),
6964    msg72c(CR).
6965
6966msg72c04() ->
6967    From1 = #megaco_term_id{id = ["11111111", "00000000", "00000000"]},
6968    To1   = #megaco_term_id{id = ["11111111", "00000000", "00001111"]},
6969    Dir1  = oneway,
6970    Top1  = cre_TopologyRequest(From1, To1, Dir1),
6971    From2 = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
6972    To2   = #megaco_term_id{id = ["11111111", "00001111", "00001111"]},
6973    Dir2  = isolate,
6974    Top2  = cre_TopologyRequest(From2, To2, Dir2),
6975    Top   = [Top1, Top2],
6976    PP    = cre_PropParm("tdmc/gain", ["2","4","8"], sublist, false),
6977    Props = [PP],
6978    CR    = cre_CtxReq(15, true, Top, false, Props),
6979    msg72c(CR).
6980
6981
6982msg73() ->
6983    Stat1    = cre_StatsParm("rtp/ps"),
6984    Stat2    = cre_StatsParm("nt/os","62300"),
6985    Stat3    = cre_StatsParm("rtp/pr","700"),
6986    Stat4    = cre_StatsParm("nt/or","45100"),
6987    Stat5    = cre_StatsParm("rtp/pl","0.2"),
6988    Stat6    = cre_StatsParm("rtp/jit","20"),
6989    Stat7    = cre_StatsParm("rtp/delay","40"),
6990    Stats    = [Stat1, Stat2, Stat3, Stat4, Stat5, Stat6, Stat7],
6991    cre_StatsDesc(Stats).
6992
6993%% StatisticsDescriptor in AmmDescriptor
6994msg73a() ->
6995    StatDesc = msg73(),
6996    AmmDesc  = cre_AmmDesc(StatDesc),
6997    TermIDs  = [#megaco_term_id{id = ["11111111", "00001111", "00000000"]}],
6998    AmmReq   = cre_AmmReq(TermIDs, [AmmDesc]),
6999    Cmd      = cre_Cmd(addReq, AmmReq),
7000    CmdReq   = cre_CmdReq(Cmd),
7001    CID      = cre_CtxID(7301),
7002    ActReq   = cre_ActReq(CID, [CmdReq]),
7003    Actions  = [ActReq],
7004    TransId  = cre_TransId(7302),
7005    TransReq = cre_TransReq(TransId, Actions),
7006    Trans    = cre_Trans(TransReq),
7007    Mid      = ?MG1_MID,
7008    Mess     = cre_Msg(Mid, [Trans]),
7009    cre_MegacoMessage(Mess).
7010
7011
7012%% StatisticsDescriptor in IndAudStreamParms
7013msg73b1() ->
7014    IASD = cre_IndAudStatsDesc("nt/dur"),
7015    cre_IndAudStreamParms(IASD).
7016
7017msg73b2(IAMD) ->
7018    IAP      = cre_IndAudParam(IAMD),
7019    AD       = cre_AuditDesc([IAP]),
7020    TermID   = #megaco_term_id{id = ["11111111", "00001111", "00000000"]},
7021    AudReq   = cre_AuditReq(TermID, AD),
7022    Cmd      = cre_Cmd(auditValueRequest, AudReq),
7023    CmdReq   = cre_CmdReq(Cmd),
7024    CID      = cre_CtxID(7311),
7025    ActReq   = cre_ActReq(CID, [CmdReq]),
7026    Actions  = [ActReq],
7027    TransId  = cre_TransId(7312),
7028    TransReq = cre_TransReq(TransId, Actions),
7029    Trans    = cre_Trans(TransReq),
7030    Mid      = ?MG1_MID,
7031    Mess     = cre_Msg(Mid, [Trans]),
7032    cre_MegacoMessage(Mess).
7033
7034msg73b01() ->
7035    IASP = msg73b1(),
7036    IAMD = cre_IndAudMediaDesc(IASP),
7037    msg73b2(IAMD).
7038
7039msg73b02() ->
7040    IASP = msg73b1(),
7041    SID  = cre_StreamID(303),
7042    IASD = cre_IndAudStreamDesc(SID, IASP),
7043    IAMD = cre_IndAudMediaDesc([IASD]),
7044    msg73b2(IAMD).
7045
7046%% StatisticsDescriptor in StreamParms
7047msg73c1() ->
7048    StatDesc = msg73(),
7049    SP       = cre_StreamParms(StatDesc),
7050    SID      = cre_StreamID(505),
7051    cre_StreamDesc(SID, SP).
7052
7053msg73c2(MD) ->
7054    ARP      = cre_AuditRetParam(MD),
7055    TA       = cre_TermAudit([ARP]),
7056    TermIDs  = [#megaco_term_id{id = ["11111111", "00001111", "00000000"]}],
7057    AmmsRep  = cre_AmmsReply(TermIDs, TA),
7058    CmdRep   = cre_CmdRep(moveReply, AmmsRep),
7059    CID      = cre_CtxID(606),
7060    ActRep   = cre_ActRep(CID, [CmdRep]),
7061    TransId  = cre_TransId(8899),
7062    TransRep = cre_TransRep(TransId, [ActRep]),
7063    Trans    = cre_Trans(TransRep),
7064    Mid      = ?MG1_MID,
7065    Mess     = cre_Msg(Mid, [Trans]),
7066    cre_MegacoMessage(Mess).
7067
7068msg73c01() ->
7069    SD = msg73c1(),
7070    MD = cre_MediaDesc(SD),
7071    msg73c2(MD).
7072
7073msg73c02() ->
7074    SD = msg73c1(),
7075    MD = cre_MediaDesc([SD]),
7076    msg73c2(MD).
7077
7078
7079%% New Signal (direction and requestID); msg74
7080msg74a1(D) ->
7081    Dir = cre_SigDir(D),
7082    cre_Sig("cg/rt", Dir, asn1_NOVALUE).
7083
7084msg74a2(D, RID) ->
7085    Dir = cre_SigDir(D),
7086    cre_Sig("cg/rt", Dir, RID).
7087
7088msg74a3(D, RID) ->
7089    Name = "al/ri",
7090    SID  = cre_StreamID(7401),
7091    ST   = cre_SigType(brief),
7092    Dur  = 7499,
7093    NC   = cre_NotifCompl([onTimeOut,otherReason]),
7094    KA   = cre_BOOLEAN(true),
7095    SPL  = [],
7096    Dir  = cre_SigDir(D),
7097    cre_Sig(Name, SID, ST, Dur, NC, KA, SPL, Dir, RID).
7098
7099msg74a4(Sig) ->
7100    SR      = cre_SigReq(Sig),
7101    SD      = cre_SigsDesc([SR]),
7102    AD      = cre_AmmDesc(SD),
7103    TermIDs = [#megaco_term_id{id = ?A4444}],
7104    AR      = cre_AmmReq(TermIDs, [AD]),
7105    Cmd     = cre_Cmd(modReq, AR),
7106    cre_CmdReq(Cmd).
7107
7108msg74a01() ->
7109    Sig      = msg74a1(internal),
7110    CR       = msg74a4(Sig),
7111    CID      = cre_CtxID(7411),
7112    ActReq   = cre_ActReq(CID, [CR]),
7113    Actions  = [ActReq],
7114    TransId  = cre_TransId(7421),
7115    TransReq = cre_TransReq(TransId, Actions),
7116    Trans    = cre_Trans(TransReq),
7117    Mid      = ?MG1_MID,
7118    Mess     = cre_Msg(Mid, [Trans]),
7119    cre_MegacoMessage(Mess).
7120
7121msg74a02() ->
7122    Sig      = msg74a1(both),
7123    CR       = msg74a4(Sig),
7124    CID      = cre_CtxID(7412),
7125    ActReq   = cre_ActReq(CID, [CR]),
7126    Actions  = [ActReq],
7127    TransId  = cre_TransId(7422),
7128    TransReq = cre_TransReq(TransId, Actions),
7129    Trans    = cre_Trans(TransReq),
7130    Mid      = ?MG1_MID,
7131    Mess     = cre_Msg(Mid, [Trans]),
7132    cre_MegacoMessage(Mess).
7133
7134msg74a03() ->
7135    RID      = cre_ReqID(7433),
7136    Sig      = msg74a2(external, RID),
7137    CR       = msg74a4(Sig),
7138    CID      = cre_CtxID(7413),
7139    ActReq   = cre_ActReq(CID, [CR]),
7140    Actions  = [ActReq],
7141    TransId  = cre_TransId(7423),
7142    TransReq = cre_TransReq(TransId, Actions),
7143    Trans    = cre_Trans(TransReq),
7144    Mid      = ?MG1_MID,
7145    Mess     = cre_Msg(Mid, [Trans]),
7146    cre_MegacoMessage(Mess).
7147
7148msg74a04() ->
7149    RID      = cre_ReqID(7434),
7150    Sig      = msg74a2(both, RID),
7151    CR       = msg74a4(Sig),
7152    CID      = cre_CtxID(7414),
7153    ActReq   = cre_ActReq(CID, [CR]),
7154    Actions  = [ActReq],
7155    TransId  = cre_TransId(7424),
7156    TransReq = cre_TransReq(TransId, Actions),
7157    Trans    = cre_Trans(TransReq),
7158    Mid      = ?MG1_MID,
7159    Mess     = cre_Msg(Mid, [Trans]),
7160    cre_MegacoMessage(Mess).
7161
7162msg74a05() ->
7163    RID      = cre_ReqID(7435),
7164    Sig      = msg74a3(both, RID),
7165    CR       = msg74a4(Sig),
7166    CID      = cre_CtxID(7415),
7167    ActReq   = cre_ActReq(CID, [CR]),
7168    Actions  = [ActReq],
7169    TransId  = cre_TransId(7425),
7170    TransReq = cre_TransReq(TransId, Actions),
7171    Trans    = cre_Trans(TransReq),
7172    Mid      = ?MG1_MID,
7173    Mess     = cre_Msg(Mid, [Trans]),
7174    cre_MegacoMessage(Mess).
7175
7176msg74a06() ->
7177    RID      = cre_ReqID(7436),
7178    Sig      = msg74a3(internal, RID),
7179    CR       = msg74a4(Sig),
7180    CID      = cre_CtxID(7416),
7181    ActReq   = cre_ActReq(CID, [CR]),
7182    Actions  = [ActReq],
7183    TransId  = cre_TransId(7426),
7184    TransReq = cre_TransReq(TransId, Actions),
7185    Trans    = cre_Trans(TransReq),
7186    Mid      = ?MG1_MID,
7187    Mess     = cre_Msg(Mid, [Trans]),
7188    cre_MegacoMessage(Mess).
7189
7190
7191
7192%% New ServiceChangeParm (serviceChangeIncompleteFlag); msg75
7193msg75a(IncFlag) ->
7194    Method   = cre_SvcChMethod(restart),
7195    Address  = cre_SvcChAddr(portNumber, ?DEFAULT_PORT),
7196    Reason   = "901 mg col boot",
7197    Profile  = cre_SvcChProf("resgw",1),
7198    Parm     = cre_SvcChParm(Method, Address, [Reason], Profile, IncFlag),
7199    TermIDs  = [?megaco_root_termination_id],
7200    Req      = cre_SvcChReq(TermIDs, Parm),
7201    Cmd      = cre_Cmd(serviceChangeReq, Req),
7202    CR       = cre_CmdReq(Cmd),
7203    CID      = cre_CtxID(7501),
7204    ActReq   = cre_ActReq(CID, [CR]),
7205    Actions  = [ActReq],
7206    TransId  = cre_TransId(7502),
7207    TransReq = cre_TransReq(TransId, Actions),
7208    Trans    = cre_Trans(TransReq),
7209    Mid      = ?MG1_MID,
7210    Mess     = cre_Msg(Mid, [Trans]),
7211    cre_MegacoMessage(Mess).
7212
7213msg75a01() ->
7214    msg75a(asn1_NOVALUE).
7215
7216msg75a02() ->
7217    msg75a('NULL').
7218
7219
7220msg76(IAMD) ->
7221    IAP   = cre_IndAudParam(IAMD),
7222    AD    = cre_AuditDesc(asn1_NOVALUE, [IAP]),
7223    AR    = cre_AuditReq(#megaco_term_id{id = ?A5556}, AD),
7224    CR    = cre_CmdReq({auditValueRequest, AR}),
7225    msg_request(?MG2_MID, 50076, ?megaco_null_context_id, [CR]).
7226
7227%% IndAudLocalControlDescriptor and IndAudPropertyParm
7228msg76a(IALCD) when is_record(IALCD, 'IndAudLocalControlDescriptor') ->
7229    IASP  = cre_IndAudStreamParms(IALCD),
7230    SID   = 123,
7231    IASD  = cre_IndAudStreamDesc(SID, IASP),
7232    IAMD  = cre_IndAudMediaDesc([IASD]),
7233    msg76(IAMD).
7234
7235msg76a01() ->
7236    Name1 = "nt/jit",
7237    IAPP1 = cre_IndAudPropertyParm(Name1),
7238    Name2 = "tdmc/ec",
7239    IAPP2 = cre_IndAudPropertyParm(Name2),
7240    SMS   = cre_StreamMode(recvOnly),
7241    IALCD = cre_IndAudLocalControlDesc(asn1_NOVALUE, 'NULL', 'NULL',
7242				       [IAPP1, IAPP2], SMS),
7243    msg76a(IALCD).
7244
7245msg76a02() ->
7246    Name1 = "tdmc/gain",
7247    PP1   = cre_PropParm("tdmc/gain", "2"),
7248    IAPP1 = cre_IndAudPropertyParm(Name1, PP1),
7249    Name2 = "tdmc/gain",
7250    PP2   = cre_PropParm("tdmc/gain", "3"),
7251    IAPP2 = cre_IndAudPropertyParm(Name2, PP2),
7252    SMS   = cre_StreamMode(recvOnly),
7253    IALCD = cre_IndAudLocalControlDesc(asn1_NOVALUE, 'NULL', 'NULL',
7254				       [IAPP1, IAPP2], SMS),
7255    msg76a(IALCD).
7256
7257%% IndAudTerminationStateDescription + ServiceState
7258msg76b(IATSD) ->
7259    IAMD = cre_IndAudMediaDesc(IATSD),
7260    msg76(IAMD).
7261
7262msg76b01() ->
7263    SSS   = cre_ServiceState(outOfSvc),
7264    IATSD = cre_IndAudTermStateDesc([], asn1_NOVALUE, asn1_NOVALUE, SSS),
7265    msg76b(IATSD).
7266
7267%% msg76b02() ->
7268%%     PP    = cre_PropParm("tdmc/gain", "2"),
7269%%     IAPP  = cre_IndAudPropertyParm("nt/jit", PP),
7270%%     IAPPs = [IAPP],
7271%%     SSS   = cre_ServiceState(outOfSvc),
7272%%     IATSD = cre_IndAudTermStateDesc(IAPPs, 'NULL', asn1_NOVALUE, SSS),
7273%%     msg76b(IATSD).
7274
7275msg77a01() ->
7276    SN  = "tonegen/pt",
7277    Sig = cre_IndAudSig(SN, 7701),
7278    msg54(?MG2_MID, Sig).
7279
7280
7281msg78a(Events) ->
7282    EventsDesc = cre_EvsDesc(2223, Events),
7283    Signal     = cre_Sig("cg/rt"),
7284    Name       = "dialplan00",
7285    Body = "(0s| 00s|[1-7]xlxx|8lxxxxxxx|#xxxxxxx|*xx|9l1xxxxxxxxxx|9l011x.s)",
7286    DigitMapValue = cre_DigitMapValue(Body),
7287    DigMapDesc = cre_DigitMapDesc(Name, DigitMapValue),
7288    AmmReq     = cre_AmmReq([#megaco_term_id{id = ?A4444}],
7289                           [{eventsDescriptor, EventsDesc},
7290			    {signalsDescriptor, [{signal, Signal}]},
7291			    {digitMapDescriptor, DigMapDesc}]),
7292    CmdReq     = cre_CmdReq({modReq, AmmReq}),
7293    msg_request(?MG2_MID, 10001, ?megaco_null_context_id, [CmdReq]).
7294
7295msg78a01() ->
7296    Name1  = "al/on",
7297    Strict = cre_EvParm("strict", ["state"]),
7298    EPL1   = [Strict],
7299    RE1    = cre_ReqEv(Name1, EPL1),
7300    Name2  = "al/on",
7301    SID2   = 7801,
7302    KA2    = true,
7303    EDM2   = cre_EvDM("dialplan00"),
7304    NB2    = cre_NotifBehav(notifyImmediate, 'NULL'),
7305    RED2   = asn1_NOVALUE,
7306    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, RED2),
7307    EPL2   = EPL1,
7308    RE2    = cre_ReqEv(Name2, SID2, RA2, EPL2),
7309    msg78a([RE1, RE2]).
7310
7311msg78a02() ->
7312    Name1  = "al/on",
7313    Strict = cre_EvParm("strict",["state"]),
7314    EPL1   = [Strict],
7315    RE1    = cre_ReqEv(Name1, EPL1),
7316    Name2  = "al/on",
7317    SID2   = 7802,
7318    KA2    = true,
7319    EDM2   = cre_EvDM("dialplan00"),
7320    NB2    = cre_NotifBehav(neverNotify, 'NULL'),
7321    RED2   = asn1_NOVALUE,
7322    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, RED2),
7323    EPL2   = EPL1,
7324    RE2    = cre_ReqEv(Name2, SID2, RA2, EPL2),
7325    msg78a([RE1, RE2]).
7326
7327msg78a03() ->
7328    Name1  = "al/on",
7329    Strict = cre_EvParm("strict",["state"]),
7330    EPL1   = [Strict],
7331    RE1    = cre_ReqEv(Name1, EPL1),
7332    Name2  = "al/on",
7333    SID2   = 7803,
7334    KA2    = true,
7335    EDM2   = cre_EvDM("dialplan00"),
7336    RED2   = cre_RegEmbedDesc(),
7337    NB2    = cre_NotifBehav(notifyRegulated, RED2),
7338    REvD2  = asn1_NOVALUE,
7339    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, REvD2),
7340    EPL2   = EPL1,
7341    RE2    = cre_ReqEv(Name2, SID2, RA2, EPL2),
7342    msg78a([RE1, RE2]).
7343
7344msg78a04() ->
7345    Name1  = "al/on",
7346    Strict = cre_EvParm("strict",["state"]),
7347    EPL1   = [Strict],
7348    RE1    = cre_ReqEv(Name1, EPL1),
7349    Name2  = "al/on",
7350    KA2    = true,
7351    EDM2   = cre_EvDM("dialplan00"),
7352    SRE2   = cre_SecReqEv("al/on"),
7353    SED2   = cre_SecEvsDesc(7814, [SRE2]),
7354    RED2   = cre_RegEmbedDesc(SED2),
7355    NB2    = cre_NotifBehav(notifyRegulated, RED2),
7356    REvD2  = asn1_NOVALUE,
7357    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, REvD2),
7358    EPL2   = EPL1,
7359    RE2    = cre_ReqEv(Name2, 7824, RA2, EPL2),
7360    msg78a([RE1, RE2]).
7361
7362msg78a05() ->
7363    Name1  = "al/on",
7364    Strict = cre_EvParm("strict",["state"]),
7365    EPL1   = [Strict],
7366    RE1    = cre_ReqEv(Name1, EPL1),
7367    Name2  = "al/on",
7368    SID2   = 7805,
7369    KA2    = true,
7370    EDM2   = cre_EvDM("dialplan00"),
7371    SD2    = cre_SigsDesc(),
7372    RED2   = cre_RegEmbedDesc(SD2),
7373    NB2    = cre_NotifBehav(notifyRegulated, RED2),
7374    REvD2  = asn1_NOVALUE,
7375    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, REvD2),
7376    EPL2   = EPL1,
7377    RE2    = cre_ReqEv(Name2, SID2, RA2, EPL2),
7378    msg78a([RE1, RE2]).
7379
7380msg78a06() ->
7381    Name1  = "al/on",
7382    Strict = cre_EvParm("strict",["state"]),
7383    EPL1   = [Strict],
7384    RE1    = cre_ReqEv(Name1, EPL1),
7385    Name2  = "al/on",
7386    KA2    = true,
7387    EDM2   = cre_EvDM("dialplan00"),
7388    SRE2   = cre_SecReqEv("al/on"),
7389    SED2   = cre_SecEvsDesc(7816, [SRE2]),
7390    Sig2   = cre_Sig("cg/rt", external, asn1_NOVALUE),
7391    SR2    = cre_SigReq(Sig2),
7392    SRs2   = [SR2],
7393    SD2    = cre_SigsDesc(SRs2),
7394    RED2   = cre_RegEmbedDesc(SED2, SD2),
7395    NB2    = cre_NotifBehav(notifyRegulated, RED2),
7396    REvD2  = asn1_NOVALUE,
7397    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, REvD2),
7398    EPL2   = EPL1,
7399    RE2    = cre_ReqEv(Name2, 7826, RA2, EPL2),
7400    msg78a([RE1, RE2]).
7401
7402msg78a07() ->
7403    Name1  = "al/on",
7404    Strict = cre_EvParm("strict",["state"]),
7405    EPL1   = [Strict],
7406    RE1    = cre_ReqEv(Name1, EPL1),
7407    Name2  = "al/on",
7408    KA2    = true,
7409    EDM2   = cre_EvDM("dialplan00"),
7410    SRE2   = cre_SecReqEv("al/on"),
7411    SED2   = cre_SecEvsDesc(7817, [SRE2]),
7412    Sig2   = cre_Sig("cg/rt", external, asn1_NOVALUE),
7413    SR2    = cre_SigReq(Sig2),
7414    SRs2   = [SR2],
7415    SD2    = cre_SigsDesc(SRs2),
7416    RED2   = cre_RegEmbedDesc(SED2, SD2),
7417    NB2    = cre_NotifBehav(notifyRegulated, RED2),
7418    REvD2  = 'NULL',
7419    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB2, REvD2),
7420    EPL2   = EPL1,
7421    RE2    = cre_ReqEv(Name2, 7827, RA2, EPL2),
7422    msg78a([RE1, RE2]).
7423
7424msg78a08() ->
7425    Name1  = "al/on",
7426    Strict = cre_EvParm("strict",["state"]),
7427    EPL1   = [Strict],
7428    RE1    = cre_ReqEv(Name1, EPL1),
7429
7430    Name2  = "al/on",
7431    KA2    = true,
7432    EDM2   = cre_EvDM("dialplan00"),
7433
7434    Sig21  = cre_Sig("al/ri", both, asn1_NOVALUE),
7435    SR21   = cre_SigReq(Sig21),
7436    SRs21  = [SR21],
7437    SD21   = cre_SigsDesc(SRs21),
7438    RED21  = cre_RegEmbedDesc(SD21),
7439    NB21   = cre_NotifBehav(notifyRegulated, RED21),
7440    SRA2   = cre_SecReqActs(KA2, EDM2, asn1_NOVALUE, NB21, 'NULL'),
7441    SRE2   = cre_SecReqEv("al/of", 7816, SRA2),
7442    SED2   = cre_SecEvsDesc(7826, [SRE2]),
7443
7444    Sig22  = cre_Sig("cg/rt", external, asn1_NOVALUE),
7445    SR22   = cre_SigReq(Sig22),
7446    SRs22  = [SR22],
7447    SD22   = cre_SigsDesc(SRs22),
7448    RED22  = cre_RegEmbedDesc(SED2, SD22),
7449    NB22   = cre_NotifBehav(notifyRegulated, RED22),
7450    REvD2  = 'NULL',
7451
7452    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB22, REvD2),
7453    EPL2   = EPL1,
7454    RE2    = cre_ReqEv(Name2, 7836, RA2, EPL2),
7455    msg78a([RE1, RE2]).
7456
7457msg78a09() ->
7458    Name1  = "al/on",
7459    Strict = cre_EvParm("strict",["state"]),
7460    EPL1   = [Strict],
7461    RE1    = cre_ReqEv(Name1, EPL1),
7462
7463    Name2  = "al/on",
7464    KA2    = true,
7465    EDM2   = cre_EvDM("dialplan00"),
7466
7467    SID21  = cre_StreamID(7819),
7468    ST21   = cre_SigType(timeOut),
7469    Dur21  = 7898,
7470    NC21   = cre_NotifCompl([onTimeOut, onInterruptByEvent, otherReason]),
7471    KA21   = cre_BOOLEAN(false),
7472    SPL21  = [],
7473    Dir21  = cre_SigDir(both),
7474    RID21  = cre_ReqID(7829),
7475
7476    Sig21  = cre_Sig("cg/rt", SID21, ST21, Dur21, NC21, KA21, SPL21, Dir21,
7477		     RID21, 7839),
7478    SR21   = cre_SigReq(Sig21),
7479    SRs21  = [SR21],
7480    SD21   = cre_SigsDesc(SRs21),
7481    RED21  = cre_RegEmbedDesc(SD21),
7482    NB21   = cre_NotifBehav(notifyRegulated, RED21),
7483
7484    SRA2   = cre_SecReqActs(KA2, EDM2, asn1_NOVALUE, NB21, 'NULL'),
7485    SRE2   = cre_SecReqEv("al/of", 7849, SRA2),
7486    SED2   = cre_SecEvsDesc(7859, [SRE2]),
7487
7488    SID22  = cre_StreamID(7869),
7489    ST22   = cre_SigType(brief),
7490    Dur22  = 17809,
7491    NC22   = cre_NotifCompl([onTimeOut, otherReason]),
7492    KA22   = cre_BOOLEAN(true),
7493    SPL22  = [],
7494    Dir22  = cre_SigDir(external),
7495    RID22  = cre_ReqID(7879),
7496
7497    Sig22  = cre_Sig("cg/rt", SID22, ST22, Dur22, NC22, KA22, SPL22, Dir22,
7498		     RID22, 7889),
7499    SR22   = cre_SigReq(Sig22),
7500    SRs22  = [SR22],
7501    SD22   = cre_SigsDesc(SRs22),
7502    RED22  = cre_RegEmbedDesc(SED2, SD22),
7503
7504    NB22   = cre_NotifBehav(notifyRegulated, RED22),
7505    REvD2  = 'NULL',
7506
7507    RA2    = cre_ReqActs(KA2, EDM2, asn1_NOVALUE, asn1_NOVALUE, NB22, REvD2),
7508    EPL2   = EPL1,
7509    RE2    = cre_ReqEv(Name2, 7899, RA2, EPL2),
7510    msg78a([RE1, RE2]).
7511
7512
7513msg79a01() ->
7514    TID1 = #megaco_term_id{id = ?A4444},
7515    TID2 = #megaco_term_id{id = ?A4445},
7516    TID3 = #megaco_term_id{id = ?A5555},
7517    TIDs = cre_TermIDList([TID1, TID2, TID3]),
7518    ErC  = cre_ErrCode(?megaco_not_ready),
7519    ErD  = cre_ErrDesc(ErC),
7520    ARP1 = cre_AuditRetParam(ErD),
7521    RE   = cre_ReqEv("al/of"),
7522    EvD  = cre_EvsDesc(7911,[RE]),
7523    ARP2 = cre_AuditRetParam(EvD),
7524    Tks  = [mediaToken, digitMapToken, statsToken, packagesToken],
7525    AD   = cre_AuditDesc(Tks),
7526    ARP3 = cre_AuditRetParam(AD),
7527    TAR  = cre_TermAudit([ARP1, ARP2, ARP3]),
7528    TLAR = cre_TermListAuditRes(TIDs, TAR),
7529    AudR = cre_AuditRep(TLAR),
7530    CR   = cre_CmdRep(auditValueReply, AudR),
7531    ActR = cre_ActRep(7921, [CR]),
7532    Acts = [ActR],
7533    msg_reply(?MG2_MID, 7931, Acts).
7534
7535
7536%% --
7537
7538msg80() ->
7539    Address  = {portNumber, ?DEFAULT_PORT},
7540    Profile  = cre_SvcChProf("resgw", 1),
7541    Parm     = cre_SvcChResParm(Address, Profile),
7542    Reply    = cre_SvcChRep([?megaco_root_termination_id],
7543			    {serviceChangeResParms, Parm}),
7544    CmdRep  = cre_CmdRep(serviceChangeReply, Reply),
7545    cre_ActRep(80, [CmdRep]).
7546
7547msg80a(Mid, SN) ->
7548    TransId  = 8000,
7549    ActRep   = msg80(),
7550    TransRep = cre_TransRep(TransId, [ActRep], SN),
7551    Trans    = cre_Trans(TransRep),
7552    Mess     = cre_Msg(Mid, [Trans]),
7553    cre_MegacoMessage(Mess).
7554
7555msg80a01() ->
7556    msg80a(?MG1_MID, 1).
7557
7558msg80a02() ->
7559    msg80a(?MG2_MID, 1000).
7560
7561msg80a03() ->
7562    msg80a(?MG3_MID, 65535).
7563
7564msg80b(Mid, SN) ->
7565    TransId  = 8989,
7566    ActRep   = msg80(),
7567    TransRep = cre_TransRep(TransId, [ActRep], SN, 'NULL'),
7568    Trans    = cre_Trans(TransRep),
7569    Mess     = cre_Msg(Mid, [Trans]),
7570    cre_MegacoMessage(Mess).
7571
7572msg80b01() ->
7573    msg80b(?MG1_MID, 1).
7574
7575msg80b02() ->
7576    msg80b(?MG2_MID, 1000).
7577
7578msg80b03() ->
7579    msg80b(?MG3_MID, 65535).
7580
7581msg81a(Mid, SN) ->
7582    TransId  = 8101,
7583    SegReply = cre_SegRep(TransId, SN),
7584    Trans    = cre_Trans(SegReply),
7585    Mess     = cre_Msg(Mid, [Trans]),
7586    cre_MegacoMessage(Mess).
7587
7588msg81a01() ->
7589    msg81a(?MG1_MID, 1).
7590
7591msg81a02() ->
7592    msg81a(?MG2_MID, 1000).
7593
7594msg81a03() ->
7595    msg81a(?MG3_MID, 65535).
7596
7597msg81b(Mid, SN) ->
7598    TransId  = 8102,
7599    SegReply = cre_SegRep(TransId, SN, 'NULL'),
7600    Trans    = cre_Trans(SegReply),
7601    Mess     = cre_Msg(Mid, [Trans]),
7602    cre_MegacoMessage(Mess).
7603
7604msg81b01() ->
7605    msg81b(?MG1_MID, 1).
7606
7607msg81b02() ->
7608    msg81b(?MG2_MID, 1000).
7609
7610msg81b03() ->
7611    msg81b(?MG3_MID, 65535).
7612
7613
7614%% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7615%% Pretty RFC 3525 messages:
7616
7617%% Added Reason
7618rfc3525_msg1() ->
7619"MEGACO/" ?VERSION_STR " [124.124.124.222] Transaction = 9998 {
7620   Context = - {
7621      ServiceChange = ROOT {
7622         Services {
7623            Method = Restart,
7624            Reason = 901,
7625            ServiceChangeAddress = 55555,
7626            Profile = ResGW/1
7627         }
7628      }
7629   }
7630}".
7631
7632rfc3525_msg2() ->
7633"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Reply = 9998 {
7634   Context = - {
7635      ServiceChange = ROOT {
7636         Services {
7637            ServiceChangeAddress = 55555,
7638            Profile = ResGW/1
7639         }
7640      }
7641   }
7642}".
7643
7644
7645%% Removed "," after LocalControl ending "}"
7646rfc3525_msg3() ->
7647"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 9999 {
7648   Context = - {
7649      Modify = A4444 {
7650         Media {
7651            Stream = 1 {
7652               LocalControl {
7653                  Mode = SendReceive,
7654                  tdmc/gain=2,  ; in dB,
7655                  tdmc/ec=on
7656               }
7657            }
7658         },
7659         Events = 2222 {
7660            al/of {strict=state}
7661         }
7662      }
7663   }
7664}".
7665
7666%% Removed the outermost "{}" pair (before the Reply token)
7667rfc3525_msg4() ->
7668"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 9999 {
7669   Context = - {
7670      Modify = A4444
7671   }
7672}".
7673
7674rfc3525_msg6() ->
7675"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Transaction = 10000 {
7676   Context = - {
7677      Notify = A4444 {
7678         ObservedEvents =2222 {
7679            19990729T22000000:al/of{init=false}
7680         }
7681      }
7682   }
7683}".
7684
7685
7686rfc3525_msg7() ->
7687"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Reply = 10000 {
7688   Context = - {
7689      Notify = A4444
7690   }
7691}".
7692
7693rfc3525_msg8() ->
7694"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 10001 {
7695   Context = - {
7696      Modify = A4444 {
7697         Events = 2223 {
7698            al/on {strict=state},
7699            dd/ce {DigitMap=Dialplan0}
7700	 },
7701         Signals {cg/dt},
7702         DigitMap = Dialplan0 {
7703            (0| 00|[1-7]xxx|8xxxxxxx|fxxxxxxx|exx|91xxxxxxxxxx|9011x.)
7704         }
7705      }
7706   }
7707}".
7708
7709rfc3525_msg9() ->
7710"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10001 {
7711   Context = - {
7712      Modify = A4444
7713   }
7714}".
7715
7716rfc3525_msg10() ->
7717"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Transaction = 10002 {
7718   Context = - {
7719      Notify = A4444 {
7720         ObservedEvents =2223 {
7721            19990729T22010001:dd/ce {
7722               ds=\"916135551212\",
7723               Meth=UM
7724            }
7725         }
7726      }
7727   }
7728}".
7729
7730
7731rfc3525_msg11() ->
7732"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Reply = 10002 {
7733   Context = - {
7734      Notify = A4444
7735   }
7736}".
7737
7738%% Added ?
7739rfc3525_msg12() ->
7740"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 10003 {
7741   Context = $ {
7742      Add = A4444,
7743      Add = $ {
7744         Media {
7745            Stream = 1 {
7746               LocalControl {
7747                  Mode = ReceiveOnly,
7748                  nt/jit=40 ; in ms
7749               },
7750               Local {
7751                  v=0 c=IN IP4 $ m=audio $ RTP/AVP 4 a=ptime:30 v=0 c=IN IP4 $ m=audio $ RTP/AVP 0
7752               }
7753            }
7754         }
7755      }
7756   }
7757}".
7758
7759%% Added ?
7760rfc3525_msg13() ->
7761"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
7762   Context = 2000 {
7763      Add = A4444,
7764      Add = A4445 {
7765         Media {
7766            Stream = 1 {
7767               Local {
7768v=0
7769o=- 2890844526 2890842807 IN IP4 124.124.124.222
7770s=-
7771t= 0 0
7772c=IN IP4 124.124.124.222
7773m=audio 2222 RTP/AVP 4
7774a=ptime:30
7775a=recvonly
7776               } ; RTP profile for G.723.1 is 4
7777            }
7778         }
7779      }
7780   }
7781}".
7782
7783%%
7784%% Added ?
7785rfc3525_msg14() ->
7786"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 50003 {
7787   Context = $ {
7788      Add = A5555 {
7789         Media {
7790            Stream = 1 {
7791               LocalControl {
7792                  Mode = SendReceive
7793               }
7794            }
7795         },
7796         Events = 1234 {
7797            al/of {strict=state}
7798         },
7799         Signals {al/ri}
7800      },
7801      Add = $ {
7802         Media {
7803            Stream = 1 {
7804               LocalControl {
7805                  Mode = SendReceive,
7806                  nt/jit=40 ; in ms
7807               },
7808               Local {
7809                  v=0 c=IN IP4 $ m=audio $ RTP/AVP 4 a=ptime:30
7810               },
7811               Remote {
7812                  v=0 c=IN IP4 124.124.124.222 m=audio 2222 RTP/AVP 4 a=ptime:30
7813               } ; RTP profile for G.723.1 is 4
7814            }
7815         }
7816      }
7817   }
7818}".
7819
7820%% Added ?
7821rfc3525_msg15() ->
7822"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Reply = 50003 {
7823   Context = 5000 {
7824      Add = A5555,
7825      Add = A5556 {
7826         Media {
7827            Stream = 1 {
7828               Local {
7829                  v=0 o=- 7736844526 7736842807 IN IP4 125.125.125.111 s=- t= 0 0 c=IN IP4 125.125.125.111 m=audio 1111 RTP/AVP 4
7830               } ; RTP profile for G723.1 is 4
7831            }
7832         }
7833      }
7834   }
7835}".
7836
7837%% Added ?
7838rfc3525_msg16a() ->
7839"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 10005 {
7840   Context = 2000 {
7841      Modify = A4444 {
7842         Signals {cg/rt}
7843      },
7844      Modify = A4445 {
7845         Media {
7846            Stream = 1 {
7847               Remote {
7848                  v=0 o=- 7736844526 7736842807 IN IP4 125.125.125.111 s=- t= 0 0 c=IN IP4 125.125.125.111 m=audio 1111 RTP/AVP 4
7849	       } ; RTP profile for G723.1 is 4
7850            }
7851         }
7852      }
7853   }
7854}".
7855
7856rfc3525_msg16b() ->
7857"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10005 {
7858   Context = 2000 {
7859      Modify = A4444,
7860      Modify = A4445
7861   }
7862}".
7863
7864rfc3525_msg17a() ->
7865"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Transaction = 50005 {
7866   Context = 5000 {
7867      Notify = A5555 {
7868         ObservedEvents = 1234 {
7869            19990729T22020002:al/of{init=false}
7870         }
7871      }
7872   }
7873}".
7874
7875rfc3525_msg17b() ->
7876"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Reply = 50005 {
7877   Context = - {
7878      Notify = A5555
7879   }
7880}".
7881
7882%% Removed "{ }" after Signals
7883rfc3525_msg17c() ->
7884"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 50006 {
7885   Context = 5000 {
7886      Modify = A5555 {
7887         Events = 1235 {
7888            al/on{strict=state}
7889         },
7890         Signals ; to turn off ringing
7891      }
7892   }
7893}".
7894
7895rfc3525_msg17d() ->
7896"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Reply = 50006 {
7897   Context = 5000 {
7898      Modify = A4445
7899   }
7900}".
7901
7902%% Removed "{ }" after Signals
7903rfc3525_msg18a() ->
7904"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 10006 {
7905   Context = 2000 {
7906      Modify = A4445 {
7907         Media {
7908            Stream = 1 {
7909               LocalControl {
7910                  Mode = SendReceive
7911               }
7912            }
7913         }
7914      },
7915      Modify = A4444 {
7916         Signals
7917      }
7918   }
7919}".
7920
7921rfc3525_msg18b() ->
7922"MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10006 {
7923   Context = 2000 {
7924      Modify = A4445,
7925      Modify = A4444
7926   }
7927}".
7928
7929rfc3525_msg19() ->
7930"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 50007 {
7931   Context = - {
7932      AuditValue = A5556 {
7933         Audit {
7934            Media, DigitMap, Events, Signals, Packages, Statistics
7935         }
7936      }
7937   }
7938}".
7939
7940%% Added ?
7941rfc3525_msg20() ->
7942"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Reply = 50007 {
7943   Context = - {
7944      AuditValue = A5556 {
7945         Media {
7946            TerminationState {
7947               ServiceStates = InService,
7948               Buffer = OFF
7949            },
7950            Stream = 1 {
7951               LocalControl {
7952                  Mode = SendReceive,
7953                  nt/jit=40
7954               },
7955               Local {
7956                  v=0 o=- 7736844526 7736842807 IN IP4 125.125.125.111 s=- t= 0 0 c=IN IP4 125.125.125.111 m=audio 1111 RTP/AVP  4 a=ptime:30
7957               },
7958               Remote {
7959                  v=0 o=- 2890844526 2890842807 IN IP4 124.124.124.222 s=- t= 0 0 c=IN IP4 124.124.124.222 m=audio 2222 RTP/AVP  4 a=ptime:30
7960               }
7961            }
7962         },
7963         Events,
7964         Signals,
7965         DigitMap,
7966         Packages {nt-1, rtp-1},
7967         Statistics {
7968            rtp/ps=1200,  ; packets sent
7969            nt/os=62300, ; octets sent
7970            rtp/pr=700, ; packets received
7971            nt/or=45100, ; octets received
7972            rtp/pl=0.2,  ; % packet loss
7973            rtp/jit=20,
7974            rtp/delay=40 ; avg latency
7975         }
7976      }
7977   }
7978}".
7979
7980rfc3525_msg21a() ->
7981"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Transaction = 50008 {
7982   Context = 5000 {
7983      Notify = A5555 {
7984         ObservedEvents =1235 {
7985            19990729T24020002:al/on {init=false}
7986         }
7987      }
7988   }
7989}".
7990
7991rfc3525_msg21b() ->
7992"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Reply = 50008 {
7993   Context = - {
7994      Notify = A5555
7995   }
7996}".
7997
7998rfc3525_msg22a() ->
7999"MEGACO/" ?VERSION_STR " [123.123.123.4]:55555 Transaction = 50009 {
8000   Context = 5000 {
8001      Subtract = A5555 {
8002         Audit {
8003            Statistics
8004         }
8005      },
8006      Subtract = A5556 {
8007         Audit {
8008            Statistics
8009         }
8010      }
8011   }
8012}".
8013
8014%% Added ?
8015rfc3525_msg22b() ->
8016"MEGACO/" ?VERSION_STR " [125.125.125.111]:55555 Reply = 50009 {
8017   Context = 5000 {
8018      Subtract = A5555 {
8019         Statistics {
8020            nt/os=45123, ; Octets Sent
8021            nt/dur=40 ; in seconds
8022         }
8023      },
8024      Subtract = A5556 {
8025         Statistics {
8026            rtp/ps=1245, ; packets sent
8027            nt/os=62345, ; octets sent
8028            rtp/pr=780, ; packets received
8029            nt/or=45123, ; octets received
8030            rtp/pl=10, ;  % packets lost
8031            rtp/jit=27,
8032            rtp/delay=48 ; average latency
8033         }
8034      }
8035   }
8036}".
8037
8038rfc3525_msgs() ->
8039    [
8040     {msg1,   rfc3525_msg1()},
8041     {msg2,   rfc3525_msg2()},
8042     {msg3,   rfc3525_msg3()},
8043     {msg4,   rfc3525_msg4()},
8044     {msg6,   rfc3525_msg6()},
8045     {msg7,   rfc3525_msg7()},
8046     {msg8,   rfc3525_msg8()},
8047     {msg9,   rfc3525_msg9()},
8048     {msg10,  rfc3525_msg10()},
8049     {msg11,  rfc3525_msg11()},
8050     {msg12,  rfc3525_msg12()},
8051     {msg13,  rfc3525_msg13()},
8052     {msg14,  rfc3525_msg14()},
8053     {msg15,  rfc3525_msg15()},
8054     {msg16a, rfc3525_msg16a()},
8055     {msg16b, rfc3525_msg16b()},
8056     {msg17a, rfc3525_msg17a()},
8057     {msg17b, rfc3525_msg17b()},
8058     {msg17c, rfc3525_msg17c()},
8059     {msg17d, rfc3525_msg17d()},
8060     {msg18a, rfc3525_msg18a()},
8061     {msg18b, rfc3525_msg18b()},
8062     {msg19,  rfc3525_msg19()},
8063     {msg20,  rfc3525_msg20()},
8064     {msg21a, rfc3525_msg21a()},
8065     {msg21b, rfc3525_msg21b()},
8066     {msg22a, rfc3525_msg22a()},
8067     {msg22b, rfc3525_msg22b()}
8068    ].
8069
8070rfc3525_msgs_display() ->
8071    Msgs = rfc3525_msgs(),
8072    Fun = fun({Name, Msg}) ->
8073		  io:format("~w: ~n~s~n~n", [Name, Msg])
8074	  end,
8075    lists:foreach(Fun, Msgs).
8076
8077rfc3525_msgs_test() ->
8078    put(dbg,true),
8079    Res = rfc3525_msgs_test(megaco_pretty_text_encoder, [], 2),
8080    erase(dbg),
8081    io:format("~w~n", [Res]).
8082
8083rfc3525_msgs_test(Codec, Config, Ver) ->
8084    io:format("-----------------------------------------"
8085	      "~ntesting with"
8086	      "~n   Codec:   ~w"
8087	      "~n   Config:  ~w"
8088	      "~n   Version: ~w"
8089	      "~n", [Codec, Config, Ver]),
8090    Msgs = rfc3525_msgs(),
8091    Test = fun({N,M1}) ->
8092		   %% io:format("testing ~w: ", [N]),
8093		   io:format("~n*** testing ~w *** ~n~s~n", [N,M1]),
8094		   Bin1 = erlang:list_to_binary(M1),
8095		   case (catch Codec:decode_message(Config, Ver, Bin1)) of
8096		       {ok, M2} ->
8097			   %% io:format("d", []),
8098			   io:format("decoded:~n~p~n", [M2]),
8099			   case (catch Codec:encode_message(Config, Ver, M2)) of
8100			       {ok, Bin2} when is_binary(Bin2) ->
8101				   %% io:format("e~n", []),
8102				   io:format("encode: ~n~s~n", [erlang:binary_to_list(Bin2)]),
8103				   {N,ok};
8104			       {ok, M3} ->
8105				   %% io:format("e~n", []),
8106				   io:format("encode: ~n~s~n", [M3]),
8107				   {N,ok};
8108			       E ->
8109				   io:format("~n~p~n", [E]),
8110				   {N,encode_error}
8111			   end;
8112		       E ->
8113			   io:format("~n~p~n", [E]),
8114			   {N,decode_error}
8115		   end
8116	  end,
8117    [Test(M) || M <- Msgs].
8118
8119%% --------------------------
8120
8121
8122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8123
8124%% skip(Reason) ->
8125%%     megaco_codec_test_lib:skip(Reason).
8126
8127
8128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8129
8130ticket_compact_encode_decode_ok(Msg) ->
8131    ticket_compact_encode_decode_ok(Msg, []).
8132
8133ticket_compact_encode_decode_ok(Msg, Conf) ->
8134    Codec  = megaco_compact_text_encoder,
8135    ticket_encode_decode_ok(Msg, Codec, Conf).
8136
8137ticket_pretty_encode_decode_ok(Msg) ->
8138    ticket_pretty_encode_decode_ok(Msg, []).
8139
8140ticket_pretty_encode_decode_ok(Msg, Conf) ->
8141    Codec  = megaco_pretty_text_encoder,
8142    ticket_encode_decode_ok(Msg, Codec, Conf).
8143
8144ticket_encode_decode_ok(Msg, Codec, Conf0) ->
8145    Conf   = [?EC_V3|Conf0],
8146    Encode = fun(M) -> encode_message(Codec, Conf, M) end,
8147    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8148    Check  = fun(M1, M2) -> chk_MegacoMessage(M1, M2) end,
8149    megaco_codec_test_lib:expect_encode_decode(Msg, Encode, Decode, Check).
8150
8151%% --
8152
8153%% ticket_compact_encode_error(Msg) ->
8154%%     ticket_compact_encode_error(Msg, []).
8155
8156%% ticket_compact_encode_error(Msg, Conf) ->
8157%%     Codec  = megaco_compact_text_encoder,
8158%%     ticket_encode_error(Msg, Codec, Conf).
8159
8160%% ticket_pretty_encode_error(Msg) ->
8161%%     ticket_pretty_encode_error(Msg, []).
8162
8163ticket_pretty_encode_error(Msg, Conf) when is_list(Conf) ->
8164    Codec = megaco_pretty_text_encoder,
8165    ticket_encode_error(Msg, Codec, Conf);
8166ticket_pretty_encode_error(Msg, Check) when is_function(Check) ->
8167    ticket_pretty_encode_error(Msg, [], Check).
8168
8169ticket_pretty_encode_error(Msg, Conf, Check) when is_function(Check) ->
8170    Codec = megaco_pretty_text_encoder,
8171    ticket_encode_error(Msg, Codec, Conf, Check).
8172
8173ticket_encode_error(Msg, Codec, Conf) when is_list(Conf) ->
8174    Check = fun(_) -> ok end, % Only called when encode failes
8175    ticket_encode_error(Msg, Codec, Conf, Check).
8176
8177ticket_encode_error(Msg, Codec, Conf0, Check) ->
8178    Conf   = [?EC_V3|Conf0],
8179    Encode = fun(M) -> encode_message(Codec, Conf, M) end,
8180    megaco_codec_test_lib:expect_encode(Msg, Encode, Check).
8181
8182%% --
8183
8184ticket_compact_decode_encode_ok(Msg) ->
8185    ticket_compact_decode_encode_ok(Msg, []).
8186
8187ticket_compact_decode_encode_ok(Msg, Conf) ->
8188    Codec  = megaco_compact_text_encoder,
8189    ticket_decode_encode_ok(Msg, Codec, Conf).
8190
8191ticket_pretty_decode_encode_ok(Msg) ->
8192    ticket_pretty_decode_encode_ok(Msg, []).
8193
8194ticket_pretty_decode_encode_ok(Msg, Conf) ->
8195    Codec  = megaco_pretty_text_encoder,
8196    ticket_decode_encode_ok(Msg, Codec, Conf).
8197
8198ticket_decode_encode_ok(Msg, Codec, Conf0) ->
8199    Conf   = [?EC_V3|Conf0],
8200    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8201    Encode = fun(M) -> encode_message(Codec, Conf, M) end,
8202    Check  = fun(M1, M2) -> chk_MegacoMessage(M1, M2) end,
8203    megaco_codec_test_lib:expect_decode_encode(Msg, Decode, Encode, Check).
8204
8205%% --
8206
8207ticket_pretty_decode_encode_only(Msg, Check) ->
8208    ticket_pretty_decode_encode_only(Msg, Check, []).
8209
8210ticket_pretty_decode_encode_only(Msg, Check, Conf) ->
8211    Codec  = megaco_pretty_text_encoder,
8212    ticket_decode_encode_only(Msg, Codec, Check, Conf).
8213
8214ticket_decode_encode_only(Msg, Codec, Check, Conf0) ->
8215    Conf   = [?EC_V3|Conf0],
8216    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8217    Encode = fun(M) -> encode_message(Codec, Conf, M) end,
8218    megaco_codec_test_lib:expect_decode_encode_only(Msg, Decode, Encode,
8219						    Check).
8220
8221%% --
8222
8223ticket_pretty_encode_decode_only(Msg) ->
8224    ticket_pretty_encode_decode_only(Msg, []).
8225
8226ticket_pretty_encode_decode_only(Msg, Conf) when is_list(Conf) ->
8227    Codec = megaco_pretty_text_encoder,
8228    ticket_encode_decode_only(Msg, Codec, Conf);
8229ticket_pretty_encode_decode_only(Msg, Check) when is_function(Check) ->
8230    ticket_pretty_encode_decode_only(Msg, Check, []).
8231
8232ticket_pretty_encode_decode_only(Msg, Check, Conf) ->
8233    Codec = megaco_pretty_text_encoder,
8234    ticket_encode_decode_only(Msg, Codec, Check, Conf).
8235
8236ticket_encode_decode_only(Msg, Codec, Conf) ->
8237    Check = fun(_) -> ok end,
8238    ticket_encode_decode_only(Msg, Codec, Check, Conf).
8239
8240ticket_encode_decode_only(Msg, Codec, Check, Conf0) ->
8241    Conf   = [?EC_V3|Conf0],
8242    Encode = fun(M) -> encode_message(Codec, Conf, M) end,
8243    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8244    megaco_codec_test_lib:expect_encode_decode_only(Msg, Encode, Decode,
8245						    Check).
8246
8247%% --
8248
8249ticket_pretty_decode_only(Msg) ->
8250    ticket_pretty_decode_only(Msg, []).
8251
8252ticket_pretty_decode_only(Msg, Conf) ->
8253    Codec = megaco_pretty_text_encoder,
8254    ticket_decode_only(Msg, Codec, Conf).
8255
8256ticket_decode_only(Msg, Codec, Conf) ->
8257    Check = fun(_) -> ok end,
8258    ticket_decode_only(Msg, Codec, Check, Conf).
8259
8260ticket_decode_only(Msg, Codec, Check, Conf0) ->
8261    Conf   = [?EC_V3|Conf0],
8262    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8263    megaco_codec_test_lib:expect_decode_only(Msg, Decode, Check).
8264
8265ticket_check_decode_only_error_reason(R, Check)
8266  when is_list(R) and is_function(Check) ->
8267    case lists:keysearch(reason, 1, R) of
8268	{value, {reason, Reason}} ->
8269	    Check(Reason);
8270	false ->
8271	    {error, {reason_not_found, R}}
8272    end.
8273
8274
8275%% --
8276
8277ticket_compact_decode_error(Msg) ->
8278    ticket_compact_decode_error(Msg, []).
8279
8280ticket_compact_decode_error(Msg, Conf) ->
8281    Codec = megaco_compact_text_encoder,
8282    ticket_decode_error(Msg, Codec, Conf).
8283
8284ticket_pretty_decode_error(Msg) ->
8285    ticket_pretty_decode_error(Msg, []).
8286
8287ticket_pretty_decode_error(Msg, Conf) when is_list(Conf) ->
8288    Codec = megaco_pretty_text_encoder,
8289    ticket_decode_error(Msg, Codec, Conf);
8290ticket_pretty_decode_error(Msg, Check) when is_function(Check) ->
8291    ticket_pretty_decode_error(Msg, [], Check).
8292
8293ticket_pretty_decode_error(Msg, Conf, Check) ->
8294    Codec = megaco_pretty_text_encoder,
8295    ticket_decode_error(Msg, Codec, Conf, Check).
8296
8297ticket_decode_error(Msg, Codec, Conf) ->
8298    Check = fun(X) ->
8299		    d("decode error reason: ~n~p~n", [X]),
8300		    ok
8301	    end, % Only called when decode failes
8302    ticket_decode_error(Msg, Codec, Conf, Check).
8303
8304ticket_decode_error(Msg, Codec, Conf0, Check) ->
8305    Conf   = [?EC_V3|Conf0],
8306    Decode = fun(B) -> decode_message(Codec, false, Conf, B) end,
8307    megaco_codec_test_lib:expect_decode(Msg, Decode, Check).
8308
8309%% --
8310
8311%% ticket_expect_exec(Instructions, Msg) ->
8312%%     megaco_codec_test_lib:expect_exec(Instructions, Msg).
8313
8314%% ticket_expect_instruction(Desc, Cmd, Verify) ->
8315%%     megaco_codec_test_lib:expect_instruction(Desc, Cmd, Verify).
8316
8317
8318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8319
8320%% pretty_decode_message(DynamicDecode, Conf, Bin) ->
8321%%     decode_message(megaco_pretty_text_encoder, DynamicDecode, Conf, Bin).
8322
8323%% compact_decode_message(DynamicDecode, Conf, Bin) ->
8324%%     decode_message(megaco_compact_text_encoder, DynamicDecode, Conf, Bin).
8325
8326decode_message(Codec, DynamicDecode, Conf, Bin) ->
8327    megaco_codec_test_lib:decode_message(Codec, DynamicDecode, ?VERSION,
8328					 Conf, Bin).
8329
8330%% pretty_encode_message(Conf, Msg) ->
8331%%     encode_message(megaco_pretty_text_encoder, Conf, Msg).
8332
8333%% compact_encode_message(Conf, Msg) ->
8334%%     encode_message(megaco_compact_text_encoder, Conf, Msg).
8335
8336encode_message(Codec, Conf, Msg) ->
8337    megaco_codec_test_lib:encode_message(Codec, ?VERSION, Conf, Msg).
8338
8339test_msgs(Codec, DynamicDecode, Conf, Msgs) ->
8340    megaco_codec_test_lib:test_msgs(Codec, DynamicDecode, ?VERSION, Conf,
8341				    fun chk_MegacoMessage/2, Msgs).
8342
8343
8344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8345
8346chk_MegacoMessage(M1, M2) ->
8347    ?MSG_LIB:chk_MegacoMessage(M1, M2).
8348
8349
8350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8351
8352cre_MegacoMessage(Mess) ->
8353    ?MSG_LIB:cre_MegacoMessage(Mess).
8354
8355cre_MegacoMessage(Auth, Mess) ->
8356    ?MSG_LIB:cre_MegacoMessage(Auth, Mess).
8357
8358cre_MegacoMessage(V, Mid, Body) ->
8359    Mess = ?MSG_LIB:cre_Message(V, Mid, Body),
8360    cre_MegacoMessage(Mess).
8361
8362cre_AuthHeader() ->
8363    SecParmIdx = [239, 205, 171, 137],
8364    SeqNum     = [18, 52, 86, 120],
8365    AD         = [18, 52, 86, 120, 137, 171, 205, 239, 118, 84, 50, 16],
8366    cre_AuthHeader(SecParmIdx, SeqNum, AD).
8367
8368cre_AuthHeader(Idx, Num, D) ->
8369    ?MSG_LIB:cre_AuthenticationHeader(Idx, Num, D).
8370
8371cre_Msg(Mid, Body) ->
8372    cre_Msg(?VERSION, Mid, Body).
8373
8374cre_Msg(V, Mid, Body) ->
8375    ?MSG_LIB:cre_Message(V, Mid, Body).
8376
8377cre_TransId(TransId) ->
8378    ?MSG_LIB:cre_TransactionId(TransId).
8379
8380cre_Trans(Trans) ->
8381    ?MSG_LIB:cre_Transaction(Trans).
8382
8383cre_TransReq(TransId, Actions) ->
8384    ?MSG_LIB:cre_TransactionRequest(TransId, Actions).
8385
8386cre_TransRep(TransId, Actions) ->
8387    ?MSG_LIB:cre_TransactionReply(TransId, Actions).
8388
8389cre_TransRep(TransId, Actions, SN) ->
8390    ?MSG_LIB:cre_TransactionReply(TransId, Actions, SN).
8391
8392cre_TransRep(TransId, Actions, SN, SC) ->
8393    ?MSG_LIB:cre_TransactionReply(TransId, Actions, SN, SC).
8394
8395cre_SegRep(TransId, SN) ->
8396    ?MSG_LIB:cre_SegmentReply(TransId, SN).
8397
8398cre_SegRep(TransId, SN, SC) ->
8399    ?MSG_LIB:cre_SegmentReply(TransId, SN, SC).
8400
8401cre_TransAck(First, Last) ->
8402    ?MSG_LIB:cre_TransactionAck(First, Last).
8403
8404cre_ActReq(CtxId, CmdReqs) ->
8405    ?MSG_LIB:cre_ActionRequest(CtxId, CmdReqs).
8406
8407cre_ActRep(CtxId, CmdReps) ->
8408    ?MSG_LIB:cre_ActionReply(CtxId, CmdReps).
8409
8410cre_ActRep(CtxId, ED, CR, CmdReps) ->
8411    ?MSG_LIB:cre_ActionReply(CtxId, ED, CR, CmdReps).
8412
8413cre_CtxReq() ->
8414    ?MSG_LIB:cre_ContextRequest().
8415
8416cre_CtxReq(A) ->
8417    ?MSG_LIB:cre_ContextRequest(A).
8418
8419cre_CtxReq(A, B) ->
8420    ?MSG_LIB:cre_ContextRequest(A, B).
8421
8422cre_CtxReq(A, B, C) ->
8423    ?MSG_LIB:cre_ContextRequest(A, B, C).
8424
8425cre_CtxReq(A, B, C, D) ->
8426    ?MSG_LIB:cre_ContextRequest(A, B, C, D).
8427
8428cre_CtxReq(A, B, C, D, E) ->
8429    ?MSG_LIB:cre_ContextRequest(A, B, C, D, E).
8430
8431cre_CtxReq(Prio, Em, Top, Ieps, CtxProp, CtxList) ->
8432    ?MSG_LIB:cre_ContextRequest(Prio, Em, Top, Ieps, CtxProp, CtxList).
8433
8434cre_CtxAttrAuditReq() ->
8435    ?MSG_LIB:cre_ContextAttrAuditRequest().
8436
8437% cre_CtxAttrAuditReq(A) ->
8438%     ?MSG_LIB:cre_ContextAttrAuditRequest(A).
8439
8440% cre_CtxAttrAuditReq(A, B) ->
8441%     ?MSG_LIB:cre_ContextAttrAuditRequest(A, B).
8442
8443cre_CtxAttrAuditReq(A, B, C) ->
8444    ?MSG_LIB:cre_ContextAttrAuditRequest(A, B, C).
8445
8446cre_CtxAttrAuditReq(A, B, C, D) ->
8447    ?MSG_LIB:cre_ContextAttrAuditRequest(A, B, C, D).
8448
8449cre_CtxAttrAuditReq(A, B, C, D, E) ->
8450    ?MSG_LIB:cre_ContextAttrAuditRequest(A, B, C, D, E).
8451
8452cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, Ctx, SPrio) ->
8453    ?MSG_LIB:cre_ContextAttrAuditRequest(Top, Em, Prio, Ieps, Ctx, SPrio).
8454
8455cre_CtxAttrAuditReq(A, B, C, D, E, F, G) ->
8456    ?MSG_LIB:cre_ContextAttrAuditRequest(A, B, C, D, E, F, G).
8457
8458cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, Ctx, SPrio, SEm, SIeps) ->
8459    ?MSG_LIB:cre_ContextAttrAuditRequest(Top, Em, Prio, Ieps, Ctx,
8460					 SPrio, SEm, SIeps).
8461
8462cre_CtxAttrAuditReq(Top, Em, Prio, Ieps, Ctx, SPrio, SEm, SIeps, SLog) ->
8463    ?MSG_LIB:cre_ContextAttrAuditRequest(Top, Em, Prio, Ieps, Ctx,
8464					 SPrio, SEm, SIeps, SLog).
8465
8466cre_TopologyRequest(From, To, Dir) ->
8467    ?MSG_LIB:cre_TopologyRequest(From, To, Dir).
8468
8469%% Ind Aud related:
8470
8471cre_IndAudParam(IAP) ->
8472    ?MSG_LIB:cre_IndAuditParameter(IAP).
8473
8474cre_IndAudMediaDesc(D) ->
8475    ?MSG_LIB:cre_IndAudMediaDescriptor(D).
8476
8477cre_IndAudStreamDesc(SID, SP) ->
8478    ?MSG_LIB:cre_IndAudStreamDescriptor(SID, SP).
8479
8480cre_IndAudStreamParms(LCD) ->
8481    ?MSG_LIB:cre_IndAudStreamParms(LCD).
8482
8483cre_IndAudLocalControlDesc(A, B, C, D) ->
8484    ?MSG_LIB:cre_IndAudLocalControlDescriptor(A, B, C, D).
8485
8486cre_IndAudLocalControlDesc(SM, RV, RG, PP, SMS) ->
8487    ?MSG_LIB:cre_IndAudLocalControlDescriptor(SM, RV, RG, PP, SMS).
8488
8489cre_IndAudPropertyParm(Name) ->
8490    ?MSG_LIB:cre_IndAudPropertyParm(Name).
8491
8492cre_IndAudPropertyParm(Name, PP) ->
8493    ?MSG_LIB:cre_IndAudPropertyParm(Name, PP).
8494
8495cre_IndAudTermStateDesc(PP) ->
8496    ?MSG_LIB:cre_IndAudTerminationStateDescriptor(PP).
8497
8498cre_IndAudTermStateDesc(PP, EBC, SS) ->
8499    ?MSG_LIB:cre_IndAudTerminationStateDescriptor(PP, EBC, SS).
8500
8501cre_IndAudTermStateDesc(PP, EBC, SS, SSS) ->
8502    ?MSG_LIB:cre_IndAudTerminationStateDescriptor(PP, EBC, SS, SSS).
8503
8504cre_IndAudEvsDesc(RID, PN)
8505  when is_integer(RID) ->
8506    ?MSG_LIB:cre_IndAudEventsDescriptor(RID, PN).
8507
8508cre_IndAudEvBufDesc(EN, SID) ->
8509    ?MSG_LIB:cre_IndAudEventBufferDescriptor(EN, SID).
8510
8511cre_IndAudSigsDesc(D) ->
8512    ?MSG_LIB:cre_IndAudSignalsDescriptor(D).
8513
8514cre_IndAudSig(SN) ->
8515    ?MSG_LIB:cre_IndAudSignal(SN).
8516
8517cre_IndAudSig(SN, SigRID) ->
8518    ?MSG_LIB:cre_IndAudSignal(SN, SigRID).
8519
8520cre_IndAudSeqSigList(ID, SL) ->
8521    ?MSG_LIB:cre_IndAudSeqSigList(ID, SL).
8522
8523cre_IndAudDigitMapDesc(DMN) ->
8524    ?MSG_LIB:cre_IndAudDigitMapDescriptor(DMN).
8525
8526cre_IndAudStatsDesc(SN) ->
8527    ?MSG_LIB:cre_IndAudStatisticsDescriptor(SN).
8528
8529cre_IndAudPkgsDesc(PN, PV) ->
8530    ?MSG_LIB:cre_IndAudPackagesDescriptor(PN, PV).
8531
8532%% Parameter related
8533cre_PropParm(Name, Val) ->
8534    ?MSG_LIB:cre_PropertyParm(Name, [Val]).
8535
8536cre_PropParm(Name, Vals, Tag, EI) ->
8537    ?MSG_LIB:cre_PropertyParm(Name, Vals, Tag, EI).
8538
8539
8540%% Statistics related
8541cre_StatsDesc(SPs) ->
8542    ?MSG_LIB:cre_StatisticsDescriptor(SPs).
8543
8544cre_StatsParm(Name) ->
8545    ?MSG_LIB:cre_StatisticsParameter(Name).
8546
8547cre_StatsParm(Name, Val) ->
8548    ?MSG_LIB:cre_StatisticsParameter(Name, [Val]).
8549
8550
8551% Event related
8552cre_EvParm(Name, Val) ->
8553    ?MSG_LIB:cre_EventParameter(Name, Val).
8554
8555cre_ObsEv(Name, Not) ->
8556    ?MSG_LIB:cre_ObservedEvent(Name, Not).
8557cre_ObsEv(Name, Not, Par) ->
8558    ?MSG_LIB:cre_ObservedEvent(Name, Par, Not).
8559
8560cre_ReqEv(Name) ->
8561    ?MSG_LIB:cre_RequestedEvent(Name).
8562cre_ReqEv(Name, EPL) ->
8563    ?MSG_LIB:cre_RequestedEvent(Name, EPL).
8564cre_ReqEv(Name, SID, RA, EPL) ->
8565    ?MSG_LIB:cre_RequestedEvent(Name, SID, RA, EPL).
8566
8567
8568cre_ObsEvsDesc(Id, EvList) ->
8569    ?MSG_LIB:cre_ObservedEventsDescriptor(Id, EvList).
8570
8571cre_EvsDesc(Id, EvList) ->
8572    ?MSG_LIB:cre_EventsDescriptor(Id, EvList).
8573
8574
8575%% Service change related
8576cre_SvcChParm(M, A, R, P) ->
8577    ?MSG_LIB:cre_ServiceChangeParm(M, A, P, R).
8578
8579cre_SvcChParm(M, A, R, P, IF) ->
8580    ?MSG_LIB:cre_ServiceChangeParm(M, A, asn1_NOVALUE, P, R, asn1_NOVALUE,
8581			  asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE, IF).
8582
8583cre_SvcChResParm(A, P) ->
8584    ?MSG_LIB:cre_ServiceChangeResParm(A, P).
8585
8586cre_SvcChReq(Tids, P) ->
8587    ?MSG_LIB:cre_ServiceChangeRequest(Tids, P).
8588
8589cre_SvcChProf(Name, Ver) ->
8590    ?MSG_LIB:cre_ServiceChangeProfile(Name, Ver).
8591
8592cre_SvcChAddr(Tag, Val) ->
8593    ?MSG_LIB:cre_ServiceChangeAddress(Tag, Val).
8594
8595cre_SvcChMethod(M) ->
8596    ?MSG_LIB:cre_ServiceChangeMethod(M).
8597
8598cre_SvcChRep(Tids, Res) ->
8599    ?MSG_LIB:cre_ServiceChangeReply(Tids, Res).
8600
8601
8602%% Stream related
8603cre_StreamID(Id) ->
8604    ?MSG_LIB:cre_StreamID(Id).
8605
8606cre_StreamParms(Lcd) ->
8607    ?MSG_LIB:cre_StreamParms(Lcd).
8608cre_StreamParms(Lcd, Ld) ->
8609    ?MSG_LIB:cre_StreamParms(Lcd, Ld).
8610cre_StreamParms(Lcd, Ld, Rd) ->
8611    ?MSG_LIB:cre_StreamParms(Lcd, Ld, Rd).
8612cre_StreamParmsL(Ld) ->
8613    ?MSG_LIB:cre_StreamParms(asn1_NOVALUE, Ld, asn1_NOVALUE).
8614cre_StreamParmsR(Rd) ->
8615    ?MSG_LIB:cre_StreamParms(asn1_NOVALUE, asn1_NOVALUE, Rd).
8616
8617cre_StreamDesc(Id, P) ->
8618    ?MSG_LIB:cre_StreamDescriptor(Id, P).
8619
8620
8621%% "Local" related
8622cre_LocalControlDesc(Mode) ->
8623    ?MSG_LIB:cre_LocalControlDescriptor(Mode).
8624cre_LocalControlDesc(Mode, Parms) ->
8625    ?MSG_LIB:cre_LocalControlDescriptor(Mode, Parms).
8626
8627cre_LocalRemoteDesc(Grps) ->
8628    ?MSG_LIB:cre_LocalRemoteDescriptor(Grps).
8629
8630
8631%% DigitMap related
8632cre_DigitMapDesc() ->
8633    ?MSG_LIB:cre_DigitMapDescriptor().
8634cre_DigitMapDesc(NameOrVal) ->
8635    ?MSG_LIB:cre_DigitMapDescriptor(NameOrVal).
8636cre_DigitMapDesc(Name, Val) ->
8637    ?MSG_LIB:cre_DigitMapDescriptor(Name, Val).
8638
8639cre_DigitMapValue(Body) ->
8640    ?MSG_LIB:cre_DigitMapValue(Body).
8641
8642cre_DigitMapValue(Body, Start, Short, Long) ->
8643    ?MSG_LIB:cre_DigitMapValue(Start, Short, Long, Body).
8644
8645%% Media related
8646cre_MediaDesc(SD) when is_record(SD, 'StreamDescriptor') ->
8647    cre_MediaDesc([SD]);
8648cre_MediaDesc(SDs) ->
8649    ?MSG_LIB:cre_MediaDescriptor(SDs).
8650
8651
8652%% Notify related
8653cre_NotifyReq(Tids, EvsDesc) ->
8654    ?MSG_LIB:cre_NotifyRequest(Tids, EvsDesc).
8655
8656cre_NotifyRep(Tids) ->
8657    ?MSG_LIB:cre_NotifyReply(Tids).
8658
8659
8660%% Subtract related
8661cre_SubReq(Tids, Desc) ->
8662    ?MSG_LIB:cre_SubtractRequest(Tids, Desc).
8663
8664
8665%% Audit related
8666cre_AuditDesc(Tokens) ->
8667    ?MSG_LIB:cre_AuditDescriptor(Tokens).
8668
8669cre_AuditDesc(Tokens, PropertTokens) ->
8670    ?MSG_LIB:cre_AuditDescriptor(Tokens, PropertTokens).
8671
8672cre_AuditReq(Tid, Desc) ->
8673    ?MSG_LIB:cre_AuditRequest(Tid, Desc).
8674
8675cre_AuditRep(AR) ->
8676    ?MSG_LIB:cre_AuditReply(AR).
8677
8678cre_AuditRes(Tid, Res) ->
8679    ?MSG_LIB:cre_AuditResult(Tid, Res).
8680
8681cre_TermAudit(ARP) ->
8682    ?MSG_LIB:cre_TerminationAudit(ARP).
8683
8684cre_AuditRetParam(D) ->
8685    ?MSG_LIB:cre_AuditReturnParameter(D).
8686
8687cre_TermListAuditRes(TIDs, TA) ->
8688    ?MSG_LIB:cre_TermListAuditResult(TIDs, TA).
8689
8690%% AMM/AMMS related
8691cre_AmmDesc(D) ->
8692    ?MSG_LIB:cre_AmmDescriptor(D).
8693
8694cre_AmmReq(Tids, Descs) ->
8695    ?MSG_LIB:cre_AmmRequest(Tids, Descs).
8696
8697cre_AmmsReply(Tids) ->
8698    ?MSG_LIB:cre_AmmsReply(Tids).
8699cre_AmmsReply(Tids, Descs) ->
8700    ?MSG_LIB:cre_AmmsReply(Tids, Descs).
8701
8702
8703%% Command related
8704cre_Cmd(Tag, Req) ->
8705    ?MSG_LIB:cre_Command(Tag, Req).
8706
8707cre_CmdReq(Cmd) ->
8708    ?MSG_LIB:cre_CommandRequest(Cmd).
8709
8710cre_CmdRep(Tag, Rep) ->
8711    ?MSG_LIB:cre_CommandReply(Tag, Rep).
8712
8713
8714%% Actions related
8715cre_ReqActs(A) ->
8716    ?MSG_LIB:cre_RequestedActions(A).
8717
8718cre_ReqActs(KA, EDM, SE, SD, NB, RED) ->
8719    ?MSG_LIB:cre_RequestedActions(KA, EDM, SE, SD, NB, RED).
8720
8721%% cre_SecReqActs() ->
8722%%     ?MSG_LIB:cre_SecondRequestedActions().
8723
8724%% cre_SecReqActs(A) ->
8725%%     ?MSG_LIB:cre_SecondRequestedActions(A).
8726
8727cre_SecReqActs(KA, EDM, SD, NB, RED) ->
8728    ?MSG_LIB:cre_SecondRequestedActions(KA, EDM, SD, NB, RED).
8729
8730cre_EvDM(Name) when is_list(Name) ->
8731    ?MSG_LIB:cre_EventDM(Name).
8732
8733cre_RegEmbedDesc() ->
8734    ?MSG_LIB:cre_RegulatedEmbeddedDescriptor().
8735
8736cre_RegEmbedDesc(D) ->
8737    ?MSG_LIB:cre_RegulatedEmbeddedDescriptor(D).
8738
8739cre_RegEmbedDesc(SED, SD) ->
8740    ?MSG_LIB:cre_RegulatedEmbeddedDescriptor(SED, SD).
8741
8742%% cre_SecEvsDesc(REDs) ->
8743%%     ?MSG_LIB:cre_SecondEventsDescriptor(REDs).
8744
8745cre_SecEvsDesc(RID, REDs) ->
8746    ?MSG_LIB:cre_SecondEventsDescriptor(RID, REDs).
8747
8748cre_SecReqEv(N) ->
8749    cre_SecReqEv(N, []).
8750
8751cre_SecReqEv(N, EPL) ->
8752    ?MSG_LIB:cre_SecondRequestedEvent(N, EPL).
8753
8754cre_SecReqEv(N, SID, EA) when is_list(N) and
8755			      is_integer(SID) and
8756			      is_record(EA, 'SecondRequestedActions') ->
8757    cre_SecReqEv(N, SID, EA, []);
8758cre_SecReqEv(A, B, C) ->
8759    ?MSG_LIB:cre_SecondRequestedEvent(A, B, C).
8760
8761cre_SecReqEv(N, SID, EA, EPL) ->
8762    ?MSG_LIB:cre_SecondRequestedEvent(N, SID, EA, EPL).
8763
8764%% Signal related
8765cre_SigsDesc() ->
8766    cre_SigsDesc([]).
8767
8768cre_SigsDesc(SRs) ->
8769    ?MSG_LIB:cre_SignalsDescriptor(SRs).
8770
8771cre_SigDir(D) ->
8772    ?MSG_LIB:cre_SignalDirection(D).
8773
8774cre_Sig(Name) ->
8775    cre_Sig(Name, []).
8776
8777cre_Sig(Name, SPL) ->
8778    ?MSG_LIB:cre_Signal(Name, SPL).
8779
8780cre_Sig(Name, Dir, RID) ->
8781    cre_Sig(Name, [], Dir, RID).
8782
8783cre_Sig(Name, SPL, Dir, RID) ->
8784    cre_Sig(Name, asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE,
8785	    asn1_NOVALUE, SPL, Dir, RID).
8786
8787cre_Sig(Name, SID, ST, Dur, NC, KA, SPL, Dir, RID) ->
8788    ?MSG_LIB:cre_Signal(Name, SID, ST, Dur, NC, KA, SPL, Dir, RID).
8789
8790cre_Sig(Name, SID, ST, Dur, NC, KA, SPL, Dir, RID, ISD) ->
8791    ?MSG_LIB:cre_Signal(Name, SID, ST, Dur, NC, KA, SPL, Dir, RID, ISD).
8792
8793cre_SigReq(S) ->
8794    ?MSG_LIB:cre_SignalRequest(S).
8795
8796cre_NotifBehav(Tag, Val) ->
8797    ?MSG_LIB:cre_NotifyBehaviour(Tag, Val).
8798
8799cre_NotifCompl(NC) ->
8800    ?MSG_LIB:cre_NotifyCompletion(NC).
8801
8802cre_SigType(ST) ->
8803   ?MSG_LIB:cre_SignalType(ST).
8804
8805
8806%% Others
8807cre_ErrCode(EC) ->
8808    ?MSG_LIB:cre_ErrorCode(EC).
8809
8810cre_ErrDesc(EC) ->
8811    ?MSG_LIB:cre_ErrorDescriptor(EC).
8812
8813cre_TermIDList(TIDs) ->
8814    ?MSG_LIB:cre_TerminationIDList(TIDs).
8815
8816cre_ServiceState(SS) ->
8817    ?MSG_LIB:cre_ServiceState(SS).
8818
8819cre_StreamMode(SS) ->
8820    ?MSG_LIB:cre_StreamMode(SS).
8821
8822cre_SelectLogic(Tag) ->
8823    ?MSG_LIB:cre_SelectLogic(Tag).
8824
8825cre_CtxID(CID) ->
8826    ?MSG_LIB:cre_ContextID(CID).
8827
8828cre_ReqID(RID) ->
8829    ?MSG_LIB:cre_RequestID(RID).
8830
8831cre_TimeNot(D,T) ->
8832    ?MSG_LIB:cre_TimeNotation(D, T).
8833
8834cre_PkgsItem(Name, Ver) ->
8835    ?MSG_LIB:cre_PackagesItem(Name, Ver).
8836
8837cre_BOOLEAN(B) ->
8838    ?MSG_LIB:cre_BOOLEAN(B).
8839
8840
8841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8842
8843flex_init(Config) ->
8844    megaco_codec_flex_lib:init(Config).
8845
8846flex_finish(Config) ->
8847    megaco_codec_flex_lib:finish(Config).
8848
8849flex_scanner_conf(Config) ->
8850    megaco_codec_flex_lib:scanner_conf(Config).
8851
8852%% start_flex_scanner() ->
8853%%     megaco_codec_flex_lib:start().
8854
8855%% stop_flex_scanner(Pid) ->
8856%%     megaco_codec_flex_lib:stop(Pid).
8857
8858
8859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8860
8861t(F,A) ->
8862    p(printable(get(severity),trc),trc,F,A).
8863
8864d(F,A) ->
8865    p(printable(get(severity),dbg),dbg,F,A).
8866
8867%% l(F,A) ->
8868%%     p(printable(get(severity),log),log,F,A).
8869
8870e(F,A) ->
8871    p(printable(get(severity),err),err,F,A).
8872
8873
8874printable(trc,_) ->
8875    true;
8876printable(dbg,trc) ->
8877    false;
8878printable(dbg,_) ->
8879    true;
8880printable(log,log) ->
8881    true;
8882printable(log,err) ->
8883    true;
8884printable(err,err) ->
8885    true;
8886printable(_,_) ->
8887    false.
8888
8889
8890image_of(trc) ->
8891    "TRC";
8892image_of(dbg) ->
8893    "DBG";
8894image_of(log) ->
8895    "LOG";
8896image_of(err) ->
8897    "ERR";
8898image_of(L) ->
8899    io_lib:format("~p",[L]).
8900
8901
8902p(true,L,F,A) ->
8903    io:format("~s:" ++ F ++ "~n", [image_of(L)|A]);
8904p(_,_,_,_) ->
8905    ok.
8906
8907
8908p(F, A) ->
8909    io:format("*** [~s] ***"
8910	      "~n   " ++ F ++ "~n",
8911	      [?FTS() | A]).
8912