summaryrefslogtreecommitdiff
path: root/CSTA-application-context-information-csta3.erl
blob: fdf7405bf7d90918a1484f8d7ec62a43e5be97e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
%% Generated by the Erlang ASN.1 BER-compiler version:1.7
%% Purpose: encoder and decoder to the types in mod CSTA-application-context-information-csta3

-module('CSTA-application-context-information-csta3').
-include("CSTA-application-context-information-csta3.hrl").
-define('RT_BER',asn1rt_ber_bin).
-asn1_info([{vsn,'1.7'},
            {module,'CSTA-application-context-information-csta3'},
            {options,[{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},warnings,ber,errors,{cwd,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{outdir,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110]},{i,[46]},{i,[47,104,111,109,101,47,113,117,97,120,47,101,114,108,47,97,115,110,47,107,109,101]}]}]).

-export([encoding_rule/0]).
-export([
'enc_CSTAFunctionality'/2,
'enc_SwitchingFunctionServicesC2'/2,
'enc_EventReportServicesC2'/2,
'enc_ComputingFunctionServicesC2'/2,
'enc_BidirectionalServicesC2'/2,
'enc_StatusReportingServicesC2'/2,
'enc_InputOutputServicesC2'/2,
'enc_VoiceUnitServicesC2'/2,
'enc_ACSEUserInformationForCSTA'/2,
'enc_OldACSEUserInformationForCSTA'/2,
'enc_NewACSEUserInformationForCSTA'/2,
'enc_CSTAPrivateDataVersionList'/2,
'enc_CSTAVersion'/2,
'enc_CallControlServices'/2,
'enc_CallAssociatedServices'/2,
'enc_MediaAttachmentServices'/2,
'enc_RouteingServices'/2,
'enc_VoiceUnitServices'/2,
'enc_LocationServices'/2,
'enc_CallControlEvents'/2,
'enc_CallAssociatedEvents'/2,
'enc_MediaAttachmentEvents'/2,
'enc_PhysicalDeviceFeatureEvents'/2,
'enc_LogicalDeviceFeatureEvents'/2,
'enc_DeviceMaintenanceEvents'/2,
'enc_VoiceUnitEvents'/2,
'enc_VendorSpecEvents'/2
]).

-export([
'dec_CSTAFunctionality'/2,
'dec_SwitchingFunctionServicesC2'/2,
'dec_EventReportServicesC2'/2,
'dec_ComputingFunctionServicesC2'/2,
'dec_BidirectionalServicesC2'/2,
'dec_StatusReportingServicesC2'/2,
'dec_InputOutputServicesC2'/2,
'dec_VoiceUnitServicesC2'/2,
'dec_ACSEUserInformationForCSTA'/2,
'dec_OldACSEUserInformationForCSTA'/2,
'dec_NewACSEUserInformationForCSTA'/2,
'dec_CSTAPrivateDataVersionList'/2,
'dec_CSTAVersion'/2,
'dec_CallControlServices'/2,
'dec_CallAssociatedServices'/2,
'dec_MediaAttachmentServices'/2,
'dec_RouteingServices'/2,
'dec_VoiceUnitServices'/2,
'dec_LocationServices'/2,
'dec_CallControlEvents'/2,
'dec_CallAssociatedEvents'/2,
'dec_MediaAttachmentEvents'/2,
'dec_PhysicalDeviceFeatureEvents'/2,
'dec_LogicalDeviceFeatureEvents'/2,
'dec_DeviceMaintenanceEvents'/2,
'dec_VoiceUnitEvents'/2,
'dec_VendorSpecEvents'/2
]).

-export([
'dec_CSTAFunctionality'/3,
'dec_SwitchingFunctionServicesC2'/3,
'dec_EventReportServicesC2'/3,
'dec_ComputingFunctionServicesC2'/3,
'dec_BidirectionalServicesC2'/3,
'dec_StatusReportingServicesC2'/3,
'dec_InputOutputServicesC2'/3,
'dec_VoiceUnitServicesC2'/3,
'dec_ACSEUserInformationForCSTA'/3,
'dec_OldACSEUserInformationForCSTA'/3,
'dec_NewACSEUserInformationForCSTA'/3,
'dec_CSTAPrivateDataVersionList'/3,
'dec_CSTAVersion'/3,
'dec_CallControlServices'/3,
'dec_CallAssociatedServices'/3,
'dec_MediaAttachmentServices'/3,
'dec_RouteingServices'/3,
'dec_VoiceUnitServices'/3,
'dec_LocationServices'/3,
'dec_CallControlEvents'/3,
'dec_CallAssociatedEvents'/3,
'dec_MediaAttachmentEvents'/3,
'dec_PhysicalDeviceFeatureEvents'/3,
'dec_LogicalDeviceFeatureEvents'/3,
'dec_DeviceMaintenanceEvents'/3,
'dec_VoiceUnitEvents'/3,
'dec_VendorSpecEvents'/3
]).

-export([info/0]).


-export([encode/2,decode/2,encode_disp/2,decode_disp/2]).

encoding_rule() ->
   ber.

encode(Type,Data) ->
case catch encode_disp(Type,Data) of
  {'EXIT',{error,Reason}} ->
    {error,Reason};
  {'EXIT',Reason} ->
    {error,{asn1,Reason}};
  {Bytes,_Len} ->
    {ok,wrap_encode(Bytes)};
  Bytes ->
    {ok,wrap_encode(Bytes)}
end.

decode(Type,Data) ->
case catch decode_disp(Type,wrap_decode(Data)) of
  {'EXIT',{error,Reason}} ->
    {error,Reason};
  {'EXIT',Reason} ->
    {error,{asn1,Reason}};
  {X,_Rest} ->
    {ok,X};
  {X,_Rest,_Len} ->
    {ok,X}
end.

encode_disp('CSTAFunctionality',Data) -> 'enc_CSTAFunctionality'(Data,[]);
encode_disp('SwitchingFunctionServicesC2',Data) -> 'enc_SwitchingFunctionServicesC2'(Data,[]);
encode_disp('EventReportServicesC2',Data) -> 'enc_EventReportServicesC2'(Data,[]);
encode_disp('ComputingFunctionServicesC2',Data) -> 'enc_ComputingFunctionServicesC2'(Data,[]);
encode_disp('BidirectionalServicesC2',Data) -> 'enc_BidirectionalServicesC2'(Data,[]);
encode_disp('StatusReportingServicesC2',Data) -> 'enc_StatusReportingServicesC2'(Data,[]);
encode_disp('InputOutputServicesC2',Data) -> 'enc_InputOutputServicesC2'(Data,[]);
encode_disp('VoiceUnitServicesC2',Data) -> 'enc_VoiceUnitServicesC2'(Data,[]);
encode_disp('ACSEUserInformationForCSTA',Data) -> 'enc_ACSEUserInformationForCSTA'(Data,[]);
encode_disp('OldACSEUserInformationForCSTA',Data) -> 'enc_OldACSEUserInformationForCSTA'(Data,[]);
encode_disp('NewACSEUserInformationForCSTA',Data) -> 'enc_NewACSEUserInformationForCSTA'(Data,[]);
encode_disp('CSTAPrivateDataVersionList',Data) -> 'enc_CSTAPrivateDataVersionList'(Data,[]);
encode_disp('CSTAVersion',Data) -> 'enc_CSTAVersion'(Data,[]);
encode_disp('CallControlServices',Data) -> 'enc_CallControlServices'(Data,[]);
encode_disp('CallAssociatedServices',Data) -> 'enc_CallAssociatedServices'(Data,[]);
encode_disp('MediaAttachmentServices',Data) -> 'enc_MediaAttachmentServices'(Data,[]);
encode_disp('RouteingServices',Data) -> 'enc_RouteingServices'(Data,[]);
encode_disp('VoiceUnitServices',Data) -> 'enc_VoiceUnitServices'(Data,[]);
encode_disp('LocationServices',Data) -> 'enc_LocationServices'(Data,[]);
encode_disp('CallControlEvents',Data) -> 'enc_CallControlEvents'(Data,[]);
encode_disp('CallAssociatedEvents',Data) -> 'enc_CallAssociatedEvents'(Data,[]);
encode_disp('MediaAttachmentEvents',Data) -> 'enc_MediaAttachmentEvents'(Data,[]);
encode_disp('PhysicalDeviceFeatureEvents',Data) -> 'enc_PhysicalDeviceFeatureEvents'(Data,[]);
encode_disp('LogicalDeviceFeatureEvents',Data) -> 'enc_LogicalDeviceFeatureEvents'(Data,[]);
encode_disp('DeviceMaintenanceEvents',Data) -> 'enc_DeviceMaintenanceEvents'(Data,[]);
encode_disp('VoiceUnitEvents',Data) -> 'enc_VoiceUnitEvents'(Data,[]);
encode_disp('VendorSpecEvents',Data) -> 'enc_VendorSpecEvents'(Data,[]);
encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).


decode_disp('CSTAFunctionality',Data) -> 'dec_CSTAFunctionality'(Data,mandatory);
decode_disp('SwitchingFunctionServicesC2',Data) -> 'dec_SwitchingFunctionServicesC2'(Data,mandatory);
decode_disp('EventReportServicesC2',Data) -> 'dec_EventReportServicesC2'(Data,mandatory);
decode_disp('ComputingFunctionServicesC2',Data) -> 'dec_ComputingFunctionServicesC2'(Data,mandatory);
decode_disp('BidirectionalServicesC2',Data) -> 'dec_BidirectionalServicesC2'(Data,mandatory);
decode_disp('StatusReportingServicesC2',Data) -> 'dec_StatusReportingServicesC2'(Data,mandatory);
decode_disp('InputOutputServicesC2',Data) -> 'dec_InputOutputServicesC2'(Data,mandatory);
decode_disp('VoiceUnitServicesC2',Data) -> 'dec_VoiceUnitServicesC2'(Data,mandatory);
decode_disp('ACSEUserInformationForCSTA',Data) -> 'dec_ACSEUserInformationForCSTA'(Data,mandatory);
decode_disp('OldACSEUserInformationForCSTA',Data) -> 'dec_OldACSEUserInformationForCSTA'(Data,mandatory);
decode_disp('NewACSEUserInformationForCSTA',Data) -> 'dec_NewACSEUserInformationForCSTA'(Data,mandatory);
decode_disp('CSTAPrivateDataVersionList',Data) -> 'dec_CSTAPrivateDataVersionList'(Data,mandatory);
decode_disp('CSTAVersion',Data) -> 'dec_CSTAVersion'(Data,mandatory);
decode_disp('CallControlServices',Data) -> 'dec_CallControlServices'(Data,mandatory);
decode_disp('CallAssociatedServices',Data) -> 'dec_CallAssociatedServices'(Data,mandatory);
decode_disp('MediaAttachmentServices',Data) -> 'dec_MediaAttachmentServices'(Data,mandatory);
decode_disp('RouteingServices',Data) -> 'dec_RouteingServices'(Data,mandatory);
decode_disp('VoiceUnitServices',Data) -> 'dec_VoiceUnitServices'(Data,mandatory);
decode_disp('LocationServices',Data) -> 'dec_LocationServices'(Data,mandatory);
decode_disp('CallControlEvents',Data) -> 'dec_CallControlEvents'(Data,mandatory);
decode_disp('CallAssociatedEvents',Data) -> 'dec_CallAssociatedEvents'(Data,mandatory);
decode_disp('MediaAttachmentEvents',Data) -> 'dec_MediaAttachmentEvents'(Data,mandatory);
decode_disp('PhysicalDeviceFeatureEvents',Data) -> 'dec_PhysicalDeviceFeatureEvents'(Data,mandatory);
decode_disp('LogicalDeviceFeatureEvents',Data) -> 'dec_LogicalDeviceFeatureEvents'(Data,mandatory);
decode_disp('DeviceMaintenanceEvents',Data) -> 'dec_DeviceMaintenanceEvents'(Data,mandatory);
decode_disp('VoiceUnitEvents',Data) -> 'dec_VoiceUnitEvents'(Data,mandatory);
decode_disp('VendorSpecEvents',Data) -> 'dec_VendorSpecEvents'(Data,mandatory);
decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).



wrap_encode(Bytes) when is_list(Bytes) ->
   binary_to_list(list_to_binary(Bytes));
wrap_encode(Bytes) when is_binary(Bytes) ->
   binary_to_list(Bytes);
wrap_encode(Bytes) -> Bytes.

wrap_decode(Bytes) when is_list(Bytes) ->
   list_to_binary(Bytes);
wrap_decode(Bytes) -> Bytes.


info() ->
   case ?MODULE:module_info() of
      MI when is_list(MI) ->
         case lists:keysearch(attributes,1,MI) of
            {value,{_,Attributes}} when is_list(Attributes) ->
               case lists:keysearch(asn1_info,1,Attributes) of
                  {value,{_,Info}} when is_list(Info) ->
                     Info;
                  _ ->
                     []
               end;
            _ ->
               []
         end
   end.


%%================================
%%  CSTAFunctionality
%%================================
'enc_CSTAFunctionality'(Val, TagIn) ->

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case ?RT_BER:cindex(2,Val,switchingFunctionServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,switchingFunctionServices), [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], [{tag,128,0,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 2 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case ?RT_BER:cindex(3,Val,eventReportServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(3,Val,eventReportServices), [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], [{tag,128,1,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 3 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case ?RT_BER:cindex(4,Val,computingFunctionServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(4,Val,computingFunctionServices), [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], [{tag,128,2,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 4 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case ?RT_BER:cindex(5,Val,bidirectionalServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(5,Val,bidirectionalServices), [{escapeService,0},{systemStatus,1}], [{tag,128,3,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 5 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case ?RT_BER:cindex(6,Val,statusReportingServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(6,Val,statusReportingServices), [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], [{tag,128,4,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 6 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes6,EncLen6} =  case ?RT_BER:cindex(7,Val,inputOutputServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(7,Val,inputOutputServices), [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], [{tag,128,5,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 7 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {EncBytes7,EncLen7} =  case ?RT_BER:cindex(8,Val,voiceUnitServices) of
         asn1_DEFAULT -> {<<>>,0};
         [] -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], ?RT_BER:cindex(8,Val,voiceUnitServices), [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], [{tag,128,6,'IMPLICIT',32}])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7],
  LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7,
  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).


'dec_CSTAFunctionality'(Bytes, OptOrMand) ->
   'dec_CSTAFunctionality'(Bytes, OptOrMand, []).

'dec_CSTAFunctionality'(Bytes, OptOrMand, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
   {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), 
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term1,Bytes3,Rb2} = case Bytes2 of
<<2:2,_:1,0:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes2,[],[{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}],[{tag,128,0,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes2, 0 }
end,

%%-------------------------------------------------
%% attribute number 2 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term2,Bytes4,Rb3} = case Bytes3 of
<<2:2,_:1,1:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes3,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}],[{tag,128,1,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes3, 0 }
end,

%%-------------------------------------------------
%% attribute number 3 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term3,Bytes5,Rb4} = case Bytes4 of
<<2:2,_:1,2:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes4,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],[{tag,128,2,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes4, 0 }
end,

%%-------------------------------------------------
%% attribute number 4 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term4,Bytes6,Rb5} = case Bytes5 of
<<2:2,_:1,3:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes5,[],[{escapeService,0},{systemStatus,1}],[{tag,128,3,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes5, 0 }
end,

%%-------------------------------------------------
%% attribute number 5 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term5,Bytes7,Rb6} = case Bytes6 of
<<2:2,_:1,4:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes6,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],[{tag,128,4,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes6, 0 }
end,

%%-------------------------------------------------
%% attribute number 6 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term6,Bytes8,Rb7} = case Bytes7 of
<<2:2,_:1,5:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes7,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],[{tag,128,5,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes7, 0 }
end,

%%-------------------------------------------------
%% attribute number 7 with type BIT STRING DEFAULT = []
%%-------------------------------------------------
   {Term7,Bytes9,Rb8} = case Bytes8 of
<<2:2,_:1,6:5,_/binary>> ->
?RT_BER:decode_bit_string(Bytes8,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}],[{tag,128,6,'IMPLICIT',32}], no_length, mandatory);
_ ->
{[],Bytes8, 0 }
end,

   {Bytes10,Rb9} = ?RT_BER:restbytes2(RemBytes, Bytes9,noext),
   {{'CSTAFunctionality', Term1, Term2, Term3, Term4, Term5, Term6, Term7}, Bytes10, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6+Rb7+Rb8+Rb9}.


%%================================
%%  SwitchingFunctionServicesC2
%%================================

'enc_SwitchingFunctionServicesC2'({'SwitchingFunctionServicesC2',Val}, TagIn) ->
   'enc_SwitchingFunctionServicesC2'(Val, TagIn);

'enc_SwitchingFunctionServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}], TagIn ++ []).


'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand) ->
   'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, []).

'dec_SwitchingFunctionServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{alternateCall,0},{answerCall,1},{associateData,2},{callCompletion,3},{clearCall,4},{clearConnection,5},{conferenceCall,6},{consultationCall,7},{divertCall,8},{holdCall,9},{makeCall,10},{makePredictiveCall,11},{parkCall,12},{queryDevice,13},{reconnectCall,14},{retrieveCall,15},{sendDTMFTones,16},{setFeature,17},{singleStepConference,18},{singleStepTransfer,19},{transferCall,20}],TagIn++[], no_length, OptOrMand).



%%================================
%%  EventReportServicesC2
%%================================

'enc_EventReportServicesC2'({'EventReportServicesC2',Val}, TagIn) ->
   'enc_EventReportServicesC2'(Val, TagIn);

'enc_EventReportServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}], TagIn ++ []).


'dec_EventReportServicesC2'(Bytes, OptOrMand) ->
   'dec_EventReportServicesC2'(Bytes, OptOrMand, []).

'dec_EventReportServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{autoAnswer,14},{callInformation,15},{doNotDisturb,16},{forwarding,17},{messageWaiting,18},{microphoneMute,19},{speakerMute,20},{speakerVolume,21},{agentBusy,22},{loggedOn,23},{loggedOff,24},{notReady,25},{ready,26},{workingAfterCall,27},{backInService,28},{outOfServiceEvent,29},{privateEvent,30},{playEvent,31},{recordEvent,32},{reviewEvent,33},{stopEvent,34},{suspendPlayEvent,35},{suspendRecordEvent,36},{voiceAttributesChangeEvent,37}],TagIn++[], no_length, OptOrMand).



%%================================
%%  ComputingFunctionServicesC2
%%================================

'enc_ComputingFunctionServicesC2'({'ComputingFunctionServicesC2',Val}, TagIn) ->
   'enc_ComputingFunctionServicesC2'(Val, TagIn);

'enc_ComputingFunctionServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}], TagIn ++ []).


'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand) ->
   'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, []).

'dec_ComputingFunctionServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{routeRequest,0},{reRouteRequest,1},{routeSelectRequest,2},{routeUsedRequest,3},{routeEndRequest,4}],TagIn++[], no_length, OptOrMand).



%%================================
%%  BidirectionalServicesC2
%%================================

'enc_BidirectionalServicesC2'({'BidirectionalServicesC2',Val}, TagIn) ->
   'enc_BidirectionalServicesC2'(Val, TagIn);

'enc_BidirectionalServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{escapeService,0},{systemStatus,1}], TagIn ++ []).


'dec_BidirectionalServicesC2'(Bytes, OptOrMand) ->
   'dec_BidirectionalServicesC2'(Bytes, OptOrMand, []).

'dec_BidirectionalServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{escapeService,0},{systemStatus,1}],TagIn++[], no_length, OptOrMand).



%%================================
%%  StatusReportingServicesC2
%%================================

'enc_StatusReportingServicesC2'({'StatusReportingServicesC2',Val}, TagIn) ->
   'enc_StatusReportingServicesC2'(Val, TagIn);

'enc_StatusReportingServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}], TagIn ++ []).


'dec_StatusReportingServicesC2'(Bytes, OptOrMand) ->
   'dec_StatusReportingServicesC2'(Bytes, OptOrMand, []).

'dec_StatusReportingServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{monitorStart,0},{changeMonitorFilter,1},{monitorStop,2},{snapshotDevice,3},{snapshotCall,4}],TagIn++[], no_length, OptOrMand).



%%================================
%%  InputOutputServicesC2
%%================================

'enc_InputOutputServicesC2'({'InputOutputServicesC2',Val}, TagIn) ->
   'enc_InputOutputServicesC2'(Val, TagIn);

'enc_InputOutputServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}], TagIn ++ []).


'dec_InputOutputServicesC2'(Bytes, OptOrMand) ->
   'dec_InputOutputServicesC2'(Bytes, OptOrMand, []).

'dec_InputOutputServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{startDataPathService,0},{stopDataPathService,1},{sendDataService,2},{sendMulticastDataService,3},{sendBroadcastDataService,4},{suspendDataPathService,5},{dataPathSuspendedService,6},{resumeDataPath,7},{dataPathResumedService,8},{fastData,9}],TagIn++[], no_length, OptOrMand).



%%================================
%%  VoiceUnitServicesC2
%%================================

'enc_VoiceUnitServicesC2'({'VoiceUnitServicesC2',Val}, TagIn) ->
   'enc_VoiceUnitServicesC2'(Val, TagIn);

'enc_VoiceUnitServicesC2'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}], TagIn ++ []).


'dec_VoiceUnitServicesC2'(Bytes, OptOrMand) ->
   'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, []).

'dec_VoiceUnitServicesC2'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11}],TagIn++[], no_length, OptOrMand).



%%================================
%%  ACSEUserInformationForCSTA
%%================================

'enc_ACSEUserInformationForCSTA'({'ACSEUserInformationForCSTA',Val}, TagIn) ->
   'enc_ACSEUserInformationForCSTA'(Val, TagIn);

'enc_ACSEUserInformationForCSTA'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      oldDefinition ->
         'enc_OldACSEUserInformationForCSTA'(element(2,Val), []);
      newDefinition ->
         'enc_NewACSEUserInformationForCSTA'(element(2,Val), [{tag,128,0,'IMPLICIT',32}]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn ++[], EncBytes, EncLen).




'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand) ->
   'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, []).

'dec_ACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) ->
   {{_,Len},Bytes1, RbExp} = ?RT_BER:check_tags(TagIn++[], Bytes, OptOrMand),
   IndefEndBytes = fun(indefinite,<<0,0,R/binary>>)-> R; (_,B)-> B end,
   IndefEndRb = fun(indefinite,<<0,0,_R/binary>>)-> 2; (_,_)-> 0 end,
   case Bytes1 of

%% 'oldDefinition'
      <<0:2,_:1,16:5,_/binary>> ->
         {Dec, Rest, RbCho} = 'dec_OldACSEUserInformationForCSTA'(Bytes1, mandatory, []),
         {{oldDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};


%% 'newDefinition'
      <<2:2,_:1,0:5,_/binary>> ->
         {Dec, Rest, RbCho} = 'dec_NewACSEUserInformationForCSTA'(Bytes1, mandatory, [{tag,128,0,'IMPLICIT',32}]),
         {{newDefinition, Dec}, IndefEndBytes(Len,Rest), RbExp + RbCho + IndefEndRb(Len,Rest)};

      Else -> 
         case OptOrMand of
            mandatory ->exit({error,{asn1,{invalid_choice_tag,Else}}});
            _ ->exit({error,{asn1,{no_optional_tag,Else}}})
         end
   end.


%%================================
%%  OldACSEUserInformationForCSTA
%%================================
'enc_OldACSEUserInformationForCSTA'(Val, TagIn) ->

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], []),

%%-------------------------------------------------
%% attribute number 2   External CSTA-application-context-information-csta3:CSTAFunctionality
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), []),

%%-------------------------------------------------
%% attribute number 3   External CSTA-application-context-information-csta3:CSTAFunctionality
%%-------------------------------------------------
   {EncBytes3,EncLen3} = 'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), []),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
  LenSoFar = EncLen1 + EncLen2 + EncLen3,
  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).


'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand) ->
   'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, []).

'dec_OldACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
   {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), 
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING
%%-------------------------------------------------
   {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],[], no_length, mandatory),

%%-------------------------------------------------
%% attribute number 2   External CSTA-application-context-information-csta3:CSTAFunctionality
%%-------------------------------------------------
   {Term2,Bytes4,Rb3} = 'dec_CSTAFunctionality'(Bytes3, mandatory, []),

%%-------------------------------------------------
%% attribute number 3   External CSTA-application-context-information-csta3:CSTAFunctionality
%%-------------------------------------------------
   {Term3,Bytes5,Rb4} = 'dec_CSTAFunctionality'(Bytes4, mandatory, []),

   {Bytes6,Rb5} = ?RT_BER:restbytes2(RemBytes, Bytes5,noext),
   {{'OldACSEUserInformationForCSTA', Term1, Term2, Term3}, Bytes6, Rb1+Rb2+Rb3+Rb4+Rb5}.


%%================================
%%  NewACSEUserInformationForCSTA
%%================================
'enc_NewACSEUserInformationForCSTA'(Val, TagIn) ->

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_bit_string([], ?RT_BER:cindex(2,Val,cSTAVersion), [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], []),

%%-------------------------------------------------
%% attribute number 2   External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case ?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication) of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_CSTAFunctionality'(?RT_BER:cindex(3,Val,cSTAFunctionsRequiredByApplication), [{tag,128,0,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 3   External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case ?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied) of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_CSTAFunctionality'(?RT_BER:cindex(4,Val,cSTAFunctionsThatCanBeSupplied), [{tag,128,1,'IMPLICIT',32}])
       end,

%%-------------------------------------------------
%% attribute number 4   External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case ?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList) of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_CSTAPrivateDataVersionList'(?RT_BER:cindex(5,Val,cSTAPrivateDataVersionList), [{tag,128,2,'IMPLICIT',32}])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
  LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
  ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], BytesSoFar, LenSoFar).


'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand) ->
   'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, []).

'dec_NewACSEUserInformationForCSTA'(Bytes, OptOrMand, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
   {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), 
{Bytes2,RemBytes} = ?RT_BER:split_list(Bytes1,Len),

%%-------------------------------------------------
%% attribute number 1 with type BIT STRING
%%-------------------------------------------------
   {Term1,Bytes3,Rb2} = ?RT_BER:decode_bit_string(Bytes2,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],[], no_length, mandatory),

%%-------------------------------------------------
%% attribute number 2   External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL
%%-------------------------------------------------
   {Term2,Bytes4,Rb3} = case Bytes3 of
<<2:2,_:1,0:5,_/binary>> ->
'dec_CSTAFunctionality'(Bytes3, opt_or_default, [{tag,128,0,'IMPLICIT',32}]);
_ ->
{ asn1_NOVALUE, Bytes3, 0 }
end,

%%-------------------------------------------------
%% attribute number 3   External CSTA-application-context-information-csta3:CSTAFunctionality OPTIONAL
%%-------------------------------------------------
   {Term3,Bytes5,Rb4} = case Bytes4 of
<<2:2,_:1,1:5,_/binary>> ->
'dec_CSTAFunctionality'(Bytes4, opt_or_default, [{tag,128,1,'IMPLICIT',32}]);
_ ->
{ asn1_NOVALUE, Bytes4, 0 }
end,

%%-------------------------------------------------
%% attribute number 4   External CSTA-application-context-information-csta3:CSTAPrivateDataVersionList OPTIONAL
%%-------------------------------------------------
   {Term4,Bytes6,Rb5} = case Bytes5 of
<<2:2,_:1,2:5,_/binary>> ->
'dec_CSTAPrivateDataVersionList'(Bytes5, opt_or_default, [{tag,128,2,'IMPLICIT',32}]);
_ ->
{ asn1_NOVALUE, Bytes5, 0 }
end,

   {Bytes7,Rb6} = ?RT_BER:restbytes2(RemBytes, Bytes6,noext),
   {{'NewACSEUserInformationForCSTA', Term1, Term2, Term3, Term4}, Bytes7, Rb1+Rb2+Rb3+Rb4+Rb5+Rb6}.


%%================================
%%  CSTAPrivateDataVersionList
%%================================

'enc_CSTAPrivateDataVersionList'({'CSTAPrivateDataVersionList',Val}, TagIn) ->
   'enc_CSTAPrivateDataVersionList'(Val, TagIn);

'enc_CSTAPrivateDataVersionList'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_CSTAPrivateDataVersionList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], EncBytes, EncLen).

'enc_CSTAPrivateDataVersionList_components'([], AccBytes, AccLen) -> 
   {lists:reverse(AccBytes),AccLen};

'enc_CSTAPrivateDataVersionList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = ?RT_BER:encode_integer([], H, []),
   'enc_CSTAPrivateDataVersionList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand) ->
   'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, []).

'dec_CSTAPrivateDataVersionList'(Bytes, OptOrMand, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
   {{_,Len},Bytes1,Rb1} = ?RT_BER:check_tags(TagIn ++ [{tag,0,16,'IMPLICIT',32}], Bytes, OptOrMand), 
   ?RT_BER:decode_components(Rb1, Len, Bytes1, fun(FBytes,_,_)->
?RT_BER:decode_integer(FBytes,[],[], mandatory)
end, [], []).




%%================================
%%  CSTAVersion
%%================================

'enc_CSTAVersion'({'CSTAVersion',Val}, TagIn) ->
   'enc_CSTAVersion'(Val, TagIn);

'enc_CSTAVersion'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}], TagIn ++ []).


'dec_CSTAVersion'(Bytes, OptOrMand) ->
   'dec_CSTAVersion'(Bytes, OptOrMand, []).

'dec_CSTAVersion'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{versionOne,0},{versionTwo,1},{versionThree,2},{versionFour,3},{versionFive,4},{versionSix,5},{versionSeven,6},{versionEight,7},{versionNine,8},{versionTen,9},{versionEleven,10},{versionTwelve,11},{versionThirteen,12},{versionFourteen,13},{versionFifteen,14},{versionSixteen,15},{versionSeventeen,16},{versionEighteen,17},{versionNineteen,18},{versionTwenty,19},{versionTwentyone,20},{versionTwentytwo,21},{versionTwentythree,22},{versionTwentyfour,23}],TagIn++[], no_length, OptOrMand).



%%================================
%%  CallControlServices
%%================================

'enc_CallControlServices'({'CallControlServices',Val}, TagIn) ->
   'enc_CallControlServices'(Val, TagIn);

'enc_CallControlServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}], TagIn ++ []).


'dec_CallControlServices'(Bytes, OptOrMand) ->
   'dec_CallControlServices'(Bytes, OptOrMand, []).

'dec_CallControlServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{acceptCall,0},{alternateCall,1},{answerCall,2},{callBack,3},{callBackMessage,4},{campOnCall,5},{clearCall,6},{clearConnection,7},{conferenceCall,8},{consultationCall,9},{deflectCall,10},{dialDigits,11},{directedPickupCall,12},{groupPickupCall,13},{holdCall,14},{intrudeCall,15},{joinCall,16},{makeCall,17},{makePredictiveCall,18},{parkCall,19},{reconnectCall,20},{retrieveCall,21},{singleStepConference,22},{singleStepTransfer,23},{transferCall,24},{makeConnection,25},{sendMessage,26}],TagIn++[], no_length, OptOrMand).



%%================================
%%  CallAssociatedServices
%%================================

'enc_CallAssociatedServices'({'CallAssociatedServices',Val}, TagIn) ->
   'enc_CallAssociatedServices'(Val, TagIn);

'enc_CallAssociatedServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}], TagIn ++ []).


'dec_CallAssociatedServices'(Bytes, OptOrMand) ->
   'dec_CallAssociatedServices'(Bytes, OptOrMand, []).

'dec_CallAssociatedServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{associateData,0},{cancelTelephonyTones,1},{generateDigits,2},{generateTelephonyTones,3},{sendUserInformation,4},{changeConnectionInformation,5}],TagIn++[], no_length, OptOrMand).



%%================================
%%  MediaAttachmentServices
%%================================

'enc_MediaAttachmentServices'({'MediaAttachmentServices',Val}, TagIn) ->
   'enc_MediaAttachmentServices'(Val, TagIn);

'enc_MediaAttachmentServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{attachMediaService,0},{detachMediaService,1}], TagIn ++ []).


'dec_MediaAttachmentServices'(Bytes, OptOrMand) ->
   'dec_MediaAttachmentServices'(Bytes, OptOrMand, []).

'dec_MediaAttachmentServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{attachMediaService,0},{detachMediaService,1}],TagIn++[], no_length, OptOrMand).



%%================================
%%  RouteingServices
%%================================

'enc_RouteingServices'({'RouteingServices',Val}, TagIn) ->
   'enc_RouteingServices'(Val, TagIn);

'enc_RouteingServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}], TagIn ++ []).


'dec_RouteingServices'(Bytes, OptOrMand) ->
   'dec_RouteingServices'(Bytes, OptOrMand, []).

'dec_RouteingServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{routeRegister,0},{routeRegisterCancel,1},{routeRegisterAbort,2},{reroute,3},{routeEnd,4},{routeReject,5},{routeRequest,6},{routeSelect,7},{routeUsed,8}],TagIn++[], no_length, OptOrMand).



%%================================
%%  VoiceUnitServices
%%================================

'enc_VoiceUnitServices'({'VoiceUnitServices',Val}, TagIn) ->
   'enc_VoiceUnitServices'(Val, TagIn);

'enc_VoiceUnitServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}], TagIn ++ []).


'dec_VoiceUnitServices'(Bytes, OptOrMand) ->
   'dec_VoiceUnitServices'(Bytes, OptOrMand, []).

'dec_VoiceUnitServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{concatenateMessage,0},{deleteMessage,1},{playMessage,2},{queryVoiceAttribute,3},{recordMessage,4},{reposition,5},{resume,6},{review,7},{setVoiceAttribute,8},{stop,9},{suspend,10},{synthesizeMessage,11},{activate,12},{clear,13},{deactivate,14}],TagIn++[], no_length, OptOrMand).



%%================================
%%  LocationServices
%%================================

'enc_LocationServices'({'LocationServices',Val}, TagIn) ->
   'enc_LocationServices'(Val, TagIn);

'enc_LocationServices'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}], TagIn ++ []).


'dec_LocationServices'(Bytes, OptOrMand) ->
   'dec_LocationServices'(Bytes, OptOrMand, []).

'dec_LocationServices'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{getLocationInformation,0},{setLocationInformation,1},{locationTrackkingSessionResumed,2},{locationTrackkingSessionSuspended,3},{resumeLocationTrackingSession,4},{locationInformationReport,5},{startLocationTrackingSession,6},{stopLocationTrackingSession,7},{suspendLocationTrackingCapabilities,8},{locationSessionInfo,9}],TagIn++[], no_length, OptOrMand).



%%================================
%%  CallControlEvents
%%================================

'enc_CallControlEvents'({'CallControlEvents',Val}, TagIn) ->
   'enc_CallControlEvents'(Val, TagIn);

'enc_CallControlEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}], TagIn ++ []).


'dec_CallControlEvents'(Bytes, OptOrMand) ->
   'dec_CallControlEvents'(Bytes, OptOrMand, []).

'dec_CallControlEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{callCleared,0},{conferenced,1},{connectionCleared,2},{delivered,3},{diverted,4},{established,5},{failed,6},{held,7},{networkReached,8},{originated,9},{queued,10},{retrieved,11},{serviceInitiated,12},{transferred,13},{digitsDialed,14},{bridged,15},{networkCapabilitiesChanged,16},{offered,17}],TagIn++[], no_length, OptOrMand).



%%================================
%%  CallAssociatedEvents
%%================================

'enc_CallAssociatedEvents'({'CallAssociatedEvents',Val}, TagIn) ->
   'enc_CallAssociatedEvents'(Val, TagIn);

'enc_CallAssociatedEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}], TagIn ++ []).


'dec_CallAssociatedEvents'(Bytes, OptOrMand) ->
   'dec_CallAssociatedEvents'(Bytes, OptOrMand, []).

'dec_CallAssociatedEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{callInformation,0},{charging,1},{dTMFDigitsDetected,2},{telephonyTonesDetected,3},{serviceCompletionFailure,4}],TagIn++[], no_length, OptOrMand).



%%================================
%%  MediaAttachmentEvents
%%================================

'enc_MediaAttachmentEvents'({'MediaAttachmentEvents',Val}, TagIn) ->
   'enc_MediaAttachmentEvents'(Val, TagIn);

'enc_MediaAttachmentEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{mediaAttached,0},{mediaDetached,1}], TagIn ++ []).


'dec_MediaAttachmentEvents'(Bytes, OptOrMand) ->
   'dec_MediaAttachmentEvents'(Bytes, OptOrMand, []).

'dec_MediaAttachmentEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{mediaAttached,0},{mediaDetached,1}],TagIn++[], no_length, OptOrMand).



%%================================
%%  PhysicalDeviceFeatureEvents
%%================================

'enc_PhysicalDeviceFeatureEvents'({'PhysicalDeviceFeatureEvents',Val}, TagIn) ->
   'enc_PhysicalDeviceFeatureEvents'(Val, TagIn);

'enc_PhysicalDeviceFeatureEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}], TagIn ++ []).


'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand) ->
   'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, []).

'dec_PhysicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{buttonInformation,0},{buttonPress,1},{displayUpdated,2},{hookswitch,3},{lampMode,4},{messageWaiting,5},{microphoneGain,6},{microphoneMute,7},{ringerStatus,8},{speakerMute,9},{speakerVolume,10}],TagIn++[], no_length, OptOrMand).



%%================================
%%  LogicalDeviceFeatureEvents
%%================================

'enc_LogicalDeviceFeatureEvents'({'LogicalDeviceFeatureEvents',Val}, TagIn) ->
   'enc_LogicalDeviceFeatureEvents'(Val, TagIn);

'enc_LogicalDeviceFeatureEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}], TagIn ++ []).


'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand) ->
   'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, []).

'dec_LogicalDeviceFeatureEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{agentBusy,0},{agentLoggedOn,1},{agentLoggedOff,2},{agentNotReady,3},{agentReady,4},{agentWorkingAfterCall,5},{autoAnswer,6},{autoWorkMode,7},{callBack,8},{callBackMessage,9},{callerIDStatus,10},{doNotDisturb,11},{forwarding,12},{routeingMode,13},{presenceState,14}],TagIn++[], no_length, OptOrMand).



%%================================
%%  DeviceMaintenanceEvents
%%================================

'enc_DeviceMaintenanceEvents'({'DeviceMaintenanceEvents',Val}, TagIn) ->
   'enc_DeviceMaintenanceEvents'(Val, TagIn);

'enc_DeviceMaintenanceEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}], TagIn ++ []).


'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand) ->
   'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, []).

'dec_DeviceMaintenanceEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{backInService,0},{outOfService,1},{deviceCapabilityChanged,2},{partiallyInService,3}],TagIn++[], no_length, OptOrMand).



%%================================
%%  VoiceUnitEvents
%%================================

'enc_VoiceUnitEvents'({'VoiceUnitEvents',Val}, TagIn) ->
   'enc_VoiceUnitEvents'(Val, TagIn);

'enc_VoiceUnitEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}], TagIn ++ []).


'dec_VoiceUnitEvents'(Bytes, OptOrMand) ->
   'dec_VoiceUnitEvents'(Bytes, OptOrMand, []).

'dec_VoiceUnitEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{stop,0},{play,1},{suspendPlay,2},{record,3},{suspendRecord,4},{review,5},{voiceAttributesChange,6},{bookmarkReached,7},{completed,8},{dtmfDetected,9},{emptied,10},{interruptionDetected,11},{notRecognized,12},{recognized,13},{started,14},{silenceTimeoutExpired,15},{speechDetected,16},{voiceErrorOccured,17}],TagIn++[], no_length, OptOrMand).



%%================================
%%  VendorSpecEvents
%%================================

'enc_VendorSpecEvents'({'VendorSpecEvents',Val}, TagIn) ->
   'enc_VendorSpecEvents'(Val, TagIn);

'enc_VendorSpecEvents'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{privateEvent,0}], TagIn ++ []).


'dec_VendorSpecEvents'(Bytes, OptOrMand) ->
   'dec_VendorSpecEvents'(Bytes, OptOrMand, []).

'dec_VendorSpecEvents'(Bytes, OptOrMand, TagIn) ->
?RT_BER:decode_bit_string(Bytes,[],[{privateEvent,0}],TagIn++[], no_length, OptOrMand).