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

-module('megaco_per_media_gateway_control_prev3a').
-compile(nowarn_unused_vars).
-include("megaco_per_media_gateway_control_prev3a.hrl").
-asn1_info([{vsn,'2.0.2'},
            {module,'megaco_per_media_gateway_control_prev3a'},
            {options,[warnings,per,errors,
 {cwd,"/net/isildur/ldisk/daily_build/r16b01_prebuild_opu_o.2013-06-17_20/otp_src_R16B01/lib/megaco/src/binary"},
 {outdir,"/net/isildur/ldisk/daily_build/r16b01_prebuild_opu_o.2013-06-17_20/otp_src_R16B01/lib/megaco/src/binary"},
 noobj,
 {i,"."},
 {i,"/net/isildur/ldisk/daily_build/r16b01_prebuild_opu_o.2013-06-17_20/otp_src_R16B01/lib/megaco/src/binary"}]}]).

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

-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([encode/2,decode/2]).

encoding_rule() -> per.

bit_string_format() -> bitstring.

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





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

   encode_length(length(Val)),
   'enc_Value_components'(Val, [])
].
'enc_Value_components'([], Acc) -> lists:reverse(Acc);

'enc_Value_components'([H|T], Acc) ->
'enc_Value_components'(T, [encode_octet_string(no, H) | Acc]).


'dec_Value'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_Value_components'(V1@V0, V1@Buf1, []).

'dec_Value_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_Value_components'(Num, Bytes, Acc) ->
   {Term,Remain} = begin
V2@Pad3 = bit_size(Bytes) band 7,
{V2@V0,V2@Buf1} = case Bytes of
<<_:V2@Pad3,0:1,V2@V5:7,V2@V7:V2@V5/binary-unit:8,V2@Buf8/bitstring>> ->
{V2@V7,V2@Buf8};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@V8:V2@V6/binary-unit:8,V2@Buf9/bitstring>> ->
{V2@V8,V2@Buf9};
<<_:V2@Pad3,1:1,1:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V8,V2@Buf9}  = decode_fragmented(V2@V6, V2@Buf7, 8),
{V2@V8,V2@Buf9}
end,
V2@Conv10 = binary_to_list(V2@V0),
{V2@Conv10,V2@Buf1}
end,
   'dec_Value_components'(Num-1, Remain, [Term|Acc]).
'enc_TimeNotation'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type IA5String
encode_known_multiplier_string(8, 8, {0,127,notab}, element(2,Val1)),

%% attribute number 2 with type IA5String
encode_known_multiplier_string(8, 8, {0,127,notab}, element(3,Val1))].


'dec_TimeNotation'(Bytes,_) ->

%% attribute number 1 with type IA5String
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:8/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end,

%% attribute number 2 with type IA5String
{Term2,Bytes2} = begin
<<V2@V0:8/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end,
{{'TimeNotation',Term1,Term2},Bytes2}.

'enc_H221NonStandard'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,255},256,{octets,1}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<255,Tmpval2>=0 ->
      [20,1,Tmpval2- 0];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,255},256,{octets,1}}]
  begin
  Tmpval3=element(3,Val1),
  case Tmpval3 of
    Tmpval4 when Tmpval4=<255,Tmpval4>=0 ->
      [20,1,Tmpval4- 0];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end,

%% attribute number 3 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,255},256,{octets,1}}]
  begin
  Tmpval5=element(4,Val1),
  case Tmpval5 of
    Tmpval6 when Tmpval6=<255,Tmpval6>=0 ->
      [20,1,Tmpval6- 0];
    Tmpval6 ->
      exit({error,{value_out_of_bounds,Tmpval6}})
  end

  end,

%% attribute number 4 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval7=element(5,Val1),
  case Tmpval7 of
    Tmpval8 when Tmpval8=<65535,Tmpval8>=0 ->
      [20,2,<<(Tmpval8- 0):16>>];
    Tmpval8 ->
      exit({error,{value_out_of_bounds,Tmpval8}})
  end

  end].


'dec_H221NonStandard'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:1/unsigned-unit:8,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = begin
<<V3@V0:1/unsigned-unit:8,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end,

%% attribute number 3 with type INTEGER
{Term3,Bytes4} = begin
<<V4@V0:1/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end,

%% attribute number 4 with type INTEGER
{Term4,Bytes5} = begin
<<V5@V0:2/unsigned-unit:8,V5@Buf1/bitstring>> = Bytes4,
{V5@V0,V5@Buf1}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V6@V0,V6@Buf1} = case Bytes5 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:7,0:1,V6@V7:7,V6@Buf8/bitstring>> when V6@V7 =/= 0 ->
{V6@V7,V6@Buf8};
<<_:7,1:1,0:1,V6@V8:14,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V10:V6@V0/bitstring-unit:1,V6@Buf11/bitstring>> = V6@Buf1,
{V6@V10,V6@Buf11}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'H221NonStandard',Term1,Term2,Term3,Term4},Bytes7}.

'enc_NonStandardIdentifier'(Val) ->
[
set_choice(element(1, Val), {[object,h221NonStandard,experimental],[]}, {3,0}),
case element(1,Val) of
object ->
encode_object_identifier(element(2, Val));
h221NonStandard ->
'enc_H221NonStandard'(element(2, Val));
experimental ->
encode_known_multiplier_string(8, 8, {0,127,notab}, element(2, Val))
end
].


'dec_NonStandardIdentifier'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1,
V2@Conv10 = binary_to_list(V2@V8),
{V2@V11,V2@Buf12}  = {decode_oid(V2@Conv10),V2@Buf9},
{V2@V11,V2@Buf12}
end
end,
{{object,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_H221NonStandard'(Bytes2,telltype)
end,
{{h221NonStandard,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:8/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end
end,
{{experimental,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_NonStandardData'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type Externaltypereference971megaco_per_media_gateway_control_prev3aNonStandardIdentifier
'enc_NonStandardIdentifier'(element(2,Val1)),

%% attribute number 2 with type OCTET STRING
encode_octet_string(no, element(3,Val1))].


'dec_NonStandardData'(Bytes,_) ->

%% attribute number 1 with type NonStandardIdentifier
{Term1,Bytes1} = 'dec_NonStandardIdentifier'(Bytes,telltype),

%% attribute number 2 with type OCTET STRING
{Term2,Bytes2} = begin
V1@Pad3 = bit_size(Bytes1) band 7,
{V1@V0,V1@Buf1} = case Bytes1 of
<<_:V1@Pad3,0:1,V1@V5:7,V1@V7:V1@V5/binary-unit:8,V1@Buf8/bitstring>> ->
{V1@V7,V1@Buf8};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@V8:V1@V6/binary-unit:8,V1@Buf9/bitstring>> ->
{V1@V8,V1@Buf9};
<<_:V1@Pad3,1:1,1:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V8,V1@Buf9}  = decode_fragmented(V1@V6, V1@Buf7, 8),
{V1@V8,V1@Buf9}
end,
V1@Conv10 = binary_to_list(V1@V0),
{V1@Conv10,V1@Buf1}
end,
{{'NonStandardData',Term1,Term2},Bytes2}.

'enc_StatisticsParameter'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference966megaco_per_media_gateway_control_prev3aValue
'enc_Value'(Tmpval2)
end].


'dec_StatisticsParameter'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:4/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv4 = binary_to_list(V2@V0),
{V2@Conv4,V2@Buf1}
end,

%% attribute number 2 with type Value
{Term2,Bytes3} = case Opt band 1 of
1 ->
'dec_Value'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'StatisticsParameter',Term1,Term2},Bytes3}.

'enc_StatisticsDescriptor'(Val) ->
[

   encode_length(length(Val)),
   'enc_StatisticsDescriptor_components'(Val, [])
].
'enc_StatisticsDescriptor_components'([], Acc) -> lists:reverse(Acc);

'enc_StatisticsDescriptor_components'([H|T], Acc) ->
'enc_StatisticsDescriptor_components'(T, ['enc_StatisticsParameter'(H)

 | Acc]).


'dec_StatisticsDescriptor'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_StatisticsDescriptor_components'(V1@V0, V1@Buf1, []).

'dec_StatisticsDescriptor_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_StatisticsDescriptor_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_StatisticsParameter'(Bytes,telltype),
   'dec_StatisticsDescriptor_components'(Num-1, Remain, [Term|Acc]).
'enc_PackagesItem'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  Tmpval2=element(3,Val1),
  case Tmpval2 of
    Tmpval3 when Tmpval3=<99,Tmpval3>=0 ->
      [10,7,Tmpval3- 0];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end].


'dec_PackagesItem'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
<<V2@V0:2/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = begin
<<V3@V0:7/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end,

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V4@V0,V4@Buf1} = case Bytes3 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'PackagesItem',Term1,Term2},Bytes5}.

'enc_PackagesDescriptor'(Val) ->
[

   encode_length(length(Val)),
   'enc_PackagesDescriptor_components'(Val, [])
].
'enc_PackagesDescriptor_components'([], Acc) -> lists:reverse(Acc);

'enc_PackagesDescriptor_components'([H|T], Acc) ->
'enc_PackagesDescriptor_components'(T, ['enc_PackagesItem'(H)

 | Acc]).


'dec_PackagesDescriptor'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_PackagesDescriptor_components'(V1@V0, V1@Buf1, []).

'dec_PackagesDescriptor_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_PackagesDescriptor_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PackagesItem'(Bytes,telltype),
   'dec_PackagesDescriptor_components'(Num-1, Remain, [Term|Acc]).
'enc_ServiceChangeProfile'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type IA5String
encode_known_multiplier_string({1,67}, 8, {0,127,notab}, element(2,Val1))].


'dec_ServiceChangeProfile'(Bytes,_) ->

%% attribute number 1 with type IA5String
{Term1,Bytes1} = begin
<<V1@V0:7/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/binary-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
V1@Conv7 = binary_to_list(V1@V3),
{V1@Conv7,V1@Buf4}
end,
{{'ServiceChangeProfile',Term1},Bytes1}.

'enc_ServiceChangeMethod'(Val) ->
case Val of
'failover' -> [0,10,3,0];
'forced' -> [0,10,3,1];
'graceful' -> [0,10,3,2];
'restart' -> [0,10,3,3];
'disconnected' -> [0,10,3,4];
'handOff' -> [0,10,3,5];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_ServiceChangeMethod'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:3/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> failover;
1 -> forced;
2 -> graceful;
3 -> restart;
4 -> disconnected;
5 -> handOff;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[failover,forced,graceful,restart,disconnected,handOff]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_ServiceChangeResParm'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt4 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt5 = case element(6,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3,Fixopt4,Fixopt5]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aMId
'enc_MId'(Tmpval1)
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aServiceChangeAddress
'enc_ServiceChangeAddress'(Tmpval2)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval3 of
    Tmpval4 when Tmpval4=<99,Tmpval4>=0 ->
      [10,7,Tmpval4- 0];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end
end,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereference930megaco_per_media_gateway_control_prev3aServiceChangeProfile
'enc_ServiceChangeProfile'(Tmpval5)
end,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type Externaltypereference931megaco_per_media_gateway_control_prev3aTimeNotation
'enc_TimeNotation'(Tmpval6)
end].


'dec_ServiceChangeResParm'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:5,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type MId
{Term1,Bytes3} = case (Opt bsr 4) band 1 of
1 ->
'dec_MId'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type ServiceChangeAddress
{Term2,Bytes4} = case (Opt bsr 3) band 1 of
1 ->
'dec_ServiceChangeAddress'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case (Opt bsr 2) band 1 of
1 ->
begin
<<V3@V0:7/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes4,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type ServiceChangeProfile
{Term4,Bytes6} = case (Opt bsr 1) band 1 of
1 ->
'dec_ServiceChangeProfile'(Bytes5,telltype);
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% attribute number 5 with type TimeNotation
{Term5,Bytes7} = case Opt band 1 of
1 ->
'dec_TimeNotation'(Bytes6,telltype);
0 ->
{asn1_NOVALUE,Bytes6}
end,

%% Extensions
{Extensions,Bytes8} = case Ext of
0 -> {<<>>,Bytes7};
1 ->
{V4@V0,V4@Buf1} = case Bytes7 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes9= skipextensions(Bytes8, 1, Extensions),
{{'ServiceChangeResParm',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_ServiceChangeAddress'(Val) ->
[
set_choice(element(1, Val), {[portNumber,ip4Address,ip6Address,domainName,deviceName,mtpAddress],[]}, {6,0}),
case element(1,Val) of
portNumber ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
 case element(2, Val) of 
    Tmpval1 when Tmpval1=<65535,Tmpval1>=0 ->
      [20,2,<<(Tmpval1- 0):16>>];
    Tmpval1 ->
      exit({error,{value_out_of_bounds,Tmpval1}})
  end
;
ip4Address ->
'enc_IP4Address'(element(2, Val));
ip6Address ->
'enc_IP6Address'(element(2, Val));
domainName ->
'enc_DomainName'(element(2, Val));
deviceName ->
encode_known_multiplier_string({1,64}, 8, {0,127,notab}, element(2, Val));
mtpAddress ->
encode_octet_string({2,4}, element(2, Val))
end
].


'dec_ServiceChangeAddress'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
V2@Pad2 = bit_size(Bytes2) band 7,
<<_:V2@Pad2,V2@V0:2/unsigned-unit:8,V2@Buf1/bitstring>> = Bytes2,
{V2@V0,V2@Buf1}
end
end,
{{portNumber,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_IP4Address'(Bytes2,telltype)
end,
{{ip4Address,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_IP6Address'(Bytes2,telltype)
end,
{{ip6Address,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_DomainName'(Bytes2,telltype)
end,
{{domainName,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
begin
<<V3@V0:6/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/binary-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
V3@Conv7 = binary_to_list(V3@V3),
{V3@Conv7,V3@Buf4}
end
end,
{{deviceName,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
begin
<<V4@V0:2/unsigned-unit:1,V4@Buf1/bitstring>> = Bytes2,
V4@Add2 = V4@V0 + 2,
V4@Pad5 = bit_size(V4@Buf1) band 7,
<<_:V4@Pad5,V4@V3:V4@Add2/binary-unit:8,V4@Buf4/bitstring>> = V4@Buf1,
V4@Conv7 = binary_to_list(V4@V3),
{V4@Conv7,V4@Buf4}
end
end,
{{mtpAddress,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_ServiceChangeParm'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt4 = case element(7,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt5 = case element(8,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt6 = case element(9,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt7 = case element(10,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3,Fixopt4,Fixopt5,Fixopt6,Fixopt7]},
Extensions = fixextensions({ext,10,2}, Val1),
[
setext(Extensions =/= []), Opt,

%% attribute number 1 with type ENUMERATED
case element(2,Val1) of
'failover' -> [0,10,3,0];
'forced' -> [0,10,3,1];
'graceful' -> [0,10,3,2];
'restart' -> [0,10,3,3];
'disconnected' -> [0,10,3,4];
'handOff' -> [0,10,3,5];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference890megaco_per_media_gateway_control_prev3aServiceChangeAddress
'enc_ServiceChangeAddress'(Tmpval2)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval3 of
    Tmpval4 when Tmpval4=<99,Tmpval4>=0 ->
      [10,7,Tmpval4- 0];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end
end,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereference892megaco_per_media_gateway_control_prev3aServiceChangeProfile
'enc_ServiceChangeProfile'(Tmpval5)
end,

%% attribute number 5 with type Externaltypereference893megaco_per_media_gateway_control_prev3aValue
'enc_Value'(element(6,Val1)),
case element(7,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 6 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval6)
end,
case element(8,Val1) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 7 with type Externaltypereference906megaco_per_media_gateway_control_prev3aMId
'enc_MId'(Tmpval7)
end,
case element(9,Val1) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 8 with type Externaltypereference907megaco_per_media_gateway_control_prev3aTimeNotation
'enc_TimeNotation'(Tmpval8)
end,
case element(10,Val1) of
asn1_NOVALUE -> [];
Tmpval9 ->

%% attribute number 9 with type Externaltypereference908megaco_per_media_gateway_control_prev3aNonStandardData
'enc_NonStandardData'(Tmpval9)
end
,Extensions
,
case element(11,Val1) of
asn1_NOVALUE -> [];
Tmpval10 ->

%% attribute number 10 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aAuditDescriptor
encode_open_type(complete('enc_AuditDescriptor'(Tmpval10)))
end,
case element(12,Val1) of
asn1_NOVALUE -> [];
Tmpval11 ->

%% attribute number 11 with type NULL
encode_open_type(complete([]))
end].


'dec_ServiceChangeParm'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:7,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = begin
{V3@V0,V3@Buf1} = case Bytes2 of
<<0:1,V3@V3:3/unsigned-unit:1,V3@Buf4/bitstring>> ->
V3@Int5 = case V3@V3 of
0 -> failover;
1 -> forced;
2 -> graceful;
3 -> restart;
4 -> disconnected;
5 -> handOff;
_ -> exit({error,{asn1,{decode_enumerated,{V3@V3,[failover,forced,graceful,restart,disconnected,handOff]}}}})
end,
{V3@Int5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<0:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V6,V3@Buf7};
<<1:1,V3@Buf5/bitstring>> ->
V3@Pad9 = bit_size(V3@Buf5) band 7,
{V3@V6,V3@Buf7} = case V3@Buf5 of
<<_:V3@Pad9,0:1,V3@V11:7,V3@Buf12/bitstring>> when V3@V11 =/= 0 ->
{V3@V11,V3@Buf12};
<<_:V3@Pad9,1:1,0:1,V3@V12:14,V3@Buf13/bitstring>> when V3@V12 =/= 0 ->
{V3@V12,V3@Buf13}
end,
<<V3@V14:V3@V6/unit:8,V3@Buf15/bitstring>> = V3@Buf7,
{V3@V14,V3@Buf15}
end,
V3@Int16 = case V3@V3 of
_ -> {asn1_enum,V3@V3}
end,
{V3@Int16,V3@Buf4}
end,
{V3@V0,V3@Buf1}
end,

%% attribute number 2 with type ServiceChangeAddress
{Term2,Bytes4} = case (Opt bsr 6) band 1 of
1 ->
'dec_ServiceChangeAddress'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case (Opt bsr 5) band 1 of
1 ->
begin
<<V4@V0:7/unsigned-unit:1,V4@Buf1/bitstring>> = Bytes4,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type ServiceChangeProfile
{Term4,Bytes6} = case (Opt bsr 4) band 1 of
1 ->
'dec_ServiceChangeProfile'(Bytes5,telltype);
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% attribute number 5 with type Value
{Term5,Bytes7} = 'dec_Value'(Bytes6,telltype),

%% attribute number 6 with type INTEGER
{Term6,Bytes8} = case (Opt bsr 3) band 1 of
1 ->
begin
<<V5@V0:2/unsigned-unit:1,V5@Buf1/bitstring>> = Bytes7,
V5@Add2 = V5@V0 + 1,
V5@Pad5 = bit_size(V5@Buf1) band 7,
<<_:V5@Pad5,V5@V3:V5@Add2/unsigned-unit:8,V5@Buf4/bitstring>> = V5@Buf1,
{V5@V3,V5@Buf4}
end;
0 ->
{asn1_NOVALUE,Bytes7}
end,

%% attribute number 7 with type MId
{Term7,Bytes9} = case (Opt bsr 2) band 1 of
1 ->
'dec_MId'(Bytes8,telltype);
0 ->
{asn1_NOVALUE,Bytes8}
end,

%% attribute number 8 with type TimeNotation
{Term8,Bytes10} = case (Opt bsr 1) band 1 of
1 ->
'dec_TimeNotation'(Bytes9,telltype);
0 ->
{asn1_NOVALUE,Bytes9}
end,

%% attribute number 9 with type NonStandardData
{Term9,Bytes11} = case Opt band 1 of
1 ->
'dec_NonStandardData'(Bytes10,telltype);
0 ->
{asn1_NOVALUE,Bytes10}
end,

%% Extensions
{Extensions,Bytes12} = case Ext of
0 -> {<<>>,Bytes11};
1 ->
{V6@V0,V6@Buf1} = case Bytes11 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
V6@Pad6 = bit_size(V6@Buf2) band 7,
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:V6@Pad6,0:1,V6@V8:7,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9};
<<_:V6@Pad6,1:1,0:1,V6@V9:14,V6@Buf10/bitstring>> when V6@V9 =/= 0 ->
{V6@V9,V6@Buf10}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V11:V6@V0/bitstring-unit:1,V6@Buf12/bitstring>> = V6@Buf1,
{V6@V11,V6@Buf12}
end,

%% attribute number 10 with type AuditDescriptor
{Term10,Bytes13} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V7@Pad3 = bit_size(Bytes12) band 7,
{V7@V0,V7@Buf1} = case Bytes12 of
<<_:V7@Pad3,0:1,V7@V5:7,V7@Buf6/bitstring>> ->
{V7@V5,V7@Buf6};
<<_:V7@Pad3,1:1,0:1,V7@V6:14,V7@Buf7/bitstring>> ->
{V7@V6,V7@Buf7}
end,
<<V7@V8:V7@V0/binary-unit:8,V7@Buf9/bitstring>> = V7@Buf1,
{TmpValx10,_} = 'dec_AuditDescriptor'(V7@V8,telltype),
{TmpValx10,V7@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes12}
end,

%% attribute number 11 with type NULL
{Term11,Bytes14} = case Extensions of
  <<_:1,1:1,_/bitstring>> ->
begin
V8@Pad3 = bit_size(Bytes13) band 7,
{V8@V0,V8@Buf1} = case Bytes13 of
<<_:V8@Pad3,0:1,V8@V5:7,V8@Buf6/bitstring>> ->
{V8@V5,V8@Buf6};
<<_:V8@Pad3,1:1,0:1,V8@V6:14,V8@Buf7/bitstring>> ->
{V8@V6,V8@Buf7}
end,
<<V8@V8:V8@V0/binary-unit:8,V8@Buf9/bitstring>> = V8@Buf1,
{TmpValx11,_} = begin
ignore,
{'NULL',V8@V8}
end,
{TmpValx11,V8@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes13}
end,
Bytes15= skipextensions(Bytes14, 3, Extensions),
{{'ServiceChangeParm',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9,Term10,Term11},Bytes15}.

'enc_DigitMapValue'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
Extensions = fixextensions({ext,5,1}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<99,Tmpval3>=0 ->
      [10,7,Tmpval3- 0];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval4 of
    Tmpval5 when Tmpval5=<99,Tmpval5>=0 ->
      [10,7,Tmpval5- 0];
    Tmpval5 ->
      exit({error,{value_out_of_bounds,Tmpval5}})
  end

  end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 3 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval6 of
    Tmpval7 when Tmpval7=<99,Tmpval7>=0 ->
      [10,7,Tmpval7- 0];
    Tmpval7 ->
      exit({error,{value_out_of_bounds,Tmpval7}})
  end

  end
end,

%% attribute number 4 with type IA5String
encode_known_multiplier_string(no, 8, {0,127,notab}, element(5,Val1))
,Extensions
,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 5 with type INTEGER
encode_open_type(complete(  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  case Tmpval8 of
    Tmpval9 when Tmpval9=<99,Tmpval9>=0 ->
      [10,7,Tmpval9- 0];
    Tmpval9 ->
      exit({error,{value_out_of_bounds,Tmpval9}})
  end

  end))
end].


'dec_DigitMapValue'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
begin
<<V3@V0:7/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
<<V4@V0:7/unsigned-unit:1,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
<<V5@V0:7/unsigned-unit:1,V5@Buf1/bitstring>> = Bytes4,
{V5@V0,V5@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type IA5String
{Term4,Bytes6} = begin
V6@Pad3 = bit_size(Bytes5) band 7,
{V6@V0,V6@Buf1} = case Bytes5 of
<<_:V6@Pad3,0:1,V6@V5:7,V6@V7:V6@V5/binary-unit:8,V6@Buf8/bitstring>> ->
{V6@V7,V6@Buf8};
<<_:V6@Pad3,1:1,0:1,V6@V6:14,V6@V8:V6@V6/binary-unit:8,V6@Buf9/bitstring>> ->
{V6@V8,V6@Buf9};
<<_:V6@Pad3,1:1,1:1,V6@V6:6,V6@Buf7/bitstring>> ->
{V6@V8,V6@Buf9}  = decode_fragmented(V6@V6, V6@Buf7, 8),
{V6@V8,V6@Buf9}
end,
V6@Conv10 = binary_to_list(V6@V0),
{V6@Conv10,V6@Buf1}
end,

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V7@V0,V7@Buf1} = case Bytes6 of
<<0:1,V7@V3:6,V7@Buf4/bitstring>> ->
V7@Add5 = V7@V3 + 1,
{V7@Add5,V7@Buf4};
<<1:1,V7@Buf2/bitstring>> ->
{V7@V3,V7@Buf4} = case V7@Buf2 of
<<_:7,0:1,V7@V7:7,V7@Buf8/bitstring>> when V7@V7 =/= 0 ->
{V7@V7,V7@Buf8};
<<_:7,1:1,0:1,V7@V8:14,V7@Buf9/bitstring>> when V7@V8 =/= 0 ->
{V7@V8,V7@Buf9}
end,
{V7@V3,V7@Buf4}
end,
<<V7@V10:V7@V0/bitstring-unit:1,V7@Buf11/bitstring>> = V7@Buf1,
{V7@V10,V7@Buf11}
end,

%% attribute number 5 with type INTEGER
{Term5,Bytes8} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V8@Pad3 = bit_size(Bytes7) band 7,
{V8@V0,V8@Buf1} = case Bytes7 of
<<_:V8@Pad3,0:1,V8@V5:7,V8@Buf6/bitstring>> ->
{V8@V5,V8@Buf6};
<<_:V8@Pad3,1:1,0:1,V8@V6:14,V8@Buf7/bitstring>> ->
{V8@V6,V8@Buf7}
end,
<<V8@V8:V8@V0/binary-unit:8,V8@Buf9/bitstring>> = V8@Buf1,
{TmpValx5,_} = begin
<<V9@V0:7/unsigned-unit:1,V9@Buf1/bitstring>> = V8@V8,
{V9@V0,V9@Buf1}
end,
{TmpValx5,V8@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes7}
end,
Bytes9= skipextensions(Bytes8, 2, Extensions),
{{'DigitMapValue',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_DigitMapName'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_DigitMapName'(Bytes,_) ->
begin
<<V1@V0:2/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv2 = binary_to_list(V1@V0),
{V1@Conv2,V1@Buf1}
end.

'enc_DigitMapDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval2 = Tmpval1,
    case length(Tmpval2) of
      2 ->
        [[45,16,2]|Tmpval2];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval2}})
    end
  end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereference867megaco_per_media_gateway_control_prev3aDigitMapValue
'enc_DigitMapValue'(Tmpval3)
end].


'dec_DigitMapDescriptor'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:2,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = case (Opt bsr 1) band 1 of
1 ->
begin
<<V2@V0:2/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes1}
end,

%% attribute number 2 with type DigitMapValue
{Term2,Bytes3} = case Opt band 1 of
1 ->
'dec_DigitMapValue'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'DigitMapDescriptor',Term1,Term2},Bytes3}.

'enc_ModemType'(Val) ->
case Val of
'v18' -> [0,10,4,0];
'v22' -> [0,10,4,1];
'v22bis' -> [0,10,4,2];
'v32' -> [0,10,4,3];
'v32bis' -> [0,10,4,4];
'v34' -> [0,10,4,5];
'v90' -> [0,10,4,6];
'v91' -> [0,10,4,7];
'synchISDN' -> [0,10,4,8];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_ModemType'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:4/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> v18;
1 -> v22;
2 -> v22bis;
3 -> v32;
4 -> v32bis;
5 -> v34;
6 -> v90;
7 -> v91;
8 -> synchISDN;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[v18,v22,v22bis,v32,v32bis,v34,v90,v91,synchISDN]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_ModemDescriptor'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_ModemDescriptor_mtl'(element(2,Val1)),

%% attribute number 2 with type SEQUENCE OF
'enc_ModemDescriptor_mpl'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type Externaltypereference847megaco_per_media_gateway_control_prev3aNonStandardData
'enc_NonStandardData'(Tmpval1)
end].
'enc_ModemDescriptor_mtl'(Val) ->
[

   encode_length(length(Val)),
   'enc_ModemDescriptor_mtl_components'(Val, [])
].
'enc_ModemDescriptor_mtl_components'([], Acc) -> lists:reverse(Acc);

'enc_ModemDescriptor_mtl_components'([H|T], Acc) ->
'enc_ModemDescriptor_mtl_components'(T, [case H of
'v18' -> [0,10,4,0];
'v22' -> [0,10,4,1];
'v22bis' -> [0,10,4,2];
'v32' -> [0,10,4,3];
'v32bis' -> [0,10,4,4];
'v34' -> [0,10,4,5];
'v90' -> [0,10,4,6];
'v91' -> [0,10,4,7];
'synchISDN' -> [0,10,4,8];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end | Acc]).

'dec_ModemDescriptor_mtl'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ModemDescriptor_mtl_components'(V1@V0, V1@Buf1, []).

'dec_ModemDescriptor_mtl_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ModemDescriptor_mtl_components'(Num, Bytes, Acc) ->
   {Term,Remain} = begin
{V2@V0,V2@Buf1} = case Bytes of
<<0:1,V2@V3:4/unsigned-unit:1,V2@Buf4/bitstring>> ->
V2@Int5 = case V2@V3 of
0 -> v18;
1 -> v22;
2 -> v22bis;
3 -> v32;
4 -> v32bis;
5 -> v34;
6 -> v90;
7 -> v91;
8 -> synchISDN;
_ -> exit({error,{asn1,{decode_enumerated,{V2@V3,[v18,v22,v22bis,v32,v32bis,v34,v90,v91,synchISDN]}}}})
end,
{V2@Int5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<0:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7};
<<1:1,V2@Buf5/bitstring>> ->
V2@Pad9 = bit_size(V2@Buf5) band 7,
{V2@V6,V2@Buf7} = case V2@Buf5 of
<<_:V2@Pad9,0:1,V2@V11:7,V2@Buf12/bitstring>> when V2@V11 =/= 0 ->
{V2@V11,V2@Buf12};
<<_:V2@Pad9,1:1,0:1,V2@V12:14,V2@Buf13/bitstring>> when V2@V12 =/= 0 ->
{V2@V12,V2@Buf13}
end,
<<V2@V14:V2@V6/unit:8,V2@Buf15/bitstring>> = V2@Buf7,
{V2@V14,V2@Buf15}
end,
V2@Int16 = case V2@V3 of
_ -> {asn1_enum,V2@V3}
end,
{V2@Int16,V2@Buf4}
end,
{V2@V0,V2@Buf1}
end,
   'dec_ModemDescriptor_mtl_components'(Num-1, Remain, [Term|Acc]).
'enc_ModemDescriptor_mpl'(Val) ->
[

   encode_length(length(Val)),
   'enc_ModemDescriptor_mpl_components'(Val, [])
].
'enc_ModemDescriptor_mpl_components'([], Acc) -> lists:reverse(Acc);

'enc_ModemDescriptor_mpl_components'([H|T], Acc) ->
'enc_ModemDescriptor_mpl_components'(T, ['enc_PropertyParm'(H)

 | Acc]).

'dec_ModemDescriptor_mpl'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ModemDescriptor_mpl_components'(V1@V0, V1@Buf1, []).

'dec_ModemDescriptor_mpl_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ModemDescriptor_mpl_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyParm'(Bytes,telltype),
   'dec_ModemDescriptor_mpl_components'(Num-1, Remain, [Term|Acc]).


'dec_ModemDescriptor'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes2} = 'dec_ModemDescriptor_mtl'(Bytes1, telltype),

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes3} = 'dec_ModemDescriptor_mpl'(Bytes2, telltype),

%% attribute number 3 with type NonStandardData
{Term3,Bytes4} = case Opt band 1 of
1 ->
'dec_NonStandardData'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,
{{'ModemDescriptor',Term1,Term2,Term3},Bytes4}.

'enc_RequestID'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Val).


'dec_RequestID'(Bytes,_) ->
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/unsigned-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
{V1@V3,V1@Buf4}
end.

'enc_SigParameter'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type Externaltypereference827megaco_per_media_gateway_control_prev3aValue
'enc_Value'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type CHOICE
'enc_SigParameter_extraInfo'(Tmpval2)
end].
'enc_SigParameter_extraInfo'(Val) ->
[
set_choice(element(1, Val), [relation,range,sublist], 3),
case element(1,Val) of
relation ->
case element(2, Val) of
'greaterThan' -> [0,10,2,0];
'smallerThan' -> [0,10,2,1];
'unequalTo' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end;
range ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end;
sublist ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end
end
].

'dec_SigParameter_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
{V2@V0,V2@Buf1} = case Bytes1 of
<<0:1,V2@V3:2/unsigned-unit:1,V2@Buf4/bitstring>> ->
V2@Int5 = case V2@V3 of
0 -> greaterThan;
1 -> smallerThan;
2 -> unequalTo;
_ -> exit({error,{asn1,{decode_enumerated,{V2@V3,[greaterThan,smallerThan,unequalTo]}}}})
end,
{V2@Int5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<0:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7};
<<1:1,V2@Buf5/bitstring>> ->
V2@Pad9 = bit_size(V2@Buf5) band 7,
{V2@V6,V2@Buf7} = case V2@Buf5 of
<<_:V2@Pad9,0:1,V2@V11:7,V2@Buf12/bitstring>> when V2@V11 =/= 0 ->
{V2@V11,V2@Buf12};
<<_:V2@Pad9,1:1,0:1,V2@V12:14,V2@Buf13/bitstring>> when V2@V12 =/= 0 ->
{V2@V12,V2@Buf13}
end,
<<V2@V14:V2@V6/unit:8,V2@Buf15/bitstring>> = V2@Buf7,
{V2@V14,V2@Buf15}
end,
V2@Int16 = case V2@V3 of
_ -> {asn1_enum,V2@V3}
end,
{V2@Int16,V2@Buf4}
end,
{V2@V0,V2@Buf1}
end
end,
{{relation,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
begin
<<V3@V0:1,V3@Buf1/bitstring>> = Bytes1,
V3@Int2 = case V3@V0 of
0 -> false;
1 -> true
end,
{V3@Int2,V3@Buf1}
end
end,
{{range,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
begin
<<V4@V0:1,V4@Buf1/bitstring>> = Bytes1,
V4@Int2 = case V4@V0 of
0 -> false;
1 -> true
end,
{V4@Int2,V4@Buf1}
end
end,
{{sublist,Val},NewBytes}
end.


'dec_SigParameter'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
<<V3@V0:2/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv2 = binary_to_list(V3@V0),
{V3@Conv2,V3@Buf1}
end,

%% attribute number 2 with type Value
{Term2,Bytes4} = 'dec_Value'(Bytes3,telltype),

%% attribute number 3 with type CHOICE
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_SigParameter_extraInfo'(Bytes4, telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V4@V0,V4@Buf1} = case Bytes5 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'SigParameter',Term1,Term2,Term3},Bytes7}.

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


'dec_NotifyCompletion'(Bytes,_) ->
begin
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@V7:V1@V5/binary-unit:1,V1@Buf8/bitstring>> ->
{V1@V7,V1@Buf8};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@V8:V1@V6/binary-unit:1,V1@Buf9/bitstring>> ->
{V1@V8,V1@Buf9};
<<_:V1@Pad3,1:1,1:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V8,V1@Buf9}  = decode_fragmented(V1@V6, V1@Buf7, 1),
{V1@V8,V1@Buf9}
end,
{V1@V10,V1@Buf11}  = {decode_named_bit_string(V1@V0, [{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}]),V1@Buf1},
{V1@V10,V1@Buf11}
end.

'enc_SignalName'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_SignalName'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end.

'enc_SignalDirection'(Val) ->
case Val of
'internal' -> [0,10,2,0];
'external' -> [0,10,2,1];
'both' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_SignalDirection'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:2/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> internal;
1 -> external;
2 -> both;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[internal,external,both]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_SignalType'(Val) ->
case Val of
'brief' -> [0,10,2,0];
'onOff' -> [0,10,2,1];
'timeOut' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_SignalType'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:2/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> brief;
1 -> onOff;
2 -> timeOut;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[brief,onOff,timeOut]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_Signal'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt4 = case element(6,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt5 = case element(7,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3,Fixopt4,Fixopt5]},
Extensions = fixextensions({ext,8,2}, Val1),
[
setext(Extensions =/= []), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval2 = element(2,Val1),
    case length(Tmpval2) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval2];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval2}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval3 of
    Tmpval4 when Tmpval4=<65535,Tmpval4>=0 ->
      [20,2,<<(Tmpval4- 0):16>>];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 3 with type ENUMERATED
case Tmpval5 of
'brief' -> [0,10,2,0];
'onOff' -> [0,10,2,1];
'timeOut' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end
end,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 4 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval6 of
    Tmpval7 when Tmpval7=<65535,Tmpval7>=0 ->
      [20,2,<<(Tmpval7- 0):16>>];
    Tmpval7 ->
      exit({error,{value_out_of_bounds,Tmpval7}})
  end

  end
end,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 5 with type BIT STRING
encode_bit_string(no, Tmpval8, [{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}])
end,
case element(7,Val1) of
asn1_NOVALUE -> [];
Tmpval9 ->

%% attribute number 6 with type BOOLEAN
case Tmpval9 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval9}}})
end
end,

%% attribute number 7 with type SEQUENCE OF
'enc_Signal_sigParList'(element(8,Val1))
,Extensions
,
case element(9,Val1) of
asn1_NOVALUE -> [];
Tmpval10 ->

%% attribute number 8 with type ENUMERATED
encode_open_type(complete(case Tmpval10 of
'internal' -> [0,10,2,0];
'external' -> [0,10,2,1];
'both' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end))
end,
case element(10,Val1) of
asn1_NOVALUE -> [];
Tmpval11 ->

%% attribute number 9 with type INTEGER
encode_open_type(complete(  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval11)))
end].
'enc_Signal_sigParList'(Val) ->
[

   encode_length(length(Val)),
   'enc_Signal_sigParList_components'(Val, [])
].
'enc_Signal_sigParList_components'([], Acc) -> lists:reverse(Acc);

'enc_Signal_sigParList_components'([H|T], Acc) ->
'enc_Signal_sigParList_components'(T, ['enc_SigParameter'(H)

 | Acc]).

'dec_Signal_sigParList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_Signal_sigParList_components'(V1@V0, V1@Buf1, []).

'dec_Signal_sigParList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_Signal_sigParList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_SigParameter'(Bytes,telltype),
   'dec_Signal_sigParList_components'(Num-1, Remain, [Term|Acc]).


'dec_Signal'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:5,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case (Opt bsr 4) band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type ENUMERATED
{Term3,Bytes5} = case (Opt bsr 3) band 1 of
1 ->
begin
{V5@V0,V5@Buf1} = case Bytes4 of
<<0:1,V5@V3:2/unsigned-unit:1,V5@Buf4/bitstring>> ->
V5@Int5 = case V5@V3 of
0 -> brief;
1 -> onOff;
2 -> timeOut;
_ -> exit({error,{asn1,{decode_enumerated,{V5@V3,[brief,onOff,timeOut]}}}})
end,
{V5@Int5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<0:1,V5@V6:6,V5@Buf7/bitstring>> ->
{V5@V6,V5@Buf7};
<<1:1,V5@Buf5/bitstring>> ->
V5@Pad9 = bit_size(V5@Buf5) band 7,
{V5@V6,V5@Buf7} = case V5@Buf5 of
<<_:V5@Pad9,0:1,V5@V11:7,V5@Buf12/bitstring>> when V5@V11 =/= 0 ->
{V5@V11,V5@Buf12};
<<_:V5@Pad9,1:1,0:1,V5@V12:14,V5@Buf13/bitstring>> when V5@V12 =/= 0 ->
{V5@V12,V5@Buf13}
end,
<<V5@V14:V5@V6/unit:8,V5@Buf15/bitstring>> = V5@Buf7,
{V5@V14,V5@Buf15}
end,
V5@Int16 = case V5@V3 of
_ -> {asn1_enum,V5@V3}
end,
{V5@Int16,V5@Buf4}
end,
{V5@V0,V5@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type INTEGER
{Term4,Bytes6} = case (Opt bsr 2) band 1 of
1 ->
begin
V6@Pad2 = bit_size(Bytes5) band 7,
<<_:V6@Pad2,V6@V0:2/unsigned-unit:8,V6@Buf1/bitstring>> = Bytes5,
{V6@V0,V6@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% attribute number 5 with type BIT STRING
{Term5,Bytes7} = case (Opt bsr 1) band 1 of
1 ->
begin
V7@Pad3 = bit_size(Bytes6) band 7,
{V7@V0,V7@Buf1} = case Bytes6 of
<<_:V7@Pad3,0:1,V7@V5:7,V7@V7:V7@V5/binary-unit:1,V7@Buf8/bitstring>> ->
{V7@V7,V7@Buf8};
<<_:V7@Pad3,1:1,0:1,V7@V6:14,V7@V8:V7@V6/binary-unit:1,V7@Buf9/bitstring>> ->
{V7@V8,V7@Buf9};
<<_:V7@Pad3,1:1,1:1,V7@V6:6,V7@Buf7/bitstring>> ->
{V7@V8,V7@Buf9}  = decode_fragmented(V7@V6, V7@Buf7, 1),
{V7@V8,V7@Buf9}
end,
{V7@V10,V7@Buf11}  = {decode_named_bit_string(V7@V0, [{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3}]),V7@Buf1},
{V7@V10,V7@Buf11}
end;
0 ->
{asn1_NOVALUE,Bytes6}
end,

%% attribute number 6 with type BOOLEAN
{Term6,Bytes8} = case Opt band 1 of
1 ->
begin
<<V8@V0:1,V8@Buf1/bitstring>> = Bytes7,
V8@Int2 = case V8@V0 of
0 -> false;
1 -> true
end,
{V8@Int2,V8@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes7}
end,

%% attribute number 7 with type SEQUENCE OF
{Term7,Bytes9} = 'dec_Signal_sigParList'(Bytes8, telltype),

%% Extensions
{Extensions,Bytes10} = case Ext of
0 -> {<<>>,Bytes9};
1 ->
{V9@V0,V9@Buf1} = case Bytes9 of
<<0:1,V9@V3:6,V9@Buf4/bitstring>> ->
V9@Add5 = V9@V3 + 1,
{V9@Add5,V9@Buf4};
<<1:1,V9@Buf2/bitstring>> ->
V9@Pad6 = bit_size(V9@Buf2) band 7,
{V9@V3,V9@Buf4} = case V9@Buf2 of
<<_:V9@Pad6,0:1,V9@V8:7,V9@Buf9/bitstring>> when V9@V8 =/= 0 ->
{V9@V8,V9@Buf9};
<<_:V9@Pad6,1:1,0:1,V9@V9:14,V9@Buf10/bitstring>> when V9@V9 =/= 0 ->
{V9@V9,V9@Buf10}
end,
{V9@V3,V9@Buf4}
end,
<<V9@V11:V9@V0/bitstring-unit:1,V9@Buf12/bitstring>> = V9@Buf1,
{V9@V11,V9@Buf12}
end,

%% attribute number 8 with type ENUMERATED
{Term8,Bytes11} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V10@Pad3 = bit_size(Bytes10) band 7,
{V10@V0,V10@Buf1} = case Bytes10 of
<<_:V10@Pad3,0:1,V10@V5:7,V10@Buf6/bitstring>> ->
{V10@V5,V10@Buf6};
<<_:V10@Pad3,1:1,0:1,V10@V6:14,V10@Buf7/bitstring>> ->
{V10@V6,V10@Buf7}
end,
<<V10@V8:V10@V0/binary-unit:8,V10@Buf9/bitstring>> = V10@Buf1,
{TmpValx8,_} = begin
{V11@V0,V11@Buf1} = case V10@V8 of
<<0:1,V11@V3:2/unsigned-unit:1,V11@Buf4/bitstring>> ->
V11@Int5 = case V11@V3 of
0 -> internal;
1 -> external;
2 -> both;
_ -> exit({error,{asn1,{decode_enumerated,{V11@V3,[internal,external,both]}}}})
end,
{V11@Int5,V11@Buf4};
<<1:1,V11@Buf2/bitstring>> ->
{V11@V3,V11@Buf4} = case V11@Buf2 of
<<0:1,V11@V6:6,V11@Buf7/bitstring>> ->
{V11@V6,V11@Buf7};
<<1:1,V11@Buf5/bitstring>> ->
V11@Pad9 = bit_size(V11@Buf5) band 7,
{V11@V6,V11@Buf7} = case V11@Buf5 of
<<_:V11@Pad9,0:1,V11@V11:7,V11@Buf12/bitstring>> when V11@V11 =/= 0 ->
{V11@V11,V11@Buf12};
<<_:V11@Pad9,1:1,0:1,V11@V12:14,V11@Buf13/bitstring>> when V11@V12 =/= 0 ->
{V11@V12,V11@Buf13}
end,
<<V11@V14:V11@V6/unit:8,V11@Buf15/bitstring>> = V11@Buf7,
{V11@V14,V11@Buf15}
end,
V11@Int16 = case V11@V3 of
_ -> {asn1_enum,V11@V3}
end,
{V11@Int16,V11@Buf4}
end,
{V11@V0,V11@Buf1}
end,
{TmpValx8,V10@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes10}
end,

%% attribute number 9 with type INTEGER
{Term9,Bytes12} = case Extensions of
  <<_:1,1:1,_/bitstring>> ->
begin
V12@Pad3 = bit_size(Bytes11) band 7,
{V12@V0,V12@Buf1} = case Bytes11 of
<<_:V12@Pad3,0:1,V12@V5:7,V12@Buf6/bitstring>> ->
{V12@V5,V12@Buf6};
<<_:V12@Pad3,1:1,0:1,V12@V6:14,V12@Buf7/bitstring>> ->
{V12@V6,V12@Buf7}
end,
<<V12@V8:V12@V0/binary-unit:8,V12@Buf9/bitstring>> = V12@Buf1,
{TmpValx9,_} = begin
<<V13@V0:2/unsigned-unit:1,V13@Buf1/bitstring>> = V12@V8,
V13@Add2 = V13@V0 + 1,
V13@Pad5 = bit_size(V13@Buf1) band 7,
<<_:V13@Pad5,V13@V3:V13@Add2/unsigned-unit:8,V13@Buf4/bitstring>> = V13@Buf1,
{V13@V3,V13@Buf4}
end,
{TmpValx9,V12@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes11}
end,
Bytes13= skipextensions(Bytes12, 3, Extensions),
{{'Signal',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9},Bytes13}.

'enc_SeqSigList'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,

%% attribute number 2 with type SEQUENCE OF
'enc_SeqSigList_signalList'(element(3,Val1))].
'enc_SeqSigList_signalList'(Val) ->
[

   encode_length(length(Val)),
   'enc_SeqSigList_signalList_components'(Val, [])
].
'enc_SeqSigList_signalList_components'([], Acc) -> lists:reverse(Acc);

'enc_SeqSigList_signalList_components'([H|T], Acc) ->
'enc_SeqSigList_signalList_components'(T, ['enc_Signal'(H)

 | Acc]).

'dec_SeqSigList_signalList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_SeqSigList_signalList_components'(V1@V0, V1@Buf1, []).

'dec_SeqSigList_signalList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_SeqSigList_signalList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_Signal'(Bytes,telltype),
   'dec_SeqSigList_signalList_components'(Num-1, Remain, [Term|Acc]).


'dec_SeqSigList'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes2} = 'dec_SeqSigList_signalList'(Bytes1, telltype),
{{'SeqSigList',Term1,Term2},Bytes2}.

'enc_SignalRequest'(Val) ->
[
set_choice(element(1, Val), {[signal,seqSigList],[]}, {2,0}),
case element(1,Val) of
signal ->
'enc_Signal'(element(2, Val));
seqSigList ->
'enc_SeqSigList'(element(2, Val))
end
].


'dec_SignalRequest'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_Signal'(Bytes2,telltype)
end,
{{signal,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_SeqSigList'(Bytes2,telltype)
end,
{{seqSigList,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_SignalsDescriptor'(Val) ->
[

   encode_length(length(Val)),
   'enc_SignalsDescriptor_components'(Val, [])
].
'enc_SignalsDescriptor_components'([], Acc) -> lists:reverse(Acc);

'enc_SignalsDescriptor_components'([H|T], Acc) ->
'enc_SignalsDescriptor_components'(T, ['enc_SignalRequest'(H)

 | Acc]).


'dec_SignalsDescriptor'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_SignalsDescriptor_components'(V1@V0, V1@Buf1, []).

'dec_SignalsDescriptor_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_SignalsDescriptor_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_SignalRequest'(Bytes,telltype),
   'dec_SignalsDescriptor_components'(Num-1, Remain, [Term|Acc]).
'enc_EventSpec'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,

%% attribute number 3 with type SEQUENCE OF
'enc_EventSpec_eventParList'(element(4,Val1))].
'enc_EventSpec_eventParList'(Val) ->
[

   encode_length(length(Val)),
   'enc_EventSpec_eventParList_components'(Val, [])
].
'enc_EventSpec_eventParList_components'([], Acc) -> lists:reverse(Acc);

'enc_EventSpec_eventParList_components'([H|T], Acc) ->
'enc_EventSpec_eventParList_components'(T, ['enc_EventParameter'(H)

 | Acc]).

'dec_EventSpec_eventParList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_EventSpec_eventParList_components'(V1@V0, V1@Buf1, []).

'dec_EventSpec_eventParList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_EventSpec_eventParList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_EventParameter'(Bytes,telltype),
   'dec_EventSpec_eventParList_components'(Num-1, Remain, [Term|Acc]).


'dec_EventSpec'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SEQUENCE OF
{Term3,Bytes5} = 'dec_EventSpec_eventParList'(Bytes4, telltype),

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'EventSpec',Term1,Term2,Term3},Bytes7}.

'enc_EventBufferDescriptor'(Val) ->
[

   encode_length(length(Val)),
   'enc_EventBufferDescriptor_components'(Val, [])
].
'enc_EventBufferDescriptor_components'([], Acc) -> lists:reverse(Acc);

'enc_EventBufferDescriptor_components'([H|T], Acc) ->
'enc_EventBufferDescriptor_components'(T, ['enc_EventSpec'(H)

 | Acc]).


'dec_EventBufferDescriptor'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_EventBufferDescriptor_components'(V1@V0, V1@Buf1, []).

'dec_EventBufferDescriptor_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_EventBufferDescriptor_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_EventSpec'(Bytes,telltype),
   'dec_EventBufferDescriptor_components'(Num-1, Remain, [Term|Acc]).
'enc_SecondRequestedActions'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type BOOLEAN
case Tmpval1 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval1}}})
end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aEventDM
'enc_EventDM'(Tmpval2)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type Externaltypereference756megaco_per_media_gateway_control_prev3aSignalsDescriptor
'enc_SignalsDescriptor'(Tmpval3)
end].


'dec_SecondRequestedActions'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type BOOLEAN
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
begin
<<V3@V0:1,V3@Buf1/bitstring>> = Bytes2,
V3@Int2 = case V3@V0 of
0 -> false;
1 -> true
end,
{V3@Int2,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type EventDM
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
'dec_EventDM'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SignalsDescriptor
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_SignalsDescriptor'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V4@V0,V4@Buf1} = case Bytes5 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'SecondRequestedActions',Term1,Term2,Term3},Bytes7}.

'enc_SecondRequestedEvent'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference747megaco_per_media_gateway_control_prev3aSecondRequestedActions
'enc_SecondRequestedActions'(Tmpval4)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_SecondRequestedEvent_evParList'(element(5,Val1))].
'enc_SecondRequestedEvent_evParList'(Val) ->
[

   encode_length(length(Val)),
   'enc_SecondRequestedEvent_evParList_components'(Val, [])
].
'enc_SecondRequestedEvent_evParList_components'([], Acc) -> lists:reverse(Acc);

'enc_SecondRequestedEvent_evParList_components'([H|T], Acc) ->
'enc_SecondRequestedEvent_evParList_components'(T, ['enc_EventParameter'(H)

 | Acc]).

'dec_SecondRequestedEvent_evParList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_SecondRequestedEvent_evParList_components'(V1@V0, V1@Buf1, []).

'dec_SecondRequestedEvent_evParList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_SecondRequestedEvent_evParList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_EventParameter'(Bytes,telltype),
   'dec_SecondRequestedEvent_evParList_components'(Num-1, Remain, [Term|Acc]).


'dec_SecondRequestedEvent'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SecondRequestedActions
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_SecondRequestedActions'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_SecondRequestedEvent_evParList'(Bytes5, telltype),

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V5@V0,V5@Buf1} = case Bytes6 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'SecondRequestedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_SecondEventsDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval1)
end,

%% attribute number 2 with type SEQUENCE OF
'enc_SecondEventsDescriptor_eventList'(element(3,Val1))].
'enc_SecondEventsDescriptor_eventList'(Val) ->
[

   encode_length(length(Val)),
   'enc_SecondEventsDescriptor_eventList_components'(Val, [])
].
'enc_SecondEventsDescriptor_eventList_components'([], Acc) -> lists:reverse(Acc);

'enc_SecondEventsDescriptor_eventList_components'([H|T], Acc) ->
'enc_SecondEventsDescriptor_eventList_components'(T, ['enc_SecondRequestedEvent'(H)

 | Acc]).

'dec_SecondEventsDescriptor_eventList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_SecondEventsDescriptor_eventList_components'(V1@V0, V1@Buf1, []).

'dec_SecondEventsDescriptor_eventList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_SecondEventsDescriptor_eventList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_SecondRequestedEvent'(Bytes,telltype),
   'dec_SecondEventsDescriptor_eventList_components'(Num-1, Remain, [Term|Acc]).


'dec_SecondEventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band 1 of
1 ->
begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/unsigned-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
{V3@V3,V3@Buf4}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_SecondEventsDescriptor_eventList'(Bytes3, telltype),

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V4@V0,V4@Buf1} = case Bytes4 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'SecondEventsDescriptor',Term1,Term2},Bytes6}.

'enc_EventDM'(Val) ->
[
set_choice(element(1, Val), [digitMapName,digitMapValue], 2),
case element(1,Val) of
digitMapName ->
  begin
    Tmpval1 = element(2, Val),
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end;
digitMapValue ->
'enc_DigitMapValue'(element(2, Val))
end
].


'dec_EventDM'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
<<V2@V0:2/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end
end,
{{digitMapName,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_DigitMapValue'(Bytes1,telltype)
end,
{{digitMapValue,Val},NewBytes}
end.
'enc_RequestedActions'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt4 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3,Fixopt4]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type BOOLEAN
case Tmpval1 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval1}}})
end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference724megaco_per_media_gateway_control_prev3aEventDM
'enc_EventDM'(Tmpval2)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type Externaltypereference725megaco_per_media_gateway_control_prev3aSecondEventsDescriptor
'enc_SecondEventsDescriptor'(Tmpval3)
end,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type Externaltypereference726megaco_per_media_gateway_control_prev3aSignalsDescriptor
'enc_SignalsDescriptor'(Tmpval4)
end].


'dec_RequestedActions'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:4,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type BOOLEAN
{Term1,Bytes3} = case (Opt bsr 3) band 1 of
1 ->
begin
<<V3@V0:1,V3@Buf1/bitstring>> = Bytes2,
V3@Int2 = case V3@V0 of
0 -> false;
1 -> true
end,
{V3@Int2,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type EventDM
{Term2,Bytes4} = case (Opt bsr 2) band 1 of
1 ->
'dec_EventDM'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SecondEventsDescriptor
{Term3,Bytes5} = case (Opt bsr 1) band 1 of
1 ->
'dec_SecondEventsDescriptor'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type SignalsDescriptor
{Term4,Bytes6} = case Opt band 1 of
1 ->
'dec_SignalsDescriptor'(Bytes5,telltype);
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V4@V0,V4@Buf1} = case Bytes6 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'RequestedActions',Term1,Term2,Term3,Term4},Bytes8}.

'enc_RequestedEvent'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference716megaco_per_media_gateway_control_prev3aRequestedActions
'enc_RequestedActions'(Tmpval4)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_RequestedEvent_evParList'(element(5,Val1))].
'enc_RequestedEvent_evParList'(Val) ->
[

   encode_length(length(Val)),
   'enc_RequestedEvent_evParList_components'(Val, [])
].
'enc_RequestedEvent_evParList_components'([], Acc) -> lists:reverse(Acc);

'enc_RequestedEvent_evParList_components'([H|T], Acc) ->
'enc_RequestedEvent_evParList_components'(T, ['enc_EventParameter'(H)

 | Acc]).

'dec_RequestedEvent_evParList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_RequestedEvent_evParList_components'(V1@V0, V1@Buf1, []).

'dec_RequestedEvent_evParList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_RequestedEvent_evParList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_EventParameter'(Bytes,telltype),
   'dec_RequestedEvent_evParList_components'(Num-1, Remain, [Term|Acc]).


'dec_RequestedEvent'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type RequestedActions
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_RequestedActions'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_RequestedEvent_evParList'(Bytes5, telltype),

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V5@V0,V5@Buf1} = case Bytes6 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'RequestedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_EventsDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval1)
end,

%% attribute number 2 with type SEQUENCE OF
'enc_EventsDescriptor_eventList'(element(3,Val1))].
'enc_EventsDescriptor_eventList'(Val) ->
[

   encode_length(length(Val)),
   'enc_EventsDescriptor_eventList_components'(Val, [])
].
'enc_EventsDescriptor_eventList_components'([], Acc) -> lists:reverse(Acc);

'enc_EventsDescriptor_eventList_components'([H|T], Acc) ->
'enc_EventsDescriptor_eventList_components'(T, ['enc_RequestedEvent'(H)

 | Acc]).

'dec_EventsDescriptor_eventList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_EventsDescriptor_eventList_components'(V1@V0, V1@Buf1, []).

'dec_EventsDescriptor_eventList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_EventsDescriptor_eventList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_RequestedEvent'(Bytes,telltype),
   'dec_EventsDescriptor_eventList_components'(Num-1, Remain, [Term|Acc]).


'dec_EventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band 1 of
1 ->
begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/unsigned-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
{V3@V3,V3@Buf4}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_EventsDescriptor_eventList'(Bytes3, telltype),

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V4@V0,V4@Buf1} = case Bytes4 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'EventsDescriptor',Term1,Term2},Bytes6}.

'enc_StreamID'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
 case Val of 
    Tmpval1 when Tmpval1=<65535,Tmpval1>=0 ->
      [20,2,<<(Tmpval1- 0):16>>];
    Tmpval1 ->
      exit({error,{value_out_of_bounds,Tmpval1}})
  end
.


'dec_StreamID'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end.

'enc_MuxType'(Val) ->
case Val of
'h221' -> [0,10,2,0];
'h223' -> [0,10,2,1];
'h226' -> [0,10,2,2];
'v76' -> [0,10,2,3];
'nx64k' -> [1,10,7,0];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_MuxType'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:2/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> h221;
1 -> h223;
2 -> h226;
3 -> v76
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
0 -> nx64k;
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_MuxDescriptor'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type ENUMERATED
case element(2,Val1) of
'h221' -> [0,10,2,0];
'h223' -> [0,10,2,1];
'h226' -> [0,10,2,2];
'v76' -> [0,10,2,3];
'nx64k' -> [1,10,7,0];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end,

%% attribute number 2 with type SEQUENCE OF
'enc_MuxDescriptor_termList'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type Externaltypereference687megaco_per_media_gateway_control_prev3aNonStandardData
'enc_NonStandardData'(Tmpval1)
end].
'enc_MuxDescriptor_termList'(Val) ->
[

   encode_length(length(Val)),
   'enc_MuxDescriptor_termList_components'(Val, [])
].
'enc_MuxDescriptor_termList_components'([], Acc) -> lists:reverse(Acc);

'enc_MuxDescriptor_termList_components'([H|T], Acc) ->
'enc_MuxDescriptor_termList_components'(T, ['enc_TerminationID'(H)

 | Acc]).

'dec_MuxDescriptor_termList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_MuxDescriptor_termList_components'(V1@V0, V1@Buf1, []).

'dec_MuxDescriptor_termList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_MuxDescriptor_termList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_TerminationID'(Bytes,telltype),
   'dec_MuxDescriptor_termList_components'(Num-1, Remain, [Term|Acc]).


'dec_MuxDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = begin
{V3@V0,V3@Buf1} = case Bytes2 of
<<0:1,V3@V3:2/unsigned-unit:1,V3@Buf4/bitstring>> ->
V3@Int5 = case V3@V3 of
0 -> h221;
1 -> h223;
2 -> h226;
3 -> v76
end,
{V3@Int5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<0:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V6,V3@Buf7};
<<1:1,V3@Buf5/bitstring>> ->
V3@Pad9 = bit_size(V3@Buf5) band 7,
{V3@V6,V3@Buf7} = case V3@Buf5 of
<<_:V3@Pad9,0:1,V3@V11:7,V3@Buf12/bitstring>> when V3@V11 =/= 0 ->
{V3@V11,V3@Buf12};
<<_:V3@Pad9,1:1,0:1,V3@V12:14,V3@Buf13/bitstring>> when V3@V12 =/= 0 ->
{V3@V12,V3@Buf13}
end,
<<V3@V14:V3@V6/unit:8,V3@Buf15/bitstring>> = V3@Buf7,
{V3@V14,V3@Buf15}
end,
V3@Int16 = case V3@V3 of
0 -> nx64k;
_ -> {asn1_enum,V3@V3}
end,
{V3@Int16,V3@Buf4}
end,
{V3@V0,V3@Buf1}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_MuxDescriptor_termList'(Bytes3, telltype),

%% attribute number 3 with type NonStandardData
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_NonStandardData'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V4@V0,V4@Buf1} = case Bytes5 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'MuxDescriptor',Term1,Term2,Term3},Bytes7}.

'enc_ServiceState'(Val) ->
case Val of
'test' -> [0,10,2,0];
'outOfSvc' -> [0,10,2,1];
'inSvc' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_ServiceState'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:2/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> test;
1 -> outOfSvc;
2 -> inSvc;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[test,outOfSvc,inSvc]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_EventBufferControl'(Val) ->
case Val of
'off' -> [0,0];
'lockStep' -> [0,1];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_EventBufferControl'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:1/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> off;
1 -> lockStep
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_TerminationStateDescriptor'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_TerminationStateDescriptor_propertyParms'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type ENUMERATED
case Tmpval1 of
'off' -> [0,0];
'lockStep' -> [0,1];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type ENUMERATED
case Tmpval2 of
'test' -> [0,10,2,0];
'outOfSvc' -> [0,10,2,1];
'inSvc' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end
end].
'enc_TerminationStateDescriptor_propertyParms'(Val) ->
[

   encode_length(length(Val)),
   'enc_TerminationStateDescriptor_propertyParms_components'(Val, [])
].
'enc_TerminationStateDescriptor_propertyParms_components'([], Acc) -> lists:reverse(Acc);

'enc_TerminationStateDescriptor_propertyParms_components'([H|T], Acc) ->
'enc_TerminationStateDescriptor_propertyParms_components'(T, ['enc_PropertyParm'(H)

 | Acc]).

'dec_TerminationStateDescriptor_propertyParms'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TerminationStateDescriptor_propertyParms_components'(V1@V0, V1@Buf1, []).

'dec_TerminationStateDescriptor_propertyParms_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TerminationStateDescriptor_propertyParms_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyParm'(Bytes,telltype),
   'dec_TerminationStateDescriptor_propertyParms_components'(Num-1, Remain, [Term|Acc]).


'dec_TerminationStateDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes3} = 'dec_TerminationStateDescriptor_propertyParms'(Bytes2, telltype),

%% attribute number 2 with type ENUMERATED
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
{V3@V0,V3@Buf1} = case Bytes3 of
<<0:1,V3@V3:1/unsigned-unit:1,V3@Buf4/bitstring>> ->
V3@Int5 = case V3@V3 of
0 -> off;
1 -> lockStep
end,
{V3@Int5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<0:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V6,V3@Buf7};
<<1:1,V3@Buf5/bitstring>> ->
V3@Pad9 = bit_size(V3@Buf5) band 7,
{V3@V6,V3@Buf7} = case V3@Buf5 of
<<_:V3@Pad9,0:1,V3@V11:7,V3@Buf12/bitstring>> when V3@V11 =/= 0 ->
{V3@V11,V3@Buf12};
<<_:V3@Pad9,1:1,0:1,V3@V12:14,V3@Buf13/bitstring>> when V3@V12 =/= 0 ->
{V3@V12,V3@Buf13}
end,
<<V3@V14:V3@V6/unit:8,V3@Buf15/bitstring>> = V3@Buf7,
{V3@V14,V3@Buf15}
end,
V3@Int16 = case V3@V3 of
_ -> {asn1_enum,V3@V3}
end,
{V3@Int16,V3@Buf4}
end,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type ENUMERATED
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
{V4@V0,V4@Buf1} = case Bytes4 of
<<0:1,V4@V3:2/unsigned-unit:1,V4@Buf4/bitstring>> ->
V4@Int5 = case V4@V3 of
0 -> test;
1 -> outOfSvc;
2 -> inSvc;
_ -> exit({error,{asn1,{decode_enumerated,{V4@V3,[test,outOfSvc,inSvc]}}}})
end,
{V4@Int5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<0:1,V4@V6:6,V4@Buf7/bitstring>> ->
{V4@V6,V4@Buf7};
<<1:1,V4@Buf5/bitstring>> ->
V4@Pad9 = bit_size(V4@Buf5) band 7,
{V4@V6,V4@Buf7} = case V4@Buf5 of
<<_:V4@Pad9,0:1,V4@V11:7,V4@Buf12/bitstring>> when V4@V11 =/= 0 ->
{V4@V11,V4@Buf12};
<<_:V4@Pad9,1:1,0:1,V4@V12:14,V4@Buf13/bitstring>> when V4@V12 =/= 0 ->
{V4@V12,V4@Buf13}
end,
<<V4@V14:V4@V6/unit:8,V4@Buf15/bitstring>> = V4@Buf7,
{V4@V14,V4@Buf15}
end,
V4@Int16 = case V4@V3 of
_ -> {asn1_enum,V4@V3}
end,
{V4@Int16,V4@Buf4}
end,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'TerminationStateDescriptor',Term1,Term2,Term3},Bytes7}.

'enc_PropertyGroup'(Val) ->
[

   encode_length(length(Val)),
   'enc_PropertyGroup_components'(Val, [])
].
'enc_PropertyGroup_components'([], Acc) -> lists:reverse(Acc);

'enc_PropertyGroup_components'([H|T], Acc) ->
'enc_PropertyGroup_components'(T, ['enc_PropertyParm'(H)

 | Acc]).


'dec_PropertyGroup'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_PropertyGroup_components'(V1@V0, V1@Buf1, []).

'dec_PropertyGroup_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_PropertyGroup_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyParm'(Bytes,telltype),
   'dec_PropertyGroup_components'(Num-1, Remain, [Term|Acc]).
'enc_LocalRemoteDescriptor'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type SEQUENCE OF
'enc_LocalRemoteDescriptor_propGrps'(element(2,Val1))].
'enc_LocalRemoteDescriptor_propGrps'(Val) ->
[

   encode_length(length(Val)),
   'enc_LocalRemoteDescriptor_propGrps_components'(Val, [])
].
'enc_LocalRemoteDescriptor_propGrps_components'([], Acc) -> lists:reverse(Acc);

'enc_LocalRemoteDescriptor_propGrps_components'([H|T], Acc) ->
'enc_LocalRemoteDescriptor_propGrps_components'(T, ['enc_PropertyGroup'(H)

 | Acc]).

'dec_LocalRemoteDescriptor_propGrps'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_LocalRemoteDescriptor_propGrps_components'(V1@V0, V1@Buf1, []).

'dec_LocalRemoteDescriptor_propGrps_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_LocalRemoteDescriptor_propGrps_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyGroup'(Bytes,telltype),
   'dec_LocalRemoteDescriptor_propGrps_components'(Num-1, Remain, [Term|Acc]).


'dec_LocalRemoteDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes2} = 'dec_LocalRemoteDescriptor_propGrps'(Bytes1, telltype),

%% Extensions
{Extensions,Bytes3} = case Ext of
0 -> {<<>>,Bytes2};
1 ->
{V2@V0,V2@Buf1} = case Bytes2 of
<<0:1,V2@V3:6,V2@Buf4/bitstring>> ->
V2@Add5 = V2@V3 + 1,
{V2@Add5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
V2@Pad6 = bit_size(V2@Buf2) band 7,
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<_:V2@Pad6,0:1,V2@V8:7,V2@Buf9/bitstring>> when V2@V8 =/= 0 ->
{V2@V8,V2@Buf9};
<<_:V2@Pad6,1:1,0:1,V2@V9:14,V2@Buf10/bitstring>> when V2@V9 =/= 0 ->
{V2@V9,V2@Buf10}
end,
{V2@V3,V2@Buf4}
end,
<<V2@V11:V2@V0/bitstring-unit:1,V2@Buf12/bitstring>> = V2@Buf1,
{V2@V11,V2@Buf12}
end,
Bytes4= skipextensions(Bytes3, 1, Extensions),
{{'LocalRemoteDescriptor',Term1},Bytes4}.

'enc_Relation'(Val) ->
case Val of
'greaterThan' -> [0,10,2,0];
'smallerThan' -> [0,10,2,1];
'unequalTo' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_Relation'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:2/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> greaterThan;
1 -> smallerThan;
2 -> unequalTo;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[greaterThan,smallerThan,unequalTo]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_PkgdName'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_PkgdName'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end.

'enc_Name'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_Name'(Bytes,_) ->
begin
<<V1@V0:2/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv2 = binary_to_list(V1@V0),
{V1@Conv2,V1@Buf1}
end.

'enc_PropertyParm'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type SEQUENCE OF
'enc_PropertyParm_value'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type CHOICE
'enc_PropertyParm_extraInfo'(Tmpval2)
end].
'enc_PropertyParm_value'(Val) ->
[

   encode_length(length(Val)),
   'enc_PropertyParm_value_components'(Val, [])
].
'enc_PropertyParm_value_components'([], Acc) -> lists:reverse(Acc);

'enc_PropertyParm_value_components'([H|T], Acc) ->
'enc_PropertyParm_value_components'(T, [encode_octet_string(no, H) | Acc]).

'dec_PropertyParm_value'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_PropertyParm_value_components'(V1@V0, V1@Buf1, []).

'dec_PropertyParm_value_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_PropertyParm_value_components'(Num, Bytes, Acc) ->
   {Term,Remain} = begin
V2@Pad3 = bit_size(Bytes) band 7,
{V2@V0,V2@Buf1} = case Bytes of
<<_:V2@Pad3,0:1,V2@V5:7,V2@V7:V2@V5/binary-unit:8,V2@Buf8/bitstring>> ->
{V2@V7,V2@Buf8};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@V8:V2@V6/binary-unit:8,V2@Buf9/bitstring>> ->
{V2@V8,V2@Buf9};
<<_:V2@Pad3,1:1,1:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V8,V2@Buf9}  = decode_fragmented(V2@V6, V2@Buf7, 8),
{V2@V8,V2@Buf9}
end,
V2@Conv10 = binary_to_list(V2@V0),
{V2@Conv10,V2@Buf1}
end,
   'dec_PropertyParm_value_components'(Num-1, Remain, [Term|Acc]).
'enc_PropertyParm_extraInfo'(Val) ->
[
set_choice(element(1, Val), [relation,range,sublist], 3),
case element(1,Val) of
relation ->
case element(2, Val) of
'greaterThan' -> [0,10,2,0];
'smallerThan' -> [0,10,2,1];
'unequalTo' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end;
range ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end;
sublist ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end
end
].

'dec_PropertyParm_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
{V2@V0,V2@Buf1} = case Bytes1 of
<<0:1,V2@V3:2/unsigned-unit:1,V2@Buf4/bitstring>> ->
V2@Int5 = case V2@V3 of
0 -> greaterThan;
1 -> smallerThan;
2 -> unequalTo;
_ -> exit({error,{asn1,{decode_enumerated,{V2@V3,[greaterThan,smallerThan,unequalTo]}}}})
end,
{V2@Int5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<0:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7};
<<1:1,V2@Buf5/bitstring>> ->
V2@Pad9 = bit_size(V2@Buf5) band 7,
{V2@V6,V2@Buf7} = case V2@Buf5 of
<<_:V2@Pad9,0:1,V2@V11:7,V2@Buf12/bitstring>> when V2@V11 =/= 0 ->
{V2@V11,V2@Buf12};
<<_:V2@Pad9,1:1,0:1,V2@V12:14,V2@Buf13/bitstring>> when V2@V12 =/= 0 ->
{V2@V12,V2@Buf13}
end,
<<V2@V14:V2@V6/unit:8,V2@Buf15/bitstring>> = V2@Buf7,
{V2@V14,V2@Buf15}
end,
V2@Int16 = case V2@V3 of
_ -> {asn1_enum,V2@V3}
end,
{V2@Int16,V2@Buf4}
end,
{V2@V0,V2@Buf1}
end
end,
{{relation,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
begin
<<V3@V0:1,V3@Buf1/bitstring>> = Bytes1,
V3@Int2 = case V3@V0 of
0 -> false;
1 -> true
end,
{V3@Int2,V3@Buf1}
end
end,
{{range,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
begin
<<V4@V0:1,V4@Buf1/bitstring>> = Bytes1,
V4@Int2 = case V4@V0 of
0 -> false;
1 -> true
end,
{V4@Int2,V4@Buf1}
end
end,
{{sublist,Val},NewBytes}
end.


'dec_PropertyParm'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_PropertyParm_value'(Bytes3, telltype),

%% attribute number 3 with type CHOICE
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_PropertyParm_extraInfo'(Bytes4, telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V4@V0,V4@Buf1} = case Bytes5 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'PropertyParm',Term1,Term2,Term3},Bytes7}.

'enc_StreamMode'(Val) ->
case Val of
'sendOnly' -> [0,10,3,0];
'recvOnly' -> [0,10,3,1];
'sendRecv' -> [0,10,3,2];
'inactive' -> [0,10,3,3];
'loopBack' -> [0,10,3,4];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end.


'dec_StreamMode'(Bytes,_) ->
begin
{V1@V0,V1@Buf1} = case Bytes of
<<0:1,V1@V3:3/unsigned-unit:1,V1@Buf4/bitstring>> ->
V1@Int5 = case V1@V3 of
0 -> sendOnly;
1 -> recvOnly;
2 -> sendRecv;
3 -> inactive;
4 -> loopBack;
_ -> exit({error,{asn1,{decode_enumerated,{V1@V3,[sendOnly,recvOnly,sendRecv,inactive,loopBack]}}}})
end,
{V1@Int5,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<0:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7};
<<1:1,V1@Buf5/bitstring>> ->
V1@Pad9 = bit_size(V1@Buf5) band 7,
{V1@V6,V1@Buf7} = case V1@Buf5 of
<<_:V1@Pad9,0:1,V1@V11:7,V1@Buf12/bitstring>> when V1@V11 =/= 0 ->
{V1@V11,V1@Buf12};
<<_:V1@Pad9,1:1,0:1,V1@V12:14,V1@Buf13/bitstring>> when V1@V12 =/= 0 ->
{V1@V12,V1@Buf13}
end,
<<V1@V14:V1@V6/unit:8,V1@Buf15/bitstring>> = V1@Buf7,
{V1@V14,V1@Buf15}
end,
V1@Int16 = case V1@V3 of
_ -> {asn1_enum,V1@V3}
end,
{V1@Int16,V1@Buf4}
end,
{V1@V0,V1@Buf1}
end.

'enc_LocalControlDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type ENUMERATED
case Tmpval1 of
'sendOnly' -> [0,10,3,0];
'recvOnly' -> [0,10,3,1];
'sendRecv' -> [0,10,3,2];
'inactive' -> [0,10,3,3];
'loopBack' -> [0,10,3,4];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type BOOLEAN
case Tmpval2 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval2}}})
end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type BOOLEAN
case Tmpval3 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval3}}})
end
end,

%% attribute number 4 with type SEQUENCE OF
'enc_LocalControlDescriptor_propertyParms'(element(5,Val1))].
'enc_LocalControlDescriptor_propertyParms'(Val) ->
[

   encode_length(length(Val)),
   'enc_LocalControlDescriptor_propertyParms_components'(Val, [])
].
'enc_LocalControlDescriptor_propertyParms_components'([], Acc) -> lists:reverse(Acc);

'enc_LocalControlDescriptor_propertyParms_components'([H|T], Acc) ->
'enc_LocalControlDescriptor_propertyParms_components'(T, ['enc_PropertyParm'(H)

 | Acc]).

'dec_LocalControlDescriptor_propertyParms'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_LocalControlDescriptor_propertyParms_components'(V1@V0, V1@Buf1, []).

'dec_LocalControlDescriptor_propertyParms_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_LocalControlDescriptor_propertyParms_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyParm'(Bytes,telltype),
   'dec_LocalControlDescriptor_propertyParms_components'(Num-1, Remain, [Term|Acc]).


'dec_LocalControlDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
begin
{V3@V0,V3@Buf1} = case Bytes2 of
<<0:1,V3@V3:3/unsigned-unit:1,V3@Buf4/bitstring>> ->
V3@Int5 = case V3@V3 of
0 -> sendOnly;
1 -> recvOnly;
2 -> sendRecv;
3 -> inactive;
4 -> loopBack;
_ -> exit({error,{asn1,{decode_enumerated,{V3@V3,[sendOnly,recvOnly,sendRecv,inactive,loopBack]}}}})
end,
{V3@Int5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<0:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V6,V3@Buf7};
<<1:1,V3@Buf5/bitstring>> ->
V3@Pad9 = bit_size(V3@Buf5) band 7,
{V3@V6,V3@Buf7} = case V3@Buf5 of
<<_:V3@Pad9,0:1,V3@V11:7,V3@Buf12/bitstring>> when V3@V11 =/= 0 ->
{V3@V11,V3@Buf12};
<<_:V3@Pad9,1:1,0:1,V3@V12:14,V3@Buf13/bitstring>> when V3@V12 =/= 0 ->
{V3@V12,V3@Buf13}
end,
<<V3@V14:V3@V6/unit:8,V3@Buf15/bitstring>> = V3@Buf7,
{V3@V14,V3@Buf15}
end,
V3@Int16 = case V3@V3 of
_ -> {asn1_enum,V3@V3}
end,
{V3@Int16,V3@Buf4}
end,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type BOOLEAN
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
<<V4@V0:1,V4@Buf1/bitstring>> = Bytes3,
V4@Int2 = case V4@V0 of
0 -> false;
1 -> true
end,
{V4@Int2,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type BOOLEAN
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
<<V5@V0:1,V5@Buf1/bitstring>> = Bytes4,
V5@Int2 = case V5@V0 of
0 -> false;
1 -> true
end,
{V5@Int2,V5@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_LocalControlDescriptor_propertyParms'(Bytes5, telltype),

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V6@V0,V6@Buf1} = case Bytes6 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
V6@Pad6 = bit_size(V6@Buf2) band 7,
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:V6@Pad6,0:1,V6@V8:7,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9};
<<_:V6@Pad6,1:1,0:1,V6@V9:14,V6@Buf10/bitstring>> when V6@V9 =/= 0 ->
{V6@V9,V6@Buf10}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V11:V6@V0/bitstring-unit:1,V6@Buf12/bitstring>> = V6@Buf1,
{V6@V11,V6@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'LocalControlDescriptor',Term1,Term2,Term3,Term4},Bytes8}.

'enc_StreamParms'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
Extensions = fixextensions({ext,4,1}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type Externaltypereference569megaco_per_media_gateway_control_prev3aLocalControlDescriptor
'enc_LocalControlDescriptor'(Tmpval2)
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereference570megaco_per_media_gateway_control_prev3aLocalRemoteDescriptor
'enc_LocalRemoteDescriptor'(Tmpval3)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference571megaco_per_media_gateway_control_prev3aLocalRemoteDescriptor
'enc_LocalRemoteDescriptor'(Tmpval4)
end
,Extensions
,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereference573megaco_per_media_gateway_control_prev3aStatisticsDescriptor
encode_open_type(complete('enc_StatisticsDescriptor'(Tmpval5)))
end].


'dec_StreamParms'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type LocalControlDescriptor
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
'dec_LocalControlDescriptor'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type LocalRemoteDescriptor
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
'dec_LocalRemoteDescriptor'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type LocalRemoteDescriptor
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_LocalRemoteDescriptor'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V3@V0,V3@Buf1} = case Bytes5 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,

%% attribute number 4 with type StatisticsDescriptor
{Term4,Bytes7} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V4@Pad3 = bit_size(Bytes6) band 7,
{V4@V0,V4@Buf1} = case Bytes6 of
<<_:V4@Pad3,0:1,V4@V5:7,V4@Buf6/bitstring>> ->
{V4@V5,V4@Buf6};
<<_:V4@Pad3,1:1,0:1,V4@V6:14,V4@Buf7/bitstring>> ->
{V4@V6,V4@Buf7}
end,
<<V4@V8:V4@V0/binary-unit:8,V4@Buf9/bitstring>> = V4@Buf1,
{TmpValx4,_} = 'dec_StatisticsDescriptor'(V4@V8,telltype),
{TmpValx4,V4@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes6}
end,
Bytes8= skipextensions(Bytes7, 2, Extensions),
{{'StreamParms',Term1,Term2,Term3,Term4},Bytes8}.

'enc_StreamDescriptor'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,

%% attribute number 2 with type Externaltypereference564megaco_per_media_gateway_control_prev3aStreamParms
'enc_StreamParms'(element(3,Val1))].


'dec_StreamDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 2 with type StreamParms
{Term2,Bytes2} = 'dec_StreamParms'(Bytes1,telltype),
{{'StreamDescriptor',Term1,Term2},Bytes2}.

'enc_MediaDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereference552megaco_per_media_gateway_control_prev3aTerminationStateDescriptor
'enc_TerminationStateDescriptor'(Tmpval1)
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type CHOICE
'enc_MediaDescriptor_streams'(Tmpval2)
end].
'enc_MediaDescriptor_streams'(Val) ->
[
set_choice(element(1, Val), [oneStream,multiStream], 2),
case element(1,Val) of
oneStream ->
'enc_StreamParms'(element(2, Val));
multiStream ->
'enc_MediaDescriptor_streams_multiStream'(element(2, Val))
end
].
'enc_MediaDescriptor_streams_multiStream'(Val) ->
[

   encode_length(length(Val)),
   'enc_MediaDescriptor_streams_multiStream_components'(Val, [])
].
'enc_MediaDescriptor_streams_multiStream_components'([], Acc) -> lists:reverse(Acc);

'enc_MediaDescriptor_streams_multiStream_components'([H|T], Acc) ->
'enc_MediaDescriptor_streams_multiStream_components'(T, ['enc_StreamDescriptor'(H)

 | Acc]).

'dec_MediaDescriptor_streams_multiStream'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_MediaDescriptor_streams_multiStream_components'(V1@V0, V1@Buf1, []).

'dec_MediaDescriptor_streams_multiStream_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_MediaDescriptor_streams_multiStream_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_StreamDescriptor'(Bytes,telltype),
   'dec_MediaDescriptor_streams_multiStream_components'(Num-1, Remain, [Term|Acc]).

'dec_MediaDescriptor_streams'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_StreamParms'(Bytes1,telltype)
end,
{{oneStream,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_MediaDescriptor_streams_multiStream'(Bytes1, telltype)
end,
{{multiStream,Val},NewBytes}
end.


'dec_MediaDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type TerminationStateDescriptor
{Term1,Bytes3} = case (Opt bsr 1) band 1 of
1 ->
'dec_TerminationStateDescriptor'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type CHOICE
{Term2,Bytes4} = case Opt band 1 of
1 ->
'dec_MediaDescriptor_streams'(Bytes3, telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'MediaDescriptor',Term1,Term2},Bytes6}.

'enc_TerminationIDList'(Val) ->
[

   encode_length(length(Val)),
   'enc_TerminationIDList_components'(Val, [])
].
'enc_TerminationIDList_components'([], Acc) -> lists:reverse(Acc);

'enc_TerminationIDList_components'([H|T], Acc) ->
'enc_TerminationIDList_components'(T, ['enc_TerminationID'(H)

 | Acc]).


'dec_TerminationIDList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TerminationIDList_components'(V1@V0, V1@Buf1, []).

'dec_TerminationIDList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TerminationIDList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_TerminationID'(Bytes,telltype),
   'dec_TerminationIDList_components'(Num-1, Remain, [Term|Acc]).
'enc_TerminationID'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type SEQUENCE OF
'enc_TerminationID_wildcard'(element(2,Val1)),

%% attribute number 2 with type OCTET STRING
encode_octet_string({1,8}, element(3,Val1))].
'enc_TerminationID_wildcard'(Val) ->
[

   encode_length(length(Val)),
   'enc_TerminationID_wildcard_components'(Val, [])
].
'enc_TerminationID_wildcard_components'([], Acc) -> lists:reverse(Acc);

'enc_TerminationID_wildcard_components'([H|T], Acc) ->
'enc_TerminationID_wildcard_components'(T, [  begin
    [Tmpval1] = H,
    [[10,8],Tmpval1]
  end | Acc]).

'dec_TerminationID_wildcard'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TerminationID_wildcard_components'(V1@V0, V1@Buf1, []).

'dec_TerminationID_wildcard_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TerminationID_wildcard_components'(Num, Bytes, Acc) ->
   {Term,Remain} = begin
<<V2@V0:1/binary-unit:8,V2@Buf1/bitstring>> = Bytes,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end,
   'dec_TerminationID_wildcard_components'(Num-1, Remain, [Term|Acc]).


'dec_TerminationID'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes2} = 'dec_TerminationID_wildcard'(Bytes1, telltype),

%% attribute number 2 with type OCTET STRING
{Term2,Bytes3} = begin
<<V2@V0:3/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes2,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/binary-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
V2@Conv7 = binary_to_list(V2@V3),
{V2@Conv7,V2@Buf4}
end,

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V3@V0,V3@Buf1} = case Bytes3 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:7,0:1,V3@V7:7,V3@Buf8/bitstring>> when V3@V7 =/= 0 ->
{V3@V7,V3@Buf8};
<<_:7,1:1,0:1,V3@V8:14,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V10:V3@V0/bitstring-unit:1,V3@Buf11/bitstring>> = V3@Buf1,
{V3@V10,V3@Buf11}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'TerminationID',Term1,Term2},Bytes5}.

'enc_WildcardField'(Val) ->
  begin
    [Tmpval1] = Val,
    [[10,8],Tmpval1]
  end.


'dec_WildcardField'(Bytes,_) ->
begin
<<V1@V0:1/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv2 = binary_to_list(V1@V0),
{V1@Conv2,V1@Buf1}
end.

'enc_ServiceChangeResult'(Val) ->
[
set_choice(element(1, Val), [errorDescriptor,serviceChangeResParms], 2),
case element(1,Val) of
errorDescriptor ->
'enc_ErrorDescriptor'(element(2, Val));
serviceChangeResParms ->
'enc_ServiceChangeResParm'(element(2, Val))
end
].


'dec_ServiceChangeResult'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_ErrorDescriptor'(Bytes1,telltype)
end,
{{errorDescriptor,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_ServiceChangeResParm'(Bytes1,telltype)
end,
{{serviceChangeResParms,Val},NewBytes}
end.
'enc_ServiceChangeReply'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type Externaltypereference523megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference524megaco_per_media_gateway_control_prev3aServiceChangeResult
'enc_ServiceChangeResult'(element(3,Val1))].


'dec_ServiceChangeReply'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes2} = 'dec_TerminationIDList'(Bytes1,telltype),

%% attribute number 2 with type ServiceChangeResult
{Term2,Bytes3} = 'dec_ServiceChangeResult'(Bytes2,telltype),

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V2@V0,V2@Buf1} = case Bytes3 of
<<0:1,V2@V3:6,V2@Buf4/bitstring>> ->
V2@Add5 = V2@V3 + 1,
{V2@Add5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
V2@Pad6 = bit_size(V2@Buf2) band 7,
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<_:V2@Pad6,0:1,V2@V8:7,V2@Buf9/bitstring>> when V2@V8 =/= 0 ->
{V2@V8,V2@Buf9};
<<_:V2@Pad6,1:1,0:1,V2@V9:14,V2@Buf10/bitstring>> when V2@V9 =/= 0 ->
{V2@V9,V2@Buf10}
end,
{V2@V3,V2@Buf4}
end,
<<V2@V11:V2@V0/bitstring-unit:1,V2@Buf12/bitstring>> = V2@Buf1,
{V2@V11,V2@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'ServiceChangeReply',Term1,Term2},Bytes5}.

'enc_ServiceChangeRequest'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type Externaltypereference516megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference517megaco_per_media_gateway_control_prev3aServiceChangeParm
'enc_ServiceChangeParm'(element(3,Val1))].


'dec_ServiceChangeRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes2} = 'dec_TerminationIDList'(Bytes1,telltype),

%% attribute number 2 with type ServiceChangeParm
{Term2,Bytes3} = 'dec_ServiceChangeParm'(Bytes2,telltype),

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V2@V0,V2@Buf1} = case Bytes3 of
<<0:1,V2@V3:6,V2@Buf4/bitstring>> ->
V2@Add5 = V2@V3 + 1,
{V2@Add5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
V2@Pad6 = bit_size(V2@Buf2) band 7,
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<_:V2@Pad6,0:1,V2@V8:7,V2@Buf9/bitstring>> when V2@V8 =/= 0 ->
{V2@V8,V2@Buf9};
<<_:V2@Pad6,1:1,0:1,V2@V9:14,V2@Buf10/bitstring>> when V2@V9 =/= 0 ->
{V2@V9,V2@Buf10}
end,
{V2@V3,V2@Buf4}
end,
<<V2@V11:V2@V0/bitstring-unit:1,V2@Buf12/bitstring>> = V2@Buf1,
{V2@V11,V2@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'ServiceChangeRequest',Term1,Term2},Bytes5}.

'enc_EventParameter'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type Externaltypereference502megaco_per_media_gateway_control_prev3aValue
'enc_Value'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type CHOICE
'enc_EventParameter_extraInfo'(Tmpval2)
end].
'enc_EventParameter_extraInfo'(Val) ->
[
set_choice(element(1, Val), [relation,range,sublist], 3),
case element(1,Val) of
relation ->
case element(2, Val) of
'greaterThan' -> [0,10,2,0];
'smallerThan' -> [0,10,2,1];
'unequalTo' -> [0,10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end;
range ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end;
sublist ->
case element(2, Val) of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,element(2, Val)}}})
end
end
].

'dec_EventParameter_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
begin
{V2@V0,V2@Buf1} = case Bytes1 of
<<0:1,V2@V3:2/unsigned-unit:1,V2@Buf4/bitstring>> ->
V2@Int5 = case V2@V3 of
0 -> greaterThan;
1 -> smallerThan;
2 -> unequalTo;
_ -> exit({error,{asn1,{decode_enumerated,{V2@V3,[greaterThan,smallerThan,unequalTo]}}}})
end,
{V2@Int5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<0:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7};
<<1:1,V2@Buf5/bitstring>> ->
V2@Pad9 = bit_size(V2@Buf5) band 7,
{V2@V6,V2@Buf7} = case V2@Buf5 of
<<_:V2@Pad9,0:1,V2@V11:7,V2@Buf12/bitstring>> when V2@V11 =/= 0 ->
{V2@V11,V2@Buf12};
<<_:V2@Pad9,1:1,0:1,V2@V12:14,V2@Buf13/bitstring>> when V2@V12 =/= 0 ->
{V2@V12,V2@Buf13}
end,
<<V2@V14:V2@V6/unit:8,V2@Buf15/bitstring>> = V2@Buf7,
{V2@V14,V2@Buf15}
end,
V2@Int16 = case V2@V3 of
_ -> {asn1_enum,V2@V3}
end,
{V2@Int16,V2@Buf4}
end,
{V2@V0,V2@Buf1}
end
end,
{{relation,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
begin
<<V3@V0:1,V3@Buf1/bitstring>> = Bytes1,
V3@Int2 = case V3@V0 of
0 -> false;
1 -> true
end,
{V3@Int2,V3@Buf1}
end
end,
{{range,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
begin
<<V4@V0:1,V4@Buf1/bitstring>> = Bytes1,
V4@Int2 = case V4@V0 of
0 -> false;
1 -> true
end,
{V4@Int2,V4@Buf1}
end
end,
{{sublist,Val},NewBytes}
end.


'dec_EventParameter'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
<<V3@V0:2/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv2 = binary_to_list(V3@V0),
{V3@Conv2,V3@Buf1}
end,

%% attribute number 2 with type Value
{Term2,Bytes4} = 'dec_Value'(Bytes3,telltype),

%% attribute number 3 with type CHOICE
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_EventParameter_extraInfo'(Bytes4, telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V4@V0,V4@Buf1} = case Bytes5 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'EventParameter',Term1,Term2,Term3},Bytes7}.

'enc_EventName'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_EventName'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end.

'enc_ObservedEvent'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,

%% attribute number 3 with type SEQUENCE OF
'enc_ObservedEvent_eventParList'(element(4,Val1)),
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type Externaltypereference493megaco_per_media_gateway_control_prev3aTimeNotation
'enc_TimeNotation'(Tmpval4)
end].
'enc_ObservedEvent_eventParList'(Val) ->
[

   encode_length(length(Val)),
   'enc_ObservedEvent_eventParList_components'(Val, [])
].
'enc_ObservedEvent_eventParList_components'([], Acc) -> lists:reverse(Acc);

'enc_ObservedEvent_eventParList_components'([H|T], Acc) ->
'enc_ObservedEvent_eventParList_components'(T, ['enc_EventParameter'(H)

 | Acc]).

'dec_ObservedEvent_eventParList'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ObservedEvent_eventParList_components'(V1@V0, V1@Buf1, []).

'dec_ObservedEvent_eventParList_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ObservedEvent_eventParList_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_EventParameter'(Bytes,telltype),
   'dec_ObservedEvent_eventParList_components'(Num-1, Remain, [Term|Acc]).


'dec_ObservedEvent'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SEQUENCE OF
{Term3,Bytes5} = 'dec_ObservedEvent_eventParList'(Bytes4, telltype),

%% attribute number 4 with type TimeNotation
{Term4,Bytes6} = case Opt band 1 of
1 ->
'dec_TimeNotation'(Bytes5,telltype);
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V5@V0,V5@Buf1} = case Bytes6 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'ObservedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_ObservedEventsDescriptor'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),

%% attribute number 2 with type SEQUENCE OF
'enc_ObservedEventsDescriptor_observedEventLst'(element(3,Val1))].
'enc_ObservedEventsDescriptor_observedEventLst'(Val) ->
[

   encode_length(length(Val)),
   'enc_ObservedEventsDescriptor_observedEventLst_components'(Val, [])
].
'enc_ObservedEventsDescriptor_observedEventLst_components'([], Acc) -> lists:reverse(Acc);

'enc_ObservedEventsDescriptor_observedEventLst_components'([H|T], Acc) ->
'enc_ObservedEventsDescriptor_observedEventLst_components'(T, ['enc_ObservedEvent'(H)

 | Acc]).

'dec_ObservedEventsDescriptor_observedEventLst'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ObservedEventsDescriptor_observedEventLst_components'(V1@V0, V1@Buf1, []).

'dec_ObservedEventsDescriptor_observedEventLst_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ObservedEventsDescriptor_observedEventLst_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_ObservedEvent'(Bytes,telltype),
   'dec_ObservedEventsDescriptor_observedEventLst_components'(Num-1, Remain, [Term|Acc]).


'dec_ObservedEventsDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/unsigned-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
{V1@V3,V1@Buf4}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes2} = 'dec_ObservedEventsDescriptor_observedEventLst'(Bytes1, telltype),
{{'ObservedEventsDescriptor',Term1,Term2},Bytes2}.

'enc_NotifyReply'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type Externaltypereference477megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference478megaco_per_media_gateway_control_prev3aErrorDescriptor
'enc_ErrorDescriptor'(Tmpval1)
end].


'dec_NotifyReply'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

%% attribute number 2 with type ErrorDescriptor
{Term2,Bytes4} = case Opt band 1 of
1 ->
'dec_ErrorDescriptor'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'NotifyReply',Term1,Term2},Bytes6}.

'enc_NotifyRequest'(Val) ->
Fixopt1 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type Externaltypereference469megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference470megaco_per_media_gateway_control_prev3aObservedEventsDescriptor
'enc_ObservedEventsDescriptor'(element(3,Val1)),
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type Externaltypereference471megaco_per_media_gateway_control_prev3aErrorDescriptor
'enc_ErrorDescriptor'(Tmpval1)
end].


'dec_NotifyRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

%% attribute number 2 with type ObservedEventsDescriptor
{Term2,Bytes4} = 'dec_ObservedEventsDescriptor'(Bytes3,telltype),

%% attribute number 3 with type ErrorDescriptor
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_ErrorDescriptor'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V3@V0,V3@Buf1} = case Bytes5 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'NotifyRequest',Term1,Term2,Term3},Bytes7}.

'enc_IndAudPackagesDescriptor'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      2 ->
        [[45,16,2]|Tmpval1];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  Tmpval2=element(3,Val1),
  case Tmpval2 of
    Tmpval3 when Tmpval3=<99,Tmpval3>=0 ->
      [10,7,Tmpval3- 0];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end].


'dec_IndAudPackagesDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
<<V2@V0:2/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = begin
<<V3@V0:7/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end,

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V4@V0,V4@Buf1} = case Bytes3 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'IndAudPackagesDescriptor',Term1,Term2},Bytes5}.

'enc_IndAudStatisticsDescriptor'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end].


'dec_IndAudStatisticsDescriptor'(Bytes,_) ->

%% attribute number 1 with type OCTET STRING
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end,
{{'IndAudStatisticsDescriptor',Term1},Bytes1}.

'enc_IndAudDigitMapDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval2 = Tmpval1,
    case length(Tmpval2) of
      2 ->
        [[45,16,2]|Tmpval2];
      _ ->
        exit({error,{value_out_of_bounds,Tmpval2}})
    end
  end
end].


'dec_IndAudDigitMapDescriptor'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = case Opt band 1 of
1 ->
begin
<<V2@V0:2/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes1}
end,
{{'IndAudDigitMapDescriptor',Term1},Bytes2}.

'enc_IndAudSignal'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end].


'dec_IndAudSignal'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V5@V0,V5@Buf1} = case Bytes4 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'IndAudSignal',Term1,Term2},Bytes6}.

'enc_IndAudSeqSigList'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereference440megaco_per_media_gateway_control_prev3aIndAudSignal
'enc_IndAudSignal'(Tmpval3)
end].


'dec_IndAudSeqSigList'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:2/unsigned-unit:8,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 2 with type IndAudSignal
{Term2,Bytes3} = case Opt band 1 of
1 ->
'dec_IndAudSignal'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'IndAudSeqSigList',Term1,Term2},Bytes3}.

'enc_IndAudSignalsDescriptor'(Val) ->
[
set_choice(element(1, Val), {[signal,seqSigList],[]}, {2,0}),
case element(1,Val) of
signal ->
'enc_IndAudSignal'(element(2, Val));
seqSigList ->
'enc_IndAudSeqSigList'(element(2, Val))
end
].


'dec_IndAudSignalsDescriptor'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_IndAudSignal'(Bytes2,telltype)
end,
{{signal,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_IndAudSeqSigList'(Bytes2,telltype)
end,
{{seqSigList,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_IndAudEventBufferDescriptor'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end].


'dec_IndAudEventBufferDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:4/binary-unit:8,V3@Buf1/bitstring>> = Bytes2,
V3@Conv4 = binary_to_list(V3@V0),
{V3@Conv4,V3@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band 1 of
1 ->
begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:2/unsigned-unit:8,V4@Buf1/bitstring>> = Bytes3,
{V4@V0,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V5@V0,V5@Buf1} = case Bytes4 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'IndAudEventBufferDescriptor',Term1,Term2},Bytes6}.

'enc_IndAudEventsDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval1)
end,

%% attribute number 2 with type OCTET STRING
  begin
    Tmpval2 = element(3,Val1),
    case length(Tmpval2) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval2];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval2}})
    end
  end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval3 of
    Tmpval4 when Tmpval4=<65535,Tmpval4>=0 ->
      [20,2,<<(Tmpval4- 0):16>>];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end
end].


'dec_IndAudEventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case (Opt bsr 1) band 1 of
1 ->
begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/unsigned-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
{V3@V3,V3@Buf4}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type OCTET STRING
{Term2,Bytes4} = begin
V4@Pad2 = bit_size(Bytes3) band 7,
<<_:V4@Pad2,V4@V0:4/binary-unit:8,V4@Buf1/bitstring>> = Bytes3,
V4@Conv4 = binary_to_list(V4@V0),
{V4@Conv4,V4@Buf1}
end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
V5@Pad2 = bit_size(Bytes4) band 7,
<<_:V5@Pad2,V5@V0:2/unsigned-unit:8,V5@Buf1/bitstring>> = Bytes4,
{V5@V0,V5@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V6@V0,V6@Buf1} = case Bytes5 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
V6@Pad6 = bit_size(V6@Buf2) band 7,
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:V6@Pad6,0:1,V6@V8:7,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9};
<<_:V6@Pad6,1:1,0:1,V6@V9:14,V6@Buf10/bitstring>> when V6@V9 =/= 0 ->
{V6@V9,V6@Buf10}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V11:V6@V0/bitstring-unit:1,V6@Buf12/bitstring>> = V6@Buf1,
{V6@V11,V6@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'IndAudEventsDescriptor',Term1,Term2,Term3},Bytes7}.

'enc_IndAudTerminationStateDescriptor'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_IndAudTerminationStateDescriptor_propertyParms'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type NULL
[]
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type NULL
[]
end].
'enc_IndAudTerminationStateDescriptor_propertyParms'(Val) ->
[

   encode_length(length(Val)),
   'enc_IndAudTerminationStateDescriptor_propertyParms_components'(Val, [])
].
'enc_IndAudTerminationStateDescriptor_propertyParms_components'([], Acc) -> lists:reverse(Acc);

'enc_IndAudTerminationStateDescriptor_propertyParms_components'([H|T], Acc) ->
'enc_IndAudTerminationStateDescriptor_propertyParms_components'(T, ['enc_IndAudPropertyParm'(H)

 | Acc]).

'dec_IndAudTerminationStateDescriptor_propertyParms'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_IndAudTerminationStateDescriptor_propertyParms_components'(V1@V0, V1@Buf1, []).

'dec_IndAudTerminationStateDescriptor_propertyParms_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_IndAudTerminationStateDescriptor_propertyParms_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAudPropertyParm'(Bytes,telltype),
   'dec_IndAudTerminationStateDescriptor_propertyParms_components'(Num-1, Remain, [Term|Acc]).


'dec_IndAudTerminationStateDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes3} = 'dec_IndAudTerminationStateDescriptor_propertyParms'(Bytes2, telltype),

%% attribute number 2 with type NULL
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes3}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
ignore,
{'NULL',Bytes4}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'IndAudTerminationStateDescriptor',Term1,Term2,Term3},Bytes7}.

'enc_IndAudPropertyGroup'(Val) ->
[

   encode_length(length(Val)),
   'enc_IndAudPropertyGroup_components'(Val, [])
].
'enc_IndAudPropertyGroup_components'([], Acc) -> lists:reverse(Acc);

'enc_IndAudPropertyGroup_components'([H|T], Acc) ->
'enc_IndAudPropertyGroup_components'(T, ['enc_IndAudPropertyParm'(H)

 | Acc]).


'dec_IndAudPropertyGroup'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_IndAudPropertyGroup_components'(V1@V0, V1@Buf1, []).

'dec_IndAudPropertyGroup_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_IndAudPropertyGroup_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAudPropertyParm'(Bytes,telltype),
   'dec_IndAudPropertyGroup_components'(Num-1, Remain, [Term|Acc]).
'enc_IndAudLocalRemoteDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end
end,

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aIndAudPropertyGroup
'enc_IndAudPropertyGroup'(element(3,Val1))].


'dec_IndAudLocalRemoteDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:2/unsigned-unit:8,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type IndAudPropertyGroup
{Term2,Bytes4} = 'dec_IndAudPropertyGroup'(Bytes3,telltype),

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V4@V0,V4@Buf1} = case Bytes4 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'IndAudLocalRemoteDescriptor',Term1,Term2},Bytes6}.

'enc_IndAudPropertyParm'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end].


'dec_IndAudPropertyParm'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:4/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv4 = binary_to_list(V2@V0),
{V2@Conv4,V2@Buf1}
end,

%% Extensions
{Extensions,Bytes3} = case Ext of
0 -> {<<>>,Bytes2};
1 ->
{V3@V0,V3@Buf1} = case Bytes2 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:7,0:1,V3@V7:7,V3@Buf8/bitstring>> when V3@V7 =/= 0 ->
{V3@V7,V3@Buf8};
<<_:7,1:1,0:1,V3@V8:14,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V10:V3@V0/bitstring-unit:1,V3@Buf11/bitstring>> = V3@Buf1,
{V3@V10,V3@Buf11}
end,
Bytes4= skipextensions(Bytes3, 1, Extensions),
{{'IndAudPropertyParm',Term1},Bytes4}.

'enc_IndAudLocalControlDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt4 = case element(5,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3,Fixopt4]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type NULL
[]
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type NULL
[]
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type NULL
[]
end,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type SEQUENCE OF
'enc_IndAudLocalControlDescriptor_propertyParms'(Tmpval4)
end].
'enc_IndAudLocalControlDescriptor_propertyParms'(Val) ->
[

   encode_length(length(Val)),
   'enc_IndAudLocalControlDescriptor_propertyParms_components'(Val, [])
].
'enc_IndAudLocalControlDescriptor_propertyParms_components'([], Acc) -> lists:reverse(Acc);

'enc_IndAudLocalControlDescriptor_propertyParms_components'([H|T], Acc) ->
'enc_IndAudLocalControlDescriptor_propertyParms_components'(T, ['enc_IndAudPropertyParm'(H)

 | Acc]).

'dec_IndAudLocalControlDescriptor_propertyParms'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_IndAudLocalControlDescriptor_propertyParms_components'(V1@V0, V1@Buf1, []).

'dec_IndAudLocalControlDescriptor_propertyParms_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_IndAudLocalControlDescriptor_propertyParms_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAudPropertyParm'(Bytes,telltype),
   'dec_IndAudLocalControlDescriptor_propertyParms_components'(Num-1, Remain, [Term|Acc]).


'dec_IndAudLocalControlDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:4,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type NULL
{Term1,Bytes3} = case (Opt bsr 3) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes2}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type NULL
{Term2,Bytes4} = case (Opt bsr 2) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes3}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case (Opt bsr 1) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes4}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = case Opt band 1 of
1 ->
'dec_IndAudLocalControlDescriptor_propertyParms'(Bytes5, telltype);
0 ->
{asn1_NOVALUE,Bytes5}
end,

%% Extensions
{Extensions,Bytes7} = case Ext of
0 -> {<<>>,Bytes6};
1 ->
{V6@V0,V6@Buf1} = case Bytes6 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
V6@Pad6 = bit_size(V6@Buf2) band 7,
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:V6@Pad6,0:1,V6@V8:7,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9};
<<_:V6@Pad6,1:1,0:1,V6@V9:14,V6@Buf10/bitstring>> when V6@V9 =/= 0 ->
{V6@V9,V6@Buf10}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V11:V6@V0/bitstring-unit:1,V6@Buf12/bitstring>> = V6@Buf1,
{V6@V11,V6@Buf12}
end,
Bytes8= skipextensions(Bytes7, 1, Extensions),
{{'IndAudLocalControlDescriptor',Term1,Term2,Term3,Term4},Bytes8}.

'enc_IndAudStreamParms'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
Extensions = fixextensions({ext,4,1}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aIndAudLocalControlDescriptor
'enc_IndAudLocalControlDescriptor'(Tmpval2)
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aIndAudLocalRemoteDescriptor
'enc_IndAudLocalRemoteDescriptor'(Tmpval3)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference378megaco_per_media_gateway_control_prev3aIndAudLocalRemoteDescriptor
'enc_IndAudLocalRemoteDescriptor'(Tmpval4)
end
,Extensions
,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aIndAudStatisticsDescriptor
encode_open_type(complete('enc_IndAudStatisticsDescriptor'(Tmpval5)))
end].


'dec_IndAudStreamParms'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type IndAudLocalControlDescriptor
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
'dec_IndAudLocalControlDescriptor'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type IndAudLocalRemoteDescriptor
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
'dec_IndAudLocalRemoteDescriptor'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type IndAudLocalRemoteDescriptor
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_IndAudLocalRemoteDescriptor'(Bytes4,telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V3@V0,V3@Buf1} = case Bytes5 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,

%% attribute number 4 with type IndAudStatisticsDescriptor
{Term4,Bytes7} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V4@Pad3 = bit_size(Bytes6) band 7,
{V4@V0,V4@Buf1} = case Bytes6 of
<<_:V4@Pad3,0:1,V4@V5:7,V4@Buf6/bitstring>> ->
{V4@V5,V4@Buf6};
<<_:V4@Pad3,1:1,0:1,V4@V6:14,V4@Buf7/bitstring>> ->
{V4@V6,V4@Buf7}
end,
<<V4@V8:V4@V0/binary-unit:8,V4@Buf9/bitstring>> = V4@Buf1,
{TmpValx4,_} = 'dec_IndAudStatisticsDescriptor'(V4@V8,telltype),
{TmpValx4,V4@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes6}
end,
Bytes8= skipextensions(Bytes7, 2, Extensions),
{{'IndAudStreamParms',Term1,Term2,Term3,Term4},Bytes8}.

'enc_IndAudStreamDescriptor'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,

%% attribute number 2 with type Externaltypereference371megaco_per_media_gateway_control_prev3aIndAudStreamParms
'enc_IndAudStreamParms'(element(3,Val1))].


'dec_IndAudStreamDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 2 with type IndAudStreamParms
{Term2,Bytes2} = 'dec_IndAudStreamParms'(Bytes1,telltype),
{{'IndAudStreamDescriptor',Term1,Term2},Bytes2}.

'enc_IndAudMediaDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3aIndAudTerminationStateDescriptor
'enc_IndAudTerminationStateDescriptor'(Tmpval1)
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type CHOICE
'enc_IndAudMediaDescriptor_streams'(Tmpval2)
end].
'enc_IndAudMediaDescriptor_streams'(Val) ->
[
set_choice(element(1, Val), [oneStream,multiStream], 2),
case element(1,Val) of
oneStream ->
'enc_IndAudStreamParms'(element(2, Val));
multiStream ->
'enc_IndAudMediaDescriptor_streams_multiStream'(element(2, Val))
end
].
'enc_IndAudMediaDescriptor_streams_multiStream'(Val) ->
[

   encode_length(length(Val)),
   'enc_IndAudMediaDescriptor_streams_multiStream_components'(Val, [])
].
'enc_IndAudMediaDescriptor_streams_multiStream_components'([], Acc) -> lists:reverse(Acc);

'enc_IndAudMediaDescriptor_streams_multiStream_components'([H|T], Acc) ->
'enc_IndAudMediaDescriptor_streams_multiStream_components'(T, ['enc_IndAudStreamDescriptor'(H)

 | Acc]).

'dec_IndAudMediaDescriptor_streams_multiStream'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_IndAudMediaDescriptor_streams_multiStream_components'(V1@V0, V1@Buf1, []).

'dec_IndAudMediaDescriptor_streams_multiStream_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_IndAudMediaDescriptor_streams_multiStream_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAudStreamDescriptor'(Bytes,telltype),
   'dec_IndAudMediaDescriptor_streams_multiStream_components'(Num-1, Remain, [Term|Acc]).

'dec_IndAudMediaDescriptor_streams'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_IndAudStreamParms'(Bytes1,telltype)
end,
{{oneStream,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_IndAudMediaDescriptor_streams_multiStream'(Bytes1, telltype)
end,
{{multiStream,Val},NewBytes}
end.


'dec_IndAudMediaDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type IndAudTerminationStateDescriptor
{Term1,Bytes3} = case (Opt bsr 1) band 1 of
1 ->
'dec_IndAudTerminationStateDescriptor'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type CHOICE
{Term2,Bytes4} = case Opt band 1 of
1 ->
'dec_IndAudMediaDescriptor_streams'(Bytes3, telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'IndAudMediaDescriptor',Term1,Term2},Bytes6}.

'enc_IndAuditParameter'(Val) ->
[
set_choice(element(1, Val), {[indAudMediaDescriptor,indAudEventsDescriptor,indAudEventBufferDescriptor,indAudSignalsDescriptor,indAudDigitMapDescriptor,indAudStatisticsDescriptor,indAudPackagesDescriptor],[]}, {7,0}),
case element(1,Val) of
indAudMediaDescriptor ->
'enc_IndAudMediaDescriptor'(element(2, Val));
indAudEventsDescriptor ->
'enc_IndAudEventsDescriptor'(element(2, Val));
indAudEventBufferDescriptor ->
'enc_IndAudEventBufferDescriptor'(element(2, Val));
indAudSignalsDescriptor ->
'enc_IndAudSignalsDescriptor'(element(2, Val));
indAudDigitMapDescriptor ->
'enc_IndAudDigitMapDescriptor'(element(2, Val));
indAudStatisticsDescriptor ->
'enc_IndAudStatisticsDescriptor'(element(2, Val));
indAudPackagesDescriptor ->
'enc_IndAudPackagesDescriptor'(element(2, Val))
end
].


'dec_IndAuditParameter'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_IndAudMediaDescriptor'(Bytes2,telltype)
end,
{{indAudMediaDescriptor,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_IndAudEventsDescriptor'(Bytes2,telltype)
end,
{{indAudEventsDescriptor,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_IndAudEventBufferDescriptor'(Bytes2,telltype)
end,
{{indAudEventBufferDescriptor,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_IndAudSignalsDescriptor'(Bytes2,telltype)
end,
{{indAudSignalsDescriptor,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
'dec_IndAudDigitMapDescriptor'(Bytes2,telltype)
end,
{{indAudDigitMapDescriptor,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
'dec_IndAudStatisticsDescriptor'(Bytes2,telltype)
end,
{{indAudStatisticsDescriptor,Val},NewBytes};
6 ->
{Val,NewBytes} = begin
'dec_IndAudPackagesDescriptor'(Bytes2,telltype)
end,
{{indAudPackagesDescriptor,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_AuditDescriptor'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
Extensions = fixextensions({ext,2,1}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type BIT STRING
encode_bit_string(no, Tmpval2, [{muxToken,0},{modemToken,1},{mediaToken,2},{eventsToken,3},{signalsToken,4},{digitMapToken,5},{statsToken,6},{observedEventsToken,7},{packagesToken,8},{eventBufferToken,9}])
end
,Extensions
,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type SEQUENCE OF
encode_open_type(complete('enc_AuditDescriptor_auditPropertyToken'(Tmpval3)))
end].
'enc_AuditDescriptor_auditPropertyToken'(Val) ->
[

   encode_length(length(Val)),
   'enc_AuditDescriptor_auditPropertyToken_components'(Val, [])
].
'enc_AuditDescriptor_auditPropertyToken_components'([], Acc) -> lists:reverse(Acc);

'enc_AuditDescriptor_auditPropertyToken_components'([H|T], Acc) ->
'enc_AuditDescriptor_auditPropertyToken_components'(T, ['enc_IndAuditParameter'(H)

 | Acc]).

'dec_AuditDescriptor_auditPropertyToken'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_AuditDescriptor_auditPropertyToken_components'(V1@V0, V1@Buf1, []).

'dec_AuditDescriptor_auditPropertyToken_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_AuditDescriptor_auditPropertyToken_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAuditParameter'(Bytes,telltype),
   'dec_AuditDescriptor_auditPropertyToken_components'(Num-1, Remain, [Term|Acc]).


'dec_AuditDescriptor'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type BIT STRING
{Term1,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad3 = bit_size(Bytes2) band 7,
{V3@V0,V3@Buf1} = case Bytes2 of
<<_:V3@Pad3,0:1,V3@V5:7,V3@V7:V3@V5/binary-unit:1,V3@Buf8/bitstring>> ->
{V3@V7,V3@Buf8};
<<_:V3@Pad3,1:1,0:1,V3@V6:14,V3@V8:V3@V6/binary-unit:1,V3@Buf9/bitstring>> ->
{V3@V8,V3@Buf9};
<<_:V3@Pad3,1:1,1:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V8,V3@Buf9}  = decode_fragmented(V3@V6, V3@Buf7, 1),
{V3@V8,V3@Buf9}
end,
{V3@V10,V3@Buf11}  = {decode_named_bit_string(V3@V0, [{muxToken,0},{modemToken,1},{mediaToken,2},{eventsToken,3},{signalsToken,4},{digitMapToken,5},{statsToken,6},{observedEventsToken,7},{packagesToken,8},{eventBufferToken,9}]),V3@Buf1},
{V3@V10,V3@Buf11}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V4@V0,V4@Buf1} = case Bytes3 of
<<0:1,V4@V3:6,V4@Buf4/bitstring>> ->
V4@Add5 = V4@V3 + 1,
{V4@Add5,V4@Buf4};
<<1:1,V4@Buf2/bitstring>> ->
V4@Pad6 = bit_size(V4@Buf2) band 7,
{V4@V3,V4@Buf4} = case V4@Buf2 of
<<_:V4@Pad6,0:1,V4@V8:7,V4@Buf9/bitstring>> when V4@V8 =/= 0 ->
{V4@V8,V4@Buf9};
<<_:V4@Pad6,1:1,0:1,V4@V9:14,V4@Buf10/bitstring>> when V4@V9 =/= 0 ->
{V4@V9,V4@Buf10}
end,
{V4@V3,V4@Buf4}
end,
<<V4@V11:V4@V0/bitstring-unit:1,V4@Buf12/bitstring>> = V4@Buf1,
{V4@V11,V4@Buf12}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes5} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V5@Pad3 = bit_size(Bytes4) band 7,
{V5@V0,V5@Buf1} = case Bytes4 of
<<_:V5@Pad3,0:1,V5@V5:7,V5@Buf6/bitstring>> ->
{V5@V5,V5@Buf6};
<<_:V5@Pad3,1:1,0:1,V5@V6:14,V5@Buf7/bitstring>> ->
{V5@V6,V5@Buf7}
end,
<<V5@V8:V5@V0/binary-unit:8,V5@Buf9/bitstring>> = V5@Buf1,
{TmpValx2,_} = 'dec_AuditDescriptor_auditPropertyToken'(V5@V8, telltype),
{TmpValx2,V5@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes4}
end,
Bytes6= skipextensions(Bytes5, 2, Extensions),
{{'AuditDescriptor',Term1,Term2},Bytes6}.

'enc_AuditReturnParameter'(Val) ->
[
set_choice(element(1, Val), {[errorDescriptor,mediaDescriptor,modemDescriptor,muxDescriptor,eventsDescriptor,eventBufferDescriptor,signalsDescriptor,digitMapDescriptor,observedEventsDescriptor,statisticsDescriptor,packagesDescriptor,emptyDescriptors],[]}, {12,0}),
case element(1,Val) of
errorDescriptor ->
'enc_ErrorDescriptor'(element(2, Val));
mediaDescriptor ->
'enc_MediaDescriptor'(element(2, Val));
modemDescriptor ->
'enc_ModemDescriptor'(element(2, Val));
muxDescriptor ->
'enc_MuxDescriptor'(element(2, Val));
eventsDescriptor ->
'enc_EventsDescriptor'(element(2, Val));
eventBufferDescriptor ->
'enc_EventBufferDescriptor'(element(2, Val));
signalsDescriptor ->
'enc_SignalsDescriptor'(element(2, Val));
digitMapDescriptor ->
'enc_DigitMapDescriptor'(element(2, Val));
observedEventsDescriptor ->
'enc_ObservedEventsDescriptor'(element(2, Val));
statisticsDescriptor ->
'enc_StatisticsDescriptor'(element(2, Val));
packagesDescriptor ->
'enc_PackagesDescriptor'(element(2, Val));
emptyDescriptors ->
'enc_AuditDescriptor'(element(2, Val))
end
].


'dec_AuditReturnParameter'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:4/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_ErrorDescriptor'(Bytes2,telltype)
end,
{{errorDescriptor,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_MediaDescriptor'(Bytes2,telltype)
end,
{{mediaDescriptor,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_ModemDescriptor'(Bytes2,telltype)
end,
{{modemDescriptor,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_MuxDescriptor'(Bytes2,telltype)
end,
{{muxDescriptor,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
'dec_EventsDescriptor'(Bytes2,telltype)
end,
{{eventsDescriptor,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
'dec_EventBufferDescriptor'(Bytes2,telltype)
end,
{{eventBufferDescriptor,Val},NewBytes};
6 ->
{Val,NewBytes} = begin
'dec_SignalsDescriptor'(Bytes2,telltype)
end,
{{signalsDescriptor,Val},NewBytes};
7 ->
{Val,NewBytes} = begin
'dec_DigitMapDescriptor'(Bytes2,telltype)
end,
{{digitMapDescriptor,Val},NewBytes};
8 ->
{Val,NewBytes} = begin
'dec_ObservedEventsDescriptor'(Bytes2,telltype)
end,
{{observedEventsDescriptor,Val},NewBytes};
9 ->
{Val,NewBytes} = begin
'dec_StatisticsDescriptor'(Bytes2,telltype)
end,
{{statisticsDescriptor,Val},NewBytes};
10 ->
{Val,NewBytes} = begin
'dec_PackagesDescriptor'(Bytes2,telltype)
end,
{{packagesDescriptor,Val},NewBytes};
11 ->
{Val,NewBytes} = begin
'dec_AuditDescriptor'(Bytes2,telltype)
end,
{{emptyDescriptors,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_TerminationAudit'(Val) ->
[

   encode_length(length(Val)),
   'enc_TerminationAudit_components'(Val, [])
].
'enc_TerminationAudit_components'([], Acc) -> lists:reverse(Acc);

'enc_TerminationAudit_components'([H|T], Acc) ->
'enc_TerminationAudit_components'(T, ['enc_AuditReturnParameter'(H)

 | Acc]).


'dec_TerminationAudit'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TerminationAudit_components'(V1@V0, V1@Buf1, []).

'dec_TerminationAudit_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TerminationAudit_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_AuditReturnParameter'(Bytes,telltype),
   'dec_TerminationAudit_components'(Num-1, Remain, [Term|Acc]).
'enc_AuditResult'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type Externaltypereference302megaco_per_media_gateway_control_prev3aTerminationID
'enc_TerminationID'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference303megaco_per_media_gateway_control_prev3aTerminationAudit
'enc_TerminationAudit'(element(3,Val1))].


'dec_AuditResult'(Bytes,_) ->

%% attribute number 1 with type TerminationID
{Term1,Bytes1} = 'dec_TerminationID'(Bytes,telltype),

%% attribute number 2 with type TerminationAudit
{Term2,Bytes2} = 'dec_TerminationAudit'(Bytes1,telltype),
{{'AuditResult',Term1,Term2},Bytes2}.

'enc_AuditReply'(Val) ->
[
set_choice(element(1, Val), {[contextAuditResult,error,auditResult],[]}, {3,0}),
case element(1,Val) of
contextAuditResult ->
'enc_TerminationIDList'(element(2, Val));
error ->
'enc_ErrorDescriptor'(element(2, Val));
auditResult ->
'enc_AuditResult'(element(2, Val))
end
].


'dec_AuditReply'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_TerminationIDList'(Bytes2,telltype)
end,
{{contextAuditResult,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_ErrorDescriptor'(Bytes2,telltype)
end,
{{error,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_AuditResult'(Bytes2,telltype)
end,
{{auditResult,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_AuditRequest'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type Externaltypereference286megaco_per_media_gateway_control_prev3aTerminationID
'enc_TerminationID'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference287megaco_per_media_gateway_control_prev3aAuditDescriptor
'enc_AuditDescriptor'(element(3,Val1))].


'dec_AuditRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type TerminationID
{Term1,Bytes2} = 'dec_TerminationID'(Bytes1,telltype),

%% attribute number 2 with type AuditDescriptor
{Term2,Bytes3} = 'dec_AuditDescriptor'(Bytes2,telltype),

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V2@V0,V2@Buf1} = case Bytes3 of
<<0:1,V2@V3:6,V2@Buf4/bitstring>> ->
V2@Add5 = V2@V3 + 1,
{V2@Add5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
V2@Pad6 = bit_size(V2@Buf2) band 7,
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<_:V2@Pad6,0:1,V2@V8:7,V2@Buf9/bitstring>> when V2@V8 =/= 0 ->
{V2@V8,V2@Buf9};
<<_:V2@Pad6,1:1,0:1,V2@V9:14,V2@Buf10/bitstring>> when V2@V9 =/= 0 ->
{V2@V9,V2@Buf10}
end,
{V2@V3,V2@Buf4}
end,
<<V2@V11:V2@V0/bitstring-unit:1,V2@Buf12/bitstring>> = V2@Buf1,
{V2@V11,V2@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'AuditRequest',Term1,Term2},Bytes5}.

'enc_SubtractRequest'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type Externaltypereference279megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference280megaco_per_media_gateway_control_prev3aAuditDescriptor
'enc_AuditDescriptor'(Tmpval1)
end].


'dec_SubtractRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

%% attribute number 2 with type AuditDescriptor
{Term2,Bytes4} = case Opt band 1 of
1 ->
'dec_AuditDescriptor'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'SubtractRequest',Term1,Term2},Bytes6}.

'enc_AmmsReply'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
setext(false), Opt,

%% attribute number 1 with type Externaltypereference272megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference273megaco_per_media_gateway_control_prev3aTerminationAudit
'enc_TerminationAudit'(Tmpval1)
end].


'dec_AmmsReply'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

%% attribute number 2 with type TerminationAudit
{Term2,Bytes4} = case Opt band 1 of
1 ->
'dec_TerminationAudit'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'AmmsReply',Term1,Term2},Bytes6}.

'enc_AmmDescriptor'(Val) ->
[
set_choice(element(1, Val), {[mediaDescriptor,modemDescriptor,muxDescriptor,eventsDescriptor,eventBufferDescriptor,signalsDescriptor,digitMapDescriptor,auditDescriptor],[statisticsDescriptor]}, {8,1}),
case element(1,Val) of
mediaDescriptor ->
'enc_MediaDescriptor'(element(2, Val));
modemDescriptor ->
'enc_ModemDescriptor'(element(2, Val));
muxDescriptor ->
'enc_MuxDescriptor'(element(2, Val));
eventsDescriptor ->
'enc_EventsDescriptor'(element(2, Val));
eventBufferDescriptor ->
'enc_EventBufferDescriptor'(element(2, Val));
signalsDescriptor ->
'enc_SignalsDescriptor'(element(2, Val));
digitMapDescriptor ->
'enc_DigitMapDescriptor'(element(2, Val));
auditDescriptor ->
'enc_AuditDescriptor'(element(2, Val));
statisticsDescriptor ->
encode_open_type(complete('enc_StatisticsDescriptor'(element(2, Val))))
end
].


'dec_AmmDescriptor'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_MediaDescriptor'(Bytes2,telltype)
end,
{{mediaDescriptor,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_ModemDescriptor'(Bytes2,telltype)
end,
{{modemDescriptor,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_MuxDescriptor'(Bytes2,telltype)
end,
{{muxDescriptor,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_EventsDescriptor'(Bytes2,telltype)
end,
{{eventsDescriptor,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
'dec_EventBufferDescriptor'(Bytes2,telltype)
end,
{{eventBufferDescriptor,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
'dec_SignalsDescriptor'(Bytes2,telltype)
end,
{{signalsDescriptor,Val},NewBytes};
6 ->
{Val,NewBytes} = begin
'dec_DigitMapDescriptor'(Bytes2,telltype)
end,
{{digitMapDescriptor,Val},NewBytes};
7 ->
{Val,NewBytes} = begin
'dec_AuditDescriptor'(Bytes2,telltype)
end,
{{auditDescriptor,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
0 ->
{Val,NewBytes} = begin
{TmpVal,_} = 'dec_StatisticsDescriptor'(V2@V8,telltype),
{TmpVal,V2@Buf9}
end,
{{statisticsDescriptor,Val},NewBytes};
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_AmmRequest'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type Externaltypereference248megaco_per_media_gateway_control_prev3aTerminationIDList
'enc_TerminationIDList'(element(2,Val1)),

%% attribute number 2 with type SEQUENCE OF
'enc_AmmRequest_descriptors'(element(3,Val1))].
'enc_AmmRequest_descriptors'(Val) ->
[

   encode_length(length(Val)),
   'enc_AmmRequest_descriptors_components'(Val, [])
].
'enc_AmmRequest_descriptors_components'([], Acc) -> lists:reverse(Acc);

'enc_AmmRequest_descriptors_components'([H|T], Acc) ->
'enc_AmmRequest_descriptors_components'(T, ['enc_AmmDescriptor'(H)

 | Acc]).

'dec_AmmRequest_descriptors'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_AmmRequest_descriptors_components'(V1@V0, V1@Buf1, []).

'dec_AmmRequest_descriptors_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_AmmRequest_descriptors_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_AmmDescriptor'(Bytes,telltype),
   'dec_AmmRequest_descriptors_components'(Num-1, Remain, [Term|Acc]).


'dec_AmmRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type TerminationIDList
{Term1,Bytes2} = 'dec_TerminationIDList'(Bytes1,telltype),

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes3} = 'dec_AmmRequest_descriptors'(Bytes2, telltype),

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V2@V0,V2@Buf1} = case Bytes3 of
<<0:1,V2@V3:6,V2@Buf4/bitstring>> ->
V2@Add5 = V2@V3 + 1,
{V2@Add5,V2@Buf4};
<<1:1,V2@Buf2/bitstring>> ->
V2@Pad6 = bit_size(V2@Buf2) band 7,
{V2@V3,V2@Buf4} = case V2@Buf2 of
<<_:V2@Pad6,0:1,V2@V8:7,V2@Buf9/bitstring>> when V2@V8 =/= 0 ->
{V2@V8,V2@Buf9};
<<_:V2@Pad6,1:1,0:1,V2@V9:14,V2@Buf10/bitstring>> when V2@V9 =/= 0 ->
{V2@V9,V2@Buf10}
end,
{V2@V3,V2@Buf4}
end,
<<V2@V11:V2@V0/bitstring-unit:1,V2@Buf12/bitstring>> = V2@Buf1,
{V2@V11,V2@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'AmmRequest',Term1,Term2},Bytes5}.

'enc_TopologyRequest'(Val) ->
Val1 = Val,
Extensions = fixextensions({ext,4,1}, Val1),
[
setext(Extensions =/= []), 
%% attribute number 1 with type Externaltypereference234megaco_per_media_gateway_control_prev3aTerminationID
'enc_TerminationID'(element(2,Val1)),

%% attribute number 2 with type Externaltypereference235megaco_per_media_gateway_control_prev3aTerminationID
'enc_TerminationID'(element(3,Val1)),

%% attribute number 3 with type ENUMERATED
case element(4,Val1) of
'bothway' -> [10,2,0];
'isolate' -> [10,2,1];
'oneway' -> [10,2,2];
EnumVal -> exit({error,{asn1,{enumerated_not_in_range, EnumVal}}})
end
,Extensions
, case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 4 with type INTEGER
encode_open_type(complete(  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end))
end].


'dec_TopologyRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type TerminationID
{Term1,Bytes2} = 'dec_TerminationID'(Bytes1,telltype),

%% attribute number 2 with type TerminationID
{Term2,Bytes3} = 'dec_TerminationID'(Bytes2,telltype),

%% attribute number 3 with type ENUMERATED
{Term3,Bytes4} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes3,
V2@Int2 = case V2@V0 of
0 -> bothway;
1 -> isolate;
2 -> oneway;
_ -> exit({error,{asn1,{decode_enumerated,{V2@V0,[bothway,isolate,oneway]}}}})
end,
{V2@Int2,V2@Buf1}
end,

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,

%% attribute number 4 with type INTEGER
{Term4,Bytes6} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V4@Pad3 = bit_size(Bytes5) band 7,
{V4@V0,V4@Buf1} = case Bytes5 of
<<_:V4@Pad3,0:1,V4@V5:7,V4@Buf6/bitstring>> ->
{V4@V5,V4@Buf6};
<<_:V4@Pad3,1:1,0:1,V4@V6:14,V4@Buf7/bitstring>> ->
{V4@V6,V4@Buf7}
end,
<<V4@V8:V4@V0/binary-unit:8,V4@Buf9/bitstring>> = V4@Buf1,
{TmpValx4,_} = begin
V5@Pad2 = bit_size(V4@V8) band 7,
<<_:V5@Pad2,V5@V0:2/unsigned-unit:8,V5@Buf1/bitstring>> = V4@V8,
{V5@V0,V5@Buf1}
end,
{TmpValx4,V4@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes5}
end,
Bytes7= skipextensions(Bytes6, 2, Extensions),
{{'TopologyRequest',Term1,Term2,Term3,Term4},Bytes7}.

'enc_CommandReply'(Val) ->
[
set_choice(element(1, Val), {[addReply,moveReply,modReply,subtractReply,auditCapReply,auditValueReply,notifyReply,serviceChangeReply],[]}, {8,0}),
case element(1,Val) of
addReply ->
'enc_AmmsReply'(element(2, Val));
moveReply ->
'enc_AmmsReply'(element(2, Val));
modReply ->
'enc_AmmsReply'(element(2, Val));
subtractReply ->
'enc_AmmsReply'(element(2, Val));
auditCapReply ->
'enc_AuditReply'(element(2, Val));
auditValueReply ->
'enc_AuditReply'(element(2, Val));
notifyReply ->
'enc_NotifyReply'(element(2, Val));
serviceChangeReply ->
'enc_ServiceChangeReply'(element(2, Val))
end
].


'dec_CommandReply'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_AmmsReply'(Bytes2,telltype)
end,
{{addReply,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_AmmsReply'(Bytes2,telltype)
end,
{{moveReply,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_AmmsReply'(Bytes2,telltype)
end,
{{modReply,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_AmmsReply'(Bytes2,telltype)
end,
{{subtractReply,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
'dec_AuditReply'(Bytes2,telltype)
end,
{{auditCapReply,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
'dec_AuditReply'(Bytes2,telltype)
end,
{{auditValueReply,Val},NewBytes};
6 ->
{Val,NewBytes} = begin
'dec_NotifyReply'(Bytes2,telltype)
end,
{{notifyReply,Val},NewBytes};
7 ->
{Val,NewBytes} = begin
'dec_ServiceChangeReply'(Bytes2,telltype)
end,
{{serviceChangeReply,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_Command'(Val) ->
[
set_choice(element(1, Val), {[addReq,moveReq,modReq,subtractReq,auditCapRequest,auditValueRequest,notifyReq,serviceChangeReq],[]}, {8,0}),
case element(1,Val) of
addReq ->
'enc_AmmRequest'(element(2, Val));
moveReq ->
'enc_AmmRequest'(element(2, Val));
modReq ->
'enc_AmmRequest'(element(2, Val));
subtractReq ->
'enc_SubtractRequest'(element(2, Val));
auditCapRequest ->
'enc_AuditRequest'(element(2, Val));
auditValueRequest ->
'enc_AuditRequest'(element(2, Val));
notifyReq ->
'enc_NotifyRequest'(element(2, Val));
serviceChangeReq ->
'enc_ServiceChangeRequest'(element(2, Val))
end
].


'dec_Command'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_AmmRequest'(Bytes2,telltype)
end,
{{addReq,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_AmmRequest'(Bytes2,telltype)
end,
{{moveReq,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_AmmRequest'(Bytes2,telltype)
end,
{{modReq,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_SubtractRequest'(Bytes2,telltype)
end,
{{subtractReq,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
'dec_AuditRequest'(Bytes2,telltype)
end,
{{auditCapRequest,Val},NewBytes};
5 ->
{Val,NewBytes} = begin
'dec_AuditRequest'(Bytes2,telltype)
end,
{{auditValueRequest,Val},NewBytes};
6 ->
{Val,NewBytes} = begin
'dec_NotifyRequest'(Bytes2,telltype)
end,
{{notifyReq,Val},NewBytes};
7 ->
{Val,NewBytes} = begin
'dec_ServiceChangeRequest'(Bytes2,telltype)
end,
{{serviceChangeReq,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_CommandRequest'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
setext(false), Opt,

%% attribute number 1 with type Externaltypereference198megaco_per_media_gateway_control_prev3aCommand
'enc_Command'(element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type NULL
[]
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type NULL
[]
end].


'dec_CommandRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:2,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type Command
{Term1,Bytes3} = 'dec_Command'(Bytes2,telltype),

%% attribute number 2 with type NULL
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes3}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
ignore,
{'NULL',Bytes4}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,
Bytes7= skipextensions(Bytes6, 1, Extensions),
{{'CommandRequest',Term1,Term2,Term3},Bytes7}.

'enc_ContextAttrAuditRequest'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
Extensions = fixextensions({ext,4,2}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type NULL
[]
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type NULL
[]
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type NULL
[]
end
,Extensions
,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type NULL
encode_open_type(complete([]))
end,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type SEQUENCE OF
encode_open_type(complete('enc_ContextAttrAuditRequest_contextPropAud'(Tmpval6)))
end].
'enc_ContextAttrAuditRequest_contextPropAud'(Val) ->
[

   encode_length(length(Val)),
   'enc_ContextAttrAuditRequest_contextPropAud_components'(Val, [])
].
'enc_ContextAttrAuditRequest_contextPropAud_components'([], Acc) -> lists:reverse(Acc);

'enc_ContextAttrAuditRequest_contextPropAud_components'([H|T], Acc) ->
'enc_ContextAttrAuditRequest_contextPropAud_components'(T, ['enc_IndAudPropertyParm'(H)

 | Acc]).

'dec_ContextAttrAuditRequest_contextPropAud'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ContextAttrAuditRequest_contextPropAud_components'(V1@V0, V1@Buf1, []).

'dec_ContextAttrAuditRequest_contextPropAud_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ContextAttrAuditRequest_contextPropAud_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_IndAudPropertyParm'(Bytes,telltype),
   'dec_ContextAttrAuditRequest_contextPropAud_components'(Num-1, Remain, [Term|Acc]).


'dec_ContextAttrAuditRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type NULL
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes2}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type NULL
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
ignore,
{'NULL',Bytes3}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band 1 of
1 ->
begin
ignore,
{'NULL',Bytes4}
end;
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V6@V0,V6@Buf1} = case Bytes5 of
<<0:1,V6@V3:6,V6@Buf4/bitstring>> ->
V6@Add5 = V6@V3 + 1,
{V6@Add5,V6@Buf4};
<<1:1,V6@Buf2/bitstring>> ->
V6@Pad6 = bit_size(V6@Buf2) band 7,
{V6@V3,V6@Buf4} = case V6@Buf2 of
<<_:V6@Pad6,0:1,V6@V8:7,V6@Buf9/bitstring>> when V6@V8 =/= 0 ->
{V6@V8,V6@Buf9};
<<_:V6@Pad6,1:1,0:1,V6@V9:14,V6@Buf10/bitstring>> when V6@V9 =/= 0 ->
{V6@V9,V6@Buf10}
end,
{V6@V3,V6@Buf4}
end,
<<V6@V11:V6@V0/bitstring-unit:1,V6@Buf12/bitstring>> = V6@Buf1,
{V6@V11,V6@Buf12}
end,

%% attribute number 4 with type NULL
{Term4,Bytes7} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V7@Pad3 = bit_size(Bytes6) band 7,
{V7@V0,V7@Buf1} = case Bytes6 of
<<_:V7@Pad3,0:1,V7@V5:7,V7@Buf6/bitstring>> ->
{V7@V5,V7@Buf6};
<<_:V7@Pad3,1:1,0:1,V7@V6:14,V7@Buf7/bitstring>> ->
{V7@V6,V7@Buf7}
end,
<<V7@V8:V7@V0/binary-unit:8,V7@Buf9/bitstring>> = V7@Buf1,
{TmpValx4,_} = begin
ignore,
{'NULL',V7@V8}
end,
{TmpValx4,V7@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes6}
end,

%% attribute number 5 with type SEQUENCE OF
{Term5,Bytes8} = case Extensions of
  <<_:1,1:1,_/bitstring>> ->
begin
V9@Pad3 = bit_size(Bytes7) band 7,
{V9@V0,V9@Buf1} = case Bytes7 of
<<_:V9@Pad3,0:1,V9@V5:7,V9@Buf6/bitstring>> ->
{V9@V5,V9@Buf6};
<<_:V9@Pad3,1:1,0:1,V9@V6:14,V9@Buf7/bitstring>> ->
{V9@V6,V9@Buf7}
end,
<<V9@V8:V9@V0/binary-unit:8,V9@Buf9/bitstring>> = V9@Buf1,
{TmpValx5,_} = 'dec_ContextAttrAuditRequest_contextPropAud'(V9@V8, telltype),
{TmpValx5,V9@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes7}
end,
Bytes9= skipextensions(Bytes8, 3, Extensions),
{{'ContextAttrAuditRequest',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_ContextRequest'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt3 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2,Fixopt3]},
Extensions = fixextensions({ext,4,2}, Val1),
[
setext(Extensions =/= []), Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,15},16,{bits,4}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<15,Tmpval3>=0 ->
      [10,4,Tmpval3- 0];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 2 with type BOOLEAN
case Tmpval4 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval4}}})
end
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 3 with type SEQUENCE OF
'enc_ContextRequest_topologyReq'(Tmpval5)
end
,Extensions
,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 4 with type BOOLEAN
encode_open_type(complete(case Tmpval6 of
  true -> [1];
  false -> [0];
  _ -> exit({error,{asn1,{encode_boolean,Tmpval6}}})
end))
end,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 5 with type SEQUENCE OF
encode_open_type(complete('enc_ContextRequest_contextProp'(Tmpval7)))
end].
'enc_ContextRequest_topologyReq'(Val) ->
[

   encode_length(length(Val)),
   'enc_ContextRequest_topologyReq_components'(Val, [])
].
'enc_ContextRequest_topologyReq_components'([], Acc) -> lists:reverse(Acc);

'enc_ContextRequest_topologyReq_components'([H|T], Acc) ->
'enc_ContextRequest_topologyReq_components'(T, ['enc_TopologyRequest'(H)

 | Acc]).

'dec_ContextRequest_topologyReq'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ContextRequest_topologyReq_components'(V1@V0, V1@Buf1, []).

'dec_ContextRequest_topologyReq_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ContextRequest_topologyReq_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_TopologyRequest'(Bytes,telltype),
   'dec_ContextRequest_topologyReq_components'(Num-1, Remain, [Term|Acc]).
'enc_ContextRequest_contextProp'(Val) ->
[

   encode_length(length(Val)),
   'enc_ContextRequest_contextProp_components'(Val, [])
].
'enc_ContextRequest_contextProp_components'([], Acc) -> lists:reverse(Acc);

'enc_ContextRequest_contextProp_components'([H|T], Acc) ->
'enc_ContextRequest_contextProp_components'(T, ['enc_PropertyParm'(H)

 | Acc]).

'dec_ContextRequest_contextProp'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ContextRequest_contextProp_components'(V1@V0, V1@Buf1, []).

'dec_ContextRequest_contextProp_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ContextRequest_contextProp_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_PropertyParm'(Bytes,telltype),
   'dec_ContextRequest_contextProp_components'(Num-1, Remain, [Term|Acc]).


'dec_ContextRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:3,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case (Opt bsr 2) band 1 of
1 ->
begin
<<V3@V0:4/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 2 with type BOOLEAN
{Term2,Bytes4} = case (Opt bsr 1) band 1 of
1 ->
begin
<<V4@V0:1,V4@Buf1/bitstring>> = Bytes3,
V4@Int2 = case V4@V0 of
0 -> false;
1 -> true
end,
{V4@Int2,V4@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type SEQUENCE OF
{Term3,Bytes5} = case Opt band 1 of
1 ->
'dec_ContextRequest_topologyReq'(Bytes4, telltype);
0 ->
{asn1_NOVALUE,Bytes4}
end,

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,

%% attribute number 4 with type BOOLEAN
{Term4,Bytes7} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V6@Pad3 = bit_size(Bytes6) band 7,
{V6@V0,V6@Buf1} = case Bytes6 of
<<_:V6@Pad3,0:1,V6@V5:7,V6@Buf6/bitstring>> ->
{V6@V5,V6@Buf6};
<<_:V6@Pad3,1:1,0:1,V6@V6:14,V6@Buf7/bitstring>> ->
{V6@V6,V6@Buf7}
end,
<<V6@V8:V6@V0/binary-unit:8,V6@Buf9/bitstring>> = V6@Buf1,
{TmpValx4,_} = begin
<<V7@V0:1,V7@Buf1/bitstring>> = V6@V8,
V7@Int2 = case V7@V0 of
0 -> false;
1 -> true
end,
{V7@Int2,V7@Buf1}
end,
{TmpValx4,V6@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes6}
end,

%% attribute number 5 with type SEQUENCE OF
{Term5,Bytes8} = case Extensions of
  <<_:1,1:1,_/bitstring>> ->
begin
V8@Pad3 = bit_size(Bytes7) band 7,
{V8@V0,V8@Buf1} = case Bytes7 of
<<_:V8@Pad3,0:1,V8@V5:7,V8@Buf6/bitstring>> ->
{V8@V5,V8@Buf6};
<<_:V8@Pad3,1:1,0:1,V8@V6:14,V8@Buf7/bitstring>> ->
{V8@V6,V8@Buf7}
end,
<<V8@V8:V8@V0/binary-unit:8,V8@Buf9/bitstring>> = V8@Buf1,
{TmpValx5,_} = 'dec_ContextRequest_contextProp'(V8@V8, telltype),
{TmpValx5,V8@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes7}
end,
Bytes9= skipextensions(Bytes8, 3, Extensions),
{{'ContextRequest',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_ActionReply'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference171megaco_per_media_gateway_control_prev3aErrorDescriptor
'enc_ErrorDescriptor'(Tmpval1)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type Externaltypereference172megaco_per_media_gateway_control_prev3aContextRequest
'enc_ContextRequest'(Tmpval2)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_ActionReply_commandReply'(element(5,Val1))].
'enc_ActionReply_commandReply'(Val) ->
[

   encode_length(length(Val)),
   'enc_ActionReply_commandReply_components'(Val, [])
].
'enc_ActionReply_commandReply_components'([], Acc) -> lists:reverse(Acc);

'enc_ActionReply_commandReply_components'([H|T], Acc) ->
'enc_ActionReply_commandReply_components'(T, ['enc_CommandReply'(H)

 | Acc]).

'dec_ActionReply_commandReply'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ActionReply_commandReply_components'(V1@V0, V1@Buf1, []).

'dec_ActionReply_commandReply_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ActionReply_commandReply_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_CommandReply'(Bytes,telltype),
   'dec_ActionReply_commandReply_components'(Num-1, Remain, [Term|Acc]).


'dec_ActionReply'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:2,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/unsigned-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
{V2@V3,V2@Buf4}
end,

%% attribute number 2 with type ErrorDescriptor
{Term2,Bytes3} = case (Opt bsr 1) band 1 of
1 ->
'dec_ErrorDescriptor'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 3 with type ContextRequest
{Term3,Bytes4} = case Opt band 1 of
1 ->
'dec_ContextRequest'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes5} = 'dec_ActionReply_commandReply'(Bytes4, telltype),
{{'ActionReply',Term1,Term2,Term3,Term4},Bytes5}.

'enc_ActionRequest'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
Fixopt2 = case element(4,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1,Fixopt2]},
[
Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference163megaco_per_media_gateway_control_prev3aContextRequest
'enc_ContextRequest'(Tmpval1)
end,
case element(4,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type Externaltypereference164megaco_per_media_gateway_control_prev3aContextAttrAuditRequest
'enc_ContextAttrAuditRequest'(Tmpval2)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_ActionRequest_commandRequests'(element(5,Val1))].
'enc_ActionRequest_commandRequests'(Val) ->
[

   encode_length(length(Val)),
   'enc_ActionRequest_commandRequests_components'(Val, [])
].
'enc_ActionRequest_commandRequests_components'([], Acc) -> lists:reverse(Acc);

'enc_ActionRequest_commandRequests_components'([H|T], Acc) ->
'enc_ActionRequest_commandRequests_components'(T, ['enc_CommandRequest'(H)

 | Acc]).

'dec_ActionRequest_commandRequests'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_ActionRequest_commandRequests_components'(V1@V0, V1@Buf1, []).

'dec_ActionRequest_commandRequests_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ActionRequest_commandRequests_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_CommandRequest'(Bytes,telltype),
   'dec_ActionRequest_commandRequests_components'(Num-1, Remain, [Term|Acc]).


'dec_ActionRequest'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:2,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/unsigned-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
{V2@V3,V2@Buf4}
end,

%% attribute number 2 with type ContextRequest
{Term2,Bytes3} = case (Opt bsr 1) band 1 of
1 ->
'dec_ContextRequest'(Bytes2,telltype);
0 ->
{asn1_NOVALUE,Bytes2}
end,

%% attribute number 3 with type ContextAttrAuditRequest
{Term3,Bytes4} = case Opt band 1 of
1 ->
'dec_ContextAttrAuditRequest'(Bytes3,telltype);
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes5} = 'dec_ActionRequest_commandRequests'(Bytes4, telltype),
{{'ActionRequest',Term1,Term2,Term3,Term4},Bytes5}.

'enc_ContextID'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Val).


'dec_ContextID'(Bytes,_) ->
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/unsigned-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
{V1@V3,V1@Buf4}
end.

'enc_ErrorText'(Val) ->
encode_known_multiplier_string(no, 8, {0,127,notab}, Val).


'dec_ErrorText'(Bytes,_) ->
begin
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@V7:V1@V5/binary-unit:8,V1@Buf8/bitstring>> ->
{V1@V7,V1@Buf8};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@V8:V1@V6/binary-unit:8,V1@Buf9/bitstring>> ->
{V1@V8,V1@Buf9};
<<_:V1@Pad3,1:1,1:1,V1@V6:6,V1@Buf7/bitstring>> ->
{V1@V8,V1@Buf9}  = decode_fragmented(V1@V6, V1@Buf7, 8),
{V1@V8,V1@Buf9}
end,
V1@Conv10 = binary_to_list(V1@V0),
{V1@Conv10,V1@Buf1}
end.

'enc_ErrorCode'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
 case Val of 
    Tmpval1 when Tmpval1=<65535,Tmpval1>=0 ->
      [20,2,<<(Tmpval1- 0):16>>];
    Tmpval1 ->
      exit({error,{value_out_of_bounds,Tmpval1}})
  end
.


'dec_ErrorCode'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end.

'enc_ErrorDescriptor'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type IA5String
encode_known_multiplier_string(no, 8, {0,127,notab}, Tmpval3)
end].


'dec_ErrorDescriptor'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:2/unsigned-unit:8,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 2 with type IA5String
{Term2,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad3 = bit_size(Bytes2) band 7,
{V3@V0,V3@Buf1} = case Bytes2 of
<<_:V3@Pad3,0:1,V3@V5:7,V3@V7:V3@V5/binary-unit:8,V3@Buf8/bitstring>> ->
{V3@V7,V3@Buf8};
<<_:V3@Pad3,1:1,0:1,V3@V6:14,V3@V8:V3@V6/binary-unit:8,V3@Buf9/bitstring>> ->
{V3@V8,V3@Buf9};
<<_:V3@Pad3,1:1,1:1,V3@V6:6,V3@Buf7/bitstring>> ->
{V3@V8,V3@Buf9}  = decode_fragmented(V3@V6, V3@Buf7, 8),
{V3@V8,V3@Buf9}
end,
V3@Conv10 = binary_to_list(V3@V0),
{V3@Conv10,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'ErrorDescriptor',Term1,Term2},Bytes3}.

'enc_TransactionAck'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Tmpval1)
end].


'dec_TransactionAck'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/unsigned-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
{V2@V3,V2@Buf4}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band 1 of
1 ->
begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/unsigned-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
{V3@V3,V3@Buf4}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'TransactionAck',Term1,Term2},Bytes3}.

'enc_TransactionResponseAck'(Val) ->
[

   encode_length(length(Val)),
   'enc_TransactionResponseAck_components'(Val, [])
].
'enc_TransactionResponseAck_components'([], Acc) -> lists:reverse(Acc);

'enc_TransactionResponseAck_components'([H|T], Acc) ->
'enc_TransactionResponseAck_components'(T, ['enc_TransactionAck'(H)

 | Acc]).


'dec_TransactionResponseAck'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TransactionResponseAck_components'(V1@V0, V1@Buf1, []).

'dec_TransactionResponseAck_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TransactionResponseAck_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_TransactionAck'(Bytes,telltype),
   'dec_TransactionResponseAck_components'(Num-1, Remain, [Term|Acc]).
'enc_SegmentNumber'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
 case Val of 
    Tmpval1 when Tmpval1=<65535,Tmpval1>=0 ->
      [20,2,<<(Tmpval1- 0):16>>];
    Tmpval1 ->
      exit({error,{value_out_of_bounds,Tmpval1}})
  end
.


'dec_SegmentNumber'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:2/unsigned-unit:8,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end.

'enc_TransactionReply'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
Extensions = fixextensions({ext,4,2}, Val1),
[
setext(Extensions =/= []), Opt,

%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type NULL
[]
end,

%% attribute number 3 with type CHOICE
'enc_TransactionReply_transactionResult'(element(4,Val1))
,Extensions
,
case element(5,Val1) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 4 with type INTEGER
encode_open_type(complete(  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval3 of
    Tmpval4 when Tmpval4=<65535,Tmpval4>=0 ->
      [20,2,<<(Tmpval4- 0):16>>];
    Tmpval4 ->
      exit({error,{value_out_of_bounds,Tmpval4}})
  end

  end))
end,
case element(6,Val1) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 5 with type NULL
encode_open_type(complete([]))
end].
'enc_TransactionReply_transactionResult'(Val) ->
[
set_choice(element(1, Val), [transactionError,actionReplies], 2),
case element(1,Val) of
transactionError ->
'enc_ErrorDescriptor'(element(2, Val));
actionReplies ->
'enc_TransactionReply_transactionResult_actionReplies'(element(2, Val))
end
].
'enc_TransactionReply_transactionResult_actionReplies'(Val) ->
[

   encode_length(length(Val)),
   'enc_TransactionReply_transactionResult_actionReplies_components'(Val, [])
].
'enc_TransactionReply_transactionResult_actionReplies_components'([], Acc) -> lists:reverse(Acc);

'enc_TransactionReply_transactionResult_actionReplies_components'([H|T], Acc) ->
'enc_TransactionReply_transactionResult_actionReplies_components'(T, ['enc_ActionReply'(H)

 | Acc]).

'dec_TransactionReply_transactionResult_actionReplies'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TransactionReply_transactionResult_actionReplies_components'(V1@V0, V1@Buf1, []).

'dec_TransactionReply_transactionResult_actionReplies_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TransactionReply_transactionResult_actionReplies_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_ActionReply'(Bytes,telltype),
   'dec_TransactionReply_transactionResult_actionReplies_components'(Num-1, Remain, [Term|Acc]).

'dec_TransactionReply_transactionResult'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_ErrorDescriptor'(Bytes1,telltype)
end,
{{transactionError,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_TransactionReply_transactionResult_actionReplies'(Bytes1, telltype)
end,
{{actionReplies,Val},NewBytes}
end.


'dec_TransactionReply'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
{Opt,Bytes2} = begin
<<V2@V0:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes3} = begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 1,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/unsigned-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
{V3@V3,V3@Buf4}
end,

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band 1 of
1 ->
begin
ignore,
{'NULL',Bytes3}
end;
0 ->
{asn1_NOVALUE,Bytes3}
end,

%% attribute number 3 with type CHOICE
{Term3,Bytes5} = 'dec_TransactionReply_transactionResult'(Bytes4, telltype),

%% Extensions
{Extensions,Bytes6} = case Ext of
0 -> {<<>>,Bytes5};
1 ->
{V5@V0,V5@Buf1} = case Bytes5 of
<<0:1,V5@V3:6,V5@Buf4/bitstring>> ->
V5@Add5 = V5@V3 + 1,
{V5@Add5,V5@Buf4};
<<1:1,V5@Buf2/bitstring>> ->
V5@Pad6 = bit_size(V5@Buf2) band 7,
{V5@V3,V5@Buf4} = case V5@Buf2 of
<<_:V5@Pad6,0:1,V5@V8:7,V5@Buf9/bitstring>> when V5@V8 =/= 0 ->
{V5@V8,V5@Buf9};
<<_:V5@Pad6,1:1,0:1,V5@V9:14,V5@Buf10/bitstring>> when V5@V9 =/= 0 ->
{V5@V9,V5@Buf10}
end,
{V5@V3,V5@Buf4}
end,
<<V5@V11:V5@V0/bitstring-unit:1,V5@Buf12/bitstring>> = V5@Buf1,
{V5@V11,V5@Buf12}
end,

%% attribute number 4 with type INTEGER
{Term4,Bytes7} = case Extensions of
  <<_:0,1:1,_/bitstring>> ->
begin
V6@Pad3 = bit_size(Bytes6) band 7,
{V6@V0,V6@Buf1} = case Bytes6 of
<<_:V6@Pad3,0:1,V6@V5:7,V6@Buf6/bitstring>> ->
{V6@V5,V6@Buf6};
<<_:V6@Pad3,1:1,0:1,V6@V6:14,V6@Buf7/bitstring>> ->
{V6@V6,V6@Buf7}
end,
<<V6@V8:V6@V0/binary-unit:8,V6@Buf9/bitstring>> = V6@Buf1,
{TmpValx4,_} = begin
V7@Pad2 = bit_size(V6@V8) band 7,
<<_:V7@Pad2,V7@V0:2/unsigned-unit:8,V7@Buf1/bitstring>> = V6@V8,
{V7@V0,V7@Buf1}
end,
{TmpValx4,V6@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes6}
end,

%% attribute number 5 with type NULL
{Term5,Bytes8} = case Extensions of
  <<_:1,1:1,_/bitstring>> ->
begin
V8@Pad3 = bit_size(Bytes7) band 7,
{V8@V0,V8@Buf1} = case Bytes7 of
<<_:V8@Pad3,0:1,V8@V5:7,V8@Buf6/bitstring>> ->
{V8@V5,V8@Buf6};
<<_:V8@Pad3,1:1,0:1,V8@V6:14,V8@Buf7/bitstring>> ->
{V8@V6,V8@Buf7}
end,
<<V8@V8:V8@V0/binary-unit:8,V8@Buf9/bitstring>> = V8@Buf1,
{TmpValx5,_} = begin
ignore,
{'NULL',V8@V8}
end,
{TmpValx5,V8@Buf9}
end;
_  ->
{asn1_NOVALUE,Bytes7}
end,
Bytes9= skipextensions(Bytes8, 3, Extensions),
{{'TransactionReply',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_TransactionPending'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1))].


'dec_TransactionPending'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/unsigned-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
{V2@V3,V2@Buf4}
end,

%% Extensions
{Extensions,Bytes3} = case Ext of
0 -> {<<>>,Bytes2};
1 ->
{V3@V0,V3@Buf1} = case Bytes2 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:7,0:1,V3@V7:7,V3@Buf8/bitstring>> when V3@V7 =/= 0 ->
{V3@V7,V3@Buf8};
<<_:7,1:1,0:1,V3@V8:14,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V10:V3@V0/bitstring-unit:1,V3@Buf11/bitstring>> = V3@Buf1,
{V3@V10,V3@Buf11}
end,
Bytes4= skipextensions(Bytes3, 1, Extensions),
{{'TransactionPending',Term1},Bytes4}.

'enc_TransactionRequest'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, element(2,Val1)),

%% attribute number 2 with type SEQUENCE OF
'enc_TransactionRequest_actions'(element(3,Val1))].
'enc_TransactionRequest_actions'(Val) ->
[

   encode_length(length(Val)),
   'enc_TransactionRequest_actions_components'(Val, [])
].
'enc_TransactionRequest_actions_components'([], Acc) -> lists:reverse(Acc);

'enc_TransactionRequest_actions_components'([H|T], Acc) ->
'enc_TransactionRequest_actions_components'(T, ['enc_ActionRequest'(H)

 | Acc]).

'dec_TransactionRequest_actions'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_TransactionRequest_actions_components'(V1@V0, V1@Buf1, []).

'dec_TransactionRequest_actions_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TransactionRequest_actions_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_ActionRequest'(Bytes,telltype),
   'dec_TransactionRequest_actions_components'(Num-1, Remain, [Term|Acc]).


'dec_TransactionRequest'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:2/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/unsigned-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
{V2@V3,V2@Buf4}
end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes3} = 'dec_TransactionRequest_actions'(Bytes2, telltype),

%% Extensions
{Extensions,Bytes4} = case Ext of
0 -> {<<>>,Bytes3};
1 ->
{V3@V0,V3@Buf1} = case Bytes3 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes5= skipextensions(Bytes4, 1, Extensions),
{{'TransactionRequest',Term1,Term2},Bytes5}.

'enc_TransactionId'(Val) ->
  %%INTEGER with effective constraint: [{'ValueRange',{0,4294967295}}]
encode_constrained_number({0,4294967295}, Val).


'dec_TransactionId'(Bytes,_) ->
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/unsigned-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
{V1@V3,V1@Buf4}
end.

'enc_Transaction'(Val) ->
[
set_choice(element(1, Val), {[transactionRequest,transactionPending,transactionReply,transactionResponseAck],[]}, {4,0}),
case element(1,Val) of
transactionRequest ->
'enc_TransactionRequest'(element(2, Val));
transactionPending ->
'enc_TransactionPending'(element(2, Val));
transactionReply ->
'enc_TransactionReply'(element(2, Val));
transactionResponseAck ->
'enc_TransactionResponseAck'(element(2, Val))
end
].


'dec_Transaction'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:2/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_TransactionRequest'(Bytes2,telltype)
end,
{{transactionRequest,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_TransactionPending'(Bytes2,telltype)
end,
{{transactionPending,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_TransactionReply'(Bytes2,telltype)
end,
{{transactionReply,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
'dec_TransactionResponseAck'(Bytes2,telltype)
end,
{{transactionResponseAck,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_PathName'(Val) ->
encode_known_multiplier_string({1,64}, 8, {0,127,notab}, Val).


'dec_PathName'(Bytes,_) ->
begin
<<V1@V0:6/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 1,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/binary-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
V1@Conv7 = binary_to_list(V1@V3),
{V1@Conv7,V1@Buf4}
end.

'enc_IP6Address'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      16=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end].


'dec_IP6Address'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:16/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv4 = binary_to_list(V2@V0),
{V2@Conv4,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:2/unsigned-unit:8,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'IP6Address',Term1,Term2},Bytes3}.

'enc_IP4Address'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval2 of
    Tmpval3 when Tmpval3=<65535,Tmpval3>=0 ->
      [20,2,<<(Tmpval3- 0):16>>];
    Tmpval3 ->
      exit({error,{value_out_of_bounds,Tmpval3}})
  end

  end
end].


'dec_IP4Address'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = begin
V2@Pad2 = bit_size(Bytes1) band 7,
<<_:V2@Pad2,V2@V0:4/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv4 = binary_to_list(V2@V0),
{V2@Conv4,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:2/unsigned-unit:8,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'IP4Address',Term1,Term2},Bytes3}.

'enc_DomainName'(Val) ->
Fixopt1 = case element(3,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,

%% attribute number 1 with type IA5String
encode_known_multiplier_string(no, 8, {0,127,notab}, element(2,Val1)),
case element(3,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,65535},65536,{octets,2}}]
  begin
  case Tmpval1 of
    Tmpval2 when Tmpval2=<65535,Tmpval2>=0 ->
      [20,2,<<(Tmpval2- 0):16>>];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end
end].


'dec_DomainName'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type IA5String
{Term1,Bytes2} = begin
V2@Pad3 = bit_size(Bytes1) band 7,
{V2@V0,V2@Buf1} = case Bytes1 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@V7:V2@V5/binary-unit:8,V2@Buf8/bitstring>> ->
{V2@V7,V2@Buf8};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@V8:V2@V6/binary-unit:8,V2@Buf9/bitstring>> ->
{V2@V8,V2@Buf9};
<<_:V2@Pad3,1:1,1:1,V2@V6:6,V2@Buf7/bitstring>> ->
{V2@V8,V2@Buf9}  = decode_fragmented(V2@V6, V2@Buf7, 8),
{V2@V8,V2@Buf9}
end,
V2@Conv10 = binary_to_list(V2@V0),
{V2@Conv10,V2@Buf1}
end,

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band 1 of
1 ->
begin
V3@Pad2 = bit_size(Bytes2) band 7,
<<_:V3@Pad2,V3@V0:2/unsigned-unit:8,V3@Buf1/bitstring>> = Bytes2,
{V3@V0,V3@Buf1}
end;
0 ->
{asn1_NOVALUE,Bytes2}
end,
{{'DomainName',Term1,Term2},Bytes3}.

'enc_MId'(Val) ->
[
set_choice(element(1, Val), {[ip4Address,ip6Address,domainName,deviceName,mtpAddress],[]}, {5,0}),
case element(1,Val) of
ip4Address ->
'enc_IP4Address'(element(2, Val));
ip6Address ->
'enc_IP6Address'(element(2, Val));
domainName ->
'enc_DomainName'(element(2, Val));
deviceName ->
encode_known_multiplier_string({1,64}, 8, {0,127,notab}, element(2, Val));
mtpAddress ->
encode_octet_string({2,4}, element(2, Val))
end
].


'dec_MId'(Bytes,_) ->
case Bytes of
<<0:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
<<V1@V0:3/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes1,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_IP4Address'(Bytes2,telltype)
end,
{{ip4Address,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_IP6Address'(Bytes2,telltype)
end,
{{ip6Address,Val},NewBytes};
2 ->
{Val,NewBytes} = begin
'dec_DomainName'(Bytes2,telltype)
end,
{{domainName,Val},NewBytes};
3 ->
{Val,NewBytes} = begin
begin
<<V2@V0:6/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes2,
V2@Add2 = V2@V0 + 1,
V2@Pad5 = bit_size(V2@Buf1) band 7,
<<_:V2@Pad5,V2@V3:V2@Add2/binary-unit:8,V2@Buf4/bitstring>> = V2@Buf1,
V2@Conv7 = binary_to_list(V2@V3),
{V2@Conv7,V2@Buf4}
end
end,
{{deviceName,Val},NewBytes};
4 ->
{Val,NewBytes} = begin
begin
<<V3@V0:2/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 2,
V3@Pad5 = bit_size(V3@Buf1) band 7,
<<_:V3@Pad5,V3@V3:V3@Add2/binary-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
V3@Conv7 = binary_to_list(V3@V3),
{V3@Conv7,V3@Buf4}
end
end,
{{mtpAddress,Val},NewBytes}
end;

<<1:1,Bytes1/bitstring>> ->
{Choice,Bytes2} = 
begin
{V1@V0,V1@Buf1} = case Bytes1 of
<<0:1,V1@V3:6,V1@Buf4/bitstring>> ->
{V1@V3,V1@Buf4};
<<1:1,V1@Buf2/bitstring>> ->
V1@Pad6 = bit_size(V1@Buf2) band 7,
{V1@V3,V1@Buf4} = case V1@Buf2 of
<<_:V1@Pad6,0:1,V1@V8:7,V1@Buf9/bitstring>> when V1@V8 =/= 0 ->
{V1@V8,V1@Buf9};
<<_:V1@Pad6,1:1,0:1,V1@V9:14,V1@Buf10/bitstring>> when V1@V9 =/= 0 ->
{V1@V9,V1@Buf10}
end,
<<V1@V11:V1@V3/unit:8,V1@Buf12/bitstring>> = V1@Buf4,
{V1@V11,V1@Buf12}
end,
{V1@V0,V1@Buf1}
end,
begin
V2@Pad3 = bit_size(Bytes2) band 7,
{V2@V0,V2@Buf1} = case Bytes2 of
<<_:V2@Pad3,0:1,V2@V5:7,V2@Buf6/bitstring>> ->
{V2@V5,V2@Buf6};
<<_:V2@Pad3,1:1,0:1,V2@V6:14,V2@Buf7/bitstring>> ->
{V2@V6,V2@Buf7}
end,
<<V2@V8:V2@V0/binary-unit:8,V2@Buf9/bitstring>> = V2@Buf1
end,
case Choice of
_ ->
{{asn1_ExtAlt,V2@V8},V2@Buf9}
end
end.
'enc_Message'(Val) ->
Val1 = Val,
[
setext(false), 
%% attribute number 1 with type INTEGER
  %%INTEGER with effective constraint: [{'ValueRange',{0,99},100,{bits,7}}]
  begin
  Tmpval1=element(2,Val1),
  case Tmpval1 of
    Tmpval2 when Tmpval2=<99,Tmpval2>=0 ->
      [10,7,Tmpval2- 0];
    Tmpval2 ->
      exit({error,{value_out_of_bounds,Tmpval2}})
  end

  end,

%% attribute number 2 with type Externaltypereference31megaco_per_media_gateway_control_prev3aMId
'enc_MId'(element(3,Val1)),

%% attribute number 3 with type CHOICE
'enc_Message_messageBody'(element(4,Val1))].
'enc_Message_messageBody'(Val) ->
[
set_choice(element(1, Val), [messageError,transactions], 2),
case element(1,Val) of
messageError ->
'enc_ErrorDescriptor'(element(2, Val));
transactions ->
'enc_Message_messageBody_transactions'(element(2, Val))
end
].
'enc_Message_messageBody_transactions'(Val) ->
[

   encode_length(length(Val)),
   'enc_Message_messageBody_transactions_components'(Val, [])
].
'enc_Message_messageBody_transactions_components'([], Acc) -> lists:reverse(Acc);

'enc_Message_messageBody_transactions_components'([H|T], Acc) ->
'enc_Message_messageBody_transactions_components'(T, ['enc_Transaction'(H)

 | Acc]).

'dec_Message_messageBody_transactions'(Bytes,_) ->
%% Length with constraint no
V1@Pad3 = bit_size(Bytes) band 7,
{V1@V0,V1@Buf1} = case Bytes of
<<_:V1@Pad3,0:1,V1@V5:7,V1@Buf6/bitstring>> ->
{V1@V5,V1@Buf6};
<<_:V1@Pad3,1:1,0:1,V1@V6:14,V1@Buf7/bitstring>> ->
{V1@V6,V1@Buf7}
end,
'dec_Message_messageBody_transactions_components'(V1@V0, V1@Buf1, []).

'dec_Message_messageBody_transactions_components'(0, Bytes, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_Message_messageBody_transactions_components'(Num, Bytes, Acc) ->
   {Term,Remain} = 'dec_Transaction'(Bytes,telltype),
   'dec_Message_messageBody_transactions_components'(Num-1, Remain, [Term|Acc]).

'dec_Message_messageBody'(Bytes,_) ->
{Choice,Bytes1} = 
begin
<<V1@V0:1/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,
case Choice of
0 ->
{Val,NewBytes} = begin
'dec_ErrorDescriptor'(Bytes1,telltype)
end,
{{messageError,Val},NewBytes};
1 ->
{Val,NewBytes} = begin
'dec_Message_messageBody_transactions'(Bytes1, telltype)
end,
{{transactions,Val},NewBytes}
end.


'dec_Message'(Bytes,_) ->
{Ext,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = begin
<<V2@V0:7/unsigned-unit:1,V2@Buf1/bitstring>> = Bytes1,
{V2@V0,V2@Buf1}
end,

%% attribute number 2 with type MId
{Term2,Bytes3} = 'dec_MId'(Bytes2,telltype),

%% attribute number 3 with type CHOICE
{Term3,Bytes4} = 'dec_Message_messageBody'(Bytes3, telltype),

%% Extensions
{Extensions,Bytes5} = case Ext of
0 -> {<<>>,Bytes4};
1 ->
{V3@V0,V3@Buf1} = case Bytes4 of
<<0:1,V3@V3:6,V3@Buf4/bitstring>> ->
V3@Add5 = V3@V3 + 1,
{V3@Add5,V3@Buf4};
<<1:1,V3@Buf2/bitstring>> ->
V3@Pad6 = bit_size(V3@Buf2) band 7,
{V3@V3,V3@Buf4} = case V3@Buf2 of
<<_:V3@Pad6,0:1,V3@V8:7,V3@Buf9/bitstring>> when V3@V8 =/= 0 ->
{V3@V8,V3@Buf9};
<<_:V3@Pad6,1:1,0:1,V3@V9:14,V3@Buf10/bitstring>> when V3@V9 =/= 0 ->
{V3@V9,V3@Buf10}
end,
{V3@V3,V3@Buf4}
end,
<<V3@V11:V3@V0/bitstring-unit:1,V3@Buf12/bitstring>> = V3@Buf1,
{V3@V11,V3@Buf12}
end,
Bytes6= skipextensions(Bytes5, 1, Extensions),
{{'Message',Term1,Term2,Term3},Bytes6}.

'enc_AuthData'(Val) ->
encode_octet_string({12,32}, Val).


'dec_AuthData'(Bytes,_) ->
begin
<<V1@V0:5/unsigned-unit:1,V1@Buf1/bitstring>> = Bytes,
V1@Add2 = V1@V0 + 12,
V1@Pad5 = bit_size(V1@Buf1) band 7,
<<_:V1@Pad5,V1@V3:V1@Add2/binary-unit:8,V1@Buf4/bitstring>> = V1@Buf1,
V1@Conv7 = binary_to_list(V1@V3),
{V1@Conv7,V1@Buf4}
end.

'enc_SequenceNum'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_SequenceNum'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end.

'enc_SecurityParmIndex'(Val) ->
  begin
    Tmpval1 = Val,
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end.


'dec_SecurityParmIndex'(Bytes,_) ->
begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end.

'enc_AuthenticationHeader'(Val) ->
Val1 = Val,
[

%% attribute number 1 with type OCTET STRING
  begin
    Tmpval1 = element(2,Val1),
    case length(Tmpval1) of
      4=Tmplen1 ->
       [20,Tmplen1|Tmpval1];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval1}})
    end
  end,

%% attribute number 2 with type OCTET STRING
  begin
    Tmpval2 = element(3,Val1),
    case length(Tmpval2) of
      4=Tmplen2 ->
       [20,Tmplen2|Tmpval2];
      _ ->
       exit({error,{value_out_of_bounds,Tmpval2}})
    end
  end,

%% attribute number 3 with type OCTET STRING
encode_octet_string({12,32}, element(4,Val1))].


'dec_AuthenticationHeader'(Bytes,_) ->

%% attribute number 1 with type OCTET STRING
{Term1,Bytes1} = begin
V1@Pad2 = bit_size(Bytes) band 7,
<<_:V1@Pad2,V1@V0:4/binary-unit:8,V1@Buf1/bitstring>> = Bytes,
V1@Conv4 = binary_to_list(V1@V0),
{V1@Conv4,V1@Buf1}
end,

%% attribute number 2 with type OCTET STRING
{Term2,Bytes2} = begin
<<V2@V0:4/binary-unit:8,V2@Buf1/bitstring>> = Bytes1,
V2@Conv2 = binary_to_list(V2@V0),
{V2@Conv2,V2@Buf1}
end,

%% attribute number 3 with type OCTET STRING
{Term3,Bytes3} = begin
<<V3@V0:5/unsigned-unit:1,V3@Buf1/bitstring>> = Bytes2,
V3@Add2 = V3@V0 + 12,
<<_:3,V3@V3:V3@Add2/binary-unit:8,V3@Buf4/bitstring>> = V3@Buf1,
V3@Conv6 = binary_to_list(V3@V3),
{V3@Conv6,V3@Buf4}
end,
{{'AuthenticationHeader',Term1,Term2,Term3},Bytes3}.

'enc_MegacoMessage'(Val) ->
Fixopt1 = case element(2,Val) of
asn1_DEFAULT -> 0;
asn1_NOVALUE -> 0;
_ -> 1
end,
{Val1,Opt} = {Val,[Fixopt1]},
[
Opt,
case element(2,Val1) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereference10megaco_per_media_gateway_control_prev3aAuthenticationHeader
'enc_AuthenticationHeader'(Tmpval1)
end,

%% attribute number 2 with type Externaltypereference11megaco_per_media_gateway_control_prev3aMessage
'enc_Message'(element(3,Val1))].


'dec_MegacoMessage'(Bytes,_) ->
{Opt,Bytes1} = begin
<<V1@V0:1,V1@Buf1/bitstring>> = Bytes,
{V1@V0,V1@Buf1}
end,

%% attribute number 1 with type AuthenticationHeader
{Term1,Bytes2} = case Opt band 1 of
1 ->
'dec_AuthenticationHeader'(Bytes1,telltype);
0 ->
{asn1_NOVALUE,Bytes1}
end,

%% attribute number 2 with type Message
{Term2,Bytes3} = 'dec_Message'(Bytes2,telltype),
{{'MegacoMessage',Term1,Term2},Bytes3}.


%%%
%%% Run-time functions.
%%%

align(Bin) when is_binary(Bin) ->
    Bin;
align(BitStr) when is_bitstring(BitStr) ->
    AlignBits = bit_size(BitStr) rem 8,
    <<_:AlignBits,Rest/binary>> = BitStr,
    Rest.

bit_string_trailing_zeros(BitList, C) when is_integer(C) ->
    bit_string_trailing_zeros1(BitList, C, C);
bit_string_trailing_zeros(BitList, {Lb,Ub}) when is_integer(Lb) ->
    bit_string_trailing_zeros1(BitList, Lb, Ub);
bit_string_trailing_zeros(BitList, {{Lb,Ub},_}) when is_integer(Lb) ->
    bit_string_trailing_zeros1(BitList, Lb, Ub);
bit_string_trailing_zeros(BitList, _) ->
    BitList.

bit_string_trailing_zeros1(BitList, Lb, Ub) ->
    case length(BitList) of
        Lb ->
            BitList;
        B when B < Lb ->
            BitList ++ lists:duplicate(Lb - B, 0);
        D ->
            F = fun(L, LB, LB, _, _) ->
                       lists:reverse(L);
                   ([0|R], L1, LB, UB, Fun) ->
                       Fun(R, L1 - 1, LB, UB, Fun);
                   (L, L1, _, UB, _) when L1 =< UB ->
                       lists:reverse(L);
                   (_, _L1, _, _, _) ->
                       exit({error,{list_length_BIT_STRING,BitList}})
                end,
            F(lists:reverse(BitList), D, Lb, Ub, F)
    end.

chars_encode2([H|T], NumBits, T1 = {Min,Max,notab})
    when H =< Max, H >= Min ->
    [pre_complete_bits(NumBits, H - Min)|chars_encode2(T, NumBits, T1)];
chars_encode2([H|T], NumBits, T1 = {Min,Max,Tab})
    when H =< Max, H >= Min ->
    [pre_complete_bits(NumBits,
                       exit_if_false(H, element(H - Min + 1, Tab)))|
     chars_encode2(T, NumBits, T1)];
chars_encode2([{A,B,C,D}|T], NumBits, T1 = {Min,_Max,notab}) ->
    [pre_complete_bits(NumBits, A bsl 8 + B bsl 8 + C bsl 8 + D - Min)|
     chars_encode2(T, NumBits, T1)];
chars_encode2([H = {A,B,C,D}|T], NumBits, {Min,Max,Tab}) ->
    [pre_complete_bits(NumBits,
                       exit_if_false(H,
                                     element(A bsl 8 + B bsl 8 + C bsl 8
                                             +
                                             D
                                             -
                                             Min,
                                             Tab)))|
     chars_encode2(T, NumBits, {Min,Max,notab})];
chars_encode2([H|_T], _NumBits, {_Min,_Max,_Tab}) ->
    exit({error,{asn1,{illegal_char_value,H}}});
chars_encode2([], _, _) ->
    [].

complete(L) ->
    case asn1rt_nif:encode_per_complete(L) of
        <<>> ->
            <<0>>;
        Bin ->
            Bin
    end.

dec_subidentifiers([H|T], Av, Al) when H >= 128 ->
    dec_subidentifiers(T, Av bsl 7 bor H band 127, Al);
dec_subidentifiers([H|T], Av, Al) ->
    dec_subidentifiers(T, 0, [Av bsl 7 bor H|Al]);
dec_subidentifiers([], _Av, Al) ->
    lists:reverse(Al).

decode_fragmented(SegSz0, Buf0, Unit) ->
    SegSz = SegSz0 * Unit * 16384,
    <<Res:SegSz/bitstring,Buf/bitstring>> = Buf0,
    decode_fragmented_1(Buf, Unit, Res).

decode_fragmented_1(<<0:1,N:7,Buf0/bitstring>>, Unit, Res) ->
    Sz = N * Unit,
    <<S:Sz/bitstring,Buf/bitstring>> = Buf0,
    {<<Res/bitstring,S/bitstring>>,Buf};
decode_fragmented_1(<<1:1,0:1,N:14,Buf0/bitstring>>, Unit, Res) ->
    Sz = N * Unit,
    <<S:Sz/bitstring,Buf/bitstring>> = Buf0,
    {<<Res/bitstring,S/bitstring>>,Buf};
decode_fragmented_1(<<1:1,1:1,SegSz0:6,Buf0/bitstring>>, Unit, Res0) ->
    SegSz = SegSz0 * Unit * 16384,
    <<Frag:SegSz/bitstring,Buf/bitstring>> = Buf0,
    Res = <<Res0/bitstring,Frag/bitstring>>,
    decode_fragmented_1(Buf, Unit, Res).

decode_length(Buffer) ->
    case align(Buffer) of
        <<0:1,Oct:7,Rest/binary>> ->
            {Oct,Rest};
        <<2:2,Val:14,Rest/binary>> ->
            {Val,Rest};
        <<3:2,_Val:14,_Rest/binary>> ->
            exit({error,{asn1,{decode_length,{nyi,above_16k}}}})
    end.

decode_named_bit_string(Val, NNL) ->
    Bits =
        [ 
         B ||
             <<B:1>> <= Val
        ],
    decode_named_bit_string_1(0, Bits, NNL, []).

decode_named_bit_string_1(Pos, [0|Bt], Names, Acc) ->
    decode_named_bit_string_1(Pos + 1, Bt, Names, Acc);
decode_named_bit_string_1(Pos, [1|Bt], Names, Acc) ->
    case lists:keyfind(Pos, 2, Names) of
        {Name,_} ->
            decode_named_bit_string_1(Pos + 1, Bt, Names, [Name|Acc]);
        false ->
            decode_named_bit_string_1(Pos + 1,
                                      Bt,
                                      Names,
                                      [{bit,Pos}|Acc])
    end;
decode_named_bit_string_1(_Pos, [], _Names, Acc) ->
    lists:reverse(Acc).

decode_oid(Octets) ->
    [First|Rest] = dec_subidentifiers(Octets, 0, []),
    Idlist =
        if
            First < 40 ->
                [0,First|Rest];
            First < 80 ->
                [1,First - 40|Rest];
            true ->
                [2,First - 80|Rest]
        end,
    list_to_tuple(Idlist).

e_o_e(Num) when Num < 128 ->
    Num bor 128;
e_o_e(Num) ->
    [e_o_e(Num bsr 7),Num band 127 bor 128].

e_object_element(Num) when Num < 128 ->
    [Num];
e_object_element(Num) ->
    [e_o_e(Num bsr 7),Num band 127].

e_object_elements([], Acc) ->
    lists:reverse(Acc);
e_object_elements([H|T], Acc) ->
    e_object_elements(T, [e_object_element(H)|Acc]).

e_object_identifier({'OBJECT IDENTIFIER',V}) ->
    e_object_identifier(V);
e_object_identifier(V) when is_tuple(V) ->
    e_object_identifier(tuple_to_list(V));
e_object_identifier([E1,E2|Tail]) when E1 >= 0, E1 < 2, E2 < 40; E1 == 2 ->
    Head = 40 * E1 + E2,
    e_object_elements([Head|Tail], []);
e_object_identifier(Oid = [_,_|_Tail]) ->
    exit({error,{asn1,{illegal_value,Oid}}}).

efos_1(<<B1:49152/binary,B2:16384/binary,T/binary>>) ->
    [20,
     1,
     <<3:2,4:6>>,
     octets_to_complete(49152, B1),
     octets_to_complete(16384, B2)|
     efos_1(T)];
efos_1(<<B:49152/binary,T/binary>>) ->
    [20,1,<<3:2,3:6>>,octets_to_complete(49152, B)|efos_1(T)];
efos_1(<<B:32768/binary,T/binary>>) ->
    [20,1,<<3:2,2:6>>,octets_to_complete(32768, B)|efos_1(T)];
efos_1(<<B:16384/binary,T/binary>>) ->
    [20,1,<<3:2,1:6>>,octets_to_complete(16384, B)|efos_1(T)];
efos_1(<<>>) ->
    [20,1,0];
efos_1(<<B/bitstring>>) ->
    Len = byte_size(B),
    [encode_length(Len)|octets_to_complete(Len, B)].

eint(0, [B|Acc]) when B < 128 ->
    [B|Acc];
eint(N, Acc) ->
    eint(N bsr 8, [N band 255|Acc]).

eint_positive(Val) ->
    case eint(Val, []) of
        [0,B1|T] ->
            [B1|T];
        T ->
            T
    end.

encode_bin_bit_string(C, {Unused,BinBits}, _NamedBitList)
    when is_integer(C), C =< 16 ->
    range_check(C, bit_size(BinBits) - Unused),
    [45,C,byte_size(BinBits),BinBits];
encode_bin_bit_string(C, {Unused,BinBits}, _NamedBitList)
    when is_integer(C), C =< 255 ->
    range_check(C, bit_size(BinBits) - Unused),
    [2,45,C,byte_size(BinBits),BinBits];
encode_bin_bit_string(C, {Unused,BinBits}, _NamedBitList)
    when is_integer(C), C =< 65535 ->
    range_check(C, bit_size(BinBits) - Unused),
    case byte_size(BinBits) of
        Size when Size =< 255 ->
            [2,46,<<C:16>>,Size,BinBits];
        Size ->
            [2,47,<<C:16>>,<<Size:16>>,BinBits]
    end;
encode_bin_bit_string(C, UnusedAndBin = {_,_}, NamedBitList) ->
    {Unused1,Bin1} = remove_trailing_bin(NamedBitList, UnusedAndBin),
    case C of
        {Lb,Ub} when is_integer(Lb), is_integer(Ub) ->
            Size = byte_size(Bin1),
            [encode_length({Lb,Ub}, Size * 8 - Unused1),
             2,
             octets_unused_to_complete(Unused1, Size, Bin1)];
        no ->
            Size = byte_size(Bin1),
            [encode_length(Size * 8 - Unused1),
             2|
             octets_unused_to_complete(Unused1, Size, Bin1)];
        {{Fix,Fix},Ext} when is_integer(Fix), is_list(Ext) ->
            case byte_size(Bin1) * 8 - Unused1 of
                Size when Size =< Fix ->
                    [0|
                     encode_bin_bit_string(Fix,
                                           UnusedAndBin,
                                           NamedBitList)];
                _Size ->
                    [1|
                     encode_bin_bit_string(no,
                                           UnusedAndBin,
                                           NamedBitList)]
            end;
        Sc ->
            Size = byte_size(Bin1),
            [encode_length(Sc, Size * 8 - Unused1),
             2|
             octets_unused_to_complete(Unused1, Size, Bin1)]
    end.

encode_bit_string(C, Bits, NamedBitList) when is_bitstring(Bits) ->
    PadLen = (8 - bit_size(Bits) band 7) band 7,
    Compact = {PadLen,<<Bits/bitstring,0:PadLen>>},
    encode_bin_bit_string(C, Compact, NamedBitList);
encode_bit_string(C, {Unused,BinBits} = Bin, NamedBitList)
    when is_integer(Unused), is_binary(BinBits) ->
    encode_bin_bit_string(C, Bin, NamedBitList);
encode_bit_string(C, LoNB = [FirstVal|_RestVal], NamedBitList)
    when is_atom(FirstVal) ->
    ToSetPos = get_all_bitposes(LoNB, NamedBitList, []),
    BitList = make_and_set_list(ToSetPos, 0),
    encode_bit_string(C, BitList, NamedBitList);
encode_bit_string(C, BL = [{bit,_}|_RestVal], NamedBitList) ->
    ToSetPos = get_all_bitposes(BL, NamedBitList, []),
    BitList = make_and_set_list(ToSetPos, 0),
    encode_bit_string(C, BitList, NamedBitList);
encode_bit_string(Int, BitListValue, _)
    when is_list(BitListValue), is_integer(Int), Int =< 16 ->
    [40,Int,length(BitListValue),BitListValue];
encode_bit_string(Int, BitListValue, _)
    when is_list(BitListValue), is_integer(Int), Int =< 255 ->
    [2,40,Int,length(BitListValue),BitListValue];
encode_bit_string(Int, BitListValue, _)
    when is_list(BitListValue), is_integer(Int), Int < 65536 ->
    {Code,DesiredLength,Length} =
        case length(BitListValue) of
            B1 when B1 > Int ->
                exit({error,
                      {'BIT_STRING_length_greater_than_SIZE',
                       Int,
                       BitListValue}});
            B1 when B1 =< 255, Int =< 255 ->
                {40,Int,B1};
            B1 when B1 =< 255 ->
                {42,<<Int:16>>,B1};
            B1 ->
                {43,<<Int:16>>,<<B1:16>>}
        end,
    [2,Code,DesiredLength,Length,BitListValue];
encode_bit_string(no, BitListValue, []) when is_list(BitListValue) ->
    [encode_length(length(BitListValue)),2|BitListValue];
encode_bit_string({{Fix,Fix},Ext}, BitListValue, [])
    when is_integer(Fix), is_list(Ext) ->
    case length(BitListValue) of
        Len when Len =< Fix ->
            [0|encode_bit_string(Fix, BitListValue, [])];
        _ ->
            [1|encode_bit_string(no, BitListValue, [])]
    end;
encode_bit_string(C, BitListValue, []) when is_list(BitListValue) ->
    [encode_length(C, length(BitListValue)),2|BitListValue];
encode_bit_string(no, BitListValue, _NamedBitList)
    when is_list(BitListValue) ->
    NewBitLVal =
        lists:reverse(lists:dropwhile(fun(0) ->
                                             true;
                                         (1) ->
                                             false
                                      end,
                                      lists:reverse(BitListValue))),
    [encode_length(length(NewBitLVal)),2|NewBitLVal];
encode_bit_string({{Fix,Fix},Ext}, BitListValue, NamedBitList)
    when is_integer(Fix), is_list(Ext) ->
    case length(BitListValue) of
        Len when Len =< Fix ->
            [0|encode_bit_string(Fix, BitListValue, NamedBitList)];
        _ ->
            [1|encode_bit_string(no, BitListValue, NamedBitList)]
    end;
encode_bit_string(C, BitListValue, _NamedBitList)
    when is_list(BitListValue) ->
    NewBitLVal = bit_string_trailing_zeros(BitListValue, C),
    [encode_length(C, length(NewBitLVal)),2|NewBitLVal];
encode_bit_string(C, IntegerVal, NamedBitList)
    when is_integer(IntegerVal) ->
    BitList = int_to_bitlist(IntegerVal),
    encode_bit_string(C, BitList, NamedBitList).

encode_constrained_number({Lb,Ub}, Val) when Val >= Lb, Ub >= Val ->
    Range = Ub - Lb + 1,
    Val2 = Val - Lb,
    if
        Range == 1 ->
            [];
        Range == 2 ->
            [Val2];
        Range =< 4 ->
            [10,2,Val2];
        Range =< 8 ->
            [10,3,Val2];
        Range =< 16 ->
            [10,4,Val2];
        Range =< 32 ->
            [10,5,Val2];
        Range =< 64 ->
            [10,6,Val2];
        Range =< 128 ->
            [10,7,Val2];
        Range =< 255 ->
            [10,8,Val2];
        Range =< 256 ->
            [20,1,Val2];
        Range =< 65536 ->
            [20,2,<<Val2:16>>];
        Range =< 1 bsl 255 * 8 ->
            Octs = binary:encode_unsigned(Val2),
            RangeOcts = binary:encode_unsigned(Range - 1),
            OctsLen = byte_size(Octs),
            RangeOctsLen = byte_size(RangeOcts),
            LengthBitsNeeded = minimum_bits(RangeOctsLen - 1),
            [10,LengthBitsNeeded,OctsLen - 1,20,OctsLen,Octs];
        true ->
            exit({not_supported,{integer_range,Range}})
    end;
encode_constrained_number({_,_}, Val) ->
    exit({error,{asn1,{illegal_value,Val}}}).

encode_fragmented_octet_string(Val) ->
    Bin = iolist_to_binary(Val),
    efos_1(Bin).

encode_known_multiplier_string(SizeC, NumBits, CharOutTab, Val) ->
    Result = chars_encode2(Val, NumBits, CharOutTab),
    case SizeC of
        Ub when is_integer(Ub), Ub * NumBits < 16 ->
            Result;
        Ub when is_integer(Ub) ->
            [2,Result];
        {{_,Ub},Ext} = SZ when is_list(Ext) ->
            Len = length(Val),
            case encode_length(SZ, Len) of
                [0|_] = EncLen when Ub * NumBits < 16 ->
                    [EncLen,45,Len * NumBits,Len,Val];
                [_|_] = EncLen ->
                    [EncLen,2|Result]
            end;
        {_,Ub} = Range ->
            [encode_length(Range, length(Val))|
             if
                 Ub * NumBits < 16 ->
                     Result;
                 true ->
                     [2|Result]
             end];
        no ->
            [encode_length(length(Val)),2,Result]
    end.

encode_length(Len) ->
    if
        Len < 128 ->
            [20,1,Len];
        Len < 16384 ->
            <<20,2,2:2,Len:14>>;
        true ->
            exit({error,{asn1,{encode_length,{nyi,above_16k}}}})
    end.

encode_length({C,[]}, Len) ->
    case C of
        {Lb,Ub} = Vr when Lb =< Len, Len =< Ub ->
            [0|encode_constrained_number(Vr, Len)];
        _ ->
            [1|encode_length(Len)]
    end;
encode_length(Len, Len) ->
    [];
encode_length(Vr, Len) ->
    encode_constrained_number(Vr, Len).

encode_object_identifier(Val) ->
    OctetList = e_object_identifier(Val),
    Octets = list_to_binary(OctetList),
    Sz = byte_size(Octets),
    [encode_length(Sz),octets_to_complete(Sz, Octets)].

encode_octet_string({{Sv,Sv},Ext} = SZ, Val) when is_list(Ext), Sv =< 2 ->
    Len = length(Val),
    try
        case encode_length(SZ, Len) of
            [0|_] = EncLen ->
                [EncLen,45,Sv * 8,Sv,Val];
            [_|_] = EncLen ->
                [EncLen|octets_to_complete(Len, Val)]
        end
    catch
        exit:{error,{asn1,{encode_length,_}}} ->
            encode_fragmented_octet_string(Val)
    end;
encode_octet_string({_,_} = SZ, Val) ->
    Len = length(Val),
    try
        [encode_length(SZ, Len),2|octets_to_complete(Len, Val)]
    catch
        exit:{error,{asn1,{encode_length,_}}} ->
            encode_fragmented_octet_string(Val)
    end;
encode_octet_string(Sv, Val) when is_integer(Sv) ->
    encode_fragmented_octet_string(Val);
encode_octet_string(no, Val) ->
    Len = length(Val),
    try
        [encode_length(Len),2|octets_to_complete(Len, Val)]
    catch
        exit:{error,{asn1,{encode_length,_}}} ->
            encode_fragmented_octet_string(Val)
    end.

encode_open_type(Val) ->
    case byte_size(Val) of
        Size when Size > 255 ->
            [encode_length(Size),21,<<Size:16>>,Val];
        Size ->
            [encode_length(Size),20,Size,Val]
    end.

encode_semi_constrained_number(Lb, Val) ->
    Val2 = Val - Lb,
    Oct = eint_positive(Val2),
    Len = length(Oct),
    if
        Len < 128 ->
            [20,Len + 1,Len|Oct];
        Len < 256 ->
            [encode_length(Len),20,Len|Oct];
        true ->
            [encode_length(Len),21,<<Len:16>>|Oct]
    end.

encode_small_length(Len) when Len =< 64 ->
    [10,7,Len - 1];
encode_small_length(Len) ->
    [1,encode_length(Len)].

encode_small_number(Val) when Val < 64 ->
    [10,7,Val];
encode_small_number(Val) ->
    [1|encode_semi_constrained_number(0, Val)].

exit_if_false(V, false) ->
    exit({error,
          {asn1,
           {"illegal value according to Permitted alphabet constraint",
            V}}});
exit_if_false(_, V) ->
    V.

fixextensions(Pos, MaxPos, _, Acc) when Pos >= MaxPos ->
    Acc;
fixextensions(Pos, ExtPos, Val, Acc) ->
    Bit =
        case catch element(Pos + 1, Val) of
            asn1_NOVALUE ->
                0;
            asn1_NOEXTVALUE ->
                0;
            {'EXIT',_} ->
                0;
            _ ->
                1
        end,
    fixextensions(Pos + 1, ExtPos, Val, Acc bsl 1 + Bit).

fixextensions({ext,ExtPos,ExtNum}, Val) ->
    case fixextensions(ExtPos, ExtNum + ExtPos, Val, 0) of
        0 ->
            [];
        ExtBits ->
            [encode_small_length(ExtNum)|
             pre_complete_bits(ExtNum, ExtBits)]
    end.

get_all_bitposes([{bit,ValPos}|Rest], NamedBitList, Ack) ->
    get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]);
get_all_bitposes([Val|Rest], NamedBitList, Ack) ->
    case lists:keyfind(Val, 1, NamedBitList) of
        {_ValName,ValPos} ->
            get_all_bitposes(Rest, NamedBitList, [ValPos|Ack]);
        false ->
            exit({error,{asn1,{bitstring_namedbit,Val}}})
    end;
get_all_bitposes([], _NamedBitList, Ack) ->
    lists:sort(Ack).

int_to_bitlist(Int) when is_integer(Int), Int > 0 ->
    [Int band 1|int_to_bitlist(Int bsr 1)];
int_to_bitlist(0) ->
    [].

make_and_set_list([XPos|SetPos], XPos) ->
    [1|make_and_set_list(SetPos, XPos + 1)];
make_and_set_list([Pos|SetPos], XPos) ->
    [0|make_and_set_list([Pos|SetPos], XPos + 1)];
make_and_set_list([], _) ->
    [].

minimum_bits(N) when N < 4 ->
    2;
minimum_bits(N) when N < 8 ->
    3;
minimum_bits(N) when N < 16 ->
    4;
minimum_bits(N) when N < 32 ->
    5;
minimum_bits(N) when N < 64 ->
    6;
minimum_bits(N) when N < 128 ->
    7;
minimum_bits(_N) ->
    8.

octets_to_complete(Len, Val) when Len < 256 ->
    [20,Len,Val];
octets_to_complete(Len, Val) ->
    [21,<<Len:16>>,Val].

octets_unused_to_complete(Unused, Len, Val) when Len < 256 ->
    [30,Unused,Len,Val];
octets_unused_to_complete(Unused, Len, Val) ->
    [31,Unused,<<Len:16>>,Val].

pre_complete_bits(NumBits, Val) when NumBits =< 8 ->
    [10,NumBits,Val];
pre_complete_bits(NumBits, Val) when NumBits =< 16 ->
    [10,NumBits - 8,Val bsr 8,10,8,Val band 255];
pre_complete_bits(NumBits, Val) when NumBits =< 2040 ->
    Unused = (8 - NumBits rem 8) rem 8,
    Len = NumBits + Unused,
    [30,Unused,Len div 8,<<(Val bsl Unused):Len>>].

range_check(C, C) when is_integer(C) ->
    ok;
range_check(C1, C2) when is_integer(C1) ->
    exit({error,{asn1,{bit_string_out_of_range,{C1,C2}}}}).

remove_trailing_bin([], {Unused,Bin}) ->
    {Unused,Bin};
remove_trailing_bin(_NamedNumberList, {_Unused,<<>>}) ->
    {0,<<>>};
remove_trailing_bin(NamedNumberList, {_Unused,Bin}) ->
    Size = byte_size(Bin) - 1,
    <<Bfront:Size/binary,LastByte:8>> = Bin,
    Unused1 = trailingZeroesInNibble(LastByte band 15),
    Unused2 =
        case Unused1 of
            4 ->
                4 + trailingZeroesInNibble(LastByte bsr 4);
            _ ->
                Unused1
        end,
    case Unused2 of
        8 ->
            remove_trailing_bin(NamedNumberList, {0,Bfront});
        _ ->
            {Unused2,Bin}
    end.

set_choice(Alt, {L1,L2}, {Len1,_Len2}) ->
    case set_choice_tag(Alt, L1) of
        N when is_integer(N), Len1 > 1 ->
            [0,encode_constrained_number({0,Len1 - 1}, N)];
        N when is_integer(N) ->
            [0];
        false ->
            [1,
             case set_choice_tag(Alt, L2) of
                 N2 when is_integer(N2) ->
                     encode_small_number(N2);
                 false ->
                     unknown_choice_alt
             end]
    end;
set_choice(Alt, L, Len) ->
    case set_choice_tag(Alt, L) of
        N when is_integer(N), Len > 1 ->
            encode_constrained_number({0,Len - 1}, N);
        N when is_integer(N) ->
            [];
        false ->
            [unknown_choice_alt]
    end.

set_choice_tag(Alt, Choices) ->
    set_choice_tag(Alt, Choices, 0).

set_choice_tag(Alt, [Alt|_Rest], Tag) ->
    Tag;
set_choice_tag(Alt, [_H|Rest], Tag) ->
    set_choice_tag(Alt, Rest, Tag + 1);
set_choice_tag(_Alt, [], _Tag) ->
    false.

setext(false) ->
    [0];
setext(true) ->
    [1].

skipextensions(Bytes0, Nr, ExtensionBitstr)
    when is_bitstring(ExtensionBitstr) ->
    Prev = Nr - 1,
    case ExtensionBitstr of
        <<_:Prev,1:1,_/bitstring>> ->
            {Len,Bytes1} = decode_length(Bytes0),
            <<_:Len/binary,Bytes2/bitstring>> = Bytes1,
            skipextensions(Bytes2, Nr + 1, ExtensionBitstr);
        <<_:Prev,0:1,_/bitstring>> ->
            skipextensions(Bytes0, Nr + 1, ExtensionBitstr);
        _ ->
            Bytes0
    end.

trailingZeroesInNibble(0) ->
    4;
trailingZeroesInNibble(1) ->
    0;
trailingZeroesInNibble(2) ->
    1;
trailingZeroesInNibble(3) ->
    0;
trailingZeroesInNibble(4) ->
    2;
trailingZeroesInNibble(5) ->
    0;
trailingZeroesInNibble(6) ->
    1;
trailingZeroesInNibble(7) ->
    0;
trailingZeroesInNibble(8) ->
    3;
trailingZeroesInNibble(9) ->
    0;
trailingZeroesInNibble(10) ->
    1;
trailingZeroesInNibble(11) ->
    0;
trailingZeroesInNibble(12) ->
    2;
trailingZeroesInNibble(13) ->
    0;
trailingZeroesInNibble(14) ->
    1;
trailingZeroesInNibble(15) ->
    0.
