%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:1.6.13
%% Purpose: encoder and decoder to the types in mod megaco_ber_bin_media_gateway_control_prev3a

-module('megaco_ber_bin_media_gateway_control_prev3a').
-include("megaco_ber_bin_media_gateway_control_prev3a.hrl").
-define('RT_BER',asn1rt_ber_bin_v2).
-asn1_info([{vsn,'1.6.13'},
            {module,'megaco_ber_bin_media_gateway_control_prev3a'},
            {options,[ber_bin_v2,report_errors,{cwd,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,51,98,48,52,46,50,48,49,48,45,48,50,45,50,50,95,50,48,47,111,116,112,95,115,114,99,95,82,49,51,66,48,52,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]},{outdir,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,51,98,48,52,46,50,48,49,48,45,48,50,45,50,50,95,50,48,47,111,116,112,95,115,114,99,95,82,49,51,66,48,52,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]},optimize,asn1config,noobj,{i,[46]},{i,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,51,98,48,52,46,50,48,49,48,45,48,50,45,50,50,95,50,48,47,111,116,112,95,115,114,99,95,82,49,51,66,48,52,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]}]}]).

-export([encoding_rule/0]).
-export([
'enc_Value'/2,
'enc_TimeNotation'/2,
'enc_H221NonStandard'/2,
'enc_NonStandardIdentifier'/2,
'enc_NonStandardData'/2,
'enc_StatisticsParameter'/2,
'enc_StatisticsDescriptor'/2,
'enc_PackagesItem'/2,
'enc_PackagesDescriptor'/2,
'enc_ServiceChangeProfile'/2,
'enc_ServiceChangeMethod'/2,
'enc_ServiceChangeResParm'/2,
'enc_ServiceChangeAddress'/2,
'enc_ServiceChangeParm'/2,
'enc_DigitMapValue'/2,
'enc_DigitMapName'/2,
'enc_DigitMapDescriptor'/2,
'enc_ModemType'/2,
'enc_ModemDescriptor'/2,
'enc_RequestID'/2,
'enc_SigParameter'/2,
'enc_NotifyCompletion'/2,
'enc_SignalName'/2,
'enc_SignalDirection'/2,
'enc_SignalType'/2,
'enc_Signal'/2,
'enc_SeqSigList'/2,
'enc_SignalRequest'/2,
'enc_SignalsDescriptor'/2,
'enc_EventSpec'/2,
'enc_EventBufferDescriptor'/2,
'enc_SecondRequestedActions'/2,
'enc_SecondRequestedEvent'/2,
'enc_SecondEventsDescriptor'/2,
'enc_EventDM'/2,
'enc_RequestedActions'/2,
'enc_RequestedEvent'/2,
'enc_EventsDescriptor'/2,
'enc_StreamID'/2,
'enc_MuxType'/2,
'enc_MuxDescriptor'/2,
'enc_ServiceState'/2,
'enc_EventBufferControl'/2,
'enc_TerminationStateDescriptor'/2,
'enc_PropertyGroup'/2,
'enc_LocalRemoteDescriptor'/2,
'enc_Relation'/2,
'enc_PkgdName'/2,
'enc_Name'/2,
'enc_PropertyParm'/2,
'enc_StreamMode'/2,
'enc_LocalControlDescriptor'/2,
'enc_StreamParms'/2,
'enc_StreamDescriptor'/2,
'enc_MediaDescriptor'/2,
'enc_TerminationIDList'/2,
'enc_TerminationID'/2,
'enc_WildcardField'/2,
'enc_ServiceChangeResult'/2,
'enc_ServiceChangeReply'/2,
'enc_ServiceChangeRequest'/2,
'enc_EventParameter'/2,
'enc_EventName'/2,
'enc_ObservedEvent'/2,
'enc_ObservedEventsDescriptor'/2,
'enc_NotifyReply'/2,
'enc_NotifyRequest'/2,
'enc_IndAudPackagesDescriptor'/2,
'enc_IndAudStatisticsDescriptor'/2,
'enc_IndAudDigitMapDescriptor'/2,
'enc_IndAudSignal'/2,
'enc_IndAudSeqSigList'/2,
'enc_IndAudSignalsDescriptor'/2,
'enc_IndAudEventBufferDescriptor'/2,
'enc_IndAudEventsDescriptor'/2,
'enc_IndAudTerminationStateDescriptor'/2,
'enc_IndAudPropertyGroup'/2,
'enc_IndAudLocalRemoteDescriptor'/2,
'enc_IndAudPropertyParm'/2,
'enc_IndAudLocalControlDescriptor'/2,
'enc_IndAudStreamParms'/2,
'enc_IndAudStreamDescriptor'/2,
'enc_IndAudMediaDescriptor'/2,
'enc_IndAuditParameter'/2,
'enc_AuditDescriptor'/2,
'enc_AuditReturnParameter'/2,
'enc_TerminationAudit'/2,
'enc_AuditResult'/2,
'enc_AuditReply'/2,
'enc_AuditRequest'/2,
'enc_SubtractRequest'/2,
'enc_AmmsReply'/2,
'enc_AmmDescriptor'/2,
'enc_AmmRequest'/2,
'enc_TopologyRequest'/2,
'enc_CommandReply'/2,
'enc_Command'/2,
'enc_CommandRequest'/2,
'enc_ContextAttrAuditRequest'/2,
'enc_ContextRequest'/2,
'enc_ActionReply'/2,
'enc_ActionRequest'/2,
'enc_ContextID'/2,
'enc_ErrorText'/2,
'enc_ErrorCode'/2,
'enc_ErrorDescriptor'/2,
'enc_TransactionAck'/2,
'enc_TransactionResponseAck'/2,
'enc_SegmentNumber'/2,
'enc_TransactionReply'/2,
'enc_TransactionPending'/2,
'enc_TransactionRequest'/2,
'enc_TransactionId'/2,
'enc_Transaction'/2,
'enc_PathName'/2,
'enc_IP6Address'/2,
'enc_IP4Address'/2,
'enc_DomainName'/2,
'enc_MId'/2,
'enc_Message'/2,
'enc_AuthData'/2,
'enc_SequenceNum'/2,
'enc_SecurityParmIndex'/2,
'enc_AuthenticationHeader'/2,
'enc_MegacoMessage'/2
]).

-export([
'dec_Value'/2,
'dec_TimeNotation'/2,
'dec_H221NonStandard'/2,
'dec_NonStandardIdentifier'/2,
'dec_NonStandardData'/2,
'dec_StatisticsParameter'/2,
'dec_StatisticsDescriptor'/2,
'dec_PackagesItem'/2,
'dec_PackagesDescriptor'/2,
'dec_ServiceChangeProfile'/2,
'dec_ServiceChangeMethod'/2,
'dec_ServiceChangeResParm'/2,
'dec_ServiceChangeAddress'/2,
'dec_ServiceChangeParm'/2,
'dec_DigitMapValue'/2,
'dec_DigitMapName'/2,
'dec_DigitMapDescriptor'/2,
'dec_ModemType'/2,
'dec_ModemDescriptor'/2,
'dec_RequestID'/2,
'dec_SigParameter'/2,
'dec_NotifyCompletion'/2,
'dec_SignalName'/2,
'dec_SignalDirection'/2,
'dec_SignalType'/2,
'dec_Signal'/2,
'dec_SeqSigList'/2,
'dec_SignalRequest'/2,
'dec_SignalsDescriptor'/2,
'dec_EventSpec'/2,
'dec_EventBufferDescriptor'/2,
'dec_SecondRequestedActions'/2,
'dec_SecondRequestedEvent'/2,
'dec_SecondEventsDescriptor'/2,
'dec_EventDM'/2,
'dec_RequestedActions'/2,
'dec_RequestedEvent'/2,
'dec_EventsDescriptor'/2,
'dec_StreamID'/2,
'dec_MuxType'/2,
'dec_MuxDescriptor'/2,
'dec_ServiceState'/2,
'dec_EventBufferControl'/2,
'dec_TerminationStateDescriptor'/2,
'dec_PropertyGroup'/2,
'dec_LocalRemoteDescriptor'/2,
'dec_Relation'/2,
'dec_PkgdName'/2,
'dec_Name'/2,
'dec_PropertyParm'/2,
'dec_StreamMode'/2,
'dec_LocalControlDescriptor'/2,
'dec_StreamParms'/2,
'dec_StreamDescriptor'/2,
'dec_MediaDescriptor'/2,
'dec_TerminationIDList'/2,
'dec_TerminationID'/2,
'dec_WildcardField'/2,
'dec_ServiceChangeResult'/2,
'dec_ServiceChangeReply'/2,
'dec_ServiceChangeRequest'/2,
'dec_EventParameter'/2,
'dec_EventName'/2,
'dec_ObservedEvent'/2,
'dec_ObservedEventsDescriptor'/2,
'dec_NotifyReply'/2,
'dec_NotifyRequest'/2,
'dec_IndAudPackagesDescriptor'/2,
'dec_IndAudStatisticsDescriptor'/2,
'dec_IndAudDigitMapDescriptor'/2,
'dec_IndAudSignal'/2,
'dec_IndAudSeqSigList'/2,
'dec_IndAudSignalsDescriptor'/2,
'dec_IndAudEventBufferDescriptor'/2,
'dec_IndAudEventsDescriptor'/2,
'dec_IndAudTerminationStateDescriptor'/2,
'dec_IndAudPropertyGroup'/2,
'dec_IndAudLocalRemoteDescriptor'/2,
'dec_IndAudPropertyParm'/2,
'dec_IndAudLocalControlDescriptor'/2,
'dec_IndAudStreamParms'/2,
'dec_IndAudStreamDescriptor'/2,
'dec_IndAudMediaDescriptor'/2,
'dec_IndAuditParameter'/2,
'dec_AuditDescriptor'/2,
'dec_AuditReturnParameter'/2,
'dec_TerminationAudit'/2,
'dec_AuditResult'/2,
'dec_AuditReply'/2,
'dec_AuditRequest'/2,
'dec_SubtractRequest'/2,
'dec_AmmsReply'/2,
'dec_AmmDescriptor'/2,
'dec_AmmRequest'/2,
'dec_TopologyRequest'/2,
'dec_CommandReply'/2,
'dec_Command'/2,
'dec_CommandRequest'/2,
'dec_ContextAttrAuditRequest'/2,
'dec_ContextRequest'/2,
'dec_ActionReply'/2,
'dec_ActionRequest'/2,
'dec_ContextID'/2,
'dec_ErrorText'/2,
'dec_ErrorCode'/2,
'dec_ErrorDescriptor'/2,
'dec_TransactionAck'/2,
'dec_TransactionResponseAck'/2,
'dec_SegmentNumber'/2,
'dec_TransactionReply'/2,
'dec_TransactionPending'/2,
'dec_TransactionRequest'/2,
'dec_TransactionId'/2,
'dec_Transaction'/2,
'dec_PathName'/2,
'dec_IP6Address'/2,
'dec_IP4Address'/2,
'dec_DomainName'/2,
'dec_MId'/2,
'dec_Message'/2,
'dec_AuthData'/2,
'dec_SequenceNum'/2,
'dec_SecurityParmIndex'/2,
'dec_AuthenticationHeader'/2,
'dec_MegacoMessage'/2
]).

-export([info/0]).
-export([decode_message_trans_partial/1, decode_message_acts_partial/1, decode_message_version/1, decode_message_mId/1]).
-export([decode_part/2]).


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

encoding_rule() ->
   ber_bin_v2.

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

decode(Type,Data) ->
case catch decode_disp(Type,element(1,?RT_BER:decode(Data))
) of
  {'EXIT',{error,Reason}} ->
    {error,Reason};
  {'EXIT',Reason} ->
    {error,{asn1,Reason}};
  Result ->
    {ok,Result}
end.

decode_partial_incomplete(Type,Data0,Pattern) ->
  {Data,_RestBin} =
    ?RT_BER:decode_primitive_incomplete(Pattern,Data0),
  case catch decode_partial_inc_disp(Type,Data) of
   {'EXIT',{error,Reason}} ->
      {error,Reason};
    {'EXIT',Reason} ->
      {error,{asn1,Reason}};
    Result ->
      {ok,Result}
  end.

decode_part(Type,Data0) ->
  case catch decode_inc_disp(Type,element(1,?RT_BER:decode(Data0))) of
   {'EXIT',{error,Reason}} ->
      {error,Reason};
    {'EXIT',Reason} ->
      {error,{asn1,Reason}};
    Result ->
      {ok,Result}
  end.

encode_disp('Value',Data) -> 'enc_Value'(Data);
encode_disp('TimeNotation',Data) -> 'enc_TimeNotation'(Data);
encode_disp('H221NonStandard',Data) -> 'enc_H221NonStandard'(Data);
encode_disp('NonStandardIdentifier',Data) -> 'enc_NonStandardIdentifier'(Data);
encode_disp('NonStandardData',Data) -> 'enc_NonStandardData'(Data);
encode_disp('StatisticsParameter',Data) -> 'enc_StatisticsParameter'(Data);
encode_disp('StatisticsDescriptor',Data) -> 'enc_StatisticsDescriptor'(Data);
encode_disp('PackagesItem',Data) -> 'enc_PackagesItem'(Data);
encode_disp('PackagesDescriptor',Data) -> 'enc_PackagesDescriptor'(Data);
encode_disp('ServiceChangeProfile',Data) -> 'enc_ServiceChangeProfile'(Data);
encode_disp('ServiceChangeMethod',Data) -> 'enc_ServiceChangeMethod'(Data);
encode_disp('ServiceChangeResParm',Data) -> 'enc_ServiceChangeResParm'(Data);
encode_disp('ServiceChangeAddress',Data) -> 'enc_ServiceChangeAddress'(Data);
encode_disp('ServiceChangeParm',Data) -> 'enc_ServiceChangeParm'(Data);
encode_disp('DigitMapValue',Data) -> 'enc_DigitMapValue'(Data);
encode_disp('DigitMapName',Data) -> 'enc_DigitMapName'(Data);
encode_disp('DigitMapDescriptor',Data) -> 'enc_DigitMapDescriptor'(Data);
encode_disp('ModemType',Data) -> 'enc_ModemType'(Data);
encode_disp('ModemDescriptor',Data) -> 'enc_ModemDescriptor'(Data);
encode_disp('RequestID',Data) -> 'enc_RequestID'(Data);
encode_disp('SigParameter',Data) -> 'enc_SigParameter'(Data);
encode_disp('NotifyCompletion',Data) -> 'enc_NotifyCompletion'(Data);
encode_disp('SignalName',Data) -> 'enc_SignalName'(Data);
encode_disp('SignalDirection',Data) -> 'enc_SignalDirection'(Data);
encode_disp('SignalType',Data) -> 'enc_SignalType'(Data);
encode_disp('Signal',Data) -> 'enc_Signal'(Data);
encode_disp('SeqSigList',Data) -> 'enc_SeqSigList'(Data);
encode_disp('SignalRequest',Data) -> 'enc_SignalRequest'(Data);
encode_disp('SignalsDescriptor',Data) -> 'enc_SignalsDescriptor'(Data);
encode_disp('EventSpec',Data) -> 'enc_EventSpec'(Data);
encode_disp('EventBufferDescriptor',Data) -> 'enc_EventBufferDescriptor'(Data);
encode_disp('SecondRequestedActions',Data) -> 'enc_SecondRequestedActions'(Data);
encode_disp('SecondRequestedEvent',Data) -> 'enc_SecondRequestedEvent'(Data);
encode_disp('SecondEventsDescriptor',Data) -> 'enc_SecondEventsDescriptor'(Data);
encode_disp('EventDM',Data) -> 'enc_EventDM'(Data);
encode_disp('RequestedActions',Data) -> 'enc_RequestedActions'(Data);
encode_disp('RequestedEvent',Data) -> 'enc_RequestedEvent'(Data);
encode_disp('EventsDescriptor',Data) -> 'enc_EventsDescriptor'(Data);
encode_disp('StreamID',Data) -> 'enc_StreamID'(Data);
encode_disp('MuxType',Data) -> 'enc_MuxType'(Data);
encode_disp('MuxDescriptor',Data) -> 'enc_MuxDescriptor'(Data);
encode_disp('ServiceState',Data) -> 'enc_ServiceState'(Data);
encode_disp('EventBufferControl',Data) -> 'enc_EventBufferControl'(Data);
encode_disp('TerminationStateDescriptor',Data) -> 'enc_TerminationStateDescriptor'(Data);
encode_disp('PropertyGroup',Data) -> 'enc_PropertyGroup'(Data);
encode_disp('LocalRemoteDescriptor',Data) -> 'enc_LocalRemoteDescriptor'(Data);
encode_disp('Relation',Data) -> 'enc_Relation'(Data);
encode_disp('PkgdName',Data) -> 'enc_PkgdName'(Data);
encode_disp('Name',Data) -> 'enc_Name'(Data);
encode_disp('PropertyParm',Data) -> 'enc_PropertyParm'(Data);
encode_disp('StreamMode',Data) -> 'enc_StreamMode'(Data);
encode_disp('LocalControlDescriptor',Data) -> 'enc_LocalControlDescriptor'(Data);
encode_disp('StreamParms',Data) -> 'enc_StreamParms'(Data);
encode_disp('StreamDescriptor',Data) -> 'enc_StreamDescriptor'(Data);
encode_disp('MediaDescriptor',Data) -> 'enc_MediaDescriptor'(Data);
encode_disp('TerminationIDList',Data) -> 'enc_TerminationIDList'(Data);
encode_disp('TerminationID',Data) -> 'enc_TerminationID'(Data);
encode_disp('WildcardField',Data) -> 'enc_WildcardField'(Data);
encode_disp('ServiceChangeResult',Data) -> 'enc_ServiceChangeResult'(Data);
encode_disp('ServiceChangeReply',Data) -> 'enc_ServiceChangeReply'(Data);
encode_disp('ServiceChangeRequest',Data) -> 'enc_ServiceChangeRequest'(Data);
encode_disp('EventParameter',Data) -> 'enc_EventParameter'(Data);
encode_disp('EventName',Data) -> 'enc_EventName'(Data);
encode_disp('ObservedEvent',Data) -> 'enc_ObservedEvent'(Data);
encode_disp('ObservedEventsDescriptor',Data) -> 'enc_ObservedEventsDescriptor'(Data);
encode_disp('NotifyReply',Data) -> 'enc_NotifyReply'(Data);
encode_disp('NotifyRequest',Data) -> 'enc_NotifyRequest'(Data);
encode_disp('IndAudPackagesDescriptor',Data) -> 'enc_IndAudPackagesDescriptor'(Data);
encode_disp('IndAudStatisticsDescriptor',Data) -> 'enc_IndAudStatisticsDescriptor'(Data);
encode_disp('IndAudDigitMapDescriptor',Data) -> 'enc_IndAudDigitMapDescriptor'(Data);
encode_disp('IndAudSignal',Data) -> 'enc_IndAudSignal'(Data);
encode_disp('IndAudSeqSigList',Data) -> 'enc_IndAudSeqSigList'(Data);
encode_disp('IndAudSignalsDescriptor',Data) -> 'enc_IndAudSignalsDescriptor'(Data);
encode_disp('IndAudEventBufferDescriptor',Data) -> 'enc_IndAudEventBufferDescriptor'(Data);
encode_disp('IndAudEventsDescriptor',Data) -> 'enc_IndAudEventsDescriptor'(Data);
encode_disp('IndAudTerminationStateDescriptor',Data) -> 'enc_IndAudTerminationStateDescriptor'(Data);
encode_disp('IndAudPropertyGroup',Data) -> 'enc_IndAudPropertyGroup'(Data);
encode_disp('IndAudLocalRemoteDescriptor',Data) -> 'enc_IndAudLocalRemoteDescriptor'(Data);
encode_disp('IndAudPropertyParm',Data) -> 'enc_IndAudPropertyParm'(Data);
encode_disp('IndAudLocalControlDescriptor',Data) -> 'enc_IndAudLocalControlDescriptor'(Data);
encode_disp('IndAudStreamParms',Data) -> 'enc_IndAudStreamParms'(Data);
encode_disp('IndAudStreamDescriptor',Data) -> 'enc_IndAudStreamDescriptor'(Data);
encode_disp('IndAudMediaDescriptor',Data) -> 'enc_IndAudMediaDescriptor'(Data);
encode_disp('IndAuditParameter',Data) -> 'enc_IndAuditParameter'(Data);
encode_disp('AuditDescriptor',Data) -> 'enc_AuditDescriptor'(Data);
encode_disp('AuditReturnParameter',Data) -> 'enc_AuditReturnParameter'(Data);
encode_disp('TerminationAudit',Data) -> 'enc_TerminationAudit'(Data);
encode_disp('AuditResult',Data) -> 'enc_AuditResult'(Data);
encode_disp('AuditReply',Data) -> 'enc_AuditReply'(Data);
encode_disp('AuditRequest',Data) -> 'enc_AuditRequest'(Data);
encode_disp('SubtractRequest',Data) -> 'enc_SubtractRequest'(Data);
encode_disp('AmmsReply',Data) -> 'enc_AmmsReply'(Data);
encode_disp('AmmDescriptor',Data) -> 'enc_AmmDescriptor'(Data);
encode_disp('AmmRequest',Data) -> 'enc_AmmRequest'(Data);
encode_disp('TopologyRequest',Data) -> 'enc_TopologyRequest'(Data);
encode_disp('CommandReply',Data) -> 'enc_CommandReply'(Data);
encode_disp('Command',Data) -> 'enc_Command'(Data);
encode_disp('CommandRequest',Data) -> 'enc_CommandRequest'(Data);
encode_disp('ContextAttrAuditRequest',Data) -> 'enc_ContextAttrAuditRequest'(Data);
encode_disp('ContextRequest',Data) -> 'enc_ContextRequest'(Data);
encode_disp('ActionReply',Data) -> 'enc_ActionReply'(Data);
encode_disp('ActionRequest',Data) -> 'enc_ActionRequest'(Data);
encode_disp('ContextID',Data) -> 'enc_ContextID'(Data);
encode_disp('ErrorText',Data) -> 'enc_ErrorText'(Data);
encode_disp('ErrorCode',Data) -> 'enc_ErrorCode'(Data);
encode_disp('ErrorDescriptor',Data) -> 'enc_ErrorDescriptor'(Data);
encode_disp('TransactionAck',Data) -> 'enc_TransactionAck'(Data);
encode_disp('TransactionResponseAck',Data) -> 'enc_TransactionResponseAck'(Data);
encode_disp('SegmentNumber',Data) -> 'enc_SegmentNumber'(Data);
encode_disp('TransactionReply',Data) -> 'enc_TransactionReply'(Data);
encode_disp('TransactionPending',Data) -> 'enc_TransactionPending'(Data);
encode_disp('TransactionRequest',Data) -> 'enc_TransactionRequest'(Data);
encode_disp('TransactionId',Data) -> 'enc_TransactionId'(Data);
encode_disp('Transaction',Data) -> 'enc_Transaction'(Data);
encode_disp('PathName',Data) -> 'enc_PathName'(Data);
encode_disp('IP6Address',Data) -> 'enc_IP6Address'(Data);
encode_disp('IP4Address',Data) -> 'enc_IP4Address'(Data);
encode_disp('DomainName',Data) -> 'enc_DomainName'(Data);
encode_disp('MId',Data) -> 'enc_MId'(Data);
encode_disp('Message',Data) -> 'enc_Message'(Data);
encode_disp('AuthData',Data) -> 'enc_AuthData'(Data);
encode_disp('SequenceNum',Data) -> 'enc_SequenceNum'(Data);
encode_disp('SecurityParmIndex',Data) -> 'enc_SecurityParmIndex'(Data);
encode_disp('AuthenticationHeader',Data) -> 'enc_AuthenticationHeader'(Data);
encode_disp('MegacoMessage',Data) -> 'enc_MegacoMessage'(Data);
encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).


decode_disp('Value',Data) -> 'dec_Value'(Data);
decode_disp('TimeNotation',Data) -> 'dec_TimeNotation'(Data);
decode_disp('H221NonStandard',Data) -> 'dec_H221NonStandard'(Data);
decode_disp('NonStandardIdentifier',Data) -> 'dec_NonStandardIdentifier'(Data);
decode_disp('NonStandardData',Data) -> 'dec_NonStandardData'(Data);
decode_disp('StatisticsParameter',Data) -> 'dec_StatisticsParameter'(Data);
decode_disp('StatisticsDescriptor',Data) -> 'dec_StatisticsDescriptor'(Data);
decode_disp('PackagesItem',Data) -> 'dec_PackagesItem'(Data);
decode_disp('PackagesDescriptor',Data) -> 'dec_PackagesDescriptor'(Data);
decode_disp('ServiceChangeProfile',Data) -> 'dec_ServiceChangeProfile'(Data);
decode_disp('ServiceChangeMethod',Data) -> 'dec_ServiceChangeMethod'(Data);
decode_disp('ServiceChangeResParm',Data) -> 'dec_ServiceChangeResParm'(Data);
decode_disp('ServiceChangeAddress',Data) -> 'dec_ServiceChangeAddress'(Data);
decode_disp('ServiceChangeParm',Data) -> 'dec_ServiceChangeParm'(Data);
decode_disp('DigitMapValue',Data) -> 'dec_DigitMapValue'(Data);
decode_disp('DigitMapName',Data) -> 'dec_DigitMapName'(Data);
decode_disp('DigitMapDescriptor',Data) -> 'dec_DigitMapDescriptor'(Data);
decode_disp('ModemType',Data) -> 'dec_ModemType'(Data);
decode_disp('ModemDescriptor',Data) -> 'dec_ModemDescriptor'(Data);
decode_disp('RequestID',Data) -> 'dec_RequestID'(Data);
decode_disp('SigParameter',Data) -> 'dec_SigParameter'(Data);
decode_disp('NotifyCompletion',Data) -> 'dec_NotifyCompletion'(Data);
decode_disp('SignalName',Data) -> 'dec_SignalName'(Data);
decode_disp('SignalDirection',Data) -> 'dec_SignalDirection'(Data);
decode_disp('SignalType',Data) -> 'dec_SignalType'(Data);
decode_disp('Signal',Data) -> 'dec_Signal'(Data);
decode_disp('SeqSigList',Data) -> 'dec_SeqSigList'(Data);
decode_disp('SignalRequest',Data) -> 'dec_SignalRequest'(Data);
decode_disp('SignalsDescriptor',Data) -> 'dec_SignalsDescriptor'(Data);
decode_disp('EventSpec',Data) -> 'dec_EventSpec'(Data);
decode_disp('EventBufferDescriptor',Data) -> 'dec_EventBufferDescriptor'(Data);
decode_disp('SecondRequestedActions',Data) -> 'dec_SecondRequestedActions'(Data);
decode_disp('SecondRequestedEvent',Data) -> 'dec_SecondRequestedEvent'(Data);
decode_disp('SecondEventsDescriptor',Data) -> 'dec_SecondEventsDescriptor'(Data);
decode_disp('EventDM',Data) -> 'dec_EventDM'(Data);
decode_disp('RequestedActions',Data) -> 'dec_RequestedActions'(Data);
decode_disp('RequestedEvent',Data) -> 'dec_RequestedEvent'(Data);
decode_disp('EventsDescriptor',Data) -> 'dec_EventsDescriptor'(Data);
decode_disp('StreamID',Data) -> 'dec_StreamID'(Data);
decode_disp('MuxType',Data) -> 'dec_MuxType'(Data);
decode_disp('MuxDescriptor',Data) -> 'dec_MuxDescriptor'(Data);
decode_disp('ServiceState',Data) -> 'dec_ServiceState'(Data);
decode_disp('EventBufferControl',Data) -> 'dec_EventBufferControl'(Data);
decode_disp('TerminationStateDescriptor',Data) -> 'dec_TerminationStateDescriptor'(Data);
decode_disp('PropertyGroup',Data) -> 'dec_PropertyGroup'(Data);
decode_disp('LocalRemoteDescriptor',Data) -> 'dec_LocalRemoteDescriptor'(Data);
decode_disp('Relation',Data) -> 'dec_Relation'(Data);
decode_disp('PkgdName',Data) -> 'dec_PkgdName'(Data);
decode_disp('Name',Data) -> 'dec_Name'(Data);
decode_disp('PropertyParm',Data) -> 'dec_PropertyParm'(Data);
decode_disp('StreamMode',Data) -> 'dec_StreamMode'(Data);
decode_disp('LocalControlDescriptor',Data) -> 'dec_LocalControlDescriptor'(Data);
decode_disp('StreamParms',Data) -> 'dec_StreamParms'(Data);
decode_disp('StreamDescriptor',Data) -> 'dec_StreamDescriptor'(Data);
decode_disp('MediaDescriptor',Data) -> 'dec_MediaDescriptor'(Data);
decode_disp('TerminationIDList',Data) -> 'dec_TerminationIDList'(Data);
decode_disp('TerminationID',Data) -> 'dec_TerminationID'(Data);
decode_disp('WildcardField',Data) -> 'dec_WildcardField'(Data);
decode_disp('ServiceChangeResult',Data) -> 'dec_ServiceChangeResult'(Data);
decode_disp('ServiceChangeReply',Data) -> 'dec_ServiceChangeReply'(Data);
decode_disp('ServiceChangeRequest',Data) -> 'dec_ServiceChangeRequest'(Data);
decode_disp('EventParameter',Data) -> 'dec_EventParameter'(Data);
decode_disp('EventName',Data) -> 'dec_EventName'(Data);
decode_disp('ObservedEvent',Data) -> 'dec_ObservedEvent'(Data);
decode_disp('ObservedEventsDescriptor',Data) -> 'dec_ObservedEventsDescriptor'(Data);
decode_disp('NotifyReply',Data) -> 'dec_NotifyReply'(Data);
decode_disp('NotifyRequest',Data) -> 'dec_NotifyRequest'(Data);
decode_disp('IndAudPackagesDescriptor',Data) -> 'dec_IndAudPackagesDescriptor'(Data);
decode_disp('IndAudStatisticsDescriptor',Data) -> 'dec_IndAudStatisticsDescriptor'(Data);
decode_disp('IndAudDigitMapDescriptor',Data) -> 'dec_IndAudDigitMapDescriptor'(Data);
decode_disp('IndAudSignal',Data) -> 'dec_IndAudSignal'(Data);
decode_disp('IndAudSeqSigList',Data) -> 'dec_IndAudSeqSigList'(Data);
decode_disp('IndAudSignalsDescriptor',Data) -> 'dec_IndAudSignalsDescriptor'(Data);
decode_disp('IndAudEventBufferDescriptor',Data) -> 'dec_IndAudEventBufferDescriptor'(Data);
decode_disp('IndAudEventsDescriptor',Data) -> 'dec_IndAudEventsDescriptor'(Data);
decode_disp('IndAudTerminationStateDescriptor',Data) -> 'dec_IndAudTerminationStateDescriptor'(Data);
decode_disp('IndAudPropertyGroup',Data) -> 'dec_IndAudPropertyGroup'(Data);
decode_disp('IndAudLocalRemoteDescriptor',Data) -> 'dec_IndAudLocalRemoteDescriptor'(Data);
decode_disp('IndAudPropertyParm',Data) -> 'dec_IndAudPropertyParm'(Data);
decode_disp('IndAudLocalControlDescriptor',Data) -> 'dec_IndAudLocalControlDescriptor'(Data);
decode_disp('IndAudStreamParms',Data) -> 'dec_IndAudStreamParms'(Data);
decode_disp('IndAudStreamDescriptor',Data) -> 'dec_IndAudStreamDescriptor'(Data);
decode_disp('IndAudMediaDescriptor',Data) -> 'dec_IndAudMediaDescriptor'(Data);
decode_disp('IndAuditParameter',Data) -> 'dec_IndAuditParameter'(Data);
decode_disp('AuditDescriptor',Data) -> 'dec_AuditDescriptor'(Data);
decode_disp('AuditReturnParameter',Data) -> 'dec_AuditReturnParameter'(Data);
decode_disp('TerminationAudit',Data) -> 'dec_TerminationAudit'(Data);
decode_disp('AuditResult',Data) -> 'dec_AuditResult'(Data);
decode_disp('AuditReply',Data) -> 'dec_AuditReply'(Data);
decode_disp('AuditRequest',Data) -> 'dec_AuditRequest'(Data);
decode_disp('SubtractRequest',Data) -> 'dec_SubtractRequest'(Data);
decode_disp('AmmsReply',Data) -> 'dec_AmmsReply'(Data);
decode_disp('AmmDescriptor',Data) -> 'dec_AmmDescriptor'(Data);
decode_disp('AmmRequest',Data) -> 'dec_AmmRequest'(Data);
decode_disp('TopologyRequest',Data) -> 'dec_TopologyRequest'(Data);
decode_disp('CommandReply',Data) -> 'dec_CommandReply'(Data);
decode_disp('Command',Data) -> 'dec_Command'(Data);
decode_disp('CommandRequest',Data) -> 'dec_CommandRequest'(Data);
decode_disp('ContextAttrAuditRequest',Data) -> 'dec_ContextAttrAuditRequest'(Data);
decode_disp('ContextRequest',Data) -> 'dec_ContextRequest'(Data);
decode_disp('ActionReply',Data) -> 'dec_ActionReply'(Data);
decode_disp('ActionRequest',Data) -> 'dec_ActionRequest'(Data);
decode_disp('ContextID',Data) -> 'dec_ContextID'(Data);
decode_disp('ErrorText',Data) -> 'dec_ErrorText'(Data);
decode_disp('ErrorCode',Data) -> 'dec_ErrorCode'(Data);
decode_disp('ErrorDescriptor',Data) -> 'dec_ErrorDescriptor'(Data);
decode_disp('TransactionAck',Data) -> 'dec_TransactionAck'(Data);
decode_disp('TransactionResponseAck',Data) -> 'dec_TransactionResponseAck'(Data);
decode_disp('SegmentNumber',Data) -> 'dec_SegmentNumber'(Data);
decode_disp('TransactionReply',Data) -> 'dec_TransactionReply'(Data);
decode_disp('TransactionPending',Data) -> 'dec_TransactionPending'(Data);
decode_disp('TransactionRequest',Data) -> 'dec_TransactionRequest'(Data);
decode_disp('TransactionId',Data) -> 'dec_TransactionId'(Data);
decode_disp('Transaction',Data) -> 'dec_Transaction'(Data);
decode_disp('PathName',Data) -> 'dec_PathName'(Data);
decode_disp('IP6Address',Data) -> 'dec_IP6Address'(Data);
decode_disp('IP4Address',Data) -> 'dec_IP4Address'(Data);
decode_disp('DomainName',Data) -> 'dec_DomainName'(Data);
decode_disp('MId',Data) -> 'dec_MId'(Data);
decode_disp('Message',Data) -> 'dec_Message'(Data);
decode_disp('AuthData',Data) -> 'dec_AuthData'(Data);
decode_disp('SequenceNum',Data) -> 'dec_SequenceNum'(Data);
decode_disp('SecurityParmIndex',Data) -> 'dec_SecurityParmIndex'(Data);
decode_disp('AuthenticationHeader',Data) -> 'dec_AuthenticationHeader'(Data);
decode_disp('MegacoMessage',Data) -> 'dec_MegacoMessage'(Data);
decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).


decode_partial_inc_disp('MegacoMessage',Data) ->
  'dec-inc-MegacoMessage'(Data);
decode_partial_inc_disp('Transaction',Data) ->
  'dec-inc-Transaction'(Data);
decode_partial_inc_disp('MegacoMessage_1',Data) ->
  'dec-inc-MegacoMessage_1'(Data);
decode_partial_inc_disp('MegacoMessage_2',Data) ->
  'dec-inc-MegacoMessage_2'(Data);
decode_partial_inc_disp(Type,_Data) ->
  exit({error,{asn1,{undefined_type,Type}}}).



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.


%%================================
%%  Value
%%================================
'enc_Value'(Val) ->
    'enc_Value'(Val, [<<48>>]).


'enc_Value'({'Value',Val}, TagIn) ->
   'enc_Value'(Val, TagIn);

'enc_Value'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_Value_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_Value_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, [<<4>>]),
   'enc_Value_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_Value'(Tlv) ->
   'dec_Value'(Tlv, [16]).

'dec_Value'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
[?RT_BER:decode_octet_string(V1,[],[4]) || V1 <- Tlv1].




%%================================
%%  TimeNotation
%%================================
'enc_TimeNotation'(Val) ->
    'enc_TimeNotation'(Val, [<<48>>]).

'enc_TimeNotation'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute date(1) with type IA5String
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], Cindex1, 22, [<<128>>]),

%%-------------------------------------------------
%% attribute time(2) with type IA5String
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_restricted_string([], Cindex2, 22, [<<129>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_TimeNotation'(Tlv) ->
   'dec_TimeNotation'(Tlv, [16]).

'dec_TimeNotation'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute date(1) with type IA5String
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_restricted_string(V1,8,22,[131072]),

%%-------------------------------------------------
%% attribute time(2) with type IA5String
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_restricted_string(V2,8,22,[131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'TimeNotation', Term1, Term2}.



%%================================
%%  H221NonStandard
%%================================
'enc_H221NonStandard'(Val) ->
    'enc_H221NonStandard'(Val, [<<48>>]).

'enc_H221NonStandard'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute t35CountryCode1(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute t35CountryCode2(2) with type INTEGER
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], Cindex2, [<<129>>]),

%%-------------------------------------------------
%% attribute t35Extension(3) with type INTEGER
%%-------------------------------------------------
   {EncBytes3,EncLen3} = ?RT_BER:encode_integer([], Cindex3, [<<130>>]),

%%-------------------------------------------------
%% attribute manufacturerCode(4) with type INTEGER
%%-------------------------------------------------
   {EncBytes4,EncLen4} = ?RT_BER:encode_integer([], Cindex4, [<<131>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_H221NonStandard'(Tlv) ->
   'dec_H221NonStandard'(Tlv, [16]).

'dec_H221NonStandard'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute t35CountryCode1(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,255},[131072]),

%%-------------------------------------------------
%% attribute t35CountryCode2(2) with type INTEGER
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_integer(V2,{0,255},[131073]),

%%-------------------------------------------------
%% attribute t35Extension(3) with type INTEGER
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = ?RT_BER:decode_integer(V3,{0,255},[131074]),

%%-------------------------------------------------
%% attribute manufacturerCode(4) with type INTEGER
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = ?RT_BER:decode_integer(V4,{0,65535},[131075]),

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'H221NonStandard', Term1, Term2, Term3, Term4}.



%%================================
%%  NonStandardIdentifier
%%================================
'enc_NonStandardIdentifier'(Val) ->
    'enc_NonStandardIdentifier'(Val, []).


'enc_NonStandardIdentifier'({'NonStandardIdentifier',Val}, TagIn) ->
   'enc_NonStandardIdentifier'(Val, TagIn);

'enc_NonStandardIdentifier'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      object ->
         ?RT_BER:encode_object_identifier(element(2,Val), [<<128>>]);
      h221NonStandard ->
         'enc_H221NonStandard'(element(2,Val), [<<161>>]);
      experimental ->
         ?RT_BER:encode_restricted_string([], element(2,Val), 22, [<<130>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_NonStandardIdentifier'(Tlv) ->
   'dec_NonStandardIdentifier'(Tlv, []).

'dec_NonStandardIdentifier'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'object'
    {131072, V1} -> 
        {object, ?RT_BER:decode_object_identifier(V1,[])};


%% 'h221NonStandard'
    {131073, V1} -> 
        {h221NonStandard, 'dec_H221NonStandard'(V1, [])};


%% 'experimental'
    {131074, V1} -> 
        {experimental, ?RT_BER:decode_restricted_string(V1,8,22,[])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  NonStandardData
%%================================
'enc_NonStandardData'(Val) ->
    'enc_NonStandardData'(Val, [<<48>>]).

'enc_NonStandardData'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute nonStandardIdentifier(1)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardIdentifier
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_NonStandardIdentifier'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute data(2) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], Cindex2, [<<129>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_NonStandardData'(Tlv) ->
   'dec_NonStandardData'(Tlv, [16]).

'dec_NonStandardData'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute nonStandardIdentifier(1)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardIdentifier
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_NonStandardIdentifier'(V1, [131072]),

%%-------------------------------------------------
%% attribute data(2) with type OCTET STRING
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_octet_string(V2,[],[131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'NonStandardData', Term1, Term2}.



%%================================
%%  StatisticsParameter
%%================================
'enc_StatisticsParameter'(Val) ->
    'enc_StatisticsParameter'(Val, [<<48>>]).

'enc_StatisticsParameter'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute statName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute statValue(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_Value'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_StatisticsParameter'(Tlv) ->
   'dec_StatisticsParameter'(Tlv, [16]).

'dec_StatisticsParameter'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute statName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute statValue(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_Value'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'StatisticsParameter', Term1, Term2}.



%%================================
%%  StatisticsDescriptor
%%================================
'enc_StatisticsDescriptor'(Val) ->
    'enc_StatisticsDescriptor'(Val, [<<48>>]).


'enc_StatisticsDescriptor'({'StatisticsDescriptor',Val}, TagIn) ->
   'enc_StatisticsDescriptor'(Val, TagIn);

'enc_StatisticsDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_StatisticsDescriptor_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_StatisticsDescriptor_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_StatisticsParameter'(H, [<<48>>]),
   'enc_StatisticsDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_StatisticsDescriptor'(Tlv) ->
   'dec_StatisticsDescriptor'(Tlv, [16]).

'dec_StatisticsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_StatisticsParameter'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  PackagesItem
%%================================
'enc_PackagesItem'(Val) ->
    'enc_PackagesItem'(Val, [<<48>>]).

'enc_PackagesItem'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute packageName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute packageVersion(2) with type INTEGER
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], Cindex2, [<<129>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_PackagesItem'(Tlv) ->
   'dec_PackagesItem'(Tlv, [16]).

'dec_PackagesItem'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute packageName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,2,[131072]),

%%-------------------------------------------------
%% attribute packageVersion(2) with type INTEGER
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_integer(V2,{0,99},[131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'PackagesItem', Term1, Term2}.



%%================================
%%  PackagesDescriptor
%%================================
'enc_PackagesDescriptor'(Val) ->
    'enc_PackagesDescriptor'(Val, [<<48>>]).


'enc_PackagesDescriptor'({'PackagesDescriptor',Val}, TagIn) ->
   'enc_PackagesDescriptor'(Val, TagIn);

'enc_PackagesDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_PackagesDescriptor_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_PackagesDescriptor_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PackagesItem'(H, [<<48>>]),
   'enc_PackagesDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_PackagesDescriptor'(Tlv) ->
   'dec_PackagesDescriptor'(Tlv, [16]).

'dec_PackagesDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PackagesItem'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  ServiceChangeProfile
%%================================
'enc_ServiceChangeProfile'(Val) ->
    'enc_ServiceChangeProfile'(Val, [<<48>>]).

'enc_ServiceChangeProfile'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute profileName(1) with type IA5String
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], Cindex1, 22, [<<128>>]),

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ServiceChangeProfile'(Tlv) ->
   'dec_ServiceChangeProfile'(Tlv, [16]).

'dec_ServiceChangeProfile'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute profileName(1) with type IA5String
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_restricted_string(V1,{1,67},22,[131072]),

case Tlv2 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv2}}}) % extra fields not allowed
end,
   {'ServiceChangeProfile', Term1}.



%%================================
%%  ServiceChangeMethod
%%================================
'enc_ServiceChangeMethod'(Val) ->
    'enc_ServiceChangeMethod'(Val, [<<10>>]).


'enc_ServiceChangeMethod'({'ServiceChangeMethod',Val}, TagIn) ->
   'enc_ServiceChangeMethod'(Val, TagIn);

'enc_ServiceChangeMethod'(Val, TagIn) ->
case Val of
failover -> ?RT_BER:encode_enumerated(0,TagIn);
forced -> ?RT_BER:encode_enumerated(1,TagIn);
graceful -> ?RT_BER:encode_enumerated(2,TagIn);
restart -> ?RT_BER:encode_enumerated(3,TagIn);
disconnected -> ?RT_BER:encode_enumerated(4,TagIn);
handOff -> ?RT_BER:encode_enumerated(5,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_ServiceChangeMethod'(Tlv) ->
   'dec_ServiceChangeMethod'(Tlv, [10]).

'dec_ServiceChangeMethod'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{failover,0},{forced,1},{graceful,2},{restart,3},{disconnected,4},{handOff,5}],[]},TagIn).



%%================================
%%  ServiceChangeResParm
%%================================
'enc_ServiceChangeResParm'(Val) ->
    'enc_ServiceChangeResParm'(Val, [<<48>>]).

'enc_ServiceChangeResParm'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val,

%%-------------------------------------------------
%% attribute serviceChangeMgcId(1)   External megaco_ber_bin_media_gateway_control_prev3a:MId OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_MId'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeAddress(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeAddress OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ServiceChangeAddress'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeVersion(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeProfile(4)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeProfile OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ServiceChangeProfile'(Cindex4, [<<163>>])
       end,

%%-------------------------------------------------
%% attribute timestamp(5)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_TimeNotation'(Cindex5, [<<164>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ServiceChangeResParm'(Tlv) ->
   'dec_ServiceChangeResParm'(Tlv, [16]).

'dec_ServiceChangeResParm'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute serviceChangeMgcId(1)   External megaco_ber_bin_media_gateway_control_prev3a:MId OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_MId'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute serviceChangeAddress(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeAddress OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_ServiceChangeAddress'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute serviceChangeVersion(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_integer(V3,{0,99},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute serviceChangeProfile(4)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeProfile OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_ServiceChangeProfile'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute timestamp(5)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {'dec_TimeNotation'(V5, []), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ServiceChangeResParm', Term1, Term2, Term3, Term4, Term5}.



%%================================
%%  ServiceChangeAddress
%%================================
'enc_ServiceChangeAddress'(Val) ->
    'enc_ServiceChangeAddress'(Val, []).


'enc_ServiceChangeAddress'({'ServiceChangeAddress',Val}, TagIn) ->
   'enc_ServiceChangeAddress'(Val, TagIn);

'enc_ServiceChangeAddress'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      portNumber ->
         ?RT_BER:encode_integer([], element(2,Val), [<<128>>]);
      ip4Address ->
         'enc_IP4Address'(element(2,Val), [<<161>>]);
      ip6Address ->
         'enc_IP6Address'(element(2,Val), [<<162>>]);
      domainName ->
         'enc_DomainName'(element(2,Val), [<<163>>]);
      deviceName ->
         ?RT_BER:encode_restricted_string([], element(2,Val), 22, [<<132>>]);
      mtpAddress ->
         ?RT_BER:encode_octet_string([], element(2,Val), [<<133>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_ServiceChangeAddress'(Tlv) ->
   'dec_ServiceChangeAddress'(Tlv, []).

'dec_ServiceChangeAddress'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'portNumber'
    {131072, V1} -> 
        {portNumber, ?RT_BER:decode_integer(V1,{0,65535},[])};


%% 'ip4Address'
    {131073, V1} -> 
        {ip4Address, 'dec_IP4Address'(V1, [])};


%% 'ip6Address'
    {131074, V1} -> 
        {ip6Address, 'dec_IP6Address'(V1, [])};


%% 'domainName'
    {131075, V1} -> 
        {domainName, 'dec_DomainName'(V1, [])};


%% 'deviceName'
    {131076, V1} -> 
        {deviceName, ?RT_BER:decode_restricted_string(V1,{1,64},22,[])};


%% 'mtpAddress'
    {131077, V1} -> 
        {mtpAddress, ?RT_BER:decode_octet_string(V1,{2,4},[])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  ServiceChangeParm
%%================================
'enc_ServiceChangeParm'(Val) ->
    'enc_ServiceChangeParm'(Val, [<<48>>]).

'enc_ServiceChangeParm'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11} = Val,

%%-------------------------------------------------
%% attribute serviceChangeMethod(1) with type ENUMERATED
%%-------------------------------------------------
   {EncBytes1,EncLen1} = case Cindex1 of
failover -> ?RT_BER:encode_enumerated(0,[<<128>>]);
forced -> ?RT_BER:encode_enumerated(1,[<<128>>]);
graceful -> ?RT_BER:encode_enumerated(2,[<<128>>]);
restart -> ?RT_BER:encode_enumerated(3,[<<128>>]);
disconnected -> ?RT_BER:encode_enumerated(4,[<<128>>]);
handOff -> ?RT_BER:encode_enumerated(5,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end,

%%-------------------------------------------------
%% attribute serviceChangeAddress(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeAddress OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ServiceChangeAddress'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeVersion(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeProfile(4)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeProfile OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ServiceChangeProfile'(Cindex4, [<<163>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeReason(5)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
   {EncBytes5,EncLen5} = 'enc_Value'(Cindex5, [<<164>>]),

%%-------------------------------------------------
%% attribute serviceChangeDelay(6) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes6,EncLen6} =  case Cindex6 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex6, [<<133>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeMgcId(7)   External megaco_ber_bin_media_gateway_control_prev3a:MId OPTIONAL
%%-------------------------------------------------
   {EncBytes7,EncLen7} =  case Cindex7 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_MId'(Cindex7, [<<166>>])
       end,

%%-------------------------------------------------
%% attribute timeStamp(8)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
   {EncBytes8,EncLen8} =  case Cindex8 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_TimeNotation'(Cindex8, [<<167>>])
       end,

%%-------------------------------------------------
%% attribute nonStandardData(9)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
   {EncBytes9,EncLen9} =  case Cindex9 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_NonStandardData'(Cindex9, [<<168>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeInfo(10)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes10,EncLen10} =  case Cindex10 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_AuditDescriptor'(Cindex10, [<<169>>])
       end,

%%-------------------------------------------------
%% attribute serviceChangeIncompleteFlag(11) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes11,EncLen11} =  case Cindex11 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex11, [<<138>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10, EncBytes11],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10 + EncLen11,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ServiceChangeParm'(Tlv) ->
   'dec_ServiceChangeParm'(Tlv, [16]).

'dec_ServiceChangeParm'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute serviceChangeMethod(1) with type ENUMERATED
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_enumerated(V1,[],{[{failover,0},{forced,1},{graceful,2},{restart,3},{disconnected,4},{handOff,5}],[]},[131072]),

%%-------------------------------------------------
%% attribute serviceChangeAddress(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeAddress OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_ServiceChangeAddress'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute serviceChangeVersion(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_integer(V3,{0,99},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute serviceChangeProfile(4)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeProfile OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_ServiceChangeProfile'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute serviceChangeReason(5)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
[V5|Tlv6] = Tlv5, 
Term5 = 'dec_Value'(V5, [131076]),

%%-------------------------------------------------
%% attribute serviceChangeDelay(6) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term6,Tlv7} = case Tlv6 of
[{131077,V6}|TempTlv7] ->
    {?RT_BER:decode_integer(V6,{0,4294967295},[]), TempTlv7};
    _ ->
        { asn1_NOVALUE, Tlv6}
end,

%%-------------------------------------------------
%% attribute serviceChangeMgcId(7)   External megaco_ber_bin_media_gateway_control_prev3a:MId OPTIONAL
%%-------------------------------------------------
{Term7,Tlv8} = case Tlv7 of
[{131078,V7}|TempTlv8] ->
    {'dec_MId'(V7, []), TempTlv8};
    _ ->
        { asn1_NOVALUE, Tlv7}
end,

%%-------------------------------------------------
%% attribute timeStamp(8)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
{Term8,Tlv9} = case Tlv8 of
[{131079,V8}|TempTlv9] ->
    {'dec_TimeNotation'(V8, []), TempTlv9};
    _ ->
        { asn1_NOVALUE, Tlv8}
end,

%%-------------------------------------------------
%% attribute nonStandardData(9)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
{Term9,Tlv10} = case Tlv9 of
[{131080,V9}|TempTlv10] ->
    {'dec_NonStandardData'(V9, []), TempTlv10};
    _ ->
        { asn1_NOVALUE, Tlv9}
end,

%%-------------------------------------------------
%% attribute serviceChangeInfo(10)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor OPTIONAL
%%-------------------------------------------------
{Term10,Tlv11} = case Tlv10 of
[{131081,V10}|TempTlv11] ->
    {'dec_AuditDescriptor'(V10, []), TempTlv11};
    _ ->
        { asn1_NOVALUE, Tlv10}
end,

%%-------------------------------------------------
%% attribute serviceChangeIncompleteFlag(11) with type NULL OPTIONAL
%%-------------------------------------------------
{Term11,Tlv12} = case Tlv11 of
[{131082,V11}|TempTlv12] ->
    {?RT_BER:decode_null(V11,[]), TempTlv12};
    _ ->
        { asn1_NOVALUE, Tlv11}
end,

case Tlv12 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ServiceChangeParm', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10, Term11}.



%%================================
%%  DigitMapValue
%%================================
'enc_DigitMapValue'(Val) ->
    'enc_DigitMapValue'(Val, [<<48>>]).

'enc_DigitMapValue'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val,

%%-------------------------------------------------
%% attribute startTimer(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute shortTimer(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute longTimer(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute digitMapBody(4) with type IA5String
%%-------------------------------------------------
   {EncBytes4,EncLen4} = ?RT_BER:encode_restricted_string([], Cindex4, 22, [<<131>>]),

%%-------------------------------------------------
%% attribute durationTimer(5) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex5, [<<132>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_DigitMapValue'(Tlv) ->
   'dec_DigitMapValue'(Tlv, [16]).

'dec_DigitMapValue'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute startTimer(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,99},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute shortTimer(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,99},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute longTimer(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_integer(V3,{0,99},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute digitMapBody(4) with type IA5String
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = ?RT_BER:decode_restricted_string(V4,[],22,[131075]),

%%-------------------------------------------------
%% attribute durationTimer(5) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {?RT_BER:decode_integer(V5,{0,99},[]), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'DigitMapValue', Term1, Term2, Term3, Term4, Term5}.



%%================================
%%  DigitMapName
%%================================
'enc_DigitMapName'(Val) ->
    'enc_DigitMapName'(Val, [<<4>>]).


'enc_DigitMapName'({'DigitMapName',Val}, TagIn) ->
   'enc_DigitMapName'(Val, TagIn);

'enc_DigitMapName'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_DigitMapName'(Tlv) ->
   'dec_DigitMapName'(Tlv, [4]).

'dec_DigitMapName'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,2,TagIn).



%%================================
%%  DigitMapDescriptor
%%================================
'enc_DigitMapDescriptor'(Val) ->
    'enc_DigitMapDescriptor'(Val, [<<48>>]).

'enc_DigitMapDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute digitMapName(1) with type OCTET STRING OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_octet_string([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute digitMapValue(2)   External megaco_ber_bin_media_gateway_control_prev3a:DigitMapValue OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_DigitMapValue'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_DigitMapDescriptor'(Tlv) ->
   'dec_DigitMapDescriptor'(Tlv, [16]).

'dec_DigitMapDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute digitMapName(1) with type OCTET STRING OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_octet_string(V1,2,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute digitMapValue(2)   External megaco_ber_bin_media_gateway_control_prev3a:DigitMapValue OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_DigitMapValue'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'DigitMapDescriptor', Term1, Term2}.



%%================================
%%  ModemType
%%================================
'enc_ModemType'(Val) ->
    'enc_ModemType'(Val, [<<10>>]).


'enc_ModemType'({'ModemType',Val}, TagIn) ->
   'enc_ModemType'(Val, TagIn);

'enc_ModemType'(Val, TagIn) ->
case Val of
v18 -> ?RT_BER:encode_enumerated(0,TagIn);
v22 -> ?RT_BER:encode_enumerated(1,TagIn);
v22bis -> ?RT_BER:encode_enumerated(2,TagIn);
v32 -> ?RT_BER:encode_enumerated(3,TagIn);
v32bis -> ?RT_BER:encode_enumerated(4,TagIn);
v34 -> ?RT_BER:encode_enumerated(5,TagIn);
v90 -> ?RT_BER:encode_enumerated(6,TagIn);
v91 -> ?RT_BER:encode_enumerated(7,TagIn);
synchISDN -> ?RT_BER:encode_enumerated(8,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_ModemType'(Tlv) ->
   'dec_ModemType'(Tlv, [10]).

'dec_ModemType'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{v18,0},{v22,1},{v22bis,2},{v32,3},{v32bis,4},{v34,5},{v90,6},{v91,7},{synchISDN,8}],[]},TagIn).



%%================================
%%  ModemDescriptor
%%================================
'enc_ModemDescriptor'(Val) ->
    'enc_ModemDescriptor'(Val, [<<48>>]).

'enc_ModemDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute mtl(1) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_ModemDescriptor_mtl'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute mpl(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_ModemDescriptor_mpl'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute nonStandardData(3)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_NonStandardData'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ModemDescriptor_mtl
%%================================

'enc_ModemDescriptor_mtl'({'ModemDescriptor_mtl',Val}, TagIn) ->
   'enc_ModemDescriptor_mtl'(Val, TagIn);

'enc_ModemDescriptor_mtl'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ModemDescriptor_mtl_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ModemDescriptor_mtl_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = case H of
v18 -> ?RT_BER:encode_enumerated(0,[<<10>>]);
v22 -> ?RT_BER:encode_enumerated(1,[<<10>>]);
v22bis -> ?RT_BER:encode_enumerated(2,[<<10>>]);
v32 -> ?RT_BER:encode_enumerated(3,[<<10>>]);
v32bis -> ?RT_BER:encode_enumerated(4,[<<10>>]);
v34 -> ?RT_BER:encode_enumerated(5,[<<10>>]);
v90 -> ?RT_BER:encode_enumerated(6,[<<10>>]);
v91 -> ?RT_BER:encode_enumerated(7,[<<10>>]);
synchISDN -> ?RT_BER:encode_enumerated(8,[<<10>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end,
   'enc_ModemDescriptor_mtl_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ModemDescriptor_mtl'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
[?RT_BER:decode_enumerated(V1,[],{[{v18,0},{v22,1},{v22bis,2},{v32,3},{v32bis,4},{v34,5},{v90,6},{v91,7},{synchISDN,8}],[]},[10]) || V1 <- Tlv1].





%%================================
%%  ModemDescriptor_mpl
%%================================

'enc_ModemDescriptor_mpl'({'ModemDescriptor_mpl',Val}, TagIn) ->
   'enc_ModemDescriptor_mpl'(Val, TagIn);

'enc_ModemDescriptor_mpl'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ModemDescriptor_mpl_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ModemDescriptor_mpl_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyParm'(H, [<<48>>]),
   'enc_ModemDescriptor_mpl_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ModemDescriptor_mpl'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_ModemDescriptor'(Tlv) ->
   'dec_ModemDescriptor'(Tlv, [16]).

'dec_ModemDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute mtl(1) with type SEQUENCE OF
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_ModemDescriptor_mtl'(V1, [131072]),

%%-------------------------------------------------
%% attribute mpl(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_ModemDescriptor_mpl'(V2, [131073]),

%%-------------------------------------------------
%% attribute nonStandardData(3)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_NonStandardData'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed
end,
   {'ModemDescriptor', Term1, Term2, Term3}.



%%================================
%%  RequestID
%%================================
'enc_RequestID'(Val) ->
    'enc_RequestID'(Val, [<<2>>]).


'enc_RequestID'({'RequestID',Val}, TagIn) ->
   'enc_RequestID'(Val, TagIn);

'enc_RequestID'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_RequestID'(Tlv) ->
   'dec_RequestID'(Tlv, [2]).

'dec_RequestID'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,4294967295},TagIn).



%%================================
%%  SigParameter
%%================================
'enc_SigParameter'(Val) ->
    'enc_SigParameter'(Val, [<<48>>]).

'enc_SigParameter'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute sigParameterName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute value(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_Value'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_SigParameter_extraInfo'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  SigParameter_extraInfo
%%================================

'enc_SigParameter_extraInfo'({'SigParameter_extraInfo',Val}, TagIn) ->
   'enc_SigParameter_extraInfo'(Val, TagIn);

'enc_SigParameter_extraInfo'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      relation ->
         case element(2,Val) of
greaterThan -> ?RT_BER:encode_enumerated(0,[<<128>>]);
smallerThan -> ?RT_BER:encode_enumerated(1,[<<128>>]);
unequalTo -> ?RT_BER:encode_enumerated(2,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end;
      range ->
         ?RT_BER:encode_boolean(element(2,Val), [<<129>>]);
      sublist ->
         ?RT_BER:encode_boolean(element(2,Val), [<<130>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).


'dec_SigParameter_extraInfo'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'relation'
    {131072, V1} -> 
        {relation, ?RT_BER:decode_enumerated(V1,[],{[{greaterThan,0},{smallerThan,1},{unequalTo,2}],[]},[])};


%% 'range'
    {131073, V1} -> 
        {range, ?RT_BER:decode_boolean(V1,[])};


%% 'sublist'
    {131074, V1} -> 
        {sublist, ?RT_BER:decode_boolean(V1,[])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_SigParameter'(Tlv) ->
   'dec_SigParameter'(Tlv, [16]).

'dec_SigParameter'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute sigParameterName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,2,[131072]),

%%-------------------------------------------------
%% attribute value(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_Value'(V2, [131073]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_SigParameter_extraInfo'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'SigParameter', Term1, Term2, Term3}.



%%================================
%%  NotifyCompletion
%%================================
'enc_NotifyCompletion'(Val) ->
    'enc_NotifyCompletion'(Val, [<<3>>]).


'enc_NotifyCompletion'({'NotifyCompletion',Val}, TagIn) ->
   'enc_NotifyCompletion'(Val, TagIn);

'enc_NotifyCompletion'(Val, TagIn) ->
?RT_BER:encode_bit_string([], Val, [{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}], TagIn).


'dec_NotifyCompletion'(Tlv) ->
   'dec_NotifyCompletion'(Tlv, [3]).

'dec_NotifyCompletion'(Tlv, TagIn) ->
?RT_BER:decode_bit_string(Tlv,[],[{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}],TagIn).



%%================================
%%  SignalName
%%================================
'enc_SignalName'(Val) ->
    'enc_SignalName'(Val, [<<4>>]).


'enc_SignalName'({'SignalName',Val}, TagIn) ->
   'enc_SignalName'(Val, TagIn);

'enc_SignalName'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_SignalName'(Tlv) ->
   'dec_SignalName'(Tlv, [4]).

'dec_SignalName'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,4,TagIn).



%%================================
%%  SignalDirection
%%================================
'enc_SignalDirection'(Val) ->
    'enc_SignalDirection'(Val, [<<10>>]).


'enc_SignalDirection'({'SignalDirection',Val}, TagIn) ->
   'enc_SignalDirection'(Val, TagIn);

'enc_SignalDirection'(Val, TagIn) ->
case Val of
internal -> ?RT_BER:encode_enumerated(0,TagIn);
external -> ?RT_BER:encode_enumerated(1,TagIn);
both -> ?RT_BER:encode_enumerated(3,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_SignalDirection'(Tlv) ->
   'dec_SignalDirection'(Tlv, [10]).

'dec_SignalDirection'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{internal,0},{external,1},{both,3}],[]},TagIn).



%%================================
%%  SignalType
%%================================
'enc_SignalType'(Val) ->
    'enc_SignalType'(Val, [<<10>>]).


'enc_SignalType'({'SignalType',Val}, TagIn) ->
   'enc_SignalType'(Val, TagIn);

'enc_SignalType'(Val, TagIn) ->
case Val of
brief -> ?RT_BER:encode_enumerated(0,TagIn);
onOff -> ?RT_BER:encode_enumerated(1,TagIn);
timeOut -> ?RT_BER:encode_enumerated(2,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_SignalType'(Tlv) ->
   'dec_SignalType'(Tlv, [10]).

'dec_SignalType'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{brief,0},{onOff,1},{timeOut,2}],[]},TagIn).



%%================================
%%  Signal
%%================================
'enc_Signal'(Val) ->
    'enc_Signal'(Val, [<<48>>]).

'enc_Signal'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9} = Val,

%%-------------------------------------------------
%% attribute signalName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute sigType(3) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            case Cindex3 of
brief -> ?RT_BER:encode_enumerated(0,[<<130>>]);
onOff -> ?RT_BER:encode_enumerated(1,[<<130>>]);
timeOut -> ?RT_BER:encode_enumerated(2,[<<130>>]);
Enumval3 -> exit({error,{asn1, {enumerated_not_in_range,Enumval3}}})
end
       end,

%%-------------------------------------------------
%% attribute duration(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex4, [<<131>>])
       end,

%%-------------------------------------------------
%% attribute notifyCompletion(5) with type BIT STRING OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], Cindex5, [{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}], [<<132>>])
       end,

%%-------------------------------------------------
%% attribute keepActive(6) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes6,EncLen6} =  case Cindex6 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex6, [<<133>>])
       end,

%%-------------------------------------------------
%% attribute sigParList(7) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes7,EncLen7} = 'enc_Signal_sigParList'(Cindex7, [<<166>>]),

%%-------------------------------------------------
%% attribute direction(8) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
   {EncBytes8,EncLen8} =  case Cindex8 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            case Cindex8 of
internal -> ?RT_BER:encode_enumerated(0,[<<135>>]);
external -> ?RT_BER:encode_enumerated(1,[<<135>>]);
both -> ?RT_BER:encode_enumerated(3,[<<135>>]);
Enumval7 -> exit({error,{asn1, {enumerated_not_in_range,Enumval7}}})
end
       end,

%%-------------------------------------------------
%% attribute requestID(9) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes9,EncLen9} =  case Cindex9 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex9, [<<136>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  Signal_sigParList
%%================================

'enc_Signal_sigParList'({'Signal_sigParList',Val}, TagIn) ->
   'enc_Signal_sigParList'(Val, TagIn);

'enc_Signal_sigParList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_Signal_sigParList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_Signal_sigParList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_SigParameter'(H, [<<48>>]),
   'enc_Signal_sigParList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_Signal_sigParList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_SigParameter'(V1, [16]) || V1 <- Tlv1].




'dec_Signal'(Tlv) ->
   'dec_Signal'(Tlv, [16]).

'dec_Signal'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute signalName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute sigType(3) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_enumerated(V3,[],{[{brief,0},{onOff,1},{timeOut,2}],[]},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute duration(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_integer(V4,{0,65535},[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute notifyCompletion(5) with type BIT STRING OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {?RT_BER:decode_bit_string(V5,[],[{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}],[]), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

%%-------------------------------------------------
%% attribute keepActive(6) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term6,Tlv7} = case Tlv6 of
[{131077,V6}|TempTlv7] ->
    {?RT_BER:decode_boolean(V6,[]), TempTlv7};
    _ ->
        { asn1_NOVALUE, Tlv6}
end,

%%-------------------------------------------------
%% attribute sigParList(7) with type SEQUENCE OF
%%-------------------------------------------------
[V7|Tlv8] = Tlv7, 
Term7 = 'dec_Signal_sigParList'(V7, [131078]),

%%-------------------------------------------------
%% attribute direction(8) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
{Term8,Tlv9} = case Tlv8 of
[{131079,V8}|TempTlv9] ->
    {?RT_BER:decode_enumerated(V8,[],{[{internal,0},{external,1},{both,3}],[]},[]), TempTlv9};
    _ ->
        { asn1_NOVALUE, Tlv8}
end,

%%-------------------------------------------------
%% attribute requestID(9) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term9,Tlv10} = case Tlv9 of
[{131080,V9}|TempTlv10] ->
    {?RT_BER:decode_integer(V9,{0,4294967295},[]), TempTlv10};
    _ ->
        { asn1_NOVALUE, Tlv9}
end,

case Tlv10 of [] -> true; _ -> true end, % ... extra fields skipped
   {'Signal', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9}.



%%================================
%%  SeqSigList
%%================================
'enc_SeqSigList'(Val) ->
    'enc_SeqSigList'(Val, [<<48>>]).

'enc_SeqSigList'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute id(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute signalList(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_SeqSigList_signalList'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  SeqSigList_signalList
%%================================

'enc_SeqSigList_signalList'({'SeqSigList_signalList',Val}, TagIn) ->
   'enc_SeqSigList_signalList'(Val, TagIn);

'enc_SeqSigList_signalList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_SeqSigList_signalList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_SeqSigList_signalList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_Signal'(H, [<<48>>]),
   'enc_SeqSigList_signalList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_SeqSigList_signalList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_Signal'(V1, [16]) || V1 <- Tlv1].




'dec_SeqSigList'(Tlv) ->
   'dec_SeqSigList'(Tlv, [16]).

'dec_SeqSigList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute id(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,65535},[131072]),

%%-------------------------------------------------
%% attribute signalList(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_SeqSigList_signalList'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'SeqSigList', Term1, Term2}.



%%================================
%%  SignalRequest
%%================================
'enc_SignalRequest'(Val) ->
    'enc_SignalRequest'(Val, []).


'enc_SignalRequest'({'SignalRequest',Val}, TagIn) ->
   'enc_SignalRequest'(Val, TagIn);

'enc_SignalRequest'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      signal ->
         'enc_Signal'(element(2,Val), [<<160>>]);
      seqSigList ->
         'enc_SeqSigList'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_SignalRequest'(Tlv) ->
   'dec_SignalRequest'(Tlv, []).

'dec_SignalRequest'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'signal'
    {131072, V1} -> 
        {signal, 'dec_Signal'(V1, [])};


%% 'seqSigList'
    {131073, V1} -> 
        {seqSigList, 'dec_SeqSigList'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  SignalsDescriptor
%%================================
'enc_SignalsDescriptor'(Val) ->
    'enc_SignalsDescriptor'(Val, [<<48>>]).


'enc_SignalsDescriptor'({'SignalsDescriptor',Val}, TagIn) ->
   'enc_SignalsDescriptor'(Val, TagIn);

'enc_SignalsDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_SignalsDescriptor_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_SignalsDescriptor_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_SignalRequest'(H, []),
   'enc_SignalsDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_SignalsDescriptor'(Tlv) ->
   'dec_SignalsDescriptor'(Tlv, [16]).

'dec_SignalsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_SignalRequest'(V1, []) || V1 <- Tlv1].




%%================================
%%  EventSpec
%%================================
'enc_EventSpec'(Val) ->
    'enc_EventSpec'(Val, [<<48>>]).

'enc_EventSpec'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute eventParList(3) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes3,EncLen3} = 'enc_EventSpec_eventParList'(Cindex3, [<<162>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  EventSpec_eventParList
%%================================

'enc_EventSpec_eventParList'({'EventSpec_eventParList',Val}, TagIn) ->
   'enc_EventSpec_eventParList'(Val, TagIn);

'enc_EventSpec_eventParList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_EventSpec_eventParList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_EventSpec_eventParList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_EventParameter'(H, [<<48>>]),
   'enc_EventSpec_eventParList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_EventSpec_eventParList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_EventParameter'(V1, [16]) || V1 <- Tlv1].




'dec_EventSpec'(Tlv) ->
   'dec_EventSpec'(Tlv, [16]).

'dec_EventSpec'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute eventParList(3) with type SEQUENCE OF
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec_EventSpec_eventParList'(V3, [131074]),

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'EventSpec', Term1, Term2, Term3}.



%%================================
%%  EventBufferDescriptor
%%================================
'enc_EventBufferDescriptor'(Val) ->
    'enc_EventBufferDescriptor'(Val, [<<48>>]).


'enc_EventBufferDescriptor'({'EventBufferDescriptor',Val}, TagIn) ->
   'enc_EventBufferDescriptor'(Val, TagIn);

'enc_EventBufferDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_EventBufferDescriptor_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_EventBufferDescriptor_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_EventSpec'(H, [<<48>>]),
   'enc_EventBufferDescriptor_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_EventBufferDescriptor'(Tlv) ->
   'dec_EventBufferDescriptor'(Tlv, [16]).

'dec_EventBufferDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_EventSpec'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  SecondRequestedActions
%%================================
'enc_SecondRequestedActions'(Val) ->
    'enc_SecondRequestedActions'(Val, [<<48>>]).

'enc_SecondRequestedActions'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute keepActive(1) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute eventDM(2)   External megaco_ber_bin_media_gateway_control_prev3a:EventDM OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_EventDM'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute signalsDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:SignalsDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_SignalsDescriptor'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_SecondRequestedActions'(Tlv) ->
   'dec_SecondRequestedActions'(Tlv, [16]).

'dec_SecondRequestedActions'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute keepActive(1) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_boolean(V1,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute eventDM(2)   External megaco_ber_bin_media_gateway_control_prev3a:EventDM OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_EventDM'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute signalsDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:SignalsDescriptor OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_SignalsDescriptor'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'SecondRequestedActions', Term1, Term2, Term3}.



%%================================
%%  SecondRequestedEvent
%%================================
'enc_SecondRequestedEvent'(Val) ->
    'enc_SecondRequestedEvent'(Val, [<<48>>]).

'enc_SecondRequestedEvent'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute pkgdName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute eventAction(3)   External megaco_ber_bin_media_gateway_control_prev3a:SecondRequestedActions OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_SecondRequestedActions'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute evParList(4) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes4,EncLen4} = 'enc_SecondRequestedEvent_evParList'(Cindex4, [<<163>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  SecondRequestedEvent_evParList
%%================================

'enc_SecondRequestedEvent_evParList'({'SecondRequestedEvent_evParList',Val}, TagIn) ->
   'enc_SecondRequestedEvent_evParList'(Val, TagIn);

'enc_SecondRequestedEvent_evParList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_SecondRequestedEvent_evParList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_SecondRequestedEvent_evParList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_EventParameter'(H, [<<48>>]),
   'enc_SecondRequestedEvent_evParList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_SecondRequestedEvent_evParList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_EventParameter'(V1, [16]) || V1 <- Tlv1].




'dec_SecondRequestedEvent'(Tlv) ->
   'dec_SecondRequestedEvent'(Tlv, [16]).

'dec_SecondRequestedEvent'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute pkgdName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute eventAction(3)   External megaco_ber_bin_media_gateway_control_prev3a:SecondRequestedActions OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_SecondRequestedActions'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute evParList(4) with type SEQUENCE OF
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = 'dec_SecondRequestedEvent_evParList'(V4, [131075]),

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'SecondRequestedEvent', Term1, Term2, Term3, Term4}.



%%================================
%%  SecondEventsDescriptor
%%================================
'enc_SecondEventsDescriptor'(Val) ->
    'enc_SecondEventsDescriptor'(Val, [<<48>>]).

'enc_SecondEventsDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute eventList(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_SecondEventsDescriptor_eventList'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  SecondEventsDescriptor_eventList
%%================================

'enc_SecondEventsDescriptor_eventList'({'SecondEventsDescriptor_eventList',Val}, TagIn) ->
   'enc_SecondEventsDescriptor_eventList'(Val, TagIn);

'enc_SecondEventsDescriptor_eventList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_SecondEventsDescriptor_eventList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_SecondEventsDescriptor_eventList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_SecondRequestedEvent'(H, [<<48>>]),
   'enc_SecondEventsDescriptor_eventList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_SecondEventsDescriptor_eventList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_SecondRequestedEvent'(V1, [16]) || V1 <- Tlv1].




'dec_SecondEventsDescriptor'(Tlv) ->
   'dec_SecondEventsDescriptor'(Tlv, [16]).

'dec_SecondEventsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,4294967295},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute eventList(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_SecondEventsDescriptor_eventList'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'SecondEventsDescriptor', Term1, Term2}.



%%================================
%%  EventDM
%%================================
'enc_EventDM'(Val) ->
    'enc_EventDM'(Val, []).


'enc_EventDM'({'EventDM',Val}, TagIn) ->
   'enc_EventDM'(Val, TagIn);

'enc_EventDM'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      digitMapName ->
         ?RT_BER:encode_octet_string([], element(2,Val), [<<128>>]);
      digitMapValue ->
         'enc_DigitMapValue'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_EventDM'(Tlv) ->
   'dec_EventDM'(Tlv, []).

'dec_EventDM'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'digitMapName'
    {131072, V1} -> 
        {digitMapName, ?RT_BER:decode_octet_string(V1,2,[])};


%% 'digitMapValue'
    {131073, V1} -> 
        {digitMapValue, 'dec_DigitMapValue'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


%%================================
%%  RequestedActions
%%================================
'enc_RequestedActions'(Val) ->
    'enc_RequestedActions'(Val, [<<48>>]).

'enc_RequestedActions'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute keepActive(1) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute eventDM(2)   External megaco_ber_bin_media_gateway_control_prev3a:EventDM OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_EventDM'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute secondEvent(3)   External megaco_ber_bin_media_gateway_control_prev3a:SecondEventsDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_SecondEventsDescriptor'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute signalsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:SignalsDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_SignalsDescriptor'(Cindex4, [<<163>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_RequestedActions'(Tlv) ->
   'dec_RequestedActions'(Tlv, [16]).

'dec_RequestedActions'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute keepActive(1) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_boolean(V1,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute eventDM(2)   External megaco_ber_bin_media_gateway_control_prev3a:EventDM OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_EventDM'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute secondEvent(3)   External megaco_ber_bin_media_gateway_control_prev3a:SecondEventsDescriptor OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_SecondEventsDescriptor'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute signalsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:SignalsDescriptor OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_SignalsDescriptor'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'RequestedActions', Term1, Term2, Term3, Term4}.



%%================================
%%  RequestedEvent
%%================================
'enc_RequestedEvent'(Val) ->
    'enc_RequestedEvent'(Val, [<<48>>]).

'enc_RequestedEvent'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute pkgdName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute eventAction(3)   External megaco_ber_bin_media_gateway_control_prev3a:RequestedActions OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_RequestedActions'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute evParList(4) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes4,EncLen4} = 'enc_RequestedEvent_evParList'(Cindex4, [<<163>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  RequestedEvent_evParList
%%================================

'enc_RequestedEvent_evParList'({'RequestedEvent_evParList',Val}, TagIn) ->
   'enc_RequestedEvent_evParList'(Val, TagIn);

'enc_RequestedEvent_evParList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_RequestedEvent_evParList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_RequestedEvent_evParList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_EventParameter'(H, [<<48>>]),
   'enc_RequestedEvent_evParList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_RequestedEvent_evParList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_EventParameter'(V1, [16]) || V1 <- Tlv1].




'dec_RequestedEvent'(Tlv) ->
   'dec_RequestedEvent'(Tlv, [16]).

'dec_RequestedEvent'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute pkgdName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute eventAction(3)   External megaco_ber_bin_media_gateway_control_prev3a:RequestedActions OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_RequestedActions'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute evParList(4) with type SEQUENCE OF
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = 'dec_RequestedEvent_evParList'(V4, [131075]),

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'RequestedEvent', Term1, Term2, Term3, Term4}.



%%================================
%%  EventsDescriptor
%%================================
'enc_EventsDescriptor'(Val) ->
    'enc_EventsDescriptor'(Val, [<<48>>]).

'enc_EventsDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute eventList(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_EventsDescriptor_eventList'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  EventsDescriptor_eventList
%%================================

'enc_EventsDescriptor_eventList'({'EventsDescriptor_eventList',Val}, TagIn) ->
   'enc_EventsDescriptor_eventList'(Val, TagIn);

'enc_EventsDescriptor_eventList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_EventsDescriptor_eventList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_EventsDescriptor_eventList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_RequestedEvent'(H, [<<48>>]),
   'enc_EventsDescriptor_eventList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_EventsDescriptor_eventList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_RequestedEvent'(V1, [16]) || V1 <- Tlv1].




'dec_EventsDescriptor'(Tlv) ->
   'dec_EventsDescriptor'(Tlv, [16]).

'dec_EventsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,4294967295},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute eventList(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_EventsDescriptor_eventList'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'EventsDescriptor', Term1, Term2}.



%%================================
%%  StreamID
%%================================
'enc_StreamID'(Val) ->
    'enc_StreamID'(Val, [<<2>>]).


'enc_StreamID'({'StreamID',Val}, TagIn) ->
   'enc_StreamID'(Val, TagIn);

'enc_StreamID'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_StreamID'(Tlv) ->
   'dec_StreamID'(Tlv, [2]).

'dec_StreamID'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,65535},TagIn).



%%================================
%%  MuxType
%%================================
'enc_MuxType'(Val) ->
    'enc_MuxType'(Val, [<<10>>]).


'enc_MuxType'({'MuxType',Val}, TagIn) ->
   'enc_MuxType'(Val, TagIn);

'enc_MuxType'(Val, TagIn) ->
case Val of
h221 -> ?RT_BER:encode_enumerated(0,TagIn);
h223 -> ?RT_BER:encode_enumerated(1,TagIn);
h226 -> ?RT_BER:encode_enumerated(2,TagIn);
v76 -> ?RT_BER:encode_enumerated(3,TagIn);
nx64k -> ?RT_BER:encode_enumerated(4,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_MuxType'(Tlv) ->
   'dec_MuxType'(Tlv, [10]).

'dec_MuxType'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{h221,0},{h223,1},{h226,2},{v76,3}],[{nx64k,4}]},TagIn).



%%================================
%%  MuxDescriptor
%%================================
'enc_MuxDescriptor'(Val) ->
    'enc_MuxDescriptor'(Val, [<<48>>]).

'enc_MuxDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute muxType(1) with type ENUMERATED
%%-------------------------------------------------
   {EncBytes1,EncLen1} = case Cindex1 of
h221 -> ?RT_BER:encode_enumerated(0,[<<128>>]);
h223 -> ?RT_BER:encode_enumerated(1,[<<128>>]);
h226 -> ?RT_BER:encode_enumerated(2,[<<128>>]);
v76 -> ?RT_BER:encode_enumerated(3,[<<128>>]);
nx64k -> ?RT_BER:encode_enumerated(4,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end,

%%-------------------------------------------------
%% attribute termList(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_MuxDescriptor_termList'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute nonStandardData(3)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_NonStandardData'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  MuxDescriptor_termList
%%================================

'enc_MuxDescriptor_termList'({'MuxDescriptor_termList',Val}, TagIn) ->
   'enc_MuxDescriptor_termList'(Val, TagIn);

'enc_MuxDescriptor_termList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_MuxDescriptor_termList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_MuxDescriptor_termList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_TerminationID'(H, [<<48>>]),
   'enc_MuxDescriptor_termList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_MuxDescriptor_termList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_TerminationID'(V1, [16]) || V1 <- Tlv1].




'dec_MuxDescriptor'(Tlv) ->
   'dec_MuxDescriptor'(Tlv, [16]).

'dec_MuxDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute muxType(1) with type ENUMERATED
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_enumerated(V1,[],{[{h221,0},{h223,1},{h226,2},{v76,3}],[{nx64k,4}]},[131072]),

%%-------------------------------------------------
%% attribute termList(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_MuxDescriptor_termList'(V2, [131073]),

%%-------------------------------------------------
%% attribute nonStandardData(3)   External megaco_ber_bin_media_gateway_control_prev3a:NonStandardData OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_NonStandardData'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'MuxDescriptor', Term1, Term2, Term3}.



%%================================
%%  ServiceState
%%================================
'enc_ServiceState'(Val) ->
    'enc_ServiceState'(Val, [<<10>>]).


'enc_ServiceState'({'ServiceState',Val}, TagIn) ->
   'enc_ServiceState'(Val, TagIn);

'enc_ServiceState'(Val, TagIn) ->
case Val of
test -> ?RT_BER:encode_enumerated(0,TagIn);
outOfSvc -> ?RT_BER:encode_enumerated(1,TagIn);
inSvc -> ?RT_BER:encode_enumerated(2,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_ServiceState'(Tlv) ->
   'dec_ServiceState'(Tlv, [10]).

'dec_ServiceState'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{test,0},{outOfSvc,1},{inSvc,2}],[]},TagIn).



%%================================
%%  EventBufferControl
%%================================
'enc_EventBufferControl'(Val) ->
    'enc_EventBufferControl'(Val, [<<10>>]).


'enc_EventBufferControl'({'EventBufferControl',Val}, TagIn) ->
   'enc_EventBufferControl'(Val, TagIn);

'enc_EventBufferControl'(Val, TagIn) ->
case Val of
off -> ?RT_BER:encode_enumerated(0,TagIn);
lockStep -> ?RT_BER:encode_enumerated(1,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_EventBufferControl'(Tlv) ->
   'dec_EventBufferControl'(Tlv, [10]).

'dec_EventBufferControl'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{off,0},{lockStep,1}],[]},TagIn).



%%================================
%%  TerminationStateDescriptor
%%================================
'enc_TerminationStateDescriptor'(Val) ->
    'enc_TerminationStateDescriptor'(Val, [<<48>>]).

'enc_TerminationStateDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute propertyParms(1) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationStateDescriptor_propertyParms'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute eventBufferControl(2) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            case Cindex2 of
off -> ?RT_BER:encode_enumerated(0,[<<129>>]);
lockStep -> ?RT_BER:encode_enumerated(1,[<<129>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end
       end,

%%-------------------------------------------------
%% attribute serviceState(3) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            case Cindex3 of
test -> ?RT_BER:encode_enumerated(0,[<<130>>]);
outOfSvc -> ?RT_BER:encode_enumerated(1,[<<130>>]);
inSvc -> ?RT_BER:encode_enumerated(2,[<<130>>]);
Enumval2 -> exit({error,{asn1, {enumerated_not_in_range,Enumval2}}})
end
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  TerminationStateDescriptor_propertyParms
%%================================

'enc_TerminationStateDescriptor_propertyParms'({'TerminationStateDescriptor_propertyParms',Val}, TagIn) ->
   'enc_TerminationStateDescriptor_propertyParms'(Val, TagIn);

'enc_TerminationStateDescriptor_propertyParms'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_TerminationStateDescriptor_propertyParms_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TerminationStateDescriptor_propertyParms_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyParm'(H, [<<48>>]),
   'enc_TerminationStateDescriptor_propertyParms_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_TerminationStateDescriptor_propertyParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_TerminationStateDescriptor'(Tlv) ->
   'dec_TerminationStateDescriptor'(Tlv, [16]).

'dec_TerminationStateDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute propertyParms(1) with type SEQUENCE OF
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationStateDescriptor_propertyParms'(V1, [131072]),

%%-------------------------------------------------
%% attribute eventBufferControl(2) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_enumerated(V2,[],{[{off,0},{lockStep,1}],[]},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute serviceState(3) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_enumerated(V3,[],{[{test,0},{outOfSvc,1},{inSvc,2}],[]},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TerminationStateDescriptor', Term1, Term2, Term3}.



%%================================
%%  PropertyGroup
%%================================
'enc_PropertyGroup'(Val) ->
    'enc_PropertyGroup'(Val, [<<48>>]).


'enc_PropertyGroup'({'PropertyGroup',Val}, TagIn) ->
   'enc_PropertyGroup'(Val, TagIn);

'enc_PropertyGroup'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_PropertyGroup_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_PropertyGroup_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyParm'(H, [<<48>>]),
   'enc_PropertyGroup_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_PropertyGroup'(Tlv) ->
   'dec_PropertyGroup'(Tlv, [16]).

'dec_PropertyGroup'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyParm'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  LocalRemoteDescriptor
%%================================
'enc_LocalRemoteDescriptor'(Val) ->
    'enc_LocalRemoteDescriptor'(Val, [<<48>>]).

'enc_LocalRemoteDescriptor'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute propGrps(1) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_LocalRemoteDescriptor_propGrps'(Cindex1, [<<160>>]),

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  LocalRemoteDescriptor_propGrps
%%================================

'enc_LocalRemoteDescriptor_propGrps'({'LocalRemoteDescriptor_propGrps',Val}, TagIn) ->
   'enc_LocalRemoteDescriptor_propGrps'(Val, TagIn);

'enc_LocalRemoteDescriptor_propGrps'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_LocalRemoteDescriptor_propGrps_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_LocalRemoteDescriptor_propGrps_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyGroup'(H, [<<48>>]),
   'enc_LocalRemoteDescriptor_propGrps_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_LocalRemoteDescriptor_propGrps'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyGroup'(V1, [16]) || V1 <- Tlv1].




'dec_LocalRemoteDescriptor'(Tlv) ->
   'dec_LocalRemoteDescriptor'(Tlv, [16]).

'dec_LocalRemoteDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute propGrps(1) with type SEQUENCE OF
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_LocalRemoteDescriptor_propGrps'(V1, [131072]),

case Tlv2 of [] -> true; _ -> true end, % ... extra fields skipped
   {'LocalRemoteDescriptor', Term1}.



%%================================
%%  Relation
%%================================
'enc_Relation'(Val) ->
    'enc_Relation'(Val, [<<10>>]).


'enc_Relation'({'Relation',Val}, TagIn) ->
   'enc_Relation'(Val, TagIn);

'enc_Relation'(Val, TagIn) ->
case Val of
greaterThan -> ?RT_BER:encode_enumerated(0,TagIn);
smallerThan -> ?RT_BER:encode_enumerated(1,TagIn);
unequalTo -> ?RT_BER:encode_enumerated(2,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_Relation'(Tlv) ->
   'dec_Relation'(Tlv, [10]).

'dec_Relation'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{greaterThan,0},{smallerThan,1},{unequalTo,2}],[]},TagIn).



%%================================
%%  PkgdName
%%================================
'enc_PkgdName'(Val) ->
    'enc_PkgdName'(Val, [<<4>>]).


'enc_PkgdName'({'PkgdName',Val}, TagIn) ->
   'enc_PkgdName'(Val, TagIn);

'enc_PkgdName'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_PkgdName'(Tlv) ->
   'dec_PkgdName'(Tlv, [4]).

'dec_PkgdName'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,4,TagIn).



%%================================
%%  Name
%%================================
'enc_Name'(Val) ->
    'enc_Name'(Val, [<<4>>]).


'enc_Name'({'Name',Val}, TagIn) ->
   'enc_Name'(Val, TagIn);

'enc_Name'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_Name'(Tlv) ->
   'dec_Name'(Tlv, [4]).

'dec_Name'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,2,TagIn).



%%================================
%%  PropertyParm
%%================================
'enc_PropertyParm'(Val) ->
    'enc_PropertyParm'(Val, [<<48>>]).

'enc_PropertyParm'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute name(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute value(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_PropertyParm_value'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_PropertyParm_extraInfo'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  PropertyParm_value
%%================================

'enc_PropertyParm_value'({'PropertyParm_value',Val}, TagIn) ->
   'enc_PropertyParm_value'(Val, TagIn);

'enc_PropertyParm_value'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_PropertyParm_value_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_PropertyParm_value_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, [<<4>>]),
   'enc_PropertyParm_value_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_PropertyParm_value'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
[?RT_BER:decode_octet_string(V1,[],[4]) || V1 <- Tlv1].





%%================================
%%  PropertyParm_extraInfo
%%================================

'enc_PropertyParm_extraInfo'({'PropertyParm_extraInfo',Val}, TagIn) ->
   'enc_PropertyParm_extraInfo'(Val, TagIn);

'enc_PropertyParm_extraInfo'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      relation ->
         case element(2,Val) of
greaterThan -> ?RT_BER:encode_enumerated(0,[<<128>>]);
smallerThan -> ?RT_BER:encode_enumerated(1,[<<128>>]);
unequalTo -> ?RT_BER:encode_enumerated(2,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end;
      range ->
         ?RT_BER:encode_boolean(element(2,Val), [<<129>>]);
      sublist ->
         ?RT_BER:encode_boolean(element(2,Val), [<<130>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).


'dec_PropertyParm_extraInfo'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'relation'
    {131072, V1} -> 
        {relation, ?RT_BER:decode_enumerated(V1,[],{[{greaterThan,0},{smallerThan,1},{unequalTo,2}],[]},[])};


%% 'range'
    {131073, V1} -> 
        {range, ?RT_BER:decode_boolean(V1,[])};


%% 'sublist'
    {131074, V1} -> 
        {sublist, ?RT_BER:decode_boolean(V1,[])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_PropertyParm'(Tlv) ->
   'dec_PropertyParm'(Tlv, [16]).

'dec_PropertyParm'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute name(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute value(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_PropertyParm_value'(V2, [131073]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_PropertyParm_extraInfo'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'PropertyParm', Term1, Term2, Term3}.



%%================================
%%  StreamMode
%%================================
'enc_StreamMode'(Val) ->
    'enc_StreamMode'(Val, [<<10>>]).


'enc_StreamMode'({'StreamMode',Val}, TagIn) ->
   'enc_StreamMode'(Val, TagIn);

'enc_StreamMode'(Val, TagIn) ->
case Val of
sendOnly -> ?RT_BER:encode_enumerated(0,TagIn);
recvOnly -> ?RT_BER:encode_enumerated(1,TagIn);
sendRecv -> ?RT_BER:encode_enumerated(2,TagIn);
inactive -> ?RT_BER:encode_enumerated(3,TagIn);
loopBack -> ?RT_BER:encode_enumerated(4,TagIn);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end.


'dec_StreamMode'(Tlv) ->
   'dec_StreamMode'(Tlv, [10]).

'dec_StreamMode'(Tlv, TagIn) ->
?RT_BER:decode_enumerated(Tlv,[],{[{sendOnly,0},{recvOnly,1},{sendRecv,2},{inactive,3},{loopBack,4}],[]},TagIn).



%%================================
%%  LocalControlDescriptor
%%================================
'enc_LocalControlDescriptor'(Val) ->
    'enc_LocalControlDescriptor'(Val, [<<48>>]).

'enc_LocalControlDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute streamMode(1) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            case Cindex1 of
sendOnly -> ?RT_BER:encode_enumerated(0,[<<128>>]);
recvOnly -> ?RT_BER:encode_enumerated(1,[<<128>>]);
sendRecv -> ?RT_BER:encode_enumerated(2,[<<128>>]);
inactive -> ?RT_BER:encode_enumerated(3,[<<128>>]);
loopBack -> ?RT_BER:encode_enumerated(4,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end
       end,

%%-------------------------------------------------
%% attribute reserveValue(2) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute reserveGroup(3) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute propertyParms(4) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes4,EncLen4} = 'enc_LocalControlDescriptor_propertyParms'(Cindex4, [<<163>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  LocalControlDescriptor_propertyParms
%%================================

'enc_LocalControlDescriptor_propertyParms'({'LocalControlDescriptor_propertyParms',Val}, TagIn) ->
   'enc_LocalControlDescriptor_propertyParms'(Val, TagIn);

'enc_LocalControlDescriptor_propertyParms'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_LocalControlDescriptor_propertyParms_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_LocalControlDescriptor_propertyParms_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyParm'(H, [<<48>>]),
   'enc_LocalControlDescriptor_propertyParms_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_LocalControlDescriptor_propertyParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_LocalControlDescriptor'(Tlv) ->
   'dec_LocalControlDescriptor'(Tlv, [16]).

'dec_LocalControlDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute streamMode(1) with type ENUMERATED OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_enumerated(V1,[],{[{sendOnly,0},{recvOnly,1},{sendRecv,2},{inactive,3},{loopBack,4}],[]},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute reserveValue(2) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_boolean(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute reserveGroup(3) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_boolean(V3,[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute propertyParms(4) with type SEQUENCE OF
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = 'dec_LocalControlDescriptor_propertyParms'(V4, [131075]),

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'LocalControlDescriptor', Term1, Term2, Term3, Term4}.



%%================================
%%  StreamParms
%%================================
'enc_StreamParms'(Val) ->
    'enc_StreamParms'(Val, [<<48>>]).

'enc_StreamParms'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute localControlDescriptor(1)   External megaco_ber_bin_media_gateway_control_prev3a:LocalControlDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_LocalControlDescriptor'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute localDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:LocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_LocalRemoteDescriptor'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute remoteDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:LocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_LocalRemoteDescriptor'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute statisticsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:StatisticsDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_StatisticsDescriptor'(Cindex4, [<<163>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_StreamParms'(Tlv) ->
   'dec_StreamParms'(Tlv, [16]).

'dec_StreamParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute localControlDescriptor(1)   External megaco_ber_bin_media_gateway_control_prev3a:LocalControlDescriptor OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_LocalControlDescriptor'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute localDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:LocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_LocalRemoteDescriptor'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute remoteDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:LocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_LocalRemoteDescriptor'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute statisticsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:StatisticsDescriptor OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_StatisticsDescriptor'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'StreamParms', Term1, Term2, Term3, Term4}.



%%================================
%%  StreamDescriptor
%%================================
'enc_StreamDescriptor'(Val) ->
    'enc_StreamDescriptor'(Val, [<<48>>]).

'enc_StreamDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute streamID(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:StreamParms
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_StreamParms'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_StreamDescriptor'(Tlv) ->
   'dec_StreamDescriptor'(Tlv, [16]).

'dec_StreamDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute streamID(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,65535},[131072]),

%%-------------------------------------------------
%% attribute streamParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:StreamParms
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_StreamParms'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'StreamDescriptor', Term1, Term2}.



%%================================
%%  MediaDescriptor
%%================================
'enc_MediaDescriptor'(Val) ->
    'enc_MediaDescriptor'(Val, [<<48>>]).

'enc_MediaDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute termStateDescr(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationStateDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_TerminationStateDescriptor'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute streams(2) with type CHOICE OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_MediaDescriptor_streams'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  MediaDescriptor_streams
%%================================

'enc_MediaDescriptor_streams'({'MediaDescriptor_streams',Val}, TagIn) ->
   'enc_MediaDescriptor_streams'(Val, TagIn);

'enc_MediaDescriptor_streams'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      oneStream ->
         'enc_StreamParms'(element(2,Val), [<<160>>]);
      multiStream ->
         'enc_MediaDescriptor_streams_multiStream'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).





%%================================
%%  MediaDescriptor_streams_multiStream
%%================================

'enc_MediaDescriptor_streams_multiStream'({'MediaDescriptor_streams_multiStream',Val}, TagIn) ->
   'enc_MediaDescriptor_streams_multiStream'(Val, TagIn);

'enc_MediaDescriptor_streams_multiStream'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_MediaDescriptor_streams_multiStream_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_MediaDescriptor_streams_multiStream_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_StreamDescriptor'(H, [<<48>>]),
   'enc_MediaDescriptor_streams_multiStream_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_MediaDescriptor_streams_multiStream'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_StreamDescriptor'(V1, [16]) || V1 <- Tlv1].


'dec_MediaDescriptor_streams'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'oneStream'
    {131072, V1} -> 
        {oneStream, 'dec_StreamParms'(V1, [])};


%% 'multiStream'
    {131073, V1} -> 
        {multiStream, 'dec_MediaDescriptor_streams_multiStream'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_MediaDescriptor'(Tlv) ->
   'dec_MediaDescriptor'(Tlv, [16]).

'dec_MediaDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute termStateDescr(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationStateDescriptor OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_TerminationStateDescriptor'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute streams(2) with type CHOICE OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_MediaDescriptor_streams'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'MediaDescriptor', Term1, Term2}.



%%================================
%%  TerminationIDList
%%================================
'enc_TerminationIDList'(Val) ->
    'enc_TerminationIDList'(Val, [<<48>>]).


'enc_TerminationIDList'({'TerminationIDList',Val}, TagIn) ->
   'enc_TerminationIDList'(Val, TagIn);

'enc_TerminationIDList'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_TerminationIDList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TerminationIDList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_TerminationID'(H, [<<48>>]),
   'enc_TerminationIDList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_TerminationIDList'(Tlv) ->
   'dec_TerminationIDList'(Tlv, [16]).

'dec_TerminationIDList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_TerminationID'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  TerminationID
%%================================
'enc_TerminationID'(Val) ->
    'enc_TerminationID'(Val, [<<48>>]).

'enc_TerminationID'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute wildcard(1) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationID_wildcard'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute id(2) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], Cindex2, [<<129>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  TerminationID_wildcard
%%================================

'enc_TerminationID_wildcard'({'TerminationID_wildcard',Val}, TagIn) ->
   'enc_TerminationID_wildcard'(Val, TagIn);

'enc_TerminationID_wildcard'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_TerminationID_wildcard_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TerminationID_wildcard_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = ?RT_BER:encode_octet_string([], H, [<<4>>]),
   'enc_TerminationID_wildcard_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_TerminationID_wildcard'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
[?RT_BER:decode_octet_string(V1,1,[4]) || V1 <- Tlv1].




'dec_TerminationID'(Tlv) ->
   'dec_TerminationID'(Tlv, [16]).

'dec_TerminationID'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute wildcard(1) with type SEQUENCE OF
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationID_wildcard'(V1, [131072]),

%%-------------------------------------------------
%% attribute id(2) with type OCTET STRING
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_octet_string(V2,{1,8},[131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TerminationID', Term1, Term2}.



%%================================
%%  WildcardField
%%================================
'enc_WildcardField'(Val) ->
    'enc_WildcardField'(Val, [<<4>>]).


'enc_WildcardField'({'WildcardField',Val}, TagIn) ->
   'enc_WildcardField'(Val, TagIn);

'enc_WildcardField'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_WildcardField'(Tlv) ->
   'dec_WildcardField'(Tlv, [4]).

'dec_WildcardField'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,1,TagIn).



%%================================
%%  ServiceChangeResult
%%================================
'enc_ServiceChangeResult'(Val) ->
    'enc_ServiceChangeResult'(Val, []).


'enc_ServiceChangeResult'({'ServiceChangeResult',Val}, TagIn) ->
   'enc_ServiceChangeResult'(Val, TagIn);

'enc_ServiceChangeResult'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      errorDescriptor ->
         'enc_ErrorDescriptor'(element(2,Val), [<<160>>]);
      serviceChangeResParms ->
         'enc_ServiceChangeResParm'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_ServiceChangeResult'(Tlv) ->
   'dec_ServiceChangeResult'(Tlv, []).

'dec_ServiceChangeResult'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'errorDescriptor'
    {131072, V1} -> 
        {errorDescriptor, 'dec_ErrorDescriptor'(V1, [])};


%% 'serviceChangeResParms'
    {131073, V1} -> 
        {serviceChangeResParms, 'dec_ServiceChangeResParm'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


%%================================
%%  ServiceChangeReply
%%================================
'enc_ServiceChangeReply'(Val) ->
    'enc_ServiceChangeReply'(Val, [<<48>>]).

'enc_ServiceChangeReply'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute serviceChangeResult(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeResult
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_ServiceChangeResult'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ServiceChangeReply'(Tlv) ->
   'dec_ServiceChangeReply'(Tlv, [16]).

'dec_ServiceChangeReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute serviceChangeResult(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeResult
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_ServiceChangeResult'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ServiceChangeReply', Term1, Term2}.



%%================================
%%  ServiceChangeRequest
%%================================
'enc_ServiceChangeRequest'(Val) ->
    'enc_ServiceChangeRequest'(Val, [<<48>>]).

'enc_ServiceChangeRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute serviceChangeParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeParm
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_ServiceChangeParm'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ServiceChangeRequest'(Tlv) ->
   'dec_ServiceChangeRequest'(Tlv, [16]).

'dec_ServiceChangeRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute serviceChangeParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:ServiceChangeParm
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_ServiceChangeParm'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ServiceChangeRequest', Term1, Term2}.



%%================================
%%  EventParameter
%%================================
'enc_EventParameter'(Val) ->
    'enc_EventParameter'(Val, [<<48>>]).

'enc_EventParameter'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute eventParameterName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute value(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_Value'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_EventParameter_extraInfo'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  EventParameter_extraInfo
%%================================

'enc_EventParameter_extraInfo'({'EventParameter_extraInfo',Val}, TagIn) ->
   'enc_EventParameter_extraInfo'(Val, TagIn);

'enc_EventParameter_extraInfo'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      relation ->
         case element(2,Val) of
greaterThan -> ?RT_BER:encode_enumerated(0,[<<128>>]);
smallerThan -> ?RT_BER:encode_enumerated(1,[<<128>>]);
unequalTo -> ?RT_BER:encode_enumerated(2,[<<128>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end;
      range ->
         ?RT_BER:encode_boolean(element(2,Val), [<<129>>]);
      sublist ->
         ?RT_BER:encode_boolean(element(2,Val), [<<130>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).


'dec_EventParameter_extraInfo'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'relation'
    {131072, V1} -> 
        {relation, ?RT_BER:decode_enumerated(V1,[],{[{greaterThan,0},{smallerThan,1},{unequalTo,2}],[]},[])};


%% 'range'
    {131073, V1} -> 
        {range, ?RT_BER:decode_boolean(V1,[])};


%% 'sublist'
    {131074, V1} -> 
        {sublist, ?RT_BER:decode_boolean(V1,[])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_EventParameter'(Tlv) ->
   'dec_EventParameter'(Tlv, [16]).

'dec_EventParameter'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute eventParameterName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,2,[131072]),

%%-------------------------------------------------
%% attribute value(2)   External megaco_ber_bin_media_gateway_control_prev3a:Value
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_Value'(V2, [131073]),

%%-------------------------------------------------
%% attribute extraInfo(3) with type CHOICE OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_EventParameter_extraInfo'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'EventParameter', Term1, Term2, Term3}.



%%================================
%%  EventName
%%================================
'enc_EventName'(Val) ->
    'enc_EventName'(Val, [<<4>>]).


'enc_EventName'({'EventName',Val}, TagIn) ->
   'enc_EventName'(Val, TagIn);

'enc_EventName'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_EventName'(Tlv) ->
   'dec_EventName'(Tlv, [4]).

'dec_EventName'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,4,TagIn).



%%================================
%%  ObservedEvent
%%================================
'enc_ObservedEvent'(Val) ->
    'enc_ObservedEvent'(Val, [<<48>>]).

'enc_ObservedEvent'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute eventParList(3) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes3,EncLen3} = 'enc_ObservedEvent_eventParList'(Cindex3, [<<162>>]),

%%-------------------------------------------------
%% attribute timeNotation(4)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_TimeNotation'(Cindex4, [<<163>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ObservedEvent_eventParList
%%================================

'enc_ObservedEvent_eventParList'({'ObservedEvent_eventParList',Val}, TagIn) ->
   'enc_ObservedEvent_eventParList'(Val, TagIn);

'enc_ObservedEvent_eventParList'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ObservedEvent_eventParList_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ObservedEvent_eventParList_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_EventParameter'(H, [<<48>>]),
   'enc_ObservedEvent_eventParList_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ObservedEvent_eventParList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_EventParameter'(V1, [16]) || V1 <- Tlv1].




'dec_ObservedEvent'(Tlv) ->
   'dec_ObservedEvent'(Tlv, [16]).

'dec_ObservedEvent'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute eventParList(3) with type SEQUENCE OF
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec_ObservedEvent_eventParList'(V3, [131074]),

%%-------------------------------------------------
%% attribute timeNotation(4)   External megaco_ber_bin_media_gateway_control_prev3a:TimeNotation OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_TimeNotation'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ObservedEvent', Term1, Term2, Term3, Term4}.



%%================================
%%  ObservedEventsDescriptor
%%================================
'enc_ObservedEventsDescriptor'(Val) ->
    'enc_ObservedEventsDescriptor'(Val, [<<48>>]).

'enc_ObservedEventsDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute requestId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute observedEventLst(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_ObservedEventsDescriptor_observedEventLst'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ObservedEventsDescriptor_observedEventLst
%%================================

'enc_ObservedEventsDescriptor_observedEventLst'({'ObservedEventsDescriptor_observedEventLst',Val}, TagIn) ->
   'enc_ObservedEventsDescriptor_observedEventLst'(Val, TagIn);

'enc_ObservedEventsDescriptor_observedEventLst'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ObservedEventsDescriptor_observedEventLst_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ObservedEventsDescriptor_observedEventLst_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_ObservedEvent'(H, [<<48>>]),
   'enc_ObservedEventsDescriptor_observedEventLst_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ObservedEventsDescriptor_observedEventLst'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_ObservedEvent'(V1, [16]) || V1 <- Tlv1].




'dec_ObservedEventsDescriptor'(Tlv) ->
   'dec_ObservedEventsDescriptor'(Tlv, [16]).

'dec_ObservedEventsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute requestId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute observedEventLst(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_ObservedEventsDescriptor_observedEventLst'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'ObservedEventsDescriptor', Term1, Term2}.



%%================================
%%  NotifyReply
%%================================
'enc_NotifyReply'(Val) ->
    'enc_NotifyReply'(Val, [<<48>>]).

'enc_NotifyReply'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute errorDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ErrorDescriptor'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_NotifyReply'(Tlv) ->
   'dec_NotifyReply'(Tlv, [16]).

'dec_NotifyReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute errorDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_ErrorDescriptor'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'NotifyReply', Term1, Term2}.



%%================================
%%  NotifyRequest
%%================================
'enc_NotifyRequest'(Val) ->
    'enc_NotifyRequest'(Val, [<<48>>]).

'enc_NotifyRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute observedEventsDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ObservedEventsDescriptor
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_ObservedEventsDescriptor'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute errorDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ErrorDescriptor'(Cindex3, [<<162>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_NotifyRequest'(Tlv) ->
   'dec_NotifyRequest'(Tlv, [16]).

'dec_NotifyRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute observedEventsDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ObservedEventsDescriptor
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_ObservedEventsDescriptor'(V2, [131073]),

%%-------------------------------------------------
%% attribute errorDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_ErrorDescriptor'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'NotifyRequest', Term1, Term2, Term3}.



%%================================
%%  IndAudPackagesDescriptor
%%================================
'enc_IndAudPackagesDescriptor'(Val) ->
    'enc_IndAudPackagesDescriptor'(Val, [<<48>>]).

'enc_IndAudPackagesDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute packageName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute packageVersion(2) with type INTEGER
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], Cindex2, [<<129>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudPackagesDescriptor'(Tlv) ->
   'dec_IndAudPackagesDescriptor'(Tlv, [16]).

'dec_IndAudPackagesDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute packageName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,2,[131072]),

%%-------------------------------------------------
%% attribute packageVersion(2) with type INTEGER
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_integer(V2,{0,99},[131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudPackagesDescriptor', Term1, Term2}.



%%================================
%%  IndAudStatisticsDescriptor
%%================================
'enc_IndAudStatisticsDescriptor'(Val) ->
    'enc_IndAudStatisticsDescriptor'(Val, [<<48>>]).

'enc_IndAudStatisticsDescriptor'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute statName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudStatisticsDescriptor'(Tlv) ->
   'dec_IndAudStatisticsDescriptor'(Tlv, [16]).

'dec_IndAudStatisticsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute statName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

case Tlv2 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv2}}}) % extra fields not allowed
end,
   {'IndAudStatisticsDescriptor', Term1}.



%%================================
%%  IndAudDigitMapDescriptor
%%================================
'enc_IndAudDigitMapDescriptor'(Val) ->
    'enc_IndAudDigitMapDescriptor'(Val, [<<48>>]).

'enc_IndAudDigitMapDescriptor'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute digitMapName(1) with type OCTET STRING OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_octet_string([], Cindex1, [<<128>>])
       end,

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudDigitMapDescriptor'(Tlv) ->
   'dec_IndAudDigitMapDescriptor'(Tlv, [16]).

'dec_IndAudDigitMapDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute digitMapName(1) with type OCTET STRING OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_octet_string(V1,2,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

case Tlv2 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv2}}}) % extra fields not allowed
end,
   {'IndAudDigitMapDescriptor', Term1}.



%%================================
%%  IndAudSignal
%%================================
'enc_IndAudSignal'(Val) ->
    'enc_IndAudSignal'(Val, [<<48>>]).

'enc_IndAudSignal'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute signalName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudSignal'(Tlv) ->
   'dec_IndAudSignal'(Tlv, [16]).

'dec_IndAudSignal'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute signalName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudSignal', Term1, Term2}.



%%================================
%%  IndAudSeqSigList
%%================================
'enc_IndAudSeqSigList'(Val) ->
    'enc_IndAudSeqSigList'(Val, [<<48>>]).

'enc_IndAudSeqSigList'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute id(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute signalList(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudSignal OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudSignal'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudSeqSigList'(Tlv) ->
   'dec_IndAudSeqSigList'(Tlv, [16]).

'dec_IndAudSeqSigList'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute id(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,65535},[131072]),

%%-------------------------------------------------
%% attribute signalList(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudSignal OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_IndAudSignal'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'IndAudSeqSigList', Term1, Term2}.



%%================================
%%  IndAudSignalsDescriptor
%%================================
'enc_IndAudSignalsDescriptor'(Val) ->
    'enc_IndAudSignalsDescriptor'(Val, []).


'enc_IndAudSignalsDescriptor'({'IndAudSignalsDescriptor',Val}, TagIn) ->
   'enc_IndAudSignalsDescriptor'(Val, TagIn);

'enc_IndAudSignalsDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      signal ->
         'enc_IndAudSignal'(element(2,Val), [<<160>>]);
      seqSigList ->
         'enc_IndAudSeqSigList'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_IndAudSignalsDescriptor'(Tlv) ->
   'dec_IndAudSignalsDescriptor'(Tlv, []).

'dec_IndAudSignalsDescriptor'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'signal'
    {131072, V1} -> 
        {signal, 'dec_IndAudSignal'(V1, [])};


%% 'seqSigList'
    {131073, V1} -> 
        {seqSigList, 'dec_IndAudSeqSigList'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  IndAudEventBufferDescriptor
%%================================
'enc_IndAudEventBufferDescriptor'(Val) ->
    'enc_IndAudEventBufferDescriptor'(Val, [<<48>>]).

'enc_IndAudEventBufferDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudEventBufferDescriptor'(Tlv) ->
   'dec_IndAudEventBufferDescriptor'(Tlv, [16]).

'dec_IndAudEventBufferDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute eventName(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute streamID(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudEventBufferDescriptor', Term1, Term2}.



%%================================
%%  IndAudEventsDescriptor
%%================================
'enc_IndAudEventsDescriptor'(Val) ->
    'enc_IndAudEventsDescriptor'(Val, [<<48>>]).

'enc_IndAudEventsDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute pkgdName(2) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], Cindex2, [<<129>>]),

%%-------------------------------------------------
%% attribute streamID(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex3, [<<130>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudEventsDescriptor'(Tlv) ->
   'dec_IndAudEventsDescriptor'(Tlv, [16]).

'dec_IndAudEventsDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute requestID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,4294967295},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute pkgdName(2) with type OCTET STRING
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_octet_string(V2,4,[131073]),

%%-------------------------------------------------
%% attribute streamID(3) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_integer(V3,{0,65535},[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudEventsDescriptor', Term1, Term2, Term3}.



%%================================
%%  IndAudTerminationStateDescriptor
%%================================
'enc_IndAudTerminationStateDescriptor'(Val) ->
    'enc_IndAudTerminationStateDescriptor'(Val, [<<48>>]).

'enc_IndAudTerminationStateDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute propertyParms(1) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_IndAudTerminationStateDescriptor_propertyParms'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute eventBufferControl(2) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute serviceState(3) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex3, [<<130>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  IndAudTerminationStateDescriptor_propertyParms
%%================================

'enc_IndAudTerminationStateDescriptor_propertyParms'({'IndAudTerminationStateDescriptor_propertyParms',Val}, TagIn) ->
   'enc_IndAudTerminationStateDescriptor_propertyParms'(Val, TagIn);

'enc_IndAudTerminationStateDescriptor_propertyParms'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_IndAudTerminationStateDescriptor_propertyParms_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_IndAudTerminationStateDescriptor_propertyParms_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAudPropertyParm'(H, [<<48>>]),
   'enc_IndAudTerminationStateDescriptor_propertyParms_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_IndAudTerminationStateDescriptor_propertyParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAudPropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_IndAudTerminationStateDescriptor'(Tlv) ->
   'dec_IndAudTerminationStateDescriptor'(Tlv, [16]).

'dec_IndAudTerminationStateDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute propertyParms(1) with type SEQUENCE OF
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_IndAudTerminationStateDescriptor_propertyParms'(V1, [131072]),

%%-------------------------------------------------
%% attribute eventBufferControl(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute serviceState(3) with type NULL OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_null(V3,[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudTerminationStateDescriptor', Term1, Term2, Term3}.



%%================================
%%  IndAudPropertyGroup
%%================================
'enc_IndAudPropertyGroup'(Val) ->
    'enc_IndAudPropertyGroup'(Val, [<<48>>]).


'enc_IndAudPropertyGroup'({'IndAudPropertyGroup',Val}, TagIn) ->
   'enc_IndAudPropertyGroup'(Val, TagIn);

'enc_IndAudPropertyGroup'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_IndAudPropertyGroup_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_IndAudPropertyGroup_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAudPropertyParm'(H, [<<48>>]),
   'enc_IndAudPropertyGroup_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_IndAudPropertyGroup'(Tlv) ->
   'dec_IndAudPropertyGroup'(Tlv, [16]).

'dec_IndAudPropertyGroup'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAudPropertyParm'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  IndAudLocalRemoteDescriptor
%%================================
'enc_IndAudLocalRemoteDescriptor'(Val) ->
    'enc_IndAudLocalRemoteDescriptor'(Val, [<<48>>]).

'enc_IndAudLocalRemoteDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute propGroupID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute propGrps(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudPropertyGroup
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_IndAudPropertyGroup'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudLocalRemoteDescriptor'(Tlv) ->
   'dec_IndAudLocalRemoteDescriptor'(Tlv, [16]).

'dec_IndAudLocalRemoteDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute propGroupID(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,65535},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute propGrps(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudPropertyGroup
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_IndAudPropertyGroup'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudLocalRemoteDescriptor', Term1, Term2}.



%%================================
%%  IndAudPropertyParm
%%================================
'enc_IndAudPropertyParm'(Val) ->
    'enc_IndAudPropertyParm'(Val, [<<48>>]).

'enc_IndAudPropertyParm'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute name(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudPropertyParm'(Tlv) ->
   'dec_IndAudPropertyParm'(Tlv, [16]).

'dec_IndAudPropertyParm'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute name(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

case Tlv2 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudPropertyParm', Term1}.



%%================================
%%  IndAudLocalControlDescriptor
%%================================
'enc_IndAudLocalControlDescriptor'(Val) ->
    'enc_IndAudLocalControlDescriptor'(Val, [<<48>>]).

'enc_IndAudLocalControlDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute streamMode(1) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute reserveValue(2) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute reserveGroup(3) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute propertyParms(4) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudLocalControlDescriptor_propertyParms'(Cindex4, [<<163>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  IndAudLocalControlDescriptor_propertyParms
%%================================

'enc_IndAudLocalControlDescriptor_propertyParms'({'IndAudLocalControlDescriptor_propertyParms',Val}, TagIn) ->
   'enc_IndAudLocalControlDescriptor_propertyParms'(Val, TagIn);

'enc_IndAudLocalControlDescriptor_propertyParms'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_IndAudLocalControlDescriptor_propertyParms_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_IndAudLocalControlDescriptor_propertyParms_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAudPropertyParm'(H, [<<48>>]),
   'enc_IndAudLocalControlDescriptor_propertyParms_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_IndAudLocalControlDescriptor_propertyParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAudPropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_IndAudLocalControlDescriptor'(Tlv) ->
   'dec_IndAudLocalControlDescriptor'(Tlv, [16]).

'dec_IndAudLocalControlDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute streamMode(1) with type NULL OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_null(V1,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute reserveValue(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute reserveGroup(3) with type NULL OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_null(V3,[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute propertyParms(4) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_IndAudLocalControlDescriptor_propertyParms'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudLocalControlDescriptor', Term1, Term2, Term3, Term4}.



%%================================
%%  IndAudStreamParms
%%================================
'enc_IndAudStreamParms'(Val) ->
    'enc_IndAudStreamParms'(Val, [<<48>>]).

'enc_IndAudStreamParms'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute localControlDescriptor(1)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalControlDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudLocalControlDescriptor'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute localDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudLocalRemoteDescriptor'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute remoteDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudLocalRemoteDescriptor'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute statisticsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudStatisticsDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudStatisticsDescriptor'(Cindex4, [<<163>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudStreamParms'(Tlv) ->
   'dec_IndAudStreamParms'(Tlv, [16]).

'dec_IndAudStreamParms'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute localControlDescriptor(1)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalControlDescriptor OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_IndAudLocalControlDescriptor'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute localDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_IndAudLocalRemoteDescriptor'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute remoteDescriptor(3)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudLocalRemoteDescriptor OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_IndAudLocalRemoteDescriptor'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute statisticsDescriptor(4)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudStatisticsDescriptor OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {'dec_IndAudStatisticsDescriptor'(V4, []), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudStreamParms', Term1, Term2, Term3, Term4}.



%%================================
%%  IndAudStreamDescriptor
%%================================
'enc_IndAudStreamDescriptor'(Val) ->
    'enc_IndAudStreamDescriptor'(Val, [<<48>>]).

'enc_IndAudStreamDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute streamID(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute streamParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudStreamParms
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_IndAudStreamParms'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IndAudStreamDescriptor'(Tlv) ->
   'dec_IndAudStreamDescriptor'(Tlv, [16]).

'dec_IndAudStreamDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute streamID(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,65535},[131072]),

%%-------------------------------------------------
%% attribute streamParms(2)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudStreamParms
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_IndAudStreamParms'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'IndAudStreamDescriptor', Term1, Term2}.



%%================================
%%  IndAudMediaDescriptor
%%================================
'enc_IndAudMediaDescriptor'(Val) ->
    'enc_IndAudMediaDescriptor'(Val, [<<48>>]).

'enc_IndAudMediaDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute termStateDescr(1)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudTerminationStateDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudTerminationStateDescriptor'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute streams(2) with type CHOICE OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_IndAudMediaDescriptor_streams'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  IndAudMediaDescriptor_streams
%%================================

'enc_IndAudMediaDescriptor_streams'({'IndAudMediaDescriptor_streams',Val}, TagIn) ->
   'enc_IndAudMediaDescriptor_streams'(Val, TagIn);

'enc_IndAudMediaDescriptor_streams'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      oneStream ->
         'enc_IndAudStreamParms'(element(2,Val), [<<160>>]);
      multiStream ->
         'enc_IndAudMediaDescriptor_streams_multiStream'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).





%%================================
%%  IndAudMediaDescriptor_streams_multiStream
%%================================

'enc_IndAudMediaDescriptor_streams_multiStream'({'IndAudMediaDescriptor_streams_multiStream',Val}, TagIn) ->
   'enc_IndAudMediaDescriptor_streams_multiStream'(Val, TagIn);

'enc_IndAudMediaDescriptor_streams_multiStream'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_IndAudMediaDescriptor_streams_multiStream_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_IndAudMediaDescriptor_streams_multiStream_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAudStreamDescriptor'(H, [<<48>>]),
   'enc_IndAudMediaDescriptor_streams_multiStream_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_IndAudMediaDescriptor_streams_multiStream'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAudStreamDescriptor'(V1, [16]) || V1 <- Tlv1].


'dec_IndAudMediaDescriptor_streams'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'oneStream'
    {131072, V1} -> 
        {oneStream, 'dec_IndAudStreamParms'(V1, [])};


%% 'multiStream'
    {131073, V1} -> 
        {multiStream, 'dec_IndAudMediaDescriptor_streams_multiStream'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_IndAudMediaDescriptor'(Tlv) ->
   'dec_IndAudMediaDescriptor'(Tlv, [16]).

'dec_IndAudMediaDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute termStateDescr(1)   External megaco_ber_bin_media_gateway_control_prev3a:IndAudTerminationStateDescriptor OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_IndAudTerminationStateDescriptor'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute streams(2) with type CHOICE OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_IndAudMediaDescriptor_streams'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'IndAudMediaDescriptor', Term1, Term2}.



%%================================
%%  IndAuditParameter
%%================================
'enc_IndAuditParameter'(Val) ->
    'enc_IndAuditParameter'(Val, []).


'enc_IndAuditParameter'({'IndAuditParameter',Val}, TagIn) ->
   'enc_IndAuditParameter'(Val, TagIn);

'enc_IndAuditParameter'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      indAudMediaDescriptor ->
         'enc_IndAudMediaDescriptor'(element(2,Val), [<<160>>]);
      indAudEventsDescriptor ->
         'enc_IndAudEventsDescriptor'(element(2,Val), [<<161>>]);
      indAudEventBufferDescriptor ->
         'enc_IndAudEventBufferDescriptor'(element(2,Val), [<<162>>]);
      indAudSignalsDescriptor ->
         'enc_IndAudSignalsDescriptor'(element(2,Val), [<<163>>]);
      indAudDigitMapDescriptor ->
         'enc_IndAudDigitMapDescriptor'(element(2,Val), [<<164>>]);
      indAudStatisticsDescriptor ->
         'enc_IndAudStatisticsDescriptor'(element(2,Val), [<<165>>]);
      indAudPackagesDescriptor ->
         'enc_IndAudPackagesDescriptor'(element(2,Val), [<<166>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_IndAuditParameter'(Tlv) ->
   'dec_IndAuditParameter'(Tlv, []).

'dec_IndAuditParameter'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'indAudMediaDescriptor'
    {131072, V1} -> 
        {indAudMediaDescriptor, 'dec_IndAudMediaDescriptor'(V1, [])};


%% 'indAudEventsDescriptor'
    {131073, V1} -> 
        {indAudEventsDescriptor, 'dec_IndAudEventsDescriptor'(V1, [])};


%% 'indAudEventBufferDescriptor'
    {131074, V1} -> 
        {indAudEventBufferDescriptor, 'dec_IndAudEventBufferDescriptor'(V1, [])};


%% 'indAudSignalsDescriptor'
    {131075, V1} -> 
        {indAudSignalsDescriptor, 'dec_IndAudSignalsDescriptor'(V1, [])};


%% 'indAudDigitMapDescriptor'
    {131076, V1} -> 
        {indAudDigitMapDescriptor, 'dec_IndAudDigitMapDescriptor'(V1, [])};


%% 'indAudStatisticsDescriptor'
    {131077, V1} -> 
        {indAudStatisticsDescriptor, 'dec_IndAudStatisticsDescriptor'(V1, [])};


%% 'indAudPackagesDescriptor'
    {131078, V1} -> 
        {indAudPackagesDescriptor, 'dec_IndAudPackagesDescriptor'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  AuditDescriptor
%%================================
'enc_AuditDescriptor'(Val) ->
    'enc_AuditDescriptor'(Val, [<<48>>]).

'enc_AuditDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute auditToken(1) with type BIT STRING OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_bit_string([], Cindex1, [{muxToken,0},{modemToken,1},{mediaToken,2},{eventsToken,3},{signalsToken,4},{digitMapToken,5},{statsToken,6},{observedEventsToken,7},{packagesToken,8},{eventBufferToken,9}], [<<128>>])
       end,

%%-------------------------------------------------
%% attribute auditPropertyToken(2) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_AuditDescriptor_auditPropertyToken'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  AuditDescriptor_auditPropertyToken
%%================================

'enc_AuditDescriptor_auditPropertyToken'({'AuditDescriptor_auditPropertyToken',Val}, TagIn) ->
   'enc_AuditDescriptor_auditPropertyToken'(Val, TagIn);

'enc_AuditDescriptor_auditPropertyToken'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_AuditDescriptor_auditPropertyToken_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_AuditDescriptor_auditPropertyToken_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAuditParameter'(H, []),
   'enc_AuditDescriptor_auditPropertyToken_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_AuditDescriptor_auditPropertyToken'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAuditParameter'(V1, []) || V1 <- Tlv1].




'dec_AuditDescriptor'(Tlv) ->
   'dec_AuditDescriptor'(Tlv, [16]).

'dec_AuditDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute auditToken(1) with type BIT STRING OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_bit_string(V1,[],[{muxToken,0},{modemToken,1},{mediaToken,2},{eventsToken,3},{signalsToken,4},{digitMapToken,5},{statsToken,6},{observedEventsToken,7},{packagesToken,8},{eventBufferToken,9}],[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute auditPropertyToken(2) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_AuditDescriptor_auditPropertyToken'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'AuditDescriptor', Term1, Term2}.



%%================================
%%  AuditReturnParameter
%%================================
'enc_AuditReturnParameter'(Val) ->
    'enc_AuditReturnParameter'(Val, []).


'enc_AuditReturnParameter'({'AuditReturnParameter',Val}, TagIn) ->
   'enc_AuditReturnParameter'(Val, TagIn);

'enc_AuditReturnParameter'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      errorDescriptor ->
         'enc_ErrorDescriptor'(element(2,Val), [<<160>>]);
      mediaDescriptor ->
         'enc_MediaDescriptor'(element(2,Val), [<<161>>]);
      modemDescriptor ->
         'enc_ModemDescriptor'(element(2,Val), [<<162>>]);
      muxDescriptor ->
         'enc_MuxDescriptor'(element(2,Val), [<<163>>]);
      eventsDescriptor ->
         'enc_EventsDescriptor'(element(2,Val), [<<164>>]);
      eventBufferDescriptor ->
         'enc_EventBufferDescriptor'(element(2,Val), [<<165>>]);
      signalsDescriptor ->
         'enc_SignalsDescriptor'(element(2,Val), [<<166>>]);
      digitMapDescriptor ->
         'enc_DigitMapDescriptor'(element(2,Val), [<<167>>]);
      observedEventsDescriptor ->
         'enc_ObservedEventsDescriptor'(element(2,Val), [<<168>>]);
      statisticsDescriptor ->
         'enc_StatisticsDescriptor'(element(2,Val), [<<169>>]);
      packagesDescriptor ->
         'enc_PackagesDescriptor'(element(2,Val), [<<170>>]);
      emptyDescriptors ->
         'enc_AuditDescriptor'(element(2,Val), [<<171>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_AuditReturnParameter'(Tlv) ->
   'dec_AuditReturnParameter'(Tlv, []).

'dec_AuditReturnParameter'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'errorDescriptor'
    {131072, V1} -> 
        {errorDescriptor, 'dec_ErrorDescriptor'(V1, [])};


%% 'mediaDescriptor'
    {131073, V1} -> 
        {mediaDescriptor, 'dec_MediaDescriptor'(V1, [])};


%% 'modemDescriptor'
    {131074, V1} -> 
        {modemDescriptor, 'dec_ModemDescriptor'(V1, [])};


%% 'muxDescriptor'
    {131075, V1} -> 
        {muxDescriptor, 'dec_MuxDescriptor'(V1, [])};


%% 'eventsDescriptor'
    {131076, V1} -> 
        {eventsDescriptor, 'dec_EventsDescriptor'(V1, [])};


%% 'eventBufferDescriptor'
    {131077, V1} -> 
        {eventBufferDescriptor, 'dec_EventBufferDescriptor'(V1, [])};


%% 'signalsDescriptor'
    {131078, V1} -> 
        {signalsDescriptor, 'dec_SignalsDescriptor'(V1, [])};


%% 'digitMapDescriptor'
    {131079, V1} -> 
        {digitMapDescriptor, 'dec_DigitMapDescriptor'(V1, [])};


%% 'observedEventsDescriptor'
    {131080, V1} -> 
        {observedEventsDescriptor, 'dec_ObservedEventsDescriptor'(V1, [])};


%% 'statisticsDescriptor'
    {131081, V1} -> 
        {statisticsDescriptor, 'dec_StatisticsDescriptor'(V1, [])};


%% 'packagesDescriptor'
    {131082, V1} -> 
        {packagesDescriptor, 'dec_PackagesDescriptor'(V1, [])};


%% 'emptyDescriptors'
    {131083, V1} -> 
        {emptyDescriptors, 'dec_AuditDescriptor'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  TerminationAudit
%%================================
'enc_TerminationAudit'(Val) ->
    'enc_TerminationAudit'(Val, [<<48>>]).


'enc_TerminationAudit'({'TerminationAudit',Val}, TagIn) ->
   'enc_TerminationAudit'(Val, TagIn);

'enc_TerminationAudit'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_TerminationAudit_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TerminationAudit_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_AuditReturnParameter'(H, []),
   'enc_TerminationAudit_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_TerminationAudit'(Tlv) ->
   'dec_TerminationAudit'(Tlv, [16]).

'dec_TerminationAudit'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_AuditReturnParameter'(V1, []) || V1 <- Tlv1].




%%================================
%%  AuditResult
%%================================
'enc_AuditResult'(Val) ->
    'enc_AuditResult'(Val, [<<48>>]).

'enc_AuditResult'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationID'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute terminationAuditResult(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationAudit
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_TerminationAudit'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_AuditResult'(Tlv) ->
   'dec_AuditResult'(Tlv, [16]).

'dec_AuditResult'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationID'(V1, [131072]),

%%-------------------------------------------------
%% attribute terminationAuditResult(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationAudit
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_TerminationAudit'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'AuditResult', Term1, Term2}.



%%================================
%%  AuditReply
%%================================
'enc_AuditReply'(Val) ->
    'enc_AuditReply'(Val, []).


'enc_AuditReply'({'AuditReply',Val}, TagIn) ->
   'enc_AuditReply'(Val, TagIn);

'enc_AuditReply'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      contextAuditResult ->
         'enc_TerminationIDList'(element(2,Val), [<<160>>]);
      error ->
         'enc_ErrorDescriptor'(element(2,Val), [<<161>>]);
      auditResult ->
         'enc_AuditResult'(element(2,Val), [<<162>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_AuditReply'(Tlv) ->
   'dec_AuditReply'(Tlv, []).

'dec_AuditReply'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'contextAuditResult'
    {131072, V1} -> 
        {contextAuditResult, 'dec_TerminationIDList'(V1, [])};


%% 'error'
    {131073, V1} -> 
        {error, 'dec_ErrorDescriptor'(V1, [])};


%% 'auditResult'
    {131074, V1} -> 
        {auditResult, 'dec_AuditResult'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  AuditRequest
%%================================
'enc_AuditRequest'(Val) ->
    'enc_AuditRequest'(Val, [<<48>>]).

'enc_AuditRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationID'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute auditDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_AuditDescriptor'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_AuditRequest'(Tlv) ->
   'dec_AuditRequest'(Tlv, [16]).

'dec_AuditRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationID'(V1, [131072]),

%%-------------------------------------------------
%% attribute auditDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_AuditDescriptor'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'AuditRequest', Term1, Term2}.



%%================================
%%  SubtractRequest
%%================================
'enc_SubtractRequest'(Val) ->
    'enc_SubtractRequest'(Val, [<<48>>]).

'enc_SubtractRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute auditDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_AuditDescriptor'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_SubtractRequest'(Tlv) ->
   'dec_SubtractRequest'(Tlv, [16]).

'dec_SubtractRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute auditDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:AuditDescriptor OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_AuditDescriptor'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'SubtractRequest', Term1, Term2}.



%%================================
%%  AmmsReply
%%================================
'enc_AmmsReply'(Val) ->
    'enc_AmmsReply'(Val, [<<48>>]).

'enc_AmmsReply'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute terminationAudit(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationAudit OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_TerminationAudit'(Cindex2, [<<161>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_AmmsReply'(Tlv) ->
   'dec_AmmsReply'(Tlv, [16]).

'dec_AmmsReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute terminationAudit(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationAudit OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_TerminationAudit'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'AmmsReply', Term1, Term2}.



%%================================
%%  AmmDescriptor
%%================================
'enc_AmmDescriptor'(Val) ->
    'enc_AmmDescriptor'(Val, []).


'enc_AmmDescriptor'({'AmmDescriptor',Val}, TagIn) ->
   'enc_AmmDescriptor'(Val, TagIn);

'enc_AmmDescriptor'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      mediaDescriptor ->
         'enc_MediaDescriptor'(element(2,Val), [<<160>>]);
      modemDescriptor ->
         'enc_ModemDescriptor'(element(2,Val), [<<161>>]);
      muxDescriptor ->
         'enc_MuxDescriptor'(element(2,Val), [<<162>>]);
      eventsDescriptor ->
         'enc_EventsDescriptor'(element(2,Val), [<<163>>]);
      eventBufferDescriptor ->
         'enc_EventBufferDescriptor'(element(2,Val), [<<164>>]);
      signalsDescriptor ->
         'enc_SignalsDescriptor'(element(2,Val), [<<165>>]);
      digitMapDescriptor ->
         'enc_DigitMapDescriptor'(element(2,Val), [<<166>>]);
      auditDescriptor ->
         'enc_AuditDescriptor'(element(2,Val), [<<167>>]);
      statisticsDescriptor ->
         'enc_StatisticsDescriptor'(element(2,Val), [<<168>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_AmmDescriptor'(Tlv) ->
   'dec_AmmDescriptor'(Tlv, []).

'dec_AmmDescriptor'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'mediaDescriptor'
    {131072, V1} -> 
        {mediaDescriptor, 'dec_MediaDescriptor'(V1, [])};


%% 'modemDescriptor'
    {131073, V1} -> 
        {modemDescriptor, 'dec_ModemDescriptor'(V1, [])};


%% 'muxDescriptor'
    {131074, V1} -> 
        {muxDescriptor, 'dec_MuxDescriptor'(V1, [])};


%% 'eventsDescriptor'
    {131075, V1} -> 
        {eventsDescriptor, 'dec_EventsDescriptor'(V1, [])};


%% 'eventBufferDescriptor'
    {131076, V1} -> 
        {eventBufferDescriptor, 'dec_EventBufferDescriptor'(V1, [])};


%% 'signalsDescriptor'
    {131077, V1} -> 
        {signalsDescriptor, 'dec_SignalsDescriptor'(V1, [])};


%% 'digitMapDescriptor'
    {131078, V1} -> 
        {digitMapDescriptor, 'dec_DigitMapDescriptor'(V1, [])};


%% 'auditDescriptor'
    {131079, V1} -> 
        {auditDescriptor, 'dec_AuditDescriptor'(V1, [])};


%% 'statisticsDescriptor'
    {131080, V1} -> 
        {statisticsDescriptor, 'dec_StatisticsDescriptor'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  AmmRequest
%%================================
'enc_AmmRequest'(Val) ->
    'enc_AmmRequest'(Val, [<<48>>]).

'enc_AmmRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationIDList'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute descriptors(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_AmmRequest_descriptors'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  AmmRequest_descriptors
%%================================

'enc_AmmRequest_descriptors'({'AmmRequest_descriptors',Val}, TagIn) ->
   'enc_AmmRequest_descriptors'(Val, TagIn);

'enc_AmmRequest_descriptors'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_AmmRequest_descriptors_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_AmmRequest_descriptors_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_AmmDescriptor'(H, []),
   'enc_AmmRequest_descriptors_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_AmmRequest_descriptors'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_AmmDescriptor'(V1, []) || V1 <- Tlv1].




'dec_AmmRequest'(Tlv) ->
   'dec_AmmRequest'(Tlv, [16]).

'dec_AmmRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationID(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationIDList
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationIDList'(V1, [131072]),

%%-------------------------------------------------
%% attribute descriptors(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_AmmRequest_descriptors'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'AmmRequest', Term1, Term2}.



%%================================
%%  TopologyRequest
%%================================
'enc_TopologyRequest'(Val) ->
    'enc_TopologyRequest'(Val, [<<48>>]).

'enc_TopologyRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute terminationFrom(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_TerminationID'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute terminationTo(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_TerminationID'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute topologyDirection(3) with type ENUMERATED
%%-------------------------------------------------
   {EncBytes3,EncLen3} = case Cindex3 of
bothway -> ?RT_BER:encode_enumerated(0,[<<130>>]);
isolate -> ?RT_BER:encode_enumerated(1,[<<130>>]);
oneway -> ?RT_BER:encode_enumerated(2,[<<130>>]);
Enumval1 -> exit({error,{asn1, {enumerated_not_in_range,Enumval1}}})
end,

%%-------------------------------------------------
%% attribute streamID(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex4, [<<131>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_TopologyRequest'(Tlv) ->
   'dec_TopologyRequest'(Tlv, [16]).

'dec_TopologyRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute terminationFrom(1)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_TerminationID'(V1, [131072]),

%%-------------------------------------------------
%% attribute terminationTo(2)   External megaco_ber_bin_media_gateway_control_prev3a:TerminationID
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_TerminationID'(V2, [131073]),

%%-------------------------------------------------
%% attribute topologyDirection(3) with type ENUMERATED
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = ?RT_BER:decode_enumerated(V3,[],[{bothway,0},{isolate,1},{oneway,2}],[131074]),

%%-------------------------------------------------
%% attribute streamID(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_integer(V4,{0,65535},[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

case Tlv5 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TopologyRequest', Term1, Term2, Term3, Term4}.



%%================================
%%  CommandReply
%%================================
'enc_CommandReply'(Val) ->
    'enc_CommandReply'(Val, []).


'enc_CommandReply'({'CommandReply',Val}, TagIn) ->
   'enc_CommandReply'(Val, TagIn);

'enc_CommandReply'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      addReply ->
         'enc_AmmsReply'(element(2,Val), [<<160>>]);
      moveReply ->
         'enc_AmmsReply'(element(2,Val), [<<161>>]);
      modReply ->
         'enc_AmmsReply'(element(2,Val), [<<162>>]);
      subtractReply ->
         'enc_AmmsReply'(element(2,Val), [<<163>>]);
      auditCapReply ->
         'enc_AuditReply'(element(2,Val), [<<164>>]);
      auditValueReply ->
         'enc_AuditReply'(element(2,Val), [<<165>>]);
      notifyReply ->
         'enc_NotifyReply'(element(2,Val), [<<166>>]);
      serviceChangeReply ->
         'enc_ServiceChangeReply'(element(2,Val), [<<167>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_CommandReply'(Tlv) ->
   'dec_CommandReply'(Tlv, []).

'dec_CommandReply'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'addReply'
    {131072, V1} -> 
        {addReply, 'dec_AmmsReply'(V1, [])};


%% 'moveReply'
    {131073, V1} -> 
        {moveReply, 'dec_AmmsReply'(V1, [])};


%% 'modReply'
    {131074, V1} -> 
        {modReply, 'dec_AmmsReply'(V1, [])};


%% 'subtractReply'
    {131075, V1} -> 
        {subtractReply, 'dec_AmmsReply'(V1, [])};


%% 'auditCapReply'
    {131076, V1} -> 
        {auditCapReply, 'dec_AuditReply'(V1, [])};


%% 'auditValueReply'
    {131077, V1} -> 
        {auditValueReply, 'dec_AuditReply'(V1, [])};


%% 'notifyReply'
    {131078, V1} -> 
        {notifyReply, 'dec_NotifyReply'(V1, [])};


%% 'serviceChangeReply'
    {131079, V1} -> 
        {serviceChangeReply, 'dec_ServiceChangeReply'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  Command
%%================================
'enc_Command'(Val) ->
    'enc_Command'(Val, []).


'enc_Command'({'Command',Val}, TagIn) ->
   'enc_Command'(Val, TagIn);

'enc_Command'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      addReq ->
         'enc_AmmRequest'(element(2,Val), [<<160>>]);
      moveReq ->
         'enc_AmmRequest'(element(2,Val), [<<161>>]);
      modReq ->
         'enc_AmmRequest'(element(2,Val), [<<162>>]);
      subtractReq ->
         'enc_SubtractRequest'(element(2,Val), [<<163>>]);
      auditCapRequest ->
         'enc_AuditRequest'(element(2,Val), [<<164>>]);
      auditValueRequest ->
         'enc_AuditRequest'(element(2,Val), [<<165>>]);
      notifyReq ->
         'enc_NotifyRequest'(element(2,Val), [<<166>>]);
      serviceChangeReq ->
         'enc_ServiceChangeRequest'(element(2,Val), [<<167>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_Command'(Tlv) ->
   'dec_Command'(Tlv, []).

'dec_Command'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'addReq'
    {131072, V1} -> 
        {addReq, 'dec_AmmRequest'(V1, [])};


%% 'moveReq'
    {131073, V1} -> 
        {moveReq, 'dec_AmmRequest'(V1, [])};


%% 'modReq'
    {131074, V1} -> 
        {modReq, 'dec_AmmRequest'(V1, [])};


%% 'subtractReq'
    {131075, V1} -> 
        {subtractReq, 'dec_SubtractRequest'(V1, [])};


%% 'auditCapRequest'
    {131076, V1} -> 
        {auditCapRequest, 'dec_AuditRequest'(V1, [])};


%% 'auditValueRequest'
    {131077, V1} -> 
        {auditValueRequest, 'dec_AuditRequest'(V1, [])};


%% 'notifyReq'
    {131078, V1} -> 
        {notifyReq, 'dec_NotifyRequest'(V1, [])};


%% 'serviceChangeReq'
    {131079, V1} -> 
        {serviceChangeReq, 'dec_ServiceChangeRequest'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  CommandRequest
%%================================
'enc_CommandRequest'(Val) ->
    'enc_CommandRequest'(Val, [<<48>>]).

'enc_CommandRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute command(1)   External megaco_ber_bin_media_gateway_control_prev3a:Command
%%-------------------------------------------------
   {EncBytes1,EncLen1} = 'enc_Command'(Cindex1, [<<160>>]),

%%-------------------------------------------------
%% attribute optional(2) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute wildcardReturn(3) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex3, [<<130>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_CommandRequest'(Tlv) ->
   'dec_CommandRequest'(Tlv, [16]).

'dec_CommandRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute command(1)   External megaco_ber_bin_media_gateway_control_prev3a:Command
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = 'dec_Command'(V1, [131072]),

%%-------------------------------------------------
%% attribute optional(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute wildcardReturn(3) with type NULL OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_null(V3,[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'CommandRequest', Term1, Term2, Term3}.



%%================================
%%  ContextAttrAuditRequest
%%================================
'enc_ContextAttrAuditRequest'(Val) ->
    'enc_ContextAttrAuditRequest'(Val, [<<48>>]).

'enc_ContextAttrAuditRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val,

%%-------------------------------------------------
%% attribute topology(1) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute emergency(2) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute priority(3) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex3, [<<130>>])
       end,

%%-------------------------------------------------
%% attribute iepsCallind(4) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex4, [<<131>>])
       end,

%%-------------------------------------------------
%% attribute contextPropAud(5) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextAttrAuditRequest_contextPropAud'(Cindex5, [<<164>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ContextAttrAuditRequest_contextPropAud
%%================================

'enc_ContextAttrAuditRequest_contextPropAud'({'ContextAttrAuditRequest_contextPropAud',Val}, TagIn) ->
   'enc_ContextAttrAuditRequest_contextPropAud'(Val, TagIn);

'enc_ContextAttrAuditRequest_contextPropAud'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ContextAttrAuditRequest_contextPropAud_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ContextAttrAuditRequest_contextPropAud_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_IndAudPropertyParm'(H, [<<48>>]),
   'enc_ContextAttrAuditRequest_contextPropAud_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ContextAttrAuditRequest_contextPropAud'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_IndAudPropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_ContextAttrAuditRequest'(Tlv) ->
   'dec_ContextAttrAuditRequest'(Tlv, [16]).

'dec_ContextAttrAuditRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute topology(1) with type NULL OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_null(V1,[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute emergency(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute priority(3) with type NULL OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {?RT_BER:decode_null(V3,[]), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute iepsCallind(4) with type NULL OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_null(V4,[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute contextPropAud(5) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {'dec_ContextAttrAuditRequest_contextPropAud'(V5, []), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ContextAttrAuditRequest', Term1, Term2, Term3, Term4, Term5}.



%%================================
%%  ContextRequest
%%================================
'enc_ContextRequest'(Val) ->
    'enc_ContextRequest'(Val, [<<48>>]).

'enc_ContextRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val,

%%-------------------------------------------------
%% attribute priority(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex1, [<<128>>])
       end,

%%-------------------------------------------------
%% attribute emergency(2) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute topologyReq(3) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextRequest_topologyReq'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute iepsCallind(4) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_boolean(Cindex4, [<<131>>])
       end,

%%-------------------------------------------------
%% attribute contextProp(5) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextRequest_contextProp'(Cindex5, [<<164>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ContextRequest_topologyReq
%%================================

'enc_ContextRequest_topologyReq'({'ContextRequest_topologyReq',Val}, TagIn) ->
   'enc_ContextRequest_topologyReq'(Val, TagIn);

'enc_ContextRequest_topologyReq'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ContextRequest_topologyReq_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ContextRequest_topologyReq_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_TopologyRequest'(H, [<<48>>]),
   'enc_ContextRequest_topologyReq_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ContextRequest_topologyReq'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_TopologyRequest'(V1, [16]) || V1 <- Tlv1].





%%================================
%%  ContextRequest_contextProp
%%================================

'enc_ContextRequest_contextProp'({'ContextRequest_contextProp',Val}, TagIn) ->
   'enc_ContextRequest_contextProp'(Val, TagIn);

'enc_ContextRequest_contextProp'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ContextRequest_contextProp_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ContextRequest_contextProp_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_PropertyParm'(H, [<<48>>]),
   'enc_ContextRequest_contextProp_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ContextRequest_contextProp'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_PropertyParm'(V1, [16]) || V1 <- Tlv1].




'dec_ContextRequest'(Tlv) ->
   'dec_ContextRequest'(Tlv, [16]).

'dec_ContextRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute priority(1) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {?RT_BER:decode_integer(V1,{0,15},[]), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute emergency(2) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_boolean(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute topologyReq(3) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_ContextRequest_topologyReq'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute iepsCallind(4) with type BOOLEAN OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_boolean(V4,[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute contextProp(5) with type SEQUENCE OF OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {'dec_ContextRequest_contextProp'(V5, []), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'ContextRequest', Term1, Term2, Term3, Term4, Term5}.



%%================================
%%  ActionReply
%%================================
'enc_ActionReply'(Val) ->
    'enc_ActionReply'(Val, [<<48>>]).

'enc_ActionReply'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute contextId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute errorDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ErrorDescriptor'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute contextReply(3)   External megaco_ber_bin_media_gateway_control_prev3a:ContextRequest OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextRequest'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute commandReply(4) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes4,EncLen4} = 'enc_ActionReply_commandReply'(Cindex4, [<<163>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ActionReply_commandReply
%%================================

'enc_ActionReply_commandReply'({'ActionReply_commandReply',Val}, TagIn) ->
   'enc_ActionReply_commandReply'(Val, TagIn);

'enc_ActionReply_commandReply'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ActionReply_commandReply_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ActionReply_commandReply_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_CommandReply'(H, []),
   'enc_ActionReply_commandReply_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ActionReply_commandReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_CommandReply'(V1, []) || V1 <- Tlv1].




'dec_ActionReply'(Tlv) ->
   'dec_ActionReply'(Tlv, [16]).

'dec_ActionReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute contextId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute errorDescriptor(2)   External megaco_ber_bin_media_gateway_control_prev3a:ErrorDescriptor OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_ErrorDescriptor'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute contextReply(3)   External megaco_ber_bin_media_gateway_control_prev3a:ContextRequest OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_ContextRequest'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute commandReply(4) with type SEQUENCE OF
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = 'dec_ActionReply_commandReply'(V4, [131075]),

case Tlv5 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed
end,
   {'ActionReply', Term1, Term2, Term3, Term4}.



%%================================
%%  ActionRequest
%%================================
'enc_ActionRequest'(Val) ->
    'enc_ActionRequest'(Val, [<<48>>]).

'enc_ActionRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,

%%-------------------------------------------------
%% attribute contextId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute contextRequest(2)   External megaco_ber_bin_media_gateway_control_prev3a:ContextRequest OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextRequest'(Cindex2, [<<161>>])
       end,

%%-------------------------------------------------
%% attribute contextAttrAuditReq(3)   External megaco_ber_bin_media_gateway_control_prev3a:ContextAttrAuditRequest OPTIONAL
%%-------------------------------------------------
   {EncBytes3,EncLen3} =  case Cindex3 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_ContextAttrAuditRequest'(Cindex3, [<<162>>])
       end,

%%-------------------------------------------------
%% attribute commandRequests(4) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes4,EncLen4} = 'enc_ActionRequest_commandRequests'(Cindex4, [<<163>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  ActionRequest_commandRequests
%%================================

'enc_ActionRequest_commandRequests'({'ActionRequest_commandRequests',Val}, TagIn) ->
   'enc_ActionRequest_commandRequests'(Val, TagIn);

'enc_ActionRequest_commandRequests'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_ActionRequest_commandRequests_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_ActionRequest_commandRequests_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_CommandRequest'(H, [<<48>>]),
   'enc_ActionRequest_commandRequests_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_ActionRequest_commandRequests'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_CommandRequest'(V1, [16]) || V1 <- Tlv1].




'dec_ActionRequest'(Tlv) ->
   'dec_ActionRequest'(Tlv, [16]).

'dec_ActionRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute contextId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute contextRequest(2)   External megaco_ber_bin_media_gateway_control_prev3a:ContextRequest OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {'dec_ContextRequest'(V2, []), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute contextAttrAuditReq(3)   External megaco_ber_bin_media_gateway_control_prev3a:ContextAttrAuditRequest OPTIONAL
%%-------------------------------------------------
{Term3,Tlv4} = case Tlv3 of
[{131074,V3}|TempTlv4] ->
    {'dec_ContextAttrAuditRequest'(V3, []), TempTlv4};
    _ ->
        { asn1_NOVALUE, Tlv3}
end,

%%-------------------------------------------------
%% attribute commandRequests(4) with type SEQUENCE OF
%%-------------------------------------------------
[V4|Tlv5] = Tlv4, 
Term4 = 'dec_ActionRequest_commandRequests'(V4, [131075]),

case Tlv5 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowed
end,
   {'ActionRequest', Term1, Term2, Term3, Term4}.



%%================================
%%  ContextID
%%================================
'enc_ContextID'(Val) ->
    'enc_ContextID'(Val, [<<2>>]).


'enc_ContextID'({'ContextID',Val}, TagIn) ->
   'enc_ContextID'(Val, TagIn);

'enc_ContextID'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_ContextID'(Tlv) ->
   'dec_ContextID'(Tlv, [2]).

'dec_ContextID'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,4294967295},TagIn).



%%================================
%%  ErrorText
%%================================
'enc_ErrorText'(Val) ->
    'enc_ErrorText'(Val, [<<22>>]).


'enc_ErrorText'({'ErrorText',Val}, TagIn) ->
   'enc_ErrorText'(Val, TagIn);

'enc_ErrorText'(Val, TagIn) ->
?RT_BER:encode_restricted_string([], Val, 22, TagIn).


'dec_ErrorText'(Tlv) ->
   'dec_ErrorText'(Tlv, [22]).

'dec_ErrorText'(Tlv, TagIn) ->
?RT_BER:decode_restricted_string(Tlv,[],22,TagIn).



%%================================
%%  ErrorCode
%%================================
'enc_ErrorCode'(Val) ->
    'enc_ErrorCode'(Val, [<<2>>]).


'enc_ErrorCode'({'ErrorCode',Val}, TagIn) ->
   'enc_ErrorCode'(Val, TagIn);

'enc_ErrorCode'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_ErrorCode'(Tlv) ->
   'dec_ErrorCode'(Tlv, [2]).

'dec_ErrorCode'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,65535},TagIn).



%%================================
%%  ErrorDescriptor
%%================================
'enc_ErrorDescriptor'(Val) ->
    'enc_ErrorDescriptor'(Val, [<<48>>]).

'enc_ErrorDescriptor'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute errorCode(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute errorText(2) with type IA5String OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_restricted_string([], Cindex2, 22, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_ErrorDescriptor'(Tlv) ->
   'dec_ErrorDescriptor'(Tlv, [16]).

'dec_ErrorDescriptor'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute errorCode(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,65535},[131072]),

%%-------------------------------------------------
%% attribute errorText(2) with type IA5String OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_restricted_string(V2,[],22,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'ErrorDescriptor', Term1, Term2}.



%%================================
%%  TransactionAck
%%================================
'enc_TransactionAck'(Val) ->
    'enc_TransactionAck'(Val, [<<48>>]).

'enc_TransactionAck'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute firstAck(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute lastAck(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_TransactionAck'(Tlv) ->
   'dec_TransactionAck'(Tlv, [16]).

'dec_TransactionAck'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute firstAck(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute lastAck(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,4294967295},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'TransactionAck', Term1, Term2}.



%%================================
%%  TransactionResponseAck
%%================================
'enc_TransactionResponseAck'(Val) ->
    'enc_TransactionResponseAck'(Val, [<<48>>]).


'enc_TransactionResponseAck'({'TransactionResponseAck',Val}, TagIn) ->
   'enc_TransactionResponseAck'(Val, TagIn);

'enc_TransactionResponseAck'(Val, TagIn) ->
   {EncBytes,EncLen} = 'enc_TransactionResponseAck_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TransactionResponseAck_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_TransactionAck'(H, [<<48>>]),
   'enc_TransactionResponseAck_components'(T,[EncBytes|AccBytes], AccLen + EncLen).



'dec_TransactionResponseAck'(Tlv) ->
   'dec_TransactionResponseAck'(Tlv, [16]).

'dec_TransactionResponseAck'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_TransactionAck'(V1, [16]) || V1 <- Tlv1].




%%================================
%%  SegmentNumber
%%================================
'enc_SegmentNumber'(Val) ->
    'enc_SegmentNumber'(Val, [<<2>>]).


'enc_SegmentNumber'({'SegmentNumber',Val}, TagIn) ->
   'enc_SegmentNumber'(Val, TagIn);

'enc_SegmentNumber'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_SegmentNumber'(Tlv) ->
   'dec_SegmentNumber'(Tlv, [2]).

'dec_SegmentNumber'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,65535},TagIn).



%%================================
%%  TransactionReply
%%================================
'enc_TransactionReply'(Val) ->
    'enc_TransactionReply'(Val, [<<48>>]).

'enc_TransactionReply'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5} = Val,

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute immAckRequired(2) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex2, [<<129>>])
       end,

%%-------------------------------------------------
%% attribute transactionResult(3) with type CHOICE
%%-------------------------------------------------
   {EncBytes3,EncLen3} = 'enc_TransactionReply_transactionResult'(Cindex3, [<<162>>]),

%%-------------------------------------------------
%% attribute segmentNumber(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes4,EncLen4} =  case Cindex4 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex4, [<<131>>])
       end,

%%-------------------------------------------------
%% attribute segmentationComplete(5) with type NULL OPTIONAL
%%-------------------------------------------------
   {EncBytes5,EncLen5} =  case Cindex5 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_null(Cindex5, [<<132>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5],
LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  TransactionReply_transactionResult
%%================================

'enc_TransactionReply_transactionResult'({'TransactionReply_transactionResult',Val}, TagIn) ->
   'enc_TransactionReply_transactionResult'(Val, TagIn);

'enc_TransactionReply_transactionResult'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      transactionError ->
         'enc_ErrorDescriptor'(element(2,Val), [<<160>>]);
      actionReplies ->
         'enc_TransactionReply_transactionResult_actionReplies'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).





%%================================
%%  TransactionReply_transactionResult_actionReplies
%%================================

'enc_TransactionReply_transactionResult_actionReplies'({'TransactionReply_transactionResult_actionReplies',Val}, TagIn) ->
   'enc_TransactionReply_transactionResult_actionReplies'(Val, TagIn);

'enc_TransactionReply_transactionResult_actionReplies'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_TransactionReply_transactionResult_actionReplies_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TransactionReply_transactionResult_actionReplies_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_ActionReply'(H, [<<48>>]),
   'enc_TransactionReply_transactionResult_actionReplies_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_TransactionReply_transactionResult_actionReplies'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_ActionReply'(V1, [16]) || V1 <- Tlv1].


'dec_TransactionReply_transactionResult'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'transactionError'
    {131072, V1} -> 
        {transactionError, 'dec_ErrorDescriptor'(V1, [])};


%% 'actionReplies'
    {131073, V1} -> 
        {actionReplies, 'dec_TransactionReply_transactionResult_actionReplies'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_TransactionReply'(Tlv) ->
   'dec_TransactionReply'(Tlv, [16]).

'dec_TransactionReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute immAckRequired(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute transactionResult(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec_TransactionReply_transactionResult'(V3, [131074]),

%%-------------------------------------------------
%% attribute segmentNumber(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_integer(V4,{0,65535},[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute segmentationComplete(5) with type NULL OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {?RT_BER:decode_null(V5,[]), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TransactionReply', Term1, Term2, Term3, Term4, Term5}.



%%================================
%%  TransactionPending
%%================================
'enc_TransactionPending'(Val) ->
    'enc_TransactionPending'(Val, [<<48>>]).

'enc_TransactionPending'(Val, TagIn) ->
{_,Cindex1} = Val,

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

   BytesSoFar = [EncBytes1],
LenSoFar = EncLen1,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_TransactionPending'(Tlv) ->
   'dec_TransactionPending'(Tlv, [16]).

'dec_TransactionPending'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

case Tlv2 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TransactionPending', Term1}.



%%================================
%%  TransactionRequest
%%================================
'enc_TransactionRequest'(Val) ->
    'enc_TransactionRequest'(Val, [<<48>>]).

'enc_TransactionRequest'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute actions(2) with type SEQUENCE OF
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_TransactionRequest_actions'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  TransactionRequest_actions
%%================================

'enc_TransactionRequest_actions'({'TransactionRequest_actions',Val}, TagIn) ->
   'enc_TransactionRequest_actions'(Val, TagIn);

'enc_TransactionRequest_actions'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_TransactionRequest_actions_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_TransactionRequest_actions_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_ActionRequest'(H, [<<48>>]),
   'enc_TransactionRequest_actions_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_TransactionRequest_actions'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_ActionRequest'(V1, [16]) || V1 <- Tlv1].




'dec_TransactionRequest'(Tlv) ->
   'dec_TransactionRequest'(Tlv, [16]).

'dec_TransactionRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute actions(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_TransactionRequest_actions'(V2, [131073]),

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TransactionRequest', Term1, Term2}.



%%================================
%%  TransactionId
%%================================
'enc_TransactionId'(Val) ->
    'enc_TransactionId'(Val, [<<2>>]).


'enc_TransactionId'({'TransactionId',Val}, TagIn) ->
   'enc_TransactionId'(Val, TagIn);

'enc_TransactionId'(Val, TagIn) ->
?RT_BER:encode_integer([], Val, TagIn).


'dec_TransactionId'(Tlv) ->
   'dec_TransactionId'(Tlv, [2]).

'dec_TransactionId'(Tlv, TagIn) ->
?RT_BER:decode_integer(Tlv,{0,4294967295},TagIn).



%%================================
%%  Transaction
%%================================
'enc_Transaction'(Val) ->
    'enc_Transaction'(Val, []).


'enc_Transaction'({'Transaction',Val}, TagIn) ->
   'enc_Transaction'(Val, TagIn);

'enc_Transaction'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      transactionRequest ->
         'enc_TransactionRequest'(element(2,Val), [<<160>>]);
      transactionPending ->
         'enc_TransactionPending'(element(2,Val), [<<161>>]);
      transactionReply ->
         'enc_TransactionReply'(element(2,Val), [<<162>>]);
      transactionResponseAck ->
         'enc_TransactionResponseAck'(element(2,Val), [<<163>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_Transaction'(Tlv) ->
   'dec_Transaction'(Tlv, []).

'dec_Transaction'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'transactionRequest'
    {131072, V1} -> 
        {transactionRequest, 'dec_TransactionRequest'(V1, [])};


%% 'transactionPending'
    {131073, V1} -> 
        {transactionPending, 'dec_TransactionPending'(V1, [])};


%% 'transactionReply'
    {131074, V1} -> 
        {transactionReply, 'dec_TransactionReply'(V1, [])};


%% 'transactionResponseAck'
    {131075, V1} -> 
        {transactionResponseAck, 'dec_TransactionResponseAck'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  PathName
%%================================
'enc_PathName'(Val) ->
    'enc_PathName'(Val, [<<22>>]).


'enc_PathName'({'PathName',Val}, TagIn) ->
   'enc_PathName'(Val, TagIn);

'enc_PathName'(Val, TagIn) ->
?RT_BER:encode_restricted_string([], Val, 22, TagIn).


'dec_PathName'(Tlv) ->
   'dec_PathName'(Tlv, [22]).

'dec_PathName'(Tlv, TagIn) ->
?RT_BER:decode_restricted_string(Tlv,{1,64},22,TagIn).



%%================================
%%  IP6Address
%%================================
'enc_IP6Address'(Val) ->
    'enc_IP6Address'(Val, [<<48>>]).

'enc_IP6Address'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute address(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IP6Address'(Tlv) ->
   'dec_IP6Address'(Tlv, [16]).

'dec_IP6Address'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute address(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,16,[131072]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'IP6Address', Term1, Term2}.



%%================================
%%  IP4Address
%%================================
'enc_IP4Address'(Val) ->
    'enc_IP4Address'(Val, [<<48>>]).

'enc_IP4Address'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute address(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_IP4Address'(Tlv) ->
   'dec_IP4Address'(Tlv, [16]).

'dec_IP4Address'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute address(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'IP4Address', Term1, Term2}.



%%================================
%%  DomainName
%%================================
'enc_DomainName'(Val) ->
    'enc_DomainName'(Val, [<<48>>]).

'enc_DomainName'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute name(1) with type IA5String
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_restricted_string([], Cindex1, 22, [<<128>>]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
   {EncBytes2,EncLen2} =  case Cindex2 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            ?RT_BER:encode_integer([], Cindex2, [<<129>>])
       end,

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_DomainName'(Tlv) ->
   'dec_DomainName'(Tlv, [16]).

'dec_DomainName'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute name(1) with type IA5String
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_restricted_string(V1,[],22,[131072]),

%%-------------------------------------------------
%% attribute portNumber(2) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_integer(V2,{0,65535},[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'DomainName', Term1, Term2}.



%%================================
%%  MId
%%================================
'enc_MId'(Val) ->
    'enc_MId'(Val, []).


'enc_MId'({'MId',Val}, TagIn) ->
   'enc_MId'(Val, TagIn);

'enc_MId'(Val, TagIn) ->
   {EncBytes,EncLen} = case element(1,Val) of
      ip4Address ->
         'enc_IP4Address'(element(2,Val), [<<160>>]);
      ip6Address ->
         'enc_IP6Address'(element(2,Val), [<<161>>]);
      domainName ->
         'enc_DomainName'(element(2,Val), [<<162>>]);
      deviceName ->
         ?RT_BER:encode_restricted_string([], element(2,Val), 22, [<<131>>]);
      mtpAddress ->
         ?RT_BER:encode_octet_string([], element(2,Val), [<<132>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).




'dec_MId'(Tlv) ->
   'dec_MId'(Tlv, []).

'dec_MId'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'ip4Address'
    {131072, V1} -> 
        {ip4Address, 'dec_IP4Address'(V1, [])};


%% 'ip6Address'
    {131073, V1} -> 
        {ip6Address, 'dec_IP6Address'(V1, [])};


%% 'domainName'
    {131074, V1} -> 
        {domainName, 'dec_DomainName'(V1, [])};


%% 'deviceName'
    {131075, V1} -> 
        {deviceName, ?RT_BER:decode_restricted_string(V1,{1,64},22,[])};


%% 'mtpAddress'
    {131076, V1} -> 
        {mtpAddress, ?RT_BER:decode_octet_string(V1,{2,4},[])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


%%================================
%%  Message
%%================================
'enc_Message'(Val) ->
    'enc_Message'(Val, [<<48>>]).

'enc_Message'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute version(1) with type INTEGER
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute mId(2)   External megaco_ber_bin_media_gateway_control_prev3a:MId
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_MId'(Cindex2, [<<161>>]),

%%-------------------------------------------------
%% attribute messageBody(3) with type CHOICE
%%-------------------------------------------------
   {EncBytes3,EncLen3} = 'enc_Message_messageBody'(Cindex3, [<<162>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).



%%================================
%%  Message_messageBody
%%================================

'enc_Message_messageBody'({'Message_messageBody',Val}, TagIn) ->
   'enc_Message_messageBody'(Val, TagIn);

'enc_Message_messageBody'(Val, TagIn) ->
      {EncBytes,EncLen} = case element(1,Val) of
      messageError ->
         'enc_ErrorDescriptor'(element(2,Val), [<<160>>]);
      transactions ->
         'enc_Message_messageBody_transactions'(element(2,Val), [<<161>>]);
      Else -> 
         exit({error,{asn1,{invalid_choice_type,Else}}})
   end,

?RT_BER:encode_tags(TagIn, EncBytes, EncLen).





%%================================
%%  Message_messageBody_transactions
%%================================

'enc_Message_messageBody_transactions'({'Message_messageBody_transactions',Val}, TagIn) ->
   'enc_Message_messageBody_transactions'(Val, TagIn);

'enc_Message_messageBody_transactions'(Val, TagIn) ->
      {EncBytes,EncLen} = 'enc_Message_messageBody_transactions_components'(Val,[],0),
   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).

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

'enc_Message_messageBody_transactions_components'([H|T],AccBytes, AccLen) ->
   {EncBytes,EncLen} = 'enc_Transaction'(H, []),
   'enc_Message_messageBody_transactions_components'(T,[EncBytes|AccBytes], AccLen + EncLen).

'dec_Message_messageBody_transactions'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
['dec_Transaction'(V1, []) || V1 <- Tlv1].


'dec_Message_messageBody'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'messageError'
    {131072, V1} -> 
        {messageError, 'dec_ErrorDescriptor'(V1, [])};


%% 'transactions'
    {131073, V1} -> 
        {transactions, 'dec_Message_messageBody_transactions'(V1, [])};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec_Message'(Tlv) ->
   'dec_Message'(Tlv, [16]).

'dec_Message'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute version(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,99},[131072]),

%%-------------------------------------------------
%% attribute mId(2)   External megaco_ber_bin_media_gateway_control_prev3a:MId
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_MId'(V2, [131073]),

%%-------------------------------------------------
%% attribute messageBody(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec_Message_messageBody'(V3, [131074]),

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'Message', Term1, Term2, Term3}.



%%================================
%%  AuthData
%%================================
'enc_AuthData'(Val) ->
    'enc_AuthData'(Val, [<<4>>]).


'enc_AuthData'({'AuthData',Val}, TagIn) ->
   'enc_AuthData'(Val, TagIn);

'enc_AuthData'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_AuthData'(Tlv) ->
   'dec_AuthData'(Tlv, [4]).

'dec_AuthData'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,{12,32},TagIn).



%%================================
%%  SequenceNum
%%================================
'enc_SequenceNum'(Val) ->
    'enc_SequenceNum'(Val, [<<4>>]).


'enc_SequenceNum'({'SequenceNum',Val}, TagIn) ->
   'enc_SequenceNum'(Val, TagIn);

'enc_SequenceNum'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_SequenceNum'(Tlv) ->
   'dec_SequenceNum'(Tlv, [4]).

'dec_SequenceNum'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,4,TagIn).



%%================================
%%  SecurityParmIndex
%%================================
'enc_SecurityParmIndex'(Val) ->
    'enc_SecurityParmIndex'(Val, [<<4>>]).


'enc_SecurityParmIndex'({'SecurityParmIndex',Val}, TagIn) ->
   'enc_SecurityParmIndex'(Val, TagIn);

'enc_SecurityParmIndex'(Val, TagIn) ->
?RT_BER:encode_octet_string([], Val, TagIn).


'dec_SecurityParmIndex'(Tlv) ->
   'dec_SecurityParmIndex'(Tlv, [4]).

'dec_SecurityParmIndex'(Tlv, TagIn) ->
?RT_BER:decode_octet_string(Tlv,4,TagIn).



%%================================
%%  AuthenticationHeader
%%================================
'enc_AuthenticationHeader'(Val) ->
    'enc_AuthenticationHeader'(Val, [<<48>>]).

'enc_AuthenticationHeader'(Val, TagIn) ->
{_,Cindex1, Cindex2, Cindex3} = Val,

%%-------------------------------------------------
%% attribute secParmIndex(1) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes1,EncLen1} = ?RT_BER:encode_octet_string([], Cindex1, [<<128>>]),

%%-------------------------------------------------
%% attribute seqNum(2) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes2,EncLen2} = ?RT_BER:encode_octet_string([], Cindex2, [<<129>>]),

%%-------------------------------------------------
%% attribute ad(3) with type OCTET STRING
%%-------------------------------------------------
   {EncBytes3,EncLen3} = ?RT_BER:encode_octet_string([], Cindex3, [<<130>>]),

   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],
LenSoFar = EncLen1 + EncLen2 + EncLen3,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_AuthenticationHeader'(Tlv) ->
   'dec_AuthenticationHeader'(Tlv, [16]).

'dec_AuthenticationHeader'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute secParmIndex(1) with type OCTET STRING
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_octet_string(V1,4,[131072]),

%%-------------------------------------------------
%% attribute seqNum(2) with type OCTET STRING
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = ?RT_BER:decode_octet_string(V2,4,[131073]),

%%-------------------------------------------------
%% attribute ad(3) with type OCTET STRING
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = ?RT_BER:decode_octet_string(V3,{12,32},[131074]),

case Tlv4 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowed
end,
   {'AuthenticationHeader', Term1, Term2, Term3}.



%%================================
%%  MegacoMessage
%%================================
'enc_MegacoMessage'(Val) ->
    'enc_MegacoMessage'(Val, [<<48>>]).

'enc_MegacoMessage'(Val, TagIn) ->
{_,Cindex1, Cindex2} = Val,

%%-------------------------------------------------
%% attribute authHeader(1)   External megaco_ber_bin_media_gateway_control_prev3a:AuthenticationHeader OPTIONAL
%%-------------------------------------------------
   {EncBytes1,EncLen1} =  case Cindex1 of
         asn1_NOVALUE -> {<<>>,0};
         _ ->
            'enc_AuthenticationHeader'(Cindex1, [<<160>>])
       end,

%%-------------------------------------------------
%% attribute mess(2)   External megaco_ber_bin_media_gateway_control_prev3a:Message
%%-------------------------------------------------
   {EncBytes2,EncLen2} = 'enc_Message'(Cindex2, [<<161>>]),

   BytesSoFar = [EncBytes1, EncBytes2],
LenSoFar = EncLen1 + EncLen2,
?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).


'dec_MegacoMessage'(Tlv) ->
   'dec_MegacoMessage'(Tlv, [16]).

'dec_MegacoMessage'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute authHeader(1)   External megaco_ber_bin_media_gateway_control_prev3a:AuthenticationHeader OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_AuthenticationHeader'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute mess(2)   External megaco_ber_bin_media_gateway_control_prev3a:Message
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_Message'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'MegacoMessage', Term1, Term2}.



'dec-inc-MegacoMessage'(Tlv) ->
   'dec-inc-MegacoMessage'(Tlv, [16]).

'dec-inc-MegacoMessage'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute authHeader(1)   External megaco_ber_bin_media_gateway_control_prev3a:AuthenticationHeader OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {'dec_AuthenticationHeader'(V1, []), TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute mess(2)   External megaco_ber_bin_media_gateway_control_prev3a:Message
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec-inc-Message'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'MegacoMessage', Term1, Term2}.



'dec-inc-Transaction'(Tlv) ->
   'dec-inc-Transaction'(Tlv, []).

'dec-inc-Transaction'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'transactionRequest'
    {131072, V1} -> 
        {transactionRequest, 'dec-inc-TransactionRequest'(V1, [])};


%% 'transactionPending'
    {131073, V1} -> 
        {transactionPending, 'dec_TransactionPending'(V1, [])};


%% 'transactionReply'
    {131074, V1} -> 
        {transactionReply, 'dec-inc-TransactionReply'(V1, [])};


%% 'transactionResponseAck'
    {131075, V1} -> 
        {transactionResponseAck, 'dec_TransactionResponseAck'(V1, [])};

      Else -> 
         {asn1_ExtAlt, ?RT_BER:encode(Else)}
   end
.


'dec-inc-MegacoMessage_1'(Tlv) ->
   'dec-inc-MegacoMessage_1'(Tlv, [16]).

'dec-inc-MegacoMessage_1'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute authHeader(1)   External megaco_ber_bin_media_gateway_control_prev3a:AuthenticationHeader OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {{'MegacoMessage_authHeader',V1}, TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute mess(2)   External megaco_ber_bin_media_gateway_control_prev3a:Message
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec-inc-Message_1'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'MegacoMessage', Term1, Term2}.



'dec-inc-MegacoMessage_2'(Tlv) ->
   'dec-inc-MegacoMessage_2'(Tlv, [16]).

'dec-inc-MegacoMessage_2'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute authHeader(1)   External megaco_ber_bin_media_gateway_control_prev3a:AuthenticationHeader OPTIONAL
%%-------------------------------------------------
{Term1,Tlv2} = case Tlv1 of
[{131072,V1}|TempTlv2] ->
    {{'MegacoMessage_authHeader',V1}, TempTlv2};
    _ ->
        { asn1_NOVALUE, Tlv1}
end,

%%-------------------------------------------------
%% attribute mess(2)   External megaco_ber_bin_media_gateway_control_prev3a:Message
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec-inc-Message_2'(V2, [131073]),

case Tlv3 of
[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowed
end,
   {'MegacoMessage', Term1, Term2}.



'dec-inc-Message_2'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute version(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,99},[131072]),

%%-------------------------------------------------
%% attribute mId(2)   External megaco_ber_bin_media_gateway_control_prev3a:MId
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_MId'(V2, [131073]),

%%-------------------------------------------------
%% attribute messageBody(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = {'Message_messageBody',V3},

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'Message', Term1, Term2, Term3}.



'dec-inc-Message_1'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute version(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,99},[131072]),

%%-------------------------------------------------
%% attribute mId(2)   External megaco_ber_bin_media_gateway_control_prev3a:MId
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = {'Message_mId',V2},

%%-------------------------------------------------
%% attribute messageBody(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = {'Message_messageBody',V3},

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'Message', Term1, Term2, Term3}.



'dec-inc-TransactionReply'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute immAckRequired(2) with type NULL OPTIONAL
%%-------------------------------------------------
{Term2,Tlv3} = case Tlv2 of
[{131073,V2}|TempTlv3] ->
    {?RT_BER:decode_null(V2,[]), TempTlv3};
    _ ->
        { asn1_NOVALUE, Tlv2}
end,

%%-------------------------------------------------
%% attribute transactionResult(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec-inc-TransactionReply_transactionResult'(V3, [131074]),

%%-------------------------------------------------
%% attribute segmentNumber(4) with type INTEGER OPTIONAL
%%-------------------------------------------------
{Term4,Tlv5} = case Tlv4 of
[{131075,V4}|TempTlv5] ->
    {?RT_BER:decode_integer(V4,{0,65535},[]), TempTlv5};
    _ ->
        { asn1_NOVALUE, Tlv4}
end,

%%-------------------------------------------------
%% attribute segmentationComplete(5) with type NULL OPTIONAL
%%-------------------------------------------------
{Term5,Tlv6} = case Tlv5 of
[{131076,V5}|TempTlv6] ->
    {?RT_BER:decode_null(V5,[]), TempTlv6};
    _ ->
        { asn1_NOVALUE, Tlv5}
end,

case Tlv6 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TransactionReply', Term1, Term2, Term3, Term4, Term5}.



'dec-inc-TransactionReply_transactionResult'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'transactionError'
    {131072, V1} -> 
        {transactionError, 'dec_ErrorDescriptor'(V1, [])};


%% 'actionReplies'
    {131073, V1} -> 
        {actionReplies, {'TransactionReply_transactionResult_actionReplies',?RT_BER:match_tags(V1, [])}};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.


'dec-inc-TransactionRequest'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute transactionId(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,4294967295},[131072]),

%%-------------------------------------------------
%% attribute actions(2) with type SEQUENCE OF
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = {'TransactionRequest_actions',?RT_BER:match_tags(V2, [131073])},

case Tlv3 of [] -> true; _ -> true end, % ... extra fields skipped
   {'TransactionRequest', Term1, Term2}.



'dec-inc-Message'(Tlv, TagIn) ->
   %%-------------------------------------------------
   %% decode tag and length 
   %%-------------------------------------------------
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 

%%-------------------------------------------------
%% attribute version(1) with type INTEGER
%%-------------------------------------------------
[V1|Tlv2] = Tlv1, 
Term1 = ?RT_BER:decode_integer(V1,{0,99},[131072]),

%%-------------------------------------------------
%% attribute mId(2)   External megaco_ber_bin_media_gateway_control_prev3a:MId
%%-------------------------------------------------
[V2|Tlv3] = Tlv2, 
Term2 = 'dec_MId'(V2, [131073]),

%%-------------------------------------------------
%% attribute messageBody(3) with type CHOICE
%%-------------------------------------------------
[V3|Tlv4] = Tlv3, 
Term3 = 'dec-inc-Message_messageBody'(V3, [131074]),

case Tlv4 of [] -> true; _ -> true end, % ... extra fields skipped
   {'Message', Term1, Term2, Term3}.



'dec-inc-Message_messageBody'(Tlv, TagIn) ->
Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), 
case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of

%% 'messageError'
    {131072, V1} -> 
        {messageError, 'dec_ErrorDescriptor'(V1, [])};


%% 'transactions'
    {131073, V1} -> 
        {transactions, {'Message_messageBody_transactions',?RT_BER:match_tags(V1, [])}};

      Else -> 
         exit({error,{asn1,{invalid_choice_tag,Else}}})
   end
.
decode_message_trans_partial(Bytes) ->
  decode_partial_incomplete('MegacoMessage',Bytes,[mandatory,[[opt,131072],[mandatory,[mandatory,mandatory,[mandatory,[[alt,131072],[alt_parts,131073]]]]]]]).
decode_message_acts_partial(Bytes) ->
  decode_partial_incomplete('Transaction',Bytes,[[alt,131072,[mandatory,[parts,131073]]],[alt,131073],[alt,131074,[mandatory,[opt,131073],[mandatory,[[alt,131072],[alt_parts,131073]]]]]]).
decode_message_version(Bytes) ->
  decode_partial_incomplete('MegacoMessage_1',Bytes,[mandatory,[[opt_undec,131072],[mandatory,[mandatory,[undec,131073],[undec,131074]]]]]).
decode_message_mId(Bytes) ->
  decode_partial_incomplete('MegacoMessage_2',Bytes,[mandatory,[[opt_undec,131072],[mandatory,[mandatory,mandatory,[undec,131074]]]]]).
decode_inc_disp('Message_messageBody_transactions',Data) ->
  case Data of
    L when is_list(L) ->
      'dec_Message_messageBody_transactions'(lists:map(fun(X)->element(1,?RT_BER:decode(X)) end,L),[]);
    _ ->
      [Res] = 'dec_Message_messageBody_transactions'([Data],[]),
      Res
  end;
decode_inc_disp('TransactionRequest_actions',Data) ->
  case Data of
    L when is_list(L) ->
      'dec_TransactionRequest_actions'(lists:map(fun(X)->element(1,?RT_BER:decode(X)) end,L),[]);
    _ ->
      [Res] = 'dec_TransactionRequest_actions'([Data],[]),
      Res
  end;
decode_inc_disp('TransactionReply_transactionResult_actionReplies',Data) ->
  case Data of
    L when is_list(L) ->
      'dec_TransactionReply_transactionResult_actionReplies'(lists:map(fun(X)->element(1,?RT_BER:decode(X)) end,L),[]);
    _ ->
      [Res] = 'dec_TransactionReply_transactionResult_actionReplies'([Data],[]),
      Res
  end;
decode_inc_disp('Message_mId',Data) ->
  'dec_MId'(Data,[131073]);
decode_inc_disp('Message_messageBody',Data) ->
  'dec_Message_messageBody'(Data,[131074]);
decode_inc_disp('MegacoMessage_authHeader',Data) ->
  'dec_AuthenticationHeader'(Data,[]).
