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