%% Generated by the Erlang ASN.1 PER-compiler version:1.6.16
%% Purpose: encoder and decoder to the types in mod megaco_per_media_gateway_control_prev3c

-module('megaco_per_media_gateway_control_prev3c').
-include("megaco_per_media_gateway_control_prev3c.hrl").
-define('RT_PER',asn1rt_per_bin).
-asn1_info([{vsn,'1.6.16'},
            {module,'megaco_per_media_gateway_control_prev3c'},
            {options,[warnings,per,errors,{cwd,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,114,49,52,98,48,50,95,112,114,101,98,117,105,108,100,95,111,112,117,95,111,46,50,48,49,49,45,48,51,45,49,52,95,50,48,47,111,116,112,95,115,114,99,95,82,49,52,66,48,50,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]},{outdir,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,114,49,52,98,48,50,95,112,114,101,98,117,105,108,100,95,111,112,117,95,111,46,50,48,49,49,45,48,51,45,49,52,95,50,48,47,111,116,112,95,115,114,99,95,82,49,52,66,48,50,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]},noobj,{i,[46]},{i,[47,110,101,116,47,105,115,105,108,100,117,114,47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,114,49,52,98,48,50,95,112,114,101,98,117,105,108,100,95,111,112,117,95,111,46,50,48,49,49,45,48,51,45,49,52,95,50,48,47,111,116,112,95,115,114,99,95,82,49,52,66,48,50,47,108,105,98,47,109,101,103,97,99,111,47,115,114,99,47,98,105,110,97,114,121]}]}]).

-export([encoding_rule/0]).
-export([
'enc_Value'/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_NotifyBehaviour'/1,
'enc_RegulatedEmbeddedDescriptor'/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_TermListAuditResult'/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_SelectLogic'/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_NotifyBehaviour'/2,
'dec_RegulatedEmbeddedDescriptor'/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_TermListAuditResult'/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_SelectLogic'/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,encode_disp/2,decode_disp/2]).

encoding_rule() ->
   per.

encode(Type,Data) ->
case catch ?RT_PER:complete(encode_disp(Type,Data)) of
  {'EXIT',{error,Reason}} ->
    {error,Reason};
  {'EXIT',Reason} ->
    {error,{asn1,Reason}};
  {Bytes,_Len} ->
    {ok,Bytes};
  Bytes when is_binary(Bytes) ->
    {ok,binary_to_list(Bytes)};
  Bytes ->
    {ok,binary_to_list(list_to_binary(Bytes))}
  end.

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

if_binary2list(B) when is_binary(B) ->
  binary_to_list(B);
if_binary2list(L) -> L.

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('NotifyBehaviour',Data) -> 'enc_NotifyBehaviour'(Data);
encode_disp('RegulatedEmbeddedDescriptor',Data) -> 'enc_RegulatedEmbeddedDescriptor'(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('TermListAuditResult',Data) -> 'enc_TermListAuditResult'(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('SelectLogic',Data) -> 'enc_SelectLogic'(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('NotifyBehaviour',Data) -> 'dec_NotifyBehaviour'(Data,mandatory);
decode_disp('RegulatedEmbeddedDescriptor',Data) -> 'dec_RegulatedEmbeddedDescriptor'(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('TermListAuditResult',Data) -> 'dec_TermListAuditResult'(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('SelectLogic',Data) -> 'dec_SelectLogic'(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() of
      MI when is_list(MI) ->
         case lists:keysearch(attributes,1,MI) of
            {value,{_,Attributes}} when is_list(Attributes) ->
               case lists:keysearch(asn1_info,1,Attributes) of
                  {value,{_,Info}} when is_list(Info) ->
                     Info;
                  _ ->
                     []
               end;
            _ ->
               []
         end
   end.

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

'enc_Value'(Val) ->
[

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

'enc_Value_components'([H|T], Acc) ->
'enc_Value_components'(T, [?RT_PER:encode_octet_string([],H) | Acc]).


'dec_Value'(Bytes,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_Value_components'(Num, Bytes1, telltype, []).
'dec_Value_components'(0, Bytes, _, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_Value_components'(Num, Bytes, _, Acc) ->
   {Term,Remain} = ?RT_PER:decode_octet_string(Bytes,[]),
   'dec_Value_components'(Num-1, Remain, telltype, [Term|Acc]).
'enc_TimeNotation'(Val) ->
Val1 = ?RT_PER:list_to_record('TimeNotation', Val),
[

%% attribute number 1 with type IA5String
?RT_PER:encode_IA5String([{'SizeConstraint',8}],?RT_PER:cindex(2,Val1,date)),

%% attribute number 2 with type IA5String
?RT_PER:encode_IA5String([{'SizeConstraint',8}],?RT_PER:cindex(3,Val1,time))].


'dec_TimeNotation'(Bytes,_) ->

%% attribute number 1 with type IA5String
{Term1,Bytes1} = ?RT_PER:decode_IA5String(Bytes,[{'SizeConstraint',8}]),

%% attribute number 2 with type IA5String
{Term2,Bytes2} = ?RT_PER:decode_IA5String(Bytes1,[{'SizeConstraint',8}]),
{{'TimeNotation',Term1,Term2},Bytes2}.

'enc_H221NonStandard'(Val) ->
Val1 = ?RT_PER:list_to_record('H221NonStandard', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,255}}],?RT_PER:cindex(2,Val1,t35CountryCode1)),

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,255}}],?RT_PER:cindex(3,Val1,t35CountryCode2)),

%% attribute number 3 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,255}}],?RT_PER:cindex(4,Val1,t35Extension)),

%% attribute number 4 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(5,Val1,manufacturerCode))].


'dec_H221NonStandard'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,255}}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = ?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,255}}]),

%% attribute number 3 with type INTEGER
{Term3,Bytes4} = ?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,255}}]),

%% attribute number 4 with type INTEGER
{Term4,Bytes5} = ?RT_PER:decode_integer(Bytes4,[{'ValueRange',{0,65535}}]),
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'H221NonStandard',Term1,Term2,Term3,Term4},Bytes7}.


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

'enc_NonStandardIdentifier'(Val) ->
[
?RT_PER:set_choice(element(1,Val),{[object,h221NonStandard,experimental],[]}, {3,0}),
case element(1,Val) of
object ->
?RT_PER:encode_object_identifier(element(2,Val));
h221NonStandard ->
'enc_H221NonStandard'(element(2,Val));
experimental ->
?RT_PER:encode_IA5String([{'SizeConstraint',8}],element(2,Val))
end
].


'dec_NonStandardIdentifier'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,3,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*3 of
0 -> {object,
?RT_PER:decode_object_identifier(Bytes2)};
1 -> {h221NonStandard,
'dec_H221NonStandard'(Bytes2,telltype)};
2 -> {experimental,
?RT_PER:decode_IA5String(Bytes2,[{'SizeConstraint',8}])};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_NonStandardData'(Val) ->
Val1 = ?RT_PER:list_to_record('NonStandardData', Val),
[

%% attribute number 1 with type Externaltypereference1043megaco_per_media_gateway_control_prev3cNonStandardIdentifier
'enc_NonStandardIdentifier'(?RT_PER:cindex(2,Val1,nonStandardIdentifier)),

%% attribute number 2 with type OCTET STRING
?RT_PER:encode_octet_string([],?RT_PER:cindex(3,Val1,data))].


'dec_NonStandardData'(Bytes,_) ->

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

%% attribute number 2 with type OCTET STRING
{Term2,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[]),
{{'NonStandardData',Term1,Term2},Bytes2}.

'enc_StatisticsParameter'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,statName)),
case ?RT_PER:cindex(3,Val1,statValue) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference1035megaco_per_media_gateway_control_prev3cValue
'enc_Value'(Tmpval1)
end].


'dec_StatisticsParameter'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',4}]),

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

end,
{{'StatisticsParameter',Term1,Term2},Bytes3}.


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

'enc_StatisticsDescriptor'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_StatisticsDescriptor_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_PackagesItem'(Val) ->
Val1 = ?RT_PER:list_to_record('PackagesItem', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],?RT_PER:cindex(2,Val1,packageName)),

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],?RT_PER:cindex(3,Val1,packageVersion))].


'dec_PackagesItem'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',2}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = ?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,99}}]),
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'PackagesItem',Term1,Term2},Bytes5}.


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

'enc_PackagesDescriptor'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_PackagesDescriptor_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_ServiceChangeProfile'(Val) ->
Val1 = ?RT_PER:list_to_record('ServiceChangeProfile', Val),
[

%% attribute number 1 with type IA5String
?RT_PER:encode_IA5String([{'SizeConstraint',{1,67}}],?RT_PER:cindex(2,Val1,profileName))].


'dec_ServiceChangeProfile'(Bytes,_) ->

%% attribute number 1 with type IA5String
{Term1,Bytes1} = ?RT_PER:decode_IA5String(Bytes,[{'SizeConstraint',{1,67}}]),
{{'ServiceChangeProfile',Term1},Bytes1}.


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

'enc_ServiceChangeMethod'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'failover' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 0)];
'forced' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 1)];
'graceful' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 2)];
'restart' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 3)];
'disconnected' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 4)];
'handOff' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 5)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_ServiceChangeMethod'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,5}}],{{failover,forced,graceful,restart,disconnected,handOff},{}}).

'enc_ServiceChangeResParm'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4,5,6],5,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,serviceChangeMgcId) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cMId
'enc_MId'(Tmpval1)
end,
case ?RT_PER:cindex(3,Val1,serviceChangeAddress) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cServiceChangeAddress
'enc_ServiceChangeAddress'(Tmpval2)
end,
case ?RT_PER:cindex(4,Val1,serviceChangeVersion) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval3)
end,
case ?RT_PER:cindex(5,Val1,serviceChangeProfile) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type Externaltypereference998megaco_per_media_gateway_control_prev3cServiceChangeProfile
'enc_ServiceChangeProfile'(Tmpval4)
end,
case ?RT_PER:cindex(6,Val1,timestamp) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 5 with type Externaltypereference999megaco_per_media_gateway_control_prev3cTimeNotation
'enc_TimeNotation'(Tmpval5)
end].


'dec_ServiceChangeResParm'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,5), 
%%  attribute number 1 with type MId
{Term1,Bytes3} = case Opt band (1 bsl 4) of
  _Opt1 when _Opt1 > 0 ->'dec_MId'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band (1 bsl 2) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_integer(Bytes4,[{'ValueRange',{0,99}}]);
0 ->{asn1_NOVALUE,Bytes4}

end,

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

end,

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

end,
{Extensions,Bytes8} = ?RT_PER:getextension(Ext,Bytes7),
Bytes9= ?RT_PER:skipextensions(Bytes8,1,Extensions)
,
{{'ServiceChangeResParm',Term1,Term2,Term3,Term4,Term5},Bytes9}.


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

'enc_ServiceChangeAddress'(Val) ->
[
?RT_PER:set_choice(element(1,Val),{[portNumber,ip4Address,ip6Address,domainName,deviceName,mtpAddress],[]}, {6,0}),
case element(1,Val) of
portNumber ->
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],element(2,Val));
ip4Address ->
'enc_IP4Address'(element(2,Val));
ip6Address ->
'enc_IP6Address'(element(2,Val));
domainName ->
'enc_DomainName'(element(2,Val));
deviceName ->
?RT_PER:encode_IA5String([{'SizeConstraint',{1,64}}],element(2,Val));
mtpAddress ->
?RT_PER:encode_octet_string([{'SizeConstraint',{2,4}}],element(2,Val))
end
].


'dec_ServiceChangeAddress'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,6,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*6 of
0 -> {portNumber,
?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,65535}}])};
1 -> {ip4Address,
'dec_IP4Address'(Bytes2,telltype)};
2 -> {ip6Address,
'dec_IP6Address'(Bytes2,telltype)};
3 -> {domainName,
'dec_DomainName'(Bytes2,telltype)};
4 -> {deviceName,
?RT_PER:decode_IA5String(Bytes2,[{'SizeConstraint',{1,64}}])};
5 -> {mtpAddress,
?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',{2,4}}])};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_ServiceChangeParm'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4,5,7,8,9,10],7,Val),
Extensions = ?RT_PER:fixextensions({ext,10,2},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,

%% attribute number 1 with type ENUMERATED
case (case ?RT_PER:cindex(2,Val1,serviceChangeMethod) of {_,Enumval1}-> Enumval1;_->?RT_PER:cindex(2,Val1,serviceChangeMethod) end) of
'failover' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 0)];
'forced' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 1)];
'graceful' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 2)];
'restart' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 3)];
'disconnected' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 4)];
'handOff' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,5}}], 5)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end,
case ?RT_PER:cindex(3,Val1,serviceChangeAddress) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference958megaco_per_media_gateway_control_prev3cServiceChangeAddress
'enc_ServiceChangeAddress'(Tmpval2)
end,
case ?RT_PER:cindex(4,Val1,serviceChangeVersion) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval3)
end,
case ?RT_PER:cindex(5,Val1,serviceChangeProfile) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type Externaltypereference960megaco_per_media_gateway_control_prev3cServiceChangeProfile
'enc_ServiceChangeProfile'(Tmpval4)
end,

%% attribute number 5 with type Externaltypereference961megaco_per_media_gateway_control_prev3cValue
'enc_Value'(?RT_PER:cindex(6,Val1,serviceChangeReason)),
case ?RT_PER:cindex(7,Val1,serviceChangeDelay) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 6 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval5)
end,
case ?RT_PER:cindex(8,Val1,serviceChangeMgcId) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 7 with type Externaltypereference974megaco_per_media_gateway_control_prev3cMId
'enc_MId'(Tmpval6)
end,
case ?RT_PER:cindex(9,Val1,timeStamp) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 8 with type Externaltypereference975megaco_per_media_gateway_control_prev3cTimeNotation
'enc_TimeNotation'(Tmpval7)
end,
case ?RT_PER:cindex(10,Val1,nonStandardData) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 9 with type Externaltypereference976megaco_per_media_gateway_control_prev3cNonStandardData
'enc_NonStandardData'(Tmpval8)
end
,Extensions
,
case ?RT_PER:cindex(11,Val1,serviceChangeInfo) of
asn1_NOVALUE -> [];
Tmpval9 ->

%% attribute number 10 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cAuditDescriptor
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_AuditDescriptor'(Tmpval9)))
end,
case ?RT_PER:cindex(12,Val1,serviceChangeIncompleteFlag) of
asn1_NOVALUE -> [];
Tmpval10 ->

%% attribute number 11 with type NULL
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_null(Tmpval10)))
end].


'dec_ServiceChangeParm'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,7), 
%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = ?RT_PER:decode_enumerated(Bytes2,[{'ValueRange',{0,5}}],{{failover,forced,graceful,restart,disconnected,handOff},{}}),

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

end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band (1 bsl 5) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_integer(Bytes4,[{'ValueRange',{0,99}}]);
0 ->{asn1_NOVALUE,Bytes4}

end,

%%  attribute number 4 with type ServiceChangeProfile
{Term4,Bytes6} = case Opt band (1 bsl 4) of
  _Opt4 when _Opt4 > 0 ->'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 band (1 bsl 3) of
  _Opt6 when _Opt6 > 0 ->?RT_PER:decode_integer(Bytes7,[{'ValueRange',{0,4294967295}}]);
0 ->{asn1_NOVALUE,Bytes7}

end,

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

end,

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

end,

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

end,
{Extensions,Bytes12} = ?RT_PER:getextension(Ext,Bytes11),

%%  attribute number 10 with type AuditDescriptor
{Term10,Bytes13} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal10,Trem10}=?RT_PER:decode_open_type(Bytes12,[]),
{TmpValx10,_}='dec_AuditDescriptor'(TmpVal10,telltype), {TmpValx10,Trem10}
end;
_  ->
{asn1_NOVALUE,Bytes12}

end,

%% attribute number 11 with type NULL
{Term11,Bytes14} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal11,Trem11}=?RT_PER:decode_open_type(Bytes13,[]),
{TmpValx11,_}=?RT_PER:decode_null(TmpVal11), {TmpValx11,Trem11}
end;
_  ->
{asn1_NOVALUE,Bytes13}

end,
Bytes15= ?RT_PER:skipextensions(Bytes14,3,Extensions)
,
{{'ServiceChangeParm',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9,Term10,Term11},Bytes15}.

'enc_DigitMapValue'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,5,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,startTimer) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,shortTimer) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,longTimer) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval4)
end,

%% attribute number 4 with type IA5String
?RT_PER:encode_IA5String([],?RT_PER:cindex(5,Val1,digitMapBody))
,Extensions
,
case ?RT_PER:cindex(6,Val1,durationTimer) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 5 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,99}}],Tmpval5)))
end].


'dec_DigitMapValue'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,99}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,99}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_integer(Bytes4,[{'ValueRange',{0,99}}]);
0 ->{asn1_NOVALUE,Bytes4}

end,

%% attribute number 4 with type IA5String
{Term4,Bytes6} = ?RT_PER:decode_IA5String(Bytes5,[]),
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),

%% attribute number 5 with type INTEGER
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}=?RT_PER:decode_integer(TmpVal5,[{'ValueRange',{0,99}}]), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,
Bytes9= ?RT_PER:skipextensions(Bytes8,2,Extensions)
,
{{'DigitMapValue',Term1,Term2,Term3,Term4,Term5},Bytes9}.


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

'enc_DigitMapName'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',2}],Val).


'dec_DigitMapName'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',2}]).

'enc_DigitMapDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3],2,Val),
[
Opt,
case ?RT_PER:cindex(2,Val1,digitMapName) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],Tmpval1)
end,
case ?RT_PER:cindex(3,Val1,digitMapValue) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference935megaco_per_media_gateway_control_prev3cDigitMapValue
'enc_DigitMapValue'(Tmpval2)
end].


'dec_DigitMapDescriptor'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,2), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = case Opt band (1 bsl 1) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',2}]);
0 ->{asn1_NOVALUE,Bytes1}

end,

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

end,
{{'DigitMapDescriptor',Term1,Term2},Bytes3}.


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

'enc_ModemType'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'v18' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 0)];
'v22' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 1)];
'v22bis' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 2)];
'v32' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 3)];
'v32bis' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 4)];
'v34' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 5)];
'v90' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 6)];
'v91' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 7)];
'synchISDN' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 8)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_ModemType'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,8}}],{{v18,v22,v22bis,v32,v32bis,v34,v90,v91,synchISDN},{}}).

'enc_ModemDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_ModemDescriptor_mtl'(?RT_PER:cindex(2,Val1,mtl)),

%% attribute number 2 with type SEQUENCE OF
'enc_ModemDescriptor_mpl'(?RT_PER:cindex(3,Val1,mpl)),
case ?RT_PER:cindex(4,Val1,nonStandardData) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type Externaltypereference915megaco_per_media_gateway_control_prev3cNonStandardData
'enc_NonStandardData'(Tmpval1)
end].

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

'enc_ModemDescriptor_mtl'(Val) ->
[

   ?RT_PER:encode_length(undefined,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 (case H of {_,Enumval1}-> Enumval1;_->H end) of
'v18' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 0)];
'v22' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 1)];
'v22bis' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 2)];
'v32' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 3)];
'v32bis' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 4)];
'v34' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 5)];
'v90' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 6)];
'v91' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 7)];
'synchISDN' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,8}}], 8)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end | Acc]).

'dec_ModemDescriptor_mtl'(Bytes,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ModemDescriptor_mtl_components'(Num, Bytes1, telltype, []).
'dec_ModemDescriptor_mtl_components'(0, Bytes, _, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ModemDescriptor_mtl_components'(Num, Bytes, _, Acc) ->
   {Term,Remain} = ?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,8}}],{{v18,v22,v22bis,v32,v32bis,v34,v90,v91,synchISDN},{}}),
   'dec_ModemDescriptor_mtl_components'(Num-1, Remain, telltype, [Term|Acc]).

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

'enc_ModemDescriptor_mpl'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ModemDescriptor_mpl_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ModemDescriptor'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% 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 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'dec_NonStandardData'(Bytes3,telltype);
0 ->{asn1_NOVALUE,Bytes3}

end,
{{'ModemDescriptor',Term1,Term2,Term3},Bytes4}.


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

'enc_RequestID'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Val).


'dec_RequestID'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,4294967295}}]).

'enc_SigParameter'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],?RT_PER:cindex(2,Val1,sigParameterName)),

%% attribute number 2 with type Externaltypereference896megaco_per_media_gateway_control_prev3cValue
'enc_Value'(?RT_PER:cindex(3,Val1,value)),
case ?RT_PER:cindex(4,Val1,extraInfo) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type CHOICE
'enc_SigParameter_extraInfo'(Tmpval1)
end].

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

'enc_SigParameter_extraInfo'(Val) ->
[
?RT_PER:set_choice(element(1,Val),[relation,range,sublist], 3),
case element(1,Val) of
relation ->
case (case element(2,Val) of {_,Enumval1}-> Enumval1;_->element(2,Val) end) of
'greaterThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'smallerThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'unequalTo' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end;
range ->
?RT_PER:encode_boolean(element(2,Val));
sublist ->
?RT_PER:encode_boolean(element(2,Val))
end
].

'dec_SigParameter_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,3, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {relation,
?RT_PER:decode_enumerated(Bytes1,[{'ValueRange',{0,2}}],{{greaterThan,smallerThan,unequalTo},{}})};
1 -> {range,
?RT_PER:decode_boolean(Bytes1)};
2 -> {sublist,
?RT_PER:decode_boolean(Bytes1)}
end,

{{Cname,Val},NewBytes}.


'dec_SigParameter'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',2}]),

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

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'SigParameter',Term1,Term2,Term3},Bytes7}.


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

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


'dec_NotifyCompletion'(Bytes,_) ->
?RT_PER:decode_bit_string(Bytes,[],[{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3},{onIteration,4}]).


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

'enc_SignalName'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',4}],Val).


'dec_SignalName'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]).


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

'enc_SignalDirection'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'internal' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'external' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'both' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_SignalDirection'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,2}}],{{internal,external,both},{}}).


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

'enc_SignalType'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'brief' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'onOff' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'timeOut' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_SignalType'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,2}}],{{brief,onOff,timeOut},{}}).

'enc_Signal'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4,5,6,7],5,Val),
Extensions = ?RT_PER:fixextensions({ext,8,3},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,signalName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval2)
end,
case ?RT_PER:cindex(4,Val1,sigType) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type ENUMERATED
case (case Tmpval3 of {_,Enumval3}-> Enumval3;_->Tmpval3 end) of
'brief' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'onOff' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'timeOut' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end
end,
case ?RT_PER:cindex(5,Val1,duration) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval4)
end,
case ?RT_PER:cindex(6,Val1,notifyCompletion) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 5 with type BIT STRING
?RT_PER:encode_bit_string([],Tmpval5,[{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3},{onIteration,4}])
end,
case ?RT_PER:cindex(7,Val1,keepActive) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 6 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval6)
end,

%% attribute number 7 with type SEQUENCE OF
'enc_Signal_sigParList'(?RT_PER:cindex(8,Val1,sigParList))
,Extensions
,
case ?RT_PER:cindex(9,Val1,direction) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 8 with type ENUMERATED
?RT_PER:encode_open_type(dummy,?RT_PER:complete(case (case Tmpval7 of {_,Enumval8}-> Enumval8;_->Tmpval7 end) of
'internal' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'external' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'both' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end))
end,
case ?RT_PER:cindex(10,Val1,requestID) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 9 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval8)))
end,
case ?RT_PER:cindex(11,Val1,intersigDelay) of
asn1_NOVALUE -> [];
Tmpval9 ->

%% attribute number 10 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval9)))
end].

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

'enc_Signal_sigParList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_Signal_sigParList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_Signal'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,5), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 4) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type ENUMERATED
{Term3,Bytes5} = case Opt band (1 bsl 3) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_enumerated(Bytes4,[{'ValueRange',{0,2}}],{{brief,onOff,timeOut},{}});
0 ->{asn1_NOVALUE,Bytes4}

end,

%% attribute number 4 with type INTEGER
{Term4,Bytes6} = case Opt band (1 bsl 2) of
  _Opt4 when _Opt4 > 0 ->?RT_PER:decode_integer(Bytes5,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes5}

end,

%% attribute number 5 with type BIT STRING
{Term5,Bytes7} = case Opt band (1 bsl 1) of
  _Opt5 when _Opt5 > 0 ->?RT_PER:decode_bit_string(Bytes6,[],[{onTimeOut,0},{onInterruptByEvent,1},{onInterruptByNewSignalDescr,2},{otherReason,3},{onIteration,4}]);
0 ->{asn1_NOVALUE,Bytes6}

end,

%% attribute number 6 with type BOOLEAN
{Term6,Bytes8} = case Opt band (1 bsl 0) of
  _Opt6 when _Opt6 > 0 ->?RT_PER:decode_boolean(Bytes7);
0 ->{asn1_NOVALUE,Bytes7}

end,

%% attribute number 7 with type SEQUENCE OF
{Term7,Bytes9} = 'dec_Signal_sigParList'(Bytes8, telltype),
{Extensions,Bytes10} = ?RT_PER:getextension(Ext,Bytes9),

%% attribute number 8 with type ENUMERATED
{Term8,Bytes11} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal8,Trem8}=?RT_PER:decode_open_type(Bytes10,[]),
{TmpValx8,_}=?RT_PER:decode_enumerated(TmpVal8,[{'ValueRange',{0,2}}],{{internal,external,both},{}}), {TmpValx8,Trem8}
end;
_  ->
{asn1_NOVALUE,Bytes10}

end,

%% attribute number 9 with type INTEGER
{Term9,Bytes12} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal9,Trem9}=?RT_PER:decode_open_type(Bytes11,[]),
{TmpValx9,_}=?RT_PER:decode_integer(TmpVal9,[{'ValueRange',{0,4294967295}}]), {TmpValx9,Trem9}
end;
_  ->
{asn1_NOVALUE,Bytes11}

end,

%% attribute number 10 with type INTEGER
{Term10,Bytes13} = case Extensions of
  _ when size(Extensions) >= 3,element(3,Extensions) == 1 ->
begin
{TmpVal10,Trem10}=?RT_PER:decode_open_type(Bytes12,[]),
{TmpValx10,_}=?RT_PER:decode_integer(TmpVal10,[{'ValueRange',{0,65535}}]), {TmpValx10,Trem10}
end;
_  ->
{asn1_NOVALUE,Bytes12}

end,
Bytes14= ?RT_PER:skipextensions(Bytes13,4,Extensions)
,
{{'Signal',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9,Term10},Bytes14}.

'enc_SeqSigList'(Val) ->
Val1 = ?RT_PER:list_to_record('SeqSigList', Val),
[

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(2,Val1,id)),

%% attribute number 2 with type SEQUENCE OF
'enc_SeqSigList_signalList'(?RT_PER:cindex(3,Val1,signalList))].

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

'enc_SeqSigList_signalList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_SeqSigList_signalList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_SeqSigList'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]),

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


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

'enc_SignalRequest'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,2,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*2 of
0 -> {signal,
'dec_Signal'(Bytes2,telltype)};
1 -> {seqSigList,
'dec_SeqSigList'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.

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

'enc_SignalsDescriptor'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_SignalsDescriptor_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_EventSpec'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,eventName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end,

%% attribute number 3 with type SEQUENCE OF
'enc_EventSpec_eventParList'(?RT_PER:cindex(4,Val1,eventParList))].

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

'enc_EventSpec_eventParList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_EventSpec_eventParList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_EventSpec'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type SEQUENCE OF
{Term3,Bytes5} = 'dec_EventSpec_eventParList'(Bytes4, telltype),
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'EventSpec',Term1,Term2,Term3},Bytes7}.


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

'enc_EventBufferDescriptor'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_EventBufferDescriptor_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_SecondRequestedActions'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,4,2},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,keepActive) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,eventDM) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cEventDM
'enc_EventDM'(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,signalsDescriptor) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference822megaco_per_media_gateway_control_prev3cSignalsDescriptor
'enc_SignalsDescriptor'(Tmpval4)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,notifyBehaviour) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cNotifyBehaviour
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_NotifyBehaviour'(Tmpval5)))
end,
case ?RT_PER:cindex(6,Val1,resetEventsDescriptor) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type NULL
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_null(Tmpval6)))
end].


'dec_SecondRequestedActions'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%% attribute number 1 with type BOOLEAN
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_boolean(Bytes2);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%%  attribute number 4 with type NotifyBehaviour
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}='dec_NotifyBehaviour'(TmpVal4,telltype), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,

%% attribute number 5 with type NULL
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}=?RT_PER:decode_null(TmpVal5), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,
Bytes9= ?RT_PER:skipextensions(Bytes8,3,Extensions)
,
{{'SecondRequestedActions',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_SecondRequestedEvent'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,pkgdName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end,
case ?RT_PER:cindex(4,Val1,eventAction) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cSecondRequestedActions
'enc_SecondRequestedActions'(Tmpval2)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_SecondRequestedEvent_evParList'(?RT_PER:cindex(5,Val1,evParList))].

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

'enc_SecondRequestedEvent_evParList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_SecondRequestedEvent_evParList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_SecondRequestedEvent'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,

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

end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_SecondRequestedEvent_evParList'(Bytes5, telltype),
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),
Bytes8= ?RT_PER:skipextensions(Bytes7,1,Extensions)
,
{{'SecondRequestedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_SecondEventsDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,requestID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval1)
end,

%% attribute number 2 with type SEQUENCE OF
'enc_SecondEventsDescriptor_eventList'(?RT_PER:cindex(3,Val1,eventList))].

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

'enc_SecondEventsDescriptor_eventList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_SecondEventsDescriptor_eventList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_SecondEventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,4294967295}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_SecondEventsDescriptor_eventList'(Bytes3, telltype),
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'SecondEventsDescriptor',Term1,Term2},Bytes6}.


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

'enc_EventDM'(Val) ->
[
?RT_PER:set_choice(element(1,Val),[digitMapName,digitMapValue], 2),
case element(1,Val) of
digitMapName ->
?RT_PER:encode_octet_string([{'SizeConstraint',2}],element(2,Val));
digitMapValue ->
'enc_DigitMapValue'(element(2,Val))
end
].


'dec_EventDM'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {digitMapName,
?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',2}])};
1 -> {digitMapValue,
'dec_DigitMapValue'(Bytes1,telltype)}
end,

{{Cname,Val},NewBytes}.
'enc_RequestedActions'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4,5],4,Val),
Extensions = ?RT_PER:fixextensions({ext,5,2},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,keepActive) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,eventDM) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereference788megaco_per_media_gateway_control_prev3cEventDM
'enc_EventDM'(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,secondEvent) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference789megaco_per_media_gateway_control_prev3cSecondEventsDescriptor
'enc_SecondEventsDescriptor'(Tmpval4)
end,
case ?RT_PER:cindex(5,Val1,signalsDescriptor) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereference790megaco_per_media_gateway_control_prev3cSignalsDescriptor
'enc_SignalsDescriptor'(Tmpval5)
end
,Extensions
,
case ?RT_PER:cindex(6,Val1,notifyBehaviour) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type Externaltypereference792megaco_per_media_gateway_control_prev3cNotifyBehaviour
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_NotifyBehaviour'(Tmpval6)))
end,
case ?RT_PER:cindex(7,Val1,resetEventsDescriptor) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 6 with type NULL
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_null(Tmpval7)))
end].


'dec_RequestedActions'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,4), 
%% attribute number 1 with type BOOLEAN
{Term1,Bytes3} = case Opt band (1 bsl 3) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_boolean(Bytes2);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,

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

end,

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

end,
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),

%%  attribute number 5 with type NotifyBehaviour
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}='dec_NotifyBehaviour'(TmpVal5,telltype), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,

%% attribute number 6 with type NULL
{Term6,Bytes9} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal6,Trem6}=?RT_PER:decode_open_type(Bytes8,[]),
{TmpValx6,_}=?RT_PER:decode_null(TmpVal6), {TmpValx6,Trem6}
end;
_  ->
{asn1_NOVALUE,Bytes8}

end,
Bytes10= ?RT_PER:skipextensions(Bytes9,3,Extensions)
,
{{'RequestedActions',Term1,Term2,Term3,Term4,Term5,Term6},Bytes10}.


'enc_NotifyBehaviour'({'NotifyBehaviour',Val}) ->
'enc_NotifyBehaviour'(Val);

'enc_NotifyBehaviour'(Val) ->
[
?RT_PER:set_choice(element(1,Val),{[notifyImmediate,notifyRegulated,neverNotify],[]}, {3,0}),
case element(1,Val) of
notifyImmediate ->
?RT_PER:encode_null(element(2,Val));
notifyRegulated ->
'enc_RegulatedEmbeddedDescriptor'(element(2,Val));
neverNotify ->
?RT_PER:encode_null(element(2,Val))
end
].


'dec_NotifyBehaviour'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,3,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*3 of
0 -> {notifyImmediate,
?RT_PER:decode_null(Bytes2)};
1 -> {notifyRegulated,
'dec_RegulatedEmbeddedDescriptor'(Bytes2,telltype)};
2 -> {neverNotify,
?RT_PER:decode_null(Bytes2)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_RegulatedEmbeddedDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3],2,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,secondEvent) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cSecondEventsDescriptor
'enc_SecondEventsDescriptor'(Tmpval1)
end,
case ?RT_PER:cindex(3,Val1,signalsDescriptor) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereference773megaco_per_media_gateway_control_prev3cSignalsDescriptor
'enc_SignalsDescriptor'(Tmpval2)
end].


'dec_RegulatedEmbeddedDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%%  attribute number 1 with type SecondEventsDescriptor
{Term1,Bytes3} = case Opt band (1 bsl 1) of
  _Opt1 when _Opt1 > 0 ->'dec_SecondEventsDescriptor'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

%%  attribute number 2 with type SignalsDescriptor
{Term2,Bytes4} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->'dec_SignalsDescriptor'(Bytes3,telltype);
0 ->{asn1_NOVALUE,Bytes3}

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'RegulatedEmbeddedDescriptor',Term1,Term2},Bytes6}.

'enc_RequestedEvent'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,pkgdName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end,
case ?RT_PER:cindex(4,Val1,eventAction) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type Externaltypereference765megaco_per_media_gateway_control_prev3cRequestedActions
'enc_RequestedActions'(Tmpval2)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_RequestedEvent_evParList'(?RT_PER:cindex(5,Val1,evParList))].

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

'enc_RequestedEvent_evParList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_RequestedEvent_evParList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_RequestedEvent'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,

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

end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_RequestedEvent_evParList'(Bytes5, telltype),
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),
Bytes8= ?RT_PER:skipextensions(Bytes7,1,Extensions)
,
{{'RequestedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_EventsDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,requestID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval1)
end,

%% attribute number 2 with type SEQUENCE OF
'enc_EventsDescriptor_eventList'(?RT_PER:cindex(3,Val1,eventList))].

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

'enc_EventsDescriptor_eventList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_EventsDescriptor_eventList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_EventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,4294967295}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes4} = 'dec_EventsDescriptor_eventList'(Bytes3, telltype),
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'EventsDescriptor',Term1,Term2},Bytes6}.


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

'enc_StreamID'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Val).


'dec_StreamID'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]).


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

'enc_MuxType'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'h221' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 0)];
'h223' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 1)];
'h226' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 2)];
'v76' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 3)];
'nx64k' -> [{bit,1},?RT_PER:encode_small_number(0)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_MuxType'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,3}}],{{h221,h223,h226,v76},{nx64k}}).

'enc_MuxDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type ENUMERATED
case (case ?RT_PER:cindex(2,Val1,muxType) of {_,Enumval1}-> Enumval1;_->?RT_PER:cindex(2,Val1,muxType) end) of
'h221' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 0)];
'h223' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 1)];
'h226' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 2)];
'v76' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,3}}], 3)];
'nx64k' -> [{bit,1},?RT_PER:encode_small_number(0)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end,

%% attribute number 2 with type SEQUENCE OF
'enc_MuxDescriptor_termList'(?RT_PER:cindex(3,Val1,termList)),
case ?RT_PER:cindex(4,Val1,nonStandardData) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type Externaltypereference736megaco_per_media_gateway_control_prev3cNonStandardData
'enc_NonStandardData'(Tmpval1)
end].

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

'enc_MuxDescriptor_termList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_MuxDescriptor_termList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_MuxDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = ?RT_PER:decode_enumerated(Bytes2,[{'ValueRange',{0,3}}],{{h221,h223,h226,v76},{nx64k}}),

%% 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 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'dec_NonStandardData'(Bytes4,telltype);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'MuxDescriptor',Term1,Term2,Term3},Bytes7}.


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

'enc_ServiceState'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'test' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'outOfSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'inSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_ServiceState'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,2}}],{{test,outOfSvc,inSvc},{}}).


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

'enc_EventBufferControl'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'off' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 0)];
'lockStep' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 1)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_EventBufferControl'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,1}}],{{off,lockStep},{}}).

'enc_TerminationStateDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_TerminationStateDescriptor_propertyParms'(?RT_PER:cindex(2,Val1,propertyParms)),
case ?RT_PER:cindex(3,Val1,eventBufferControl) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type ENUMERATED
case (case Tmpval1 of {_,Enumval1}-> Enumval1;_->Tmpval1 end) of
'off' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 0)];
'lockStep' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 1)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end
end,
case ?RT_PER:cindex(4,Val1,serviceState) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type ENUMERATED
case (case Tmpval2 of {_,Enumval3}-> Enumval3;_->Tmpval2 end) of
'test' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'outOfSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'inSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end
end].

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

'enc_TerminationStateDescriptor_propertyParms'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TerminationStateDescriptor_propertyParms_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_TerminationStateDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes3} = 'dec_TerminationStateDescriptor_propertyParms'(Bytes2, telltype),

%% attribute number 2 with type ENUMERATED
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_enumerated(Bytes3,[{'ValueRange',{0,1}}],{{off,lockStep},{}});
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type ENUMERATED
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_enumerated(Bytes4,[{'ValueRange',{0,2}}],{{test,outOfSvc,inSvc},{}});
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'TerminationStateDescriptor',Term1,Term2,Term3},Bytes7}.


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

'enc_PropertyGroup'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_PropertyGroup_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_LocalRemoteDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('LocalRemoteDescriptor', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type SEQUENCE OF
'enc_LocalRemoteDescriptor_propGrps'(?RT_PER:cindex(2,Val1,propGrps))].

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

'enc_LocalRemoteDescriptor_propGrps'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_LocalRemoteDescriptor_propGrps_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_LocalRemoteDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes2} = 'dec_LocalRemoteDescriptor_propGrps'(Bytes1, telltype),
{Extensions,Bytes3} = ?RT_PER:getextension(Ext,Bytes2),
Bytes4= ?RT_PER:skipextensions(Bytes3,1,Extensions)
,
{{'LocalRemoteDescriptor',Term1},Bytes4}.


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

'enc_Relation'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'greaterThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'smallerThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'unequalTo' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_Relation'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,2}}],{{greaterThan,smallerThan,unequalTo},{}}).


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

'enc_PkgdName'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',4}],Val).


'dec_PkgdName'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]).


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

'enc_Name'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',2}],Val).


'dec_Name'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',2}]).

'enc_PropertyParm'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,name)),

%% attribute number 2 with type SEQUENCE OF
'enc_PropertyParm_value'(?RT_PER:cindex(3,Val1,value)),
case ?RT_PER:cindex(4,Val1,extraInfo) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type CHOICE
'enc_PropertyParm_extraInfo'(Tmpval1)
end].

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

'enc_PropertyParm_value'(Val) ->
[

   ?RT_PER:encode_length(undefined,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, [?RT_PER:encode_octet_string([],H) | Acc]).

'dec_PropertyParm_value'(Bytes,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_PropertyParm_value_components'(Num, Bytes1, telltype, []).
'dec_PropertyParm_value_components'(0, Bytes, _, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_PropertyParm_value_components'(Num, Bytes, _, Acc) ->
   {Term,Remain} = ?RT_PER:decode_octet_string(Bytes,[]),
   'dec_PropertyParm_value_components'(Num-1, Remain, telltype, [Term|Acc]).

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

'enc_PropertyParm_extraInfo'(Val) ->
[
?RT_PER:set_choice(element(1,Val),[relation,range,sublist], 3),
case element(1,Val) of
relation ->
case (case element(2,Val) of {_,Enumval1}-> Enumval1;_->element(2,Val) end) of
'greaterThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'smallerThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'unequalTo' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end;
range ->
?RT_PER:encode_boolean(element(2,Val));
sublist ->
?RT_PER:encode_boolean(element(2,Val))
end
].

'dec_PropertyParm_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,3, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {relation,
?RT_PER:decode_enumerated(Bytes1,[{'ValueRange',{0,2}}],{{greaterThan,smallerThan,unequalTo},{}})};
1 -> {range,
?RT_PER:decode_boolean(Bytes1)};
2 -> {sublist,
?RT_PER:decode_boolean(Bytes1)}
end,

{{Cname,Val},NewBytes}.


'dec_PropertyParm'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% 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 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'dec_PropertyParm_extraInfo'(Bytes4, telltype);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'PropertyParm',Term1,Term2,Term3},Bytes7}.


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

'enc_StreamMode'(Val) ->
case (case Val of {_,Enumval1}-> Enumval1;_->Val end) of
'sendOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 0)];
'recvOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 1)];
'sendRecv' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 2)];
'inactive' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 3)];
'loopBack' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 4)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end.


'dec_StreamMode'(Bytes,_) ->
?RT_PER:decode_enumerated(Bytes,[{'ValueRange',{0,4}}],{{sendOnly,recvOnly,sendRecv,inactive,loopBack},{}}).

'enc_LocalControlDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,streamMode) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type ENUMERATED
case (case Tmpval1 of {_,Enumval1}-> Enumval1;_->Tmpval1 end) of
'sendOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 0)];
'recvOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 1)];
'sendRecv' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 2)];
'inactive' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 3)];
'loopBack' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 4)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end
end,
case ?RT_PER:cindex(3,Val1,reserveValue) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval2)
end,
case ?RT_PER:cindex(4,Val1,reserveGroup) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval3)
end,

%% attribute number 4 with type SEQUENCE OF
'enc_LocalControlDescriptor_propertyParms'(?RT_PER:cindex(5,Val1,propertyParms))].

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

'enc_LocalControlDescriptor_propertyParms'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_LocalControlDescriptor_propertyParms_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_LocalControlDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%% attribute number 1 with type ENUMERATED
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_enumerated(Bytes2,[{'ValueRange',{0,4}}],{{sendOnly,recvOnly,sendRecv,inactive,loopBack},{}});
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type BOOLEAN
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_boolean(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type BOOLEAN
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_boolean(Bytes4);
0 ->{asn1_NOVALUE,Bytes4}

end,

%% attribute number 4 with type SEQUENCE OF
{Term4,Bytes6} = 'dec_LocalControlDescriptor_propertyParms'(Bytes5, telltype),
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),
Bytes8= ?RT_PER:skipextensions(Bytes7,1,Extensions)
,
{{'LocalControlDescriptor',Term1,Term2,Term3,Term4},Bytes8}.

'enc_StreamParms'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,4,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,localControlDescriptor) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type Externaltypereference618megaco_per_media_gateway_control_prev3cLocalControlDescriptor
'enc_LocalControlDescriptor'(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,localDescriptor) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereference619megaco_per_media_gateway_control_prev3cLocalRemoteDescriptor
'enc_LocalRemoteDescriptor'(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,remoteDescriptor) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference620megaco_per_media_gateway_control_prev3cLocalRemoteDescriptor
'enc_LocalRemoteDescriptor'(Tmpval4)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,statisticsDescriptor) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereference622megaco_per_media_gateway_control_prev3cStatisticsDescriptor
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_StatisticsDescriptor'(Tmpval5)))
end].


'dec_StreamParms'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%%  attribute number 1 with type LocalControlDescriptor
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->'dec_LocalControlDescriptor'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%%  attribute number 4 with type StatisticsDescriptor
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}='dec_StatisticsDescriptor'(TmpVal4,telltype), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,
Bytes8= ?RT_PER:skipextensions(Bytes7,2,Extensions)
,
{{'StreamParms',Term1,Term2,Term3,Term4},Bytes8}.

'enc_StreamDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('StreamDescriptor', Val),
[

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(2,Val1,streamID)),

%% attribute number 2 with type Externaltypereference613megaco_per_media_gateway_control_prev3cStreamParms
'enc_StreamParms'(?RT_PER:cindex(3,Val1,streamParms))].


'dec_StreamDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]),

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

'enc_MediaDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3],2,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,termStateDescr) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereference601megaco_per_media_gateway_control_prev3cTerminationStateDescriptor
'enc_TerminationStateDescriptor'(Tmpval1)
end,
case ?RT_PER:cindex(3,Val1,streams) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type CHOICE
'enc_MediaDescriptor_streams'(Tmpval2)
end].

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

'enc_MediaDescriptor_streams'(Val) ->
[
?RT_PER: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'({'MediaDescriptor_streams_multiStream',Val}) ->
'enc_MediaDescriptor_streams_multiStream'(Val);

'enc_MediaDescriptor_streams_multiStream'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_MediaDescriptor_streams_multiStream_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'dec_MediaDescriptor_streams'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {oneStream,
'dec_StreamParms'(Bytes1,telltype)};
1 -> {multiStream,
'dec_MediaDescriptor_streams_multiStream'(Bytes1, telltype)}
end,

{{Cname,Val},NewBytes}.


'dec_MediaDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%%  attribute number 1 with type TerminationStateDescriptor
{Term1,Bytes3} = case Opt band (1 bsl 1) of
  _Opt1 when _Opt1 > 0 ->'dec_TerminationStateDescriptor'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'MediaDescriptor',Term1,Term2},Bytes6}.


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

'enc_TerminationIDList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TerminationIDList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_TerminationID'(Val) ->
Val1 = ?RT_PER:list_to_record('TerminationID', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type SEQUENCE OF
'enc_TerminationID_wildcard'(?RT_PER:cindex(2,Val1,wildcard)),

%% attribute number 2 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',{1,8}}],?RT_PER:cindex(3,Val1,id))].

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

'enc_TerminationID_wildcard'(Val) ->
[

   ?RT_PER:encode_length(undefined,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, [?RT_PER:encode_octet_string([{'SizeConstraint',1}],H) | Acc]).

'dec_TerminationID_wildcard'(Bytes,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TerminationID_wildcard_components'(Num, Bytes1, telltype, []).
'dec_TerminationID_wildcard_components'(0, Bytes, _, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_TerminationID_wildcard_components'(Num, Bytes, _, Acc) ->
   {Term,Remain} = ?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',1}]),
   'dec_TerminationID_wildcard_components'(Num-1, Remain, telltype, [Term|Acc]).


'dec_TerminationID'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

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

%% attribute number 2 with type OCTET STRING
{Term2,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',{1,8}}]),
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'TerminationID',Term1,Term2},Bytes5}.


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

'enc_WildcardField'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',1}],Val).


'dec_WildcardField'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',1}]).


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

'enc_ServiceChangeResult'(Val) ->
[
?RT_PER: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} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {errorDescriptor,
'dec_ErrorDescriptor'(Bytes1,telltype)};
1 -> {serviceChangeResParms,
'dec_ServiceChangeResParm'(Bytes1,telltype)}
end,

{{Cname,Val},NewBytes}.
'enc_ServiceChangeReply'(Val) ->
Val1 = ?RT_PER:list_to_record('ServiceChangeReply', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type Externaltypereference573megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type Externaltypereference574megaco_per_media_gateway_control_prev3cServiceChangeResult
'enc_ServiceChangeResult'(?RT_PER:cindex(3,Val1,serviceChangeResult))].


'dec_ServiceChangeReply'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%%  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,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'ServiceChangeReply',Term1,Term2},Bytes5}.

'enc_ServiceChangeRequest'(Val) ->
Val1 = ?RT_PER:list_to_record('ServiceChangeRequest', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type Externaltypereference566megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type Externaltypereference567megaco_per_media_gateway_control_prev3cServiceChangeParm
'enc_ServiceChangeParm'(?RT_PER:cindex(3,Val1,serviceChangeParms))].


'dec_ServiceChangeRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%%  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,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'ServiceChangeRequest',Term1,Term2},Bytes5}.

'enc_EventParameter'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],?RT_PER:cindex(2,Val1,eventParameterName)),

%% attribute number 2 with type Externaltypereference552megaco_per_media_gateway_control_prev3cValue
'enc_Value'(?RT_PER:cindex(3,Val1,value)),
case ?RT_PER:cindex(4,Val1,extraInfo) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 3 with type CHOICE
'enc_EventParameter_extraInfo'(Tmpval1)
end].

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

'enc_EventParameter_extraInfo'(Val) ->
[
?RT_PER:set_choice(element(1,Val),[relation,range,sublist], 3),
case element(1,Val) of
relation ->
case (case element(2,Val) of {_,Enumval1}-> Enumval1;_->element(2,Val) end) of
'greaterThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'smallerThan' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'unequalTo' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end;
range ->
?RT_PER:encode_boolean(element(2,Val));
sublist ->
?RT_PER:encode_boolean(element(2,Val))
end
].

'dec_EventParameter_extraInfo'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,3, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {relation,
?RT_PER:decode_enumerated(Bytes1,[{'ValueRange',{0,2}}],{{greaterThan,smallerThan,unequalTo},{}})};
1 -> {range,
?RT_PER:decode_boolean(Bytes1)};
2 -> {sublist,
?RT_PER:decode_boolean(Bytes1)}
end,

{{Cname,Val},NewBytes}.


'dec_EventParameter'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',2}]),

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

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'EventParameter',Term1,Term2,Term3},Bytes7}.


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

'enc_EventName'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',4}],Val).


'dec_EventName'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]).

'enc_ObservedEvent'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,5],2,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,eventName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end,

%% attribute number 3 with type SEQUENCE OF
'enc_ObservedEvent_eventParList'(?RT_PER:cindex(4,Val1,eventParList)),
case ?RT_PER:cindex(5,Val1,timeNotation) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 4 with type Externaltypereference543megaco_per_media_gateway_control_prev3cTimeNotation
'enc_TimeNotation'(Tmpval2)
end].

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

'enc_ObservedEvent_eventParList'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ObservedEvent_eventParList_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ObservedEvent'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
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 bsl 0) of
  _Opt4 when _Opt4 > 0 ->'dec_TimeNotation'(Bytes5,telltype);
0 ->{asn1_NOVALUE,Bytes5}

end,
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),
Bytes8= ?RT_PER:skipextensions(Bytes7,1,Extensions)
,
{{'ObservedEvent',Term1,Term2,Term3,Term4},Bytes8}.

'enc_ObservedEventsDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('ObservedEventsDescriptor', Val),
[

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,requestId)),

%% attribute number 2 with type SEQUENCE OF
'enc_ObservedEventsDescriptor_observedEventLst'(?RT_PER:cindex(3,Val1,observedEventLst))].

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

'enc_ObservedEventsDescriptor_observedEventLst'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ObservedEventsDescriptor_observedEventLst_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ObservedEventsDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,4294967295}}]),

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

'enc_NotifyReply'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type Externaltypereference527megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),
case ?RT_PER:cindex(3,Val1,errorDescriptor) of
asn1_NOVALUE -> [];
Tmpval1 ->

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


'dec_NotifyReply'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%%  attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

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

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'NotifyReply',Term1,Term2},Bytes6}.

'enc_NotifyRequest'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([4],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type Externaltypereference519megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type Externaltypereference520megaco_per_media_gateway_control_prev3cObservedEventsDescriptor
'enc_ObservedEventsDescriptor'(?RT_PER:cindex(3,Val1,observedEventsDescriptor)),
case ?RT_PER:cindex(4,Val1,errorDescriptor) of
asn1_NOVALUE -> [];
Tmpval1 ->

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


'dec_NotifyRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%%  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 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'dec_ErrorDescriptor'(Bytes4,telltype);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'NotifyRequest',Term1,Term2,Term3},Bytes7}.

'enc_IndAudPackagesDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('IndAudPackagesDescriptor', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],?RT_PER:cindex(2,Val1,packageName)),

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],?RT_PER:cindex(3,Val1,packageVersion))].


'dec_IndAudPackagesDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',2}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = ?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,99}}]),
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'IndAudPackagesDescriptor',Term1,Term2},Bytes5}.

'enc_IndAudStatisticsDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('IndAudStatisticsDescriptor', Val),
[

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,statName))].


'dec_IndAudStatisticsDescriptor'(Bytes,_) ->

%% attribute number 1 with type OCTET STRING
{Term1,Bytes1} = ?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]),
{{'IndAudStatisticsDescriptor',Term1},Bytes1}.

'enc_IndAudDigitMapDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
[
Opt,
case ?RT_PER:cindex(2,Val1,digitMapName) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',2}],Tmpval1)
end].


'dec_IndAudDigitMapDescriptor'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',2}]);
0 ->{asn1_NOVALUE,Bytes1}

end,
{{'IndAudDigitMapDescriptor',Term1},Bytes2}.

'enc_IndAudSignal'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
Extensions = ?RT_PER:fixextensions({ext,3,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,signalName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval2)
end
,Extensions
,
case ?RT_PER:cindex(4,Val1,signalRequestID) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval3)))
end].


'dec_IndAudSignal'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),

%% attribute number 3 with type INTEGER
{Term3,Bytes6} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal3,Trem3}=?RT_PER:decode_open_type(Bytes5,[]),
{TmpValx3,_}=?RT_PER:decode_integer(TmpVal3,[{'ValueRange',{0,4294967295}}]), {TmpValx3,Trem3}
end;
_  ->
{asn1_NOVALUE,Bytes5}

end,
Bytes7= ?RT_PER:skipextensions(Bytes6,2,Extensions)
,
{{'IndAudSignal',Term1,Term2,Term3},Bytes7}.

'enc_IndAudSeqSigList'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(2,Val1,id)),
case ?RT_PER:cindex(3,Val1,signalList) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference489megaco_per_media_gateway_control_prev3cIndAudSignal
'enc_IndAudSignal'(Tmpval1)
end].


'dec_IndAudSeqSigList'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,65535}}]),

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

end,
{{'IndAudSeqSigList',Term1,Term2},Bytes3}.


'enc_IndAudSignalsDescriptor'({'IndAudSignalsDescriptor',Val}) ->
'enc_IndAudSignalsDescriptor'(Val);

'enc_IndAudSignalsDescriptor'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,2,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*2 of
0 -> {signal,
'dec_IndAudSignal'(Bytes2,telltype)};
1 -> {seqSigList,
'dec_IndAudSeqSigList'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_IndAudEventBufferDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,eventName)),
case ?RT_PER:cindex(3,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end].


'dec_IndAudEventBufferDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes4} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes3,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes3}

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'IndAudEventBufferDescriptor',Term1,Term2},Bytes6}.

'enc_IndAudEventsDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,4],2,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,requestID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval1)
end,

%% attribute number 2 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(3,Val1,pkgdName)),
case ?RT_PER:cindex(4,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval2)
end].


'dec_IndAudEventsDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 1) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,4294967295}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type OCTET STRING
{Term2,Bytes4} = ?RT_PER:decode_octet_string(Bytes3,[{'SizeConstraint',4}]),

%% attribute number 3 with type INTEGER
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_integer(Bytes4,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'IndAudEventsDescriptor',Term1,Term2,Term3},Bytes7}.

'enc_IndAudTerminationStateDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
Extensions = ?RT_PER:fixextensions({ext,4,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,

%% attribute number 1 with type SEQUENCE OF
'enc_IndAudTerminationStateDescriptor_propertyParms'(?RT_PER:cindex(2,Val1,propertyParms)),
case ?RT_PER:cindex(3,Val1,eventBufferControl) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type NULL
?RT_PER:encode_null(Tmpval2)
end,
case ?RT_PER:cindex(4,Val1,serviceState) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 3 with type NULL
?RT_PER:encode_null(Tmpval3)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,serviceStateSel) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 4 with type ENUMERATED
?RT_PER:encode_open_type(dummy,?RT_PER:complete(case (case Tmpval4 of {_,Enumval3}-> Enumval3;_->Tmpval4 end) of
'test' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0)];
'outOfSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1)];
'inSvc' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end))
end].

'enc_IndAudTerminationStateDescriptor_propertyParms'({'IndAudTerminationStateDescriptor_propertyParms',Val}) ->
'enc_IndAudTerminationStateDescriptor_propertyParms'(Val);

'enc_IndAudTerminationStateDescriptor_propertyParms'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_IndAudTerminationStateDescriptor_propertyParms_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_IndAudTerminationStateDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%% attribute number 1 with type SEQUENCE OF
{Term1,Bytes3} = 'dec_IndAudTerminationStateDescriptor_propertyParms'(Bytes2, telltype),

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_null(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_null(Bytes4);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%% attribute number 4 with type ENUMERATED
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}=?RT_PER:decode_enumerated(TmpVal4,[{'ValueRange',{0,2}}],{{test,outOfSvc,inSvc},{}}), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,
Bytes8= ?RT_PER:skipextensions(Bytes7,2,Extensions)
,
{{'IndAudTerminationStateDescriptor',Term1,Term2,Term3,Term4},Bytes8}.


'enc_IndAudPropertyGroup'({'IndAudPropertyGroup',Val}) ->
'enc_IndAudPropertyGroup'(Val);

'enc_IndAudPropertyGroup'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_IndAudPropertyGroup_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_IndAudLocalRemoteDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,propGroupID) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end,

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cIndAudPropertyGroup
'enc_IndAudPropertyGroup'(?RT_PER:cindex(3,Val1,propGrps))].


'dec_IndAudLocalRemoteDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%%  attribute number 2 with type IndAudPropertyGroup
{Term2,Bytes4} = 'dec_IndAudPropertyGroup'(Bytes3,telltype),
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'IndAudLocalRemoteDescriptor',Term1,Term2},Bytes6}.

'enc_IndAudPropertyParm'(Val) ->
Val1 = ?RT_PER:list_to_record('IndAudPropertyParm', Val),
Extensions = ?RT_PER:fixextensions({ext,2,1},Val1),
[
?RT_PER:setext(Extensions =/= []), 
%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,name))
,Extensions
, case ?RT_PER:cindex(3,Val1,propertyParms) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cPropertyParm
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_PropertyParm'(Tmpval2)))
end].


'dec_IndAudPropertyParm'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',4}]),
{Extensions,Bytes3} = ?RT_PER:getextension(Ext,Bytes2),

%%  attribute number 2 with type PropertyParm
{Term2,Bytes4} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal2,Trem2}=?RT_PER:decode_open_type(Bytes3,[]),
{TmpValx2,_}='dec_PropertyParm'(TmpVal2,telltype), {TmpValx2,Trem2}
end;
_  ->
{asn1_NOVALUE,Bytes3}

end,
Bytes5= ?RT_PER:skipextensions(Bytes4,2,Extensions)
,
{{'IndAudPropertyParm',Term1,Term2},Bytes5}.

'enc_IndAudLocalControlDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4,5],4,Val),
Extensions = ?RT_PER:fixextensions({ext,5,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,streamMode) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type NULL
?RT_PER:encode_null(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,reserveValue) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type NULL
?RT_PER:encode_null(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,reserveGroup) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type NULL
?RT_PER:encode_null(Tmpval4)
end,
case ?RT_PER:cindex(5,Val1,propertyParms) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type SEQUENCE OF
'enc_IndAudLocalControlDescriptor_propertyParms'(Tmpval5)
end
,Extensions
,
case ?RT_PER:cindex(6,Val1,streamModeSel) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type ENUMERATED
?RT_PER:encode_open_type(dummy,?RT_PER:complete(case (case Tmpval6 of {_,Enumval4}-> Enumval4;_->Tmpval6 end) of
'sendOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 0)];
'recvOnly' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 1)];
'sendRecv' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 2)];
'inactive' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 3)];
'loopBack' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,4}}], 4)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end))
end].

'enc_IndAudLocalControlDescriptor_propertyParms'({'IndAudLocalControlDescriptor_propertyParms',Val}) ->
'enc_IndAudLocalControlDescriptor_propertyParms'(Val);

'enc_IndAudLocalControlDescriptor_propertyParms'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_IndAudLocalControlDescriptor_propertyParms_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_IndAudLocalControlDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,4), 
%% attribute number 1 with type NULL
{Term1,Bytes3} = case Opt band (1 bsl 3) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_null(Bytes2);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band (1 bsl 2) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_null(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band (1 bsl 1) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_null(Bytes4);
0 ->{asn1_NOVALUE,Bytes4}

end,

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

end,
{Extensions,Bytes7} = ?RT_PER:getextension(Ext,Bytes6),

%% attribute number 5 with type ENUMERATED
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}=?RT_PER:decode_enumerated(TmpVal5,[{'ValueRange',{0,4}}],{{sendOnly,recvOnly,sendRecv,inactive,loopBack},{}}), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,
Bytes9= ?RT_PER:skipextensions(Bytes8,2,Extensions)
,
{{'IndAudLocalControlDescriptor',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_IndAudStreamParms'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,4,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,localControlDescriptor) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cIndAudLocalControlDescriptor
'enc_IndAudLocalControlDescriptor'(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,localDescriptor) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cIndAudLocalRemoteDescriptor
'enc_IndAudLocalRemoteDescriptor'(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,remoteDescriptor) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type Externaltypereference418megaco_per_media_gateway_control_prev3cIndAudLocalRemoteDescriptor
'enc_IndAudLocalRemoteDescriptor'(Tmpval4)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,statisticsDescriptor) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cIndAudStatisticsDescriptor
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_IndAudStatisticsDescriptor'(Tmpval5)))
end].


'dec_IndAudStreamParms'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%%  attribute number 1 with type IndAudLocalControlDescriptor
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->'dec_IndAudLocalControlDescriptor'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%%  attribute number 4 with type IndAudStatisticsDescriptor
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}='dec_IndAudStatisticsDescriptor'(TmpVal4,telltype), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,
Bytes8= ?RT_PER:skipextensions(Bytes7,2,Extensions)
,
{{'IndAudStreamParms',Term1,Term2,Term3,Term4},Bytes8}.

'enc_IndAudStreamDescriptor'(Val) ->
Val1 = ?RT_PER:list_to_record('IndAudStreamDescriptor', Val),
[

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(2,Val1,streamID)),

%% attribute number 2 with type Externaltypereference411megaco_per_media_gateway_control_prev3cIndAudStreamParms
'enc_IndAudStreamParms'(?RT_PER:cindex(3,Val1,streamParms))].


'dec_IndAudStreamDescriptor'(Bytes,_) ->

%% attribute number 1 with type INTEGER
{Term1,Bytes1} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]),

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

'enc_IndAudMediaDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3],2,Val),
[
?RT_PER:setext(false), Opt,
case ?RT_PER:cindex(2,Val1,termStateDescr) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereferenceundefinedmegaco_per_media_gateway_control_prev3cIndAudTerminationStateDescriptor
'enc_IndAudTerminationStateDescriptor'(Tmpval1)
end,
case ?RT_PER:cindex(3,Val1,streams) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type CHOICE
'enc_IndAudMediaDescriptor_streams'(Tmpval2)
end].

'enc_IndAudMediaDescriptor_streams'({'IndAudMediaDescriptor_streams',Val}) ->
'enc_IndAudMediaDescriptor_streams'(Val);

'enc_IndAudMediaDescriptor_streams'(Val) ->
[
?RT_PER: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'({'IndAudMediaDescriptor_streams_multiStream',Val}) ->
'enc_IndAudMediaDescriptor_streams_multiStream'(Val);

'enc_IndAudMediaDescriptor_streams_multiStream'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_IndAudMediaDescriptor_streams_multiStream_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'dec_IndAudMediaDescriptor_streams'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {oneStream,
'dec_IndAudStreamParms'(Bytes1,telltype)};
1 -> {multiStream,
'dec_IndAudMediaDescriptor_streams_multiStream'(Bytes1, telltype)}
end,

{{Cname,Val},NewBytes}.


'dec_IndAudMediaDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%%  attribute number 1 with type IndAudTerminationStateDescriptor
{Term1,Bytes3} = case Opt band (1 bsl 1) of
  _Opt1 when _Opt1 > 0 ->'dec_IndAudTerminationStateDescriptor'(Bytes2,telltype);
0 ->{asn1_NOVALUE,Bytes2}

end,

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

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'IndAudMediaDescriptor',Term1,Term2},Bytes6}.


'enc_IndAuditParameter'({'IndAuditParameter',Val}) ->
'enc_IndAuditParameter'(Val);

'enc_IndAuditParameter'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,7,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*7 of
0 -> {indAudMediaDescriptor,
'dec_IndAudMediaDescriptor'(Bytes2,telltype)};
1 -> {indAudEventsDescriptor,
'dec_IndAudEventsDescriptor'(Bytes2,telltype)};
2 -> {indAudEventBufferDescriptor,
'dec_IndAudEventBufferDescriptor'(Bytes2,telltype)};
3 -> {indAudSignalsDescriptor,
'dec_IndAudSignalsDescriptor'(Bytes2,telltype)};
4 -> {indAudDigitMapDescriptor,
'dec_IndAudDigitMapDescriptor'(Bytes2,telltype)};
5 -> {indAudStatisticsDescriptor,
'dec_IndAudStatisticsDescriptor'(Bytes2,telltype)};
6 -> {indAudPackagesDescriptor,
'dec_IndAudPackagesDescriptor'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_AuditDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
Extensions = ?RT_PER:fixextensions({ext,2,1},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,auditToken) of
asn1_NOVALUE -> [];
Tmpval2 ->

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

%% attribute number 2 with type SEQUENCE OF
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_AuditDescriptor_auditPropertyToken'(Tmpval3)))
end].

'enc_AuditDescriptor_auditPropertyToken'({'AuditDescriptor_auditPropertyToken',Val}) ->
'enc_AuditDescriptor_auditPropertyToken'(Val);

'enc_AuditDescriptor_auditPropertyToken'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_AuditDescriptor_auditPropertyToken_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_AuditDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type BIT STRING
{Term1,Bytes3} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_bit_string(Bytes2,[],[{muxToken,0},{modemToken,1},{mediaToken,2},{eventsToken,3},{signalsToken,4},{digitMapToken,5},{statsToken,6},{observedEventsToken,7},{packagesToken,8},{eventBufferToken,9}]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes5} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal2,Trem2}=?RT_PER:decode_open_type(Bytes4,[]),
{TmpValx2,_}='dec_AuditDescriptor_auditPropertyToken'(TmpVal2, telltype), {TmpValx2,Trem2}
end;
_  ->
{asn1_NOVALUE,Bytes4}

end,
Bytes6= ?RT_PER:skipextensions(Bytes5,2,Extensions)
,
{{'AuditDescriptor',Term1,Term2},Bytes6}.


'enc_AuditReturnParameter'({'AuditReturnParameter',Val}) ->
'enc_AuditReturnParameter'(Val);

'enc_AuditReturnParameter'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,12,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*12 of
0 -> {errorDescriptor,
'dec_ErrorDescriptor'(Bytes2,telltype)};
1 -> {mediaDescriptor,
'dec_MediaDescriptor'(Bytes2,telltype)};
2 -> {modemDescriptor,
'dec_ModemDescriptor'(Bytes2,telltype)};
3 -> {muxDescriptor,
'dec_MuxDescriptor'(Bytes2,telltype)};
4 -> {eventsDescriptor,
'dec_EventsDescriptor'(Bytes2,telltype)};
5 -> {eventBufferDescriptor,
'dec_EventBufferDescriptor'(Bytes2,telltype)};
6 -> {signalsDescriptor,
'dec_SignalsDescriptor'(Bytes2,telltype)};
7 -> {digitMapDescriptor,
'dec_DigitMapDescriptor'(Bytes2,telltype)};
8 -> {observedEventsDescriptor,
'dec_ObservedEventsDescriptor'(Bytes2,telltype)};
9 -> {statisticsDescriptor,
'dec_StatisticsDescriptor'(Bytes2,telltype)};
10 -> {packagesDescriptor,
'dec_PackagesDescriptor'(Bytes2,telltype)};
11 -> {emptyDescriptors,
'dec_AuditDescriptor'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.

'enc_TerminationAudit'({'TerminationAudit',Val}) ->
'enc_TerminationAudit'(Val);

'enc_TerminationAudit'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TerminationAudit_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).
'enc_TermListAuditResult'(Val) ->
Val1 = ?RT_PER:list_to_record('TermListAuditResult', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type Externaltypereference343megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationIDList)),

%% attribute number 2 with type Externaltypereference344megaco_per_media_gateway_control_prev3cTerminationAudit
'enc_TerminationAudit'(?RT_PER:cindex(3,Val1,terminationAuditResult))].


'dec_TermListAuditResult'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

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

%%  attribute number 2 with type TerminationAudit
{Term2,Bytes3} = 'dec_TerminationAudit'(Bytes2,telltype),
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'TermListAuditResult',Term1,Term2},Bytes5}.

'enc_AuditResult'(Val) ->
Val1 = ?RT_PER:list_to_record('AuditResult', Val),
[

%% attribute number 1 with type Externaltypereference337megaco_per_media_gateway_control_prev3cTerminationID
'enc_TerminationID'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type Externaltypereference338megaco_per_media_gateway_control_prev3cTerminationAudit
'enc_TerminationAudit'(?RT_PER:cindex(3,Val1,terminationAuditResult))].


'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'({'AuditReply',Val}) ->
'enc_AuditReply'(Val);

'enc_AuditReply'(Val) ->
[
?RT_PER:set_choice(element(1,Val),{[contextAuditResult,error,auditResult],[auditResultTermList]}, {3,1}),
case element(1,Val) of
contextAuditResult ->
'enc_TerminationIDList'(element(2,Val));
error ->
'enc_ErrorDescriptor'(element(2,Val));
auditResult ->
'enc_AuditResult'(element(2,Val));
auditResultTermList ->
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_TermListAuditResult'(element(2,Val))))
end
].


'dec_AuditReply'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,3,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*3 of
0 -> {contextAuditResult,
'dec_TerminationIDList'(Bytes2,telltype)};
1 -> {error,
'dec_ErrorDescriptor'(Bytes2,telltype)};
2 -> {auditResult,
'dec_AuditResult'(Bytes2,telltype)};
3 -> {auditResultTermList,
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes2,[]),
{TmpValx4,_}='dec_TermListAuditResult'(TmpVal4,telltype), {TmpValx4,Trem4}
end};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_AuditRequest'(Val) ->
Val1 = ?RT_PER:list_to_record('AuditRequest', Val),
Extensions = ?RT_PER:fixextensions({ext,3,1},Val1),
[
?RT_PER:setext(Extensions =/= []), 
%% attribute number 1 with type Externaltypereference317megaco_per_media_gateway_control_prev3cTerminationID
'enc_TerminationID'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type Externaltypereference318megaco_per_media_gateway_control_prev3cAuditDescriptor
'enc_AuditDescriptor'(?RT_PER:cindex(3,Val1,auditDescriptor))
,Extensions
, case ?RT_PER:cindex(4,Val1,terminationIDList) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type Externaltypereference320megaco_per_media_gateway_control_prev3cTerminationIDList
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_TerminationIDList'(Tmpval2)))
end].


'dec_AuditRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%%  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,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),

%%  attribute number 3 with type TerminationIDList
{Term3,Bytes5} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal3,Trem3}=?RT_PER:decode_open_type(Bytes4,[]),
{TmpValx3,_}='dec_TerminationIDList'(TmpVal3,telltype), {TmpValx3,Trem3}
end;
_  ->
{asn1_NOVALUE,Bytes4}

end,
Bytes6= ?RT_PER:skipextensions(Bytes5,2,Extensions)
,
{{'AuditRequest',Term1,Term2,Term3},Bytes6}.

'enc_SubtractRequest'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type Externaltypereference310megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),
case ?RT_PER:cindex(3,Val1,auditDescriptor) of
asn1_NOVALUE -> [];
Tmpval1 ->

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


'dec_SubtractRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%%  attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

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

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'SubtractRequest',Term1,Term2},Bytes6}.

'enc_AmmsReply'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type Externaltypereference303megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),
case ?RT_PER:cindex(3,Val1,terminationAudit) of
asn1_NOVALUE -> [];
Tmpval1 ->

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


'dec_AmmsReply'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%%  attribute number 1 with type TerminationIDList
{Term1,Bytes3} = 'dec_TerminationIDList'(Bytes2,telltype),

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

end,
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'AmmsReply',Term1,Term2},Bytes6}.


'enc_AmmDescriptor'({'AmmDescriptor',Val}) ->
'enc_AmmDescriptor'(Val);

'enc_AmmDescriptor'(Val) ->
[
?RT_PER: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 ->
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_StatisticsDescriptor'(element(2,Val))))
end
].


'dec_AmmDescriptor'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,8,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*8 of
0 -> {mediaDescriptor,
'dec_MediaDescriptor'(Bytes2,telltype)};
1 -> {modemDescriptor,
'dec_ModemDescriptor'(Bytes2,telltype)};
2 -> {muxDescriptor,
'dec_MuxDescriptor'(Bytes2,telltype)};
3 -> {eventsDescriptor,
'dec_EventsDescriptor'(Bytes2,telltype)};
4 -> {eventBufferDescriptor,
'dec_EventBufferDescriptor'(Bytes2,telltype)};
5 -> {signalsDescriptor,
'dec_SignalsDescriptor'(Bytes2,telltype)};
6 -> {digitMapDescriptor,
'dec_DigitMapDescriptor'(Bytes2,telltype)};
7 -> {auditDescriptor,
'dec_AuditDescriptor'(Bytes2,telltype)};
8 -> {statisticsDescriptor,
begin
{TmpVal9,Trem9}=?RT_PER:decode_open_type(Bytes2,[]),
{TmpValx9,_}='dec_StatisticsDescriptor'(TmpVal9,telltype), {TmpValx9,Trem9}
end};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_AmmRequest'(Val) ->
Val1 = ?RT_PER:list_to_record('AmmRequest', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type Externaltypereference279megaco_per_media_gateway_control_prev3cTerminationIDList
'enc_TerminationIDList'(?RT_PER:cindex(2,Val1,terminationID)),

%% attribute number 2 with type SEQUENCE OF
'enc_AmmRequest_descriptors'(?RT_PER:cindex(3,Val1,descriptors))].

'enc_AmmRequest_descriptors'({'AmmRequest_descriptors',Val}) ->
'enc_AmmRequest_descriptors'(Val);

'enc_AmmRequest_descriptors'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_AmmRequest_descriptors_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_AmmRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%%  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,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'AmmRequest',Term1,Term2},Bytes5}.

'enc_TopologyRequest'(Val) ->
Val1 = ?RT_PER:list_to_record('TopologyRequest', Val),
Extensions = ?RT_PER:fixextensions({ext,4,2},Val1),
[
?RT_PER:setext(Extensions =/= []), 
%% attribute number 1 with type Externaltypereference256megaco_per_media_gateway_control_prev3cTerminationID
'enc_TerminationID'(?RT_PER:cindex(2,Val1,terminationFrom)),

%% attribute number 2 with type Externaltypereference257megaco_per_media_gateway_control_prev3cTerminationID
'enc_TerminationID'(?RT_PER:cindex(3,Val1,terminationTo)),

%% attribute number 3 with type ENUMERATED
case (case ?RT_PER:cindex(4,Val1,topologyDirection) of {_,Enumval1}->Enumval1;_->?RT_PER:cindex(4,Val1,topologyDirection) end) of
'bothway' -> ?RT_PER:encode_integer([{'ValueRange',{0,2}}], 0);
'isolate' -> ?RT_PER:encode_integer([{'ValueRange',{0,2}}], 1);
'oneway' -> ?RT_PER:encode_integer([{'ValueRange',{0,2}}], 2);

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end
,Extensions
, case ?RT_PER:cindex(5,Val1,streamID) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 4 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval2)))
end,
case ?RT_PER:cindex(6,Val1,topologyDirectionExtension) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 5 with type ENUMERATED
?RT_PER:encode_open_type(dummy,?RT_PER:complete(case (case Tmpval3 of {_,Enumval3}-> Enumval3;_->Tmpval3 end) of
'onewayexternal' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 0)];
'onewayboth' -> [{bit,0},?RT_PER:encode_integer([{'ValueRange',{0,1}}], 1)];

EnumVal -> exit({error,{asn1, {enumerated_not_in_range, EnumVal}}})
end))
end].


'dec_TopologyRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%%  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} = ?RT_PER:decode_enumerated(Bytes3,[{'ValueRange',{0,2}}],{bothway,isolate,oneway}),
{Extensions,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),

%% attribute number 4 with type INTEGER
{Term4,Bytes6} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes5,[]),
{TmpValx4,_}=?RT_PER:decode_integer(TmpVal4,[{'ValueRange',{0,65535}}]), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes5}

end,

%% attribute number 5 with type ENUMERATED
{Term5,Bytes7} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx5,_}=?RT_PER:decode_enumerated(TmpVal5,[{'ValueRange',{0,1}}],{{onewayexternal,onewayboth},{}}), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,
Bytes8= ?RT_PER:skipextensions(Bytes7,3,Extensions)
,
{{'TopologyRequest',Term1,Term2,Term3,Term4,Term5},Bytes8}.


'enc_CommandReply'({'CommandReply',Val}) ->
'enc_CommandReply'(Val);

'enc_CommandReply'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,8,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*8 of
0 -> {addReply,
'dec_AmmsReply'(Bytes2,telltype)};
1 -> {moveReply,
'dec_AmmsReply'(Bytes2,telltype)};
2 -> {modReply,
'dec_AmmsReply'(Bytes2,telltype)};
3 -> {subtractReply,
'dec_AmmsReply'(Bytes2,telltype)};
4 -> {auditCapReply,
'dec_AuditReply'(Bytes2,telltype)};
5 -> {auditValueReply,
'dec_AuditReply'(Bytes2,telltype)};
6 -> {notifyReply,
'dec_NotifyReply'(Bytes2,telltype)};
7 -> {serviceChangeReply,
'dec_ServiceChangeReply'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.

'enc_Command'({'Command',Val}) ->
'enc_Command'(Val);

'enc_Command'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,8,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*8 of
0 -> {addReq,
'dec_AmmRequest'(Bytes2,telltype)};
1 -> {moveReq,
'dec_AmmRequest'(Bytes2,telltype)};
2 -> {modReq,
'dec_AmmRequest'(Bytes2,telltype)};
3 -> {subtractReq,
'dec_SubtractRequest'(Bytes2,telltype)};
4 -> {auditCapRequest,
'dec_AuditRequest'(Bytes2,telltype)};
5 -> {auditValueRequest,
'dec_AuditRequest'(Bytes2,telltype)};
6 -> {notifyReq,
'dec_NotifyRequest'(Bytes2,telltype)};
7 -> {serviceChangeReq,
'dec_ServiceChangeRequest'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_CommandRequest'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
?RT_PER:setext(false), Opt,

%% attribute number 1 with type Externaltypereference220megaco_per_media_gateway_control_prev3cCommand
'enc_Command'(?RT_PER:cindex(2,Val1,command)),
case ?RT_PER:cindex(3,Val1,optional) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type NULL
?RT_PER:encode_null(Tmpval1)
end,
case ?RT_PER:cindex(4,Val1,wildcardReturn) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 3 with type NULL
?RT_PER:encode_null(Tmpval2)
end].


'dec_CommandRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,2), 
%%  attribute number 1 with type Command
{Term1,Bytes3} = 'dec_Command'(Bytes2,telltype),

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_null(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_null(Bytes4);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),
Bytes7= ?RT_PER:skipextensions(Bytes6,1,Extensions)
,
{{'CommandRequest',Term1,Term2,Term3},Bytes7}.


'enc_SelectLogic'({'SelectLogic',Val}) ->
'enc_SelectLogic'(Val);

'enc_SelectLogic'(Val) ->
[
?RT_PER:set_choice(element(1,Val),{[andAUDITSelect,orAUDITSelect],[]}, {2,0}),
case element(1,Val) of
andAUDITSelect ->
?RT_PER:encode_null(element(2,Val));
orAUDITSelect ->
?RT_PER:encode_null(element(2,Val))
end
].


'dec_SelectLogic'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,2,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*2 of
0 -> {andAUDITSelect,
?RT_PER:decode_null(Bytes2)};
1 -> {orAUDITSelect,
?RT_PER:decode_null(Bytes2)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_ContextAttrAuditRequest'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,4,6},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,topology) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type NULL
?RT_PER:encode_null(Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,emergency) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type NULL
?RT_PER:encode_null(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,priority) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type NULL
?RT_PER:encode_null(Tmpval4)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,iepscallind) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type NULL
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_null(Tmpval5)))
end,
case ?RT_PER:cindex(6,Val1,contextPropAud) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type SEQUENCE OF
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_ContextAttrAuditRequest_contextPropAud'(Tmpval6)))
end,
case ?RT_PER:cindex(7,Val1,selectpriority) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 6 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,15}}],Tmpval7)))
end,
case ?RT_PER:cindex(8,Val1,selectemergency) of
asn1_NOVALUE -> [];
Tmpval8 ->

%% attribute number 7 with type BOOLEAN
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_boolean(Tmpval8)))
end,
case ?RT_PER:cindex(9,Val1,selectiepscallind) of
asn1_NOVALUE -> [];
Tmpval9 ->

%% attribute number 8 with type BOOLEAN
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_boolean(Tmpval9)))
end,
case ?RT_PER:cindex(10,Val1,selectLogic) of
asn1_NOVALUE -> [];
Tmpval10 ->

%% attribute number 9 with type Externaltypereference207megaco_per_media_gateway_control_prev3cSelectLogic
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_SelectLogic'(Tmpval10)))
end].

'enc_ContextAttrAuditRequest_contextPropAud'({'ContextAttrAuditRequest_contextPropAud',Val}) ->
'enc_ContextAttrAuditRequest_contextPropAud'(Val);

'enc_ContextAttrAuditRequest_contextPropAud'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ContextAttrAuditRequest_contextPropAud_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ContextAttrAuditRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%% attribute number 1 with type NULL
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_null(Bytes2);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_null(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type NULL
{Term3,Bytes5} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->?RT_PER:decode_null(Bytes4);
0 ->{asn1_NOVALUE,Bytes4}

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%% attribute number 4 with type NULL
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}=?RT_PER:decode_null(TmpVal4), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,

%% attribute number 5 with type SEQUENCE OF
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}='dec_ContextAttrAuditRequest_contextPropAud'(TmpVal5, telltype), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,

%% attribute number 6 with type INTEGER
{Term6,Bytes9} = case Extensions of
  _ when size(Extensions) >= 3,element(3,Extensions) == 1 ->
begin
{TmpVal6,Trem6}=?RT_PER:decode_open_type(Bytes8,[]),
{TmpValx6,_}=?RT_PER:decode_integer(TmpVal6,[{'ValueRange',{0,15}}]), {TmpValx6,Trem6}
end;
_  ->
{asn1_NOVALUE,Bytes8}

end,

%% attribute number 7 with type BOOLEAN
{Term7,Bytes10} = case Extensions of
  _ when size(Extensions) >= 4,element(4,Extensions) == 1 ->
begin
{TmpVal7,Trem7}=?RT_PER:decode_open_type(Bytes9,[]),
{TmpValx7,_}=?RT_PER:decode_boolean(TmpVal7), {TmpValx7,Trem7}
end;
_  ->
{asn1_NOVALUE,Bytes9}

end,

%% attribute number 8 with type BOOLEAN
{Term8,Bytes11} = case Extensions of
  _ when size(Extensions) >= 5,element(5,Extensions) == 1 ->
begin
{TmpVal8,Trem8}=?RT_PER:decode_open_type(Bytes10,[]),
{TmpValx8,_}=?RT_PER:decode_boolean(TmpVal8), {TmpValx8,Trem8}
end;
_  ->
{asn1_NOVALUE,Bytes10}

end,

%%  attribute number 9 with type SelectLogic
{Term9,Bytes12} = case Extensions of
  _ when size(Extensions) >= 6,element(6,Extensions) == 1 ->
begin
{TmpVal9,Trem9}=?RT_PER:decode_open_type(Bytes11,[]),
{TmpValx9,_}='dec_SelectLogic'(TmpVal9,telltype), {TmpValx9,Trem9}
end;
_  ->
{asn1_NOVALUE,Bytes11}

end,
Bytes13= ?RT_PER:skipextensions(Bytes12,7,Extensions)
,
{{'ContextAttrAuditRequest',Term1,Term2,Term3,Term4,Term5,Term6,Term7,Term8,Term9},Bytes13}.

'enc_ContextRequest'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2,3,4],3,Val),
Extensions = ?RT_PER:fixextensions({ext,4,3},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,
case ?RT_PER:cindex(2,Val1,priority) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,15}}],Tmpval2)
end,
case ?RT_PER:cindex(3,Val1,emergency) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 2 with type BOOLEAN
?RT_PER:encode_boolean(Tmpval3)
end,
case ?RT_PER:cindex(4,Val1,topologyReq) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 3 with type SEQUENCE OF
'enc_ContextRequest_topologyReq'(Tmpval4)
end
,Extensions
,
case ?RT_PER:cindex(5,Val1,iepscallind) of
asn1_NOVALUE -> [];
Tmpval5 ->

%% attribute number 4 with type BOOLEAN
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_boolean(Tmpval5)))
end,
case ?RT_PER:cindex(6,Val1,contextProp) of
asn1_NOVALUE -> [];
Tmpval6 ->

%% attribute number 5 with type SEQUENCE OF
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_ContextRequest_contextProp'(Tmpval6)))
end,
case ?RT_PER:cindex(7,Val1,contextList) of
asn1_NOVALUE -> [];
Tmpval7 ->

%% attribute number 6 with type SEQUENCE OF
?RT_PER:encode_open_type(dummy,?RT_PER:complete('enc_ContextRequest_contextList'(Tmpval7)))
end].

'enc_ContextRequest_topologyReq'({'ContextRequest_topologyReq',Val}) ->
'enc_ContextRequest_topologyReq'(Val);

'enc_ContextRequest_topologyReq'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ContextRequest_topologyReq_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'enc_ContextRequest_contextProp'({'ContextRequest_contextProp',Val}) ->
'enc_ContextRequest_contextProp'(Val);

'enc_ContextRequest_contextProp'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ContextRequest_contextProp_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'enc_ContextRequest_contextList'({'ContextRequest_contextList',Val}) ->
'enc_ContextRequest_contextList'(Val);

'enc_ContextRequest_contextList'(Val) ->
[

   ?RT_PER:encode_length(undefined,length(Val)),
   'enc_ContextRequest_contextList_components'(Val, [])
].
'enc_ContextRequest_contextList_components'([], Acc) -> lists:reverse(Acc);

'enc_ContextRequest_contextList_components'([H|T], Acc) ->
'enc_ContextRequest_contextList_components'(T, [?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],H) | Acc]).

'dec_ContextRequest_contextList'(Bytes,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ContextRequest_contextList_components'(Num, Bytes1, telltype, []).
'dec_ContextRequest_contextList_components'(0, Bytes, _, Acc) ->
   {lists:reverse(Acc), Bytes};
'dec_ContextRequest_contextList_components'(Num, Bytes, _, Acc) ->
   {Term,Remain} = ?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,4294967295}}]),
   'dec_ContextRequest_contextList_components'(Num-1, Remain, telltype, [Term|Acc]).


'dec_ContextRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,3), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = case Opt band (1 bsl 2) of
  _Opt1 when _Opt1 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,15}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,

%% attribute number 2 with type BOOLEAN
{Term2,Bytes4} = case Opt band (1 bsl 1) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_boolean(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

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

end,
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%% attribute number 4 with type BOOLEAN
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}=?RT_PER:decode_boolean(TmpVal4), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,

%% attribute number 5 with type SEQUENCE OF
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}='dec_ContextRequest_contextProp'(TmpVal5, telltype), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,

%% attribute number 6 with type SEQUENCE OF
{Term6,Bytes9} = case Extensions of
  _ when size(Extensions) >= 3,element(3,Extensions) == 1 ->
begin
{TmpVal6,Trem6}=?RT_PER:decode_open_type(Bytes8,[]),
{TmpValx6,_}='dec_ContextRequest_contextList'(TmpVal6, telltype), {TmpValx6,Trem6}
end;
_  ->
{asn1_NOVALUE,Bytes8}

end,
Bytes10= ?RT_PER:skipextensions(Bytes9,4,Extensions)
,
{{'ContextRequest',Term1,Term2,Term3,Term4,Term5,Term6},Bytes10}.

'enc_ActionReply'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,contextId)),
case ?RT_PER:cindex(3,Val1,errorDescriptor) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference171megaco_per_media_gateway_control_prev3cErrorDescriptor
'enc_ErrorDescriptor'(Tmpval1)
end,
case ?RT_PER:cindex(4,Val1,contextReply) of
asn1_NOVALUE -> [];
Tmpval2 ->

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

%% attribute number 4 with type SEQUENCE OF
'enc_ActionReply_commandReply'(?RT_PER:cindex(5,Val1,commandReply))].

'enc_ActionReply_commandReply'({'ActionReply_commandReply',Val}) ->
'enc_ActionReply_commandReply'(Val);

'enc_ActionReply_commandReply'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ActionReply_commandReply_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ActionReply'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,2), 
%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,4294967295}}]),

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

end,

%%  attribute number 3 with type ContextRequest
{Term3,Bytes4} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'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) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3,4],2,Val),
[
Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,contextId)),
case ?RT_PER:cindex(3,Val1,contextRequest) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type Externaltypereference163megaco_per_media_gateway_control_prev3cContextRequest
'enc_ContextRequest'(Tmpval1)
end,
case ?RT_PER:cindex(4,Val1,contextAttrAuditReq) of
asn1_NOVALUE -> [];
Tmpval2 ->

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

%% attribute number 4 with type SEQUENCE OF
'enc_ActionRequest_commandRequests'(?RT_PER:cindex(5,Val1,commandRequests))].

'enc_ActionRequest_commandRequests'({'ActionRequest_commandRequests',Val}) ->
'enc_ActionRequest_commandRequests'(Val);

'enc_ActionRequest_commandRequests'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_ActionRequest_commandRequests_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_ActionRequest'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,2), 
%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,4294967295}}]),

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

end,

%%  attribute number 3 with type ContextAttrAuditRequest
{Term3,Bytes4} = case Opt band (1 bsl 0) of
  _Opt3 when _Opt3 > 0 ->'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'({'ContextID',Val}) ->
'enc_ContextID'(Val);

'enc_ContextID'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Val).


'dec_ContextID'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,4294967295}}]).


'enc_ErrorText'({'ErrorText',Val}) ->
'enc_ErrorText'(Val);

'enc_ErrorText'(Val) ->
?RT_PER:encode_IA5String([],Val).


'dec_ErrorText'(Bytes,_) ->
?RT_PER:decode_IA5String(Bytes,[]).


'enc_ErrorCode'({'ErrorCode',Val}) ->
'enc_ErrorCode'(Val);

'enc_ErrorCode'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Val).


'dec_ErrorCode'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]).

'enc_ErrorDescriptor'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],?RT_PER:cindex(2,Val1,errorCode)),
case ?RT_PER:cindex(3,Val1,errorText) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type IA5String
?RT_PER:encode_IA5String([],Tmpval1)
end].


'dec_ErrorDescriptor'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,65535}}]),

%% attribute number 2 with type IA5String
{Term2,Bytes3} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_IA5String(Bytes2,[]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{{'ErrorDescriptor',Term1,Term2},Bytes3}.

'enc_TransactionAck'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,firstAck)),
case ?RT_PER:cindex(3,Val1,lastAck) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Tmpval1)
end].


'dec_TransactionAck'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,4294967295}}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,4294967295}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{{'TransactionAck',Term1,Term2},Bytes3}.


'enc_TransactionResponseAck'({'TransactionResponseAck',Val}) ->
'enc_TransactionResponseAck'(Val);

'enc_TransactionResponseAck'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TransactionResponseAck_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'enc_SegmentNumber'({'SegmentNumber',Val}) ->
'enc_SegmentNumber'(Val);

'enc_SegmentNumber'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Val).


'dec_SegmentNumber'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,65535}}]).

'enc_TransactionReply'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
Extensions = ?RT_PER:fixextensions({ext,4,2},Val1),
[
?RT_PER:setext(Extensions =/= []), Opt,

%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,transactionId)),
case ?RT_PER:cindex(3,Val1,immAckRequired) of
asn1_NOVALUE -> [];
Tmpval2 ->

%% attribute number 2 with type NULL
?RT_PER:encode_null(Tmpval2)
end,

%% attribute number 3 with type CHOICE
'enc_TransactionReply_transactionResult'(?RT_PER:cindex(4,Val1,transactionResult))
,Extensions
,
case ?RT_PER:cindex(5,Val1,segmentNumber) of
asn1_NOVALUE -> [];
Tmpval3 ->

%% attribute number 4 with type INTEGER
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval3)))
end,
case ?RT_PER:cindex(6,Val1,segmentationComplete) of
asn1_NOVALUE -> [];
Tmpval4 ->

%% attribute number 5 with type NULL
?RT_PER:encode_open_type(dummy,?RT_PER:complete(?RT_PER:encode_null(Tmpval4)))
end].

'enc_TransactionReply_transactionResult'({'TransactionReply_transactionResult',Val}) ->
'enc_TransactionReply_transactionResult'(Val);

'enc_TransactionReply_transactionResult'(Val) ->
[
?RT_PER: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'({'TransactionReply_transactionResult_actionReplies',Val}) ->
'enc_TransactionReply_transactionResult_actionReplies'(Val);

'enc_TransactionReply_transactionResult_actionReplies'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TransactionReply_transactionResult_actionReplies_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'dec_TransactionReply_transactionResult'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {transactionError,
'dec_ErrorDescriptor'(Bytes1,telltype)};
1 -> {actionReplies,
'dec_TransactionReply_transactionResult_actionReplies'(Bytes1, telltype)}
end,

{{Cname,Val},NewBytes}.


'dec_TransactionReply'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),
{Opt,Bytes2} = ?RT_PER:getoptionals2(Bytes1,1), 
%% attribute number 1 with type INTEGER
{Term1,Bytes3} = ?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,4294967295}}]),

%% attribute number 2 with type NULL
{Term2,Bytes4} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_null(Bytes3);
0 ->{asn1_NOVALUE,Bytes3}

end,

%% attribute number 3 with type CHOICE
{Term3,Bytes5} = 'dec_TransactionReply_transactionResult'(Bytes4, telltype),
{Extensions,Bytes6} = ?RT_PER:getextension(Ext,Bytes5),

%% attribute number 4 with type INTEGER
{Term4,Bytes7} = case Extensions of
  _ when size(Extensions) >= 1,element(1,Extensions) == 1 ->
begin
{TmpVal4,Trem4}=?RT_PER:decode_open_type(Bytes6,[]),
{TmpValx4,_}=?RT_PER:decode_integer(TmpVal4,[{'ValueRange',{0,65535}}]), {TmpValx4,Trem4}
end;
_  ->
{asn1_NOVALUE,Bytes6}

end,

%% attribute number 5 with type NULL
{Term5,Bytes8} = case Extensions of
  _ when size(Extensions) >= 2,element(2,Extensions) == 1 ->
begin
{TmpVal5,Trem5}=?RT_PER:decode_open_type(Bytes7,[]),
{TmpValx5,_}=?RT_PER:decode_null(TmpVal5), {TmpValx5,Trem5}
end;
_  ->
{asn1_NOVALUE,Bytes7}

end,
Bytes9= ?RT_PER:skipextensions(Bytes8,3,Extensions)
,
{{'TransactionReply',Term1,Term2,Term3,Term4,Term5},Bytes9}.

'enc_TransactionPending'(Val) ->
Val1 = ?RT_PER:list_to_record('TransactionPending', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,transactionId))].


'dec_TransactionPending'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,4294967295}}]),
{Extensions,Bytes3} = ?RT_PER:getextension(Ext,Bytes2),
Bytes4= ?RT_PER:skipextensions(Bytes3,1,Extensions)
,
{{'TransactionPending',Term1},Bytes4}.

'enc_TransactionRequest'(Val) ->
Val1 = ?RT_PER:list_to_record('TransactionRequest', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],?RT_PER:cindex(2,Val1,transactionId)),

%% attribute number 2 with type SEQUENCE OF
'enc_TransactionRequest_actions'(?RT_PER:cindex(3,Val1,actions))].

'enc_TransactionRequest_actions'({'TransactionRequest_actions',Val}) ->
'enc_TransactionRequest_actions'(Val);

'enc_TransactionRequest_actions'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_TransactionRequest_actions_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).


'dec_TransactionRequest'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,4294967295}}]),

%% attribute number 2 with type SEQUENCE OF
{Term2,Bytes3} = 'dec_TransactionRequest_actions'(Bytes2, telltype),
{Extensions,Bytes4} = ?RT_PER:getextension(Ext,Bytes3),
Bytes5= ?RT_PER:skipextensions(Bytes4,1,Extensions)
,
{{'TransactionRequest',Term1,Term2},Bytes5}.


'enc_TransactionId'({'TransactionId',Val}) ->
'enc_TransactionId'(Val);

'enc_TransactionId'(Val) ->
?RT_PER:encode_integer([{'ValueRange',{0,4294967295}}],Val).


'dec_TransactionId'(Bytes,_) ->
?RT_PER:decode_integer(Bytes,[{'ValueRange',{0,4294967295}}]).


'enc_Transaction'({'Transaction',Val}) ->
'enc_Transaction'(Val);

'enc_Transaction'(Val) ->
[
?RT_PER: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,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,4,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*4 of
0 -> {transactionRequest,
'dec_TransactionRequest'(Bytes2,telltype)};
1 -> {transactionPending,
'dec_TransactionPending'(Bytes2,telltype)};
2 -> {transactionReply,
'dec_TransactionReply'(Bytes2,telltype)};
3 -> {transactionResponseAck,
'dec_TransactionResponseAck'(Bytes2,telltype)};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.

'enc_PathName'({'PathName',Val}) ->
'enc_PathName'(Val);

'enc_PathName'(Val) ->
?RT_PER:encode_IA5String([{'SizeConstraint',{1,64}}],Val).


'dec_PathName'(Bytes,_) ->
?RT_PER:decode_IA5String(Bytes,[{'SizeConstraint',{1,64}}]).

'enc_IP6Address'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',16}],?RT_PER:cindex(2,Val1,address)),
case ?RT_PER:cindex(3,Val1,portNumber) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end].


'dec_IP6Address'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',16}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{{'IP6Address',Term1,Term2},Bytes3}.

'enc_IP4Address'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,address)),
case ?RT_PER:cindex(3,Val1,portNumber) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end].


'dec_IP4Address'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type OCTET STRING
{Term1,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',4}]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{{'IP4Address',Term1,Term2},Bytes3}.

'enc_DomainName'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([3],1,Val),
[
Opt,

%% attribute number 1 with type IA5String
?RT_PER:encode_IA5String([],?RT_PER:cindex(2,Val1,name)),
case ?RT_PER:cindex(3,Val1,portNumber) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 2 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,65535}}],Tmpval1)
end].


'dec_DomainName'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%% attribute number 1 with type IA5String
{Term1,Bytes2} = ?RT_PER:decode_IA5String(Bytes1,[]),

%% attribute number 2 with type INTEGER
{Term2,Bytes3} = case Opt band (1 bsl 0) of
  _Opt2 when _Opt2 > 0 ->?RT_PER:decode_integer(Bytes2,[{'ValueRange',{0,65535}}]);
0 ->{asn1_NOVALUE,Bytes2}

end,
{{'DomainName',Term1,Term2},Bytes3}.


'enc_MId'({'MId',Val}) ->
'enc_MId'(Val);

'enc_MId'(Val) ->
[
?RT_PER: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 ->
?RT_PER:encode_IA5String([{'SizeConstraint',{1,64}}],element(2,Val));
mtpAddress ->
?RT_PER:encode_octet_string([{'SizeConstraint',{2,4}}],element(2,Val))
end
].


'dec_MId'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getbit(Bytes),
{Choice,Bytes2} = ?RT_PER:getchoice(Bytes1,5,Ext ),
{Cname,{Val,NewBytes}} = case Choice + Ext*5 of
0 -> {ip4Address,
'dec_IP4Address'(Bytes2,telltype)};
1 -> {ip6Address,
'dec_IP6Address'(Bytes2,telltype)};
2 -> {domainName,
'dec_DomainName'(Bytes2,telltype)};
3 -> {deviceName,
?RT_PER:decode_IA5String(Bytes2,[{'SizeConstraint',{1,64}}])};
4 -> {mtpAddress,
?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',{2,4}}])};
_ -> {asn1_ExtAlt,
      fun() -> 
          {XTerm,XBytes} = ?RT_PER:decode_open_type(Bytes2,[]),
          {binary_to_list(XTerm),XBytes}
      end()}
end,

{{Cname,Val},NewBytes}.
'enc_Message'(Val) ->
Val1 = ?RT_PER:list_to_record('Message', Val),
[
?RT_PER:setext(false), 
%% attribute number 1 with type INTEGER
?RT_PER:encode_integer([{'ValueRange',{0,99}}],?RT_PER:cindex(2,Val1,version)),

%% attribute number 2 with type Externaltypereference31megaco_per_media_gateway_control_prev3cMId
'enc_MId'(?RT_PER:cindex(3,Val1,mId)),

%% attribute number 3 with type CHOICE
'enc_Message_messageBody'(?RT_PER:cindex(4,Val1,messageBody))].

'enc_Message_messageBody'({'Message_messageBody',Val}) ->
'enc_Message_messageBody'(Val);

'enc_Message_messageBody'(Val) ->
[
?RT_PER: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'({'Message_messageBody_transactions',Val}) ->
'enc_Message_messageBody_transactions'(Val);

'enc_Message_messageBody_transactions'(Val) ->
[

   ?RT_PER:encode_length(undefined,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,_) ->

{Num,Bytes1} = ?RT_PER:decode_length(Bytes,undefined),
'dec_Message_messageBody_transactions_components'(Num, Bytes1, telltype, []).
'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, telltype, [Term|Acc]).

'dec_Message_messageBody'(Bytes,_) ->
{Choice,Bytes1} = ?RT_PER:getchoice(Bytes,2, 0),
{Cname,{Val,NewBytes}} = case Choice of
0 -> {messageError,
'dec_ErrorDescriptor'(Bytes1,telltype)};
1 -> {transactions,
'dec_Message_messageBody_transactions'(Bytes1, telltype)}
end,

{{Cname,Val},NewBytes}.


'dec_Message'(Bytes,_) ->
{Ext,Bytes1} = ?RT_PER:getext(Bytes),

%% attribute number 1 with type INTEGER
{Term1,Bytes2} = ?RT_PER:decode_integer(Bytes1,[{'ValueRange',{0,99}}]),

%%  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,Bytes5} = ?RT_PER:getextension(Ext,Bytes4),
Bytes6= ?RT_PER:skipextensions(Bytes5,1,Extensions)
,
{{'Message',Term1,Term2,Term3},Bytes6}.


'enc_AuthData'({'AuthData',Val}) ->
'enc_AuthData'(Val);

'enc_AuthData'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',{12,32}}],Val).


'dec_AuthData'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',{12,32}}]).


'enc_SequenceNum'({'SequenceNum',Val}) ->
'enc_SequenceNum'(Val);

'enc_SequenceNum'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',4}],Val).


'dec_SequenceNum'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]).


'enc_SecurityParmIndex'({'SecurityParmIndex',Val}) ->
'enc_SecurityParmIndex'(Val);

'enc_SecurityParmIndex'(Val) ->
?RT_PER:encode_octet_string([{'SizeConstraint',4}],Val).


'dec_SecurityParmIndex'(Bytes,_) ->
?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]).

'enc_AuthenticationHeader'(Val) ->
Val1 = ?RT_PER:list_to_record('AuthenticationHeader', Val),
[

%% attribute number 1 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(2,Val1,secParmIndex)),

%% attribute number 2 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',4}],?RT_PER:cindex(3,Val1,seqNum)),

%% attribute number 3 with type OCTET STRING
?RT_PER:encode_octet_string([{'SizeConstraint',{12,32}}],?RT_PER:cindex(4,Val1,ad))].


'dec_AuthenticationHeader'(Bytes,_) ->

%% attribute number 1 with type OCTET STRING
{Term1,Bytes1} = ?RT_PER:decode_octet_string(Bytes,[{'SizeConstraint',4}]),

%% attribute number 2 with type OCTET STRING
{Term2,Bytes2} = ?RT_PER:decode_octet_string(Bytes1,[{'SizeConstraint',4}]),

%% attribute number 3 with type OCTET STRING
{Term3,Bytes3} = ?RT_PER:decode_octet_string(Bytes2,[{'SizeConstraint',{12,32}}]),
{{'AuthenticationHeader',Term1,Term2,Term3},Bytes3}.

'enc_MegacoMessage'(Val) ->
{Val1,Opt} = ?RT_PER:fixoptionals([2],1,Val),
[
Opt,
case ?RT_PER:cindex(2,Val1,authHeader) of
asn1_NOVALUE -> [];
Tmpval1 ->

%% attribute number 1 with type Externaltypereference10megaco_per_media_gateway_control_prev3cAuthenticationHeader
'enc_AuthenticationHeader'(Tmpval1)
end,

%% attribute number 2 with type Externaltypereference11megaco_per_media_gateway_control_prev3cMessage
'enc_Message'(?RT_PER:cindex(3,Val1,mess))].


'dec_MegacoMessage'(Bytes,_) ->
{Opt,Bytes1} = ?RT_PER:getoptionals2(Bytes,1), 
%%  attribute number 1 with type AuthenticationHeader
{Term1,Bytes2} = case Opt band (1 bsl 0) of
  _Opt1 when _Opt1 > 0 ->'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}.

