File 4312-megaco-Removed-all-deprecated-prev3-binary-codec-s.patch of Package erlang

From 32a7a4547f15ff8f6843652cd014dda70f8ba851 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Thu, 19 Mar 2020 17:52:38 +0100
Subject: [PATCH 2/8] [megaco] Removed all (deprecated) prev3 binary codec(s)

OTP-16560
---
 .../binary/MEDIA-GATEWAY-CONTROL-prev3a.asn   | 1001 --------
 .../binary/MEDIA-GATEWAY-CONTROL-prev3b.asn   | 1001 --------
 .../binary/MEDIA-GATEWAY-CONTROL-prev3c.asn   | 1073 ---------
 lib/megaco/src/binary/Makefile                |   39 +-
 lib/megaco/src/binary/depend.mk               |  113 -
 lib/megaco/src/binary/megaco_ber_encoder.erl  |   85 -
 ...er_media_gateway_control_prev3a.asn1config |   43 -
 ...o_ber_media_gateway_control_prev3a.set.asn |    1 -
 ...er_media_gateway_control_prev3b.asn1config |   43 -
 ...o_ber_media_gateway_control_prev3b.set.asn |    1 -
 ...er_media_gateway_control_prev3c.asn1config |   43 -
 ...o_ber_media_gateway_control_prev3c.set.asn |    1 -
 .../src/binary/megaco_binary_encoder.erl      |  153 --
 .../megaco_binary_name_resolver_prev3a.erl    | 2009 ----------------
 .../megaco_binary_name_resolver_prev3b.erl    | 2009 ----------------
 .../megaco_binary_name_resolver_prev3c.erl    | 2010 -----------------
 .../megaco_binary_transformer_prev3a.erl      | 1628 -------------
 .../megaco_binary_transformer_prev3b.erl      | 1628 -------------
 .../megaco_binary_transformer_prev3c.erl      | 1755 --------------
 lib/megaco/src/binary/megaco_per_encoder.erl  |   48 -
 ...o_per_media_gateway_control_prev3a.set.asn |    1 -
 ...o_per_media_gateway_control_prev3b.set.asn |    1 -
 ...o_per_media_gateway_control_prev3c.set.asn |    1 -
 lib/megaco/src/binary/modules.mk              |   35 +-
 24 files changed, 9 insertions(+), 14713 deletions(-)
 delete mode 100644 lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3a.asn
 delete mode 100644 lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3b.asn
 delete mode 100644 lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3c.asn
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.asn1config
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.set.asn
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.asn1config
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.set.asn
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.asn1config
 delete mode 100644 lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.set.asn
 delete mode 100644 lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
 delete mode 100644 lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
 delete mode 100644 lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
 delete mode 100644 lib/megaco/src/binary/megaco_binary_transformer_prev3a.erl
 delete mode 100644 lib/megaco/src/binary/megaco_binary_transformer_prev3b.erl
 delete mode 100644 lib/megaco/src/binary/megaco_binary_transformer_prev3c.erl
 delete mode 100644 lib/megaco/src/binary/megaco_per_media_gateway_control_prev3a.set.asn
 delete mode 100644 lib/megaco/src/binary/megaco_per_media_gateway_control_prev3b.set.asn
 delete mode 100644 lib/megaco/src/binary/megaco_per_media_gateway_control_prev3c.set.asn

diff --git a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3a.asn b/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3a.asn
deleted file mode 100644
index 083f7e8271..0000000000
--- a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3a.asn
+++ /dev/null
@@ -1,1001 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3a
-{itu-t(0) recommendation(0) h(8) h248(248) 
- modules(0) media-gateway-control(0) version3(3)} 
-DEFINITIONS AUTOMATIC TAGS ::= 
-BEGIN 
-       
-
-MegacoMessage ::= SEQUENCE 
- { 
-   authHeader     AuthenticationHeader OPTIONAL, 
-   mess           Message 
- } 
-
-AuthenticationHeader ::= SEQUENCE 
- { 
-   secParmIndex   SecurityParmIndex, 
-   seqNum         SequenceNum, 
-   ad             AuthData 
- } 
-
-SecurityParmIndex ::= OCTET STRING(SIZE(4)) 
-
-SequenceNum       ::= OCTET STRING(SIZE(4)) 
-
-AuthData          ::= OCTET STRING (SIZE (12..32)) 
-
-Message ::= SEQUENCE 
- { 
-   version           INTEGER(0..99), 
-   -- The version of the protocol defined here is equal to 3. 
-   mId               MId,  -- Name/address of message originator 
-   messageBody CHOICE 
-    { 
-      messageError      ErrorDescriptor, 
-      transactions      SEQUENCE OF Transaction 
-    }, 
-   ... 
- } 
-
-MId ::= CHOICE 
- { 
-   ip4Address           IP4Address, 
-   ip6Address           IP6Address, 
-   domainName           DomainName, 
-   deviceName           PathName, 
-   mtpAddress           OCTET STRING(SIZE(2..4)), 
-   -- Addressing structure of mtpAddress: 
-   --     25 - 15              0 
-   --     |  PC           | NI | 
-   --     24 - 14 bits    2 bits 
-   -- Note: 14 bits are defined for international use. 
-   -- Two national options exist where the point code is 16 or 24   
-   -- bits. 
-   -- To octet align the mtpAddress, the MSBs shall be encoded as 0s. 
-   ... 
- } 
-
-DomainName ::= SEQUENCE 
- { 
-   name        IA5String, 
-   -- The name starts with an alphanumeric digit followed by a 
-   -- sequence of alphanumeric digits, hyphens and dots.  No two 
-   -- dots shall occur consecutively. 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP4Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(4)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP6Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(16)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-PathName ::= IA5String(SIZE (1..64)) 
--- See A.3 
-
-Transaction ::= CHOICE 
- { 
-   transactionRequest      TransactionRequest, 
-   transactionPending      TransactionPending, 
-   transactionReply        TransactionReply, 
-   transactionResponseAck  TransactionResponseAck, 
-   -- use of response acks is dependent on underlying transport 
-   ... 
- } 
-
-TransactionId ::= INTEGER(0..4294967295)  -- 32-bit unsigned integer 
-
-TransactionRequest ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   actions              SEQUENCE OF ActionRequest, 
-   ... 
- } 
-
-TransactionPending ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   ... 
- } 
-
-TransactionReply ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   immAckRequired       NULL OPTIONAL, 
-   transactionResult    CHOICE 
-    { 
-      transactionError   ErrorDescriptor, 
-      actionReplies      SEQUENCE OF ActionReply 
-    }, 
-    ...,
-   -- Erlang Note: NOT REALLY PART OF THIS IMPLEMENTATION
-   -- Erlang Note: The only reason why we need to include
-   -- Erlang Note: these definitions in this version is
-   -- Erlang Note: that we cannot distinguish between v3 
-   -- Erlang Note: versions in the megaco_messenger module
-   segmentNumber         SegmentNumber OPTIONAL,
-   segmentationComplete  NULL OPTIONAL 
- } 
-
--- SegmentReply ::= SEQUENCE
---  {
---    transactionId         TransactionId,
---    segmentNumber         SegmentNumber,
---    segmentationComplete  NULL OPTIONAL,
---    ...
---  }
--- 
-SegmentNumber ::= INTEGER(0..65535)
-
-TransactionResponseAck ::= SEQUENCE OF TransactionAck 
-TransactionAck ::= SEQUENCE 
- { 
-   firstAck       TransactionId, 
-   lastAck        TransactionId OPTIONAL 
- } 
-
-ErrorDescriptor ::= SEQUENCE 
- { 
-   errorCode      ErrorCode, 
-   errorText      ErrorText OPTIONAL 
- } 
-
-ErrorCode ::= INTEGER(0..65535) 
--- See clause 14 for IANA considerations with respect to error codes 
-ErrorText ::= IA5String 
-
-ContextID ::= INTEGER(0..4294967295) 
-
--- Context NULL Value: 0 
--- Context CHOOSE Value: 4294967294 (0xFFFFFFFE)  
--- Context ALL Value: 4294967295 (0xFFFFFFFF) 
-
-
-ActionRequest ::= SEQUENCE 
- { 
-   contextId            ContextID, 
-   contextRequest       ContextRequest OPTIONAL, 
-   contextAttrAuditReq  ContextAttrAuditRequest OPTIONAL, 
-   commandRequests      SEQUENCE OF CommandRequest 
- } 
-
-ActionReply ::= SEQUENCE 
- { 
-   contextId         ContextID, 
-   errorDescriptor   ErrorDescriptor OPTIONAL, 
-   contextReply      ContextRequest OPTIONAL, 
-   commandReply      SEQUENCE OF CommandReply 
- } 
-
-ContextRequest ::= SEQUENCE 
- { 
-   priority       INTEGER(0..15) OPTIONAL, 
-   emergency      BOOLEAN OPTIONAL, 
-   topologyReq    SEQUENCE OF TopologyRequest OPTIONAL, 
-   ...,
-   iepsCallind   BOOLEAN OPTIONAL,   -- Fixed
-   contextProp    SEQUENCE OF PropertyParm OPTIONAL 
- } 
-
-ContextAttrAuditRequest ::= SEQUENCE 
- { 
-   topology    NULL OPTIONAL, 
-   emergency   NULL OPTIONAL, 
-   priority    NULL OPTIONAL, 
-   ...,
-   iepsCallind    NULL OPTIONAL,   -- Fixed
-   contextPropAud  SEQUENCE OF IndAudPropertyParm OPTIONAL  
- } 
-
-CommandRequest ::= SEQUENCE 
- { 
-   command           Command, 
-   optional          NULL OPTIONAL, 
-   wildcardReturn    NULL OPTIONAL, 
-   ... 
- } 
-
-Command ::= CHOICE 
- { 
-   addReq               AmmRequest, 
-   moveReq              AmmRequest, 
-   modReq               AmmRequest, 
-   -- Add, Move, Modify requests have the same parameters 
-   subtractReq          SubtractRequest, 
-   auditCapRequest      AuditRequest, 
-   auditValueRequest    AuditRequest, 
-   notifyReq            NotifyRequest, 
-   serviceChangeReq     ServiceChangeRequest, 
-   ... 
- } 
-
-CommandReply ::= CHOICE 
- { 
-   addReply                AmmsReply, 
-   moveReply               AmmsReply, 
-   modReply                AmmsReply, 
-   subtractReply           AmmsReply, 
-   -- Add, Move, Modify, Subtract replies have the same parameters 
-   auditCapReply           AuditReply, 
-   auditValueReply         AuditReply, 
-   notifyReply             NotifyReply, 
-   serviceChangeReply      ServiceChangeReply, 
-   ... 
- } 
-
-TopologyRequest ::= SEQUENCE 
- { 
-   terminationFrom         TerminationID, 
-   terminationTo           TerminationID, 
-   topologyDirection       ENUMERATED 
-    { 
-      bothway(0), 
-      isolate(1), 
-      oneway(2) 
-    }, 
-   ..., 
-   streamID             StreamID OPTIONAL 
- } 
-
-AmmRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   descriptors          SEQUENCE OF AmmDescriptor, 
-   -- At most one descriptor of each type (see AmmDescriptor) 
-   -- allowed in the sequence. 
-   ... 
- } 
-
-AmmDescriptor ::= CHOICE 
- { 
-   mediaDescriptor         MediaDescriptor, 
-   modemDescriptor         ModemDescriptor, 
-   muxDescriptor           MuxDescriptor, 
-   eventsDescriptor        EventsDescriptor, 
-   eventBufferDescriptor   EventBufferDescriptor, 
-   signalsDescriptor       SignalsDescriptor, 
-   digitMapDescriptor      DigitMapDescriptor, 
-   auditDescriptor         AuditDescriptor, 
-   ...,
-   statisticsDescriptor    StatisticsDescriptor 
- } 
-
-
-AmmsReply ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   terminationAudit     TerminationAudit OPTIONAL, 
-   ... 
- } 
-
-SubtractRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   auditDescriptor      AuditDescriptor OPTIONAL, 
-   ... 
- } 
-
-AuditRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationID, 
-   auditDescriptor      AuditDescriptor, 
-   ... 
- } 
-
-AuditReply ::= CHOICE 
- { 
-   contextAuditResult   TerminationIDList, 
-   error                ErrorDescriptor, 
-   auditResult          AuditResult, 
-   ... 
- } 
-
-AuditResult ::= SEQUENCE 
- { 
-   
-   terminationID           TerminationID, 
-   terminationAuditResult  TerminationAudit 
- } 
-
-
-
-TerminationAudit ::= SEQUENCE OF AuditReturnParameter 
-
-AuditReturnParameter ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   mediaDescriptor            MediaDescriptor, 
-   modemDescriptor            ModemDescriptor, 
-   muxDescriptor              MuxDescriptor, 
-   eventsDescriptor           EventsDescriptor, 
-   eventBufferDescriptor      EventBufferDescriptor, 
-   signalsDescriptor          SignalsDescriptor, 
-   digitMapDescriptor         DigitMapDescriptor, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   statisticsDescriptor       StatisticsDescriptor, 
-   packagesDescriptor         PackagesDescriptor, 
-   emptyDescriptors           AuditDescriptor, 
-   ... 
- } 
-
-AuditDescriptor ::= SEQUENCE 
- { 
-   auditToken  BIT STRING 
-    { 
-      muxToken(0), modemToken(1), mediaToken(2), 
-      eventsToken(3), signalsToken(4), 
-      digitMapToken(5), statsToken(6), 
-      observedEventsToken(7), 
-      packagesToken(8), eventBufferToken(9) 
-    } OPTIONAL, 
-   ..., 
-   auditPropertyToken SEQUENCE OF IndAuditParameter OPTIONAL 
- } 
-
-
-IndAuditParameter ::= CHOICE 
- { 
-   -- Note that the lower/upper case letters of the tags have 
-   -- been changed. The same changes has been made in text...
-   indAudMediaDescriptor         IndAudMediaDescriptor, 
-   indAudEventsDescriptor        IndAudEventsDescriptor, 
-   indAudEventBufferDescriptor   IndAudEventBufferDescriptor, 
-   indAudSignalsDescriptor       IndAudSignalsDescriptor, 
-   indAudDigitMapDescriptor      IndAudDigitMapDescriptor, 
-   indAudStatisticsDescriptor    IndAudStatisticsDescriptor, 
-   indAudPackagesDescriptor      IndAudPackagesDescriptor, 
-   ... 
- } 
-
-IndAudMediaDescriptor ::= SEQUENCE 
- { 
-   
-   termStateDescr    IndAudTerminationStateDescriptor OPTIONAL, 
-   streams  CHOICE 
-    { 
-      oneStream      IndAudStreamParms, 
-      multiStream    SEQUENCE OF IndAudStreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-IndAudStreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             IndAudStreamParms 
- } 
-
-IndAudStreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor  IndAudLocalControlDescriptor OPTIONAL, 
-   localDescriptor         IndAudLocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor        IndAudLocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor    IndAudStatisticsDescriptor OPTIONAL
- } 
-
-IndAudLocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode              NULL OPTIONAL, 
-   reserveValue            NULL OPTIONAL, 
-   reserveGroup            NULL OPTIONAL, 
-   propertyParms           SEQUENCE OF IndAudPropertyParm OPTIONAL, 
-   ... 
- } 
-
-IndAudPropertyParm ::= SEQUENCE 
- { 
-   name     PkgdName, 
-   ... 
- } 
-
-IndAudLocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGroupID    INTEGER(0..65535) OPTIONAL, 
-   propGrps       IndAudPropertyGroup, 
-   ... 
- } 
-
-IndAudPropertyGroup ::= SEQUENCE OF IndAudPropertyParm 
-
-IndAudTerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF IndAudPropertyParm, 
-   eventBufferControl   NULL OPTIONAL, 
-   serviceState         NULL OPTIONAL, 
-   ... 
- } 
-
-IndAudEventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudEventBufferDescriptor ::= SEQUENCE 
- { 
-   eventName   PkgdName, 
-   streamID    StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudSignalsDescriptor ::=CHOICE 
- { 
-   signal         IndAudSignal, 
-   seqSigList     IndAudSeqSigList, 
-   ... 
- } 
-
-IndAudSeqSigList ::= SEQUENCE 
- { 
-   id             INTEGER(0..65535), 
-   signalList     IndAudSignal OPTIONAL 
- } 
-
-IndAudSignal ::= SEQUENCE 
- { 
-   signalName     PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudDigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL 
- } 
-
-IndAudStatisticsDescriptor ::= SEQUENCE  
- { 
-   statName       PkgdName 
- } 
-
-IndAudPackagesDescriptor ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-NotifyRequest ::= SEQUENCE 
- { 
-   terminationID              TerminationIDList, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   errorDescriptor            ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-NotifyReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   errorDescriptor         ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-ObservedEventsDescriptor ::= SEQUENCE 
- { 
-   requestId               RequestID, 
-   observedEventLst        SEQUENCE OF ObservedEvent 
- } 
-
-ObservedEvent ::= SEQUENCE 
- { 
-   eventName               EventName, 
-   streamID                StreamID OPTIONAL, 
-   eventParList            SEQUENCE OF EventParameter, 
-   timeNotation            TimeNotation OPTIONAL, 
-   ... 
- } 
-
-EventName ::= PkgdName 
-
-EventParameter ::= SEQUENCE 
- { 
-   eventParameterName      Name, 
-   value                   Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
-   
- } 
-
-ServiceChangeRequest ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeParms      ServiceChangeParm, 
-   ... 
- } 
-
-ServiceChangeReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeResult     ServiceChangeResult, 
-   ... 
- } 
-
--- For ServiceChangeResult, no parameters are mandatory.  Hence the 
--- distinction between ServiceChangeParm and ServiceChangeResParm. 
-
-ServiceChangeResult ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   serviceChangeResParms      ServiceChangeResParm 
- } 
-
-WildcardField ::= OCTET STRING(SIZE(1)) 
-
-TerminationID ::= SEQUENCE 
- { 
-   wildcard       SEQUENCE OF WildcardField,  
-   id             OCTET STRING(SIZE(1..8)), 
-   ... 
- } 
--- See A.1 for explanation of wildcarding mechanism. 
--- Termination ID 0xFFFFFFFFFFFFFFFF indicates the ROOT Termination. 
-
-TerminationIDList ::= SEQUENCE OF TerminationID 
-
-MediaDescriptor ::= SEQUENCE 
- { 
-   termStateDescr    TerminationStateDescriptor OPTIONAL, 
-   streams           CHOICE 
-    { 
-      oneStream      StreamParms, 
-      multiStream    SEQUENCE OF StreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-StreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             StreamParms 
- } 
-
-StreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor     LocalControlDescriptor OPTIONAL, 
-   localDescriptor            LocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor           LocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor       StatisticsDescriptor OPTIONAL 
- } 
-
-LocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode        StreamMode OPTIONAL, 
-   reserveValue      BOOLEAN OPTIONAL, 
-   reserveGroup      BOOLEAN OPTIONAL, 
-   propertyParms     SEQUENCE OF PropertyParm, 
-   ... 
- } 
-
-StreamMode ::= ENUMERATED  
- { 
-   sendOnly(0), 
-   recvOnly(1), 
-   sendRecv(2), 
-   inactive(3), 
-   loopBack(4), 
-   ... 
- } 
-
--- In PropertyParm, value is a SEQUENCE OF octet string.  When sent 
--- by an MGC the interpretation is as follows: 
--- empty sequence means CHOOSE 
--- one element sequence specifies value 
--- If the sublist field is not selected, a longer sequence means 
--- "choose one of the values" (i.e. value1 OR value2 OR ...) 
--- If the sublist field is selected, 
--- a sequence with more than one element encodes the value of a 
--- list-valued property (i.e. value1 AND value2 AND ...). 
--- The relation field may only be selected if the value sequence 
--- has length 1.  It indicates that the MG has to choose a value 
--- for the property. E.g. x > 3 (using the greaterThan 
--- value for relation) instructs the MG to choose any value larger 
--- than 3 for property x. 
--- The range field may only be selected if the value sequence 
--- has length 2.  It indicates that the MG has to choose a value 
--- in the range between the first octet in the value sequence and 
--- the trailing octet in the value sequence, including the 
--- boundary values. 
--- When sent by the MG, only responses to an AuditCapability request 
--- may contain multiple values, a range, or a relation field. 
-
-PropertyParm ::= SEQUENCE 
- { 
-   name        PkgdName, 
-   value       SEQUENCE OF OCTET STRING, 
-   extraInfo   CHOICE 
-    { 
-      relation    Relation, 
-      range       BOOLEAN, 
-      sublist     BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
-Name ::= OCTET STRING(SIZE(2)) 
-
-PkgdName ::= OCTET STRING(SIZE(4)) 
--- represents Package Name (2 octets) plus Property, Event, 
--- Signal Names or Statistics ID. (2 octets) 
--- To wildcard a package use 0xFFFF for first two octets, choose 
--- is not allowed. To reference native property tag specified in 
--- Annex C, use 0x0000 as first two octets. 
--- To wildcard a Property, Event, Signal, or Statistics ID, use 
--- 0xFFFF for last two octets, choose is not allowed. 
--- Wildcarding of Package Name is permitted only if Property, 
--- Event, Signal, or Statistics ID are 
--- also wildcarded. 
-
-Relation ::= ENUMERATED 
- { 
-   greaterThan(0), 
-   smallerThan(1), 
-   unequalTo(2), 
-   ... 
- } 
-
-LocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGrps SEQUENCE OF PropertyGroup, 
-   ... 
- } 
-
-PropertyGroup ::= SEQUENCE OF PropertyParm 
-
-TerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF PropertyParm, 
-   eventBufferControl   EventBufferControl OPTIONAL, 
-   serviceState         ServiceState OPTIONAL, 
-   ... 
- } 
-
-EventBufferControl ::= ENUMERATED 
- { 
-   off(0), 
-   lockStep(1), 
-   ... 
- } 
-
-ServiceState ::= ENUMERATED 
- { 
-   test(0), 
-   outOfSvc(1), 
-   inSvc(2), 
-   ... 
- } 
-
-MuxDescriptor   ::= SEQUENCE 
- { 
-   muxType           MuxType, 
-   termList          SEQUENCE OF TerminationID, 
-   nonStandardData   NonStandardData OPTIONAL, 
-   ... 
- } 
-
-MuxType ::= ENUMERATED 
- { 
-   h221(0), 
-   h223(1), 
-   h226(2), 
-   v76(3), 
-   ..., 
-   nx64k(4) 
- } 
-
-StreamID ::= INTEGER(0..65535)   -- 16-bit unsigned integer 
-
-EventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   -- RequestID must be present if eventList 
-   -- is non empty 
-   eventList      SEQUENCE OF RequestedEvent, 
-   ... 
- } 
-
-RequestedEvent ::= SEQUENCE 
- { 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   eventAction    RequestedActions OPTIONAL, 
-   evParList      SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-RequestedActions ::= SEQUENCE 
- { 
-   keepActive           BOOLEAN OPTIONAL, 
-   eventDM              EventDM OPTIONAL, 
-   secondEvent          SecondEventsDescriptor OPTIONAL, 
-   signalsDescriptor    SignalsDescriptor OPTIONAL, 
-   ... 
- } 
-
-EventDM ::= CHOICE 
- { 
-   digitMapName   DigitMapName, 
-   digitMapValue  DigitMapValue 
- } 
-
-SecondEventsDescriptor ::= SEQUENCE 
- { 
-   requestID         RequestID OPTIONAL, 
-   eventList         SEQUENCE OF SecondRequestedEvent, 
-   ... 
- } 
-
-SecondRequestedEvent ::= SEQUENCE 
- { 
-   pkgdName          PkgdName, 
-   streamID          StreamID OPTIONAL, 
-   eventAction       SecondRequestedActions OPTIONAL, 
-   evParList         SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-SecondRequestedActions ::= SEQUENCE 
- { 
-   keepActive           BOOLEAN OPTIONAL, 
-   eventDM              EventDM OPTIONAL, 
-   signalsDescriptor    SignalsDescriptor OPTIONAL, 
-   ... 
- } 
-
-EventBufferDescriptor ::= SEQUENCE OF EventSpec 
-
-EventSpec ::= SEQUENCE 
- { 
-   eventName      EventName, 
-   streamID       StreamID OPTIONAL, 
-   eventParList   SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-
-SignalsDescriptor ::= SEQUENCE OF SignalRequest 
-
-SignalRequest ::= CHOICE 
- { 
-   signal         Signal, 
-   seqSigList     SeqSigList, 
-   ... 
- } 
-
-SeqSigList ::= SEQUENCE 
- { 
-   id          INTEGER(0..65535), 
-   signalList  SEQUENCE OF Signal 
- } 
-
-Signal ::= SEQUENCE 
- { 
-   signalName        SignalName, 
-   streamID          StreamID OPTIONAL, 
-   sigType           SignalType OPTIONAL, 
-   duration          INTEGER (0..65535) OPTIONAL, 
-   notifyCompletion  NotifyCompletion OPTIONAL, 
-   keepActive        BOOLEAN OPTIONAL, 
-   sigParList        SEQUENCE OF SigParameter, 
-   ...,
-   direction         SignalDirection OPTIONAL,
-   requestID         RequestID OPTIONAL 
- } 
-
-SignalType ::= ENUMERATED 
- { 
-   brief(0), 
-   onOff(1), 
-   timeOut(2), 
-   ... 
- } 
-
-SignalDirection ::= ENUMERATED
- {
-   internal(0),
-   external(1),
-   both(3),
-   ...
- }
-
-SignalName ::= PkgdName 
-
-NotifyCompletion ::= BIT STRING 
- { 
-   onTimeOut(0), onInterruptByEvent(1), 
-   onInterruptByNewSignalDescr(2), otherReason(3) 
- } 
-
-SigParameter ::= SEQUENCE 
- { 
-   sigParameterName     Name, 
-   value                Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
--- For an AuditCapReply with all events, the RequestID SHALL be ALL. 
--- ALL is represented by 0xffffffff. 
-
-RequestID ::= INTEGER(0..4294967295)   -- 32-bit unsigned integer 
-
-ModemDescriptor ::= SEQUENCE 
- { 
-   mtl               SEQUENCE OF ModemType,  
-   mpl               SEQUENCE OF PropertyParm, 
-   nonStandardData   NonStandardData OPTIONAL 
- } 
-
-ModemType ::= ENUMERATED 
- { 
-   v18(0), 
-   v22(1), 
-   v22bis(2), 
-   v32(3), 
-   v32bis(4), 
-   v34(5), 
-   v90(6), 
-   v91(7), 
-   synchISDN(8), 
-   ... 
- } 
-
-DigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL, 
-   digitMapValue  DigitMapValue OPTIONAL 
- } 
-
-DigitMapName ::= Name 
-
-DigitMapValue ::= SEQUENCE 
- { 
-   startTimer        INTEGER(0..99) OPTIONAL, 
-   shortTimer        INTEGER(0..99) OPTIONAL, 
-   longTimer         INTEGER(0..99) OPTIONAL, 
-   digitMapBody      IA5String, 
-   -- Units are seconds for start, short and long timers, and 
-   -- hundreds of milliseconds for duration timer. Thus start, 
-   -- short, and long range from 1 to 99 seconds and duration 
-   -- from 100 ms to 9.9 s 
-   -- See A.3 for explanation of digit map syntax 
-   ..., 
-   durationTimer     INTEGER (0..99) OPTIONAL 
- } 
-
-ServiceChangeParm ::= SEQUENCE 
- { 
-   serviceChangeMethod          ServiceChangeMethod, 
-   serviceChangeAddress         ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion         INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile         ServiceChangeProfile OPTIONAL, 
-   serviceChangeReason          Value, 
-   -- A serviceChangeReason consists of a numeric reason code 
-   -- and an optional text description. 
-   -- The serviceChangeReason SHALL be a string consisting of  
-   -- a decimal reason code, optionally followed by a single  
-   -- space character and a textual description string. 
-   -- This string is first BER-encoded as an IA5String. 
-   -- The result of this BER-encoding is then encoded as 
-   -- an ASN.1 OCTET STRING type, "double wrapping" the  
-   -- value 
-   -- as was done for package elements. 
-   serviceChangeDelay           INTEGER(0..4294967295) OPTIONAL, 
-   -- 32-bit unsigned integer 
-   serviceChangeMgcId           MId OPTIONAL, 
-   timeStamp                    TimeNotation OPTIONAL, 
-   nonStandardData              NonStandardData OPTIONAL, 
-   ..., 
-   serviceChangeInfo            AuditDescriptor OPTIONAL,
-   serviceChangeIncompleteFlag  NULL OPTIONAL 
- } 
-
-ServiceChangeAddress ::= CHOICE 
- { 
-   portNumber        INTEGER(0..65535),    -- TCP/UDP port number 
-   ip4Address        IP4Address, 
-   ip6Address        IP6Address, 
-   domainName        DomainName, 
-   deviceName        PathName, 
-   mtpAddress        OCTET STRING(SIZE(2..4)), 
-   ... 
- } 
-
-ServiceChangeResParm ::= SEQUENCE 
- { 
-   serviceChangeMgcId      MId OPTIONAL, 
-   serviceChangeAddress    ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion    INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile    ServiceChangeProfile OPTIONAL, 
-   timestamp               TimeNotation OPTIONAL, 
-   ... 
- } 
-
-ServiceChangeMethod ::= ENUMERATED 
- { 
-   failover(0), 
-   forced(1), 
-   graceful(2), 
-   restart(3), 
-   disconnected(4), 
-   handOff(5), 
-   ... 
- } 
-       
-ServiceChangeProfile ::= SEQUENCE 
- { 
-   profileName    IA5String(SIZE (1..67)) 
-   
-   -- 64 characters for name, 1 for "/", 2 for version to match ABNF 
- } 
-
-PackagesDescriptor ::= SEQUENCE OF PackagesItem 
-PackagesItem ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-StatisticsDescriptor ::= SEQUENCE OF StatisticsParameter 
-
-StatisticsParameter ::= SEQUENCE 
- { 
-   statName       PkgdName, 
-   statValue      Value OPTIONAL 
- } 
-
-NonStandardData ::= SEQUENCE 
- { 
-   nonStandardIdentifier   NonStandardIdentifier, 
-   data                    OCTET STRING 
- } 
-
-NonStandardIdentifier ::= CHOICE 
- { 
-   object            OBJECT IDENTIFIER, 
-   h221NonStandard   H221NonStandard, 
-   experimental      IA5String(SIZE(8)),  
-   -- first two characters SHOULD be "X-" or "X+" 
-   ... 
- } 
-
-H221NonStandard ::= SEQUENCE 
- {  t35CountryCode1      INTEGER(0..255), 
-    t35CountryCode2      INTEGER(0..255),      -- country, as per T.35 
-    t35Extension         INTEGER(0..255),      -- assigned nationally 
-    manufacturerCode     INTEGER(0..65535), -- assigned nationally 
-    ... 
- } 
-
-TimeNotation ::= SEQUENCE 
- { 
-   date     IA5String(SIZE(8)),  -- yyyymmdd format 
-   time     IA5String(SIZE(8))   -- hhmmssss format 
-   -- per ISO 8601:1988 
- } 
-
-Value ::= SEQUENCE OF OCTET STRING 
-
-END 
diff --git a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3b.asn b/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3b.asn
deleted file mode 100644
index 1fb4d8fff2..0000000000
--- a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3b.asn
+++ /dev/null
@@ -1,1001 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3b
-{itu-t(0) recommendation(0) h(8) h248(248) 
- modules(0) media-gateway-control(0) version3(3)} 
-DEFINITIONS AUTOMATIC TAGS ::= 
-BEGIN 
-       
-
-MegacoMessage ::= SEQUENCE 
- { 
-   authHeader     AuthenticationHeader OPTIONAL, 
-   mess           Message 
- } 
-
-AuthenticationHeader ::= SEQUENCE 
- { 
-   secParmIndex   SecurityParmIndex, 
-   seqNum         SequenceNum, 
-   ad             AuthData 
- } 
-
-SecurityParmIndex ::= OCTET STRING(SIZE(4)) 
-
-SequenceNum       ::= OCTET STRING(SIZE(4)) 
-
-AuthData          ::= OCTET STRING (SIZE (12..32)) 
-
-Message ::= SEQUENCE 
- { 
-   version           INTEGER(0..99), 
-   -- The version of the protocol defined here is equal to 3. 
-   mId               MId,  -- Name/address of message originator 
-   messageBody CHOICE 
-    { 
-      messageError      ErrorDescriptor, 
-      transactions      SEQUENCE OF Transaction 
-    }, 
-   ... 
- } 
-
-MId ::= CHOICE 
- { 
-   ip4Address           IP4Address, 
-   ip6Address           IP6Address, 
-   domainName           DomainName, 
-   deviceName           PathName, 
-   mtpAddress           OCTET STRING(SIZE(2..4)), 
-   -- Addressing structure of mtpAddress: 
-   --     25 - 15              0 
-   --     |  PC           | NI | 
-   --     24 - 14 bits    2 bits 
-   -- Note: 14 bits are defined for international use. 
-   -- Two national options exist where the point code is 16 or 24   
-   -- bits. 
-   -- To octet align the mtpAddress, the MSBs shall be encoded as 0s. 
-   ... 
- } 
-
-DomainName ::= SEQUENCE 
- { 
-   name        IA5String, 
-   -- The name starts with an alphanumeric digit followed by a 
-   -- sequence of alphanumeric digits, hyphens and dots.  No two 
-   -- dots shall occur consecutively. 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP4Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(4)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP6Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(16)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-PathName ::= IA5String(SIZE (1..64)) 
--- See A.3 
-
-Transaction ::= CHOICE 
- { 
-   transactionRequest      TransactionRequest, 
-   transactionPending      TransactionPending, 
-   transactionReply        TransactionReply, 
-   transactionResponseAck  TransactionResponseAck, 
-   -- use of response acks is dependent on underlying transport 
-   ... 
- } 
-
-TransactionId ::= INTEGER(0..4294967295)  -- 32-bit unsigned integer 
-
-TransactionRequest ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   actions              SEQUENCE OF ActionRequest, 
-   ... 
- } 
-
-TransactionPending ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   ... 
- } 
-
-TransactionReply ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   immAckRequired       NULL OPTIONAL, 
-   transactionResult    CHOICE 
-    { 
-      transactionError   ErrorDescriptor, 
-      actionReplies      SEQUENCE OF ActionReply 
-    }, 
-    ...,
-   -- Erlang Note: NOT REALLY PART OF THIS IMPLEMENTATION
-   -- Erlang Note: The only reason why we need to include
-   -- Erlang Note: these definitions in this version is
-   -- Erlang Note: that we cannot distinguish between v3 
-   -- Erlang Note: versions in the megaco_messenger module
-   segmentNumber         SegmentNumber OPTIONAL,
-   segmentationComplete  NULL OPTIONAL 
- } 
-
--- SegmentReply ::= SEQUENCE
---  {
---    transactionId         TransactionId,
---    segmentNumber         SegmentNumber,
---    segmentationComplete  NULL OPTIONAL,
---    ...
---  }
--- 
-SegmentNumber ::= INTEGER(0..65535)
-
-TransactionResponseAck ::= SEQUENCE OF TransactionAck 
-TransactionAck ::= SEQUENCE 
- { 
-   firstAck       TransactionId, 
-   lastAck        TransactionId OPTIONAL 
- } 
-
-ErrorDescriptor ::= SEQUENCE 
- { 
-   errorCode      ErrorCode, 
-   errorText      ErrorText OPTIONAL 
- } 
-
-ErrorCode ::= INTEGER(0..65535) 
--- See clause 14 for IANA considerations with respect to error codes 
-ErrorText ::= IA5String 
-
-ContextID ::= INTEGER(0..4294967295) 
-
--- Context NULL Value: 0 
--- Context CHOOSE Value: 4294967294 (0xFFFFFFFE)  
--- Context ALL Value: 4294967295 (0xFFFFFFFF) 
-
-
-ActionRequest ::= SEQUENCE 
- { 
-   contextId            ContextID, 
-   contextRequest       ContextRequest OPTIONAL, 
-   contextAttrAuditReq  ContextAttrAuditRequest OPTIONAL, 
-   commandRequests      SEQUENCE OF CommandRequest 
- } 
-
-ActionReply ::= SEQUENCE 
- { 
-   contextId         ContextID, 
-   errorDescriptor   ErrorDescriptor OPTIONAL, 
-   contextReply      ContextRequest OPTIONAL, 
-   commandReply      SEQUENCE OF CommandReply 
- } 
-
-ContextRequest ::= SEQUENCE 
- { 
-   priority       INTEGER(0..15) OPTIONAL, 
-   emergency      BOOLEAN OPTIONAL, 
-   topologyReq    SEQUENCE OF TopologyRequest OPTIONAL, 
-   ...,
-   iepscallind    BOOLEAN OPTIONAL,
-   contextProp    SEQUENCE OF PropertyParm OPTIONAL 
- } 
-
-ContextAttrAuditRequest ::= SEQUENCE 
- { 
-   topology        NULL OPTIONAL, 
-   emergency       NULL OPTIONAL, 
-   priority        NULL OPTIONAL, 
-   ...,
-   iepscallind     NULL OPTIONAL,
-   contextPropAud  SEQUENCE OF IndAudPropertyParm OPTIONAL  
- } 
-
-CommandRequest ::= SEQUENCE 
- { 
-   command           Command, 
-   optional          NULL OPTIONAL, 
-   wildcardReturn    NULL OPTIONAL, 
-   ... 
- } 
-
-Command ::= CHOICE 
- { 
-   addReq               AmmRequest, 
-   moveReq              AmmRequest, 
-   modReq               AmmRequest, 
-   -- Add, Move, Modify requests have the same parameters 
-   subtractReq          SubtractRequest, 
-   auditCapRequest      AuditRequest, 
-   auditValueRequest    AuditRequest, 
-   notifyReq            NotifyRequest, 
-   serviceChangeReq     ServiceChangeRequest, 
-   ... 
- } 
-
-CommandReply ::= CHOICE 
- { 
-   addReply                AmmsReply, 
-   moveReply               AmmsReply, 
-   modReply                AmmsReply, 
-   subtractReply           AmmsReply, 
-   -- Add, Move, Modify, Subtract replies have the same parameters 
-   auditCapReply           AuditReply, 
-   auditValueReply         AuditReply, 
-   notifyReply             NotifyReply, 
-   serviceChangeReply      ServiceChangeReply, 
-   ... 
- } 
-
-TopologyRequest ::= SEQUENCE 
- { 
-   terminationFrom         TerminationID, 
-   terminationTo           TerminationID, 
-   topologyDirection       ENUMERATED 
-    { 
-      bothway(0), 
-      isolate(1), 
-      oneway(2) 
-    }, 
-   ..., 
-   streamID             StreamID OPTIONAL 
- } 
-
-AmmRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   descriptors          SEQUENCE OF AmmDescriptor, 
-   -- At most one descriptor of each type (see AmmDescriptor) 
-   -- allowed in the sequence. 
-   ... 
- } 
-
-AmmDescriptor ::= CHOICE 
- { 
-   mediaDescriptor         MediaDescriptor, 
-   modemDescriptor         ModemDescriptor, 
-   muxDescriptor           MuxDescriptor, 
-   eventsDescriptor        EventsDescriptor, 
-   eventBufferDescriptor   EventBufferDescriptor, 
-   signalsDescriptor       SignalsDescriptor, 
-   digitMapDescriptor      DigitMapDescriptor, 
-   auditDescriptor         AuditDescriptor, 
-   ...,
-   statisticsDescriptor    StatisticsDescriptor 
- } 
-
-
-AmmsReply ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   terminationAudit     TerminationAudit OPTIONAL, 
-   ... 
- } 
-
-SubtractRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   auditDescriptor      AuditDescriptor OPTIONAL, 
-   ... 
- } 
-
-AuditRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationID, 
-   auditDescriptor      AuditDescriptor, 
-   ... 
- } 
-
-AuditReply ::= CHOICE 
- { 
-   contextAuditResult   TerminationIDList, 
-   error                ErrorDescriptor, 
-   auditResult          AuditResult, 
-   ... 
- } 
-
-AuditResult ::= SEQUENCE 
- { 
-   
-   terminationID           TerminationID, 
-   terminationAuditResult  TerminationAudit 
- } 
-
-
-
-TerminationAudit ::= SEQUENCE OF AuditReturnParameter 
-
-AuditReturnParameter ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   mediaDescriptor            MediaDescriptor, 
-   modemDescriptor            ModemDescriptor, 
-   muxDescriptor              MuxDescriptor, 
-   eventsDescriptor           EventsDescriptor, 
-   eventBufferDescriptor      EventBufferDescriptor, 
-   signalsDescriptor          SignalsDescriptor, 
-   digitMapDescriptor         DigitMapDescriptor, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   statisticsDescriptor       StatisticsDescriptor, 
-   packagesDescriptor         PackagesDescriptor, 
-   emptyDescriptors           AuditDescriptor, 
-   ... 
- } 
-
-AuditDescriptor ::= SEQUENCE 
- { 
-   auditToken  BIT STRING 
-    { 
-      muxToken(0), modemToken(1), mediaToken(2), 
-      eventsToken(3), signalsToken(4), 
-      digitMapToken(5), statsToken(6), 
-      observedEventsToken(7), 
-      packagesToken(8), eventBufferToken(9) 
-    } OPTIONAL, 
-   ..., 
-   auditPropertyToken SEQUENCE OF IndAuditParameter OPTIONAL 
- } 
-
-
-IndAuditParameter ::= CHOICE 
- { 
-   -- Note that the lower/upper case letters of the tags have 
-   -- been changed. The same changes has been made in text...
-   indAudMediaDescriptor         IndAudMediaDescriptor, 
-   indAudEventsDescriptor        IndAudEventsDescriptor, 
-   indAudEventBufferDescriptor   IndAudEventBufferDescriptor, 
-   indAudSignalsDescriptor       IndAudSignalsDescriptor, 
-   indAudDigitMapDescriptor      IndAudDigitMapDescriptor, 
-   indAudStatisticsDescriptor    IndAudStatisticsDescriptor, 
-   indAudPackagesDescriptor      IndAudPackagesDescriptor, 
-   ... 
- } 
-
-IndAudMediaDescriptor ::= SEQUENCE 
- { 
-   
-   termStateDescr    IndAudTerminationStateDescriptor OPTIONAL, 
-   streams  CHOICE 
-    { 
-      oneStream      IndAudStreamParms, 
-      multiStream    SEQUENCE OF IndAudStreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-IndAudStreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             IndAudStreamParms 
- } 
-
-IndAudStreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor  IndAudLocalControlDescriptor OPTIONAL, 
-   localDescriptor         IndAudLocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor        IndAudLocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor    IndAudStatisticsDescriptor OPTIONAL
- } 
-
-IndAudLocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode              NULL OPTIONAL, 
-   reserveValue            NULL OPTIONAL, 
-   reserveGroup            NULL OPTIONAL, 
-   propertyParms           SEQUENCE OF IndAudPropertyParm OPTIONAL, 
-   ... 
- } 
-
-IndAudPropertyParm ::= SEQUENCE 
- { 
-   name     PkgdName, 
-   ... 
- } 
-
-IndAudLocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGroupID    INTEGER(0..65535) OPTIONAL, 
-   propGrps       IndAudPropertyGroup, 
-   ... 
- } 
-
-IndAudPropertyGroup ::= SEQUENCE OF IndAudPropertyParm 
-
-IndAudTerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF IndAudPropertyParm, 
-   eventBufferControl   NULL OPTIONAL, 
-   serviceState         NULL OPTIONAL, 
-   ... 
- } 
-
-IndAudEventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudEventBufferDescriptor ::= SEQUENCE 
- { 
-   eventName   PkgdName, 
-   streamID    StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudSignalsDescriptor ::=CHOICE 
- { 
-   signal         IndAudSignal, 
-   seqSigList     IndAudSeqSigList, 
-   ... 
- } 
-
-IndAudSeqSigList ::= SEQUENCE 
- { 
-   id             INTEGER(0..65535), 
-   signalList     IndAudSignal OPTIONAL 
- } 
-
-IndAudSignal ::= SEQUENCE 
- { 
-   signalName     PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudDigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL 
- } 
-
-IndAudStatisticsDescriptor ::= SEQUENCE  
- { 
-   statName       PkgdName 
- } 
-
-IndAudPackagesDescriptor ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-NotifyRequest ::= SEQUENCE 
- { 
-   terminationID              TerminationIDList, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   errorDescriptor            ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-NotifyReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   errorDescriptor         ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-ObservedEventsDescriptor ::= SEQUENCE 
- { 
-   requestId               RequestID, 
-   observedEventLst        SEQUENCE OF ObservedEvent 
- } 
-
-ObservedEvent ::= SEQUENCE 
- { 
-   eventName               EventName, 
-   streamID                StreamID OPTIONAL, 
-   eventParList            SEQUENCE OF EventParameter, 
-   timeNotation            TimeNotation OPTIONAL, 
-   ... 
- } 
-
-EventName ::= PkgdName 
-
-EventParameter ::= SEQUENCE 
- { 
-   eventParameterName      Name, 
-   value                   Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
-   
- } 
-
-ServiceChangeRequest ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeParms      ServiceChangeParm, 
-   ... 
- } 
-
-ServiceChangeReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeResult     ServiceChangeResult, 
-   ... 
- } 
-
--- For ServiceChangeResult, no parameters are mandatory.  Hence the 
--- distinction between ServiceChangeParm and ServiceChangeResParm. 
-
-ServiceChangeResult ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   serviceChangeResParms      ServiceChangeResParm 
- } 
-
-WildcardField ::= OCTET STRING(SIZE(1)) 
-
-TerminationID ::= SEQUENCE 
- { 
-   wildcard       SEQUENCE OF WildcardField,  
-   id             OCTET STRING(SIZE(1..8)), 
-   ... 
- } 
--- See A.1 for explanation of wildcarding mechanism. 
--- Termination ID 0xFFFFFFFFFFFFFFFF indicates the ROOT Termination. 
-
-TerminationIDList ::= SEQUENCE OF TerminationID 
-
-MediaDescriptor ::= SEQUENCE 
- { 
-   termStateDescr    TerminationStateDescriptor OPTIONAL, 
-   streams           CHOICE 
-    { 
-      oneStream      StreamParms, 
-      multiStream    SEQUENCE OF StreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-StreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             StreamParms 
- } 
-
-StreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor     LocalControlDescriptor OPTIONAL, 
-   localDescriptor            LocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor           LocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor       StatisticsDescriptor OPTIONAL 
- } 
-
-LocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode        StreamMode OPTIONAL, 
-   reserveValue      BOOLEAN OPTIONAL, 
-   reserveGroup      BOOLEAN OPTIONAL, 
-   propertyParms     SEQUENCE OF PropertyParm, 
-   ... 
- } 
-
-StreamMode ::= ENUMERATED  
- { 
-   sendOnly(0), 
-   recvOnly(1), 
-   sendRecv(2), 
-   inactive(3), 
-   loopBack(4), 
-   ... 
- } 
-
--- In PropertyParm, value is a SEQUENCE OF octet string.  When sent 
--- by an MGC the interpretation is as follows: 
--- empty sequence means CHOOSE 
--- one element sequence specifies value 
--- If the sublist field is not selected, a longer sequence means 
--- "choose one of the values" (i.e. value1 OR value2 OR ...) 
--- If the sublist field is selected, 
--- a sequence with more than one element encodes the value of a 
--- list-valued property (i.e. value1 AND value2 AND ...). 
--- The relation field may only be selected if the value sequence 
--- has length 1.  It indicates that the MG has to choose a value 
--- for the property. E.g. x > 3 (using the greaterThan 
--- value for relation) instructs the MG to choose any value larger 
--- than 3 for property x. 
--- The range field may only be selected if the value sequence 
--- has length 2.  It indicates that the MG has to choose a value 
--- in the range between the first octet in the value sequence and 
--- the trailing octet in the value sequence, including the 
--- boundary values. 
--- When sent by the MG, only responses to an AuditCapability request 
--- may contain multiple values, a range, or a relation field. 
-
-PropertyParm ::= SEQUENCE 
- { 
-   name        PkgdName, 
-   value       SEQUENCE OF OCTET STRING, 
-   extraInfo   CHOICE 
-    { 
-      relation    Relation, 
-      range       BOOLEAN, 
-      sublist     BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
-Name ::= OCTET STRING(SIZE(2)) 
-
-PkgdName ::= OCTET STRING(SIZE(4)) 
--- represents Package Name (2 octets) plus Property, Event, 
--- Signal Names or Statistics ID. (2 octets) 
--- To wildcard a package use 0xFFFF for first two octets, choose 
--- is not allowed. To reference native property tag specified in 
--- Annex C, use 0x0000 as first two octets. 
--- To wildcard a Property, Event, Signal, or Statistics ID, use 
--- 0xFFFF for last two octets, choose is not allowed. 
--- Wildcarding of Package Name is permitted only if Property, 
--- Event, Signal, or Statistics ID are 
--- also wildcarded. 
-
-Relation ::= ENUMERATED 
- { 
-   greaterThan(0), 
-   smallerThan(1), 
-   unequalTo(2), 
-   ... 
- } 
-
-LocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGrps SEQUENCE OF PropertyGroup, 
-   ... 
- } 
-
-PropertyGroup ::= SEQUENCE OF PropertyParm 
-
-TerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF PropertyParm, 
-   eventBufferControl   EventBufferControl OPTIONAL, 
-   serviceState         ServiceState OPTIONAL, 
-   ... 
- } 
-
-EventBufferControl ::= ENUMERATED 
- { 
-   off(0), 
-   lockStep(1), 
-   ... 
- } 
-
-ServiceState ::= ENUMERATED 
- { 
-   test(0), 
-   outOfSvc(1), 
-   inSvc(2), 
-   ... 
- } 
-
-MuxDescriptor   ::= SEQUENCE 
- { 
-   muxType           MuxType, 
-   termList          SEQUENCE OF TerminationID, 
-   nonStandardData   NonStandardData OPTIONAL, 
-   ... 
- } 
-
-MuxType ::= ENUMERATED 
- { 
-   h221(0), 
-   h223(1), 
-   h226(2), 
-   v76(3), 
-   ..., 
-   nx64k(4) 
- } 
-
-StreamID ::= INTEGER(0..65535)   -- 16-bit unsigned integer 
-
-EventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   -- RequestID must be present if eventList 
-   -- is non empty 
-   eventList      SEQUENCE OF RequestedEvent, 
-   ... 
- } 
-
-RequestedEvent ::= SEQUENCE 
- { 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   eventAction    RequestedActions OPTIONAL, 
-   evParList      SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-RequestedActions ::= SEQUENCE 
- { 
-   keepActive           BOOLEAN OPTIONAL, 
-   eventDM              EventDM OPTIONAL, 
-   secondEvent          SecondEventsDescriptor OPTIONAL, 
-   signalsDescriptor    SignalsDescriptor OPTIONAL, 
-   ... 
- } 
-
-EventDM ::= CHOICE 
- { 
-   digitMapName   DigitMapName, 
-   digitMapValue  DigitMapValue 
- } 
-
-SecondEventsDescriptor ::= SEQUENCE 
- { 
-   requestID         RequestID OPTIONAL, 
-   eventList         SEQUENCE OF SecondRequestedEvent, 
-   ... 
- } 
-
-SecondRequestedEvent ::= SEQUENCE 
- { 
-   pkgdName          PkgdName, 
-   streamID          StreamID OPTIONAL, 
-   eventAction       SecondRequestedActions OPTIONAL, 
-   evParList         SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-SecondRequestedActions ::= SEQUENCE 
- { 
-   keepActive           BOOLEAN OPTIONAL, 
-   eventDM              EventDM OPTIONAL, 
-   signalsDescriptor    SignalsDescriptor OPTIONAL, 
-   ... 
- } 
-
-EventBufferDescriptor ::= SEQUENCE OF EventSpec 
-
-EventSpec ::= SEQUENCE 
- { 
-   eventName      EventName, 
-   streamID       StreamID OPTIONAL, 
-   eventParList   SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-
-SignalsDescriptor ::= SEQUENCE OF SignalRequest 
-
-SignalRequest ::= CHOICE 
- { 
-   signal         Signal, 
-   seqSigList     SeqSigList, 
-   ... 
- } 
-
-SeqSigList ::= SEQUENCE 
- { 
-   id          INTEGER(0..65535), 
-   signalList  SEQUENCE OF Signal 
- } 
-
-Signal ::= SEQUENCE 
- { 
-   signalName        SignalName, 
-   streamID          StreamID OPTIONAL, 
-   sigType           SignalType OPTIONAL, 
-   duration          INTEGER (0..65535) OPTIONAL, 
-   notifyCompletion  NotifyCompletion OPTIONAL, 
-   keepActive        BOOLEAN OPTIONAL, 
-   sigParList        SEQUENCE OF SigParameter, 
-   ...,
-   direction         SignalDirection OPTIONAL,
-   requestID         RequestID OPTIONAL 
- } 
-
-SignalType ::= ENUMERATED 
- { 
-   brief(0), 
-   onOff(1), 
-   timeOut(2), 
-   ... 
- } 
-
-SignalDirection ::= ENUMERATED
- {
-   internal(0),
-   external(1),
-   both(3),
-   ...
- }
-
-SignalName ::= PkgdName 
-
-NotifyCompletion ::= BIT STRING 
- { 
-   onTimeOut(0), onInterruptByEvent(1), 
-   onInterruptByNewSignalDescr(2), otherReason(3) 
- } 
-
-SigParameter ::= SEQUENCE 
- { 
-   sigParameterName     Name, 
-   value                Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
--- For an AuditCapReply with all events, the RequestID SHALL be ALL. 
--- ALL is represented by 0xffffffff. 
-
-RequestID ::= INTEGER(0..4294967295)   -- 32-bit unsigned integer 
-
-ModemDescriptor ::= SEQUENCE 
- { 
-   mtl               SEQUENCE OF ModemType,  
-   mpl               SEQUENCE OF PropertyParm, 
-   nonStandardData   NonStandardData OPTIONAL 
- } 
-
-ModemType ::= ENUMERATED 
- { 
-   v18(0), 
-   v22(1), 
-   v22bis(2), 
-   v32(3), 
-   v32bis(4), 
-   v34(5), 
-   v90(6), 
-   v91(7), 
-   synchISDN(8), 
-   ... 
- } 
-
-DigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL, 
-   digitMapValue  DigitMapValue OPTIONAL 
- } 
-
-DigitMapName ::= Name 
-
-DigitMapValue ::= SEQUENCE 
- { 
-   startTimer        INTEGER(0..99) OPTIONAL, 
-   shortTimer        INTEGER(0..99) OPTIONAL, 
-   longTimer         INTEGER(0..99) OPTIONAL, 
-   digitMapBody      IA5String, 
-   -- Units are seconds for start, short and long timers, and 
-   -- hundreds of milliseconds for duration timer. Thus start, 
-   -- short, and long range from 1 to 99 seconds and duration 
-   -- from 100 ms to 9.9 s 
-   -- See A.3 for explanation of digit map syntax 
-   ..., 
-   durationTimer     INTEGER (0..99) OPTIONAL 
- } 
-
-ServiceChangeParm ::= SEQUENCE 
- { 
-   serviceChangeMethod          ServiceChangeMethod, 
-   serviceChangeAddress         ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion         INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile         ServiceChangeProfile OPTIONAL, 
-   serviceChangeReason          Value, 
-   -- A serviceChangeReason consists of a numeric reason code 
-   -- and an optional text description. 
-   -- The serviceChangeReason SHALL be a string consisting of  
-   -- a decimal reason code, optionally followed by a single  
-   -- space character and a textual description string. 
-   -- This string is first BER-encoded as an IA5String. 
-   -- The result of this BER-encoding is then encoded as 
-   -- an ASN.1 OCTET STRING type, "double wrapping" the  
-   -- value 
-   -- as was done for package elements. 
-   serviceChangeDelay           INTEGER(0..4294967295) OPTIONAL, 
-   -- 32-bit unsigned integer 
-   serviceChangeMgcId           MId OPTIONAL, 
-   timeStamp                    TimeNotation OPTIONAL, 
-   nonStandardData              NonStandardData OPTIONAL, 
-   ..., 
-   serviceChangeInfo            AuditDescriptor OPTIONAL,
-   serviceChangeIncompleteFlag  NULL OPTIONAL 
- } 
-
-ServiceChangeAddress ::= CHOICE 
- { 
-   portNumber        INTEGER(0..65535),    -- TCP/UDP port number 
-   ip4Address        IP4Address, 
-   ip6Address        IP6Address, 
-   domainName        DomainName, 
-   deviceName        PathName, 
-   mtpAddress        OCTET STRING(SIZE(2..4)), 
-   ... 
- } 
-
-ServiceChangeResParm ::= SEQUENCE 
- { 
-   serviceChangeMgcId      MId OPTIONAL, 
-   serviceChangeAddress    ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion    INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile    ServiceChangeProfile OPTIONAL, 
-   timestamp               TimeNotation OPTIONAL, 
-   ... 
- } 
-
-ServiceChangeMethod ::= ENUMERATED 
- { 
-   failover(0), 
-   forced(1), 
-   graceful(2), 
-   restart(3), 
-   disconnected(4), 
-   handOff(5), 
-   ... 
- } 
-       
-ServiceChangeProfile ::= SEQUENCE 
- { 
-   profileName    IA5String(SIZE (1..67)) 
-   
-   -- 64 characters for name, 1 for "/", 2 for version to match ABNF 
- } 
-
-PackagesDescriptor ::= SEQUENCE OF PackagesItem 
-PackagesItem ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-StatisticsDescriptor ::= SEQUENCE OF StatisticsParameter 
-
-StatisticsParameter ::= SEQUENCE 
- { 
-   statName       PkgdName, 
-   statValue      Value OPTIONAL 
- } 
-
-NonStandardData ::= SEQUENCE 
- { 
-   nonStandardIdentifier   NonStandardIdentifier, 
-   data                    OCTET STRING 
- } 
-
-NonStandardIdentifier ::= CHOICE 
- { 
-   object            OBJECT IDENTIFIER, 
-   h221NonStandard   H221NonStandard, 
-   experimental      IA5String(SIZE(8)),  
-   -- first two characters SHOULD be "X-" or "X+" 
-   ... 
- } 
-
-H221NonStandard ::= SEQUENCE 
- {  t35CountryCode1      INTEGER(0..255), 
-    t35CountryCode2      INTEGER(0..255),      -- country, as per T.35 
-    t35Extension         INTEGER(0..255),      -- assigned nationally 
-    manufacturerCode     INTEGER(0..65535), -- assigned nationally 
-    ... 
- } 
-
-TimeNotation ::= SEQUENCE 
- { 
-   date     IA5String(SIZE(8)),  -- yyyymmdd format 
-   time     IA5String(SIZE(8))   -- hhmmssss format 
-   -- per ISO 8601:1988 
- } 
-
-Value ::= SEQUENCE OF OCTET STRING 
-
-END 
diff --git a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3c.asn b/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3c.asn
deleted file mode 100644
index cb6940e8b0..0000000000
--- a/lib/megaco/src/binary/MEDIA-GATEWAY-CONTROL-prev3c.asn
+++ /dev/null
@@ -1,1073 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3c
-{itu-t(0) recommendation(0) h(8) h248(248) 
- modules(0) media-gateway-control(0) version3(3)} 
-DEFINITIONS AUTOMATIC TAGS ::= 
-BEGIN 
-       
-
-MegacoMessage ::= SEQUENCE 
- { 
-   authHeader     AuthenticationHeader OPTIONAL, 
-   mess           Message 
- } 
-
-AuthenticationHeader ::= SEQUENCE 
- { 
-   secParmIndex   SecurityParmIndex, 
-   seqNum         SequenceNum, 
-   ad             AuthData 
- } 
-
-SecurityParmIndex ::= OCTET STRING(SIZE(4)) 
-
-SequenceNum       ::= OCTET STRING(SIZE(4)) 
-
-AuthData          ::= OCTET STRING (SIZE (12..32)) 
-
-Message ::= SEQUENCE 
- { 
-   version           INTEGER(0..99), 
-   -- The version of the protocol defined here is equal to 3. 
-   mId               MId,  -- Name/address of message originator 
-   messageBody CHOICE 
-    { 
-      messageError      ErrorDescriptor, 
-      transactions      SEQUENCE OF Transaction 
-    }, 
-   ... 
- } 
-
-MId ::= CHOICE 
- { 
-   ip4Address           IP4Address, 
-   ip6Address           IP6Address, 
-   domainName           DomainName, 
-   deviceName           PathName, 
-   mtpAddress           OCTET STRING(SIZE(2..4)), 
-   -- Addressing structure of mtpAddress: 
-   --     25 - 15              0 
-   --     |  PC           | NI | 
-   --     24 - 14 bits    2 bits 
-   -- Note: 14 bits are defined for international use. 
-   -- Two national options exist where the point code is 16 or 24   
-   -- bits. 
-   -- To octet align the mtpAddress, the MSBs shall be encoded as 0s. 
-   ... 
- } 
-
-DomainName ::= SEQUENCE 
- { 
-   name        IA5String, 
-   -- The name starts with an alphanumeric digit followed by a 
-   -- sequence of alphanumeric digits, hyphens and dots.  No two 
-   -- dots shall occur consecutively. 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP4Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(4)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-IP6Address ::= SEQUENCE 
- { 
-   address        OCTET STRING (SIZE(16)), 
-   portNumber     INTEGER(0..65535) OPTIONAL 
- } 
-
-PathName ::= IA5String(SIZE (1..64)) 
--- See A.3 
-
-Transaction ::= CHOICE 
- { 
-   transactionRequest      TransactionRequest, 
-   transactionPending      TransactionPending, 
-   transactionReply        TransactionReply, 
-   transactionResponseAck  TransactionResponseAck, 
-   -- use of response acks is dependent on underlying transport 
-   ...
-   -- segmentReply	      SegmentReply
- } 
-
-TransactionId ::= INTEGER(0..4294967295)  -- 32-bit unsigned integer 
-
-TransactionRequest ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   actions              SEQUENCE OF ActionRequest, 
-   ... 
- } 
-
-TransactionPending ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   ... 
- } 
-
-TransactionReply ::= SEQUENCE 
- { 
-   transactionId        TransactionId, 
-   immAckRequired       NULL OPTIONAL, 
-   transactionResult    CHOICE 
-    { 
-      transactionError   ErrorDescriptor, 
-      actionReplies      SEQUENCE OF ActionReply 
-    }, 
-    ...,
-   -- Erlang Note: NOT REALLY PART OF THIS IMPLEMENTATION
-   -- Erlang Note: The only reason why we need to include
-   -- Erlang Note: these definitions in this version is
-   -- Erlang Note: that we cannot distinguish between v3 
-   -- Erlang Note: versions in the megaco_messenger module
-   segmentNumber         SegmentNumber OPTIONAL,
-   segmentationComplete  NULL OPTIONAL 
- } 
-
--- SegmentReply ::= SEQUENCE
---  {
---    transactionId         TransactionId,
---    segmentNumber         SegmentNumber,
---    segmentationComplete  NULL OPTIONAL,
---    ...
---  }
--- 
-SegmentNumber ::= INTEGER(0..65535)
-
-TransactionResponseAck ::= SEQUENCE OF TransactionAck 
-TransactionAck ::= SEQUENCE 
- { 
-   firstAck       TransactionId, 
-   lastAck        TransactionId OPTIONAL 
- } 
-
-ErrorDescriptor ::= SEQUENCE 
- { 
-   errorCode      ErrorCode, 
-   errorText      ErrorText OPTIONAL 
- } 
-
-ErrorCode ::= INTEGER(0..65535) 
--- See clause 14 for IANA considerations with respect to error codes 
-ErrorText ::= IA5String 
-
-ContextID ::= INTEGER(0..4294967295) 
--- Context NULL Value: 0 
--- Context CHOOSE Value: 4294967294 (0xFFFFFFFE)  
--- Context ALL Value: 4294967295 (0xFFFFFFFF) 
-
-
-ActionRequest ::= SEQUENCE 
- { 
-   contextId            ContextID, 
-   contextRequest       ContextRequest OPTIONAL, 
-   contextAttrAuditReq  ContextAttrAuditRequest OPTIONAL, 
-   commandRequests      SEQUENCE OF CommandRequest 
- } 
-
-ActionReply ::= SEQUENCE 
- { 
-   contextId         ContextID, 
-   errorDescriptor   ErrorDescriptor OPTIONAL, 
-   contextReply      ContextRequest OPTIONAL, 
-   commandReply      SEQUENCE OF CommandReply 
- } 
-
-ContextRequest ::= SEQUENCE 
- { 
-   priority       INTEGER(0..15) OPTIONAL, 
-   emergency      BOOLEAN OPTIONAL, 
-   topologyReq    SEQUENCE OF TopologyRequest OPTIONAL, 
-   ...,
-   iepscallind    BOOLEAN OPTIONAL,
-   contextProp    SEQUENCE OF PropertyParm OPTIONAL,
-   contextList    SEQUENCE OF ContextID OPTIONAL
- } 
--- When returning a contextList, the contextId in the ActionReply 
--- construct will return the contextId from the associated ActionRequest.
-
-ContextAttrAuditRequest ::= SEQUENCE 
- { 
-   topology        NULL OPTIONAL, 
-   emergency       NULL OPTIONAL, 
-   priority        NULL OPTIONAL, 
-   ...,
-   iepscallind        NULL OPTIONAL,
-   contextPropAud     SEQUENCE OF IndAudPropertyParm OPTIONAL,
-
-   selectpriority     INTEGER(0..15) OPTIONAL,
-   -- to select given priority
-
-   selectemergency    BOOLEAN OPTIONAL,
-   -- to select if emergency set/not set (T/F) 
-   
-   selectiepscallind  BOOLEAN OPTIONAL,
-   -- to select if IEPS set/not set (T/F)
-
-   selectLogic        SelectLogic OPTIONAL    -- default is AND
- } 
-
-SelectLogic            ::= CHOICE
- {
-   andAUDITSelect  NULL,     -- all selection conditions satisfied
-   orAUDITSelect   NULL,     -- at least one selection condition satisfied
-   ...
- }	
-
-
-CommandRequest ::= SEQUENCE 
- { 
-   command           Command, 
-   optional          NULL OPTIONAL, 
-   wildcardReturn    NULL OPTIONAL, 
-   ... 
- } 
-
-Command ::= CHOICE 
- { 
-   addReq               AmmRequest, 
-   moveReq              AmmRequest, 
-   modReq               AmmRequest, 
-   -- Add, Move, Modify requests have the same parameters 
-   subtractReq          SubtractRequest, 
-   auditCapRequest      AuditRequest, 
-   auditValueRequest    AuditRequest, 
-   notifyReq            NotifyRequest, 
-   serviceChangeReq     ServiceChangeRequest, 
-   ... 
- } 
-
-CommandReply ::= CHOICE 
- { 
-   addReply                AmmsReply, 
-   moveReply               AmmsReply, 
-   modReply                AmmsReply, 
-   subtractReply           AmmsReply, 
-   -- Add, Move, Modify, Subtract replies have the same parameters 
-   auditCapReply           AuditReply, 
-   auditValueReply         AuditReply, 
-   notifyReply             NotifyReply, 
-   serviceChangeReply      ServiceChangeReply, 
-   ... 
- } 
-
-TopologyRequest ::= SEQUENCE 
- { 
-   terminationFrom         TerminationID, 
-   terminationTo           TerminationID, 
-   topologyDirection       ENUMERATED 
-    { 
-      bothway(0), 
-      isolate(1), 
-      oneway(2) 
-    }, 
-   ..., 
-   streamID             	StreamID OPTIONAL,
-   topologyDirectionExtension	ENUMERATED
-    {
-      onewayexternal(0),
-      onewayboth(1),
-      ...
-    } OPTIONAL 
-    -- This is not according to the standard, but without it
-    -- the TopologyRequest will be useless since topologyDirection
-    -- and topologyDirectionExtension are contradictory.
- } 
-
-AmmRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   descriptors          SEQUENCE OF AmmDescriptor, 
-   -- At most one descriptor of each type (see AmmDescriptor) 
-   -- allowed in the sequence. 
-   ... 
- } 
-
-AmmDescriptor ::= CHOICE 
- { 
-   mediaDescriptor         MediaDescriptor, 
-   modemDescriptor         ModemDescriptor, 
-   muxDescriptor           MuxDescriptor, 
-   eventsDescriptor        EventsDescriptor, 
-   eventBufferDescriptor   EventBufferDescriptor, 
-   signalsDescriptor       SignalsDescriptor, 
-   digitMapDescriptor      DigitMapDescriptor, 
-   auditDescriptor         AuditDescriptor, 
-   ...,
-   statisticsDescriptor    StatisticsDescriptor 
- } 
-
-
-AmmsReply ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   terminationAudit     TerminationAudit OPTIONAL, 
-   ... 
- } 
-
-SubtractRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationIDList, 
-   auditDescriptor      AuditDescriptor OPTIONAL, 
-   ... 
- } 
-
-AuditRequest ::= SEQUENCE 
- { 
-   terminationID        TerminationID, 
-   auditDescriptor      AuditDescriptor, 
-   ...,
-   terminationIDList    TerminationIDList OPTIONAL
- } 
--- terminationID shall contain the first termination in the
--- list when using the terminationIDList construct in AuditRequest
-
-AuditReply ::= CHOICE 
- { 
-   contextAuditResult   TerminationIDList, 
-   error                ErrorDescriptor, 
-   auditResult          AuditResult, 
-   ...,
-   auditResultTermList  TermListAuditResult
- } 
-
-AuditResult ::= SEQUENCE 
- { 
-   
-   terminationID           TerminationID, 
-   terminationAuditResult  TerminationAudit 
- } 
-
-TermListAuditResult	::= SEQUENCE
- {
-   terminationIDList       TerminationIDList,
-   terminationAuditResult  TerminationAudit,
-   ...
- }
-
-TerminationAudit ::= SEQUENCE OF AuditReturnParameter 
-
-AuditReturnParameter ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   mediaDescriptor            MediaDescriptor, 
-   modemDescriptor            ModemDescriptor, 
-   muxDescriptor              MuxDescriptor, 
-   eventsDescriptor           EventsDescriptor, 
-   eventBufferDescriptor      EventBufferDescriptor, 
-   signalsDescriptor          SignalsDescriptor, 
-   digitMapDescriptor         DigitMapDescriptor, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   statisticsDescriptor       StatisticsDescriptor, 
-   packagesDescriptor         PackagesDescriptor, 
-   emptyDescriptors           AuditDescriptor, 
-   ... 
- } 
-
-AuditDescriptor ::= SEQUENCE 
- { 
-   auditToken  BIT STRING 
-    { 
-      muxToken(0), modemToken(1), mediaToken(2), 
-      eventsToken(3), signalsToken(4), 
-      digitMapToken(5), statsToken(6), 
-      observedEventsToken(7), 
-      packagesToken(8), eventBufferToken(9) 
-    } OPTIONAL, 
-   ..., 
-   auditPropertyToken SEQUENCE OF IndAuditParameter OPTIONAL 
- } 
-
-
-IndAuditParameter ::= CHOICE 
- { 
-   -- Note that the lower/upper case letters of the tags have 
-   -- been changed. The same changes has been made in text...
-   indAudMediaDescriptor         IndAudMediaDescriptor, 
-   indAudEventsDescriptor        IndAudEventsDescriptor, 
-   indAudEventBufferDescriptor   IndAudEventBufferDescriptor, 
-   indAudSignalsDescriptor       IndAudSignalsDescriptor, 
-   indAudDigitMapDescriptor      IndAudDigitMapDescriptor, 
-   indAudStatisticsDescriptor    IndAudStatisticsDescriptor, 
-   indAudPackagesDescriptor      IndAudPackagesDescriptor, 
-   ... 
- } 
-
-IndAudMediaDescriptor ::= SEQUENCE 
- { 
-   
-   termStateDescr    IndAudTerminationStateDescriptor OPTIONAL, 
-   streams  CHOICE 
-    { 
-      oneStream      IndAudStreamParms, 
-      multiStream    SEQUENCE OF IndAudStreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-IndAudStreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             IndAudStreamParms 
- } 
-
-IndAudStreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor  IndAudLocalControlDescriptor OPTIONAL, 
-   localDescriptor         IndAudLocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor        IndAudLocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor    IndAudStatisticsDescriptor OPTIONAL
- } 
-
-IndAudLocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode              NULL OPTIONAL, 
-   reserveValue            NULL OPTIONAL, 
-   reserveGroup            NULL OPTIONAL, 
-   propertyParms           SEQUENCE OF IndAudPropertyParm OPTIONAL, 
-   ...,
-   streamModeSel           StreamMode OPTIONAL
-   -- must not have both streamMode and streamModeSel	
-   -- if both are present only streamModeSel shall be honoured
- } 
-
-IndAudPropertyParm ::= SEQUENCE 
- { 
-   name            PkgdName, 
-   ...,
-   propertyParms   PropertyParm OPTIONAL 
- } 
---  to select based on property values 
---  AND/OR selection logic is specified at context level
-
-IndAudLocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGroupID    INTEGER(0..65535) OPTIONAL, 
-   propGrps       IndAudPropertyGroup, 
-   ... 
- } 
-
-IndAudPropertyGroup ::= SEQUENCE OF IndAudPropertyParm 
-
-IndAudTerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF IndAudPropertyParm, 
-   eventBufferControl   NULL OPTIONAL, 
-   serviceState         NULL OPTIONAL, 
-   ...,
-   serviceStateSel      ServiceState OPTIONAL
-   -- must not have both serviceState and serviceStateSel
-   -- if both are present only serviceStateSel shall be honoured 
- } 
-
-IndAudEventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudEventBufferDescriptor ::= SEQUENCE 
- { 
-   eventName   PkgdName, 
-   streamID    StreamID OPTIONAL, 
-   ... 
- } 
-
-IndAudSignalsDescriptor ::=CHOICE 
- { 
-   signal         IndAudSignal, 
-   seqSigList     IndAudSeqSigList, 
-   ... 
- } 
-
-IndAudSeqSigList ::= SEQUENCE 
- { 
-   id             INTEGER(0..65535), 
-   signalList     IndAudSignal OPTIONAL 
- } 
-
-IndAudSignal ::= SEQUENCE 
- { 
-   signalName       PkgdName, 
-   streamID         StreamID OPTIONAL, 
-   ...,
-   signalRequestID  RequestID OPTIONAL 
- } 
-
-IndAudDigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL 
- } 
-
-IndAudStatisticsDescriptor ::= SEQUENCE  
- { 
-   statName       PkgdName 
- } 
-
-IndAudPackagesDescriptor ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-NotifyRequest ::= SEQUENCE 
- { 
-   terminationID              TerminationIDList, 
-   observedEventsDescriptor   ObservedEventsDescriptor, 
-   errorDescriptor            ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-NotifyReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   errorDescriptor         ErrorDescriptor OPTIONAL, 
-   ... 
- } 
-
-ObservedEventsDescriptor ::= SEQUENCE 
- { 
-   requestId               RequestID, 
-   observedEventLst        SEQUENCE OF ObservedEvent 
- } 
-
-ObservedEvent ::= SEQUENCE 
- { 
-   eventName               EventName, 
-   streamID                StreamID OPTIONAL, 
-   eventParList            SEQUENCE OF EventParameter, 
-   timeNotation            TimeNotation OPTIONAL, 
-   ... 
- } 
-
-EventName ::= PkgdName 
-
-EventParameter ::= SEQUENCE 
- { 
-   eventParameterName      Name, 
-   value                   Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
-   
- } 
-
-ServiceChangeRequest ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeParms      ServiceChangeParm, 
-   ... 
- } 
-
-ServiceChangeReply ::= SEQUENCE 
- { 
-   terminationID           TerminationIDList, 
-   serviceChangeResult     ServiceChangeResult, 
-   ... 
- } 
-
--- For ServiceChangeResult, no parameters are mandatory.  Hence the 
--- distinction between ServiceChangeParm and ServiceChangeResParm. 
-ServiceChangeResult ::= CHOICE 
- { 
-   errorDescriptor            ErrorDescriptor, 
-   serviceChangeResParms      ServiceChangeResParm 
- } 
-
-WildcardField ::= OCTET STRING(SIZE(1)) 
-
-TerminationID ::= SEQUENCE 
- { 
-   wildcard       SEQUENCE OF WildcardField,  
-   id             OCTET STRING(SIZE(1..8)), 
-   ... 
- } 
--- See A.1 for explanation of wildcarding mechanism. 
--- Termination ID 0xFFFFFFFFFFFFFFFF indicates the ROOT Termination. 
-
-TerminationIDList ::= SEQUENCE OF TerminationID 
-
-MediaDescriptor ::= SEQUENCE 
- { 
-   termStateDescr    TerminationStateDescriptor OPTIONAL, 
-   streams           CHOICE 
-    { 
-      oneStream      StreamParms, 
-      multiStream    SEQUENCE OF StreamDescriptor 
-    } OPTIONAL, 
-   ... 
- } 
-
-StreamDescriptor ::= SEQUENCE 
- { 
-   streamID                StreamID, 
-   streamParms             StreamParms 
- } 
-
-StreamParms ::= SEQUENCE 
- { 
-   localControlDescriptor     LocalControlDescriptor OPTIONAL, 
-   localDescriptor            LocalRemoteDescriptor OPTIONAL, 
-   remoteDescriptor           LocalRemoteDescriptor OPTIONAL, 
-   ...,
-   statisticsDescriptor       StatisticsDescriptor OPTIONAL 
- } 
-
-LocalControlDescriptor ::= SEQUENCE 
- { 
-   streamMode        StreamMode OPTIONAL, 
-   reserveValue      BOOLEAN OPTIONAL, 
-   reserveGroup      BOOLEAN OPTIONAL, 
-   propertyParms     SEQUENCE OF PropertyParm, 
-   ... 
- } 
-
-StreamMode ::= ENUMERATED  
- { 
-   sendOnly(0), 
-   recvOnly(1), 
-   sendRecv(2), 
-   inactive(3), 
-   loopBack(4), 
-   ... 
- } 
-
--- In PropertyParm, value is a SEQUENCE OF octet string.  When sent 
--- by an MGC the interpretation is as follows: 
--- empty sequence means CHOOSE 
--- one element sequence specifies value 
--- If the sublist field is not selected, a longer sequence means 
--- "choose one of the values" (i.e. value1 OR value2 OR ...) 
--- If the sublist field is selected, 
--- a sequence with more than one element encodes the value of a 
--- list-valued property (i.e. value1 AND value2 AND ...). 
--- The relation field may only be selected if the value sequence 
--- has length 1.  It indicates that the MG has to choose a value 
--- for the property. E.g. x > 3 (using the greaterThan 
--- value for relation) instructs the MG to choose any value larger 
--- than 3 for property x. 
--- The range field may only be selected if the value sequence 
--- has length 2.  It indicates that the MG has to choose a value 
--- in the range between the first octet in the value sequence and 
--- the trailing octet in the value sequence, including the 
--- boundary values. 
--- When sent by the MG, only responses to an AuditCapability request 
--- may contain multiple values, a range, or a relation field. 
-
-PropertyParm ::= SEQUENCE 
- { 
-   name        PkgdName, 
-   value       SEQUENCE OF OCTET STRING, 
-   extraInfo   CHOICE 
-    { 
-      relation    Relation, 
-      range       BOOLEAN, 
-      sublist     BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
-Name ::= OCTET STRING(SIZE(2)) 
-
-PkgdName ::= OCTET STRING(SIZE(4)) 
--- represents Package Name (2 octets) plus Property, Event, 
--- Signal Names or Statistics ID. (2 octets) 
--- To wildcard a package use 0xFFFF for first two octets, choose 
--- is not allowed. To reference native property tag specified in 
--- Annex C, use 0x0000 as first two octets. 
--- To wildcard a Property, Event, Signal, or Statistics ID, use 
--- 0xFFFF for last two octets, choose is not allowed. 
--- Wildcarding of Package Name is permitted only if Property, 
--- Event, Signal, or Statistics ID are 
--- also wildcarded. 
-
-Relation ::= ENUMERATED 
- { 
-   greaterThan(0), 
-   smallerThan(1), 
-   unequalTo(2), 
-   ... 
- } 
-
-LocalRemoteDescriptor ::= SEQUENCE 
- { 
-   propGrps SEQUENCE OF PropertyGroup, 
-   ... 
- } 
-
-PropertyGroup ::= SEQUENCE OF PropertyParm 
-
-TerminationStateDescriptor ::= SEQUENCE  
- { 
-   propertyParms        SEQUENCE OF PropertyParm, 
-   eventBufferControl   EventBufferControl OPTIONAL, 
-   serviceState         ServiceState OPTIONAL, 
-   ... 
- } 
-
-EventBufferControl ::= ENUMERATED 
- { 
-   off(0), 
-   lockStep(1), 
-   ... 
- } 
-
-ServiceState ::= ENUMERATED 
- { 
-   test(0), 
-   outOfSvc(1), 
-   inSvc(2), 
-   ... 
- } 
-
-MuxDescriptor   ::= SEQUENCE 
- { 
-   muxType           MuxType, 
-   termList          SEQUENCE OF TerminationID, 
-   nonStandardData   NonStandardData OPTIONAL, 
-   ... 
- } 
-
-MuxType ::= ENUMERATED 
- { 
-   h221(0), 
-   h223(1), 
-   h226(2), 
-   v76(3), 
-   ..., 
-   nx64k(4) 
- } 
-
-StreamID ::= INTEGER(0..65535)   -- 16-bit unsigned integer 
-
-EventsDescriptor ::= SEQUENCE 
- { 
-   requestID      RequestID OPTIONAL, 
-   -- RequestID must be present if eventList 
-   -- is non empty 
-   eventList      SEQUENCE OF RequestedEvent, 
-   ... 
- } 
-
-RequestedEvent ::= SEQUENCE 
- { 
-   pkgdName       PkgdName, 
-   streamID       StreamID OPTIONAL, 
-   eventAction    RequestedActions OPTIONAL, 
-   evParList      SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-RegulatedEmbeddedDescriptor ::= SEQUENCE
- {
-   secondEvent		 SecondEventsDescriptor OPTIONAL,
-   signalsDescriptor	 SignalsDescriptor OPTIONAL,
-   ...
- }
-
-NotifyBehaviour ::= CHOICE
- {
-   notifyImmediate	 NULL,
-   notifyRegulated	 RegulatedEmbeddedDescriptor,
-   neverNotify		 NULL,
-   ...
- }
-
-RequestedActions ::= SEQUENCE 
- { 
-   keepActive            BOOLEAN OPTIONAL, 
-   eventDM               EventDM OPTIONAL, 
-   secondEvent           SecondEventsDescriptor OPTIONAL, 
-   signalsDescriptor     SignalsDescriptor OPTIONAL, 
-   ...,
-   notifyBehaviour       NotifyBehaviour OPTIONAL,
-   resetEventsDescriptor NULL OPTIONAL 
- } 
-
-EventDM ::= CHOICE 
- { 
-   digitMapName   DigitMapName, 
-   digitMapValue  DigitMapValue 
- } 
-
-SecondEventsDescriptor ::= SEQUENCE 
- { 
-   requestID         RequestID OPTIONAL, 
-   eventList         SEQUENCE OF SecondRequestedEvent, 
-   ... 
- } 
-
-SecondRequestedEvent ::= SEQUENCE 
- { 
-   pkgdName          PkgdName, 
-   streamID          StreamID OPTIONAL, 
-   eventAction       SecondRequestedActions OPTIONAL, 
-   evParList         SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-SecondRequestedActions ::= SEQUENCE 
- { 
-   keepActive            BOOLEAN OPTIONAL, 
-   eventDM               EventDM OPTIONAL, 
-   signalsDescriptor     SignalsDescriptor OPTIONAL, 
-   ...,
-   notifyBehaviour       NotifyBehaviour OPTIONAL,
-   resetEventsDescriptor NULL OPTIONAL 
- } 
-
-EventBufferDescriptor ::= SEQUENCE OF EventSpec 
-
-EventSpec ::= SEQUENCE 
- { 
-   eventName      EventName, 
-   streamID       StreamID OPTIONAL, 
-   eventParList   SEQUENCE OF EventParameter, 
-   ... 
- } 
-
-
-SignalsDescriptor ::= SEQUENCE OF SignalRequest 
-
-SignalRequest ::= CHOICE 
- { 
-   signal         Signal, 
-   seqSigList     SeqSigList, 
-   ... 
- } 
-
-SeqSigList ::= SEQUENCE 
- { 
-   id          INTEGER(0..65535), 
-   signalList  SEQUENCE OF Signal 
- } 
-
-Signal ::= SEQUENCE 
- { 
-   signalName        SignalName, 
-   streamID          StreamID OPTIONAL, 
-   sigType           SignalType OPTIONAL, 
-   duration          INTEGER (0..65535) OPTIONAL, 
-   notifyCompletion  NotifyCompletion OPTIONAL, 
-   keepActive        BOOLEAN OPTIONAL, 
-   sigParList        SEQUENCE OF SigParameter, 
-   ...,
-   direction         SignalDirection OPTIONAL,
-   requestID         RequestID OPTIONAL,
-   intersigDelay     INTEGER (0..65535) OPTIONAL 
- } 
-
-SignalType ::= ENUMERATED 
- { 
-   brief(0), 
-   onOff(1), 
-   timeOut(2), 
-   ... 
- } 
-
-SignalDirection ::= ENUMERATED
- {
-   internal(0),
-   external(1),
-   both(3),
-   ...
- }
-
-SignalName ::= PkgdName 
-
-NotifyCompletion ::= BIT STRING 
- { 
-   onTimeOut(0), onInterruptByEvent(1), 
-   onInterruptByNewSignalDescr(2), otherReason(3), onIteration(4)
- } 
-
-SigParameter ::= SEQUENCE 
- { 
-   sigParameterName     Name, 
-   value                Value, 
-   -- For use of extraInfo see the comment related to PropertyParm 
-   extraInfo CHOICE 
-    { 
-      relation Relation, 
-      range    BOOLEAN, 
-      sublist  BOOLEAN 
-    } OPTIONAL, 
-   ... 
- } 
-
--- For an AuditCapReply with all events, the RequestID SHALL be ALL. 
--- ALL is represented by 0xffffffff. 
-RequestID ::= INTEGER(0..4294967295)   -- 32-bit unsigned integer 
-
-ModemDescriptor ::= SEQUENCE 
- { 
-   mtl               SEQUENCE OF ModemType,  
-   mpl               SEQUENCE OF PropertyParm, 
-   nonStandardData   NonStandardData OPTIONAL 
- } 
-
-ModemType ::= ENUMERATED 
- { 
-   v18(0), 
-   v22(1), 
-   v22bis(2), 
-   v32(3), 
-   v32bis(4), 
-   v34(5), 
-   v90(6), 
-   v91(7), 
-   synchISDN(8), 
-   ... 
- } 
-
-DigitMapDescriptor ::= SEQUENCE 
- { 
-   digitMapName   DigitMapName OPTIONAL, 
-   digitMapValue  DigitMapValue OPTIONAL 
- } 
-
-DigitMapName ::= Name 
-
-DigitMapValue ::= SEQUENCE 
- { 
-   startTimer        INTEGER(0..99) OPTIONAL, 
-   shortTimer        INTEGER(0..99) OPTIONAL, 
-   longTimer         INTEGER(0..99) OPTIONAL, 
-   digitMapBody      IA5String, 
-   -- Units are seconds for start, short and long timers, and 
-   -- hundreds of milliseconds for duration timer. Thus start, 
-   -- short, and long range from 1 to 99 seconds and duration 
-   -- from 100 ms to 9.9 s 
-   -- See A.3 for explanation of digit map syntax 
-   ..., 
-   durationTimer     INTEGER (0..99) OPTIONAL 
- } 
-
-ServiceChangeParm ::= SEQUENCE 
- { 
-   serviceChangeMethod          ServiceChangeMethod, 
-   serviceChangeAddress         ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion         INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile         ServiceChangeProfile OPTIONAL, 
-   serviceChangeReason          Value, 
-   -- A serviceChangeReason consists of a numeric reason code 
-   -- and an optional text description. 
-   -- The serviceChangeReason SHALL be a string consisting of  
-   -- a decimal reason code, optionally followed by a single  
-   -- space character and a textual description string. 
-   -- This string is first BER-encoded as an IA5String. 
-   -- The result of this BER-encoding is then encoded as 
-   -- an ASN.1 OCTET STRING type, "double wrapping" the  
-   -- value 
-   -- as was done for package elements. 
-   serviceChangeDelay           INTEGER(0..4294967295) OPTIONAL, 
-   -- 32-bit unsigned integer 
-   serviceChangeMgcId           MId OPTIONAL, 
-   timeStamp                    TimeNotation OPTIONAL, 
-   nonStandardData              NonStandardData OPTIONAL, 
-   ..., 
-   serviceChangeInfo            AuditDescriptor OPTIONAL,
-   serviceChangeIncompleteFlag  NULL OPTIONAL 
- } 
-
-ServiceChangeAddress ::= CHOICE 
- { 
-   portNumber        INTEGER(0..65535),    -- TCP/UDP port number 
-   ip4Address        IP4Address, 
-   ip6Address        IP6Address, 
-   domainName        DomainName, 
-   deviceName        PathName, 
-   mtpAddress        OCTET STRING(SIZE(2..4)), 
-   ... 
- } 
-
-ServiceChangeResParm ::= SEQUENCE 
- { 
-   serviceChangeMgcId      MId OPTIONAL, 
-   serviceChangeAddress    ServiceChangeAddress OPTIONAL, 
-   serviceChangeVersion    INTEGER(0..99) OPTIONAL, 
-   serviceChangeProfile    ServiceChangeProfile OPTIONAL, 
-   timestamp               TimeNotation OPTIONAL, 
-   ... 
- } 
-
-ServiceChangeMethod ::= ENUMERATED 
- { 
-   failover(0), 
-   forced(1), 
-   graceful(2), 
-   restart(3), 
-   disconnected(4), 
-   handOff(5), 
-   ... 
- } 
-       
-ServiceChangeProfile ::= SEQUENCE 
- { 
-   profileName    IA5String(SIZE (1..67)) 
-   
-   -- 64 characters for name, 1 for "/", 2 for version to match ABNF 
- } 
-
-PackagesDescriptor ::= SEQUENCE OF PackagesItem
- 
-PackagesItem ::= SEQUENCE 
- { 
-   packageName       Name, 
-   packageVersion    INTEGER(0..99), 
-   ... 
- } 
-
-StatisticsDescriptor ::= SEQUENCE OF StatisticsParameter 
-
-StatisticsParameter ::= SEQUENCE 
- { 
-   statName       PkgdName, 
-   statValue      Value OPTIONAL 
- } 
-
--- If statistic consists of a sub-list there will be more than one
--- octetstring in statValue.
-
-NonStandardData ::= SEQUENCE 
- { 
-   nonStandardIdentifier   NonStandardIdentifier, 
-   data                    OCTET STRING 
- } 
-
-NonStandardIdentifier ::= CHOICE 
- { 
-   object            OBJECT IDENTIFIER, 
-   h221NonStandard   H221NonStandard, 
-   experimental      IA5String(SIZE(8)),  
-   -- first two characters SHOULD be "X-" or "X+" 
-   ... 
- } 
-
-H221NonStandard ::= SEQUENCE 
- {  t35CountryCode1      INTEGER(0..255), 
-    t35CountryCode2      INTEGER(0..255),      -- country, as per T.35 
-    t35Extension         INTEGER(0..255),      -- assigned nationally 
-    manufacturerCode     INTEGER(0..65535), -- assigned nationally 
-    ... 
- } 
-
-TimeNotation ::= SEQUENCE 
- { 
-   date     IA5String(SIZE(8)),  -- yyyymmdd format 
-   time     IA5String(SIZE(8))   -- hhmmssss format 
-   -- per ISO 8601:1988 
- } 
-
-Value ::= SEQUENCE OF OCTET STRING 
-
-END 
diff --git a/lib/megaco/src/binary/Makefile b/lib/megaco/src/binary/Makefile
index 7fc90fd6d5..9e33fe3ae5 100644
--- a/lib/megaco/src/binary/Makefile
+++ b/lib/megaco/src/binary/Makefile
@@ -47,53 +47,30 @@ include modules.mk
 
 ASN1_SPECS = $(ASN1_V1_SPEC) \
              $(ASN1_V2_SPEC) \
-             $(ASN1_V3_SPEC) \
-             $(ASN1_PREV3A_SPEC) $(ASN1_PREV3B_SPEC) $(ASN1_PREV3C_SPEC) 
+             $(ASN1_V3_SPEC)
 ASN1_FILES = $(ASN1_SPECS:%=%.asn)
 
-V1_SPECS = $(BER_ASN1_V1_SPEC)         \
+V1_SPECS = $(BER_ASN1_V1_SPEC) \
            $(PER_ASN1_V1_SPEC)
 
-V2_SPECS = $(BER_ASN1_V2_SPEC)         \
+V2_SPECS = $(BER_ASN1_V2_SPEC)  \
            $(PER_ASN1_V2_SPEC)
 
-PREV3A_SPECS = $(BER_ASN1_PREV3A_SPEC)         \
-               $(PER_ASN1_PREV3A_SPEC)
-
-PREV3B_SPECS = $(BER_ASN1_PREV3B_SPEC)         \
-               $(PER_ASN1_PREV3B_SPEC)
-
-PREV3C_SPECS = $(BER_ASN1_PREV3C_SPEC)         \
-               $(PER_ASN1_PREV3C_SPEC)
-
-V3_SPECS = $(BER_ASN1_V3_SPEC)         \
-           $(PER_ASN1_V3_SPEC)         \
-           $(PREV3A_SPECS) $(PREV3B_SPECS) $(PREV3C_SPECS)
+V3_SPECS = $(BER_ASN1_V3_SPEC)  \
+           $(PER_ASN1_V3_SPEC)
 
 SPECS = $(V1_SPECS) $(V2_SPECS) $(V3_SPECS)
 
 V1_SPEC_ASN1DB = $(V1_SPECS:%=%.asn1db)
 V2_SPEC_ASN1DB = $(V2_SPECS:%=%.asn1db)
-PREV3A_SPEC_ASN1DB = $(PREV3A_SPECS:%=%.asn1db)
-PREV3B_SPEC_ASN1DB = $(PREV3B_SPECS:%=%.asn1db)
-PREV3C_SPEC_ASN1DB = $(PREV3C_SPECS:%=%.asn1db)
-V3_SPEC_ASN1DB = $(V3_SPECS:%=%.asn1db) \
-                 $(PREV3A_SPEC_ASN1DB) \
-                 $(PREV3B_SPEC_ASN1DB) \
-                 $(PREV3C_SPEC_ASN1DB)
+V3_SPEC_ASN1DB = $(V3_SPECS:%=%.asn1db)
 SPEC_ASN1DB = $(V1_SPEC_ASN1DB) \
-              $(V2_SPEC_ASN1DB)\
+              $(V2_SPEC_ASN1DB) \
               $(V3_SPEC_ASN1DB)
 
 V1_SPEC_BINS = $(V1_SPECS:%=%.erl) $(V1_SPECS:%=%.hrl) 
 V2_SPEC_BINS = $(V2_SPECS:%=%.erl) $(V2_SPECS:%=%.hrl) 
-PREV3A_SPEC_BINS = $(PREV3A_SPECS:%=%.erl) $(PREV3A_SPECS:%=%.hrl) 
-PREV3B_SPEC_BINS = $(PREV3B_SPECS:%=%.erl) $(PREV3B_SPECS:%=%.hrl) 
-PREV3C_SPEC_BINS = $(PREV3C_SPECS:%=%.erl) $(PREV3C_SPECS:%=%.hrl) 
-V3_SPEC_BINS = $(V3_SPECS:%=%.erl) $(V3_SPECS:%=%.hrl) \
-               $(PREV3A_SPEC_BINS) \
-               $(PREV3B_SPEC_BINS) \
-               $(PREV3C_SPEC_BINS) 
+V3_SPEC_BINS = $(V3_SPECS:%=%.erl) $(V3_SPECS:%=%.hrl)
 SPEC_BINS    = $(V1_SPEC_BINS) $(V2_SPEC_BINS) $(V3_SPEC_BINS) 
 
 ERL_FILES = $(MODULES:%=%.erl)	
diff --git a/lib/megaco/src/binary/depend.mk b/lib/megaco/src/binary/depend.mk
index d831e5fe54..ca2872975c 100644
--- a/lib/megaco/src/binary/depend.mk
+++ b/lib/megaco/src/binary/depend.mk
@@ -37,19 +37,9 @@ endif
 
 BER_V1_FLAGS             = $(ASN1_CT_OPTS) +asn1config
 BER_V2_FLAGS             = $(ASN1_CT_OPTS) +asn1config
-# <DEPRECATED>
-BER_PREV3A_FLAGS         = $(ASN1_CT_OPTS) +asn1config
-BER_PREV3B_FLAGS         = $(ASN1_CT_OPTS) +asn1config
-BER_PREV3C_FLAGS         = $(ASN1_CT_OPTS) +asn1config
-# </DEPRECATED>
 BER_V3_FLAGS             = $(ASN1_CT_OPTS) +asn1config
 PER_V1_FLAGS             = $(ASN1_CT_OPTS)
 PER_V2_FLAGS             = $(ASN1_CT_OPTS)
-# <DEPRECATED>
-PER_PREV3A_FLAGS         = $(ASN1_CT_OPTS)
-PER_PREV3B_FLAGS         = $(ASN1_CT_OPTS)
-PER_PREV3C_FLAGS         = $(ASN1_CT_OPTS)
-# </DEPRECATED>
 PER_V3_FLAGS             = $(ASN1_CT_OPTS)
 
 
@@ -96,75 +86,6 @@ $(EBIN)/$(PER_ASN1_V2_SPEC).$(EMULATOR): \
 
 # --- Version 3 ---
 
-# -- (prev3a) --
-
-# <DEPRECATED>
-$(BER_ASN1_PREV3A_SPEC).erl: \
-	$(BER_ASN1_PREV3A_SPEC).set.asn \
-	$(ASN1_PREV3A_SPEC).asn
-	$(V_colon)@echo "$(BER_ASN1_PREV3A_SPEC):"
-	$(asn_verbose)$(ERLC) -bber $(BER_PREV3A_FLAGS) $(BER_ASN1_PREV3A_SPEC).set.asn
-
-$(EBIN)/$(BER_ASN1_PREV3A_SPEC).$(EMULATOR): \
-	$(BER_ASN1_PREV3A_SPEC).erl
-
-$(PER_ASN1_PREV3A_SPEC).erl: \
-	$(PER_ASN1_PREV3A_SPEC).set.asn \
-	$(ASN1_PREV3A_SPEC).asn
-	$(V_colon)@echo "$(PER_ASN1_PREV3A_SPEC):"
-	$(asn_verbose)$(ERLC) -bper $(PER_PREV3A_FLAGS) $(PER_ASN1_PREV3A_SPEC).set.asn
-
-$(EBIN)/$(PER_ASN1_PREV3A_SPEC).$(EMULATOR): \
-	$(PER_ASN1_PREV3A_SPEC).erl
-# </DEPRECATED>
-
-
-# -- (prev3b) --
-
-# <DEPRECATED>
-$(BER_ASN1_PREV3B_SPEC).erl: \
-	$(BER_ASN1_PREV3B_SPEC).set.asn \
-	$(ASN1_PREV3B_SPEC).asn
-	$(V_colon)@echo "$(BER_ASN1_PREV3B_SPEC):"
-	$(asn_verbose)$(ERLC) -bber $(BER_PREV3B_FLAGS) $(BER_ASN1_PREV3B_SPEC).set.asn
-
-$(EBIN)/$(BER_ASN1_PREV3B_SPEC).$(EMULATOR): \
-	$(BER_ASN1_PREV3B_SPEC).erl
-
-$(PER_ASN1_PREV3B_SPEC).erl: \
-	$(PER_ASN1_PREV3B_SPEC).set.asn \
-	$(ASN1_PREV3B_SPEC).asn
-	$(V_colon)@echo "$(PER_ASN1_PREV3B_SPEC):"
-	$(asn_verbose)$(ERLC) -bper $(PER_PREV3B_FLAGS) $(PER_ASN1_PREV3B_SPEC).set.asn
-
-$(EBIN)/$(PER_ASN1_PREV3B_SPEC).$(EMULATOR): \
-	$(PER_ASN1_PREV3B_SPEC).erl
-# </DEPRECATED>
-
-
-# -- (prev3c) --
-
-# <DEPRECATED>
-$(BER_ASN1_PREV3C_SPEC).erl: \
-	$(BER_ASN1_PREV3C_SPEC).set.asn \
-	$(ASN1_PREV3C_SPEC).asn
-	$(V_colon)@echo "$(BER_ASN1_PREV3C_SPEC):"
-	$(asn_verbose)$(ERLC) -bber $(BER_PREV3C_FLAGS) $(BER_ASN1_PREV3C_SPEC).set.asn
-
-$(EBIN)/$(BER_ASN1_PREV3C_SPEC).$(EMULATOR): \
-	$(BER_ASN1_PREV3C_SPEC).erl
-
-$(PER_ASN1_PREV3C_SPEC).erl: \
-	$(PER_ASN1_PREV3C_SPEC).set.asn \
-	$(ASN1_PREV3C_SPEC).asn
-	$(V_colon)@echo "$(PER_ASN1_PREV3C_SPEC):"
-	$(asn_verbose)$(ERLC) -bper $(PER_PREV3C_FLAGS) $(PER_ASN1_PREV3C_SPEC).set.asn
-
-$(EBIN)/$(PER_ASN1_PREV3C_SPEC).$(EMULATOR): \
-	$(PER_ASN1_PREV3C_SPEC).erl
-# </DEPRECATED>
-
-
 # -- (v3) --
 
 $(BER_ASN1_V3_SPEC).erl: \
@@ -208,20 +129,6 @@ $(EBIN)/megaco_binary_name_resolver_v2.$(EMULATOR): \
 	megaco_binary_name_resolver_v2.erl \
 	../app/megaco_internal.hrl
 
-# <DEPRECATED>
-$(EBIN)/megaco_binary_name_resolver_prev3a.$(EMULATOR): \
-	megaco_binary_name_resolver_prev3a.erl \
-	../app/megaco_internal.hrl
-
-$(EBIN)/megaco_binary_name_resolver_prev3b.$(EMULATOR): \
-	megaco_binary_name_resolver_prev3b.erl \
-	../app/megaco_internal.hrl
-
-$(EBIN)/megaco_binary_name_resolver_prev3c.$(EMULATOR): \
-	megaco_binary_name_resolver_prev3c.erl \
-	../app/megaco_internal.hrl
-# </DEPRECATED>
-
 $(EBIN)/megaco_binary_name_resolver_v3.$(EMULATOR): \
 	megaco_binary_name_resolver_v3.erl
 
@@ -241,26 +148,6 @@ $(EBIN)/megaco_binary_transformer_v2.$(EMULATOR): \
         $(MEGACO_INCLUDEDIR)/megaco.hrl \
         $(MEGACO_INCLUDEDIR)/megaco_message_v2.hrl
 
-# <DEPRECATED>
-$(EBIN)/megaco_binary_transformer_prev3a.$(EMULATOR): \
-	megaco_binary_transformer_prev3a.erl \
-	../app/megaco_internal.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco_message_prev3a.hrl
-
-$(EBIN)/megaco_binary_transformer_prev3b.$(EMULATOR): \
-	megaco_binary_transformer_prev3b.erl \
-	../app/megaco_internal.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco_message_prev3b.hrl
-
-$(EBIN)/megaco_binary_transformer_prev3c.$(EMULATOR): \
-	megaco_binary_transformer_prev3c.erl \
-	../app/megaco_internal.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco.hrl \
-        $(MEGACO_INCLUDEDIR)/megaco_message_prev3c.hrl
-# </DEPRECATED>
-
 $(EBIN)/megaco_binary_transformer_v3.$(EMULATOR): \
 	megaco_binary_transformer_v3.erl \
 	../app/megaco_internal.hrl \
diff --git a/lib/megaco/src/binary/megaco_ber_encoder.erl b/lib/megaco/src/binary/megaco_ber_encoder.erl
index 57f21f2a29..d4bdf14101 100644
--- a/lib/megaco/src/binary/megaco_ber_encoder.erl
+++ b/lib/megaco/src/binary/megaco_ber_encoder.erl
@@ -46,22 +46,10 @@
 -define(V2_ASN1_MOD,     megaco_ber_media_gateway_control_v2).
 -define(V3_ASN1_MOD,     megaco_ber_media_gateway_control_v3).
 
-%% <DEPRECATED>
--define(PREV3A_ASN1_MOD, megaco_ber_media_gateway_control_prev3a).
--define(PREV3B_ASN1_MOD, megaco_ber_media_gateway_control_prev3b).
--define(PREV3C_ASN1_MOD, megaco_ber_media_gateway_control_prev3c).
-%% </DEPRECATED>
-
 -define(V1_TRANS_MOD,     megaco_binary_transformer_v1).
 -define(V2_TRANS_MOD,     megaco_binary_transformer_v2).
 -define(V3_TRANS_MOD,     megaco_binary_transformer_v3).
 
-%% <DEPRECATED>
--define(PREV3A_TRANS_MOD, megaco_binary_transformer_prev3a).
--define(PREV3B_TRANS_MOD, megaco_binary_transformer_prev3b).
--define(PREV3C_TRANS_MOD, megaco_binary_transformer_prev3c).
-%% </DEPRECATED>
-
 -define(BIN_LIB, megaco_binary_encoder_lib).
 
 
@@ -70,18 +58,6 @@
 %% Return {ok, Version} | {error, Reason}
 %%----------------------------------------------------------------------
 
-%% <DEPRECATED>
-version_of([{version3,prev3c}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3C_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-version_of([{version3,prev3b}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3B_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-version_of([{version3,prev3a}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3A_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-%% <DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 version_of([{version3,v3}|EC], Binary) ->
     Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?V3_ASN1_MOD],
@@ -135,21 +111,6 @@ encode_message(EC, 2, MegaMsg) ->
 
 %% -- Version 3 --
 
-%% <DEPRECATED>
-encode_message([{version3,prev3c}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3C_ASN1_MOD, 
-    TransMod = ?PREV3C_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3b}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3B_ASN1_MOD, 
-    TransMod = ?PREV3B_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3a}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3A_ASN1_MOD, 
-    TransMod = ?PREV3A_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_message([{version3,v3}|EC], 3, MegaMsg) ->
     AsnMod   = ?V3_ASN1_MOD, 
@@ -298,21 +259,6 @@ decode_message(EC, 2, Binary) ->
 
 %% -- Version 3 --
 
-%% <DEPRECATED>
-decode_message([{version3,prev3c}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3C_ASN1_MOD, 
-    TransMod = ?PREV3C_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-decode_message([{version3,prev3b}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3B_ASN1_MOD, 
-    TransMod = ?PREV3B_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-decode_message([{version3,prev3a}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3A_ASN1_MOD, 
-    TransMod = ?PREV3A_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_message([{version3,v3}|EC], 3, Binary) ->
     AsnMod   = ?V3_ASN1_MOD, 
@@ -326,24 +272,6 @@ decode_message(EC, 3, Binary) ->
     ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary).
 
 
-%% <DEPRECATED>
-decode_mini_message([{version3,prev3c}|EC], dynamic, Bin) ->
-    Mods = [?V1_ASN1_MOD, 
-	    ?V2_ASN1_MOD, 
-	    ?PREV3C_ASN1_MOD], 
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-decode_mini_message([{version3,prev3b}|EC], dynamic, Bin) ->
-    Mods = [?V1_ASN1_MOD, 
-	    ?V2_ASN1_MOD, 
-	    ?PREV3B_ASN1_MOD], 
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-decode_mini_message([{version3,prev3a}|EC], dynamic, Bin) ->
-    Mods = [?V1_ASN1_MOD, 
-	    ?V2_ASN1_MOD, 
-	    ?PREV3A_ASN1_MOD], 
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_mini_message([{version3,v3}|EC], dynamic, Bin) ->
     Mods = [?V1_ASN1_MOD, 
@@ -378,19 +306,6 @@ decode_mini_message(EC, 2, Bin) ->
     AsnMod = ?V2_ASN1_MOD, 
     ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
 
-%% <DEPRECATED>
-decode_mini_message([{version3,prev3c}|EC], 3, Bin) ->
-    AsnMod = ?PREV3C_ASN1_MOD, 
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-decode_mini_message([{version3,prev3b}|EC], 3, Bin) ->
-    AsnMod = ?PREV3B_ASN1_MOD, 
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-decode_mini_message([{version3,prev3a}|EC], 3, Bin) ->
-    AsnMod = ?PREV3A_ASN1_MOD, 
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-%% </DEPRECATED>
-
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_mini_message([{version3,v3}|EC], 3, Bin) ->
     AsnMod = ?V3_ASN1_MOD, 
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.asn1config b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.asn1config
deleted file mode 100644
index da67561f1b..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.asn1config
+++ /dev/null
@@ -1,43 +0,0 @@
-{exclusive_decode,
- {'megaco_ber_media_gateway_control_prev3a',
-  [
-   {decode_message_trans_partial,
-    [
-     'MegacoMessage',[{mess,[{messageBody,[{transactions,parts}]}]}]
-    ]
-   },
-   {decode_message_acts_partial,
-    ['Transaction',
-     [
-      {transactionRequest,
-       [
-        {actions,parts}
-       ]
-      },
-      {transactionReply,
-       [
-        {transactionResult, [{actionReplies,parts}]}
-       ]
-      }
-     ]
-    ]
-   },
-   {decode_message_version,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{mId,undecoded},{messageBody,undecoded}]}
-     ]
-    ]
-   },
-   {decode_message_mId,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{messageBody,undecoded}]}
-     ]
-    ]
-   }
-  ]
- }
-}.
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.set.asn b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.set.asn
deleted file mode 100644
index b9ba7ffdb4..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3a.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3a.asn
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.asn1config b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.asn1config
deleted file mode 100644
index 2f25f03d97..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.asn1config
+++ /dev/null
@@ -1,43 +0,0 @@
-{exclusive_decode,
- {'megaco_ber_media_gateway_control_prev3b',
-  [
-   {decode_message_trans_partial,
-    [
-     'MegacoMessage',[{mess,[{messageBody,[{transactions,parts}]}]}]
-    ]
-   },
-   {decode_message_acts_partial,
-    ['Transaction',
-     [
-      {transactionRequest,
-       [
-        {actions,parts}
-       ]
-      },
-      {transactionReply,
-       [
-        {transactionResult, [{actionReplies,parts}]}
-       ]
-      }
-     ]
-    ]
-   },
-   {decode_message_version,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{mId,undecoded},{messageBody,undecoded}]}
-     ]
-    ]
-   },
-   {decode_message_mId,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{messageBody,undecoded}]}
-     ]
-    ]
-   }
-  ]
- }
-}.
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.set.asn b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.set.asn
deleted file mode 100644
index 0437bde310..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3b.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3b.asn
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.asn1config b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.asn1config
deleted file mode 100644
index 23c343eed0..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.asn1config
+++ /dev/null
@@ -1,43 +0,0 @@
-{exclusive_decode,
- {'megaco_ber_media_gateway_control_prev3c',
-  [
-   {decode_message_trans_partial,
-    [
-     'MegacoMessage',[{mess,[{messageBody,[{transactions,parts}]}]}]
-    ]
-   },
-   {decode_message_acts_partial,
-    ['Transaction',
-     [
-      {transactionRequest,
-       [
-        {actions,parts}
-       ]
-      },
-      {transactionReply,
-       [
-        {transactionResult, [{actionReplies,parts}]}
-       ]
-      }
-     ]
-    ]
-   },
-   {decode_message_version,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{mId,undecoded},{messageBody,undecoded}]}
-     ]
-    ]
-   },
-   {decode_message_mId,
-    ['MegacoMessage',
-     [
-      {authHeader,undecoded},
-      {mess,[{messageBody,undecoded}]}
-     ]
-    ]
-   }
-  ]
- }
-}.
diff --git a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.set.asn b/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.set.asn
deleted file mode 100644
index e78055fbad..0000000000
--- a/lib/megaco/src/binary/megaco_ber_media_gateway_control_prev3c.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3c.asn
diff --git a/lib/megaco/src/binary/megaco_binary_encoder.erl b/lib/megaco/src/binary/megaco_binary_encoder.erl
index 40ee11c59d..af82541175 100644
--- a/lib/megaco/src/binary/megaco_binary_encoder.erl
+++ b/lib/megaco/src/binary/megaco_binary_encoder.erl
@@ -79,21 +79,6 @@ encode_message(EC, 2, MegaMsg) ->
     TransMod = megaco_binary_transformer_v2,
     ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
 
-%% <DEPRECATED>
-encode_message([{version3,prev3c}|EC], 3, MegaMsg) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3c,
-    TransMod = megaco_binary_transformer_prev3c,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3b}|EC], 3, MegaMsg) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3b,
-    TransMod = megaco_binary_transformer_prev3b,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3a}|EC], 3, MegaMsg) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3a,
-    TransMod = megaco_binary_transformer_prev3a,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_message([{version3,v3}|EC], 3, MegaMsg) ->
     AsnMod   = megaco_ber_media_gateway_control_v3,
@@ -137,21 +122,6 @@ encode_transaction(EC, 2, Trans) ->
     TransMod = megaco_binary_transformer_v2,
     ?BIN_LIB:encode_transaction(EC, Trans, AsnMod, TransMod, io_list);
 
-%% <DEPRECATED>
-encode_transaction([{version3,prev3c}|EC], 3, Trans) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3c,
-    TransMod = megaco_binary_transformer_prev3c,
-    ?BIN_LIB:encode_transaction(EC, Trans, AsnMod, TransMod, io_list);
-encode_transaction([{version3,prev3b}|EC], 3, Trans) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3b,
-    TransMod = megaco_binary_transformer_prev3b,
-    ?BIN_LIB:encode_transaction(EC, Trans, AsnMod, TransMod, io_list);
-encode_transaction([{version3,prev3a}|EC], 3, Trans) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3a,
-    TransMod = megaco_binary_transformer_prev3a,
-    ?BIN_LIB:encode_transaction(EC, Trans, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_transaction([{version3,v3}|EC], 3, Trans) ->
     AsnMod   = megaco_ber_media_gateway_control_v3,
@@ -196,24 +166,6 @@ encode_action_requests(EC, 2, ActReqs) when is_list(ActReqs) ->
     TransMod = megaco_binary_transformer_v2,
     ?BIN_LIB:encode_action_requests(EC, ActReqs, AsnMod, TransMod, io_list);
 
-%% <DEPRECATED>
-encode_action_requests([{version3,prev3c}|EC], 3, ActReqs) 
-  when is_list(ActReqs) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3c,
-    TransMod = megaco_binary_transformer_prev3c,
-    ?BIN_LIB:encode_action_requests(EC, ActReqs, AsnMod, TransMod, io_list);
-encode_action_requests([{version3,prev3b}|EC], 3, ActReqs) 
-  when is_list(ActReqs) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3b,
-    TransMod = megaco_binary_transformer_prev3b,
-    ?BIN_LIB:encode_action_requests(EC, ActReqs, AsnMod, TransMod, io_list);
-encode_action_requests([{version3,prev3a}|EC], 3, ActReqs) 
-  when is_list(ActReqs) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3a,
-    TransMod = megaco_binary_transformer_prev3a,
-    ?BIN_LIB:encode_action_requests(EC, ActReqs, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_action_requests([{version3,v3}|EC], 3, ActReqs) 
   when is_list(ActReqs) ->
@@ -257,21 +209,6 @@ encode_action_request(EC, 2, ActReq) ->
     TransMod = megaco_binary_transformer_v2,
     ?BIN_LIB:encode_action_request(EC, ActReq, AsnMod, TransMod, io_list);
 
-%% <DEPRECATED>
-encode_action_request([{version3,prev3c}|EC], 3, ActReq) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3c,
-    TransMod = megaco_binary_transformer_prev3c,
-    ?BIN_LIB:encode_action_request(EC, ActReq, AsnMod, TransMod, io_list);
-encode_action_request([{version3,prev3b}|EC], 3, ActReq) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3b,
-    TransMod = megaco_binary_transformer_prev3b,
-    ?BIN_LIB:encode_action_request(EC, ActReq, AsnMod, TransMod, io_list);
-encode_action_request([{version3,prev3a}|EC], 3, ActReq) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3a,
-    TransMod = megaco_binary_transformer_prev3a,
-    ?BIN_LIB:encode_action_request(EC, ActReq, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_action_request([{version3,v3}|EC], 3, ActReq) ->
     AsnMod   = megaco_ber_media_gateway_control_v3,
@@ -300,24 +237,6 @@ encode_action_reply(_EC, _V, _AcionReply) ->
 %% Return {ok, Version} | {error, Reason}
 %%----------------------------------------------------------------------
 
-%% <DEPRECATED>
-version_of([{version3,prev3c}|EC], Binary) ->
-    Decoders = [megaco_ber_media_gateway_control_v1,
-		megaco_ber_media_gateway_control_v2,
-		megaco_ber_media_gateway_control_prev3c],
-    ?BIN_LIB:version_of(EC, Binary, dynamic, Decoders);
-version_of([{version3,prev3b}|EC], Binary) ->
-    Decoders = [megaco_ber_media_gateway_control_v1,
-		megaco_ber_media_gateway_control_v2,
-		megaco_ber_media_gateway_control_prev3b],
-    ?BIN_LIB:version_of(EC, Binary, dynamic, Decoders);
-version_of([{version3,prev3a}|EC], Binary) ->
-    Decoders = [megaco_ber_media_gateway_control_v1,
-		megaco_ber_media_gateway_control_v2,
-		megaco_ber_media_gateway_control_prev3a],
-    ?BIN_LIB:version_of(EC, Binary, dynamic, Decoders);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 version_of([{version3,v3}|EC], Binary) ->
     Decoders = [megaco_ber_media_gateway_control_v1,
@@ -341,33 +260,6 @@ version_of(EC, Binary) ->
 decode_message(EC, Binary) ->
     decode_message(EC, 1, Binary).
 
-%% <DEPRECATED>
-decode_message([{version3,prev3c}|EC], dynamic, Binary) ->
-    Decoders = [{megaco_ber_media_gateway_control_v1,
-		 megaco_binary_transformer_v1},
-		{megaco_ber_media_gateway_control_v2,
-		 megaco_binary_transformer_v2},
-		{megaco_ber_media_gateway_control_prev3c,
-		 megaco_binary_transformer_prev3c}],
-    ?BIN_LIB:decode_message_dynamic(EC, Binary, Decoders, binary);
-decode_message([{version3,prev3b}|EC], dynamic, Binary) ->
-    Decoders = [{megaco_ber_media_gateway_control_v1,
-		 megaco_binary_transformer_v1},
-		{megaco_ber_media_gateway_control_v2,
-		 megaco_binary_transformer_v2},
-		{megaco_ber_media_gateway_control_prev3b,
-		 megaco_binary_transformer_prev3b}],
-    ?BIN_LIB:decode_message_dynamic(EC, Binary, Decoders, binary);
-decode_message([{version3,prev3a}|EC], dynamic, Binary) ->
-    Decoders = [{megaco_ber_media_gateway_control_v1,
-		 megaco_binary_transformer_v1},
-		{megaco_ber_media_gateway_control_v2,
-		 megaco_binary_transformer_v2},
-		{megaco_ber_media_gateway_control_prev3a,
-		 megaco_binary_transformer_prev3a}],
-    ?BIN_LIB:decode_message_dynamic(EC, Binary, Decoders, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_message([{version3,v3}|EC], dynamic, Binary) ->
     Decoders = [{megaco_ber_media_gateway_control_v1,
@@ -421,21 +313,6 @@ decode_message(EC, 2, Binary) ->
 
 %% -- Version 3 --
  
-%% <DEPRECATED>
-decode_message([{version3,prev3c}|EC], 3, Binary) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3c,
-    TransMod = megaco_binary_transformer_prev3c,
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-decode_message([{version3,prev3b}|EC], 3, Binary) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3b,
-    TransMod = megaco_binary_transformer_prev3b,
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-decode_message([{version3,prev3a}|EC], 3, Binary) ->
-    AsnMod   = megaco_ber_media_gateway_control_prev3a,
-    TransMod = megaco_binary_transformer_prev3a,
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_message([{version3,v3}|EC], 3, Binary) ->
     AsnMod   = megaco_ber_media_gateway_control_v3,
@@ -449,24 +326,6 @@ decode_message(EC, 3, Binary) ->
     ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, binary).
 
 
-%% <DEPRECATED>
-decode_mini_message([{version3,prev3c}|EC], dynamic, Bin) ->
-    Mods = [megaco_ber_media_gateway_control_v1,
-	    megaco_ber_media_gateway_control_v2,
-	    megaco_ber_media_gateway_control_prev3c],
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-decode_mini_message([{version3,prev3b}|EC], dynamic, Bin) ->
-    Mods = [megaco_ber_media_gateway_control_v1,
-	    megaco_ber_media_gateway_control_v2,
-	    megaco_ber_media_gateway_control_prev3b],
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-decode_mini_message([{version3,prev3a}|EC], dynamic, Bin) ->
-    Mods = [megaco_ber_media_gateway_control_v1,
-	    megaco_ber_media_gateway_control_v2,
-	    megaco_ber_media_gateway_control_prev3a],
-    ?BIN_LIB:decode_mini_message_dynamic(EC, Bin, Mods, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_mini_message([{version3,v3}|EC], dynamic, Bin) ->
     Mods = [megaco_ber_media_gateway_control_v1,
@@ -501,18 +360,6 @@ decode_mini_message(EC, 2, Bin) ->
     AsnMod = megaco_ber_media_gateway_control_v2,
     ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
 
-%% <DEPRECATED>
-decode_mini_message([{version3,prev3c}|EC], 3, Bin) ->
-    AsnMod = megaco_ber_media_gateway_control_prev3c,
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-decode_mini_message([{version3,prev3b}|EC], 3, Bin) ->
-    AsnMod = megaco_ber_media_gateway_control_prev3b,
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-decode_mini_message([{version3,prev3a}|EC], 3, Bin) ->
-    AsnMod = megaco_ber_media_gateway_control_prev3a,
-    ?BIN_LIB:decode_mini_message(EC, Bin, AsnMod, binary);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_mini_message([{version3,v3}|EC], 3, Bin) ->
     AsnMod = megaco_ber_media_gateway_control_v3,
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
deleted file mode 100644
index d8440c6bc8..0000000000
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3a.erl
+++ /dev/null
@@ -1,2009 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2004-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Handle meta data about packages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_name_resolver_prev3a).
-
--include_lib("megaco/src/engine/megaco_message_internal.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
-
--define(LOWER(Char),
-	if
-	    Char >= $A, Char =< $Z ->
-		Char - ($A - $a);
-	    true ->
-		Char
-	end).
-
--export([packages/0,
-	 capabilities/0,
-	 capabilities/1,
-         decode_name/3,
-	 encode_name/3
-        ]).
-
-encode_name(Config, term_id, TermId) ->
-    case megaco:encode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, _Reason} ->
-	    exit({bad_term_id, TermId})
-    end;	
-encode_name(_Config, Scope, Item) ->
-    ?d("encode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    encode(Scope, Item).
-
-decode_name(Config, term_id, TermId) ->
-    case megaco:decode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, _Reason} ->
-	    exit({bad_term_id, TermId})
-    end;
-decode_name(_Config, Scope, Item) ->
-    ?d("decode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    decode(Scope, Item).
-
-
-
-%%----------------------------------------------------------------------
-%% 12.1.1	Package
-%% 
-%% Overall description of the package, specifying:
-%% 
-%% 	Package Name: only descriptive
-%% 
-%% 	PackageID: is an identifier
-%% 
-%% 	Description: is a description of the package
-%% 
-%% 	Version: 
-%% 
-%%            A new version of a package can only add additional Properties, 
-%%            Events, Signals, Statistics and new possible values for an 
-%%            existing parameter described in the original package. No 
-%%            deletions or modifications shall be allowed. A version is an 
-%%            integer in the range from 1 to 99.
-%% 
-%% 	Designed to be extended only (Optional): Yes
-%%             
-%%            This indicates that the package has been expressly designed to 
-%%            be extended by others, not to be directly referenced. For 
-%%            example, the package may not have any function on its own or be 
-%%            nonsensical on its own. The MG SHOULD NOT publish this PackageID 
-%%            when reporting packages.
-%% 
-%% 	Extends: existing package Descriptor
-%% 
-%%            A package may extend an existing package. The version of the 
-%%            original package must be specified. When a package extends 
-%%            another package it shall only add additional Properties, Events, 
-%%            Signals, Statistics and new possible values for an existing 
-%%            parameter described in the original package. An extended package 
-%%            shall not redefine or overload an identifier defined in the 
-%%            original package and packages it may have extended (multiple 
-%%            levels of extension). Hence, if package B version 1 extends 
-%%            package A version 1, version 2 of B will not be able to extend 
-%%            the A version 2 if A version 2 defines a name already in B 
-%%            version 1. If the package does not extend another package, it 
-%%            shall specify "none".
-%% 
-%% 
-%% 12.1.2	Properties
-%% 
-%% Properties defined by the package, specifying:
-%% 
-%% 	Property Name: only descriptive
-%% 
-%% 	PropertyID: is an identifier
-%% 
-%% 	Description: is a description of the function of the property
-%% 
-%% 	Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified. 
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). For 
-%%                      example, Type: sub-list of enumeration. The encoding 
-%%                      of sub-lists is specified in Annexes A and B.3.
-%% 
-%% 	Possible values:
-%% 
-%%            A package MUST specify either a specific set of values or a 
-%%            description of how values are determined. A package MUST also 
-%%            specify a default value or the default behaviour when the value 
-%%            is omitted from its descriptor. For example, a package may 
-%%            specify that procedures related to the property are suspended 
-%%            when its value is omitted.
-%% 
-%% 	Default:
-%% 
-%%            A default value (but not procedures) may be specified as 
-%%            provisionable.
-%% 
-%% 	Defined in:
-%% 
-%%            Which H.248.1 descriptor the property is defined in. 
-%%            LocalControl is for stream-dependent properties. 
-%%            TerminationState is for stream-independent properties. 
-%%            ContextAttribute is for properties that affect the context as 
-%%            a whole, i.e., mixing properties. These are expected to be the 
-%%            most common cases, but it is possible for properties to be 
-%%            defined in other descriptors. Context properties MUST be defined 
-%%            in the ContextAttribute descriptor.
-%% 
-%% 	Characteristics: Read/Write or both, and (optionally), global: 
-%% 
-%%            Indicates whether a property is read-only, or read-write, and 
-%%            if it is global. If Global is omitted, the property is not 
-%%            global. If a property is declared as global, the value of the 
-%%            property is shared by all Terminations realizing the package.  
-%%            If a context property is declared as global, the property is 
-%%            shared by all contexts realizing the package.
-%% 
-%% 
-%% 12.1.3	Events
-%% 
-%% Events defined by the package, specifying:
-%% 
-%% 	Event name: only descriptive
-%% 
-%% 	EventID: is an identifier
-%% 
-%% 	Description: a description of the function of the event
-%% 
-%% 	EventsDescriptor Parameters: 
-%% 
-%%            Parameters used by the MGC to configure the event, and found in 
-%%            the EventsDescriptor. See 12.2. If there are no parameters for 
-%%            the Events Descriptor, then "none" shall be specified.
-%% 
-%% 	ObservedEventsDescriptor Parameters: 
-%% 
-%%            Parameters returned to the MGC in Notify requests and in replies 
-%%            to command requests from the MGC that audit 
-%%            ObservedEventsDescriptor, and found in the 
-%%            ObservedEventsDescriptor. See 12.2. If there are no parameters 
-%%            for the ObservedEvents Descriptor, then 'none' shall be specified.
-%% 
-%% 
-%% 12.1.4	Signals
-%% 
-%% Signals defined by the package, specifying:
-%% 
-%% 	Signal Name: only descriptive
-%% 
-%% 	SignalID: is an identifier. SignalID is used in a SignalsDescriptor
-%% 
-%% 	Description: a description of the function of the signal
-%% 
-%% 	SignalType: one of:
-%% 
-%%            OO (On/Off) 
-%% 
-%%            TO (TimeOut)
-%% 
-%%            BR (Brief)
-%% 
-%% 	   NOTE - SignalType may be defined such that it is dependent on
-%%            the value of one or more parameters. The package MUST specify a 
-%%            default signal type. If the default type is TO, the package MUST 
-%%            specify a default duration which may be provisioned. A default 
-%%            duration is meaningless for BR. 
-%% 
-%% 	Duration: in hundredths of seconds
-%% 
-%% 	Additional Parameters: see 12.2
-%% 
-%% 
-%% 12.1.5	Statistics
-%% 
-%% Statistics defined by the package, specifying:
-%% 
-%% 	Statistic name: only descriptive
-%% 
-%% 	StatisticID: is an identifier
-%% 
-%% 	StatisticID is used in a StatisticsDescriptor
-%% 
-%% 	Description: a description of the statistic
-%% 
-%% 	Type: One of:
-%% 
-%% 	   Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets.  
-%%                          See Annex A and Annex B.3 for encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: One of a list of possible unique values (See 12.3)
-%% 
-%%            Sub-list: A list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified.  
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). 
-%%                      For example, Type: sub-list of enumeration.  
-%%                      The encoding of sub-lists is specified in Annexes A 
-%%                      and B.3.
-%% 
-%% 	Possible Values:
-%% 
-%%            A package must indicate the unit of measure, e.g. milliseconds, 
-%%            packets, either here or along with the type above, as well as 
-%%            indicating any restriction on the range.
-%% 
-%% 	Level: Specify if the statistic can be kept at the Termination 
-%%                level, Stream level or Either.
-%% 
-%% 
-%% 12.1.6	Error Codes
-%% 
-%% If the package does not define any error codes, this section may be omitted.  
-%% Otherwise, it describes error codes defined by the package, specifying:
-%% 
-%% 	Error Code #: The error code number.
-%% 
-%% 	Name: Name of the error
-%% 
-%% 	Definition: A description of the error code.
-%% 
-%% 	Error Text in the Error Descriptor:
-%% 
-%%            A description of what text to return in the Error Descriptor.
-%% 
-%% 	Comment: Any further comments on the use of the error code.
-%% 
-%% 
-%% 12.1.7	Procedures
-%% 
-%% Additional guidance on the use of the package.
-%% 
-%% 
-%% 12.2	Guidelines to defining parameters to events and signals
-%% 
-%%         Parameter Name: only descriptive
-%% 
-%%         ParameterID: is an identifier. The textual ParameterID of 
-%%         parameters to Events and Signals shall not start with "EPA" and 
-%%         "SPA", respectively. The textual ParameterID shall also not be 
-%%         "ST", "Stream", "SY", "SignalType", "DR", "Duration", "NC", 
-%%         "NotifyCompletion", "KA", "KeepActive", "EB", "Embed", "DM", 
-%%         "DigitMap", "DI", "Direction", "RQ" or "RequestID".
-%% 
-%%         Description: a description of the function of the parameter.
-%% 
-%%         Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 octet string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4-octet signed integer
-%% 
-%%            Double: 8-octet signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. Could be 
-%%                       more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list (not supported 
-%%                      for statistics). The type of sub-list SHALL also be 
-%%                      specified The type shall be chosen from the types 
-%%                      specified in this section (with the exception of 
-%%                      sub-list). For example, Type: sub-list of enumeration. 
-%%                      The encoding of sub-lists is specified in Annex A 
-%%                      and B.3.
-%% 
-%%            Optional: Yes/No
-%% 
-%%               Describes if the parameter may be omitted from the signal or 
-%%               event.
-%% 
-%%            Possible values:
-%% 
-%%               A package MUST specify either a specific set of values or a 
-%%               description of how values are determined. A package MUST 
-%%               also specify a default value or the default behavior when the 
-%%               value is omitted from its descriptor. For example, a package 
-%%               may specify that procedures related to the parameter are 
-%%               suspended when its value is omitted.
-%% 
-%%            Default:
-%% 
-%%               A default value (but not procedures) may be specified as 
-%%               provisionable.
-%% 
-%% 
-%% 12.3	Lists
-%% 
-%% Possible values for parameters include enumerations. Enumerations may be 
-%% defined in a list. It is recommended that the list be IANA registered so 
-%% that packages that extend the list can be defined without concern for 
-%% conflicting names.
-%% 
-%% 
-%% 12.4	Identifiers
-%% 
-%% Identifiers in text encoding shall be strings of up to 64 characters, 
-%% containing no spaces, starting with an alphabetic character and consisting 
-%% of alphanumeric characters and/or digits, and possibly including the 
-%% special character underscore ("_").
-%% 
-%% Identifiers in binary encoding are 2 octets long.
-%% 
-%% Both text and binary values shall be specified for each identifier, 
-%% including identifiers used as values in enumerated types.
-%% 
-%% 
-%% 12.5	Package registration
-%% 
-%% A package can be registered with IANA for interoperability reasons. See 
-%% clause 14 for IANA considerations.
-%% 
-%%----------------------------------------------------------------------
-
-capabilities() ->
-    [{P, capabilities(P)} || P <- packages()].
-
-%% -record(property, {name, type, values, defined_in, characteristics}).
-
-%%----------------------------------------------------------------------
-%% List all known packages
-%% 'native' and 'all' are not real packages
-%%----------------------------------------------------------------------
-
-packages() ->
-    [
-     "g",        % Generic
-     "root",	 % Base Root Package
-     "tonegen",	 % Tone Generator Package
-     "tonedet",	 % Tone Detection Package
-     "dg",	 % Basic DTMF Generator Package
-     "dd",	 % DTMF detection Package
-     "cg",	 % Call Progress Tones Generator Package
-     "cd",	 % Call Progress Tones Detection Package
-     "al",	 % Analog Line Supervision Package
-     "ct",	 % Basic Continuity Package
-     "nt",	 % Network Package
-     "rtp",	 % RTP Package
-     "swb",	 % SwitchBoard Package
-     "tdmc",     % TDM Circuit Package
-     ""          % Native pseudo package
-    ].
-
-%%----------------------------------------------------------------------
-%% List all matching capabilities
-%%----------------------------------------------------------------------
-
-capabilities(Package) ->
-    case Package of
-        "g"       -> capabilities_g();
-        "root"    -> capabilities_root();
-        "tonegen" -> capabilities_tonegen();
-        "tonedet" -> capabilities_tonedet();
-        "dg"      -> capabilities_dg();
-        "dd"      -> capabilities_dd();
-        "cg"      -> capabilities_cg();
-        "cd"      -> capabilities_cd();
-        "al"      -> capabilities_al();
-        "ct"      -> capabilities_ct();
-        "nt"      -> capabilities_nt();
-        "rtp"     -> capabilities_rtp();
-	"swb"     -> capabilities_swb();
-        "tdmc"    -> capabilities_tdmc();
-        ""        -> capabilities_native()
-    end.
-
-%%----------------------------------------------------------------------
-%% Decode package name to internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-decode(mid, Package) ->
-    decode_mid(Package);
-decode(package, Package) ->
-    decode_package(Package);
-decode(profile, Package) ->
-    decode_profile(Package);
-decode(dialplan, Dialplan) ->
-    decode_dialplan(Dialplan);
-decode(Scope, [A, B | Item]) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:    ~p"
-       "~n   B:    ~p"
-       "~n   Item: ~p", [Scope, A, B, Item]),
-    case decode_package([A, B]) of
-	"" ->
- 	    ?d("decode -> \"no\" package",[]),
-	    decode_item(Scope, [A, B], Item);
-	Package ->
- 	    ?d("decode -> Package: ~p", [Package]),
-	    Package ++ "/" ++ decode_item(Scope, [A, B], Item)
-    end;
-decode({Scope, [A, B | Item]}, SubItem) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:       ~p"
-       "~n   B:       ~p"
-       "~n   Item:    ~p"
-       "~n   SubItem: ~p", [Scope, A, B, Item, SubItem]),
-    decode_item({Scope, Item}, [A, B], SubItem).
-
-decode_item(Scope, [A, B], Item) ->
-    ?d("decode_item -> entry",[]),
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> decode_g(Scope, Item);
-                16#02 -> decode_root(Scope, Item);
-                16#03 -> decode_tonegen(Scope, Item);
-                16#04 -> decode_tonedet(Scope, Item);
-                16#05 -> decode_dg(Scope, Item);
-                16#06 -> decode_dd(Scope, Item);
-                16#07 -> decode_cg(Scope, Item);
-                16#08 -> decode_cd(Scope, Item);
-                16#09 -> decode_al(Scope, Item);
-                16#0a -> decode_ct(Scope, Item);
-                16#0b -> decode_nt(Scope, Item);
-                16#0c -> decode_rtp(Scope, Item);
-                16#0d -> decode_tdmc(Scope, Item);
-                16#00 -> decode_native(Scope, Item)
-            end;
-        16#fe ->
-            case B of
-                %% Proprietary extension
-                16#fe -> decode_swb(Scope, Item)
-            end;
-        16#ff ->
-            case B of
-                16#ff when Item =:= [16#ff, 16#ff] -> "*"
-            end
-    end.
-
-decode_package(Package) ->
-    ?d("decode_package -> entry with"
-       "~n   Package: ~p", [Package]),
-    [A, B] = Package,
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> "g";
-                16#02 -> "root";
-                16#03 -> "tonegen";
-                16#04 -> "tonedet";
-                16#05 -> "dg";
-                16#06 -> "dd";
-                16#07 -> "cg";
-                16#08 -> "cd";
-                16#09 -> "al";
-                16#0a -> "ct";
-                16#0b -> "nt";
-                16#0c -> "rtp";
-                16#0d -> "tdmc";
-                16#00 -> ""
-            end;
-        16#fe ->
-            case B of
-                16#fe ->  "swb"
-            end;
-        16#ff ->
-            case B of
-                16#ff -> "*"
-            end
-    end.
-
-decode_profile([A, B]) ->
-    case A of
-        16#00 -> 
-            case B of
-                16#fe -> "resgw";
-		_     -> "profile" ++ [A + $0, B + $0]
-            end;
-	_ ->
-	    "profile" ++ [A + $0, B + $0]
-    end.
-
-decode_dialplan([A, B]) ->
-    "dialplan" ++ [A + $0, B + $0].
-
-decode_mid(Mid) ->
-    case Mid of
-	{domainName, DN} ->
-	    Lower = to_lower(DN#'DomainName'.name),	    
-	    {domainName, DN#'DomainName'{name = Lower}};
-	{deviceName, PathName} ->
-	    Lower = to_lower(PathName),
-	    {deviceName, Lower};
-	Other ->
-	    Other
-    end.
-
-to_lower(Chars) ->
-    [?LOWER(Char) || Char <- Chars].
-
-%%----------------------------------------------------------------------
-%% Encode package name from internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-encode(mid, Package) ->
-    encode_mid(Package);
-encode(package, Package) ->
-    encode_package(Package);
-encode(profile, Profile) ->
-    encode_profile(Profile);
-encode(dialplan, Dialplan) ->
-    encode_dialplan(Dialplan);
-encode(Scope, PackageItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p", [Scope, PackageItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_package(Package) ++ encode_item(Scope, Package, Item);
-	[Item] ->
-	    ?d("encode -> Item: ~p", [Item]),
-	    [16#00, 16#00 | encode_native(Scope, Item)]
-    end;
-encode({Scope, PackageItem}, SubItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p"
-       "~n   SubItem:     ~p", [Scope, PackageItem, SubItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_item({Scope, Item}, Package, SubItem);
-	[_Item] ->
-	    ?d("encode -> _Item: ~p", [_Item]),
-	    encode_native(Scope, SubItem)
-    end.
-
-encode_item(_Scope, _Package, "*") ->
-    [16#ff, 16#ff];
-encode_item(Scope, Package, Item) ->
-    ?d("encode_item(~s) -> entry", [Package]),
-    case Package of
-        "g"       -> encode_g(Scope, Item);
-        "root"    -> encode_root(Scope, Item);
-        "tonegen" -> encode_tonegen(Scope, Item);
-        "tonedet" -> encode_tonedet(Scope, Item);
-        "dg"      -> encode_dg(Scope, Item);
-        "dd"      -> encode_dd(Scope, Item);
-        "cg"      -> encode_cg(Scope, Item);
-        "cd"      -> encode_cd(Scope, Item);
-        "al"      -> encode_al(Scope, Item);
-        "ct"      -> encode_ct(Scope, Item);
-        "nt"      -> encode_nt(Scope, Item);
-        "rtp"     -> encode_rtp(Scope, Item);
-        "tdmc"    -> encode_tdmc(Scope, Item);
-        "swb"     -> encode_swb(Scope, Item)
-    end.
-
-encode_package(Package) ->
-    case Package of
-        "g"       -> [16#00, 16#01];
-        "root"    -> [16#00, 16#02];
-        "tonegen" -> [16#00, 16#03];
-        "tonedet" -> [16#00, 16#04];
-        "dg"      -> [16#00, 16#05];
-        "dd"      -> [16#00, 16#06];
-        "cg"      -> [16#00, 16#07];
-        "cd"      -> [16#00, 16#08];
-        "al"      -> [16#00, 16#09];
-        "ct"      -> [16#00, 16#0a];
-        "nt"      -> [16#00, 16#0b];
-        "rtp"     -> [16#00, 16#0c];
-        "tdmc"    -> [16#00, 16#0d];
-        ""        -> [16#00, 16#00];
-	"*"       -> [16#ff, 16#ff];
-        "swb"     -> [16#fe, 16#fe]
-    end.
-
-encode_profile(Profile) ->
-    case Profile of
-        "resgw" ->
-	    [16#00, 16#fe];
-	[$p, $r, $o, $f, $i, $l, $e | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_dialplan(Dialplan) ->
-    case Dialplan of
-	[$d, $i, $a, $l, $p, $l, $a, $n | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_mid(Mid) ->
-    Mid.
-
-
-%%----------------------------------------------------------------------
-%% Name:    g - Generic
-%% Version: 1
-%% Extends: None
-%% Purpose: Generic package for commonly encountered items
-%%----------------------------------------------------------------------
-
-capabilities_g() ->
-    [
-     {event, "cause"},
-     {event, "sc"}
-    ].
-
-encode_g(event, Item) ->
-    case Item of
-	"cause"  -> [16#00, 16#01];
-	"sc"     -> [16#00, 16#02]
-    end;
-
-encode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-	"cause"  -> 
-	    case SubItem of
-		"Generalcause" -> [16#00, 16#01];
-		"Failurecause" -> [16#00, 16#02]
-	    end;
-	"sc" ->
-	    case SubItem of
-		"SigID" -> [16#00, 16#01];
-		"Meth"  -> [16#00, 16#02];
-		"SLID"  -> [16#00, 16#03];
-		"RID"   -> [16#00, 16#04]
-	    end
-    end.
-
-decode_g(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "cause";
-	[16#00, 16#02] -> "sc"
-    end;
-
-decode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: cause
-            case SubItem of
-                [16#00, 16#01] -> "Generalcause";
-		[16#00, 16#02] -> "Failurecause"
-            end;
-
-        [16#00, 16#02] -> % Event: sc
-            case SubItem of
-                [16#00, 16#01] -> "SigID";
-                [16#00, 16#02] -> "Meth";
-		[16#00, 16#03] -> "SLID";
-		[16#00, 16#04] -> "RID"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    root - Base Root Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines Gateway wide properties.
-%%----------------------------------------------------------------------
-
-capabilities_root() ->
-    [
-     {property, "maxNumberOfContexts"},
-     {property, "maxTerminationsPerContext"},
-     {property, "normalMGExecutionTime"},
-     {property, "normalMGCExecutionTime"},
-     {property, "MGProvisionalResponseTimerValue"},
-     {property, "MGCProvisionalResponseTimerValue"},
-     {property, "MGCOriginatedPendingLimit"},
-     {property, "MGOriginatedPendingLimit"}
-    ].
-
-encode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "maxNumberOfContexts"              -> [16#00, 16#01];
-                "maxTerminationsPerContext"        -> [16#00, 16#02];
-                "normalMGExecutionTime"            -> [16#00, 16#03];
-                "normalMGCExecutionTime"           -> [16#00, 16#04];
-                "MGProvisionalResponseTimerValue"  -> [16#00, 16#05];
-                "MGCProvisionalResponseTimerValue" -> [16#00, 16#06];
-                "MGCOriginatedPendingLimit"        -> [16#00, 16#07];
-                "MGOriginatedPendingLimit"         -> [16#00, 16#08]
-            end
-    end.
-
-decode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#01] -> "maxNumberOfContexts";
-                [16#00, 16#02] -> "maxTerminationsPerContext";
-                [16#00, 16#03] -> "normalMGExecutionTime";
-                [16#00, 16#04] -> "normalMGCExecutionTime";
-                [16#00, 16#05] -> "MGProvisionalResponseTimerValue";
-		[16#00, 16#06] -> "MGCProvisionalResponseTimerValue";
-		[16#00, 16#07] -> "MGCOriginatedPendingLimit";
-		[16#00, 16#08] -> "MGOriginatedPendingLimit"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonegen - Tone Generator Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines signals to generate audio tones.
-%%          This package does not specify parameter values. It is
-%%          intended to be extendable. Generally, tones are defined
-%%          as an individual signal with a parameter, ind,
-%%          representing "interdigit" time delay, and a tone id to
-%%          be used with playtones.  A tone id should be kept
-%%          consistent with any tone generation for the same tone.
-%%          MGs are expected to be provisioned with the characteristics
-%%          of appropriate tones for the country in which the MG is located.
-%%----------------------------------------------------------------------
-
-capabilities_tonegen() ->
-    [
-     {signal, "pt"}
-    ].
-
-encode_tonegen(signal, Item) ->
-    case Item of
-	"pt" -> [16#00, 16#01]
-    end;
-
-encode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        "pt" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "ind" -> [16#00, 16#02];
-                "btd" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonegen(signal, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pt"
-    end;
-
-decode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: pt
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "ind";
-                [16#00, 16#03] -> "btd"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonedet - Tone Detection Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This Package defines events for audio tone detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%%----------------------------------------------------------------------
-
-capabilities_tonedet() ->
-    [
-     {event, "std"},
-     {event, "etd"},
-     {event, "ltd"}
-    ].
-
-encode_tonedet(event, Item) ->
-    case Item of
-	"std" -> [16#00, 16#01];
-	"etd" -> [16#00, 16#02];
-	"ltd" -> [16#00, 16#03]
-    end;
-
-encode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        "std" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03]
-            end;
-        "etd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03];
-                "dur" -> [16#00, 16#02]
-            end;
-        "ltd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "dur" -> [16#00, 16#02];
-                "tid" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonedet(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "std";
-	[16#00, 16#02] -> "etd";
-	[16#00, 16#03] -> "ltd"
-    end;
-
-decode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event std
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid"
-            end;
-        [16#00, 16#02] -> % Event etd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid";
-                [16#00, 16#02] -> "dur"
-            end;
-        [16#00, 16#03] -> % Event ltd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "dur";
-                [16#00, 16#03] -> "tid"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    dg - Basic DTMF Generator Package
-%% Version: 1
-%% Extends: tonegen  version 1
-%% Purpose: This package defines the basic DTMF tones as signals and
-%%          extends the allowed values of parameter tl of playtone
-%%          in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_dg() ->
-    [
-     {signal, "d0"},
-     {signal, "d1"},
-     {signal, "d2"},
-     {signal, "d3"},
-     {signal, "d4"},
-     {signal, "d5"},
-     {signal, "d6"},
-     {signal, "d7"},
-     {signal, "d8"},
-     {signal, "d9"},
-     {signal, "ds"},
-     {signal, "do"},
-     {signal, "da"},
-     {signal, "db"},
-     {signal, "dc"},
-     {signal, "dd"}
-    ].
-
-encode_dg(signal, Item) ->
-    case Item of
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dg(signal, Item) ->
-    case Item of
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    dd - DTMF detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic DTMF tones detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%% 
-%% Additional tone id values are all tone ids described in package dg
-%% (basic DTMF generator package).
-%% 
-%% The following table maps DTMF events to digit map symbols as described
-%% in section 7.1.14.
-%% 
-%%                    _________________________________
-%%                   | DTMF Event        | Symbol     |
-%%                   | d0                |  "0"       |
-%%                   | d1                |  "1"       |
-%%                   | d2                |  "2"       |
-%%                   | d3                |  "3"       |
-%%                   | d4                |  "4"       |
-%%                   | d5                |  "5"       |
-%%                   | d6                |  "6"       |
-%%                   | d7                |  "7"       |
-%%                   | d8                |  "8"       |
-%%                   | d9                |  "9"       |
-%%                   | da                |  "A" or "a"|
-%%                   | db                |  "B" or "b"|
-%%                   | dc                |  "C" or "c"|
-%%                   | dd                |  "D" or "d"|
-%%                   | ds                |  "E" or "e"|
-%%                   | do                |  "F" or "f"|
-%%                   |___________________|____________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_dd() ->
-    [
-     {event, "ce"},
-     {event, "d0"},
-     {event, "d1"},
-     {event, "d2"},
-     {event, "d3"},
-     {event, "d4"},
-     {event, "d5"},
-     {event, "d6"},
-     {event, "d7"},
-     {event, "d8"},
-     {event, "d9"},
-     {event, "ds"},
-     {event, "do"},
-     {event, "da"},
-     {event, "db"},
-     {event, "dc"},
-     {event, "dd"}
-    ].
-
-encode_dd(event, Item) ->
-    case Item of
-	"ce" -> [16#00, 16#04];
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-        "ce" ->
-            case SubItem of
-                "ds"   -> [16#00, 16#01];
-		"Meth" -> [16#00, 16#03]
-            end;
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dd(event, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ce";
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#04] -> % Event ce
-            case SubItem of
-                [16#00, 16#01] -> "ds";
-		[16#00, 16#03] -> "Meth"
-            end;
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cg - Call Progress Tones Generator Package
-%% Version: 1
-%% Extends: tonegen version 1
-%% Purpose: This package defines the basic call progress tones as signals
-%%          and extends the allowed values of the tl parameter of
-%%          playtone in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_cg() ->
-    [
-     {signal, "dt"},
-     {signal, "rt"},
-     {signal, "bt"},
-     {signal, "ct"},
-     {signal, "sit"},
-     {signal, "wt"},
-     {signal, "prt"},
-     {signal, "cw"},
-     {signal, "cr"}
-    ].
-
-
-encode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                "dt"  -> [16#00, 16#30];
-                "rt"  -> [16#00, 16#31];
-                "bt"  -> [16#00, 16#32];
-                "ct"  -> [16#00, 16#33];
-                "sit" -> [16#00, 16#34];
-                "wt"  -> [16#00, 16#35];
-                "prt" -> [16#00, 16#36];
-                "cw"  -> [16#00, 16#37];
-                "cr"  -> [16#00, 16#38]
-            end
-    end.
-
-decode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cd - Call Progress Tones Detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic call progress detection tones.
-%%          This Package extends the possible values of tone id
-%%          in the "start tone detected", "end tone detected" and
-%%          "long tone detected" events.
-%%       Additional values
-%%             tone id values are defined for start tone detected,
-%%                   end tone detected and long tone detected with
-%%                   the same values as those in package cg (call
-%%                   progress tones generation package).
-%% 
-%% The required set of tone ids corresponds to Recommendation E.180/Q.35
-%% [ITU-T Recommendation E.180/Q.35 (1998)].  See Recommendation E.180/Q.35
-%% for definition of the meanings of these tones.
-%%----------------------------------------------------------------------
-
-capabilities_cd() ->
-    [
-     {event, "dt"},
-     {event, "rt"},
-     {event, "bt"},
-     {event, "ct"},
-     {event, "sit"},
-     {event, "wt"},
-     {event, "prt"},
-     {event, "cw"},
-     {event, "cr"}
-    ].
-
-
-encode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                "dt" -> [16#00, 16#30];
-                "rt" -> [16#00, 16#31];
-                "bt" -> [16#00, 16#32];
-                "ct" -> [16#00, 16#33];
-                "sit"-> [16#00, 16#34];
-                "wt" -> [16#00, 16#35];
-                "prt"-> [16#00, 16#36];
-                "cw" -> [16#00, 16#37];
-                "cr" -> [16#00, 16#38]
-            end
-    end.
-
-decode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    al - Analog Line Supervision Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for an analog line.
-%%----------------------------------------------------------------------
-
-capabilities_al() ->
-    [
-     {event,  "on"},
-     {event,  "of"},
-     {event,  "fl"},
-     {signal, "ri"}
-    ].
-
-encode_al(event, Item) ->
-    ?d("encode_al(event) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"on" -> [16#00, 16#04];
-	"of" -> [16#00, 16#05];
-	"fl" -> [16#00, 16#06]
-    end;
-
-encode_al({event_parameter, Item}, SubItem) ->
-    ?d("encode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-	"on" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "of" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "fl" ->
-            case SubItem of
-                "mindur" -> [16#00, 16#04];
-                "maxdur" -> [16#00, 16#05]
-            end
-    end;
-
-encode_al(signal, Item) ->
-    ?d("encode_al(signal) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"ri"    -> [16#00, 16#02]
-    end;
-
-encode_al({signal_parameter, Item}, SubItem) ->
-    ?d("encode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        "ri" ->
-            case SubItem of
-                "cad"  -> [16#00, 16#06];
-                "freq" -> [16#00, 16#07]
-            end
-    end.
-
-decode_al(event, SubItem) ->
-    ?d("decode_al(event) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#04] -> "on";
-	[16#00, 16#05] -> "of";
-	[16#00, 16#06] -> "fl"
-    end;
-
-decode_al({event_parameter, Item}, SubItem) ->
-    ?d("decode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#04] -> %% Event: on
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#05] -> %% Event: of
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#06] -> %% Event: fl
-            case SubItem of
-		[16#00, 16#04] -> "mindur";
-                [16#00, 16#05] -> "maxdur"
-            end
-    end;
-
-decode_al(signal, SubItem) ->
-    ?d("decode_al(signal) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#02] -> "ri"
-    end;
-
-decode_al({signal_parameter, Item}, SubItem) ->
-    ?d("decode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#02] -> %% Event: ri
-            case SubItem of
-		[16#00, 16#06] -> "cad";
-                [16#00, 16#07] -> "freq"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    ct - Basic Continuity Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for continuity test.
-%%          The continuity test includes provision of either a loopback
-%%          or transceiver functionality.
-%%----------------------------------------------------------------------
-
-capabilities_ct() ->
-    [
-     {event,  "cmp"},
-     {signal, "ct"},
-     {signal, "rsp"}
-    ].
-
-encode_ct(event, Item) ->
-    case Item of
-	"cmp" -> [16#00, 16#05]
-    end;
-encode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        "cmp" ->
-            case SubItem of
-                "res" -> [16#00, 16#08]
-            end
-    end;
-encode_ct(signal, Item) ->
-    case Item of
-	"ct"  -> [16#00, 16#03];
-	"rsp" -> [16#00, 16#04]
-    end.
-
-decode_ct(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "cmp"
-    end;
-decode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event cmp
-            case SubItem of
-                [16#00, 16#08] -> "res"
-            end
-    end;
-decode_ct(signal, Item) ->
-    case Item of
-	[16#00, 16#03] -> "ct";
-	[16#00, 16#04] -> "rsp"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    nt - Network Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines properties of network terminations
-%%          independent of network type.
-%%----------------------------------------------------------------------
-
-capabilities_nt() ->
-    [
-     {property,   "jit"},
-     {event,      "netfail"},
-     {event,      "qualert"},
-     {statistics, "dur"},
-     {statistics, "os"},
-     {statistics, "or"}
-    ].
-
-encode_nt(property, Item) ->
-    case Item of
-	"jit" -> [16#00, 16#07]
-    end;
-encode_nt(event, Item) ->
-    case Item of
-	"netfail" -> [16#00, 16#05];
-	"qualert" -> [16#00, 16#06]
-    end;
-encode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        "netfail" ->
-            case SubItem of
-                "cs" -> [16#00, 16#01]
-            end;
-        "qualert" ->
-            case SubItem of
-                "th"  -> [16#00, 16#01]
-            end
-    end;
-encode_nt(statistics, Item) ->
-    case Item of
-	"dur" -> [16#00, 16#01];
-	"os"  -> [16#00, 16#02];
-	"or"  -> [16#00, 16#03]
-    end.
-
-decode_nt(property, Item) ->
-    case Item of
-	[16#00, 16#07] -> "jit"
-    end;
-decode_nt(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "netfail";
-	[16#00, 16#06] -> "qualert"
-    end;
-decode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event netfail
-            case SubItem of
-                [16#00, 16#01] -> "cs"
-            end;
-        [16#00, 16#06] -> % Event qualert
-            case SubItem of
-                [16#00, 16#01] -> "th"
-            end
-	end;
-decode_nt(statistics, Item) ->
-    case Item of
-	[16#00, 16#01] -> "dur";
-	[16#00, 16#02] -> "os";
-	[16#00, 16#03] -> "or"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    rtp - RTP Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support packet based multimedia
-%%          data transfer by means of the Real-time Transport Protocol
-%%          (RTP) [RFC 1889].
-%%----------------------------------------------------------------------
-
-capabilities_rtp() ->
-    [
-     {event,      "pltrans"},
-     {statistics, "ps"},
-     {statistics, "pr"},
-     {statistics, "pl"},
-     {statistics, "jit"},
-     {statistics, "delay"}
-    ].
-
-encode_rtp(event, Item) ->
-    case Item of
-	"pltrans" -> [16#00, 16#01]
-    end;
-encode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        "pltrans" ->
-            case SubItem of
-                "rtppltype" -> [16#00, 16#01]
-            end
-    end;
-encode_rtp(statistics, Item) ->
-    case Item of
-	"ps"    -> [16#00, 16#04];
-	"pr"    -> [16#00, 16#05];
-	"pl"    -> [16#00, 16#06];
-	"jit"   -> [16#00, 16#07];
-	"delay" -> [16#00, 16#08]
-    end.
-
-decode_rtp(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pltrans"
-    end;
-decode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event pltrans
-            case SubItem of
-                [16#00, 16#01] -> "rtppltype"
-            end
-    end;
-decode_rtp(statistics, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ps";
-	[16#00, 16#05] -> "pr";
-	[16#00, 16#06] -> "pl";
-	[16#00, 16#07] -> "jit";
-	[16#00, 16#08] -> "delay"
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tdmc - TDM Circuit Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support TDM circuit terminations.
-%%----------------------------------------------------------------------
-
-capabilities_tdmc() ->
-    [
-     {property, "ec"},
-     {property, "gain"}
-    ].
-
-encode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "ec"   -> [16#00, 16#08];
-                "gain" -> [16#00, 16#0a]
-            end
-    end.
-
-decode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#08] -> "ec";
-                [16#00, 16#0a] -> "gain"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    swb - SwitchBoard Package
-%% Version: 1
-%% Extends: none
-%% Purpose: This package is used to support SwitchBoard specials
-%%----------------------------------------------------------------------
-
-capabilities_swb() ->
-    [
-     {statistics, "fs"}, % Free slots
-     {statistics, "as"}  % Allocated slots
-    ].
-
-encode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                "fs" -> [16#00, 16#00];
-                "as" -> [16#00, 16#01]
-            end
-    end.
-
-decode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                [16#00, 16#00] -> "fs";
-                [16#00, 16#01] -> "as"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:  native -  Pseudo package  
-%% Version: 1
-%% Extends: None
-%% Purpose: Native tags for media stream properties
-%%
-%% Parameters for Local descriptors and Remote descriptors are
-%% specified as tag-value pairs if binary encoding is used for the
-%% protocol.  This annex contains the property names (PropertyID), the
-%% tags (Property Tag), type of the property (Type) and the values
-%% (Value).Values presented in the Value field when the field contains
-%% references shall be regarded as "information". The reference
-%% contains the normative values.  If a value field does not contain a
-%% reference then the values in that field can be considered as
-%% "normative".
-%% 
-%% Tags are given as hexadecimal numbers in this annex. When setting
-%% the value of a property, a MGC may underspecify the value according
-%% to one of the mechanisms specified in section 7.1.1.
-%% 
-%% For type "enumeration" the value is represented by the value in brack-
-%% ets, e.g., Send(0), Receive(1).
-%%----------------------------------------------------------------------
-%% 
-%% C.6.  IP
-%% 
-%%     ________________________________________________________________
-%%    | PropertyID|  Tag       |  Type        |  Value                |
-%%    | IPv4      |  6001      |  32 BITS     |  Ipv4Address          |
-%%    | IPv6      |  6002      |  128 BITS    |  IPv6 Address         |
-%%    | Port      |  6003      |  Unsigned Int|  Port                 |
-%%    | Porttype  |  6004      |  Enumerated  |  TCP(0),UDP(1),SCTP(2)|
-%%    |___________|____________|______________|_______________________|
-%%    
-%% 
-%% C.11.  SDP Equivalents
-%% 
-%%      ______________________________________________________________
-%%     | PropertyID|  Tag |  Type  |  Value                          |
-%%     | SDP_V     |  B001|  STRING|  Protocol Version               |
-%%     | SDP_O     |  B002|  STRING|  Owner-creator and session ID   |
-%%     | SDP_S     |  B003|  STRING|  Sesson name                    |
-%%     | SDP_I     |  B004|  STRING|  Session identifier             |
-%%     | SDP_U     |  B005|  STRING|  URI of descriptor              |
-%%     | SDC_E     |  B006|  STRING|  email address                  |
-%%     | SDP_P     |  B007|  STRING|  phone number                   |
-%%     | SDP_C     |  B008|  STRING|  Connection information         |
-%%     | SDP_B     |  B009|  STRING|  Bandwidth Information          |
-%%     | SDP_Z     |  B00A|  STRING|  time zone adjustment           |
-%%     | SDP_K     |  B00B|  STRING|  Encryption Key                 |
-%%     | SDP_A     |  B00C|  STRING|  Zero or more session attributes|
-%%     | SDP_T     |  B00D|  STRING|  Active Session Time            |
-%%     | SDP_R     |  B00E|  STRING|  Zero or more repeat times      |
-%%     | SDP_M     |  B00F|  STRING|  Media name and transport addr  |
-%%     |           |      |        |  Reference: IETF RFC 2327       |
-%%     |___________|______|________|_________________________________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_native() ->
-    [
-     %% C.6.  IP 
-     {property, "IPv4"},
-     {property, "IPv6"},
-     {property, "Port"},
-     {property, "Porttype"},
-
-     %% C.11. SDP Equivalents
-     {property, "v"},
-     {property, "o"},
-     {property, "s"},
-     {property, "i"},
-     {property, "u"},
-     {property, "e"},
-     {property, "p"},
-     {property, "c"},
-     {property, "b"},
-     {property, "z"},
-     {property, "k"},
-     {property, "a"},
-     {property, "t"},
-     {property, "r"},
-     {property, "m"}
-    ].
-
-encode_native(Scope, Item) ->
-    case Scope of
-        property ->
-	    case Item of
-		%% IP
-		"IPv4"     -> [16#60, 16#01];
-		"IPv6"     -> [16#60, 16#02];
-		"Port"     -> [16#60, 16#03];
-		"Porttype" -> [16#60, 16#04];
-
-		%% SDP
-		"v" -> [16#b0, 16#01];
-		"o" -> [16#b0, 16#02];
-		"s" -> [16#b0, 16#03];
-		"i" -> [16#b0, 16#04];
-		"u" -> [16#b0, 16#05];
-		"e" -> [16#b0, 16#06];
-		"p" -> [16#b0, 16#07];
-		"c" -> [16#b0, 16#08];
-		"b" -> [16#b0, 16#09];
-		"z" -> [16#b0, 16#0a];
-		"k" -> [16#b0, 16#0b];
-		"a" -> [16#b0, 16#0c];
-		"t" -> [16#b0, 16#0d];
-		"r" -> [16#b0, 16#0e];
-		"m" -> [16#b0, 16#0f] 
-	    end
-    end.
-
-decode_native(Scope, [Type, Item]) ->
-    case Scope of
-        property ->
-            case Type of
-		16#60 ->
-		    case Item of
-			16#01 -> "IPv4";
-			16#02 -> "IPv6";
-			16#03 -> "Port";
-			16#04 -> "Porttype"
-		    end;
-
-                16#b0 ->
-		    case Item of
-			16#01 -> "v";
-			16#02 -> "o";
-			16#03 -> "s";
-			16#04 -> "i";
-			16#05 -> "u";
-			16#06 -> "e";
-			16#07 -> "p";
-			16#08 -> "c";
-			16#09 -> "b";
-			16#0a -> "z";
-			16#0b -> "k";
-			16#0c -> "a";
-			16#0d -> "t";
-			16#0e -> "r";
-			16#0f -> "m"
-		    end
-            end
-    end.
-
-%% -------------------------------------------------------------------
-
-% error(Reason) ->
-%     erlang:error(Reason).
- 
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
deleted file mode 100644
index bb04eee3c2..0000000000
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3b.erl
+++ /dev/null
@@ -1,2009 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2005-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Handle meta data about packages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_name_resolver_prev3b).
-
--include_lib("megaco/src/engine/megaco_message_internal.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
-
--define(LOWER(Char),
-	if
-	    Char >= $A, Char =< $Z ->
-		Char - ($A - $a);
-	    true ->
-		Char
-	end).
-
--export([packages/0,
-	 capabilities/0,
-	 capabilities/1,
-         decode_name/3,
-	 encode_name/3
-        ]).
-
-encode_name(Config, term_id, TermId) ->
-    case megaco:encode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, _Reason} ->
-	    exit({bad_term_id, TermId})
-    end;	
-encode_name(_Config, Scope, Item) ->
-    ?d("encode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    encode(Scope, Item).
-
-decode_name(Config, term_id, TermId) ->
-    case megaco:decode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, _Reason} ->
-	    exit({bad_term_id, TermId})
-    end;
-decode_name(_Config, Scope, Item) ->
-    ?d("decode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    decode(Scope, Item).
-
-
-
-%%----------------------------------------------------------------------
-%% 12.1.1	Package
-%% 
-%% Overall description of the package, specifying:
-%% 
-%% 	Package Name: only descriptive
-%% 
-%% 	PackageID: is an identifier
-%% 
-%% 	Description: is a description of the package
-%% 
-%% 	Version: 
-%% 
-%%            A new version of a package can only add additional Properties, 
-%%            Events, Signals, Statistics and new possible values for an 
-%%            existing parameter described in the original package. No 
-%%            deletions or modifications shall be allowed. A version is an 
-%%            integer in the range from 1 to 99.
-%% 
-%% 	Designed to be extended only (Optional): Yes
-%%             
-%%            This indicates that the package has been expressly designed to 
-%%            be extended by others, not to be directly referenced. For 
-%%            example, the package may not have any function on its own or be 
-%%            nonsensical on its own. The MG SHOULD NOT publish this PackageID 
-%%            when reporting packages.
-%% 
-%% 	Extends: existing package Descriptor
-%% 
-%%            A package may extend an existing package. The version of the 
-%%            original package must be specified. When a package extends 
-%%            another package it shall only add additional Properties, Events, 
-%%            Signals, Statistics and new possible values for an existing 
-%%            parameter described in the original package. An extended package 
-%%            shall not redefine or overload an identifier defined in the 
-%%            original package and packages it may have extended (multiple 
-%%            levels of extension). Hence, if package B version 1 extends 
-%%            package A version 1, version 2 of B will not be able to extend 
-%%            the A version 2 if A version 2 defines a name already in B 
-%%            version 1. If the package does not extend another package, it 
-%%            shall specify "none".
-%% 
-%% 
-%% 12.1.2	Properties
-%% 
-%% Properties defined by the package, specifying:
-%% 
-%% 	Property Name: only descriptive
-%% 
-%% 	PropertyID: is an identifier
-%% 
-%% 	Description: is a description of the function of the property
-%% 
-%% 	Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified. 
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). For 
-%%                      example, Type: sub-list of enumeration. The encoding 
-%%                      of sub-lists is specified in Annexes A and B.3.
-%% 
-%% 	Possible values:
-%% 
-%%            A package MUST specify either a specific set of values or a 
-%%            description of how values are determined. A package MUST also 
-%%            specify a default value or the default behaviour when the value 
-%%            is omitted from its descriptor. For example, a package may 
-%%            specify that procedures related to the property are suspended 
-%%            when its value is omitted.
-%% 
-%% 	Default:
-%% 
-%%            A default value (but not procedures) may be specified as 
-%%            provisionable.
-%% 
-%% 	Defined in:
-%% 
-%%            Which H.248.1 descriptor the property is defined in. 
-%%            LocalControl is for stream-dependent properties. 
-%%            TerminationState is for stream-independent properties. 
-%%            ContextAttribute is for properties that affect the context as 
-%%            a whole, i.e., mixing properties. These are expected to be the 
-%%            most common cases, but it is possible for properties to be 
-%%            defined in other descriptors. Context properties MUST be defined 
-%%            in the ContextAttribute descriptor.
-%% 
-%% 	Characteristics: Read/Write or both, and (optionally), global: 
-%% 
-%%            Indicates whether a property is read-only, or read-write, and 
-%%            if it is global. If Global is omitted, the property is not 
-%%            global. If a property is declared as global, the value of the 
-%%            property is shared by all Terminations realizing the package.  
-%%            If a context property is declared as global, the property is 
-%%            shared by all contexts realizing the package.
-%% 
-%% 
-%% 12.1.3	Events
-%% 
-%% Events defined by the package, specifying:
-%% 
-%% 	Event name: only descriptive
-%% 
-%% 	EventID: is an identifier
-%% 
-%% 	Description: a description of the function of the event
-%% 
-%% 	EventsDescriptor Parameters: 
-%% 
-%%            Parameters used by the MGC to configure the event, and found in 
-%%            the EventsDescriptor. See 12.2. If there are no parameters for 
-%%            the Events Descriptor, then "none" shall be specified.
-%% 
-%% 	ObservedEventsDescriptor Parameters: 
-%% 
-%%            Parameters returned to the MGC in Notify requests and in replies 
-%%            to command requests from the MGC that audit 
-%%            ObservedEventsDescriptor, and found in the 
-%%            ObservedEventsDescriptor. See 12.2. If there are no parameters 
-%%            for the ObservedEvents Descriptor, then 'none' shall be specified.
-%% 
-%% 
-%% 12.1.4	Signals
-%% 
-%% Signals defined by the package, specifying:
-%% 
-%% 	Signal Name: only descriptive
-%% 
-%% 	SignalID: is an identifier. SignalID is used in a SignalsDescriptor
-%% 
-%% 	Description: a description of the function of the signal
-%% 
-%% 	SignalType: one of:
-%% 
-%%            OO (On/Off) 
-%% 
-%%            TO (TimeOut)
-%% 
-%%            BR (Brief)
-%% 
-%% 	   NOTE - SignalType may be defined such that it is dependent on
-%%            the value of one or more parameters. The package MUST specify a 
-%%            default signal type. If the default type is TO, the package MUST 
-%%            specify a default duration which may be provisioned. A default 
-%%            duration is meaningless for BR. 
-%% 
-%% 	Duration: in hundredths of seconds
-%% 
-%% 	Additional Parameters: see 12.2
-%% 
-%% 
-%% 12.1.5	Statistics
-%% 
-%% Statistics defined by the package, specifying:
-%% 
-%% 	Statistic name: only descriptive
-%% 
-%% 	StatisticID: is an identifier
-%% 
-%% 	StatisticID is used in a StatisticsDescriptor
-%% 
-%% 	Description: a description of the statistic
-%% 
-%% 	Type: One of:
-%% 
-%% 	   Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets.  
-%%                          See Annex A and Annex B.3 for encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: One of a list of possible unique values (See 12.3)
-%% 
-%%            Sub-list: A list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified.  
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). 
-%%                      For example, Type: sub-list of enumeration.  
-%%                      The encoding of sub-lists is specified in Annexes A 
-%%                      and B.3.
-%% 
-%% 	Possible Values:
-%% 
-%%            A package must indicate the unit of measure, e.g. milliseconds, 
-%%            packets, either here or along with the type above, as well as 
-%%            indicating any restriction on the range.
-%% 
-%% 	Level: Specify if the statistic can be kept at the Termination 
-%%                level, Stream level or Either.
-%% 
-%% 
-%% 12.1.6	Error Codes
-%% 
-%% If the package does not define any error codes, this section may be omitted.  
-%% Otherwise, it describes error codes defined by the package, specifying:
-%% 
-%% 	Error Code #: The error code number.
-%% 
-%% 	Name: Name of the error
-%% 
-%% 	Definition: A description of the error code.
-%% 
-%% 	Error Text in the Error Descriptor:
-%% 
-%%            A description of what text to return in the Error Descriptor.
-%% 
-%% 	Comment: Any further comments on the use of the error code.
-%% 
-%% 
-%% 12.1.7	Procedures
-%% 
-%% Additional guidance on the use of the package.
-%% 
-%% 
-%% 12.2	Guidelines to defining parameters to events and signals
-%% 
-%%         Parameter Name: only descriptive
-%% 
-%%         ParameterID: is an identifier. The textual ParameterID of 
-%%         parameters to Events and Signals shall not start with "EPA" and 
-%%         "SPA", respectively. The textual ParameterID shall also not be 
-%%         "ST", "Stream", "SY", "SignalType", "DR", "Duration", "NC", 
-%%         "NotifyCompletion", "KA", "KeepActive", "EB", "Embed", "DM", 
-%%         "DigitMap", "DI", "Direction", "RQ" or "RequestID".
-%% 
-%%         Description: a description of the function of the parameter.
-%% 
-%%         Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 octet string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4-octet signed integer
-%% 
-%%            Double: 8-octet signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. Could be 
-%%                       more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list (not supported 
-%%                      for statistics). The type of sub-list SHALL also be 
-%%                      specified The type shall be chosen from the types 
-%%                      specified in this section (with the exception of 
-%%                      sub-list). For example, Type: sub-list of enumeration. 
-%%                      The encoding of sub-lists is specified in Annex A 
-%%                      and B.3.
-%% 
-%%            Optional: Yes/No
-%% 
-%%               Describes if the parameter may be omitted from the signal or 
-%%               event.
-%% 
-%%            Possible values:
-%% 
-%%               A package MUST specify either a specific set of values or a 
-%%               description of how values are determined. A package MUST 
-%%               also specify a default value or the default behavior when the 
-%%               value is omitted from its descriptor. For example, a package 
-%%               may specify that procedures related to the parameter are 
-%%               suspended when its value is omitted.
-%% 
-%%            Default:
-%% 
-%%               A default value (but not procedures) may be specified as 
-%%               provisionable.
-%% 
-%% 
-%% 12.3	Lists
-%% 
-%% Possible values for parameters include enumerations. Enumerations may be 
-%% defined in a list. It is recommended that the list be IANA registered so 
-%% that packages that extend the list can be defined without concern for 
-%% conflicting names.
-%% 
-%% 
-%% 12.4	Identifiers
-%% 
-%% Identifiers in text encoding shall be strings of up to 64 characters, 
-%% containing no spaces, starting with an alphabetic character and consisting 
-%% of alphanumeric characters and/or digits, and possibly including the 
-%% special character underscore ("_").
-%% 
-%% Identifiers in binary encoding are 2 octets long.
-%% 
-%% Both text and binary values shall be specified for each identifier, 
-%% including identifiers used as values in enumerated types.
-%% 
-%% 
-%% 12.5	Package registration
-%% 
-%% A package can be registered with IANA for interoperability reasons. See 
-%% clause 14 for IANA considerations.
-%% 
-%%----------------------------------------------------------------------
-
-capabilities() ->
-    [{P, capabilities(P)} || P <- packages()].
-
-%% -record(property, {name, type, values, defined_in, characteristics}).
-
-%%----------------------------------------------------------------------
-%% List all known packages
-%% 'native' and 'all' are not real packages
-%%----------------------------------------------------------------------
-
-packages() ->
-    [
-     "g",        % Generic
-     "root",	 % Base Root Package
-     "tonegen",	 % Tone Generator Package
-     "tonedet",	 % Tone Detection Package
-     "dg",	 % Basic DTMF Generator Package
-     "dd",	 % DTMF detection Package
-     "cg",	 % Call Progress Tones Generator Package
-     "cd",	 % Call Progress Tones Detection Package
-     "al",	 % Analog Line Supervision Package
-     "ct",	 % Basic Continuity Package
-     "nt",	 % Network Package
-     "rtp",	 % RTP Package
-     "swb",	 % SwitchBoard Package
-     "tdmc",     % TDM Circuit Package
-     ""          % Native pseudo package
-    ].
-
-%%----------------------------------------------------------------------
-%% List all matching capabilities
-%%----------------------------------------------------------------------
-
-capabilities(Package) ->
-    case Package of
-        "g"       -> capabilities_g();
-        "root"    -> capabilities_root();
-        "tonegen" -> capabilities_tonegen();
-        "tonedet" -> capabilities_tonedet();
-        "dg"      -> capabilities_dg();
-        "dd"      -> capabilities_dd();
-        "cg"      -> capabilities_cg();
-        "cd"      -> capabilities_cd();
-        "al"      -> capabilities_al();
-        "ct"      -> capabilities_ct();
-        "nt"      -> capabilities_nt();
-        "rtp"     -> capabilities_rtp();
-	"swb"     -> capabilities_swb();
-        "tdmc"    -> capabilities_tdmc();
-        ""        -> capabilities_native()
-    end.
-
-%%----------------------------------------------------------------------
-%% Decode package name to internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-decode(mid, Package) ->
-    decode_mid(Package);
-decode(package, Package) ->
-    decode_package(Package);
-decode(profile, Package) ->
-    decode_profile(Package);
-decode(dialplan, Dialplan) ->
-    decode_dialplan(Dialplan);
-decode(Scope, [A, B | Item]) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:    ~p"
-       "~n   B:    ~p"
-       "~n   Item: ~p", [Scope, A, B, Item]),
-    case decode_package([A, B]) of
-	"" ->
- 	    ?d("decode -> \"no\" package",[]),
-	    decode_item(Scope, [A, B], Item);
-	Package ->
- 	    ?d("decode -> Package: ~p", [Package]),
-	    Package ++ "/" ++ decode_item(Scope, [A, B], Item)
-    end;
-decode({Scope, [A, B | Item]}, SubItem) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:       ~p"
-       "~n   B:       ~p"
-       "~n   Item:    ~p"
-       "~n   SubItem: ~p", [Scope, A, B, Item, SubItem]),
-    decode_item({Scope, Item}, [A, B], SubItem).
-
-decode_item(Scope, [A, B], Item) ->
-    ?d("decode_item -> entry",[]),
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> decode_g(Scope, Item);
-                16#02 -> decode_root(Scope, Item);
-                16#03 -> decode_tonegen(Scope, Item);
-                16#04 -> decode_tonedet(Scope, Item);
-                16#05 -> decode_dg(Scope, Item);
-                16#06 -> decode_dd(Scope, Item);
-                16#07 -> decode_cg(Scope, Item);
-                16#08 -> decode_cd(Scope, Item);
-                16#09 -> decode_al(Scope, Item);
-                16#0a -> decode_ct(Scope, Item);
-                16#0b -> decode_nt(Scope, Item);
-                16#0c -> decode_rtp(Scope, Item);
-                16#0d -> decode_tdmc(Scope, Item);
-                16#00 -> decode_native(Scope, Item)
-            end;
-        16#fe ->
-            case B of
-                %% Proprietary extension
-                16#fe -> decode_swb(Scope, Item)
-            end;
-        16#ff ->
-            case B of
-                16#ff when Item =:= [16#ff, 16#ff] -> "*"
-            end
-    end.
-
-decode_package(Package) ->
-    ?d("decode_package -> entry with"
-       "~n   Package: ~p", [Package]),
-    [A, B] = Package,
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> "g";
-                16#02 -> "root";
-                16#03 -> "tonegen";
-                16#04 -> "tonedet";
-                16#05 -> "dg";
-                16#06 -> "dd";
-                16#07 -> "cg";
-                16#08 -> "cd";
-                16#09 -> "al";
-                16#0a -> "ct";
-                16#0b -> "nt";
-                16#0c -> "rtp";
-                16#0d -> "tdmc";
-                16#00 -> ""
-            end;
-        16#fe ->
-            case B of
-                16#fe ->  "swb"
-            end;
-        16#ff ->
-            case B of
-                16#ff -> "*"
-            end
-    end.
-
-decode_profile([A, B]) ->
-    case A of
-        16#00 -> 
-            case B of
-                16#fe -> "resgw";
-		_     -> "profile" ++ [A + $0, B + $0]
-            end;
-	_ ->
-	    "profile" ++ [A + $0, B + $0]
-    end.
-
-decode_dialplan([A, B]) ->
-    "dialplan" ++ [A + $0, B + $0].
-
-decode_mid(Mid) ->
-    case Mid of
-	{domainName, DN} ->
-	    Lower = to_lower(DN#'DomainName'.name),	    
-	    {domainName, DN#'DomainName'{name = Lower}};
-	{deviceName, PathName} ->
-	    Lower = to_lower(PathName),
-	    {deviceName, Lower};
-	Other ->
-	    Other
-    end.
-
-to_lower(Chars) ->
-    [?LOWER(Char) || Char <- Chars].
-
-%%----------------------------------------------------------------------
-%% Encode package name from internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-encode(mid, Package) ->
-    encode_mid(Package);
-encode(package, Package) ->
-    encode_package(Package);
-encode(profile, Profile) ->
-    encode_profile(Profile);
-encode(dialplan, Dialplan) ->
-    encode_dialplan(Dialplan);
-encode(Scope, PackageItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p", [Scope, PackageItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_package(Package) ++ encode_item(Scope, Package, Item);
-	[Item] ->
-	    ?d("encode -> Item: ~p", [Item]),
-	    [16#00, 16#00 | encode_native(Scope, Item)]
-    end;
-encode({Scope, PackageItem}, SubItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p"
-       "~n   SubItem:     ~p", [Scope, PackageItem, SubItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_item({Scope, Item}, Package, SubItem);
-	[_Item] ->
-	    ?d("encode -> _Item: ~p", [_Item]),
-	    encode_native(Scope, SubItem)
-    end.
-
-encode_item(_Scope, _Package, "*") ->
-    [16#ff, 16#ff];
-encode_item(Scope, Package, Item) ->
-    ?d("encode_item(~s) -> entry", [Package]),
-    case Package of
-        "g"       -> encode_g(Scope, Item);
-        "root"    -> encode_root(Scope, Item);
-        "tonegen" -> encode_tonegen(Scope, Item);
-        "tonedet" -> encode_tonedet(Scope, Item);
-        "dg"      -> encode_dg(Scope, Item);
-        "dd"      -> encode_dd(Scope, Item);
-        "cg"      -> encode_cg(Scope, Item);
-        "cd"      -> encode_cd(Scope, Item);
-        "al"      -> encode_al(Scope, Item);
-        "ct"      -> encode_ct(Scope, Item);
-        "nt"      -> encode_nt(Scope, Item);
-        "rtp"     -> encode_rtp(Scope, Item);
-        "tdmc"    -> encode_tdmc(Scope, Item);
-        "swb"     -> encode_swb(Scope, Item)
-    end.
-
-encode_package(Package) ->
-    case Package of
-        "g"       -> [16#00, 16#01];
-        "root"    -> [16#00, 16#02];
-        "tonegen" -> [16#00, 16#03];
-        "tonedet" -> [16#00, 16#04];
-        "dg"      -> [16#00, 16#05];
-        "dd"      -> [16#00, 16#06];
-        "cg"      -> [16#00, 16#07];
-        "cd"      -> [16#00, 16#08];
-        "al"      -> [16#00, 16#09];
-        "ct"      -> [16#00, 16#0a];
-        "nt"      -> [16#00, 16#0b];
-        "rtp"     -> [16#00, 16#0c];
-        "tdmc"    -> [16#00, 16#0d];
-        ""        -> [16#00, 16#00];
-	"*"       -> [16#ff, 16#ff];
-        "swb"     -> [16#fe, 16#fe]
-    end.
-
-encode_profile(Profile) ->
-    case Profile of
-        "resgw" ->
-	    [16#00, 16#fe];
-	[$p, $r, $o, $f, $i, $l, $e | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_dialplan(Dialplan) ->
-    case Dialplan of
-	[$d, $i, $a, $l, $p, $l, $a, $n | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_mid(Mid) ->
-    Mid.
-
-
-%%----------------------------------------------------------------------
-%% Name:    g - Generic
-%% Version: 1
-%% Extends: None
-%% Purpose: Generic package for commonly encountered items
-%%----------------------------------------------------------------------
-
-capabilities_g() ->
-    [
-     {event, "cause"},
-     {event, "sc"}
-    ].
-
-encode_g(event, Item) ->
-    case Item of
-	"cause"  -> [16#00, 16#01];
-	"sc"     -> [16#00, 16#02]
-    end;
-
-encode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-	"cause"  -> 
-	    case SubItem of
-		"Generalcause" -> [16#00, 16#01];
-		"Failurecause" -> [16#00, 16#02]
-	    end;
-	"sc" ->
-	    case SubItem of
-		"SigID" -> [16#00, 16#01];
-		"Meth"  -> [16#00, 16#02];
-		"SLID"  -> [16#00, 16#03];
-		"RID"   -> [16#00, 16#04]
-	    end
-    end.
-
-decode_g(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "cause";
-	[16#00, 16#02] -> "sc"
-    end;
-
-decode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: cause
-            case SubItem of
-                [16#00, 16#01] -> "Generalcause";
-		[16#00, 16#02] -> "Failurecause"
-            end;
-
-        [16#00, 16#02] -> % Event: sc
-            case SubItem of
-                [16#00, 16#01] -> "SigID";
-                [16#00, 16#02] -> "Meth";
-		[16#00, 16#03] -> "SLID";
-		[16#00, 16#04] -> "RID"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    root - Base Root Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines Gateway wide properties.
-%%----------------------------------------------------------------------
-
-capabilities_root() ->
-    [
-     {property, "maxNumberOfContexts"},
-     {property, "maxTerminationsPerContext"},
-     {property, "normalMGExecutionTime"},
-     {property, "normalMGCExecutionTime"},
-     {property, "MGProvisionalResponseTimerValue"},
-     {property, "MGCProvisionalResponseTimerValue"},
-     {property, "MGCOriginatedPendingLimit"},
-     {property, "MGOriginatedPendingLimit"}
-    ].
-
-encode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "maxNumberOfContexts"              -> [16#00, 16#01];
-                "maxTerminationsPerContext"        -> [16#00, 16#02];
-                "normalMGExecutionTime"            -> [16#00, 16#03];
-                "normalMGCExecutionTime"           -> [16#00, 16#04];
-                "MGProvisionalResponseTimerValue"  -> [16#00, 16#05];
-                "MGCProvisionalResponseTimerValue" -> [16#00, 16#06];
-                "MGCOriginatedPendingLimit"        -> [16#00, 16#07];
-                "MGOriginatedPendingLimit"         -> [16#00, 16#08]
-            end
-    end.
-
-decode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#01] -> "maxNumberOfContexts";
-                [16#00, 16#02] -> "maxTerminationsPerContext";
-                [16#00, 16#03] -> "normalMGExecutionTime";
-                [16#00, 16#04] -> "normalMGCExecutionTime";
-                [16#00, 16#05] -> "MGProvisionalResponseTimerValue";
-		[16#00, 16#06] -> "MGCProvisionalResponseTimerValue";
-		[16#00, 16#07] -> "MGCOriginatedPendingLimit";
-		[16#00, 16#08] -> "MGOriginatedPendingLimit"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonegen - Tone Generator Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines signals to generate audio tones.
-%%          This package does not specify parameter values. It is
-%%          intended to be extendable. Generally, tones are defined
-%%          as an individual signal with a parameter, ind,
-%%          representing "interdigit" time delay, and a tone id to
-%%          be used with playtones.  A tone id should be kept
-%%          consistent with any tone generation for the same tone.
-%%          MGs are expected to be provisioned with the characteristics
-%%          of appropriate tones for the country in which the MG is located.
-%%----------------------------------------------------------------------
-
-capabilities_tonegen() ->
-    [
-     {signal, "pt"}
-    ].
-
-encode_tonegen(signal, Item) ->
-    case Item of
-	"pt" -> [16#00, 16#01]
-    end;
-
-encode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        "pt" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "ind" -> [16#00, 16#02];
-                "btd" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonegen(signal, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pt"
-    end;
-
-decode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: pt
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "ind";
-                [16#00, 16#03] -> "btd"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonedet - Tone Detection Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This Package defines events for audio tone detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%%----------------------------------------------------------------------
-
-capabilities_tonedet() ->
-    [
-     {event, "std"},
-     {event, "etd"},
-     {event, "ltd"}
-    ].
-
-encode_tonedet(event, Item) ->
-    case Item of
-	"std" -> [16#00, 16#01];
-	"etd" -> [16#00, 16#02];
-	"ltd" -> [16#00, 16#03]
-    end;
-
-encode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        "std" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03]
-            end;
-        "etd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03];
-                "dur" -> [16#00, 16#02]
-            end;
-        "ltd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "dur" -> [16#00, 16#02];
-                "tid" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonedet(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "std";
-	[16#00, 16#02] -> "etd";
-	[16#00, 16#03] -> "ltd"
-    end;
-
-decode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event std
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid"
-            end;
-        [16#00, 16#02] -> % Event etd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid";
-                [16#00, 16#02] -> "dur"
-            end;
-        [16#00, 16#03] -> % Event ltd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "dur";
-                [16#00, 16#03] -> "tid"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    dg - Basic DTMF Generator Package
-%% Version: 1
-%% Extends: tonegen  version 1
-%% Purpose: This package defines the basic DTMF tones as signals and
-%%          extends the allowed values of parameter tl of playtone
-%%          in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_dg() ->
-    [
-     {signal, "d0"},
-     {signal, "d1"},
-     {signal, "d2"},
-     {signal, "d3"},
-     {signal, "d4"},
-     {signal, "d5"},
-     {signal, "d6"},
-     {signal, "d7"},
-     {signal, "d8"},
-     {signal, "d9"},
-     {signal, "ds"},
-     {signal, "do"},
-     {signal, "da"},
-     {signal, "db"},
-     {signal, "dc"},
-     {signal, "dd"}
-    ].
-
-encode_dg(signal, Item) ->
-    case Item of
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dg(signal, Item) ->
-    case Item of
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    dd - DTMF detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic DTMF tones detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%% 
-%% Additional tone id values are all tone ids described in package dg
-%% (basic DTMF generator package).
-%% 
-%% The following table maps DTMF events to digit map symbols as described
-%% in section 7.1.14.
-%% 
-%%                    _________________________________
-%%                   | DTMF Event        | Symbol     |
-%%                   | d0                |  "0"       |
-%%                   | d1                |  "1"       |
-%%                   | d2                |  "2"       |
-%%                   | d3                |  "3"       |
-%%                   | d4                |  "4"       |
-%%                   | d5                |  "5"       |
-%%                   | d6                |  "6"       |
-%%                   | d7                |  "7"       |
-%%                   | d8                |  "8"       |
-%%                   | d9                |  "9"       |
-%%                   | da                |  "A" or "a"|
-%%                   | db                |  "B" or "b"|
-%%                   | dc                |  "C" or "c"|
-%%                   | dd                |  "D" or "d"|
-%%                   | ds                |  "E" or "e"|
-%%                   | do                |  "F" or "f"|
-%%                   |___________________|____________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_dd() ->
-    [
-     {event, "ce"},
-     {event, "d0"},
-     {event, "d1"},
-     {event, "d2"},
-     {event, "d3"},
-     {event, "d4"},
-     {event, "d5"},
-     {event, "d6"},
-     {event, "d7"},
-     {event, "d8"},
-     {event, "d9"},
-     {event, "ds"},
-     {event, "do"},
-     {event, "da"},
-     {event, "db"},
-     {event, "dc"},
-     {event, "dd"}
-    ].
-
-encode_dd(event, Item) ->
-    case Item of
-	"ce" -> [16#00, 16#04];
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-        "ce" ->
-            case SubItem of
-                "ds"   -> [16#00, 16#01];
-		"Meth" -> [16#00, 16#03]
-            end;
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dd(event, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ce";
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#04] -> % Event ce
-            case SubItem of
-                [16#00, 16#01] -> "ds";
-		[16#00, 16#03] -> "Meth"
-            end;
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cg - Call Progress Tones Generator Package
-%% Version: 1
-%% Extends: tonegen version 1
-%% Purpose: This package defines the basic call progress tones as signals
-%%          and extends the allowed values of the tl parameter of
-%%          playtone in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_cg() ->
-    [
-     {signal, "dt"},
-     {signal, "rt"},
-     {signal, "bt"},
-     {signal, "ct"},
-     {signal, "sit"},
-     {signal, "wt"},
-     {signal, "prt"},
-     {signal, "cw"},
-     {signal, "cr"}
-    ].
-
-
-encode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                "dt"  -> [16#00, 16#30];
-                "rt"  -> [16#00, 16#31];
-                "bt"  -> [16#00, 16#32];
-                "ct"  -> [16#00, 16#33];
-                "sit" -> [16#00, 16#34];
-                "wt"  -> [16#00, 16#35];
-                "prt" -> [16#00, 16#36];
-                "cw"  -> [16#00, 16#37];
-                "cr"  -> [16#00, 16#38]
-            end
-    end.
-
-decode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cd - Call Progress Tones Detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic call progress detection tones.
-%%          This Package extends the possible values of tone id
-%%          in the "start tone detected", "end tone detected" and
-%%          "long tone detected" events.
-%%       Additional values
-%%             tone id values are defined for start tone detected,
-%%                   end tone detected and long tone detected with
-%%                   the same values as those in package cg (call
-%%                   progress tones generation package).
-%% 
-%% The required set of tone ids corresponds to Recommendation E.180/Q.35
-%% [ITU-T Recommendation E.180/Q.35 (1998)].  See Recommendation E.180/Q.35
-%% for definition of the meanings of these tones.
-%%----------------------------------------------------------------------
-
-capabilities_cd() ->
-    [
-     {event, "dt"},
-     {event, "rt"},
-     {event, "bt"},
-     {event, "ct"},
-     {event, "sit"},
-     {event, "wt"},
-     {event, "prt"},
-     {event, "cw"},
-     {event, "cr"}
-    ].
-
-
-encode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                "dt" -> [16#00, 16#30];
-                "rt" -> [16#00, 16#31];
-                "bt" -> [16#00, 16#32];
-                "ct" -> [16#00, 16#33];
-                "sit"-> [16#00, 16#34];
-                "wt" -> [16#00, 16#35];
-                "prt"-> [16#00, 16#36];
-                "cw" -> [16#00, 16#37];
-                "cr" -> [16#00, 16#38]
-            end
-    end.
-
-decode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    al - Analog Line Supervision Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for an analog line.
-%%----------------------------------------------------------------------
-
-capabilities_al() ->
-    [
-     {event,  "on"},
-     {event,  "of"},
-     {event,  "fl"},
-     {signal, "ri"}
-    ].
-
-encode_al(event, Item) ->
-    ?d("encode_al(event) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"on" -> [16#00, 16#04];
-	"of" -> [16#00, 16#05];
-	"fl" -> [16#00, 16#06]
-    end;
-
-encode_al({event_parameter, Item}, SubItem) ->
-    ?d("encode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-	"on" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "of" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "fl" ->
-            case SubItem of
-                "mindur" -> [16#00, 16#04];
-                "maxdur" -> [16#00, 16#05]
-            end
-    end;
-
-encode_al(signal, Item) ->
-    ?d("encode_al(signal) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"ri"    -> [16#00, 16#02]
-    end;
-
-encode_al({signal_parameter, Item}, SubItem) ->
-    ?d("encode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        "ri" ->
-            case SubItem of
-                "cad"  -> [16#00, 16#06];
-                "freq" -> [16#00, 16#07]
-            end
-    end.
-
-decode_al(event, SubItem) ->
-    ?d("decode_al(event) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#04] -> "on";
-	[16#00, 16#05] -> "of";
-	[16#00, 16#06] -> "fl"
-    end;
-
-decode_al({event_parameter, Item}, SubItem) ->
-    ?d("decode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#04] -> %% Event: on
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#05] -> %% Event: of
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#06] -> %% Event: fl
-            case SubItem of
-		[16#00, 16#04] -> "mindur";
-                [16#00, 16#05] -> "maxdur"
-            end
-    end;
-
-decode_al(signal, SubItem) ->
-    ?d("decode_al(signal) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#02] -> "ri"
-    end;
-
-decode_al({signal_parameter, Item}, SubItem) ->
-    ?d("decode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#02] -> %% Event: ri
-            case SubItem of
-		[16#00, 16#06] -> "cad";
-                [16#00, 16#07] -> "freq"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    ct - Basic Continuity Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for continuity test.
-%%          The continuity test includes provision of either a loopback
-%%          or transceiver functionality.
-%%----------------------------------------------------------------------
-
-capabilities_ct() ->
-    [
-     {event,  "cmp"},
-     {signal, "ct"},
-     {signal, "rsp"}
-    ].
-
-encode_ct(event, Item) ->
-    case Item of
-	"cmp" -> [16#00, 16#05]
-    end;
-encode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        "cmp" ->
-            case SubItem of
-                "res" -> [16#00, 16#08]
-            end
-    end;
-encode_ct(signal, Item) ->
-    case Item of
-	"ct"  -> [16#00, 16#03];
-	"rsp" -> [16#00, 16#04]
-    end.
-
-decode_ct(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "cmp"
-    end;
-decode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event cmp
-            case SubItem of
-                [16#00, 16#08] -> "res"
-            end
-    end;
-decode_ct(signal, Item) ->
-    case Item of
-	[16#00, 16#03] -> "ct";
-	[16#00, 16#04] -> "rsp"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    nt - Network Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines properties of network terminations
-%%          independent of network type.
-%%----------------------------------------------------------------------
-
-capabilities_nt() ->
-    [
-     {property,   "jit"},
-     {event,      "netfail"},
-     {event,      "qualert"},
-     {statistics, "dur"},
-     {statistics, "os"},
-     {statistics, "or"}
-    ].
-
-encode_nt(property, Item) ->
-    case Item of
-	"jit" -> [16#00, 16#07]
-    end;
-encode_nt(event, Item) ->
-    case Item of
-	"netfail" -> [16#00, 16#05];
-	"qualert" -> [16#00, 16#06]
-    end;
-encode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        "netfail" ->
-            case SubItem of
-                "cs" -> [16#00, 16#01]
-            end;
-        "qualert" ->
-            case SubItem of
-                "th"  -> [16#00, 16#01]
-            end
-    end;
-encode_nt(statistics, Item) ->
-    case Item of
-	"dur" -> [16#00, 16#01];
-	"os"  -> [16#00, 16#02];
-	"or"  -> [16#00, 16#03]
-    end.
-
-decode_nt(property, Item) ->
-    case Item of
-	[16#00, 16#07] -> "jit"
-    end;
-decode_nt(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "netfail";
-	[16#00, 16#06] -> "qualert"
-    end;
-decode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event netfail
-            case SubItem of
-                [16#00, 16#01] -> "cs"
-            end;
-        [16#00, 16#06] -> % Event qualert
-            case SubItem of
-                [16#00, 16#01] -> "th"
-            end
-	end;
-decode_nt(statistics, Item) ->
-    case Item of
-	[16#00, 16#01] -> "dur";
-	[16#00, 16#02] -> "os";
-	[16#00, 16#03] -> "or"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    rtp - RTP Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support packet based multimedia
-%%          data transfer by means of the Real-time Transport Protocol
-%%          (RTP) [RFC 1889].
-%%----------------------------------------------------------------------
-
-capabilities_rtp() ->
-    [
-     {event,      "pltrans"},
-     {statistics, "ps"},
-     {statistics, "pr"},
-     {statistics, "pl"},
-     {statistics, "jit"},
-     {statistics, "delay"}
-    ].
-
-encode_rtp(event, Item) ->
-    case Item of
-	"pltrans" -> [16#00, 16#01]
-    end;
-encode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        "pltrans" ->
-            case SubItem of
-                "rtppltype" -> [16#00, 16#01]
-            end
-    end;
-encode_rtp(statistics, Item) ->
-    case Item of
-	"ps"    -> [16#00, 16#04];
-	"pr"    -> [16#00, 16#05];
-	"pl"    -> [16#00, 16#06];
-	"jit"   -> [16#00, 16#07];
-	"delay" -> [16#00, 16#08]
-    end.
-
-decode_rtp(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pltrans"
-    end;
-decode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event pltrans
-            case SubItem of
-                [16#00, 16#01] -> "rtppltype"
-            end
-    end;
-decode_rtp(statistics, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ps";
-	[16#00, 16#05] -> "pr";
-	[16#00, 16#06] -> "pl";
-	[16#00, 16#07] -> "jit";
-	[16#00, 16#08] -> "delay"
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tdmc - TDM Circuit Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support TDM circuit terminations.
-%%----------------------------------------------------------------------
-
-capabilities_tdmc() ->
-    [
-     {property, "ec"},
-     {property, "gain"}
-    ].
-
-encode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "ec"   -> [16#00, 16#08];
-                "gain" -> [16#00, 16#0a]
-            end
-    end.
-
-decode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#08] -> "ec";
-                [16#00, 16#0a] -> "gain"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    swb - SwitchBoard Package
-%% Version: 1
-%% Extends: none
-%% Purpose: This package is used to support SwitchBoard specials
-%%----------------------------------------------------------------------
-
-capabilities_swb() ->
-    [
-     {statistics, "fs"}, % Free slots
-     {statistics, "as"}  % Allocated slots
-    ].
-
-encode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                "fs" -> [16#00, 16#00];
-                "as" -> [16#00, 16#01]
-            end
-    end.
-
-decode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                [16#00, 16#00] -> "fs";
-                [16#00, 16#01] -> "as"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:  native -  Pseudo package  
-%% Version: 1
-%% Extends: None
-%% Purpose: Native tags for media stream properties
-%%
-%% Parameters for Local descriptors and Remote descriptors are
-%% specified as tag-value pairs if binary encoding is used for the
-%% protocol.  This annex contains the property names (PropertyID), the
-%% tags (Property Tag), type of the property (Type) and the values
-%% (Value).Values presented in the Value field when the field contains
-%% references shall be regarded as "information". The reference
-%% contains the normative values.  If a value field does not contain a
-%% reference then the values in that field can be considered as
-%% "normative".
-%% 
-%% Tags are given as hexadecimal numbers in this annex. When setting
-%% the value of a property, a MGC may underspecify the value according
-%% to one of the mechanisms specified in section 7.1.1.
-%% 
-%% For type "enumeration" the value is represented by the value in brack-
-%% ets, e.g., Send(0), Receive(1).
-%%----------------------------------------------------------------------
-%% 
-%% C.6.  IP
-%% 
-%%     ________________________________________________________________
-%%    | PropertyID|  Tag       |  Type        |  Value                |
-%%    | IPv4      |  6001      |  32 BITS     |  Ipv4Address          |
-%%    | IPv6      |  6002      |  128 BITS    |  IPv6 Address         |
-%%    | Port      |  6003      |  Unsigned Int|  Port                 |
-%%    | Porttype  |  6004      |  Enumerated  |  TCP(0),UDP(1),SCTP(2)|
-%%    |___________|____________|______________|_______________________|
-%%    
-%% 
-%% C.11.  SDP Equivalents
-%% 
-%%      ______________________________________________________________
-%%     | PropertyID|  Tag |  Type  |  Value                          |
-%%     | SDP_V     |  B001|  STRING|  Protocol Version               |
-%%     | SDP_O     |  B002|  STRING|  Owner-creator and session ID   |
-%%     | SDP_S     |  B003|  STRING|  Sesson name                    |
-%%     | SDP_I     |  B004|  STRING|  Session identifier             |
-%%     | SDP_U     |  B005|  STRING|  URI of descriptor              |
-%%     | SDC_E     |  B006|  STRING|  email address                  |
-%%     | SDP_P     |  B007|  STRING|  phone number                   |
-%%     | SDP_C     |  B008|  STRING|  Connection information         |
-%%     | SDP_B     |  B009|  STRING|  Bandwidth Information          |
-%%     | SDP_Z     |  B00A|  STRING|  time zone adjustment           |
-%%     | SDP_K     |  B00B|  STRING|  Encryption Key                 |
-%%     | SDP_A     |  B00C|  STRING|  Zero or more session attributes|
-%%     | SDP_T     |  B00D|  STRING|  Active Session Time            |
-%%     | SDP_R     |  B00E|  STRING|  Zero or more repeat times      |
-%%     | SDP_M     |  B00F|  STRING|  Media name and transport addr  |
-%%     |           |      |        |  Reference: IETF RFC 2327       |
-%%     |___________|______|________|_________________________________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_native() ->
-    [
-     %% C.6.  IP 
-     {property, "IPv4"},
-     {property, "IPv6"},
-     {property, "Port"},
-     {property, "Porttype"},
-
-     %% C.11. SDP Equivalents
-     {property, "v"},
-     {property, "o"},
-     {property, "s"},
-     {property, "i"},
-     {property, "u"},
-     {property, "e"},
-     {property, "p"},
-     {property, "c"},
-     {property, "b"},
-     {property, "z"},
-     {property, "k"},
-     {property, "a"},
-     {property, "t"},
-     {property, "r"},
-     {property, "m"}
-    ].
-
-encode_native(Scope, Item) ->
-    case Scope of
-        property ->
-	    case Item of
-		%% IP
-		"IPv4"     -> [16#60, 16#01];
-		"IPv6"     -> [16#60, 16#02];
-		"Port"     -> [16#60, 16#03];
-		"Porttype" -> [16#60, 16#04];
-
-		%% SDP
-		"v" -> [16#b0, 16#01];
-		"o" -> [16#b0, 16#02];
-		"s" -> [16#b0, 16#03];
-		"i" -> [16#b0, 16#04];
-		"u" -> [16#b0, 16#05];
-		"e" -> [16#b0, 16#06];
-		"p" -> [16#b0, 16#07];
-		"c" -> [16#b0, 16#08];
-		"b" -> [16#b0, 16#09];
-		"z" -> [16#b0, 16#0a];
-		"k" -> [16#b0, 16#0b];
-		"a" -> [16#b0, 16#0c];
-		"t" -> [16#b0, 16#0d];
-		"r" -> [16#b0, 16#0e];
-		"m" -> [16#b0, 16#0f] 
-	    end
-    end.
-
-decode_native(Scope, [Type, Item]) ->
-    case Scope of
-        property ->
-            case Type of
-		16#60 ->
-		    case Item of
-			16#01 -> "IPv4";
-			16#02 -> "IPv6";
-			16#03 -> "Port";
-			16#04 -> "Porttype"
-		    end;
-
-                16#b0 ->
-		    case Item of
-			16#01 -> "v";
-			16#02 -> "o";
-			16#03 -> "s";
-			16#04 -> "i";
-			16#05 -> "u";
-			16#06 -> "e";
-			16#07 -> "p";
-			16#08 -> "c";
-			16#09 -> "b";
-			16#0a -> "z";
-			16#0b -> "k";
-			16#0c -> "a";
-			16#0d -> "t";
-			16#0e -> "r";
-			16#0f -> "m"
-		    end
-            end
-    end.
-
-%% -------------------------------------------------------------------
-
-% error(Reason) ->
-%     erlang:error(Reason).
- 
diff --git a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl b/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
deleted file mode 100644
index 5336f9a8ad..0000000000
--- a/lib/megaco/src/binary/megaco_binary_name_resolver_prev3c.erl
+++ /dev/null
@@ -1,2010 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2005-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Handle meta data about packages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_name_resolver_prev3c).
-
--include_lib("megaco/src/engine/megaco_message_internal.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
-
--define(LOWER(Char),
-	if
-	    Char >= $A, Char =< $Z ->
-		Char - ($A - $a);
-	    true ->
-		Char
-	end).
-
--export([packages/0,
-	 capabilities/0,
-	 capabilities/1,
-         decode_name/3,
-	 encode_name/3
-        ]).
-
-encode_name(Config, term_id, TermId) ->
-    case megaco:encode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, Reason} ->
-	    exit({bad_term_id, TermId, Reason})
-    end;	
-encode_name(_Config, Scope, Item) ->
-    ?d("encode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    encode(Scope, Item).
-
-decode_name(Config, term_id, TermId) ->
-    case megaco:decode_binary_term_id(Config, TermId) of
-	{ok, TermId2} ->
-	    TermId2;
-	{error, Reason} ->
-	    exit({bad_term_id, TermId, Reason})
-    end;
-decode_name(_Config, Scope, Item) ->
-    ?d("decode_name(~p) -> entry with"
-       "~n   Item: ~p", [Scope, Item]),
-    decode(Scope, Item).
-
-
-
-%%----------------------------------------------------------------------
-%% 12.1.1	Package
-%% 
-%% Overall description of the package, specifying:
-%% 
-%% 	Package Name: only descriptive
-%% 
-%% 	PackageID: is an identifier
-%% 
-%% 	Description: is a description of the package
-%% 
-%% 	Version: 
-%% 
-%%            A new version of a package can only add additional Properties, 
-%%            Events, Signals, Statistics and new possible values for an 
-%%            existing parameter described in the original package. No 
-%%            deletions or modifications shall be allowed. A version is an 
-%%            integer in the range from 1 to 99.
-%% 
-%% 	Designed to be extended only (Optional): Yes
-%%             
-%%            This indicates that the package has been expressly designed to 
-%%            be extended by others, not to be directly referenced. For 
-%%            example, the package may not have any function on its own or be 
-%%            nonsensical on its own. The MG SHOULD NOT publish this PackageID 
-%%            when reporting packages.
-%% 
-%% 	Extends: existing package Descriptor
-%% 
-%%            A package may extend an existing package. The version of the 
-%%            original package must be specified. When a package extends 
-%%            another package it shall only add additional Properties, Events, 
-%%            Signals, Statistics and new possible values for an existing 
-%%            parameter described in the original package. An extended package 
-%%            shall not redefine or overload an identifier defined in the 
-%%            original package and packages it may have extended (multiple 
-%%            levels of extension). Hence, if package B version 1 extends 
-%%            package A version 1, version 2 of B will not be able to extend 
-%%            the A version 2 if A version 2 defines a name already in B 
-%%            version 1. If the package does not extend another package, it 
-%%            shall specify "none".
-%% 
-%% 
-%% 12.1.2	Properties
-%% 
-%% Properties defined by the package, specifying:
-%% 
-%% 	Property Name: only descriptive
-%% 
-%% 	PropertyID: is an identifier
-%% 
-%% 	Description: is a description of the function of the property
-%% 
-%% 	Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified. 
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). For 
-%%                      example, Type: sub-list of enumeration. The encoding 
-%%                      of sub-lists is specified in Annexes A and B.3.
-%% 
-%% 	Possible values:
-%% 
-%%            A package MUST specify either a specific set of values or a 
-%%            description of how values are determined. A package MUST also 
-%%            specify a default value or the default behaviour when the value 
-%%            is omitted from its descriptor. For example, a package may 
-%%            specify that procedures related to the property are suspended 
-%%            when its value is omitted.
-%% 
-%% 	Default:
-%% 
-%%            A default value (but not procedures) may be specified as 
-%%            provisionable.
-%% 
-%% 	Defined in:
-%% 
-%%            Which H.248.1 descriptor the property is defined in. 
-%%            LocalControl is for stream-dependent properties. 
-%%            TerminationState is for stream-independent properties. 
-%%            ContextAttribute is for properties that affect the context as 
-%%            a whole, i.e., mixing properties. These are expected to be the 
-%%            most common cases, but it is possible for properties to be 
-%%            defined in other descriptors. Context properties MUST be defined 
-%%            in the ContextAttribute descriptor.
-%% 
-%% 	Characteristics: Read/Write or both, and (optionally), global: 
-%% 
-%%            Indicates whether a property is read-only, or read-write, and 
-%%            if it is global. If Global is omitted, the property is not 
-%%            global. If a property is declared as global, the value of the 
-%%            property is shared by all Terminations realizing the package.  
-%%            If a context property is declared as global, the property is 
-%%            shared by all contexts realizing the package.
-%% 
-%% 
-%% 12.1.3	Events
-%% 
-%% Events defined by the package, specifying:
-%% 
-%% 	Event name: only descriptive
-%% 
-%% 	EventID: is an identifier
-%% 
-%% 	Description: a description of the function of the event
-%% 
-%% 	EventsDescriptor Parameters: 
-%% 
-%%            Parameters used by the MGC to configure the event, and found in 
-%%            the EventsDescriptor. See 12.2. If there are no parameters for 
-%%            the Events Descriptor, then "none" shall be specified.
-%% 
-%% 	ObservedEventsDescriptor Parameters: 
-%% 
-%%            Parameters returned to the MGC in Notify requests and in replies 
-%%            to command requests from the MGC that audit 
-%%            ObservedEventsDescriptor, and found in the 
-%%            ObservedEventsDescriptor. See 12.2. If there are no parameters 
-%%            for the ObservedEvents Descriptor, then 'none' shall be specified.
-%% 
-%% 
-%% 12.1.4	Signals
-%% 
-%% Signals defined by the package, specifying:
-%% 
-%% 	Signal Name: only descriptive
-%% 
-%% 	SignalID: is an identifier. SignalID is used in a SignalsDescriptor
-%% 
-%% 	Description: a description of the function of the signal
-%% 
-%% 	SignalType: one of:
-%% 
-%%            OO (On/Off) 
-%% 
-%%            TO (TimeOut)
-%% 
-%%            BR (Brief)
-%% 
-%% 	   NOTE - SignalType may be defined such that it is dependent on
-%%            the value of one or more parameters. The package MUST specify a 
-%%            default signal type. If the default type is TO, the package MUST 
-%%            specify a default duration which may be provisioned. A default 
-%%            duration is meaningless for BR. 
-%% 
-%% 	Duration: in hundredths of seconds
-%% 
-%% 	Additional Parameters: see 12.2
-%% 
-%% 
-%% 12.1.5	Statistics
-%% 
-%% Statistics defined by the package, specifying:
-%% 
-%% 	Statistic name: only descriptive
-%% 
-%% 	StatisticID: is an identifier
-%% 
-%% 	StatisticID is used in a StatisticsDescriptor
-%% 
-%% 	Description: a description of the statistic
-%% 
-%% 	Type: One of:
-%% 
-%% 	   Boolean
-%% 
-%%            String: UTF-8 string
-%% 
-%%            Octet String: A number of octets.  
-%%                          See Annex A and Annex B.3 for encoding
-%% 
-%%            Integer: 4 byte signed integer
-%% 
-%%            Double: 8 byte signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. 
-%%                       Could be more than one octet.
-%% 
-%%            Enumeration: One of a list of possible unique values (See 12.3)
-%% 
-%%            Sub-list: A list of several values from a list. 
-%%                      The type of sub-list SHALL also be specified.  
-%%                      The type shall be chosen from the types specified in 
-%%                      this section (with the exception of sub-list). 
-%%                      For example, Type: sub-list of enumeration.  
-%%                      The encoding of sub-lists is specified in Annexes A 
-%%                      and B.3.
-%% 
-%% 	Possible Values:
-%% 
-%%            A package must indicate the unit of measure, e.g. milliseconds, 
-%%            packets, either here or along with the type above, as well as 
-%%            indicating any restriction on the range.
-%% 
-%% 	Level: Specify if the statistic can be kept at the Termination 
-%%                level, Stream level or Either.
-%% 
-%% 
-%% 12.1.6	Error Codes
-%% 
-%% If the package does not define any error codes, this section may be omitted.  
-%% Otherwise, it describes error codes defined by the package, specifying:
-%% 
-%% 	Error Code #: The error code number.
-%% 
-%% 	Name: Name of the error
-%% 
-%% 	Definition: A description of the error code.
-%% 
-%% 	Error Text in the Error Descriptor:
-%% 
-%%            A description of what text to return in the Error Descriptor.
-%% 
-%% 	Comment: Any further comments on the use of the error code.
-%% 
-%% 
-%% 12.1.7	Procedures
-%% 
-%% Additional guidance on the use of the package.
-%% 
-%% 
-%% 12.2	Guidelines to defining parameters to events and signals
-%% 
-%%         Parameter Name: only descriptive
-%% 
-%%         ParameterID: is an identifier. The textual ParameterID of 
-%%         parameters to Events and Signals shall not start with "EPA" and 
-%%         "SPA", respectively. The textual ParameterID shall also not be 
-%%         "ST", "Stream", "SY", "SignalType", "DR", "Duration", "NC", 
-%%         "NotifyCompletion", "KA", "KeepActive", "EB", "Embed", "DM", 
-%%         "DigitMap", "DI", "Direction", "RQ" or "RequestID".
-%% 
-%%         Description: a description of the function of the parameter.
-%% 
-%%         Type: One of:
-%% 
-%%            Boolean
-%% 
-%%            String: UTF-8 octet string
-%% 
-%%            Octet String: A number of octets. See Annex A and B.3 for 
-%%                          encoding
-%% 
-%%            Integer: 4-octet signed integer
-%% 
-%%            Double: 8-octet signed integer
-%% 
-%%            Character: Unicode UTF-8 encoding of a single letter. Could be 
-%%                       more than one octet.
-%% 
-%%            Enumeration: one of a list of possible unique values (see 12.3)
-%% 
-%%            Sub-list: a list of several values from a list (not supported 
-%%                      for statistics). The type of sub-list SHALL also be 
-%%                      specified The type shall be chosen from the types 
-%%                      specified in this section (with the exception of 
-%%                      sub-list). For example, Type: sub-list of enumeration. 
-%%                      The encoding of sub-lists is specified in Annex A 
-%%                      and B.3.
-%% 
-%%            Optional: Yes/No
-%% 
-%%               Describes if the parameter may be omitted from the signal or 
-%%               event.
-%% 
-%%            Possible values:
-%% 
-%%               A package MUST specify either a specific set of values or a 
-%%               description of how values are determined. A package MUST 
-%%               also specify a default value or the default behavior when the 
-%%               value is omitted from its descriptor. For example, a package 
-%%               may specify that procedures related to the parameter are 
-%%               suspended when its value is omitted.
-%% 
-%%            Default:
-%% 
-%%               A default value (but not procedures) may be specified as 
-%%               provisionable.
-%% 
-%% 
-%% 12.3	Lists
-%% 
-%% Possible values for parameters include enumerations. Enumerations may be 
-%% defined in a list. It is recommended that the list be IANA registered so 
-%% that packages that extend the list can be defined without concern for 
-%% conflicting names.
-%% 
-%% 
-%% 12.4	Identifiers
-%% 
-%% Identifiers in text encoding shall be strings of up to 64 characters, 
-%% containing no spaces, starting with an alphabetic character and consisting 
-%% of alphanumeric characters and/or digits, and possibly including the 
-%% special character underscore ("_").
-%% 
-%% Identifiers in binary encoding are 2 octets long.
-%% 
-%% Both text and binary values shall be specified for each identifier, 
-%% including identifiers used as values in enumerated types.
-%% 
-%% 
-%% 12.5	Package registration
-%% 
-%% A package can be registered with IANA for interoperability reasons. See 
-%% clause 14 for IANA considerations.
-%% 
-%%----------------------------------------------------------------------
-
-capabilities() ->
-    [{P, capabilities(P)} || P <- packages()].
-
-%% -record(property, {name, type, values, defined_in, characteristics}).
-
-%%----------------------------------------------------------------------
-%% List all known packages
-%% 'native' and 'all' are not real packages
-%%----------------------------------------------------------------------
-
-packages() ->
-    [
-     "g",        % Generic
-     "root",	 % Base Root Package
-     "tonegen",	 % Tone Generator Package
-     "tonedet",	 % Tone Detection Package
-     "dg",	 % Basic DTMF Generator Package
-     "dd",	 % DTMF detection Package
-     "cg",	 % Call Progress Tones Generator Package
-     "cd",	 % Call Progress Tones Detection Package
-     "al",	 % Analog Line Supervision Package
-     "ct",	 % Basic Continuity Package
-     "nt",	 % Network Package
-     "rtp",	 % RTP Package
-     "swb",	 % SwitchBoard Package
-     "tdmc",     % TDM Circuit Package
-     ""          % Native pseudo package
-    ].
-
-%%----------------------------------------------------------------------
-%% List all matching capabilities
-%%----------------------------------------------------------------------
-
-capabilities(Package) ->
-    case Package of
-        "g"       -> capabilities_g();
-        "root"    -> capabilities_root();
-        "tonegen" -> capabilities_tonegen();
-        "tonedet" -> capabilities_tonedet();
-        "dg"      -> capabilities_dg();
-        "dd"      -> capabilities_dd();
-        "cg"      -> capabilities_cg();
-        "cd"      -> capabilities_cd();
-        "al"      -> capabilities_al();
-        "ct"      -> capabilities_ct();
-        "nt"      -> capabilities_nt();
-        "rtp"     -> capabilities_rtp();
-	"swb"     -> capabilities_swb();
-        "tdmc"    -> capabilities_tdmc();
-        ""        -> capabilities_native()
-    end.
-
-%%----------------------------------------------------------------------
-%% Decode package name to internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-decode(mid, Package) ->
-    decode_mid(Package);
-decode(package, Package) ->
-    decode_package(Package);
-decode(profile, Package) ->
-    decode_profile(Package);
-decode(dialplan, Dialplan) ->
-    decode_dialplan(Dialplan);
-decode(Scope, [A, B | Item]) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:    ~p"
-       "~n   B:    ~p"
-       "~n   Item: ~p", [Scope, A, B, Item]),
-    case decode_package([A, B]) of
-	"" ->
- 	    ?d("decode -> \"no\" package",[]),
-	    decode_item(Scope, [A, B], Item);
-	Package ->
- 	    ?d("decode -> Package: ~p", [Package]),
-	    Package ++ "/" ++ decode_item(Scope, [A, B], Item)
-    end;
-decode({Scope, [A, B | Item]}, SubItem) when is_atom(Scope) ->
-    ?d("decode(~p) -> entry with"
-       "~n   A:       ~p"
-       "~n   B:       ~p"
-       "~n   Item:    ~p"
-       "~n   SubItem: ~p", [Scope, A, B, Item, SubItem]),
-    decode_item({Scope, Item}, [A, B], SubItem).
-
-decode_item(Scope, [A, B], Item) ->
-    ?d("decode_item -> entry",[]),
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> decode_g(Scope, Item);
-                16#02 -> decode_root(Scope, Item);
-                16#03 -> decode_tonegen(Scope, Item);
-                16#04 -> decode_tonedet(Scope, Item);
-                16#05 -> decode_dg(Scope, Item);
-                16#06 -> decode_dd(Scope, Item);
-                16#07 -> decode_cg(Scope, Item);
-                16#08 -> decode_cd(Scope, Item);
-                16#09 -> decode_al(Scope, Item);
-                16#0a -> decode_ct(Scope, Item);
-                16#0b -> decode_nt(Scope, Item);
-                16#0c -> decode_rtp(Scope, Item);
-                16#0d -> decode_tdmc(Scope, Item);
-                16#00 -> decode_native(Scope, Item)
-            end;
-        16#fe ->
-            case B of
-                %% Proprietary extension
-                16#fe -> decode_swb(Scope, Item)
-            end;
-        16#ff ->
-            case B of
-                16#ff when Item =:= [16#ff, 16#ff] -> "*"
-            end
-    end.
-
-decode_package(Package) ->
-    ?d("decode_package -> entry with"
-       "~n   Package: ~p", [Package]),
-    [A, B] = Package,
-    case A of
-        16#00 -> 
-            case B of
-                16#01 -> "g";
-                16#02 -> "root";
-                16#03 -> "tonegen";
-                16#04 -> "tonedet";
-                16#05 -> "dg";
-                16#06 -> "dd";
-                16#07 -> "cg";
-                16#08 -> "cd";
-                16#09 -> "al";
-                16#0a -> "ct";
-                16#0b -> "nt";
-                16#0c -> "rtp";
-                16#0d -> "tdmc";
-                16#00 -> ""
-            end;
-        16#fe ->
-            case B of
-                16#fe ->  "swb"
-            end;
-        16#ff ->
-            case B of
-                16#ff -> "*"
-            end
-    end.
-
-decode_profile([A, B]) ->
-    case A of
-        16#00 -> 
-            case B of
-                16#fe -> "resgw";
-		_     -> "profile" ++ [A + $0, B + $0]
-            end;
-	_ ->
-	    "profile" ++ [A + $0, B + $0]
-    end.
-
-decode_dialplan([A, B]) ->
-    "dialplan" ++ [A + $0, B + $0].
-
-decode_mid(Mid) ->
-    case Mid of
-	{domainName, DN} ->
-	    Lower = to_lower(DN#'DomainName'.name),	    
-	    {domainName, DN#'DomainName'{name = Lower}};
-	{deviceName, PathName} ->
-	    Lower = to_lower(PathName),
-	    {deviceName, Lower};
-	Other ->
-	    Other
-    end.
-
-to_lower(Chars) ->
-    [?LOWER(Char) || Char <- Chars].
-
-%%----------------------------------------------------------------------
-%% Encode package name from internal form
-%% Scope  ::= property | event | signal | statistics
-%%----------------------------------------------------------------------
-
-encode(mid, Package) ->
-    encode_mid(Package);
-encode(package, Package) ->
-    encode_package(Package);
-encode(profile, Profile) ->
-    encode_profile(Profile);
-encode(dialplan, Dialplan) ->
-    encode_dialplan(Dialplan);
-encode(Scope, PackageItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p", [Scope, PackageItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_package(Package) ++ encode_item(Scope, Package, Item);
-	[Item] ->
-	    ?d("encode -> Item: ~p", [Item]),
-	    [16#00, 16#00 | encode_native(Scope, Item)]
-    end;
-encode({Scope, PackageItem}, SubItem) when is_atom(Scope) ->
-    ?d("encode(~p) -> entry with"
-       "~n   PackageItem: ~p"
-       "~n   SubItem:     ~p", [Scope, PackageItem, SubItem]),
-    case string:tokens(PackageItem, [$/]) of
-	[Package, Item] ->
-	    ?d("encode -> "
-	       "~n   Package: ~p"
-	       "~n   Item:    ~p", [Package, Item]),
-	    encode_item({Scope, Item}, Package, SubItem);
-	[_Item] ->
-	    ?d("encode -> _Item: ~p", [_Item]),
-	    encode_native(Scope, SubItem)
-    end.
-
-encode_item(_Scope, _Package, "*") ->
-    [16#ff, 16#ff];
-encode_item(Scope, Package, Item) ->
-    ?d("encode_item(~s) -> entry", [Package]),
-    case Package of
-        "g"       -> encode_g(Scope, Item);
-        "root"    -> encode_root(Scope, Item);
-        "tonegen" -> encode_tonegen(Scope, Item);
-        "tonedet" -> encode_tonedet(Scope, Item);
-        "dg"      -> encode_dg(Scope, Item);
-        "dd"      -> encode_dd(Scope, Item);
-        "cg"      -> encode_cg(Scope, Item);
-        "cd"      -> encode_cd(Scope, Item);
-        "al"      -> encode_al(Scope, Item);
-        "ct"      -> encode_ct(Scope, Item);
-        "nt"      -> encode_nt(Scope, Item);
-        "rtp"     -> encode_rtp(Scope, Item);
-        "tdmc"    -> encode_tdmc(Scope, Item);
-        "swb"     -> encode_swb(Scope, Item)
-    end.
-
-encode_package(Package) ->
-    case Package of
-        "g"       -> [16#00, 16#01];
-        "root"    -> [16#00, 16#02];
-        "tonegen" -> [16#00, 16#03];
-        "tonedet" -> [16#00, 16#04];
-        "dg"      -> [16#00, 16#05];
-        "dd"      -> [16#00, 16#06];
-        "cg"      -> [16#00, 16#07];
-        "cd"      -> [16#00, 16#08];
-        "al"      -> [16#00, 16#09];
-        "ct"      -> [16#00, 16#0a];
-        "nt"      -> [16#00, 16#0b];
-        "rtp"     -> [16#00, 16#0c];
-        "tdmc"    -> [16#00, 16#0d];
-        ""        -> [16#00, 16#00];
-	"*"       -> [16#ff, 16#ff];
-        "swb"     -> [16#fe, 16#fe]
-    end.
-
-encode_profile(Profile) ->
-    case Profile of
-        "resgw" ->
-	    [16#00, 16#fe];
-	[$p, $r, $o, $f, $i, $l, $e | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_dialplan(Dialplan) ->
-    case Dialplan of
-	[$d, $i, $a, $l, $p, $l, $a, $n | Name] ->
-	    case Name of
-		[A, B] -> [A - $0, B - $0];
-		[B]    -> [0, B - $0];
-		[]     -> [0, 0]
-	    end
-    end.
-
-encode_mid(Mid) ->
-    Mid.
-
-
-%%----------------------------------------------------------------------
-%% Name:    g - Generic
-%% Version: 1
-%% Extends: None
-%% Purpose: Generic package for commonly encountered items
-%%----------------------------------------------------------------------
-
-capabilities_g() ->
-    [
-     {event, "cause"},
-     {event, "sc"}
-    ].
-
-encode_g(event, Item) ->
-    case Item of
-	"cause"  -> [16#00, 16#01];
-	"sc"     -> [16#00, 16#02]
-    end;
-
-encode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-	"cause"  -> 
-	    case SubItem of
-		"Generalcause" -> [16#00, 16#01];
-		"Failurecause" -> [16#00, 16#02]
-	    end;
-	"sc" ->
-	    case SubItem of
-		"SigID" -> [16#00, 16#01];
-		"Meth"  -> [16#00, 16#02];
-		"SLID"  -> [16#00, 16#03];
-		"RID"   -> [16#00, 16#04]
-	    end
-    end.
-
-decode_g(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "cause";
-	[16#00, 16#02] -> "sc"
-    end;
-
-decode_g({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: cause
-            case SubItem of
-                [16#00, 16#01] -> "Generalcause";
-		[16#00, 16#02] -> "Failurecause"
-            end;
-
-        [16#00, 16#02] -> % Event: sc
-            case SubItem of
-                [16#00, 16#01] -> "SigID";
-                [16#00, 16#02] -> "Meth";
-		[16#00, 16#03] -> "SLID";
-		[16#00, 16#04] -> "RID"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    root - Base Root Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines Gateway wide properties.
-%%----------------------------------------------------------------------
-
-capabilities_root() ->
-    [
-     {property, "maxNumberOfContexts"},
-     {property, "maxTerminationsPerContext"},
-     {property, "normalMGExecutionTime"},
-     {property, "normalMGCExecutionTime"},
-     {property, "MGProvisionalResponseTimerValue"},
-     {property, "MGCProvisionalResponseTimerValue"},
-     {property, "MGCOriginatedPendingLimit"},
-     {property, "MGOriginatedPendingLimit"}
-    ].
-
-encode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "maxNumberOfContexts"              -> [16#00, 16#01];
-                "maxTerminationsPerContext"        -> [16#00, 16#02];
-                "normalMGExecutionTime"            -> [16#00, 16#03];
-                "normalMGCExecutionTime"           -> [16#00, 16#04];
-                "MGProvisionalResponseTimerValue"  -> [16#00, 16#05];
-                "MGCProvisionalResponseTimerValue" -> [16#00, 16#06];
-                "MGCOriginatedPendingLimit"        -> [16#00, 16#07];
-                "MGOriginatedPendingLimit"         -> [16#00, 16#08]
-            end
-    end.
-
-decode_root(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#01] -> "maxNumberOfContexts";
-                [16#00, 16#02] -> "maxTerminationsPerContext";
-                [16#00, 16#03] -> "normalMGExecutionTime";
-                [16#00, 16#04] -> "normalMGCExecutionTime";
-                [16#00, 16#05] -> "MGProvisionalResponseTimerValue";
-		[16#00, 16#06] -> "MGCProvisionalResponseTimerValue";
-		[16#00, 16#07] -> "MGCOriginatedPendingLimit";
-		[16#00, 16#08] -> "MGOriginatedPendingLimit"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonegen - Tone Generator Package
-%% Version: 2
-%% Extends: None
-%% Purpose: This package defines signals to generate audio tones.
-%%          This package does not specify parameter values. It is
-%%          intended to be extendable. Generally, tones are defined
-%%          as an individual signal with a parameter, ind,
-%%          representing "interdigit" time delay, and a tone id to
-%%          be used with playtones.  A tone id should be kept
-%%          consistent with any tone generation for the same tone.
-%%          MGs are expected to be provisioned with the characteristics
-%%          of appropriate tones for the country in which the MG is located.
-%%----------------------------------------------------------------------
-
-capabilities_tonegen() ->
-    [
-     {signal, "pt"}
-    ].
-
-encode_tonegen(signal, Item) ->
-    case Item of
-	"pt" -> [16#00, 16#01]
-    end;
-
-encode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        "pt" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "ind" -> [16#00, 16#02];
-                "btd" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonegen(signal, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pt"
-    end;
-
-decode_tonegen({signal_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event: pt
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "ind";
-                [16#00, 16#03] -> "btd"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tonedet - Tone Detection Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This Package defines events for audio tone detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%%----------------------------------------------------------------------
-
-capabilities_tonedet() ->
-    [
-     {event, "std"},
-     {event, "etd"},
-     {event, "ltd"}
-    ].
-
-encode_tonedet(event, Item) ->
-    case Item of
-	"std" -> [16#00, 16#01];
-	"etd" -> [16#00, 16#02];
-	"ltd" -> [16#00, 16#03]
-    end;
-
-encode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        "std" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03]
-            end;
-        "etd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "tid" -> [16#00, 16#03];
-                "dur" -> [16#00, 16#02]
-            end;
-        "ltd" ->
-            case SubItem of
-                "tl"  -> [16#00, 16#01];
-                "dur" -> [16#00, 16#02];
-                "tid" -> [16#00, 16#03]
-            end
-    end.
-
-decode_tonedet(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "std";
-	[16#00, 16#02] -> "etd";
-	[16#00, 16#03] -> "ltd"
-    end;
-
-decode_tonedet({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event std
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid"
-            end;
-        [16#00, 16#02] -> % Event etd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#03] -> "tid";
-                [16#00, 16#02] -> "dur"
-            end;
-        [16#00, 16#03] -> % Event ltd
-            case SubItem of
-                [16#00, 16#01] -> "tl";
-                [16#00, 16#02] -> "dur";
-                [16#00, 16#03] -> "tid"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    dg - Basic DTMF Generator Package
-%% Version: 1
-%% Extends: tonegen  version 1
-%% Purpose: This package defines the basic DTMF tones as signals and
-%%          extends the allowed values of parameter tl of playtone
-%%          in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_dg() ->
-    [
-     {signal, "d0"},
-     {signal, "d1"},
-     {signal, "d2"},
-     {signal, "d3"},
-     {signal, "d4"},
-     {signal, "d5"},
-     {signal, "d6"},
-     {signal, "d7"},
-     {signal, "d8"},
-     {signal, "d9"},
-     {signal, "ds"},
-     {signal, "do"},
-     {signal, "da"},
-     {signal, "db"},
-     {signal, "dc"},
-     {signal, "dd"}
-    ].
-
-encode_dg(signal, Item) ->
-    case Item of
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dg(signal, Item) ->
-    case Item of
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dg({signal_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    dd - DTMF detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic DTMF tones detection.
-%%          Tones are selected by name (tone id). MGs are expected
-%%          to be provisioned with the characteristics of appropriate
-%%          tones for the country in which the MG is located.
-%%          
-%%          This package does not specify parameter values.
-%%          It is intended to be extendable.
-%% 
-%% Additional tone id values are all tone ids described in package dg
-%% (basic DTMF generator package).
-%% 
-%% The following table maps DTMF events to digit map symbols as described
-%% in section 7.1.14.
-%% 
-%%                    _________________________________
-%%                   | DTMF Event        | Symbol     |
-%%                   | d0                |  "0"       |
-%%                   | d1                |  "1"       |
-%%                   | d2                |  "2"       |
-%%                   | d3                |  "3"       |
-%%                   | d4                |  "4"       |
-%%                   | d5                |  "5"       |
-%%                   | d6                |  "6"       |
-%%                   | d7                |  "7"       |
-%%                   | d8                |  "8"       |
-%%                   | d9                |  "9"       |
-%%                   | da                |  "A" or "a"|
-%%                   | db                |  "B" or "b"|
-%%                   | dc                |  "C" or "c"|
-%%                   | dd                |  "D" or "d"|
-%%                   | ds                |  "E" or "e"|
-%%                   | do                |  "F" or "f"|
-%%                   |___________________|____________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_dd() ->
-    [
-     {event, "ce"},
-     {event, "d0"},
-     {event, "d1"},
-     {event, "d2"},
-     {event, "d3"},
-     {event, "d4"},
-     {event, "d5"},
-     {event, "d6"},
-     {event, "d7"},
-     {event, "d8"},
-     {event, "d9"},
-     {event, "ds"},
-     {event, "do"},
-     {event, "da"},
-     {event, "db"},
-     {event, "dc"},
-     {event, "dd"}
-    ].
-
-encode_dd(event, Item) ->
-    case Item of
-	"ce" -> [16#00, 16#04];
-	"d0" -> [16#00, 16#10];
-	"d1" -> [16#00, 16#11];
-	"d2" -> [16#00, 16#12];
-	"d3" -> [16#00, 16#13];
-	"d4" -> [16#00, 16#14];
-	"d5" -> [16#00, 16#15];
-	"d6" -> [16#00, 16#16];
-	"d7" -> [16#00, 16#17];
-	"d8" -> [16#00, 16#18];
-	"d9" -> [16#00, 16#19];
-	"ds" -> [16#00, 16#20];
-	"do" -> [16#00, 16#21];
-	"da" -> [16#00, 16#1a];
-	"db" -> [16#00, 16#1b];
-	"dc" -> [16#00, 16#1c];
-	"dd" -> [16#00, 16#1d]
-    end;
-
-encode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-        "ce" ->
-            case SubItem of
-                "ds"   -> [16#00, 16#01];
-		"Meth" -> [16#00, 16#03]
-            end;
-	"d0" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d1" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d2" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d3" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d4" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d5" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d6" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d7" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d8" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"d9" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"ds" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"do" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"da" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"db" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dc" -> 
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end;
-	"dd" ->
-	    case SubItem of
-		"btd" -> [16#00, 16#01]
-	    end
-    end.
-
-decode_dd(event, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ce";
-	[16#00, 16#10] -> "d0";
-	[16#00, 16#11] -> "d1";
-	[16#00, 16#12] -> "d2";
-	[16#00, 16#13] -> "d3";
-	[16#00, 16#14] -> "d4";
-	[16#00, 16#15] -> "d5";
-	[16#00, 16#16] -> "d6";
-	[16#00, 16#17] -> "d7";
-	[16#00, 16#18] -> "d8";
-	[16#00, 16#19] -> "d9";
-	[16#00, 16#20] -> "ds";
-	[16#00, 16#21] -> "do";
-	[16#00, 16#1a] -> "da";
-	[16#00, 16#1b] -> "db";
-	[16#00, 16#1c] -> "dc";
-	[16#00, 16#1d] -> "dd"
-    end;
-
-decode_dd({event_parameter, Item}, SubItem) ->
-    case Item of
-	[16#00, 16#04] -> % Event ce
-            case SubItem of
-                [16#00, 16#01] -> "ds";
-		[16#00, 16#03] -> "Meth"
-            end;
-	[16#00, 16#10] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#11] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#12] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#13] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#14] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#15] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#16] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#17] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#18] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#19] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#20] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#21] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1a] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1b] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1c] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end;
-	[16#00, 16#1d] -> 
-	    case SubItem of
-		[16#00, 16#01] -> "btd"
-	    end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cg - Call Progress Tones Generator Package
-%% Version: 1
-%% Extends: tonegen version 1
-%% Purpose: This package defines the basic call progress tones as signals
-%%          and extends the allowed values of the tl parameter of
-%%          playtone in tonegen.
-%%----------------------------------------------------------------------
-
-capabilities_cg() ->
-    [
-     {signal, "dt"},
-     {signal, "rt"},
-     {signal, "bt"},
-     {signal, "ct"},
-     {signal, "sit"},
-     {signal, "wt"},
-     {signal, "prt"},
-     {signal, "cw"},
-     {signal, "cr"}
-    ].
-
-
-encode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                "dt"  -> [16#00, 16#30];
-                "rt"  -> [16#00, 16#31];
-                "bt"  -> [16#00, 16#32];
-                "ct"  -> [16#00, 16#33];
-                "sit" -> [16#00, 16#34];
-                "wt"  -> [16#00, 16#35];
-                "prt" -> [16#00, 16#36];
-                "cw"  -> [16#00, 16#37];
-                "cr"  -> [16#00, 16#38]
-            end
-    end.
-
-decode_cg(Scope, Item) ->
-    case Scope of
-        signal ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    cd - Call Progress Tones Detection Package
-%% Version: 1
-%% Extends: tonedet version 1
-%% Purpose: This package defines the basic call progress detection tones.
-%%          This Package extends the possible values of tone id
-%%          in the "start tone detected", "end tone detected" and
-%%          "long tone detected" events.
-%%       Additional values
-%%             tone id values are defined for start tone detected,
-%%                   end tone detected and long tone detected with
-%%                   the same values as those in package cg (call
-%%                   progress tones generation package).
-%% 
-%% The required set of tone ids corresponds to Recommendation E.180/Q.35
-%% [ITU-T Recommendation E.180/Q.35 (1998)].  See Recommendation E.180/Q.35
-%% for definition of the meanings of these tones.
-%%----------------------------------------------------------------------
-
-capabilities_cd() ->
-    [
-     {event, "dt"},
-     {event, "rt"},
-     {event, "bt"},
-     {event, "ct"},
-     {event, "sit"},
-     {event, "wt"},
-     {event, "prt"},
-     {event, "cw"},
-     {event, "cr"}
-    ].
-
-
-encode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                "dt" -> [16#00, 16#30];
-                "rt" -> [16#00, 16#31];
-                "bt" -> [16#00, 16#32];
-                "ct" -> [16#00, 16#33];
-                "sit"-> [16#00, 16#34];
-                "wt" -> [16#00, 16#35];
-                "prt"-> [16#00, 16#36];
-                "cw" -> [16#00, 16#37];
-                "cr" -> [16#00, 16#38]
-            end
-    end.
-
-decode_cd(Scope, Item) ->
-    case Scope of
-        event ->
-            case Item of
-                [16#00, 16#30] -> "dt";              
-                [16#00, 16#31] -> "rt";           
-                [16#00, 16#32] -> "bt";              
-                [16#00, 16#33] -> "ct";        
-                [16#00, 16#34] -> "sit";         
-                [16#00, 16#35] -> "wt";              
-                [16#00, 16#36] -> "prt"; 
-                [16#00, 16#37] -> "cw";         
-                [16#00, 16#38] -> "cr"
-            end
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    al - Analog Line Supervision Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for an analog line.
-%%----------------------------------------------------------------------
-
-capabilities_al() ->
-    [
-     {event,  "on"},
-     {event,  "of"},
-     {event,  "fl"},
-     {signal, "ri"}
-    ].
-
-encode_al(event, Item) ->
-    ?d("encode_al(event) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"on" -> [16#00, 16#04];
-	"of" -> [16#00, 16#05];
-	"fl" -> [16#00, 16#06]
-    end;
-
-encode_al({event_parameter, Item}, SubItem) ->
-    ?d("encode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-	"on" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "of" ->
-            case SubItem of
-                "strict" -> [16#00, 16#01];
-                "init"   -> [16#00, 16#02]
-            end;
-        "fl" ->
-            case SubItem of
-                "mindur" -> [16#00, 16#04];
-                "maxdur" -> [16#00, 16#05]
-            end
-    end;
-
-encode_al(signal, Item) ->
-    ?d("encode_al(signal) -> entry with"
-       "~n   Item: ~p", [Item]),
-    case Item of
-	"ri"    -> [16#00, 16#02]
-    end;
-
-encode_al({signal_parameter, Item}, SubItem) ->
-    ?d("encode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        "ri" ->
-            case SubItem of
-                "cad"  -> [16#00, 16#06];
-                "freq" -> [16#00, 16#07]
-            end
-    end.
-
-decode_al(event, SubItem) ->
-    ?d("decode_al(event) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#04] -> "on";
-	[16#00, 16#05] -> "of";
-	[16#00, 16#06] -> "fl"
-    end;
-
-decode_al({event_parameter, Item}, SubItem) ->
-    ?d("decode_al({event_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#04] -> %% Event: on
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#05] -> %% Event: of
-            case SubItem of
-		[16#00, 16#01] -> "strict";
-                [16#00, 16#02] -> "init"
-            end;
-        [16#00,16#06] -> %% Event: fl
-            case SubItem of
-		[16#00, 16#04] -> "mindur";
-                [16#00, 16#05] -> "maxdur"
-            end
-    end;
-
-decode_al(signal, SubItem) ->
-    ?d("decode_al(signal) -> entry with"
-       "~n   SubItem: ~p", [SubItem]),
-    case SubItem of
-	[16#00, 16#02] -> "ri"
-    end;
-
-decode_al({signal_parameter, Item}, SubItem) ->
-    ?d("decode_al({signal_parameter,~p}) -> entry with"
-       "~n   SubItem: ~p", [Item, SubItem]),
-    case Item of
-        [16#00,16#02] -> %% Event: ri
-            case SubItem of
-		[16#00, 16#06] -> "cad";
-                [16#00, 16#07] -> "freq"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    ct - Basic Continuity Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines events and signals for continuity test.
-%%          The continuity test includes provision of either a loopback
-%%          or transceiver functionality.
-%%----------------------------------------------------------------------
-
-capabilities_ct() ->
-    [
-     {event,  "cmp"},
-     {signal, "ct"},
-     {signal, "rsp"}
-    ].
-
-encode_ct(event, Item) ->
-    case Item of
-	"cmp" -> [16#00, 16#05]
-    end;
-encode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        "cmp" ->
-            case SubItem of
-                "res" -> [16#00, 16#08]
-            end
-    end;
-encode_ct(signal, Item) ->
-    case Item of
-	"ct"  -> [16#00, 16#03];
-	"rsp" -> [16#00, 16#04]
-    end.
-
-decode_ct(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "cmp"
-    end;
-decode_ct({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event cmp
-            case SubItem of
-                [16#00, 16#08] -> "res"
-            end
-    end;
-decode_ct(signal, Item) ->
-    case Item of
-	[16#00, 16#03] -> "ct";
-	[16#00, 16#04] -> "rsp"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    nt - Network Package
-%% Version: 1
-%% Extends: None
-%% Purpose: This package defines properties of network terminations
-%%          independent of network type.
-%%----------------------------------------------------------------------
-
-capabilities_nt() ->
-    [
-     {property,   "jit"},
-     {event,      "netfail"},
-     {event,      "qualert"},
-     {statistics, "dur"},
-     {statistics, "os"},
-     {statistics, "or"}
-    ].
-
-encode_nt(property, Item) ->
-    case Item of
-	"jit" -> [16#00, 16#07]
-    end;
-encode_nt(event, Item) ->
-    case Item of
-	"netfail" -> [16#00, 16#05];
-	"qualert" -> [16#00, 16#06]
-    end;
-encode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        "netfail" ->
-            case SubItem of
-                "cs" -> [16#00, 16#01]
-            end;
-        "qualert" ->
-            case SubItem of
-                "th"  -> [16#00, 16#01]
-            end
-    end;
-encode_nt(statistics, Item) ->
-    case Item of
-	"dur" -> [16#00, 16#01];
-	"os"  -> [16#00, 16#02];
-	"or"  -> [16#00, 16#03]
-    end.
-
-decode_nt(property, Item) ->
-    case Item of
-	[16#00, 16#07] -> "jit"
-    end;
-decode_nt(event, Item) ->
-    case Item of
-	[16#00, 16#05] -> "netfail";
-	[16#00, 16#06] -> "qualert"
-    end;
-decode_nt({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#05] -> % Event netfail
-            case SubItem of
-                [16#00, 16#01] -> "cs"
-            end;
-        [16#00, 16#06] -> % Event qualert
-            case SubItem of
-                [16#00, 16#01] -> "th"
-            end
-	end;
-decode_nt(statistics, Item) ->
-    case Item of
-	[16#00, 16#01] -> "dur";
-	[16#00, 16#02] -> "os";
-	[16#00, 16#03] -> "or"
-    end.
-
-%%----------------------------------------------------------------------
-%% Name:    rtp - RTP Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support packet based multimedia
-%%          data transfer by means of the Real-time Transport Protocol
-%%          (RTP) [RFC 1889].
-%%----------------------------------------------------------------------
-
-capabilities_rtp() ->
-    [
-     {event,      "pltrans"},
-     {statistics, "ps"},
-     {statistics, "pr"},
-     {statistics, "pl"},
-     {statistics, "jit"},
-     {statistics, "delay"}
-    ].
-
-encode_rtp(event, Item) ->
-    case Item of
-	"pltrans" -> [16#00, 16#01]
-    end;
-encode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        "pltrans" ->
-            case SubItem of
-                "rtppltype" -> [16#00, 16#01]
-            end
-    end;
-encode_rtp(statistics, Item) ->
-    case Item of
-	"ps"    -> [16#00, 16#04];
-	"pr"    -> [16#00, 16#05];
-	"pl"    -> [16#00, 16#06];
-	"jit"   -> [16#00, 16#07];
-	"delay" -> [16#00, 16#08]
-    end.
-
-decode_rtp(event, Item) ->
-    case Item of
-	[16#00, 16#01] -> "pltrans"
-    end;
-decode_rtp({event_parameter, Item}, SubItem) ->
-    case Item of
-        [16#00, 16#01] -> % Event pltrans
-            case SubItem of
-                [16#00, 16#01] -> "rtppltype"
-            end
-    end;
-decode_rtp(statistics, Item) ->
-    case Item of
-	[16#00, 16#04] -> "ps";
-	[16#00, 16#05] -> "pr";
-	[16#00, 16#06] -> "pl";
-	[16#00, 16#07] -> "jit";
-	[16#00, 16#08] -> "delay"
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    tdmc - TDM Circuit Package
-%% Version: 1
-%% Extends: nt version 1
-%% Purpose: This package is used to support TDM circuit terminations.
-%%----------------------------------------------------------------------
-
-capabilities_tdmc() ->
-    [
-     {property, "ec"},
-     {property, "gain"}
-    ].
-
-encode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                "ec"   -> [16#00, 16#08];
-                "gain" -> [16#00, 16#0a]
-            end
-    end.
-
-decode_tdmc(Scope, Item) ->
-    case Scope of
-        property ->
-            case Item of
-                [16#00, 16#08] -> "ec";
-                [16#00, 16#0a] -> "gain"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:    swb - SwitchBoard Package
-%% Version: 1
-%% Extends: none
-%% Purpose: This package is used to support SwitchBoard specials
-%%----------------------------------------------------------------------
-
-capabilities_swb() ->
-    [
-     {statistics, "fs"}, % Free slots
-     {statistics, "as"}  % Allocated slots
-    ].
-
-encode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                "fs" -> [16#00, 16#00];
-                "as" -> [16#00, 16#01]
-            end
-    end.
-
-decode_swb(Scope, Item) ->
-    case Scope of
-        statistics ->
-            case Item of
-                [16#00, 16#00] -> "fs";
-                [16#00, 16#01] -> "as"
-            end
-    end.
-
-
-%%----------------------------------------------------------------------
-%% Name:  native -  Pseudo package  
-%% Version: 1
-%% Extends: None
-%% Purpose: Native tags for media stream properties
-%%
-%% Parameters for Local descriptors and Remote descriptors are
-%% specified as tag-value pairs if binary encoding is used for the
-%% protocol.  This annex contains the property names (PropertyID), the
-%% tags (Property Tag), type of the property (Type) and the values
-%% (Value).Values presented in the Value field when the field contains
-%% references shall be regarded as "information". The reference
-%% contains the normative values.  If a value field does not contain a
-%% reference then the values in that field can be considered as
-%% "normative".
-%% 
-%% Tags are given as hexadecimal numbers in this annex. When setting
-%% the value of a property, a MGC may underspecify the value according
-%% to one of the mechanisms specified in section 7.1.1.
-%% 
-%% For type "enumeration" the value is represented by the value in brack-
-%% ets, e.g., Send(0), Receive(1).
-%%----------------------------------------------------------------------
-%% 
-%% C.6.  IP
-%% 
-%%     ________________________________________________________________
-%%    | PropertyID|  Tag       |  Type        |  Value                |
-%%    | IPv4      |  6001      |  32 BITS     |  Ipv4Address          |
-%%    | IPv6      |  6002      |  128 BITS    |  IPv6 Address         |
-%%    | Port      |  6003      |  Unsigned Int|  Port                 |
-%%    | Porttype  |  6004      |  Enumerated  |  TCP(0),UDP(1),SCTP(2)|
-%%    |___________|____________|______________|_______________________|
-%%    
-%% 
-%% C.11.  SDP Equivalents
-%% 
-%%      ______________________________________________________________
-%%     | PropertyID|  Tag |  Type  |  Value                          |
-%%     | SDP_V     |  B001|  STRING|  Protocol Version               |
-%%     | SDP_O     |  B002|  STRING|  Owner-creator and session ID   |
-%%     | SDP_S     |  B003|  STRING|  Sesson name                    |
-%%     | SDP_I     |  B004|  STRING|  Session identifier             |
-%%     | SDP_U     |  B005|  STRING|  URI of descriptor              |
-%%     | SDC_E     |  B006|  STRING|  email address                  |
-%%     | SDP_P     |  B007|  STRING|  phone number                   |
-%%     | SDP_C     |  B008|  STRING|  Connection information         |
-%%     | SDP_B     |  B009|  STRING|  Bandwidth Information          |
-%%     | SDP_Z     |  B00A|  STRING|  time zone adjustment           |
-%%     | SDP_K     |  B00B|  STRING|  Encryption Key                 |
-%%     | SDP_A     |  B00C|  STRING|  Zero or more session attributes|
-%%     | SDP_T     |  B00D|  STRING|  Active Session Time            |
-%%     | SDP_R     |  B00E|  STRING|  Zero or more repeat times      |
-%%     | SDP_M     |  B00F|  STRING|  Media name and transport addr  |
-%%     |           |      |        |  Reference: IETF RFC 2327       |
-%%     |___________|______|________|_________________________________|
-%% 
-%%----------------------------------------------------------------------
-
-capabilities_native() ->
-    [
-     %% C.6.  IP 
-     {property, "IPv4"},
-     {property, "IPv6"},
-     {property, "Port"},
-     {property, "Porttype"},
-
-     %% C.11. SDP Equivalents
-     {property, "v"},
-     {property, "o"},
-     {property, "s"},
-     {property, "i"},
-     {property, "u"},
-     {property, "e"},
-     {property, "p"},
-     {property, "c"},
-     {property, "b"},
-     {property, "z"},
-     {property, "k"},
-     {property, "a"},
-     {property, "t"},
-     {property, "r"},
-     {property, "m"}
-    ].
-
-encode_native(Scope, Item) ->
-    case Scope of
-        property ->
-	    case Item of
-		%% IP
-		"IPv4"     -> [16#60, 16#01];
-		"IPv6"     -> [16#60, 16#02];
-		"Port"     -> [16#60, 16#03];
-		"Porttype" -> [16#60, 16#04];
-
-		%% SDP
-		"v" -> [16#b0, 16#01];
-		"o" -> [16#b0, 16#02];
-		"s" -> [16#b0, 16#03];
-		"i" -> [16#b0, 16#04];
-		"u" -> [16#b0, 16#05];
-		"e" -> [16#b0, 16#06];
-		"p" -> [16#b0, 16#07];
-		"c" -> [16#b0, 16#08];
-		"b" -> [16#b0, 16#09];
-		"z" -> [16#b0, 16#0a];
-		"k" -> [16#b0, 16#0b];
-		"a" -> [16#b0, 16#0c];
-		"t" -> [16#b0, 16#0d];
-		"r" -> [16#b0, 16#0e];
-		"m" -> [16#b0, 16#0f] 
-	    end
-    end.
-
-decode_native(Scope, [Type, Item]) ->
-    case Scope of
-        property ->
-            case Type of
-		16#60 ->
-		    case Item of
-			16#01 -> "IPv4";
-			16#02 -> "IPv6";
-			16#03 -> "Port";
-			16#04 -> "Porttype"
-		    end;
-
-                16#b0 ->
-		    case Item of
-			16#01 -> "v";
-			16#02 -> "o";
-			16#03 -> "s";
-			16#04 -> "i";
-			16#05 -> "u";
-			16#06 -> "e";
-			16#07 -> "p";
-			16#08 -> "c";
-			16#09 -> "b";
-			16#0a -> "z";
-			16#0b -> "k";
-			16#0c -> "a";
-			16#0d -> "t";
-			16#0e -> "r";
-			16#0f -> "m"
-		    end
-            end
-    end.
-
-%% -------------------------------------------------------------------
-
-% error(Reason) ->
-%     erlang:error(Reason).
- 
diff --git a/lib/megaco/src/binary/megaco_binary_transformer_prev3a.erl b/lib/megaco/src/binary/megaco_binary_transformer_prev3a.erl
deleted file mode 100644
index be716188d3..0000000000
--- a/lib/megaco/src/binary/megaco_binary_transformer_prev3a.erl
+++ /dev/null
@@ -1,1628 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2004-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Transform internal form of Megaco/H.248 messages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_transformer_prev3a).
-
--include_lib("megaco/include/megaco.hrl").
-%% -include_lib("megaco/include/megaco_message.hrl").
--include_lib("megaco/include/megaco_message_prev3a.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
--export([tr_message/3, tr_transaction/3]).
-
-
--define(DEFAULT_NAME_RESOLVER, megaco_binary_name_resolver_prev3a).
-
--record(state, {mode,                 % verify | encode | decode
-                resolver_module,      % 
-                resolver_options}).
-
-resolve(Type, Item, State, Constraint) ->
-    case State#state.mode of
-        verify ->
-            Item;
-        encode ->
-	    ?d("resolve(encode) -> encode: ~p",[Item]),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-            EncodedItem = Mod:encode_name(Opt, Type, Item),
-	    ?d("resolve -> verify contraint for ~p",[EncodedItem]),
-	    verify_constraint(EncodedItem, Constraint);
-        decode ->
-	    ?d("resolve(decode) -> verify contraint for ~p",[Item]),
-	    DecodedItem = verify_constraint(Item, Constraint),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-	    ?d("resolve(decode) -> decode: ~p",[DecodedItem]),
-            Mod:decode_name(Opt, Type, DecodedItem)
-    end.
-
-verify_constraint(Item, valid) ->
-    Item;
-verify_constraint(Item, Constraint) when is_function(Constraint) ->
-    Constraint(Item).
-
-tr_message(MegaMsg, Mode, Config) ->
-    case Config of
-        [native] ->
-            MegaMsg;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_MegacoMessage(MegaMsg, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_MegacoMessage(MegaMsg, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_MegacoMessage(MegaMsg, State)
-    end.
-
-tr_transaction(Trans, Mode, Config) ->
-    case Config of
-        [native] ->
-            Trans;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_Transaction(Trans, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_Transaction(Trans, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_Transaction(Trans, State)
-    end.
-
-tr_MegacoMessage(#'MegacoMessage'{authHeader = Auth,
-                                  mess       = Mess},
-                 State) ->
-    ?d("tr_MegacoMessage -> entry with"
-       "~n   Auth:  ~p"
-       "~n   Mess:  ~p"
-       "~n   State: ~p", [Auth, Mess, State]),
-    #'MegacoMessage'{authHeader = tr_opt_AuthenticationHeader(Auth, State),
-                     mess       = tr_Message(Mess, State)}.
-
-tr_opt_AuthenticationHeader(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuthenticationHeader(#'AuthenticationHeader'{secParmIndex = SPI,
-                                                    seqNum       = SN,
-                                                    ad           = AuthData},
-                            State) ->
-    #'AuthenticationHeader'{secParmIndex = tr_SecurityParmIndex(SPI, State),
-                            seqNum       = tr_SequenceNum(SN, State),
-                            ad           = tr_AuthData(AuthData, State)}.
-
-tr_SecurityParmIndex(SPI, State) ->
-    tr_HEXDIG(SPI, State, 4, 4). % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_SequenceNum(SN, State) ->
-    tr_HEXDIG(SN, State, 4, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_AuthData(AuthData, State) ->
-    tr_HEXDIG(AuthData, State, 12, 32).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_Message(#'Message'{version     = Version,
-                      mId         = MID,
-                      messageBody = Body},
-           State) ->
-    #'Message'{version     = tr_version(Version, State),
-               mId         = tr_MId(MID, State),
-               messageBody = tr_Message_messageBody(Body, State)}.
-
-tr_version(Version, State) ->
-    tr_DIGIT(Version, State, 0, 99).
-
-tr_Message_messageBody({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            messageError -> tr_ErrorDescriptor(Val, State);
-            transactions when is_list(Val) -> [tr_Transaction(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_MId({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val,   State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_mtpAddress(MtpAddr, State) ->
-    tr_OCTET_STRING(MtpAddr, State, 2, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_DomainName(#'DomainName'{name       = Name,
-                            portNumber = Port},
-              State) ->
-    Domain = #'DomainName'{name       = tr_STRING(Name, State), % BUGBUG: Mismatch between ASN.1 and ABNF
-                           portNumber = tr_opt_portNumber(Port, State)},
-    {domainName, Domain2} = resolve(mid, {domainName, Domain}, State, valid),
-    Domain2.
-
-tr_IP4Address(#'IP4Address'{address    = [A1, A2, A3, A4],
-                            portNumber = Port},
-              State) ->
-    #'IP4Address'{address    = [tr_V4hex(A1, State),
-                                tr_V4hex(A2, State),
-                                tr_V4hex(A3, State),
-                                tr_V4hex(A4, State)],
-                  portNumber = tr_opt_portNumber(Port, State)}.
-
-tr_V4hex(Val, State) ->
-    tr_DIGIT(Val, State, 0, 255).
-
-tr_IP6Address(_Val, _State) ->
-    error(ipv6_not_supported). %% BUGBUG: nyi
-
-tr_PathName(Path, State) ->
-    %% BUGBUG: ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-    %% BUGBUG: ["@" pathDomainName ]
-    Constraint = fun({deviceName, Item}) -> tr_STRING(Item, State, 1, 64) end,
-    resolve(mid, {deviceName, Path}, State, Constraint).
-
-tr_Transaction({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionRequest ->     tr_TransactionRequest(Val, State);
-            transactionPending ->     tr_TransactionPending(Val, State);
-            transactionReply ->       tr_TransactionReply(Val, State);
-            transactionResponseAck -> [tr_TransactionAck(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_TransactionAck(#'TransactionAck'{firstAck = First,
-				    lastAck  = Last},
-                          State) ->
-    #'TransactionAck'{firstAck = tr_TransactionId(First, State),
-		      lastAck  = tr_opt_TransactionId(Last, State)}.
-
-tr_opt_TransactionId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TransactionId(Id, State) ->
-    tr_TransactionId(Id, State).
-
-tr_TransactionId(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_TransactionRequest(#'TransactionRequest'{transactionId = Id,
-                                            actions       = Actions},
-                      State) when is_list(Actions) ->
-
-    #'TransactionRequest'{transactionId = tr_TransactionId(Id, State),
-                          actions       = [tr_ActionRequest(ActReq, State) || ActReq <- Actions]}.
-
-tr_TransactionPending(#'TransactionPending'{transactionId = Id},
-                      State) ->
-    #'TransactionPending'{transactionId = tr_TransactionId(Id, State)}.
-
-tr_TransactionReply(#'TransactionReply'{transactionId        = Id,
-                                        immAckRequired       = ImmAck,
-                                        transactionResult    = TransRes,
-					%% These fields are actually not 
-					%% supported in this implementation,
-					%% but because the messanger module
-					%% cannot see any diff between the
-					%% various v3 implementations...
-					segmentNumber        = asn1_NOVALUE,
-					segmentationComplete = asn1_NOVALUE},
-                    State) ->
-    #'TransactionReply'{transactionId        = tr_TransactionId(Id, State),
-                        immAckRequired       = tr_opt_null(ImmAck, State),
-                        transactionResult    = tr_TransactionReply_transactionResult(TransRes, State),
-			segmentNumber        = asn1_NOVALUE,
-			segmentationComplete = asn1_NOVALUE};
-tr_TransactionReply(TR, _State) ->
-    error({unsupported_TransactionReply, TR}).
-
-tr_opt_null(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_null('NULL', _State)       -> 'NULL'.
-
-tr_TransactionReply_transactionResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionError ->
-                tr_ErrorDescriptor(Val, State);
-            actionReplies when is_list(Val) andalso (Val =/= []) ->
-                [tr_ActionReply(ActRep, State) || ActRep <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_opt_ErrorDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ErrorDescriptor(ErrDesc, State) ->
-    tr_ErrorDescriptor(ErrDesc, State).
-
-tr_ErrorDescriptor(#'ErrorDescriptor'{errorCode = Code,
-                                      errorText = Text},
-                   State) ->
-    #'ErrorDescriptor'{errorCode = tr_ErrorCode(Code, State),
-                       errorText = tr_opt_ErrorText(Text, State)}.
-
-tr_ErrorCode(Code, State) ->
-    tr_DIGIT(Code, State, 0, 999).
-
-tr_opt_ErrorText(asn1_NOVALUE, _State)  ->
-    asn1_NOVALUE;
-tr_opt_ErrorText(Text, State)  ->
-    tr_QUOTED_STRING(Text, State).
-
-tr_ContextID(CtxId, State) ->
-    case CtxId of
-        ?megaco_all_context_id    -> ?megaco_all_context_id;
-        ?megaco_null_context_id   -> ?megaco_null_context_id;
-        ?megaco_choose_context_id -> ?megaco_choose_context_id;
-        Int when is_integer(Int)  -> tr_UINT32(Int, State)
-    end.
-
-tr_ActionRequest(#'ActionRequest'{contextId           = CtxId,
-                                  contextRequest      = CtxReq,
-                                  contextAttrAuditReq = CtxAuditReq,
-                                  commandRequests     = CmdReqList},
-                 State) ->
-    #'ActionRequest'{contextId           = tr_ContextID(CtxId, State),
-                     contextRequest      = tr_opt_ContextRequest(CtxReq, State),
-                     contextAttrAuditReq = tr_opt_ContextAttrAuditRequest(CtxAuditReq, State),
-                     commandRequests     = [tr_CommandRequest(CmdReq, State) || CmdReq <- CmdReqList]}.
-
-tr_ActionReply(#'ActionReply'{contextId       = CtxId,
-                              errorDescriptor = ErrDesc,
-                              contextReply    = CtxRep,
-                              commandReply    = CmdRepList},
-               State) ->
-    CmdRepList2 = [tr_CommandReply(CmdRep, State) || CmdRep <- CmdRepList],
-    #'ActionReply'{contextId       = tr_ContextID(CtxId, State),
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State),
-                   contextReply    = tr_opt_ContextRequest(CtxRep, State),
-                   commandReply    = CmdRepList2}.
-
-tr_opt_ContextRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextRequest(CR, State) ->
-    tr_ContextRequest(CR, State).
-
-tr_ContextRequest(#'ContextRequest'{priority    = Prio,
-				    emergency   = Em,
-				    topologyReq = TopReqList,
-				    iepsCallind = Ind,
-				    contextProp = Props},
-		  State) ->
-    Prio2 = 
-        case Prio of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_integer(Prio, State, 0, 15)
-        end,
-    Em2 = 
-        case Em of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    TopReqList2 = 
-        case TopReqList of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_TopologyRequest(TopReq, State) ||
-                                TopReq <- TopReqList]
-        end,
-    Ind2 = 
-	case Ind of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    Props2 = 
-	case Props of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_PropertyParm(Prop, State) || Prop <- Props]
-	end,
-    #'ContextRequest'{priority    = Prio2,
-                      emergency   = Em2,
-                      topologyReq = TopReqList2,
-		      iepsCallind = Ind2,
-		      contextProp = Props2}.
-
-tr_opt_ContextAttrAuditRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextAttrAuditRequest(CAAR, State) ->
-    tr_ContextAttrAuditRequest(CAAR, State).
-
-tr_ContextAttrAuditRequest(#'ContextAttrAuditRequest'{topology       = Top,
-						      emergency      = Em,
-						      priority       = Prio,
-						      iepsCallind    = Ind,
-						      contextPropAud = Props},
-                               State) ->
-    Top2   = tr_opt_null(Top,  State),
-    Em2    = tr_opt_null(Em,   State),
-    Prio2  = tr_opt_null(Prio, State),
-    Ind2   = tr_opt_null(Ind,  State),
-    Props2 = 
-	case Props of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _            -> 
-		[tr_indAudPropertyParm(Prop, State) || Prop <- Props]
-	end,
-    #'ContextAttrAuditRequest'{topology       = Top2,
-                               emergency      = Em2, 
-                               priority       = Prio2, 
-			       iepsCallind    = Ind2, 
-			       contextPropAud = Props2}.
-
-tr_CommandRequest(#'CommandRequest'{command        = Cmd,
-                                    optional       = Opt,
-                                    wildcardReturn = Wild},
-                  State) ->
-    #'CommandRequest'{optional       = tr_opt_null(Opt, State),
-                      wildcardReturn = tr_opt_null(Wild, State),
-                      command        = tr_Command(Cmd, State)}.
-
-tr_Command({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReq ->            tr_AmmRequest(Val, State);
-            moveReq ->           tr_AmmRequest(Val, State);
-            modReq ->            tr_AmmRequest(Val, State);
-            subtractReq ->       tr_SubtractRequest(Val, State);
-            auditCapRequest ->   tr_AuditRequest(Val, State);
-            auditValueRequest -> tr_AuditRequest(Val, State);
-            notifyReq ->         tr_NotifyRequest(Val, State);
-            serviceChangeReq ->  tr_ServiceChangeRequest(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_CommandReply({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReply ->           tr_AmmsReply(Val, State);
-            moveReply ->          tr_AmmsReply(Val, State);
-            modReply ->           tr_AmmsReply(Val, State);
-            subtractReply ->      tr_AmmsReply(Val, State);
-            auditCapReply ->      tr_AuditReply(Val, State);
-            auditValueReply ->    tr_AuditReply(Val, State);
-            notifyReply ->        tr_NotifyReply(Val, State);
-            serviceChangeReply -> tr_ServiceChangeReply(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_TopologyRequest(#'TopologyRequest'{terminationFrom   = From,
-                                      terminationTo     = To,
-                                      topologyDirection = Dir},
-                   State) ->
-    Dir2 = 
-        case Dir of
-            bothway -> bothway;
-            isolate -> isolate;
-            oneway ->  oneway
-        end,
-    #'TopologyRequest'{terminationFrom   = tr_TerminationID(From, State),
-                       terminationTo     = tr_TerminationID(To, State),
-                       topologyDirection = Dir2}.
-
-tr_AmmRequest(#'AmmRequest'{terminationID = IdList,
-                            descriptors   = DescList},
-              State) ->
-    #'AmmRequest'{terminationID = [tr_TerminationID(Id, State) || 
-				      Id <- IdList],
-                  descriptors   = tr_ammDescriptors(DescList, [], State)}.
-
-tr_ammDescriptors([], Acc, _State) ->
-    lists:reverse(Acc);
-tr_ammDescriptors([Desc|Descs], Acc, State) ->
-    case tr_ammDescriptor(Desc, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Desc});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	NewDesc ->
-	    tr_ammDescriptors(Descs, [NewDesc|Acc], State)
-    end.
-
-tr_ammDescriptor({Tag, Desc}, State) ->
-    Desc2 = 
-        case Tag of
-            mediaDescriptor       -> tr_MediaDescriptor(Desc, State);
-            modemDescriptor       -> tr_ModemDescriptor(Desc, State);      
-            muxDescriptor         -> tr_MuxDescriptor(Desc, State);   
-            eventsDescriptor      -> tr_EventsDescriptor(Desc, State);      
-            eventBufferDescriptor -> tr_EventBufferDescriptor(Desc, State); 
-            signalsDescriptor     -> tr_SignalsDescriptor(Desc, State);    
-            digitMapDescriptor    -> tr_DigitMapDescriptor(Desc, State);    
-            auditDescriptor       -> tr_AuditDescriptor(Desc, State);
-	    statisticsDescriptor  -> tr_StatisticsDescriptor(Desc, State)
-        end,
-    {Tag, Desc2}.
-
-tr_AmmsReply(#'AmmsReply'{terminationID    = IdList,
-                          terminationAudit = TermAudit},
-             State) ->
-    TermAudit2 =
-        case TermAudit of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_TerminationAudit(TermAudit, State)
-        end,
-    #'AmmsReply'{terminationID    = [tr_TerminationID(Id, State) ||
-                                        Id <- IdList],
-                 terminationAudit = TermAudit2}.
-
-tr_SubtractRequest(#'SubtractRequest'{terminationID   = IdList,
-                                      auditDescriptor = Desc},
-                   State) ->
-    #'SubtractRequest'{terminationID   = [tr_TerminationID(Id, State) ||
-                                             Id <- IdList],
-                       auditDescriptor = tr_opt_AuditDescriptor(Desc, State)}.
-
-tr_AuditRequest(#'AuditRequest'{terminationID   = Id,
-                                auditDescriptor = Desc},
-                State) ->
-    #'AuditRequest'{terminationID = tr_TerminationID(Id, State),
-                    auditDescriptor = tr_AuditDescriptor(Desc, State)}.
-
-%% auditReply           = (AuditValueToken / AuditCapToken ) 
-%%                        ( contextTerminationAudit  / auditOther)
-%% auditOther           = EQUAL TerminationID LBRKT 
-%%                        terminationAudit RBRKT
-%% terminationAudit     = auditReturnParameter *(COMMA auditReturnParameter) 
-%% 
-%% contextTerminationAudit = EQUAL CtxToken ( terminationIDList / 
-%%                        LBRKT errorDescriptor RBRKT )
-
-tr_AuditReply({Tag, Val}, State) ->
-    Val2 =
-	case Tag of
-	    contextAuditResult ->
-		[tr_TerminationID(Id, State) || Id <- Val];
-	    error ->
-		tr_ErrorDescriptor(Val, State);
-	    auditResult ->
-		tr_AuditResult(Val, State)
-	end,
-    {Tag, Val2}.
-
-tr_AuditResult(#'AuditResult'{terminationID          = Id,
-			      terminationAuditResult = AuditRes},
-              State) ->
-    #'AuditResult'{terminationID          = tr_TerminationID(Id, State),
-		   terminationAuditResult = tr_TerminationAudit(AuditRes, State)}.
-
-tr_opt_AuditDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuditDescriptor(Desc, State) ->
-    tr_AuditDescriptor(Desc, State).
-
-%% BUGBUG BUGBUG BUGBUG 
-%% With this construction it is possible to have both auditToken
-%% and auditPropertyToken, but it is actually valid?
-tr_AuditDescriptor(#'AuditDescriptor'{auditToken         = Tokens,
-				      auditPropertyToken = APTs},
-                   State) ->
-    Tokens2 = 
-	case Tokens of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-	    _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-	end,
-    %% v2
-    APTs2 = 
-	case APTs of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		[tr_indAuditParameter(APT, State) || APT <- APTs]
-	end,
-    #'AuditDescriptor'{auditToken         = Tokens2,
-		       auditPropertyToken = APTs2}.  
-
-tr_auditItem(Token, _State) ->
-    case Token of
-        muxToken            -> muxToken;
-        modemToken          -> modemToken;
-        mediaToken          -> mediaToken;
-        eventsToken         -> eventsToken;
-        signalsToken        -> signalsToken;
-        digitMapToken       -> digitMapToken;
-        statsToken          -> statsToken;
-        observedEventsToken -> observedEventsToken;
-        packagesToken       -> packagesToken;
-        eventBufferToken    -> eventBufferToken
-    end.
-
-%% --- v2 begin ---
-
-tr_indAuditParameter({Tag, Val}, State) ->
-    Val2 = 
-	case Tag of
-	    indAudMediaDescriptor       -> 
-		tr_indAudMediaDescriptor(Val, State);
-	    indAudEventsDescriptor      -> 
-		tr_indAudEventsDescriptor(Val, State);
-	    indAudSignalsDescriptor     -> 
-		tr_indAudSignalsDescriptor(Val, State);
-	    indAudDigitMapDescriptor    -> 
-		tr_indAudDigitMapDescriptor(Val, State);
-	    indAudEventBufferDescriptor -> 
-		tr_indAudEventBufferDescriptor(Val, State);
-	    indAudStatisticsDescriptor  -> 
-		tr_indAudStatisticsDescriptor(Val, State);
-	    indAudPackagesDescriptor    -> 
-		tr_indAudPackagesDescriptor(Val, State)
-	end,
-    {Tag, Val2}.
-
-
-%% -
-
-tr_indAudMediaDescriptor(#'IndAudMediaDescriptor'{termStateDescr = TSD,
-						  streams        = S}, 
-			 State) ->
-    TSD2 = 
-	case TSD of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		tr_indAudTerminationStateDescriptor(TSD, State)
-	end,
-    S2 = 
-	case S of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    {oneStream, OS} ->
-		{oneStream, tr_indAudStreamParms(OS, State)};
-	    {multiStream, MS} ->
-		MS2 = [tr_indAudStreamDescriptor(MS1, State) || MS1 <- MS],
-		{multiStream, MS2}
-	end,
-    #'IndAudMediaDescriptor'{termStateDescr = TSD2,
-			     streams        = S2}.
-
-tr_indAudTerminationStateDescriptor(Val, State) 
-  when is_record(Val, 'IndAudTerminationStateDescriptor') ->
-    #'IndAudTerminationStateDescriptor'{propertyParms      = Parms,
-					eventBufferControl = EBC,
-					serviceState       = SS} = Val,
-    Parms2 = [tr_indAudPropertyParm(Parm, State) || Parm <- Parms],
-    EBC2   = tr_opt_null(EBC, State),
-    SS2    = tr_opt_null(SS, State),
-    #'IndAudTerminationStateDescriptor'{propertyParms = Parms2, 
-					eventBufferControl = EBC2,
-					serviceState       = SS2}.
-
-    
-tr_indAudStreamParms(#'IndAudStreamParms'{localControlDescriptor = LCD, 
-					  localDescriptor        = LD, 
-					  remoteDescriptor       = RD,
-					  statisticsDescriptor   = SD}, 
-		     State) ->
-    LCD2 = 
-	case LCD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalControlDescriptor(LCD, State)
-	end,
-    LD2 = 
-	case LD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(LD, State)
-	end,
-    RD2 = 
-	case RD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(RD, State)
-	end,
-    SD2 = 
-	case SD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudStatisticsDescriptor(SD, State)
-	end,
-    #'IndAudStreamParms'{localControlDescriptor = LCD2, 
-			 localDescriptor        = LD2, 
-			 remoteDescriptor       = RD2,
-			 statisticsDescriptor   = SD2}.
-    
-tr_indAudLocalControlDescriptor(Val, State) 
-  when is_record(Val, 'IndAudLocalControlDescriptor') ->
-    #'IndAudLocalControlDescriptor'{streamMode    = M,
-				    reserveValue  = V,
-				    reserveGroup  = G,
-				    propertyParms = P} = Val,
-    M2 = tr_opt_null(M, State),
-    V2 = tr_opt_null(V, State),
-    G2 = tr_opt_null(G, State),
-    P2 = tr_indAudLocalControlDescriptor_propertyParms(P, State),
-    #'IndAudLocalControlDescriptor'{streamMode    = M2,
-				    reserveValue  = V2,
-				    reserveGroup  = G2,
-				    propertyParms = P2}.
-
-tr_indAudLocalControlDescriptor_propertyParms(Parms, State) 
-  when is_list(Parms) andalso (length(Parms) > 0) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Parms];
-tr_indAudLocalControlDescriptor_propertyParms(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE.
-
-tr_indAudLocalRemoteDescriptor(#'IndAudLocalRemoteDescriptor'{propGroupID = ID,
-							      propGrps = Grps},
-			       State) ->
-    #'IndAudLocalRemoteDescriptor'{propGroupID = tr_opt_UINT16(ID, State),
-				   propGrps = tr_indAudPropertyGroup(Grps, 
-								     State)}.
-
-tr_indAudPropertyGroup(Grps, State) when is_list(Grps) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Grps].
-
-tr_indAudPropertyParm(#'IndAudPropertyParm'{name = Name0}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(property, Name0, State, Constraint),
-    #'IndAudPropertyParm'{name = Name}.
-
-
-tr_indAudStreamDescriptor(#'IndAudStreamDescriptor'{streamID = ID,
-						    streamParms = Parms},
-			  State) ->
-    #'IndAudStreamDescriptor'{streamID    = tr_StreamID(ID, State),
-			      streamParms = tr_indAudStreamParms(Parms, 
-								 State)}.
-
-
-%% -
-
-tr_indAudEventsDescriptor(#'IndAudEventsDescriptor'{requestID = RID,
-						    pkgdName  = Name0,
-						    streamID  = SID},
-			  State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, Name0, State, Constraint),
-    #'IndAudEventsDescriptor'{requestID = tr_opt_RequestID(RID, State),
-			      pkgdName  = Name, 
-			      streamID  = tr_opt_StreamID(SID, State)}.
-
-
-%% -
-
-tr_indAudSignalsDescriptor({Tag, Val}, State) ->
-    case Tag of
-	signal ->
-	    {signal, tr_indAudSignal(Val, State)};
-	seqSigList ->
-	    {seqSigList, tr_indAudSeqSigList(Val, State)}
-    end.
-
-tr_opt_indAudSignal(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_indAudSignal(Val, State) ->
-    tr_indAudSignal(Val, State).
-
-tr_indAudSignal(#'IndAudSignal'{signalName = Name0,
-				streamID   = SID}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(signal, Name0, State, Constraint),
-    #'IndAudSignal'{signalName = Name, 
-		    streamID   = tr_opt_StreamID(SID, State)}.
-
-tr_indAudSeqSigList(#'IndAudSeqSigList'{id = ID,
-					signalList = SigList}, State) ->
-    #'IndAudSeqSigList'{id = tr_integer(ID, State, 0, 65535),
-			signalList = tr_opt_indAudSignal(SigList, State)}.
-
-%% -
-
-tr_indAudDigitMapDescriptor(#'IndAudDigitMapDescriptor'{digitMapName = Name},
-			    State) ->
-    #'IndAudDigitMapDescriptor'{digitMapName = 
-				tr_opt_DigitMapName(Name, State)}.
-
-
-%% -
-
-tr_indAudEventBufferDescriptor(#'IndAudEventBufferDescriptor'{eventName = N,
-							      streamID  = SID},
-			       State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p"
-       "~n   SID: ~p", [N, SID]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, N, State, Constraint),
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudEventBufferDescriptor'{eventName = Name,
-				   streamID  = tr_opt_StreamID(SID, State)}.
-
-%% -
-
-tr_indAudStatisticsDescriptor(#'IndAudStatisticsDescriptor'{statName = N},
-			      State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p", [N]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(statistics, N, State, Constraint),
-    #'IndAudStatisticsDescriptor'{statName = Name}.
-
-
-%% -
-
-tr_indAudPackagesDescriptor(#'IndAudPackagesDescriptor'{packageName    = N,
-							packageVersion = V}, 
-			    State) ->
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   N: ~p"
-       "~n   V: ~p", [N, V]),
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    Name = resolve(package, N, State, Constraint),
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudPackagesDescriptor'{packageName = Name, 
-				packageVersion = tr_integer(V, State, 0, 99)}.
-
-%% -- v2 end --
-
-
-tr_TerminationAudit(ParmList, State) when is_list(ParmList) ->
-    do_tr_TerminationAudit(ParmList, [], State).
-
-do_tr_TerminationAudit([], Acc, _State) ->
-    lists:reverse(Acc);
-do_tr_TerminationAudit([Parm|ParmList], Acc, State) ->
-    case tr_AuditReturnParameter(Parm, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Parm});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	NewParm ->
-	    do_tr_TerminationAudit(ParmList, [NewParm|Acc], State)
-    end.
-
-tr_AuditReturnParameter({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor ->
-                tr_ErrorDescriptor(Val, State);
-            mediaDescriptor ->
-                tr_MediaDescriptor(Val, State);
-            modemDescriptor ->
-                tr_ModemDescriptor(Val, State);
-            muxDescriptor ->
-                tr_MuxDescriptor(Val, State);
-            eventsDescriptor ->
-                tr_EventsDescriptor(Val, State);
-            eventBufferDescriptor ->
-                tr_EventBufferDescriptor(Val, State);
-            signalsDescriptor ->
-                tr_SignalsDescriptor(Val, State);
-            digitMapDescriptor ->
-                tr_DigitMapDescriptor(Val, State);
-            observedEventsDescriptor ->
-                tr_ObservedEventsDescriptor(Val, State);
-            statisticsDescriptor ->
-                tr_StatisticsDescriptor(Val, State);
-            packagesDescriptor ->
-                tr_PackagesDescriptor(Val, State);
-            emptyDescriptors ->
-                tr_EmptyDescriptors(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_EmptyDescriptors(#'AuditDescriptor'{auditToken = Tokens},
-                    State) ->
-    case Tokens of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-    end.
-
-tr_NotifyRequest(#'NotifyRequest'{terminationID            = IdList,
-                                  observedEventsDescriptor = ObsDesc,
-                                  errorDescriptor          = ErrDesc},
-                 State) ->
-    %% BUGBUG: Mismatch between ASN.1 and ABNF
-    %% BUGBUG: The following ought to be a 'choice'
-    #'NotifyRequest'{terminationID            = [tr_TerminationID(Id, State) ||
-                                                    Id <- IdList],
-                     observedEventsDescriptor = tr_ObservedEventsDescriptor(ObsDesc, State),
-                     errorDescriptor          = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_NotifyReply(#'NotifyReply'{terminationID   = IdList,
-                              errorDescriptor = ErrDesc},
-               State) ->
-    #'NotifyReply'{terminationID   = [tr_TerminationID(Id, State) || Id <- IdList],
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_ObservedEventsDescriptor(#'ObservedEventsDescriptor'{requestId        = Id,
-                                                        observedEventLst = Events},
-                            State) when is_list(Events) ->
-    #'ObservedEventsDescriptor'{requestId        = tr_RequestID(Id, State),
-                                observedEventLst = [tr_ObservedEvent(E, State) || E <- Events]}.
-
-%% ;time per event, because it might be buffered
-%% observedEvent        = [ TimeStamp LWSP COLON] LWSP 
-%%                        pkgdName [ LBRKT observedEventParameter
-%%                        *(COMMA observedEventParameter) RBRKT ]
-%% 
-%% ;at-most-once eventStream, every eventParameterName at most once
-%% observedEventParameter = eventStream / eventOther
-
-tr_ObservedEvent(#'ObservedEvent'{eventName    = Name,
-                                  streamID     = Id,
-                                  eventParList = Parms,
-                                  timeNotation = Time},
-                 State) ->
-    #'ObservedEvent'{eventName    = tr_EventName(Name, State),
-                     streamID     = tr_opt_StreamID(Id, State),
-                     eventParList = [tr_EventParameter(P, Name, State) || P <- Parms],
-                     timeNotation = tr_opt_TimeNotation(Time, State)}.
-
-tr_EventName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(event, Name, State, Constraint).
-
-tr_EventParameter(#'EventParameter'{eventParameterName = ParName,
-                                    value              = Value,
-				    extraInfo          = Extra},
-		  EventName,
-                  State) ->
-    %% BUGBUG: event parameter name
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({event_parameter, EventName}, ParName, State, Constraint),
-    #'EventParameter'{eventParameterName = N,
-		      value              = tr_Value(Value, State),
-		      extraInfo          = tr_opt_extraInfo(Extra, State)}.
-
-tr_ServiceChangeRequest(#'ServiceChangeRequest'{terminationID      = IdList,
-                                                serviceChangeParms = Parms},
-                        State) ->
-    #'ServiceChangeRequest'{terminationID      = [tr_TerminationID(Id, State) || Id <- IdList],
-                            serviceChangeParms = tr_ServiceChangeParm(Parms, State)}.
-
-%% serviceChangeReply   = ServiceChangeToken EQUAL TerminationID
-%%                        [LBRKT (errorDescriptor / 
-%%                        serviceChangeReplyDescriptor) RBRKT]
-%% serviceChangeReplyDescriptor = ServicesToken LBRKT
-%%                        servChgReplyParm *(COMMA servChgReplyParm) RBRKT
-%% 
-%% ;at-most-once. Version is REQUIRED on first ServiceChange response
-%% servChgReplyParm     = (serviceChangeAddress / serviceChangeMgcId /
-%%                        serviceChangeProfile / serviceChangeVersion )
-tr_ServiceChangeReply(#'ServiceChangeReply'{terminationID       = IdList,
-                                            serviceChangeResult = Res},
-                      State) ->
-    #'ServiceChangeReply'{terminationID       = [tr_TerminationID(Id, State) || Id <- IdList],
-                          serviceChangeResult = tr_ServiceChangeResult(Res, State)}.
-
-tr_ServiceChangeResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor       -> tr_ErrorDescriptor(Val, State);
-            serviceChangeResParms -> tr_ServiceChangeResParm(Val, State)
-        end,
-    {Tag, Val2}.
-
-%% TerminationID        = "ROOT" / pathNAME / "$" / "*"
-%% ; Total length of pathNAME must not exceed 64 chars.
-%% pathNAME             = ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-%%                        ["@" pathDomainName ]
-
-tr_TerminationID(TermId, State) when State#state.mode =/= verify ->
-    resolve(term_id, TermId, State, valid);
-tr_TerminationID(#'TerminationID'{wildcard = Wild,
-                                  id       = Id},
-                 _State) ->
-    #'TerminationID'{wildcard = Wild,
-                     id       = Id};
-tr_TerminationID(#megaco_term_id{contains_wildcards = IsWild,
-                                 id                 = Id},
-                 State) ->
-    #megaco_term_id{contains_wildcards = tr_bool(IsWild, State),
-                    id                 = [tr_term_id_component(Sub, State) || Sub <- Id]}.
-
-tr_opt_bool(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_bool(Bool, State)         -> tr_bool(Bool, State).
-
-tr_bool(true, _State)  -> true;
-tr_bool(false, _State) -> false.
-
-tr_term_id_component(Sub, _State) ->
-    case Sub of
-        all    -> all;
-        choose -> choose;
-        Char when is_integer(Char) -> Char
-    end.
-
-%% mediaDescriptor      = MediaToken LBRKT mediaParm *(COMMA mediaParm) RBRKT
-%% ; at-most-once per item
-%% ; and either streamParm or streamDescriptor but not both
-%% mediaParm            = (streamParm / streamDescriptor / 
-%%                         terminationStateDescriptor)
-%% ; at-most-once
-%% streamParm           = ( localDescriptor / remoteDescriptor / 
-%%                         localControlDescriptor )
-%% streamDescriptor     = StreamToken EQUAL StreamID LBRKT streamParm 
-%%                        *(COMMA streamParm) RBRKT
-tr_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TermState,
-                                      streams        = Streams},
-                   State) ->
-    #'MediaDescriptor'{termStateDescr = tr_opt_TerminationStateDescriptor(TermState, State),
-                       streams        = tr_opt_streams(Streams, State)}.
-
-tr_opt_streams(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_streams({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            oneStream   -> tr_StreamParms(Val, State);
-            multiStream -> [tr_StreamDescriptor(SD, State) || SD <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_StreamParms(#'StreamParms'{localControlDescriptor = LCD,
-                              localDescriptor        = LD,
-                              remoteDescriptor       = RD,
-			      statisticsDescriptor   = SD},
-               State) ->
-    LCD2 = tr_opt_LocalControlDescriptor(LCD, State),
-    LD2  = tr_opt_LocalRemoteDescriptor(LD,   State),
-    RD2  = tr_opt_LocalRemoteDescriptor(RD,   State),
-    SD2  = tr_opt_StatisticsDescriptor(SD,    State),
-    #'StreamParms'{localControlDescriptor = LCD2,
-                   localDescriptor        = LD2,
-                   remoteDescriptor       = RD2,
-		   statisticsDescriptor   = SD2}.
-
-tr_StreamDescriptor(#'StreamDescriptor'{streamID    = Id,
-                                        streamParms = Parms},
-                    State) ->
-    #'StreamDescriptor'{streamID    = tr_StreamID(Id, State),
-                        streamParms = tr_StreamParms(Parms, State)}.
-
-%% localControlDescriptor = LocalControlToken LBRKT localParm 
-%%                          *(COMMA localParm) RBRKT
-%% 
-%% ; at-most-once per item
-%% localParm            = ( streamMode / propertyParm /
-%%                          reservedValueMode  / reservedGroupMode ) 
-%% reservedValueMode       = ReservedValueToken EQUAL ( "ON" / "OFF" ) 
-%% reservedGroupMode       = ReservedGroupToken EQUAL ( "ON" / "OFF" ) 
-%% 
-%% reservedMode      = ReservedToken EQUAL ( "ON" / "OFF" )
-%% 
-%% streamMode           = ModeToken EQUAL streamModes
-tr_opt_LocalControlDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = Mode,
-                                                        reserveGroup  = Group,
-                                                        reserveValue  = Value,
-                                                        propertyParms = Props},
-                              State) ->
-    #'LocalControlDescriptor'{streamMode    = tr_opt_StreamMode(Mode, State),
-                              reserveGroup  = tr_opt_bool(Group, State),
-                              reserveValue  = tr_opt_bool(Value, State),
-                              propertyParms = [tr_PropertyParm(P, State) || P <- Props]}.
-
-tr_opt_StreamMode(Mode, _State) ->
-    case Mode of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        sendOnly     -> sendOnly;
-        recvOnly     -> recvOnly;
-        sendRecv     -> sendRecv;
-        inactive     -> inactive;
-        loopBack     -> loopBack
-    end.
-
-tr_Name(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" )
-    tr_STRING(Name, State, 2, 2).
-
-tr_PkgdName(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG:  pkgdName =  (NAME / "*")  SLASH  (ItemID / "*" )
-    tr_OCTET_STRING(Name, State, 4, 4).
-
-%% When text encoding the protocol, the descriptors consist of session
-%% descriptions as defined in SDP (RFC2327), except that the "s=", "t="
-%% and "o=" lines are optional. When multiple session descriptions are
-%% provided in one descriptor, the "v=" lines are required as delimiters;
-%% otherwise they are optional.  Implementations shall accept session
-%% descriptions that are fully conformant to RFC2327. When binary
-%% encoding the protocol the descriptor consists of groups of properties
-%% (tag-value pairs) as specified in Annex C.  Each such group may
-%% contain the parameters of a session description.
-tr_opt_LocalRemoteDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = Groups},
-                             State) ->
-    #'LocalRemoteDescriptor'{propGrps = [tr_PropertyGroup(G, State) || G <- Groups]}.
-
-tr_PropertyGroup(Props, State) ->
-    [tr_PropertyGroupParm(P, State) || P <- Props].
-
-tr_PropertyGroupParm(#'PropertyParm'{name  = Name,
-                                     value = Value},
-                     State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name  = resolve(property, Name, State, Constraint),
-                    value = tr_OCTET_STRING(Value, State, 0, infinity)}.
-
-tr_PropertyParm(#'PropertyParm'{name      = Name,
-                                value     = Value,
-                                extraInfo = Extra},
-                State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name      = resolve(property, Name, State, Constraint),
-                    value     = tr_Value(Value, State),
-                    extraInfo = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_extraInfo(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_extraInfo({relation, Rel}, _State) ->
-    Rel2 = 
-        case Rel of
-            greaterThan -> greaterThan;
-            smallerThan -> smallerThan;
-            unequalTo   -> unequalTo
-        end,
-    {relation, Rel2};
-tr_opt_extraInfo({range, Range}, State) ->
-    Range2 = tr_bool(Range, State),
-    {range, Range2};
-tr_opt_extraInfo({sublist, Sub}, State) ->
-    Sub2 = tr_bool(Sub, State),
-    {sublist, Sub2}.
-
-tr_opt_TerminationStateDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TerminationStateDescriptor(#'TerminationStateDescriptor'{propertyParms      = Props,
-                                                                eventBufferControl = Control,
-                                                                serviceState       = Service},
-                                  State) ->
-    #'TerminationStateDescriptor'{propertyParms      = [tr_PropertyParm(P, State) || P <- Props],
-                                  eventBufferControl = tr_opt_EventBufferControl(Control, State),
-                                  serviceState       = tr_opt_ServiceState(Service, State)}.
-
-tr_opt_EventBufferControl(Control, _State) ->
-    case Control of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        off          -> off;
-        lockStep     -> lockStep
-    end.
-
-tr_opt_ServiceState(Service, _State) ->
-    case Service of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        test         -> test;
-        outOfSvc     -> outOfSvc;
-        inSvc        -> inSvc
-    end.
-
-tr_MuxDescriptor(#'MuxDescriptor'{muxType  = Type,
-                                  termList = IdList},
-                 State) ->
-    #'MuxDescriptor'{muxType  = tr_MuxType(Type, State),
-                     termList = [tr_TerminationID(Id, State) || Id <- IdList]}.
-
-tr_MuxType(Type, _State) ->
-    case Type of
-        h221 -> h221;
-        h223 -> h223;
-        h226 -> h226;
-        v76  -> v76
-    end.
-
-tr_opt_StreamID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StreamID(Id, State) ->
-    tr_StreamID(Id, State).
-
-tr_StreamID(Id, State) ->
-    tr_UINT16(Id, State).
-
-tr_EventsDescriptor(#'EventsDescriptor'{requestID = Id,
-                                        eventList = Events},
-                    State) ->
-    #'EventsDescriptor'{requestID = tr_opt_RequestID(Id, State),
-                        eventList = [tr_RequestedEvent(E, State) || E <- Events]}.
-
-tr_RequestedEvent(#'RequestedEvent'{pkgdName    = Name,
-                                    streamID    = Id,
-                                    evParList   = Parms,
-                                    eventAction = Actions},
-                  State)  ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'RequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                      streamID    = tr_opt_StreamID(Id, State),
-                      eventAction = tr_opt_RequestedActions(Actions, State),
-                      evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_opt_RequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestedActions(#'RequestedActions'{keepActive        = Keep,
-                                            eventDM           = DM,
-                                            secondEvent       = Event,
-                                            signalsDescriptor = SigDesc},
-                        State) ->
-    #'RequestedActions'{keepActive        = tr_opt_keepActive(Keep, State),
-                        eventDM           = tr_opt_EventDM(DM, State),
-                        secondEvent       = tr_opt_SecondEventsDescriptor(Event, State),
-                        signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.
-
-tr_opt_keepActive(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_keepActive(Keep, State) ->
-    tr_bool(Keep, State).
-
-tr_opt_EventDM(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_EventDM({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            digitMapName  -> tr_DigitMapName(Val, State);
-            digitMapValue -> tr_DigitMapValue(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_SecondEventsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = Id,
-                                                        eventList = Events},
-                              State) ->
-    #'SecondEventsDescriptor'{requestID = tr_RequestID(Id, State), %% IG v6 6.8 withdrawn
-                              eventList = [tr_SecondRequestedEvent(E, State) || E <- Events]}.
-
-tr_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = Name,
-                                                streamID    = Id,
-                                                evParList   = Parms,
-                                                eventAction = Actions},
-                        State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'SecondRequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                            streamID    = tr_opt_StreamID(Id, State),
-                            eventAction = tr_opt_SecondRequestedActions(Actions, State),
-                            evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-
-tr_opt_SecondRequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondRequestedActions(#'SecondRequestedActions'{keepActive        = Keep,
-                                                        eventDM           = DM,
-                                                        signalsDescriptor = SigDesc},
-                              State) ->
-    #'SecondRequestedActions'{keepActive        = tr_opt_keepActive(Keep, State),
-                              eventDM           = tr_opt_EventDM(DM, State),
-                              signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.
-
-tr_EventBufferDescriptor(EventSpecs, State) ->
-    [tr_EventSpec(ES, State) || ES <- EventSpecs].
-
-tr_EventSpec(#'EventSpec'{eventName    = Name,
-                          streamID     = Id,
-                          eventParList = Parms},
-             State) ->
-    #'EventSpec'{eventName    = tr_EventName(Name, State),
-                 streamID     = tr_opt_StreamID(Id, State),
-                 eventParList = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_opt_SignalsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SignalsDescriptor(SigDesc, State) ->
-    tr_SignalsDescriptor(SigDesc, State).
-
-tr_SignalsDescriptor(SigDesc, State)  when is_list(SigDesc) ->
-    [tr_SignalRequest(SigReq, State) || SigReq <- SigDesc].
-
-tr_SignalRequest({Tag, Val}, State) ->
-    Val2 =
-        case Tag of
-            signal     -> tr_Signal(Val, State);
-            seqSigList -> tr_SeqSigList(Val, State)
-        end,
-    {Tag, Val2}.
-
-
-tr_SeqSigList(#'SeqSigList'{id         = Id,
-                            signalList = SigList},
-              State) when is_list(SigList) ->
-    #'SeqSigList'{id         = tr_UINT16(Id, State),
-                  signalList = [tr_Signal(Sig, State) || Sig <- SigList]}.
-
-tr_Signal(#'Signal'{signalName       = Name,
-                    streamID         = SID,
-                    sigType          = Type,
-                    duration         = Dur,
-                    notifyCompletion = Compl,
-                    keepActive       = Keep,
-                    sigParList       = Parms,
-		    direction        = Dir,
-		    requestID        = RID},
-          State) ->
-    Name2  = tr_SignalName(Name, State),
-    SID2   = tr_opt_StreamID(SID, State),
-    Type2  = tr_opt_SignalType(Type, State),
-    Dur2   = tr_opt_duration(Dur, State),
-    Compl2 = tr_opt_NotifyCompletion(Compl, State),
-    Keep2  = tr_opt_keepActive(Keep, State),
-    Parms2 = [tr_SigParameter(P, Name, State) || P <- Parms],
-    Dir2   = tr_opt_SignalDirection(Dir, State),
-    RID2   = tr_opt_RequestID(RID, State),
-    #'Signal'{signalName       = Name2,
-              streamID         = SID2, 
-              sigType          = Type2, 
-              duration         = Dur2, 
-              notifyCompletion = Compl2, 
-              keepActive       = Keep2, 
-              sigParList       = Parms2,
-	      direction        = Dir2,
-	      requestID        = RID2}.
-
-tr_opt_duration(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_duration(Dur, State) ->
-    tr_UINT16(Dur, State).
-
-tr_opt_NotifyCompletion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_NotifyCompletion(Items, State) when is_list(Items) ->
-    [tr_notifyCompletionItem(I, State) || I <- Items].
-
-tr_notifyCompletionItem(Item, _State) ->
-    case Item of
-        onTimeOut                   -> onTimeOut;
-        onInterruptByEvent          -> onInterruptByEvent;
-        onInterruptByNewSignalDescr -> onInterruptByNewSignalDescr;
-        otherReason                 -> otherReason
-    end.
-
-tr_opt_SignalType(asn1_NOVALUE = Type, _State) ->
-    Type;
-tr_opt_SignalType(Type, _State) ->
-    case Type of
-        brief   -> brief;
-        onOff   -> onOff;
-        timeOut -> timeOut
-    end.
-
-tr_opt_SignalDirection(asn1_NOVALUE = SD, _State) ->
-    SD;
-tr_opt_SignalDirection(SD, _State) ->
-    case SD of
-	internal -> internal;
-	external -> external;
-	both     -> both
-    end.
-	     
-tr_SignalName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(signal, Name, State, Constraint).
-
-tr_SigParameter(#'SigParameter'{sigParameterName = ParName,
-                                value            = Value,
-                                extraInfo        = Extra},
-                SigName,
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({signal_parameter, SigName}, ParName, State, Constraint),
-    #'SigParameter'{sigParameterName = N,
-                    value            = tr_Value(Value, State),
-                    extraInfo        = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_RequestID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestID(Id, State) ->
-    tr_RequestID(Id, State).
-
-tr_RequestID(Id, _State) when Id =:= ?megaco_all_request_id ->
-    ?megaco_all_request_id;
-tr_RequestID(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_ModemDescriptor(_MD, _State) ->
-    deprecated.
-
-tr_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName  = Name,
-                                            digitMapValue = Value},
-                      State) ->
-    #'DigitMapDescriptor'{digitMapName  = tr_opt_DigitMapName(Name, State),
-                          digitMapValue = tr_opt_DigitMapValue(Value, State)}.
-
-tr_opt_DigitMapName(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapName(Name, State) ->
-    tr_DigitMapName(Name, State).
-
-tr_DigitMapName(Name, State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    resolve(dialplan, Name, State, Constraint).
-
-tr_opt_DigitMapValue(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapValue(Value, State) ->
-    tr_DigitMapValue(Value, State).
-
-tr_DigitMapValue(#'DigitMapValue'{digitMapBody = Body,
-                                  startTimer   = Start,
-                                  shortTimer   = Short,
-                                  longTimer    = Long},
-                 State) ->
-    #'DigitMapValue'{startTimer   = tr_opt_timer(Start, State),
-                     shortTimer   = tr_opt_timer(Short, State),
-                     longTimer    = tr_opt_timer(Long, State),
-                     digitMapBody = tr_STRING(Body, State)}. %% BUGBUG: digitMapBody not handled at all
-
-tr_opt_timer(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_timer(Timer, State) ->
-    tr_DIGIT(Timer, State, 0, 99).
-
-tr_ServiceChangeParm(
-  #'ServiceChangeParm'{serviceChangeMethod  = Method, 
-		       serviceChangeAddress = Addr, 
-		       serviceChangeVersion = Version, 
-		       serviceChangeProfile = Profile, 
-		       serviceChangeReason  = Reason, 
-		       serviceChangeDelay   = Delay, 
-		       serviceChangeMgcId   = MgcId, 
-		       timeStamp            = Time,
-		       serviceChangeInfo    = Info,
-		       serviceChangeIncompleteFlag = Incomplete},
-  State) ->
-    Method2     = tr_ServiceChangeMethod(Method, State),
-    Addr2       = tr_opt_ServiceChangeAddress(Addr, State),
-    Version2    = tr_opt_serviceChangeVersion(Version, State),
-    Profile2    = tr_opt_ServiceChangeProfile(Profile, State),
-    Reason2     = tr_serviceChangeReason(Reason, State),
-    Delay2      = tr_opt_serviceChangeDelay(Delay, State),
-    MgcId2      = tr_opt_serviceChangeMgcId(MgcId, State),
-    Time2       = tr_opt_TimeNotation(Time, State),
-    Info2       = tr_opt_AuditDescriptor(Info, State),
-    Incomplete2 = tr_opt_null(Incomplete, State),
-    #'ServiceChangeParm'{serviceChangeMethod         = Method2,
-                         serviceChangeAddress        = Addr2,
-                         serviceChangeVersion        = Version2,
-                         serviceChangeProfile        = Profile2,
-                         serviceChangeReason         = Reason2, 
-                         serviceChangeDelay          = Delay2, 
-                         serviceChangeMgcId          = MgcId2, 
-                         timeStamp                   = Time2, 
-			 serviceChangeInfo           = Info2, 
-			 serviceChangeIncompleteFlag = Incomplete2}.
-
-tr_ServiceChangeMethod(Method, _State) ->
-    case Method of
-        failover      -> failover;
-        forced        -> forced;
-        graceful      -> graceful;
-        restart       -> restart;
-        disconnected  -> disconnected;
-        handOff       -> handOff
-    end. %% BUGBUG: extension
-
-tr_opt_ServiceChangeAddress(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ServiceChangeAddress({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            portNumber -> tr_portNumber(Val, State);
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val, State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_serviceChangeVersion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeVersion(Version, State) ->
-    tr_version(Version, State).
-
-tr_opt_ServiceChangeProfile(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-%% Decode
-tr_opt_ServiceChangeProfile({'ServiceChangeProfile', ProfileName}, State) ->
-    case string:tokens(ProfileName, "/") of
-        [Name0, Version0] ->
-	    Name    = tr_STRING(Name0, State, 1, 64),
-	    Version = tr_version(list_to_integer(Version0), State),
-	    #'ServiceChangeProfile'{profileName = Name, 
-				    version     = Version}
-    end;
-%% Encode
-tr_opt_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = Name0, 
-						    version     = Version0},
-			    State) ->
-    Name        = tr_STRING(Name0, State, 1, 64),
-    Version     = tr_version(Version0, State),
-    ProfileName = lists:flatten(io_lib:format("~s/~w", [Name, Version])),
-    {'ServiceChangeProfile', ProfileName}.
-    
-tr_serviceChangeReason([_] = Reason, State) ->
-    tr_Value(Reason, State).
-
-tr_opt_serviceChangeDelay(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeDelay(Delay, State) ->
-    tr_UINT32(Delay, State).
-
-tr_opt_serviceChangeMgcId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeMgcId(MgcId, State) ->
-    tr_MId(MgcId, State).
-
-tr_opt_portNumber(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_portNumber(Port, State) ->
-    tr_portNumber(Port, State).
-
-tr_portNumber(Port, State) when is_integer(Port) andalso (Port >= 0) ->
-    tr_UINT16(Port, State).
-
-tr_ServiceChangeResParm(#'ServiceChangeResParm'{serviceChangeMgcId   = MgcId, 
-                                                serviceChangeAddress = Addr, 
-                                                serviceChangeVersion = Version, 
-                                                serviceChangeProfile = Profile,
-						timeStamp            = Time}, 
-                        State) ->
-    #'ServiceChangeResParm'{serviceChangeMgcId   = tr_opt_serviceChangeMgcId(MgcId, State),
-                            serviceChangeAddress = tr_opt_ServiceChangeAddress(Addr, State),
-                            serviceChangeVersion = tr_opt_serviceChangeVersion(Version, State),
-                            serviceChangeProfile = tr_opt_ServiceChangeProfile(Profile, State),
-			    timeStamp            = tr_opt_TimeNotation(Time, State)}.
-
-tr_PackagesDescriptor(Items, State) when is_list(Items) ->
-    [tr_PackagesItem(I, State) || I <- Items].
-
-tr_PackagesItem(#'PackagesItem'{packageName    = Name,
-                                packageVersion = Version},
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    #'PackagesItem'{packageName    = resolve(package, Name, State, Constraint),
-                    packageVersion = tr_UINT16(Version, State)}.
-
-tr_opt_StatisticsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StatisticsDescriptor(Parms, State) ->
-    tr_StatisticsDescriptor(Parms, State).
-
-tr_StatisticsDescriptor(Parms, State) when is_list(Parms) ->
-    [tr_StatisticsParameter(P, State) || P <- Parms].
-
-tr_StatisticsParameter(#'StatisticsParameter'{statName  = Name,
-                                              statValue = Value},
-                       State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'StatisticsParameter'{statName  = resolve(statistics, Name, State, Constraint),
-                           statValue = tr_opt_Value(Value, State)}.
-
-tr_opt_TimeNotation(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TimeNotation(#'TimeNotation'{date = Date,
-                                    time = Time},
-                    State) ->
-    #'TimeNotation'{date = tr_STRING(Date, State, 8, 8), % "yyyymmdd"
-                    time = tr_STRING(Time, State, 8, 8)}.% "hhmmssss"
-
-%% BUGBUG: Does not verify that string must contain at least one char
-%% BUGBUG: This violation of the is required in order to comply with
-%% BUGBUG: the dd/ce ds parameter that may possibly be empty.
-
-tr_opt_Value(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_Value(Value, State) ->
-    tr_Value(Value, State).
-
-tr_Value(Strings, _State) when is_list(Strings) ->
-    [[Char || Char <- String] || String <- Strings].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%% Encode an octet string, escape } by \ if necessary 
-tr_OCTET_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_QUOTED_STRING(String, _State) when is_list(String) ->
-    verify_count(length(String), 1, infinity),
-    String.
-
-%% The internal format of hex digits is a list of octets
-%% Min and Max means #hexDigits
-%% Leading zeros are prepended in order to fulfill Min
-tr_HEXDIG(Octets, _State, Min, Max) when is_list(Octets) ->
-    verify_count(length(Octets), Min, Max),
-    Octets.
-
-tr_DIGIT(Val, State, Min, Max) ->
-    tr_integer(Val, State, Min, Max).
-
-tr_STRING(String, _State) when is_list(String) ->
-    String.
-
-tr_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_opt_UINT16(Val, State) ->
-    tr_opt_integer(Val, State, 0, 65535).
-
-tr_UINT16(Val, State) ->
-    tr_integer(Val, State, 0, 65535).
-
-tr_UINT32(Val, State) ->
-    tr_integer(Val, State, 0, 4294967295).
-
-tr_opt_integer(asn1_NOVALUE, _State, _Min, _Max) ->
-    asn1_NOVALUE;
-tr_opt_integer(Int, State, Min, Max) ->
-    tr_integer(Int, State, Min, Max).
-
-tr_integer(Int, _State, Min, Max) ->
-    verify_count(Int, Min, Max),
-    Int.
-
-%% Verify that Count is within the range of Min and Max
-verify_count(Count, Min, Max) ->
-    if
-        is_integer(Count) ->
-            if
-                is_integer(Min) andalso (Count >= Min) ->
-                    if
-                        is_integer(Max) andalso (Count =< Max) ->
-                            Count;
-                        Max =:= infinity ->
-                            Count;
-                        true ->
-                            error({count_too_large, Count, Max})
-                    end;
-                true ->
-                    error({count_too_small, Count, Min})
-            end;
-        true ->
-            error({count_not_an_integer, Count})
-    end.
diff --git a/lib/megaco/src/binary/megaco_binary_transformer_prev3b.erl b/lib/megaco/src/binary/megaco_binary_transformer_prev3b.erl
deleted file mode 100644
index 8b1cf91159..0000000000
--- a/lib/megaco/src/binary/megaco_binary_transformer_prev3b.erl
+++ /dev/null
@@ -1,1628 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2005-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Transform internal form of Megaco/H.248 messages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_transformer_prev3b).
-
--include_lib("megaco/include/megaco.hrl").
-%% -include_lib("megaco/include/megaco_message.hrl").
--include_lib("megaco/include/megaco_message_prev3b.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
--export([tr_message/3, tr_transaction/3]).
-
-
--define(DEFAULT_NAME_RESOLVER, megaco_binary_name_resolver_prev3b).
-
--record(state, {mode,                 % verify | encode | decode
-                resolver_module,      % 
-                resolver_options}).
-
-resolve(Type, Item, State, Constraint) ->
-    case State#state.mode of
-        verify ->
-            Item;
-        encode ->
-	    ?d("resolve(encode) -> encode: ~p",[Item]),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-            EncodedItem = Mod:encode_name(Opt, Type, Item),
-	    ?d("resolve -> verify contraint for ~p",[EncodedItem]),
-	    verify_constraint(EncodedItem, Constraint);
-        decode ->
-	    ?d("resolve(decode) -> verify contraint for ~p",[Item]),
-	    DecodedItem = verify_constraint(Item, Constraint),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-	    ?d("resolve(decode) -> decode: ~p",[DecodedItem]),
-            Mod:decode_name(Opt, Type, DecodedItem)
-    end.
-
-verify_constraint(Item, valid) ->
-    Item;
-verify_constraint(Item, Constraint) when is_function(Constraint) ->
-    Constraint(Item).
-
-tr_message(MegaMsg, Mode, Config) ->
-    case Config of
-        [native] ->
-            MegaMsg;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_MegacoMessage(MegaMsg, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_MegacoMessage(MegaMsg, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_MegacoMessage(MegaMsg, State)
-    end.
-
-tr_transaction(Trans, Mode, Config) ->
-    case Config of
-        [native] ->
-            Trans;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_Transaction(Trans, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_Transaction(Trans, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_Transaction(Trans, State)
-    end.
-
-tr_MegacoMessage(#'MegacoMessage'{authHeader = Auth,
-                                  mess       = Mess},
-                 State) ->
-    ?d("tr_MegacoMessage -> entry with"
-       "~n   Auth:  ~p"
-       "~n   Mess:  ~p"
-       "~n   State: ~p", [Auth, Mess, State]),
-    #'MegacoMessage'{authHeader = tr_opt_AuthenticationHeader(Auth, State),
-                     mess       = tr_Message(Mess, State)}.
-
-tr_opt_AuthenticationHeader(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuthenticationHeader(#'AuthenticationHeader'{secParmIndex = SPI,
-                                                    seqNum       = SN,
-                                                    ad           = AuthData},
-                            State) ->
-    #'AuthenticationHeader'{secParmIndex = tr_SecurityParmIndex(SPI, State),
-                            seqNum       = tr_SequenceNum(SN, State),
-                            ad           = tr_AuthData(AuthData, State)}.
-
-tr_SecurityParmIndex(SPI, State) ->
-    tr_HEXDIG(SPI, State, 4, 4). % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_SequenceNum(SN, State) ->
-    tr_HEXDIG(SN, State, 4, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_AuthData(AuthData, State) ->
-    tr_HEXDIG(AuthData, State, 12, 32).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_Message(#'Message'{version     = Version,
-                      mId         = MID,
-                      messageBody = Body},
-           State) ->
-    #'Message'{version     = tr_version(Version, State),
-               mId         = tr_MId(MID, State),
-               messageBody = tr_Message_messageBody(Body, State)}.
-
-tr_version(Version, State) ->
-    tr_DIGIT(Version, State, 0, 99).
-
-tr_Message_messageBody({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            messageError -> tr_ErrorDescriptor(Val, State);
-            transactions when is_list(Val) -> [tr_Transaction(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_MId({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val,   State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_mtpAddress(MtpAddr, State) ->
-    tr_OCTET_STRING(MtpAddr, State, 2, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_DomainName(#'DomainName'{name       = Name,
-                            portNumber = Port},
-              State) ->
-    Domain = #'DomainName'{name       = tr_STRING(Name, State), % BUGBUG: Mismatch between ASN.1 and ABNF
-                           portNumber = tr_opt_portNumber(Port, State)},
-    {domainName, Domain2} = resolve(mid, {domainName, Domain}, State, valid),
-    Domain2.
-
-tr_IP4Address(#'IP4Address'{address    = [A1, A2, A3, A4],
-                            portNumber = Port},
-              State) ->
-    #'IP4Address'{address    = [tr_V4hex(A1, State),
-                                tr_V4hex(A2, State),
-                                tr_V4hex(A3, State),
-                                tr_V4hex(A4, State)],
-                  portNumber = tr_opt_portNumber(Port, State)}.
-
-tr_V4hex(Val, State) ->
-    tr_DIGIT(Val, State, 0, 255).
-
-tr_IP6Address(_Val, _State) ->
-    error(ipv6_not_supported). %% BUGBUG: nyi
-
-tr_PathName(Path, State) ->
-    %% BUGBUG: ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-    %% BUGBUG: ["@" pathDomainName ]
-    Constraint = fun({deviceName, Item}) -> tr_STRING(Item, State, 1, 64) end,
-    resolve(mid, {deviceName, Path}, State, Constraint).
-
-tr_Transaction({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionRequest ->     tr_TransactionRequest(Val, State);
-            transactionPending ->     tr_TransactionPending(Val, State);
-            transactionReply ->       tr_TransactionReply(Val, State);
-            transactionResponseAck -> [tr_TransactionAck(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_TransactionAck(#'TransactionAck'{firstAck = First,
-				    lastAck  = Last},
-                          State) ->
-    #'TransactionAck'{firstAck = tr_TransactionId(First, State),
-		      lastAck  = tr_opt_TransactionId(Last, State)}.
-
-tr_opt_TransactionId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TransactionId(Id, State) ->
-    tr_TransactionId(Id, State).
-
-tr_TransactionId(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_TransactionRequest(#'TransactionRequest'{transactionId = Id,
-                                            actions       = Actions},
-                      State) when is_list(Actions) ->
-
-    #'TransactionRequest'{transactionId = tr_TransactionId(Id, State),
-                          actions       = [tr_ActionRequest(ActReq, State) || ActReq <- Actions]}.
-
-tr_TransactionPending(#'TransactionPending'{transactionId = Id},
-                      State) ->
-    #'TransactionPending'{transactionId = tr_TransactionId(Id, State)}.
-
-tr_TransactionReply(#'TransactionReply'{transactionId        = Id,
-                                        immAckRequired       = ImmAck,
-                                        transactionResult    = TransRes,
-					%% These fields are actually not 
-					%% supported in this implementation,
-					%% but because the messanger module
-					%% cannot see any diff between the
-					%% various v3 implementations...
-					segmentNumber        = asn1_NOVALUE,
-					segmentationComplete = asn1_NOVALUE},
-                    State) ->
-    #'TransactionReply'{transactionId        = tr_TransactionId(Id, State),
-                        immAckRequired       = tr_opt_null(ImmAck, State),
-                        transactionResult    = tr_TransactionReply_transactionResult(TransRes, State),
-			segmentNumber        = asn1_NOVALUE,
-			segmentationComplete = asn1_NOVALUE};
-tr_TransactionReply(TR, _State) ->
-    error({unsupported_TransactionReply, TR}).
-
-tr_opt_null(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_null('NULL', _State)       -> 'NULL'.
-
-tr_TransactionReply_transactionResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionError ->
-                tr_ErrorDescriptor(Val, State);
-            actionReplies when is_list(Val) andalso (Val =/= []) ->
-                [tr_ActionReply(ActRep, State) || ActRep <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_opt_ErrorDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ErrorDescriptor(ErrDesc, State) ->
-    tr_ErrorDescriptor(ErrDesc, State).
-
-tr_ErrorDescriptor(#'ErrorDescriptor'{errorCode = Code,
-                                      errorText = Text},
-                   State) ->
-    #'ErrorDescriptor'{errorCode = tr_ErrorCode(Code, State),
-                       errorText = tr_opt_ErrorText(Text, State)}.
-
-tr_ErrorCode(Code, State) ->
-    tr_DIGIT(Code, State, 0, 999).
-
-tr_opt_ErrorText(asn1_NOVALUE, _State)  ->
-    asn1_NOVALUE;
-tr_opt_ErrorText(Text, State)  ->
-    tr_QUOTED_STRING(Text, State).
-
-tr_ContextID(CtxId, State) ->
-    case CtxId of
-        ?megaco_all_context_id    -> ?megaco_all_context_id;
-        ?megaco_null_context_id   -> ?megaco_null_context_id;
-        ?megaco_choose_context_id -> ?megaco_choose_context_id;
-        Int when is_integer(Int)  -> tr_UINT32(Int, State)
-    end.
-
-tr_ActionRequest(#'ActionRequest'{contextId           = CtxId,
-                                  contextRequest      = CtxReq,
-                                  contextAttrAuditReq = CtxAuditReq,
-                                  commandRequests     = CmdReqList},
-                 State) ->
-    #'ActionRequest'{contextId           = tr_ContextID(CtxId, State),
-                     contextRequest      = tr_opt_ContextRequest(CtxReq, State),
-                     contextAttrAuditReq = tr_opt_ContextAttrAuditRequest(CtxAuditReq, State),
-                     commandRequests     = [tr_CommandRequest(CmdReq, State) || CmdReq <- CmdReqList]}.
-
-tr_ActionReply(#'ActionReply'{contextId       = CtxId,
-                              errorDescriptor = ErrDesc,
-                              contextReply    = CtxRep,
-                              commandReply    = CmdRepList},
-               State) ->
-    CmdRepList2 = [tr_CommandReply(CmdRep, State) || CmdRep <- CmdRepList],
-    #'ActionReply'{contextId       = tr_ContextID(CtxId, State),
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State),
-                   contextReply    = tr_opt_ContextRequest(CtxRep, State),
-                   commandReply    = CmdRepList2}.
-
-tr_opt_ContextRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextRequest(CR, State) ->
-    tr_ContextRequest(CR, State).
-
-tr_ContextRequest(#'ContextRequest'{priority    = Prio,
-				    emergency   = Em,
-				    topologyReq = TopReqList,
-				    iepscallind = Ind,
-				    contextProp = Props},
-		  State) ->
-    Prio2 = 
-        case Prio of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_integer(Prio, State, 0, 15)
-        end,
-    Em2 = 
-        case Em of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    TopReqList2 = 
-        case TopReqList of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_TopologyRequest(TopReq, State) ||
-                                TopReq <- TopReqList]
-        end,
-    Ind2 = 
-	case Ind of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    Props2 = 
-	case Props of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_PropertyParm(Prop, State) || Prop <- Props]
-	end,
-    #'ContextRequest'{priority    = Prio2,
-                      emergency   = Em2,
-                      topologyReq = TopReqList2,
-		      iepscallind = Ind2,
-		      contextProp = Props2}.
-
-tr_opt_ContextAttrAuditRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextAttrAuditRequest(CAAR, State) ->
-    tr_ContextAttrAuditRequest(CAAR, State).
-
-tr_ContextAttrAuditRequest(#'ContextAttrAuditRequest'{topology       = Top,
-						      emergency      = Em,
-						      priority       = Prio,
-						      iepscallind    = Ind,
-						      contextPropAud = Props},
-                               State) ->
-    Top2   = tr_opt_null(Top,  State),
-    Em2    = tr_opt_null(Em,   State),
-    Prio2  = tr_opt_null(Prio, State),
-    Ind2   = tr_opt_null(Ind,  State),
-    Props2 = 
-	case Props of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _            -> 
-		[tr_indAudPropertyParm(Prop, State) || Prop <- Props]
-	end,
-    #'ContextAttrAuditRequest'{topology       = Top2,
-                               emergency      = Em2, 
-                               priority       = Prio2, 
-			       iepscallind    = Ind2, 
-			       contextPropAud = Props2}.
-
-tr_CommandRequest(#'CommandRequest'{command        = Cmd,
-                                    optional       = Opt,
-                                    wildcardReturn = Wild},
-                  State) ->
-    #'CommandRequest'{optional       = tr_opt_null(Opt, State),
-                      wildcardReturn = tr_opt_null(Wild, State),
-                      command        = tr_Command(Cmd, State)}.
-
-tr_Command({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReq ->            tr_AmmRequest(Val, State);
-            moveReq ->           tr_AmmRequest(Val, State);
-            modReq ->            tr_AmmRequest(Val, State);
-            subtractReq ->       tr_SubtractRequest(Val, State);
-            auditCapRequest ->   tr_AuditRequest(Val, State);
-            auditValueRequest -> tr_AuditRequest(Val, State);
-            notifyReq ->         tr_NotifyRequest(Val, State);
-            serviceChangeReq ->  tr_ServiceChangeRequest(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_CommandReply({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReply ->           tr_AmmsReply(Val, State);
-            moveReply ->          tr_AmmsReply(Val, State);
-            modReply ->           tr_AmmsReply(Val, State);
-            subtractReply ->      tr_AmmsReply(Val, State);
-            auditCapReply ->      tr_AuditReply(Val, State);
-            auditValueReply ->    tr_AuditReply(Val, State);
-            notifyReply ->        tr_NotifyReply(Val, State);
-            serviceChangeReply -> tr_ServiceChangeReply(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_TopologyRequest(#'TopologyRequest'{terminationFrom   = From,
-                                      terminationTo     = To,
-                                      topologyDirection = Dir},
-                   State) ->
-    Dir2 = 
-        case Dir of
-            bothway -> bothway;
-            isolate -> isolate;
-            oneway ->  oneway
-        end,
-    #'TopologyRequest'{terminationFrom   = tr_TerminationID(From, State),
-                       terminationTo     = tr_TerminationID(To, State),
-                       topologyDirection = Dir2}.
-
-tr_AmmRequest(#'AmmRequest'{terminationID = IdList,
-                            descriptors   = DescList},
-              State) ->
-    #'AmmRequest'{terminationID = [tr_TerminationID(Id, State) || 
-				      Id <- IdList],
-                  descriptors   = tr_ammDescriptors(DescList, [], State)}.
-
-tr_ammDescriptors([], Acc, _State) ->
-    lists:reverse(Acc);
-tr_ammDescriptors([Desc|Descs], Acc, State) ->
-    case tr_ammDescriptor(Desc, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Desc});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	NewDesc ->
-	    tr_ammDescriptors(Descs, [NewDesc|Acc], State)
-    end.
-
-tr_ammDescriptor({Tag, Desc}, State) ->
-    Desc2 = 
-        case Tag of
-            mediaDescriptor       -> tr_MediaDescriptor(Desc, State);
-            modemDescriptor       -> tr_ModemDescriptor(Desc, State);      
-            muxDescriptor         -> tr_MuxDescriptor(Desc, State);   
-            eventsDescriptor      -> tr_EventsDescriptor(Desc, State);      
-            eventBufferDescriptor -> tr_EventBufferDescriptor(Desc, State); 
-            signalsDescriptor     -> tr_SignalsDescriptor(Desc, State);    
-            digitMapDescriptor    -> tr_DigitMapDescriptor(Desc, State);    
-            auditDescriptor       -> tr_AuditDescriptor(Desc, State);
-	    statisticsDescriptor  -> tr_StatisticsDescriptor(Desc, State)
-        end,
-    {Tag, Desc2}.
-
-tr_AmmsReply(#'AmmsReply'{terminationID    = IdList,
-                          terminationAudit = TermAudit},
-             State) ->
-    TermAudit2 =
-        case TermAudit of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_TerminationAudit(TermAudit, State)
-        end,
-    #'AmmsReply'{terminationID    = [tr_TerminationID(Id, State) ||
-                                        Id <- IdList],
-                 terminationAudit = TermAudit2}.
-
-tr_SubtractRequest(#'SubtractRequest'{terminationID   = IdList,
-                                      auditDescriptor = Desc},
-                   State) ->
-    #'SubtractRequest'{terminationID   = [tr_TerminationID(Id, State) ||
-                                             Id <- IdList],
-                       auditDescriptor = tr_opt_AuditDescriptor(Desc, State)}.
-
-tr_AuditRequest(#'AuditRequest'{terminationID   = Id,
-                                auditDescriptor = Desc},
-                State) ->
-    #'AuditRequest'{terminationID = tr_TerminationID(Id, State),
-                    auditDescriptor = tr_AuditDescriptor(Desc, State)}.
-
-%% auditReply           = (AuditValueToken / AuditCapToken ) 
-%%                        ( contextTerminationAudit  / auditOther)
-%% auditOther           = EQUAL TerminationID LBRKT 
-%%                        terminationAudit RBRKT
-%% terminationAudit     = auditReturnParameter *(COMMA auditReturnParameter) 
-%% 
-%% contextTerminationAudit = EQUAL CtxToken ( terminationIDList / 
-%%                        LBRKT errorDescriptor RBRKT )
-
-tr_AuditReply({Tag, Val}, State) ->
-    Val2 =
-	case Tag of
-	    contextAuditResult ->
-		[tr_TerminationID(Id, State) || Id <- Val];
-	    error ->
-		tr_ErrorDescriptor(Val, State);
-	    auditResult ->
-		tr_AuditResult(Val, State)
-	end,
-    {Tag, Val2}.
-
-tr_AuditResult(#'AuditResult'{terminationID          = Id,
-			      terminationAuditResult = AuditRes},
-              State) ->
-    #'AuditResult'{terminationID          = tr_TerminationID(Id, State),
-		   terminationAuditResult = tr_TerminationAudit(AuditRes, State)}.
-
-tr_opt_AuditDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuditDescriptor(Desc, State) ->
-    tr_AuditDescriptor(Desc, State).
-
-%% BUGBUG BUGBUG BUGBUG 
-%% With this construction it is possible to have both auditToken
-%% and auditPropertyToken, but it is actually valid?
-tr_AuditDescriptor(#'AuditDescriptor'{auditToken         = Tokens,
-				      auditPropertyToken = APTs},
-                   State) ->
-    Tokens2 = 
-	case Tokens of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-	    _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-	end,
-    %% v2
-    APTs2 = 
-	case APTs of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		[tr_indAuditParameter(APT, State) || APT <- APTs]
-	end,
-    #'AuditDescriptor'{auditToken         = Tokens2,
-		       auditPropertyToken = APTs2}.  
-
-tr_auditItem(Token, _State) ->
-    case Token of
-        muxToken            -> muxToken;
-        modemToken          -> modemToken;
-        mediaToken          -> mediaToken;
-        eventsToken         -> eventsToken;
-        signalsToken        -> signalsToken;
-        digitMapToken       -> digitMapToken;
-        statsToken          -> statsToken;
-        observedEventsToken -> observedEventsToken;
-        packagesToken       -> packagesToken;
-        eventBufferToken    -> eventBufferToken
-    end.
-
-%% --- v2 begin ---
-
-tr_indAuditParameter({Tag, Val}, State) ->
-    Val2 = 
-	case Tag of
-	    indAudMediaDescriptor       -> 
-		tr_indAudMediaDescriptor(Val, State);
-	    indAudEventsDescriptor      -> 
-		tr_indAudEventsDescriptor(Val, State);
-	    indAudSignalsDescriptor     -> 
-		tr_indAudSignalsDescriptor(Val, State);
-	    indAudDigitMapDescriptor    -> 
-		tr_indAudDigitMapDescriptor(Val, State);
-	    indAudEventBufferDescriptor -> 
-		tr_indAudEventBufferDescriptor(Val, State);
-	    indAudStatisticsDescriptor  -> 
-		tr_indAudStatisticsDescriptor(Val, State);
-	    indAudPackagesDescriptor    -> 
-		tr_indAudPackagesDescriptor(Val, State)
-	end,
-    {Tag, Val2}.
-
-
-%% -
-
-tr_indAudMediaDescriptor(#'IndAudMediaDescriptor'{termStateDescr = TSD,
-						  streams        = S}, 
-			 State) ->
-    TSD2 = 
-	case TSD of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		tr_indAudTerminationStateDescriptor(TSD, State)
-	end,
-    S2 = 
-	case S of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    {oneStream, OS} ->
-		{oneStream, tr_indAudStreamParms(OS, State)};
-	    {multiStream, MS} ->
-		MS2 = [tr_indAudStreamDescriptor(MS1, State) || MS1 <- MS],
-		{multiStream, MS2}
-	end,
-    #'IndAudMediaDescriptor'{termStateDescr = TSD2,
-			     streams        = S2}.
-
-tr_indAudTerminationStateDescriptor(Val, State) 
-  when is_record(Val, 'IndAudTerminationStateDescriptor') ->
-    #'IndAudTerminationStateDescriptor'{propertyParms      = Parms,
-					eventBufferControl = EBC,
-					serviceState       = SS} = Val,
-    Parms2 = [tr_indAudPropertyParm(Parm, State) || Parm <- Parms],
-    EBC2   = tr_opt_null(EBC, State),
-    SS2    = tr_opt_null(SS, State),
-    #'IndAudTerminationStateDescriptor'{propertyParms = Parms2, 
-					eventBufferControl = EBC2,
-					serviceState       = SS2}.
-
-    
-tr_indAudStreamParms(#'IndAudStreamParms'{localControlDescriptor = LCD, 
-					  localDescriptor        = LD, 
-					  remoteDescriptor       = RD,
-					  statisticsDescriptor   = SD}, 
-		     State) ->
-    LCD2 = 
-	case LCD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalControlDescriptor(LCD, State)
-	end,
-    LD2 = 
-	case LD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(LD, State)
-	end,
-    RD2 = 
-	case RD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(RD, State)
-	end,
-    SD2 = 
-	case SD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudStatisticsDescriptor(SD, State)
-	end,
-    #'IndAudStreamParms'{localControlDescriptor = LCD2, 
-			 localDescriptor        = LD2, 
-			 remoteDescriptor       = RD2,
-			 statisticsDescriptor   = SD2}.
-    
-tr_indAudLocalControlDescriptor(Val, State) 
-  when is_record(Val, 'IndAudLocalControlDescriptor') ->
-    #'IndAudLocalControlDescriptor'{streamMode    = M,
-				    reserveValue  = V,
-				    reserveGroup  = G,
-				    propertyParms = P} = Val,
-    M2 = tr_opt_null(M, State),
-    V2 = tr_opt_null(V, State),
-    G2 = tr_opt_null(G, State),
-    P2 = tr_indAudLocalControlDescriptor_propertyParms(P, State),
-    #'IndAudLocalControlDescriptor'{streamMode    = M2,
-				    reserveValue  = V2,
-				    reserveGroup  = G2,
-				    propertyParms = P2}.
-
-tr_indAudLocalControlDescriptor_propertyParms(Parms, State) 
-  when is_list(Parms) andalso (length(Parms) > 0) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Parms];
-tr_indAudLocalControlDescriptor_propertyParms(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE.
-
-tr_indAudLocalRemoteDescriptor(#'IndAudLocalRemoteDescriptor'{propGroupID = ID,
-							      propGrps = Grps},
-			       State) ->
-    #'IndAudLocalRemoteDescriptor'{propGroupID = tr_opt_UINT16(ID, State),
-				   propGrps = tr_indAudPropertyGroup(Grps, 
-								     State)}.
-
-tr_indAudPropertyGroup(Grps, State) when is_list(Grps) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Grps].
-
-tr_indAudPropertyParm(#'IndAudPropertyParm'{name = Name0}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(property, Name0, State, Constraint),
-    #'IndAudPropertyParm'{name = Name}.
-
-
-tr_indAudStreamDescriptor(#'IndAudStreamDescriptor'{streamID = ID,
-						    streamParms = Parms},
-			  State) ->
-    #'IndAudStreamDescriptor'{streamID    = tr_StreamID(ID, State),
-			      streamParms = tr_indAudStreamParms(Parms, 
-								 State)}.
-
-
-%% -
-
-tr_indAudEventsDescriptor(#'IndAudEventsDescriptor'{requestID = RID,
-						    pkgdName  = Name0,
-						    streamID  = SID},
-			  State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, Name0, State, Constraint),
-    #'IndAudEventsDescriptor'{requestID = tr_opt_RequestID(RID, State),
-			      pkgdName  = Name, 
-			      streamID  = tr_opt_StreamID(SID, State)}.
-
-
-%% -
-
-tr_indAudSignalsDescriptor({Tag, Val}, State) ->
-    case Tag of
-	signal ->
-	    {signal, tr_indAudSignal(Val, State)};
-	seqSigList ->
-	    {seqSigList, tr_indAudSeqSigList(Val, State)}
-    end.
-
-tr_opt_indAudSignal(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_indAudSignal(Val, State) ->
-    tr_indAudSignal(Val, State).
-
-tr_indAudSignal(#'IndAudSignal'{signalName = Name0,
-				streamID   = SID}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(signal, Name0, State, Constraint),
-    #'IndAudSignal'{signalName = Name, 
-		    streamID   = tr_opt_StreamID(SID, State)}.
-
-tr_indAudSeqSigList(#'IndAudSeqSigList'{id = ID,
-					signalList = SigList}, State) ->
-    #'IndAudSeqSigList'{id = tr_integer(ID, State, 0, 65535),
-			signalList = tr_opt_indAudSignal(SigList, State)}.
-
-%% -
-
-tr_indAudDigitMapDescriptor(#'IndAudDigitMapDescriptor'{digitMapName = Name},
-			    State) ->
-    #'IndAudDigitMapDescriptor'{digitMapName = 
-				tr_opt_DigitMapName(Name, State)}.
-
-
-%% -
-
-tr_indAudEventBufferDescriptor(#'IndAudEventBufferDescriptor'{eventName = N,
-							      streamID  = SID},
-			       State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p"
-       "~n   SID: ~p", [N, SID]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, N, State, Constraint),
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudEventBufferDescriptor'{eventName = Name,
-				   streamID  = tr_opt_StreamID(SID, State)}.
-
-%% -
-
-tr_indAudStatisticsDescriptor(#'IndAudStatisticsDescriptor'{statName = N},
-			      State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p", [N]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(statistics, N, State, Constraint),
-    #'IndAudStatisticsDescriptor'{statName = Name}.
-
-
-%% -
-
-tr_indAudPackagesDescriptor(#'IndAudPackagesDescriptor'{packageName    = N,
-							packageVersion = V}, 
-			    State) ->
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   N: ~p"
-       "~n   V: ~p", [N, V]),
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    Name = resolve(package, N, State, Constraint),
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudPackagesDescriptor'{packageName = Name, 
-				packageVersion = tr_integer(V, State, 0, 99)}.
-
-%% -- v2 end --
-
-
-tr_TerminationAudit(ParmList, State) when is_list(ParmList) ->
-    do_tr_TerminationAudit(ParmList, [], State).
-
-do_tr_TerminationAudit([], Acc, _State) ->
-    lists:reverse(Acc);
-do_tr_TerminationAudit([Parm|ParmList], Acc, State) ->
-    case tr_AuditReturnParameter(Parm, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Parm});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	NewParm ->
-	    do_tr_TerminationAudit(ParmList, [NewParm|Acc], State)
-    end.
-
-tr_AuditReturnParameter({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor ->
-                tr_ErrorDescriptor(Val, State);
-            mediaDescriptor ->
-                tr_MediaDescriptor(Val, State);
-            modemDescriptor ->
-                tr_ModemDescriptor(Val, State);
-            muxDescriptor ->
-                tr_MuxDescriptor(Val, State);
-            eventsDescriptor ->
-                tr_EventsDescriptor(Val, State);
-            eventBufferDescriptor ->
-                tr_EventBufferDescriptor(Val, State);
-            signalsDescriptor ->
-                tr_SignalsDescriptor(Val, State);
-            digitMapDescriptor ->
-                tr_DigitMapDescriptor(Val, State);
-            observedEventsDescriptor ->
-                tr_ObservedEventsDescriptor(Val, State);
-            statisticsDescriptor ->
-                tr_StatisticsDescriptor(Val, State);
-            packagesDescriptor ->
-                tr_PackagesDescriptor(Val, State);
-            emptyDescriptors ->
-                tr_EmptyDescriptors(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_EmptyDescriptors(#'AuditDescriptor'{auditToken = Tokens},
-                    State) ->
-    case Tokens of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-    end.
-
-tr_NotifyRequest(#'NotifyRequest'{terminationID            = IdList,
-                                  observedEventsDescriptor = ObsDesc,
-                                  errorDescriptor          = ErrDesc},
-                 State) ->
-    %% BUGBUG: Mismatch between ASN.1 and ABNF
-    %% BUGBUG: The following ought to be a 'choice'
-    #'NotifyRequest'{terminationID            = [tr_TerminationID(Id, State) ||
-                                                    Id <- IdList],
-                     observedEventsDescriptor = tr_ObservedEventsDescriptor(ObsDesc, State),
-                     errorDescriptor          = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_NotifyReply(#'NotifyReply'{terminationID   = IdList,
-                              errorDescriptor = ErrDesc},
-               State) ->
-    #'NotifyReply'{terminationID   = [tr_TerminationID(Id, State) || Id <- IdList],
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_ObservedEventsDescriptor(#'ObservedEventsDescriptor'{requestId        = Id,
-                                                        observedEventLst = Events},
-                            State) when is_list(Events) ->
-    #'ObservedEventsDescriptor'{requestId        = tr_RequestID(Id, State),
-                                observedEventLst = [tr_ObservedEvent(E, State) || E <- Events]}.
-
-%% ;time per event, because it might be buffered
-%% observedEvent        = [ TimeStamp LWSP COLON] LWSP 
-%%                        pkgdName [ LBRKT observedEventParameter
-%%                        *(COMMA observedEventParameter) RBRKT ]
-%% 
-%% ;at-most-once eventStream, every eventParameterName at most once
-%% observedEventParameter = eventStream / eventOther
-
-tr_ObservedEvent(#'ObservedEvent'{eventName    = Name,
-                                  streamID     = Id,
-                                  eventParList = Parms,
-                                  timeNotation = Time},
-                 State) ->
-    #'ObservedEvent'{eventName    = tr_EventName(Name, State),
-                     streamID     = tr_opt_StreamID(Id, State),
-                     eventParList = [tr_EventParameter(P, Name, State) || P <- Parms],
-                     timeNotation = tr_opt_TimeNotation(Time, State)}.
-
-tr_EventName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(event, Name, State, Constraint).
-
-tr_EventParameter(#'EventParameter'{eventParameterName = ParName,
-                                    value              = Value,
-				    extraInfo          = Extra},
-		  EventName,
-                  State) ->
-    %% BUGBUG: event parameter name
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({event_parameter, EventName}, ParName, State, Constraint),
-    #'EventParameter'{eventParameterName = N,
-		      value              = tr_Value(Value, State),
-		      extraInfo          = tr_opt_extraInfo(Extra, State)}.
-
-tr_ServiceChangeRequest(#'ServiceChangeRequest'{terminationID      = IdList,
-                                                serviceChangeParms = Parms},
-                        State) ->
-    #'ServiceChangeRequest'{terminationID      = [tr_TerminationID(Id, State) || Id <- IdList],
-                            serviceChangeParms = tr_ServiceChangeParm(Parms, State)}.
-
-%% serviceChangeReply   = ServiceChangeToken EQUAL TerminationID
-%%                        [LBRKT (errorDescriptor / 
-%%                        serviceChangeReplyDescriptor) RBRKT]
-%% serviceChangeReplyDescriptor = ServicesToken LBRKT
-%%                        servChgReplyParm *(COMMA servChgReplyParm) RBRKT
-%% 
-%% ;at-most-once. Version is REQUIRED on first ServiceChange response
-%% servChgReplyParm     = (serviceChangeAddress / serviceChangeMgcId /
-%%                        serviceChangeProfile / serviceChangeVersion )
-tr_ServiceChangeReply(#'ServiceChangeReply'{terminationID       = IdList,
-                                            serviceChangeResult = Res},
-                      State) ->
-    #'ServiceChangeReply'{terminationID       = [tr_TerminationID(Id, State) || Id <- IdList],
-                          serviceChangeResult = tr_ServiceChangeResult(Res, State)}.
-
-tr_ServiceChangeResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor       -> tr_ErrorDescriptor(Val, State);
-            serviceChangeResParms -> tr_ServiceChangeResParm(Val, State)
-        end,
-    {Tag, Val2}.
-
-%% TerminationID        = "ROOT" / pathNAME / "$" / "*"
-%% ; Total length of pathNAME must not exceed 64 chars.
-%% pathNAME             = ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-%%                        ["@" pathDomainName ]
-
-tr_TerminationID(TermId, State) when State#state.mode =/= verify ->
-    resolve(term_id, TermId, State, valid);
-tr_TerminationID(#'TerminationID'{wildcard = Wild,
-                                  id       = Id},
-                 _State) ->
-    #'TerminationID'{wildcard = Wild,
-                     id       = Id};
-tr_TerminationID(#megaco_term_id{contains_wildcards = IsWild,
-                                 id                 = Id},
-                 State) ->
-    #megaco_term_id{contains_wildcards = tr_bool(IsWild, State),
-                    id                 = [tr_term_id_component(Sub, State) || Sub <- Id]}.
-
-tr_opt_bool(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_bool(Bool, State)         -> tr_bool(Bool, State).
-
-tr_bool(true, _State)  -> true;
-tr_bool(false, _State) -> false.
-
-tr_term_id_component(Sub, _State) ->
-    case Sub of
-        all    -> all;
-        choose -> choose;
-        Char when is_integer(Char) -> Char
-    end.
-
-%% mediaDescriptor      = MediaToken LBRKT mediaParm *(COMMA mediaParm) RBRKT
-%% ; at-most-once per item
-%% ; and either streamParm or streamDescriptor but not both
-%% mediaParm            = (streamParm / streamDescriptor / 
-%%                         terminationStateDescriptor)
-%% ; at-most-once
-%% streamParm           = ( localDescriptor / remoteDescriptor / 
-%%                         localControlDescriptor )
-%% streamDescriptor     = StreamToken EQUAL StreamID LBRKT streamParm 
-%%                        *(COMMA streamParm) RBRKT
-tr_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TermState,
-                                      streams        = Streams},
-                   State) ->
-    #'MediaDescriptor'{termStateDescr = tr_opt_TerminationStateDescriptor(TermState, State),
-                       streams        = tr_opt_streams(Streams, State)}.
-
-tr_opt_streams(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_streams({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            oneStream   -> tr_StreamParms(Val, State);
-            multiStream -> [tr_StreamDescriptor(SD, State) || SD <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_StreamParms(#'StreamParms'{localControlDescriptor = LCD,
-                              localDescriptor        = LD,
-                              remoteDescriptor       = RD,
-			      statisticsDescriptor   = SD},
-               State) ->
-    LCD2 = tr_opt_LocalControlDescriptor(LCD, State),
-    LD2  = tr_opt_LocalRemoteDescriptor(LD,   State),
-    RD2  = tr_opt_LocalRemoteDescriptor(RD,   State),
-    SD2  = tr_opt_StatisticsDescriptor(SD,    State),
-    #'StreamParms'{localControlDescriptor = LCD2,
-                   localDescriptor        = LD2,
-                   remoteDescriptor       = RD2,
-		   statisticsDescriptor   = SD2}.
-
-tr_StreamDescriptor(#'StreamDescriptor'{streamID    = Id,
-                                        streamParms = Parms},
-                    State) ->
-    #'StreamDescriptor'{streamID    = tr_StreamID(Id, State),
-                        streamParms = tr_StreamParms(Parms, State)}.
-
-%% localControlDescriptor = LocalControlToken LBRKT localParm 
-%%                          *(COMMA localParm) RBRKT
-%% 
-%% ; at-most-once per item
-%% localParm            = ( streamMode / propertyParm /
-%%                          reservedValueMode  / reservedGroupMode ) 
-%% reservedValueMode       = ReservedValueToken EQUAL ( "ON" / "OFF" ) 
-%% reservedGroupMode       = ReservedGroupToken EQUAL ( "ON" / "OFF" ) 
-%% 
-%% reservedMode      = ReservedToken EQUAL ( "ON" / "OFF" )
-%% 
-%% streamMode           = ModeToken EQUAL streamModes
-tr_opt_LocalControlDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = Mode,
-                                                        reserveGroup  = Group,
-                                                        reserveValue  = Value,
-                                                        propertyParms = Props},
-                              State) ->
-    #'LocalControlDescriptor'{streamMode    = tr_opt_StreamMode(Mode, State),
-                              reserveGroup  = tr_opt_bool(Group, State),
-                              reserveValue  = tr_opt_bool(Value, State),
-                              propertyParms = [tr_PropertyParm(P, State) || P <- Props]}.
-
-tr_opt_StreamMode(Mode, _State) ->
-    case Mode of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        sendOnly     -> sendOnly;
-        recvOnly     -> recvOnly;
-        sendRecv     -> sendRecv;
-        inactive     -> inactive;
-        loopBack     -> loopBack
-    end.
-
-tr_Name(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" )
-    tr_STRING(Name, State, 2, 2).
-
-tr_PkgdName(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG:  pkgdName =  (NAME / "*")  SLASH  (ItemID / "*" )
-    tr_OCTET_STRING(Name, State, 4, 4).
-
-%% When text encoding the protocol, the descriptors consist of session
-%% descriptions as defined in SDP (RFC2327), except that the "s=", "t="
-%% and "o=" lines are optional. When multiple session descriptions are
-%% provided in one descriptor, the "v=" lines are required as delimiters;
-%% otherwise they are optional.  Implementations shall accept session
-%% descriptions that are fully conformant to RFC2327. When binary
-%% encoding the protocol the descriptor consists of groups of properties
-%% (tag-value pairs) as specified in Annex C.  Each such group may
-%% contain the parameters of a session description.
-tr_opt_LocalRemoteDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = Groups},
-                             State) ->
-    #'LocalRemoteDescriptor'{propGrps = [tr_PropertyGroup(G, State) || G <- Groups]}.
-
-tr_PropertyGroup(Props, State) ->
-    [tr_PropertyGroupParm(P, State) || P <- Props].
-
-tr_PropertyGroupParm(#'PropertyParm'{name  = Name,
-                                     value = Value},
-                     State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name  = resolve(property, Name, State, Constraint),
-                    value = tr_OCTET_STRING(Value, State, 0, infinity)}.
-
-tr_PropertyParm(#'PropertyParm'{name      = Name,
-                                value     = Value,
-                                extraInfo = Extra},
-                State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name      = resolve(property, Name, State, Constraint),
-                    value     = tr_Value(Value, State),
-                    extraInfo = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_extraInfo(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_extraInfo({relation, Rel}, _State) ->
-    Rel2 = 
-        case Rel of
-            greaterThan -> greaterThan;
-            smallerThan -> smallerThan;
-            unequalTo   -> unequalTo
-        end,
-    {relation, Rel2};
-tr_opt_extraInfo({range, Range}, State) ->
-    Range2 = tr_bool(Range, State),
-    {range, Range2};
-tr_opt_extraInfo({sublist, Sub}, State) ->
-    Sub2 = tr_bool(Sub, State),
-    {sublist, Sub2}.
-
-tr_opt_TerminationStateDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TerminationStateDescriptor(#'TerminationStateDescriptor'{propertyParms      = Props,
-                                                                eventBufferControl = Control,
-                                                                serviceState       = Service},
-                                  State) ->
-    #'TerminationStateDescriptor'{propertyParms      = [tr_PropertyParm(P, State) || P <- Props],
-                                  eventBufferControl = tr_opt_EventBufferControl(Control, State),
-                                  serviceState       = tr_opt_ServiceState(Service, State)}.
-
-tr_opt_EventBufferControl(Control, _State) ->
-    case Control of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        off          -> off;
-        lockStep     -> lockStep
-    end.
-
-tr_opt_ServiceState(Service, _State) ->
-    case Service of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        test         -> test;
-        outOfSvc     -> outOfSvc;
-        inSvc        -> inSvc
-    end.
-
-tr_MuxDescriptor(#'MuxDescriptor'{muxType  = Type,
-                                  termList = IdList},
-                 State) ->
-    #'MuxDescriptor'{muxType  = tr_MuxType(Type, State),
-                     termList = [tr_TerminationID(Id, State) || Id <- IdList]}.
-
-tr_MuxType(Type, _State) ->
-    case Type of
-        h221 -> h221;
-        h223 -> h223;
-        h226 -> h226;
-        v76  -> v76
-    end.
-
-tr_opt_StreamID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StreamID(Id, State) ->
-    tr_StreamID(Id, State).
-
-tr_StreamID(Id, State) ->
-    tr_UINT16(Id, State).
-
-tr_EventsDescriptor(#'EventsDescriptor'{requestID = Id,
-                                        eventList = Events},
-                    State) ->
-    #'EventsDescriptor'{requestID = tr_opt_RequestID(Id, State),
-                        eventList = [tr_RequestedEvent(E, State) || E <- Events]}.
-
-tr_RequestedEvent(#'RequestedEvent'{pkgdName    = Name,
-                                    streamID    = Id,
-                                    evParList   = Parms,
-                                    eventAction = Actions},
-                  State)  ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'RequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                      streamID    = tr_opt_StreamID(Id, State),
-                      eventAction = tr_opt_RequestedActions(Actions, State),
-                      evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_opt_RequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestedActions(#'RequestedActions'{keepActive        = Keep,
-                                            eventDM           = DM,
-                                            secondEvent       = Event,
-                                            signalsDescriptor = SigDesc},
-                        State) ->
-    #'RequestedActions'{keepActive        = tr_opt_keepActive(Keep, State),
-                        eventDM           = tr_opt_EventDM(DM, State),
-                        secondEvent       = tr_opt_SecondEventsDescriptor(Event, State),
-                        signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.
-
-tr_opt_keepActive(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_keepActive(Keep, State) ->
-    tr_bool(Keep, State).
-
-tr_opt_EventDM(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_EventDM({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            digitMapName  -> tr_DigitMapName(Val, State);
-            digitMapValue -> tr_DigitMapValue(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_SecondEventsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = Id,
-                                                        eventList = Events},
-                              State) ->
-    #'SecondEventsDescriptor'{requestID = tr_RequestID(Id, State), %% IG v6 6.8 withdrawn
-                              eventList = [tr_SecondRequestedEvent(E, State) || E <- Events]}.
-
-tr_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = Name,
-                                                streamID    = Id,
-                                                evParList   = Parms,
-                                                eventAction = Actions},
-                        State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'SecondRequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                            streamID    = tr_opt_StreamID(Id, State),
-                            eventAction = tr_opt_SecondRequestedActions(Actions, State),
-                            evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-
-tr_opt_SecondRequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondRequestedActions(#'SecondRequestedActions'{keepActive        = Keep,
-                                                        eventDM           = DM,
-                                                        signalsDescriptor = SigDesc},
-                              State) ->
-    #'SecondRequestedActions'{keepActive        = tr_opt_keepActive(Keep, State),
-                              eventDM           = tr_opt_EventDM(DM, State),
-                              signalsDescriptor = tr_opt_SignalsDescriptor(SigDesc, State)}.
-
-tr_EventBufferDescriptor(EventSpecs, State) ->
-    [tr_EventSpec(ES, State) || ES <- EventSpecs].
-
-tr_EventSpec(#'EventSpec'{eventName    = Name,
-                          streamID     = Id,
-                          eventParList = Parms},
-             State) ->
-    #'EventSpec'{eventName    = tr_EventName(Name, State),
-                 streamID     = tr_opt_StreamID(Id, State),
-                 eventParList = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_opt_SignalsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SignalsDescriptor(SigDesc, State) ->
-    tr_SignalsDescriptor(SigDesc, State).
-
-tr_SignalsDescriptor(SigDesc, State)  when is_list(SigDesc) ->
-    [tr_SignalRequest(SigReq, State) || SigReq <- SigDesc].
-
-tr_SignalRequest({Tag, Val}, State) ->
-    Val2 =
-        case Tag of
-            signal     -> tr_Signal(Val, State);
-            seqSigList -> tr_SeqSigList(Val, State)
-        end,
-    {Tag, Val2}.
-
-
-tr_SeqSigList(#'SeqSigList'{id         = Id,
-                            signalList = SigList},
-              State) when is_list(SigList) ->
-    #'SeqSigList'{id         = tr_UINT16(Id, State),
-                  signalList = [tr_Signal(Sig, State) || Sig <- SigList]}.
-
-tr_Signal(#'Signal'{signalName       = Name,
-                    streamID         = SID,
-                    sigType          = Type,
-                    duration         = Dur,
-                    notifyCompletion = Compl,
-                    keepActive       = Keep,
-                    sigParList       = Parms,
-		    direction        = Dir,
-		    requestID        = RID},
-          State) ->
-    Name2  = tr_SignalName(Name, State),
-    SID2   = tr_opt_StreamID(SID, State),
-    Type2  = tr_opt_SignalType(Type, State),
-    Dur2   = tr_opt_duration(Dur, State),
-    Compl2 = tr_opt_NotifyCompletion(Compl, State),
-    Keep2  = tr_opt_keepActive(Keep, State),
-    Parms2 = [tr_SigParameter(P, Name, State) || P <- Parms],
-    Dir2   = tr_opt_SignalDirection(Dir, State),
-    RID2   = tr_opt_RequestID(RID, State),
-    #'Signal'{signalName       = Name2,
-              streamID         = SID2, 
-              sigType          = Type2, 
-              duration         = Dur2, 
-              notifyCompletion = Compl2, 
-              keepActive       = Keep2, 
-              sigParList       = Parms2,
-	      direction        = Dir2,
-	      requestID        = RID2}.
-
-tr_opt_duration(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_duration(Dur, State) ->
-    tr_UINT16(Dur, State).
-
-tr_opt_NotifyCompletion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_NotifyCompletion(Items, State) when is_list(Items) ->
-    [tr_notifyCompletionItem(I, State) || I <- Items].
-
-tr_notifyCompletionItem(Item, _State) ->
-    case Item of
-        onTimeOut                   -> onTimeOut;
-        onInterruptByEvent          -> onInterruptByEvent;
-        onInterruptByNewSignalDescr -> onInterruptByNewSignalDescr;
-        otherReason                 -> otherReason
-    end.
-
-tr_opt_SignalType(asn1_NOVALUE = Type, _State) ->
-    Type;
-tr_opt_SignalType(Type, _State) ->
-    case Type of
-        brief   -> brief;
-        onOff   -> onOff;
-        timeOut -> timeOut
-    end.
-
-tr_opt_SignalDirection(asn1_NOVALUE = SD, _State) ->
-    SD;
-tr_opt_SignalDirection(SD, _State) ->
-    case SD of
-	internal -> internal;
-	external -> external;
-	both     -> both
-    end.
-	     
-tr_SignalName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(signal, Name, State, Constraint).
-
-tr_SigParameter(#'SigParameter'{sigParameterName = ParName,
-                                value            = Value,
-                                extraInfo        = Extra},
-                SigName,
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({signal_parameter, SigName}, ParName, State, Constraint),
-    #'SigParameter'{sigParameterName = N,
-                    value            = tr_Value(Value, State),
-                    extraInfo        = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_RequestID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestID(Id, State) ->
-    tr_RequestID(Id, State).
-
-tr_RequestID(Id, _State) when Id =:= ?megaco_all_request_id ->
-    ?megaco_all_request_id;
-tr_RequestID(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_ModemDescriptor(_MD, _State) ->
-    deprecated.
-
-tr_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName  = Name,
-                                            digitMapValue = Value},
-                      State) ->
-    #'DigitMapDescriptor'{digitMapName  = tr_opt_DigitMapName(Name, State),
-                          digitMapValue = tr_opt_DigitMapValue(Value, State)}.
-
-tr_opt_DigitMapName(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapName(Name, State) ->
-    tr_DigitMapName(Name, State).
-
-tr_DigitMapName(Name, State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    resolve(dialplan, Name, State, Constraint).
-
-tr_opt_DigitMapValue(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapValue(Value, State) ->
-    tr_DigitMapValue(Value, State).
-
-tr_DigitMapValue(#'DigitMapValue'{digitMapBody = Body,
-                                  startTimer   = Start,
-                                  shortTimer   = Short,
-                                  longTimer    = Long},
-                 State) ->
-    #'DigitMapValue'{startTimer   = tr_opt_timer(Start, State),
-                     shortTimer   = tr_opt_timer(Short, State),
-                     longTimer    = tr_opt_timer(Long, State),
-                     digitMapBody = tr_STRING(Body, State)}. %% BUGBUG: digitMapBody not handled at all
-
-tr_opt_timer(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_timer(Timer, State) ->
-    tr_DIGIT(Timer, State, 0, 99).
-
-tr_ServiceChangeParm(
-  #'ServiceChangeParm'{serviceChangeMethod  = Method, 
-		       serviceChangeAddress = Addr, 
-		       serviceChangeVersion = Version, 
-		       serviceChangeProfile = Profile, 
-		       serviceChangeReason  = Reason, 
-		       serviceChangeDelay   = Delay, 
-		       serviceChangeMgcId   = MgcId, 
-		       timeStamp            = Time,
-		       serviceChangeInfo    = Info,
-		       serviceChangeIncompleteFlag = Incomplete},
-  State) ->
-    Method2     = tr_ServiceChangeMethod(Method, State),
-    Addr2       = tr_opt_ServiceChangeAddress(Addr, State),
-    Version2    = tr_opt_serviceChangeVersion(Version, State),
-    Profile2    = tr_opt_ServiceChangeProfile(Profile, State),
-    Reason2     = tr_serviceChangeReason(Reason, State),
-    Delay2      = tr_opt_serviceChangeDelay(Delay, State),
-    MgcId2      = tr_opt_serviceChangeMgcId(MgcId, State),
-    Time2       = tr_opt_TimeNotation(Time, State),
-    Info2       = tr_opt_AuditDescriptor(Info, State),
-    Incomplete2 = tr_opt_null(Incomplete, State),
-    #'ServiceChangeParm'{serviceChangeMethod         = Method2,
-                         serviceChangeAddress        = Addr2,
-                         serviceChangeVersion        = Version2,
-                         serviceChangeProfile        = Profile2,
-                         serviceChangeReason         = Reason2, 
-                         serviceChangeDelay          = Delay2, 
-                         serviceChangeMgcId          = MgcId2, 
-                         timeStamp                   = Time2, 
-			 serviceChangeInfo           = Info2, 
-			 serviceChangeIncompleteFlag = Incomplete2}.
-
-tr_ServiceChangeMethod(Method, _State) ->
-    case Method of
-        failover      -> failover;
-        forced        -> forced;
-        graceful      -> graceful;
-        restart       -> restart;
-        disconnected  -> disconnected;
-        handOff       -> handOff
-    end. %% BUGBUG: extension
-
-tr_opt_ServiceChangeAddress(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ServiceChangeAddress({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            portNumber -> tr_portNumber(Val, State);
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val, State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_serviceChangeVersion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeVersion(Version, State) ->
-    tr_version(Version, State).
-
-tr_opt_ServiceChangeProfile(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-%% Decode
-tr_opt_ServiceChangeProfile({'ServiceChangeProfile', ProfileName}, State) ->
-    case string:tokens(ProfileName, "/") of
-        [Name0, Version0] ->
-	    Name    = tr_STRING(Name0, State, 1, 64),
-	    Version = tr_version(list_to_integer(Version0), State),
-	    #'ServiceChangeProfile'{profileName = Name, 
-				    version     = Version}
-    end;
-%% Encode
-tr_opt_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = Name0, 
-						    version     = Version0},
-			    State) ->
-    Name        = tr_STRING(Name0, State, 1, 64),
-    Version     = tr_version(Version0, State),
-    ProfileName = lists:flatten(io_lib:format("~s/~w", [Name, Version])),
-    {'ServiceChangeProfile', ProfileName}.
-    
-tr_serviceChangeReason([_] = Reason, State) ->
-    tr_Value(Reason, State).
-
-tr_opt_serviceChangeDelay(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeDelay(Delay, State) ->
-    tr_UINT32(Delay, State).
-
-tr_opt_serviceChangeMgcId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeMgcId(MgcId, State) ->
-    tr_MId(MgcId, State).
-
-tr_opt_portNumber(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_portNumber(Port, State) ->
-    tr_portNumber(Port, State).
-
-tr_portNumber(Port, State) when is_integer(Port) andalso (Port >= 0) ->
-    tr_UINT16(Port, State).
-
-tr_ServiceChangeResParm(#'ServiceChangeResParm'{serviceChangeMgcId   = MgcId, 
-                                                serviceChangeAddress = Addr, 
-                                                serviceChangeVersion = Version, 
-                                                serviceChangeProfile = Profile,
-						timeStamp            = Time}, 
-                        State) ->
-    #'ServiceChangeResParm'{serviceChangeMgcId   = tr_opt_serviceChangeMgcId(MgcId, State),
-                            serviceChangeAddress = tr_opt_ServiceChangeAddress(Addr, State),
-                            serviceChangeVersion = tr_opt_serviceChangeVersion(Version, State),
-                            serviceChangeProfile = tr_opt_ServiceChangeProfile(Profile, State),
-			    timeStamp            = tr_opt_TimeNotation(Time, State)}.
-
-tr_PackagesDescriptor(Items, State) when is_list(Items) ->
-    [tr_PackagesItem(I, State) || I <- Items].
-
-tr_PackagesItem(#'PackagesItem'{packageName    = Name,
-                                packageVersion = Version},
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    #'PackagesItem'{packageName    = resolve(package, Name, State, Constraint),
-                    packageVersion = tr_UINT16(Version, State)}.
-
-tr_opt_StatisticsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StatisticsDescriptor(Parms, State) ->
-    tr_StatisticsDescriptor(Parms, State).
-
-tr_StatisticsDescriptor(Parms, State) when is_list(Parms) ->
-    [tr_StatisticsParameter(P, State) || P <- Parms].
-
-tr_StatisticsParameter(#'StatisticsParameter'{statName  = Name,
-                                              statValue = Value},
-                       State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'StatisticsParameter'{statName  = resolve(statistics, Name, State, Constraint),
-                           statValue = tr_opt_Value(Value, State)}.
-
-tr_opt_TimeNotation(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TimeNotation(#'TimeNotation'{date = Date,
-                                    time = Time},
-                    State) ->
-    #'TimeNotation'{date = tr_STRING(Date, State, 8, 8), % "yyyymmdd"
-                    time = tr_STRING(Time, State, 8, 8)}.% "hhmmssss"
-
-%% BUGBUG: Does not verify that string must contain at least one char
-%% BUGBUG: This violation of the is required in order to comply with
-%% BUGBUG: the dd/ce ds parameter that may possibly be empty.
-
-tr_opt_Value(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_Value(Value, State) ->
-    tr_Value(Value, State).
-
-tr_Value(Strings, _State) when is_list(Strings) ->
-    [[Char || Char <- String] || String <- Strings].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%% Encode an octet string, escape } by \ if necessary 
-tr_OCTET_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_QUOTED_STRING(String, _State) when is_list(String) ->
-    verify_count(length(String), 1, infinity),
-    String.
-
-%% The internal format of hex digits is a list of octets
-%% Min and Max means #hexDigits
-%% Leading zeros are prepended in order to fulfill Min
-tr_HEXDIG(Octets, _State, Min, Max) when is_list(Octets) ->
-    verify_count(length(Octets), Min, Max),
-    Octets.
-
-tr_DIGIT(Val, State, Min, Max) ->
-    tr_integer(Val, State, Min, Max).
-
-tr_STRING(String, _State) when is_list(String) ->
-    String.
-
-tr_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_opt_UINT16(Val, State) ->
-    tr_opt_integer(Val, State, 0, 65535).
-
-tr_UINT16(Val, State) ->
-    tr_integer(Val, State, 0, 65535).
-
-tr_UINT32(Val, State) ->
-    tr_integer(Val, State, 0, 4294967295).
-
-tr_opt_integer(asn1_NOVALUE, _State, _Min, _Max) ->
-    asn1_NOVALUE;
-tr_opt_integer(Int, State, Min, Max) ->
-    tr_integer(Int, State, Min, Max).
-
-tr_integer(Int, _State, Min, Max) ->
-    verify_count(Int, Min, Max),
-    Int.
-
-%% Verify that Count is within the range of Min and Max
-verify_count(Count, Min, Max) ->
-    if
-        is_integer(Count) ->
-            if
-                is_integer(Min) andalso (Count >= Min) ->
-                    if
-                        is_integer(Max) andalso (Count =< Max) ->
-                            Count;
-                        Max =:= infinity ->
-                            Count;
-                        true ->
-                            error({count_too_large, Count, Max})
-                    end;
-                true ->
-                    error({count_too_small, Count, Min})
-            end;
-        true ->
-            error({count_not_an_integer, Count})
-    end.
diff --git a/lib/megaco/src/binary/megaco_binary_transformer_prev3c.erl b/lib/megaco/src/binary/megaco_binary_transformer_prev3c.erl
deleted file mode 100644
index da6ea877ba..0000000000
--- a/lib/megaco/src/binary/megaco_binary_transformer_prev3c.erl
+++ /dev/null
@@ -1,1755 +0,0 @@
-%%
-%% %CopyrightBegin%
-%% 
-%% Copyright Ericsson AB 2005-2020. All Rights Reserved.
-%% 
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%%     http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%% 
-%% %CopyrightEnd%
-%%
-
-%%
-%%----------------------------------------------------------------------
-%% Purpose: Transform internal form of Megaco/H.248 messages
-%%
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%                      DEPRECATED
-%%
-%%----------------------------------------------------------------------
-
--module(megaco_binary_transformer_prev3c).
-
--include_lib("megaco/include/megaco.hrl").
-%% -include_lib("megaco/include/megaco_message.hrl").
--include_lib("megaco/include/megaco_message_prev3c.hrl").
--include_lib("megaco/src/app/megaco_internal.hrl").
-
--export([tr_message/3, tr_transaction/3]).
-
-
--define(DEFAULT_NAME_RESOLVER, megaco_binary_name_resolver_prev3c).
-
--record(state, {mode,                 % verify | encode | decode
-                resolver_module,      % 
-                resolver_options}).
-
-resolve(Type, Item, State, Constraint) ->
-    case State#state.mode of
-        verify ->
-            Item;
-        encode ->
-	    ?d("resolve(encode) -> encode: ~p",[Item]),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-            EncodedItem = Mod:encode_name(Opt, Type, Item),
-	    ?d("resolve -> verify contraint for ~p",[EncodedItem]),
-	    verify_constraint(EncodedItem, Constraint);
-        decode ->
-	    ?d("resolve(decode) -> verify contraint for ~p",[Item]),
-	    DecodedItem = verify_constraint(Item, Constraint),
-            Mod = State#state.resolver_module,
-            Opt = State#state.resolver_options,
-	    ?d("resolve(decode) -> decode: ~p",[DecodedItem]),
-            Mod:decode_name(Opt, Type, DecodedItem)
-    end.
-
-verify_constraint(Item, valid) ->
-    Item;
-verify_constraint(Item, Constraint) when is_function(Constraint) ->
-    Constraint(Item).
-
-tr_message(MegaMsg, Mode, Config) ->
-    case Config of
-        [native] ->
-            MegaMsg;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_MegacoMessage(MegaMsg, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_MegacoMessage(MegaMsg, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_MegacoMessage(MegaMsg, State)
-    end.
-
-tr_transaction(Trans, Mode, Config) ->
-    case Config of
-        [native] ->
-            Trans;
-        [verify] ->
-            State = #state{mode = verify},
-            tr_Transaction(Trans, State);
-        [] ->
-            State = #state{mode             = Mode,
-                           resolver_module  = ?DEFAULT_NAME_RESOLVER,
-                           resolver_options = [8, 8, 8]},
-            tr_Transaction(Trans, State);
-        [{binary_name_resolver, {Module, Options}}] when is_atom(Module) ->
-            State = #state{mode             = Mode, 
-                           resolver_module  = Module, 
-                           resolver_options = Options},
-            tr_Transaction(Trans, State)
-    end.
-
-tr_MegacoMessage(#'MegacoMessage'{authHeader = Auth,
-                                  mess       = Mess},
-                 State) ->
-    ?d("tr_MegacoMessage -> entry with"
-       "~n   Auth:  ~p"
-       "~n   Mess:  ~p"
-       "~n   State: ~p", [Auth, Mess, State]),
-    #'MegacoMessage'{authHeader = tr_opt_AuthenticationHeader(Auth, State),
-                     mess       = tr_Message(Mess, State)}.
-
-tr_opt_AuthenticationHeader(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuthenticationHeader(#'AuthenticationHeader'{secParmIndex = SPI,
-                                                    seqNum       = SN,
-                                                    ad           = AuthData},
-                            State) ->
-    #'AuthenticationHeader'{secParmIndex = tr_SecurityParmIndex(SPI, State),
-                            seqNum       = tr_SequenceNum(SN, State),
-                            ad           = tr_AuthData(AuthData, State)}.
-
-tr_SecurityParmIndex(SPI, State) ->
-    tr_HEXDIG(SPI, State, 4, 4). % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_SequenceNum(SN, State) ->
-    tr_HEXDIG(SN, State, 4, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_AuthData(AuthData, State) ->
-    tr_HEXDIG(AuthData, State, 12, 32).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_Message(#'Message'{version     = Version,
-                      mId         = MID,
-                      messageBody = Body},
-           State) ->
-    #'Message'{version     = tr_version(Version, State),
-               mId         = tr_MId(MID, State),
-               messageBody = tr_Message_messageBody(Body, State)}.
-
-tr_version(Version, State) ->
-    tr_DIGIT(Version, State, 0, 99).
-
-tr_Message_messageBody({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            messageError -> tr_ErrorDescriptor(Val, State);
-            transactions when is_list(Val) -> [tr_Transaction(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_MId({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val,   State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_mtpAddress(MtpAddr, State) ->
-    tr_OCTET_STRING(MtpAddr, State, 2, 4).  % BUGBUG: Mismatch between ASN.1 and ABNF
-
-tr_DomainName(#'DomainName'{name       = Name,
-                            portNumber = Port},
-              State) ->
-    Domain = #'DomainName'{name       = tr_STRING(Name, State), % BUGBUG: Mismatch between ASN.1 and ABNF
-                           portNumber = tr_opt_portNumber(Port, State)},
-    {domainName, Domain2} = resolve(mid, {domainName, Domain}, State, valid),
-    Domain2.
-
-tr_IP4Address(#'IP4Address'{address    = [A1, A2, A3, A4],
-                            portNumber = Port},
-              State) ->
-    #'IP4Address'{address    = [tr_V4hex(A1, State),
-                                tr_V4hex(A2, State),
-                                tr_V4hex(A3, State),
-                                tr_V4hex(A4, State)],
-                  portNumber = tr_opt_portNumber(Port, State)}.
-
-tr_V4hex(Val, State) ->
-    tr_DIGIT(Val, State, 0, 255).
-
-tr_IP6Address(_Val, _State) ->
-    error(ipv6_not_supported). %% BUGBUG: nyi
-
-tr_PathName(Path, State) ->
-    %% BUGBUG: ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-    %% BUGBUG: ["@" pathDomainName ]
-    Constraint = fun({deviceName, Item}) -> tr_STRING(Item, State, 1, 64) end,
-    resolve(mid, {deviceName, Path}, State, Constraint).
-
-tr_Transaction({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionRequest ->     tr_TransactionRequest(Val, State);
-            transactionPending ->     tr_TransactionPending(Val, State);
-            transactionReply ->       tr_TransactionReply(Val, State);
-            transactionResponseAck -> [tr_TransactionAck(T, State) || T <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_TransactionAck(#'TransactionAck'{firstAck = First,
-				    lastAck  = Last},
-                          State) ->
-    #'TransactionAck'{firstAck = tr_TransactionId(First, State),
-		      lastAck  = tr_opt_TransactionId(Last, State)}.
-
-tr_opt_TransactionId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TransactionId(Id, State) ->
-    tr_TransactionId(Id, State).
-
-tr_TransactionId(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_TransactionRequest(#'TransactionRequest'{transactionId = Id,
-                                            actions       = Actions},
-                      State) when is_list(Actions) ->
-
-    #'TransactionRequest'{transactionId = tr_TransactionId(Id, State),
-                          actions       = [tr_ActionRequest(ActReq, State) || ActReq <- Actions]}.
-
-tr_TransactionPending(#'TransactionPending'{transactionId = Id},
-                      State) ->
-    #'TransactionPending'{transactionId = tr_TransactionId(Id, State)}.
-
-tr_TransactionReply(#'TransactionReply'{transactionId        = Id,
-                                        immAckRequired       = ImmAck,
-                                        transactionResult    = TransRes,
-					%% These fields are actually not 
-					%% supported in this implementation,
-					%% but because the messanger module
-					%% cannot see any diff between the
-					%% various v3 implementations...
-					segmentNumber        = asn1_NOVALUE,
-					segmentationComplete = asn1_NOVALUE},
-                    State) ->
-    #'TransactionReply'{transactionId        = tr_TransactionId(Id, State),
-                        immAckRequired       = tr_opt_null(ImmAck, State),
-                        transactionResult    = tr_TransactionReply_transactionResult(TransRes, State),
-			segmentNumber        = asn1_NOVALUE,
-			segmentationComplete = asn1_NOVALUE};
-tr_TransactionReply(TR, _State) ->
-    error({unsupported_TransactionReply, TR}).
-
-tr_opt_null(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_null('NULL', _State)       -> 'NULL'.
-
-tr_TransactionReply_transactionResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            transactionError ->
-                tr_ErrorDescriptor(Val, State);
-            actionReplies when is_list(Val) andalso (Val =/= []) ->
-                [tr_ActionReply(ActRep, State) || ActRep <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_opt_ErrorDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ErrorDescriptor(ErrDesc, State) ->
-    tr_ErrorDescriptor(ErrDesc, State).
-
-tr_ErrorDescriptor(#'ErrorDescriptor'{errorCode = Code,
-                                      errorText = Text},
-                   State) ->
-    #'ErrorDescriptor'{errorCode = tr_ErrorCode(Code, State),
-                       errorText = tr_opt_ErrorText(Text, State)}.
-
-tr_ErrorCode(Code, State) ->
-    tr_DIGIT(Code, State, 0, 999).
-
-tr_opt_ErrorText(asn1_NOVALUE, _State)  ->
-    asn1_NOVALUE;
-tr_opt_ErrorText(Text, State)  ->
-    tr_QUOTED_STRING(Text, State).
-
-tr_ContextID(CtxId, State) ->
-    case CtxId of
-        ?megaco_all_context_id    -> ?megaco_all_context_id;
-        ?megaco_null_context_id   -> ?megaco_null_context_id;
-        ?megaco_choose_context_id -> ?megaco_choose_context_id;
-        Int when is_integer(Int)  -> tr_UINT32(Int, State)
-    end.
-
-tr_ActionRequest(#'ActionRequest'{contextId           = CtxId,
-                                  contextRequest      = CtxReq,
-                                  contextAttrAuditReq = CtxAuditReq,
-                                  commandRequests     = CmdReqList},
-                 State) ->
-    #'ActionRequest'{contextId           = tr_ContextID(CtxId, State),
-                     contextRequest      = tr_opt_ContextRequest(CtxReq, State),
-                     contextAttrAuditReq = tr_opt_ContextAttrAuditRequest(CtxAuditReq, State),
-                     commandRequests     = [tr_CommandRequest(CmdReq, State) || CmdReq <- CmdReqList]}.
-
-tr_ActionReply(#'ActionReply'{contextId       = CtxId,
-                              errorDescriptor = ErrDesc,
-                              contextReply    = CtxRep,
-                              commandReply    = CmdRepList},
-               State) ->
-    CmdRepList2 = [tr_CommandReply(CmdRep, State) || CmdRep <- CmdRepList],
-    #'ActionReply'{contextId       = tr_ContextID(CtxId, State),
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State),
-                   contextReply    = tr_opt_ContextRequest(CtxRep, State),
-                   commandReply    = CmdRepList2}.
-
-tr_opt_ContextRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextRequest(CR, State) ->
-    tr_ContextRequest(CR, State).
-
-tr_ContextRequest(#'ContextRequest'{priority    = Prio,
-				    emergency   = Em,
-				    topologyReq = TopReqList,
-				    iepscallind = Ind,
-				    contextProp = CtxProps,
-				    contextList = CtxList},
-		  State) ->
-    Prio2 = 
-        case Prio of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_integer(Prio, State, 0, 15)
-        end,
-    Em2 = 
-        case Em of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    TopReqList2 = 
-        case TopReqList of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_TopologyRequest(TopReq, State) ||
-                                TopReq <- TopReqList]
-        end,
-    Ind2 = 
-	case Ind of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    CtxProps2 = 
-	case CtxProps of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_PropertyParm(Prop, State) || Prop <- CtxProps]
-	end,
-    CtxList2 = 
-	case CtxList of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_ContextID(Id, State) || Id <- CtxList]
-	end,
-    #'ContextRequest'{priority    = Prio2,
-                      emergency   = Em2,
-                      topologyReq = TopReqList2,
-		      iepscallind = Ind2,
-		      contextProp = CtxProps2,
-		      contextList = CtxList2}.
-
-tr_opt_ContextAttrAuditRequest(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ContextAttrAuditRequest(CAAR, State) ->
-    tr_ContextAttrAuditRequest(CAAR, State).
-
-tr_ContextAttrAuditRequest(#'ContextAttrAuditRequest'{topology        = Top,
-						      emergency       = Em,
-						      priority        = Prio,
-						      iepscallind     = Ind,
-						      contextPropAud  = Props,
-						      selectpriority  = SPrio,
-						      selectemergency = SEm,
-						      selectiepscallind = SInd,
-						      selectLogic     = SLog},
-                               State) ->
-    Top2   = tr_opt_null(Top,  State),
-    Em2    = tr_opt_null(Em,   State),
-    Prio2  = tr_opt_null(Prio, State),
-    Ind2   = tr_opt_null(Ind,  State),
-    Props2 = 
-	case Props of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _            -> 
-		[tr_indAudPropertyParm(Prop, State) || Prop <- Props]
-	end,
-    SPrio2 = 
-        case SPrio of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_integer(SPrio, State, 0, 15)
-        end,
-    SEm2 = 
-        case SEm of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    SInd2 = 
-	case SInd of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            false        -> false;
-            true         -> true
-        end,
-    SLog2 = 
-        case SLog of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_SelectLogic(SLog, State)
-        end,
-    #'ContextAttrAuditRequest'{topology          = Top2,
-                               emergency         = Em2, 
-                               priority          = Prio2, 
-			       iepscallind       = Ind2, 
-			       contextPropAud    = Props2,
-			       selectpriority    = SPrio2,
-			       selectemergency   = SEm2,
-			       selectiepscallind = SInd2,
-			       selectLogic       = SLog2}.
-
-tr_SelectLogic({andAUDITSelect, 'NULL'} = Val, _State) ->
-    Val;
-tr_SelectLogic({orAUDITSelect, 'NULL'} = Val, _State) ->
-    Val.
-    
-tr_CommandRequest(#'CommandRequest'{command        = Cmd,
-                                    optional       = Opt,
-                                    wildcardReturn = Wild},
-                  State) ->
-    #'CommandRequest'{optional       = tr_opt_null(Opt, State),
-                      wildcardReturn = tr_opt_null(Wild, State),
-                      command        = tr_Command(Cmd, State)}.
-
-tr_Command({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReq ->            tr_AmmRequest(Val, State);
-            moveReq ->           tr_AmmRequest(Val, State);
-            modReq ->            tr_AmmRequest(Val, State);
-            subtractReq ->       tr_SubtractRequest(Val, State);
-            auditCapRequest ->   tr_AuditRequest(Val, State);
-            auditValueRequest -> tr_AuditRequest(Val, State);
-            notifyReq ->         tr_NotifyRequest(Val, State);
-            serviceChangeReq ->  tr_ServiceChangeRequest(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_CommandReply({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            addReply ->           tr_AmmsReply(Val, State);
-            moveReply ->          tr_AmmsReply(Val, State);
-            modReply ->           tr_AmmsReply(Val, State);
-            subtractReply ->      tr_AmmsReply(Val, State);
-            auditCapReply ->      tr_AuditReply(Val, State);
-            auditValueReply ->    tr_AuditReply(Val, State);
-            notifyReply ->        tr_NotifyReply(Val, State);
-            serviceChangeReply -> tr_ServiceChangeReply(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_TopologyRequest(#'TopologyRequest'{terminationFrom            = From,
-                                      terminationTo              = To,
-                                      topologyDirection          = Dir,
-				      streamID                   = SID,
-				      topologyDirectionExtension = TDE},
-                   State) ->
-    Dir2 = 
-        case Dir of
-            bothway -> bothway;
-            isolate -> isolate;
-            oneway ->  oneway
-        end,
-    TDE2 = 
-	case TDE of
-	    onewayexternal -> onewayexternal;
-	    onewayboth     -> onewayboth;
-	    asn1_NOVALUE   -> asn1_NOVALUE
-	end,
-    #'TopologyRequest'{terminationFrom   = tr_TerminationID(From, State),
-                       terminationTo     = tr_TerminationID(To, State),
-                       topologyDirection = Dir2,
-		       streamID          = tr_opt_StreamID(SID, State),
-		       topologyDirectionExtension = TDE2}.
-
-tr_AmmRequest(#'AmmRequest'{terminationID = IdList,
-                            descriptors   = DescList},
-              State) ->
-    #'AmmRequest'{terminationID = [tr_TerminationID(Id, State) || 
-				      Id <- IdList],
-                  descriptors   = tr_ammDescriptors(DescList, [], State)}.
-
-tr_ammDescriptors([], Acc, _State) ->
-    lists:reverse(Acc);
-tr_ammDescriptors([Desc|Descs], Acc, State) ->
-    case tr_ammDescriptor(Desc, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Desc});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    tr_ammDescriptors(Descs, Acc, State);
-	NewDesc ->
-	    tr_ammDescriptors(Descs, [NewDesc|Acc], State)
-    end.
-
-tr_ammDescriptor({Tag, Desc}, State) ->
-    Desc2 = 
-        case Tag of
-            mediaDescriptor       -> tr_MediaDescriptor(Desc, State);
-            modemDescriptor       -> tr_ModemDescriptor(Desc, State);      
-            muxDescriptor         -> tr_MuxDescriptor(Desc, State);   
-            eventsDescriptor      -> tr_EventsDescriptor(Desc, State);      
-            eventBufferDescriptor -> tr_EventBufferDescriptor(Desc, State); 
-            signalsDescriptor     -> tr_SignalsDescriptor(Desc, State);    
-            digitMapDescriptor    -> tr_DigitMapDescriptor(Desc, State);    
-            auditDescriptor       -> tr_AuditDescriptor(Desc, State);
-	    statisticsDescriptor  -> tr_StatisticsDescriptor(Desc, State)
-        end,
-    {Tag, Desc2}.
-
-tr_AmmsReply(#'AmmsReply'{terminationID    = IdList,
-                          terminationAudit = TermAudit},
-             State) ->
-    TermAudit2 =
-        case TermAudit of
-            asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> tr_TerminationAudit(TermAudit, State)
-        end,
-    #'AmmsReply'{terminationID    = [tr_TerminationID(Id, State) ||
-                                        Id <- IdList],
-                 terminationAudit = TermAudit2}.
-
-tr_SubtractRequest(#'SubtractRequest'{terminationID   = IdList,
-                                      auditDescriptor = Desc},
-                   State) ->
-    #'SubtractRequest'{terminationID   = [tr_TerminationID(Id, State) ||
-                                             Id <- IdList],
-                       auditDescriptor = tr_opt_AuditDescriptor(Desc, State)}.
-
-tr_AuditRequest(#'AuditRequest'{terminationID     = Id,
-                                auditDescriptor   = Desc,
-				terminationIDList = TIDList},
-                State) ->
-    TIDList2 = 
-	case TIDList of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-            _            -> [tr_TerminationID(TID, State) || TID <- TIDList]
-	end,
-    #'AuditRequest'{terminationID     = tr_TerminationID(Id, State),
-                    auditDescriptor   = tr_AuditDescriptor(Desc, State),
-		    terminationIDList = TIDList2}.
-
-%% auditReply           = (AuditValueToken / AuditCapToken ) 
-%%                        ( contextTerminationAudit  / auditOther)
-%% auditOther           = EQUAL TerminationID LBRKT 
-%%                        terminationAudit RBRKT
-%% terminationAudit     = auditReturnParameter *(COMMA auditReturnParameter) 
-%% 
-%% contextTerminationAudit = EQUAL CtxToken ( terminationIDList / 
-%%                        LBRKT errorDescriptor RBRKT )
-
-tr_AuditReply({Tag, Val}, State) ->
-    Val2 =
-	case Tag of
-	    contextAuditResult ->
-		[tr_TerminationID(Id, State) || Id <- Val];
-	    error ->
-		tr_ErrorDescriptor(Val, State);
-	    auditResult ->
-		tr_AuditResult(Val, State);
-	    auditResultTermList ->
-		tr_TermListAuditResult(Val, State)
-	end,
-    {Tag, Val2}.
-
-tr_AuditResult(#'AuditResult'{terminationID          = Id,
-			      terminationAuditResult = AuditRes},
-              State) ->
-    #'AuditResult'{terminationID          = tr_TerminationID(Id, State),
-		   terminationAuditResult = tr_TerminationAudit(AuditRes, State)}.
-
-tr_TermListAuditResult(
-  #'TermListAuditResult'{terminationIDList      = TIDList,
-			 terminationAuditResult = TAR},
-  State) ->
-    TIDList2 = [tr_TerminationID(TID, State) || TID <- TIDList],
-    TAR2     = tr_TerminationAudit(TAR, State), 
-    #'TermListAuditResult'{terminationIDList      = TIDList2,
-			   terminationAuditResult = TAR2}.
-
-
-tr_opt_AuditDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_AuditDescriptor(Desc, State) ->
-    tr_AuditDescriptor(Desc, State).
-
-%% BUGBUG BUGBUG BUGBUG 
-%% With this construction it is possible to have both auditToken
-%% and auditPropertyToken, but it is actually valid?
-tr_AuditDescriptor(#'AuditDescriptor'{auditToken         = Tokens,
-				      auditPropertyToken = APTs},
-                   State) ->
-    Tokens2 = 
-	case Tokens of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-	    _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-	end,
-    %% v2
-    APTs2 = 
-	case APTs of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		[tr_indAuditParameter(APT, State) || APT <- APTs]
-	end,
-    #'AuditDescriptor'{auditToken         = Tokens2,
-		       auditPropertyToken = APTs2}.  
-
-tr_auditItem(Token, _State) ->
-    case Token of
-        muxToken            -> muxToken;
-        modemToken          -> modemToken;
-        mediaToken          -> mediaToken;
-        eventsToken         -> eventsToken;
-        signalsToken        -> signalsToken;
-        digitMapToken       -> digitMapToken;
-        statsToken          -> statsToken;
-        observedEventsToken -> observedEventsToken;
-        packagesToken       -> packagesToken;
-        eventBufferToken    -> eventBufferToken
-    end.
-
-%% --- v2 begin ---
-
-tr_indAuditParameter({Tag, Val}, State) ->
-    Val2 = 
-	case Tag of
-	    indAudMediaDescriptor       -> 
-		tr_indAudMediaDescriptor(Val, State);
-	    indAudEventsDescriptor      -> 
-		tr_indAudEventsDescriptor(Val, State);
-	    indAudSignalsDescriptor     -> 
-		tr_indAudSignalsDescriptor(Val, State);
-	    indAudDigitMapDescriptor    -> 
-		tr_indAudDigitMapDescriptor(Val, State);
-	    indAudEventBufferDescriptor -> 
-		tr_indAudEventBufferDescriptor(Val, State);
-	    indAudStatisticsDescriptor  -> 
-		tr_indAudStatisticsDescriptor(Val, State);
-	    indAudPackagesDescriptor    -> 
-		tr_indAudPackagesDescriptor(Val, State)
-	end,
-    {Tag, Val2}.
-
-
-%% -
-
-tr_indAudMediaDescriptor(#'IndAudMediaDescriptor'{termStateDescr = TSD,
-						  streams        = S}, 
-			 State) ->
-    TSD2 = 
-	case TSD of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    _ -> 
-		tr_indAudTerminationStateDescriptor(TSD, State)
-	end,
-    S2 = 
-	case S of
-	    asn1_NOVALUE -> 
-		asn1_NOVALUE;
-	    {oneStream, OS} ->
-		{oneStream, tr_indAudStreamParms(OS, State)};
-	    {multiStream, MS} ->
-		MS2 = [tr_indAudStreamDescriptor(MS1, State) || MS1 <- MS],
-		{multiStream, MS2}
-	end,
-    #'IndAudMediaDescriptor'{termStateDescr = TSD2,
-			     streams        = S2}.
-
-tr_indAudTerminationStateDescriptor(Val, State) 
-  when is_record(Val, 'IndAudTerminationStateDescriptor') ->
-    #'IndAudTerminationStateDescriptor'{propertyParms      = Parms,
-					eventBufferControl = EBC,
-					serviceState       = SS,
-					serviceStateSel    = SSS} = Val,
-    Parms2 = [tr_indAudPropertyParm(Parm, State) || Parm <- Parms],
-    EBC2   = tr_opt_null(EBC, State),
-    SS2    = tr_opt_null(SS, State),
-    SSS2   = tr_opt_ServiceState(SSS, State),
-    #'IndAudTerminationStateDescriptor'{propertyParms      = Parms2, 
-					eventBufferControl = EBC2,
-					serviceState       = SS2,
-					serviceStateSel    = SSS2}.
-
-    
-tr_indAudStreamParms(#'IndAudStreamParms'{localControlDescriptor = LCD, 
-					  localDescriptor        = LD, 
-					  remoteDescriptor       = RD,
-					  statisticsDescriptor   = SD}, 
-		     State) ->
-    LCD2 = 
-	case LCD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalControlDescriptor(LCD, State)
-	end,
-    LD2 = 
-	case LD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(LD, State)
-	end,
-    RD2 = 
-	case RD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudLocalRemoteDescriptor(RD, State)
-	end,
-    SD2 = 
-	case SD of
-	    asn1_NOVALUE ->
-		asn1_NOVALUE;
-	    _ ->
-		tr_indAudStatisticsDescriptor(SD, State)
-	end,
-    #'IndAudStreamParms'{localControlDescriptor = LCD2, 
-			 localDescriptor        = LD2, 
-			 remoteDescriptor       = RD2,
-			 statisticsDescriptor   = SD2}.
-    
-tr_indAudLocalControlDescriptor(Val, State) 
-  when is_record(Val, 'IndAudLocalControlDescriptor') ->
-    #'IndAudLocalControlDescriptor'{streamMode    = M,
-				    reserveValue  = V,
-				    reserveGroup  = G,
-				    propertyParms = P,
-				    streamModeSel = SMS} = Val,
-    M2   = tr_opt_null(M, State),
-    V2   = tr_opt_null(V, State),
-    G2   = tr_opt_null(G, State),
-    P2   = tr_indAudLocalControlDescriptor_propertyParms(P, State),
-    SMS2 = tr_opt_StreamMode(SMS, State),
-    #'IndAudLocalControlDescriptor'{streamMode    = M2,
-				    reserveValue  = V2,
-				    reserveGroup  = G2,
-				    propertyParms = P2,
-				    streamModeSel = SMS2}.
-
-tr_indAudLocalControlDescriptor_propertyParms(Parms, State) 
-  when is_list(Parms) andalso (length(Parms) > 0) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Parms];
-tr_indAudLocalControlDescriptor_propertyParms(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE.
-
-tr_indAudLocalRemoteDescriptor(#'IndAudLocalRemoteDescriptor'{propGroupID = ID,
-							      propGrps = Grps},
-			       State) ->
-    #'IndAudLocalRemoteDescriptor'{propGroupID = tr_opt_UINT16(ID, State),
-				   propGrps = tr_indAudPropertyGroup(Grps, 
-								     State)}.
-
-tr_indAudPropertyGroup(Grps, State) when is_list(Grps) ->
-    [tr_indAudPropertyParm(Parm, State) || Parm <- Grps].
-
-tr_indAudPropertyParm(#'IndAudPropertyParm'{name          = Name0,
-					    propertyParms = Prop0}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(property, Name0, State, Constraint),
-    Prop = 
-	case Prop0 of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-	    _            -> tr_PropertyParm(Prop0, State)
-	end,
-    #'IndAudPropertyParm'{name          = Name,
-			  propertyParms = Prop}.
-
-
-tr_indAudStreamDescriptor(#'IndAudStreamDescriptor'{streamID = ID,
-						    streamParms = Parms},
-			  State) ->
-    #'IndAudStreamDescriptor'{streamID    = tr_StreamID(ID, State),
-			      streamParms = tr_indAudStreamParms(Parms, 
-								 State)}.
-
-
-%% -
-
-tr_indAudEventsDescriptor(#'IndAudEventsDescriptor'{requestID = RID,
-						    pkgdName  = Name0,
-						    streamID  = SID},
-			  State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, Name0, State, Constraint),
-    #'IndAudEventsDescriptor'{requestID = tr_opt_RequestID(RID, State),
-			      pkgdName  = Name, 
-			      streamID  = tr_opt_StreamID(SID, State)}.
-
-
-%% -
-
-tr_indAudSignalsDescriptor({Tag, Val}, State) ->
-    case Tag of
-	signal ->
-	    {signal, tr_indAudSignal(Val, State)};
-	seqSigList ->
-	    {seqSigList, tr_indAudSeqSigList(Val, State)}
-    end.
-
-tr_opt_indAudSignal(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_indAudSignal(Val, State) ->
-    tr_indAudSignal(Val, State).
-
-tr_indAudSignal(#'IndAudSignal'{signalName      = Name0,
-				streamID        = SID,
-				signalRequestID = RID}, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(signal, Name0, State, Constraint),
-    #'IndAudSignal'{signalName      = Name, 
-		    streamID        = tr_opt_StreamID(SID, State),
-		    signalRequestID = tr_opt_RequestID(RID, State)}.
-
-tr_indAudSeqSigList(#'IndAudSeqSigList'{id = ID,
-					signalList = SigList}, State) ->
-    #'IndAudSeqSigList'{id = tr_integer(ID, State, 0, 65535),
-			signalList = tr_opt_indAudSignal(SigList, State)}.
-
-%% -
-
-tr_indAudDigitMapDescriptor(#'IndAudDigitMapDescriptor'{digitMapName = Name},
-			    State) ->
-    #'IndAudDigitMapDescriptor'{digitMapName = 
-				tr_opt_DigitMapName(Name, State)}.
-
-
-%% -
-
-tr_indAudEventBufferDescriptor(#'IndAudEventBufferDescriptor'{eventName = N,
-							      streamID  = SID},
-			       State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p"
-       "~n   SID: ~p", [N, SID]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(event, N, State, Constraint),
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudEventBufferDescriptor'{eventName = Name,
-				   streamID  = tr_opt_StreamID(SID, State)}.
-
-%% -
-
-tr_indAudStatisticsDescriptor(#'IndAudStatisticsDescriptor'{statName = N},
-			      State) ->
-    ?d("tr_indAudEventBufferDescriptor -> entry with"
-       "~n   N:   ~p", [N]),
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    Name = resolve(statistics, N, State, Constraint),
-    #'IndAudStatisticsDescriptor'{statName = Name}.
-
-
-%% -
-
-tr_indAudPackagesDescriptor(#'IndAudPackagesDescriptor'{packageName    = N,
-							packageVersion = V}, 
-			    State) ->
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   N: ~p"
-       "~n   V: ~p", [N, V]),
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    Name = resolve(package, N, State, Constraint),
-    ?d("tr_indAudPackagesDescriptor -> entry with"
-       "~n   Name: ~p", [Name]),
-    #'IndAudPackagesDescriptor'{packageName = Name, 
-				packageVersion = tr_integer(V, State, 0, 99)}.
-
-%% -- v2 end --
-
-
-tr_TerminationAudit(ParmList, State) when is_list(ParmList) ->
-    do_tr_TerminationAudit(ParmList, [], State).
-
-do_tr_TerminationAudit([], Acc, _State) ->
-    lists:reverse(Acc);
-do_tr_TerminationAudit([Parm|ParmList], Acc, State) ->
-    case tr_AuditReturnParameter(Parm, State) of
-	{_, deprecated} when State#state.mode =:= encode ->
-	    error({deprecated, Parm});
-	{_, deprecated} when State#state.mode =:= decode ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	{_, deprecated} ->
-	    %% SKIP
-	    do_tr_TerminationAudit(ParmList, Acc, State);
-	NewParm ->
-	    do_tr_TerminationAudit(ParmList, [NewParm|Acc], State)
-    end.
-
-tr_AuditReturnParameter({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor ->
-                tr_ErrorDescriptor(Val, State);
-            mediaDescriptor ->
-                tr_MediaDescriptor(Val, State);
-            modemDescriptor ->
-                tr_ModemDescriptor(Val, State);
-            muxDescriptor ->
-                tr_MuxDescriptor(Val, State);
-            eventsDescriptor ->
-                tr_EventsDescriptor(Val, State);
-            eventBufferDescriptor ->
-                tr_EventBufferDescriptor(Val, State);
-            signalsDescriptor ->
-                tr_SignalsDescriptor(Val, State);
-            digitMapDescriptor ->
-                tr_DigitMapDescriptor(Val, State);
-            observedEventsDescriptor ->
-                tr_ObservedEventsDescriptor(Val, State);
-            statisticsDescriptor ->
-                tr_StatisticsDescriptor(Val, State);
-            packagesDescriptor ->
-                tr_PackagesDescriptor(Val, State);
-            emptyDescriptors ->
-                tr_EmptyDescriptors(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_EmptyDescriptors(#'AuditDescriptor'{auditToken = Tokens},
-                    State) ->
-    Tokens2 = 
-	case Tokens of
-	    asn1_NOVALUE -> asn1_NOVALUE;
-	    _            -> [tr_auditItem(Token, State) || Token <- Tokens]
-	end,
-    #'AuditDescriptor'{auditToken = Tokens2}.
-
-tr_NotifyRequest(#'NotifyRequest'{terminationID            = IdList,
-                                  observedEventsDescriptor = ObsDesc,
-                                  errorDescriptor          = ErrDesc},
-                 State) ->
-    %% BUGBUG: Mismatch between ASN.1 and ABNF
-    %% BUGBUG: The following ought to be a 'choice'
-    #'NotifyRequest'{terminationID            = [tr_TerminationID(Id, State) ||
-                                                    Id <- IdList],
-                     observedEventsDescriptor = tr_ObservedEventsDescriptor(ObsDesc, State),
-                     errorDescriptor          = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_NotifyReply(#'NotifyReply'{terminationID   = IdList,
-                              errorDescriptor = ErrDesc},
-               State) ->
-    #'NotifyReply'{terminationID   = [tr_TerminationID(Id, State) || Id <- IdList],
-                   errorDescriptor = tr_opt_ErrorDescriptor(ErrDesc, State)}.
-
-tr_ObservedEventsDescriptor(#'ObservedEventsDescriptor'{requestId        = Id,
-                                                        observedEventLst = Events},
-                            State) when is_list(Events) ->
-    #'ObservedEventsDescriptor'{requestId        = tr_RequestID(Id, State),
-                                observedEventLst = [tr_ObservedEvent(E, State) || E <- Events]}.
-
-%% ;time per event, because it might be buffered
-%% observedEvent        = [ TimeStamp LWSP COLON] LWSP 
-%%                        pkgdName [ LBRKT observedEventParameter
-%%                        *(COMMA observedEventParameter) RBRKT ]
-%% 
-%% ;at-most-once eventStream, every eventParameterName at most once
-%% observedEventParameter = eventStream / eventOther
-
-tr_ObservedEvent(#'ObservedEvent'{eventName    = Name,
-                                  streamID     = Id,
-                                  eventParList = Parms,
-                                  timeNotation = Time},
-                 State) ->
-    #'ObservedEvent'{eventName    = tr_EventName(Name, State),
-                     streamID     = tr_opt_StreamID(Id, State),
-                     eventParList = [tr_EventParameter(P, Name, State) || P <- Parms],
-                     timeNotation = tr_opt_TimeNotation(Time, State)}.
-
-tr_EventName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(event, Name, State, Constraint).
-
-tr_EventParameter(#'EventParameter'{eventParameterName = ParName,
-                                    value              = Value,
-				    extraInfo          = Extra},
-		  EventName,
-                  State) ->
-    %% BUGBUG: event parameter name
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({event_parameter, EventName}, ParName, State, Constraint),
-    #'EventParameter'{eventParameterName = N,
-		      value              = tr_Value(Value, State),
-		      extraInfo          = tr_opt_extraInfo(Extra, State)}.
-
-tr_ServiceChangeRequest(#'ServiceChangeRequest'{terminationID      = IdList,
-                                                serviceChangeParms = Parms},
-                        State) ->
-    #'ServiceChangeRequest'{terminationID      = [tr_TerminationID(Id, State) || Id <- IdList],
-                            serviceChangeParms = tr_ServiceChangeParm(Parms, State)}.
-
-%% serviceChangeReply   = ServiceChangeToken EQUAL TerminationID
-%%                        [LBRKT (errorDescriptor / 
-%%                        serviceChangeReplyDescriptor) RBRKT]
-%% serviceChangeReplyDescriptor = ServicesToken LBRKT
-%%                        servChgReplyParm *(COMMA servChgReplyParm) RBRKT
-%% 
-%% ;at-most-once. Version is REQUIRED on first ServiceChange response
-%% servChgReplyParm     = (serviceChangeAddress / serviceChangeMgcId /
-%%                        serviceChangeProfile / serviceChangeVersion )
-tr_ServiceChangeReply(#'ServiceChangeReply'{terminationID       = IdList,
-                                            serviceChangeResult = Res},
-                      State) ->
-    #'ServiceChangeReply'{terminationID       = [tr_TerminationID(Id, State) || Id <- IdList],
-                          serviceChangeResult = tr_ServiceChangeResult(Res, State)}.
-
-tr_ServiceChangeResult({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            errorDescriptor       -> tr_ErrorDescriptor(Val, State);
-            serviceChangeResParms -> tr_ServiceChangeResParm(Val, State)
-        end,
-    {Tag, Val2}.
-
-%% TerminationID        = "ROOT" / pathNAME / "$" / "*"
-%% ; Total length of pathNAME must not exceed 64 chars.
-%% pathNAME             = ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) 
-%%                        ["@" pathDomainName ]
-
-tr_TerminationID(TermId, State) when State#state.mode =/= verify ->
-    resolve(term_id, TermId, State, valid);
-tr_TerminationID(#'TerminationID'{wildcard = Wild,
-                                  id       = Id},
-                 _State) ->
-    #'TerminationID'{wildcard = Wild,
-                     id       = Id};
-tr_TerminationID(#megaco_term_id{contains_wildcards = IsWild,
-                                 id                 = Id},
-                 State) ->
-    #megaco_term_id{contains_wildcards = tr_bool(IsWild, State),
-                    id                 = [tr_term_id_component(Sub, State) || Sub <- Id]}.
-
-tr_opt_bool(asn1_NOVALUE, _State) -> asn1_NOVALUE;
-tr_opt_bool(Bool, State)         -> tr_bool(Bool, State).
-
-tr_bool(true, _State)  -> true;
-tr_bool(false, _State) -> false.
-
-tr_term_id_component(Sub, _State) ->
-    case Sub of
-        all    -> all;
-        choose -> choose;
-        Char when is_integer(Char) -> Char
-    end.
-
-%% mediaDescriptor      = MediaToken LBRKT mediaParm *(COMMA mediaParm) RBRKT
-%% ; at-most-once per item
-%% ; and either streamParm or streamDescriptor but not both
-%% mediaParm            = (streamParm / streamDescriptor / 
-%%                         terminationStateDescriptor)
-%% ; at-most-once
-%% streamParm           = ( localDescriptor / remoteDescriptor / 
-%%                         localControlDescriptor )
-%% streamDescriptor     = StreamToken EQUAL StreamID LBRKT streamParm 
-%%                        *(COMMA streamParm) RBRKT
-tr_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TermState,
-                                      streams        = Streams},
-                   State) ->
-    #'MediaDescriptor'{termStateDescr = tr_opt_TerminationStateDescriptor(TermState, State),
-                       streams        = tr_opt_streams(Streams, State)}.
-
-tr_opt_streams(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_streams({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            oneStream   -> tr_StreamParms(Val, State);
-            multiStream -> [tr_StreamDescriptor(SD, State) || SD <- Val]
-        end,
-    {Tag, Val2}.
-
-tr_StreamParms(#'StreamParms'{localControlDescriptor = LCD,
-                              localDescriptor        = LD,
-                              remoteDescriptor       = RD,
-			      statisticsDescriptor   = SD},
-               State) ->
-    LCD2 = tr_opt_LocalControlDescriptor(LCD, State),
-    LD2  = tr_opt_LocalRemoteDescriptor(LD,   State),
-    RD2  = tr_opt_LocalRemoteDescriptor(RD,   State),
-    SD2  = tr_opt_StatisticsDescriptor(SD,    State),
-    #'StreamParms'{localControlDescriptor = LCD2,
-                   localDescriptor        = LD2,
-                   remoteDescriptor       = RD2,
-		   statisticsDescriptor   = SD2}.
-
-tr_StreamDescriptor(#'StreamDescriptor'{streamID    = Id,
-                                        streamParms = Parms},
-                    State) ->
-    #'StreamDescriptor'{streamID    = tr_StreamID(Id, State),
-                        streamParms = tr_StreamParms(Parms, State)}.
-
-%% localControlDescriptor = LocalControlToken LBRKT localParm 
-%%                          *(COMMA localParm) RBRKT
-%% 
-%% ; at-most-once per item
-%% localParm            = ( streamMode / propertyParm /
-%%                          reservedValueMode  / reservedGroupMode ) 
-%% reservedValueMode       = ReservedValueToken EQUAL ( "ON" / "OFF" ) 
-%% reservedGroupMode       = ReservedGroupToken EQUAL ( "ON" / "OFF" ) 
-%% 
-%% reservedMode      = ReservedToken EQUAL ( "ON" / "OFF" )
-%% 
-%% streamMode           = ModeToken EQUAL streamModes
-tr_opt_LocalControlDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = Mode,
-                                                        reserveGroup  = Group,
-                                                        reserveValue  = Value,
-                                                        propertyParms = Props},
-                              State) ->
-    #'LocalControlDescriptor'{streamMode    = tr_opt_StreamMode(Mode, State),
-                              reserveGroup  = tr_opt_bool(Group, State),
-                              reserveValue  = tr_opt_bool(Value, State),
-                              propertyParms = [tr_PropertyParm(P, State) || P <- Props]}.
-
-tr_opt_StreamMode(Mode, _State) ->
-    case Mode of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        sendOnly     -> sendOnly;
-        recvOnly     -> recvOnly;
-        sendRecv     -> sendRecv;
-        inactive     -> inactive;
-        loopBack     -> loopBack
-    end.
-
-tr_Name(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" )
-    tr_STRING(Name, State, 2, 2).
-
-tr_PkgdName(Name, State) ->
-    %% BUGBUG: transform
-    %% BUGBUG:  pkgdName =  (NAME / "*")  SLASH  (ItemID / "*" )
-    tr_OCTET_STRING(Name, State, 4, 4).
-
-%% When text encoding the protocol, the descriptors consist of session
-%% descriptions as defined in SDP (RFC2327), except that the "s=", "t="
-%% and "o=" lines are optional. When multiple session descriptions are
-%% provided in one descriptor, the "v=" lines are required as delimiters;
-%% otherwise they are optional.  Implementations shall accept session
-%% descriptions that are fully conformant to RFC2327. When binary
-%% encoding the protocol the descriptor consists of groups of properties
-%% (tag-value pairs) as specified in Annex C.  Each such group may
-%% contain the parameters of a session description.
-tr_opt_LocalRemoteDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = Groups},
-                             State) ->
-    #'LocalRemoteDescriptor'{propGrps = [tr_PropertyGroup(G, State) || G <- Groups]}.
-
-tr_PropertyGroup(Props, State) ->
-    [tr_PropertyGroupParm(P, State) || P <- Props].
-
-tr_PropertyGroupParm(#'PropertyParm'{name  = Name,
-                                     value = Value},
-                     State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name  = resolve(property, Name, State, Constraint),
-                    value = tr_OCTET_STRING(Value, State, 0, infinity)}.
-
-tr_PropertyParm(#'PropertyParm'{name      = Name,
-                                value     = Value,
-                                extraInfo = Extra},
-                State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'PropertyParm'{name      = resolve(property, Name, State, Constraint),
-                    value     = tr_Value(Value, State),
-                    extraInfo = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_extraInfo(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_extraInfo({relation, Rel}, _State) ->
-    Rel2 = 
-        case Rel of
-            greaterThan -> greaterThan;
-            smallerThan -> smallerThan;
-            unequalTo   -> unequalTo
-        end,
-    {relation, Rel2};
-tr_opt_extraInfo({range, Range}, State) ->
-    Range2 = tr_bool(Range, State),
-    {range, Range2};
-tr_opt_extraInfo({sublist, Sub}, State) ->
-    Sub2 = tr_bool(Sub, State),
-    {sublist, Sub2}.
-
-tr_opt_TerminationStateDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TerminationStateDescriptor(#'TerminationStateDescriptor'{propertyParms      = Props,
-                                                                eventBufferControl = Control,
-                                                                serviceState       = Service},
-                                  State) ->
-    #'TerminationStateDescriptor'{propertyParms      = [tr_PropertyParm(P, State) || P <- Props],
-                                  eventBufferControl = tr_opt_EventBufferControl(Control, State),
-                                  serviceState       = tr_opt_ServiceState(Service, State)}.
-
-tr_opt_EventBufferControl(Control, _State) ->
-    case Control of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        off          -> off;
-        lockStep     -> lockStep
-    end.
-
-tr_opt_ServiceState(Service, _State) ->
-    case Service of
-        asn1_NOVALUE -> asn1_NOVALUE;
-        test         -> test;
-        outOfSvc     -> outOfSvc;
-        inSvc        -> inSvc
-    end.
-
-tr_MuxDescriptor(#'MuxDescriptor'{muxType  = Type,
-                                  termList = IdList},
-                 State) ->
-    #'MuxDescriptor'{muxType  = tr_MuxType(Type, State),
-                     termList = [tr_TerminationID(Id, State) || Id <- IdList]}.
-
-tr_MuxType(Type, _State) ->
-    case Type of
-        h221 -> h221;
-        h223 -> h223;
-        h226 -> h226;
-        v76  -> v76
-    end.
-
-tr_opt_StreamID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StreamID(Id, State) ->
-    tr_StreamID(Id, State).
-
-tr_StreamID(Id, State) ->
-    tr_UINT16(Id, State).
-
-tr_EventsDescriptor(#'EventsDescriptor'{requestID = Id,
-                                        eventList = Events},
-                    State) ->
-    #'EventsDescriptor'{requestID = tr_opt_RequestID(Id, State),
-                        eventList = [tr_RequestedEvent(E, State) || E <- Events]}.
-
-tr_RequestedEvent(#'RequestedEvent'{pkgdName    = Name,
-                                    streamID    = Id,
-                                    evParList   = Parms,
-                                    eventAction = Actions},
-                  State)  ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'RequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                      streamID    = tr_opt_StreamID(Id, State),
-                      eventAction = tr_opt_RequestedActions(Actions, State),
-                      evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_RegulatedEmbeddedDescriptor(
-  #'RegulatedEmbeddedDescriptor'{secondEvent       = SE,
-				 signalsDescriptor = SD}, State) ->
-    SE2 = tr_opt_SecondEventsDescriptor(SE, State),
-    SD2 = tr_opt_SignalsDescriptor(SD, State),
-    #'RegulatedEmbeddedDescriptor'{secondEvent       = SE2,
-				   signalsDescriptor = SD2}.
-
-tr_opt_NotifyBehaviour(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_NotifyBehaviour(NB, State) ->
-    tr_NotifyBehaviour(NB, State).
-
-tr_NotifyBehaviour({notifyImmediate, 'NULL'} = NB, _State) ->
-    NB;
-tr_NotifyBehaviour({notifyRegulated = Tag, Val}, State) ->
-    {Tag, tr_RegulatedEmbeddedDescriptor(Val, State)};
-tr_NotifyBehaviour({neverNotify, 'NULL'} = NB, _State) ->
-    NB.
-
-tr_opt_RequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestedActions(#'RequestedActions'{keepActive            = KA,
-                                            eventDM               = DM,
-                                            secondEvent           = SE,
-                                            signalsDescriptor     = SD,
-					    notifyBehaviour       = NB,
-					    resetEventsDescriptor = RSD},
-                        State) ->
-    KA2  = tr_opt_keepActive(KA, State),
-    DM2  = tr_opt_EventDM(DM, State),
-    SE2  = tr_opt_SecondEventsDescriptor(SE, State),
-    SD2  = tr_opt_SignalsDescriptor(SD, State),
-    NB2  = tr_opt_NotifyBehaviour(NB, State),
-    RSD2 = tr_opt_null(RSD, State),
-    #'RequestedActions'{keepActive            = KA2, 
-                        eventDM               = DM2, 
-                        secondEvent           = SE2,
-                        signalsDescriptor     = SD2,
-			notifyBehaviour       = NB2,
-			resetEventsDescriptor = RSD2}.
-
-tr_opt_keepActive(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_keepActive(Keep, State) ->
-    tr_bool(Keep, State).
-
-tr_opt_EventDM(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_EventDM({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            digitMapName  -> tr_DigitMapName(Val, State);
-            digitMapValue -> tr_DigitMapValue(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_SecondEventsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = Id,
-                                                        eventList = Events},
-                              State) ->
-    #'SecondEventsDescriptor'{requestID = tr_RequestID(Id, State), %% IG v6 6.8 withdrawn
-                              eventList = [tr_SecondRequestedEvent(E, State) || E <- Events]}.
-
-tr_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = Name,
-                                                streamID    = Id,
-                                                evParList   = Parms,
-                                                eventAction = Actions},
-                        State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'SecondRequestedEvent'{pkgdName    = resolve(event, Name, State, Constraint),
-                            streamID    = tr_opt_StreamID(Id, State),
-                            eventAction = tr_opt_SecondRequestedActions(Actions, State),
-                            evParList   = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-
-tr_opt_SecondRequestedActions(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SecondRequestedActions(
-  #'SecondRequestedActions'{keepActive            = KA,
-			    eventDM               = DM,
-			    signalsDescriptor     = SD,
-			    notifyBehaviour       = NB,
-			    resetEventsDescriptor = RSD},
-  State) ->
-    KA2  = tr_opt_keepActive(KA, State),
-    DM2  = tr_opt_EventDM(DM, State),
-    SD2  = tr_opt_SignalsDescriptor(SD, State), 
-    NB2  = tr_opt_NotifyBehaviour(NB, State),
-    RSD2 = tr_opt_null(RSD, State),
-    #'SecondRequestedActions'{keepActive            = KA2, 
-                              eventDM               = DM2, 
-                              signalsDescriptor     = SD2, 
-			      notifyBehaviour       = NB2,
-			      resetEventsDescriptor = RSD2}.
-
-tr_EventBufferDescriptor(EventSpecs, State) ->
-    [tr_EventSpec(ES, State) || ES <- EventSpecs].
-
-tr_EventSpec(#'EventSpec'{eventName    = Name,
-                          streamID     = Id,
-                          eventParList = Parms},
-             State) ->
-    #'EventSpec'{eventName    = tr_EventName(Name, State),
-                 streamID     = tr_opt_StreamID(Id, State),
-                 eventParList = [tr_EventParameter(P, Name, State) || P <- Parms]}.
-
-tr_opt_SignalsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_SignalsDescriptor(SigDesc, State) ->
-    tr_SignalsDescriptor(SigDesc, State).
-
-tr_SignalsDescriptor(SigDesc, State)  when is_list(SigDesc) ->
-    [tr_SignalRequest(SigReq, State) || SigReq <- SigDesc].
-
-tr_SignalRequest({Tag, Val}, State) ->
-    Val2 =
-        case Tag of
-            signal     -> tr_Signal(Val, State);
-            seqSigList -> tr_SeqSigList(Val, State)
-        end,
-    {Tag, Val2}.
-
-
-tr_SeqSigList(#'SeqSigList'{id         = Id,
-                            signalList = SigList},
-              State) when is_list(SigList) ->
-    #'SeqSigList'{id         = tr_UINT16(Id, State),
-                  signalList = [tr_Signal(Sig, State) || Sig <- SigList]}.
-
-tr_Signal(#'Signal'{signalName       = Name,
-                    streamID         = SID,
-                    sigType          = Type,
-                    duration         = Dur,
-                    notifyCompletion = Compl,
-                    keepActive       = Keep,
-                    sigParList       = Parms,
-		    direction        = Dir,
-		    requestID        = RID,
-		    intersigDelay    = ID},
-          State) ->
-    Name2  = tr_SignalName(Name, State),
-    SID2   = tr_opt_StreamID(SID, State),
-    Type2  = tr_opt_SignalType(Type, State),
-    Dur2   = tr_opt_UINT16(Dur, State), 
-    Compl2 = tr_opt_NotifyCompletion(Compl, State),
-    Keep2  = tr_opt_keepActive(Keep, State),
-    Parms2 = [tr_SigParameter(P, Name, State) || P <- Parms],
-    Dir2   = tr_opt_SignalDirection(Dir, State),
-    RID2   = tr_opt_RequestID(RID, State),
-    ID2    = tr_opt_UINT16(ID, State), 
-    #'Signal'{signalName       = Name2,
-              streamID         = SID2, 
-              sigType          = Type2, 
-              duration         = Dur2, 
-              notifyCompletion = Compl2, 
-              keepActive       = Keep2, 
-              sigParList       = Parms2,
-	      direction        = Dir2,
-	      requestID        = RID2,
-	      intersigDelay    = ID2}.
-
-tr_opt_NotifyCompletion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_NotifyCompletion(Items, State) when is_list(Items) ->
-    [tr_notifyCompletionItem(I, State) || I <- Items].
-
-tr_notifyCompletionItem(Item, _State) ->
-    case Item of
-        onTimeOut                   -> onTimeOut;
-        onInterruptByEvent          -> onInterruptByEvent;
-        onInterruptByNewSignalDescr -> onInterruptByNewSignalDescr;
-        otherReason                 -> otherReason;
-        onIteration                 -> onIteration
-    end.
-
-tr_opt_SignalType(asn1_NOVALUE = Type, _State) ->
-    Type;
-tr_opt_SignalType(Type, _State) ->
-    case Type of
-        brief   -> brief;
-        onOff   -> onOff;
-        timeOut -> timeOut
-    end.
-
-tr_opt_SignalDirection(asn1_NOVALUE = SD, _State) ->
-    SD;
-tr_opt_SignalDirection(SD, _State) ->
-    case SD of
-	internal -> internal;
-	external -> external;
-	both     -> both
-    end.
-	     
-tr_SignalName(Name, State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    resolve(signal, Name, State, Constraint).
-
-tr_SigParameter(#'SigParameter'{sigParameterName = ParName,
-                                value            = Value,
-                                extraInfo        = Extra},
-                SigName,
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    N = resolve({signal_parameter, SigName}, ParName, State, Constraint),
-    #'SigParameter'{sigParameterName = N,
-                    value            = tr_Value(Value, State),
-                    extraInfo        = tr_opt_extraInfo(Extra, State)}.
-
-tr_opt_RequestID(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_RequestID(Id, State) ->
-    tr_RequestID(Id, State).
-
-tr_RequestID(Id, _State) when Id =:= ?megaco_all_request_id ->
-    ?megaco_all_request_id;
-tr_RequestID(Id, State) ->
-    tr_UINT32(Id, State).
-
-tr_ModemDescriptor(_MD, _State) ->
-    deprecated.
-
-tr_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName  = Name,
-                                            digitMapValue = Value},
-                      State) ->
-    #'DigitMapDescriptor'{digitMapName  = tr_opt_DigitMapName(Name, State),
-                          digitMapValue = tr_opt_DigitMapValue(Value, State)}.
-
-tr_opt_DigitMapName(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapName(Name, State) ->
-    tr_DigitMapName(Name, State).
-
-tr_DigitMapName(Name, State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    resolve(dialplan, Name, State, Constraint).
-
-tr_opt_DigitMapValue(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_DigitMapValue(Value, State) ->
-    tr_DigitMapValue(Value, State).
-
-tr_DigitMapValue(#'DigitMapValue'{digitMapBody = Body,
-                                  startTimer   = Start,
-                                  shortTimer   = Short,
-                                  longTimer    = Long},
-                 State) ->
-    #'DigitMapValue'{startTimer   = tr_opt_timer(Start, State),
-                     shortTimer   = tr_opt_timer(Short, State),
-                     longTimer    = tr_opt_timer(Long, State),
-                     digitMapBody = tr_STRING(Body, State)}. %% BUGBUG: digitMapBody not handled at all
-
-tr_opt_timer(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_timer(Timer, State) ->
-    tr_DIGIT(Timer, State, 0, 99).
-
-tr_ServiceChangeParm(
-  #'ServiceChangeParm'{serviceChangeMethod  = Method, 
-		       serviceChangeAddress = Addr, 
-		       serviceChangeVersion = Version, 
-		       serviceChangeProfile = Profile, 
-		       serviceChangeReason  = Reason, 
-		       serviceChangeDelay   = Delay, 
-		       serviceChangeMgcId   = MgcId, 
-		       timeStamp            = Time,
-		       serviceChangeInfo    = Info,
-		       serviceChangeIncompleteFlag = Incomplete},
-  State) ->
-    Method2     = tr_ServiceChangeMethod(Method, State),
-    Addr2       = tr_opt_ServiceChangeAddress(Addr, State),
-    Version2    = tr_opt_serviceChangeVersion(Version, State),
-    Profile2    = tr_opt_ServiceChangeProfile(Profile, State),
-    Reason2     = tr_serviceChangeReason(Reason, State),
-    Delay2      = tr_opt_serviceChangeDelay(Delay, State),
-    MgcId2      = tr_opt_serviceChangeMgcId(MgcId, State),
-    Time2       = tr_opt_TimeNotation(Time, State),
-    Info2       = tr_opt_AuditDescriptor(Info, State),
-    Incomplete2 = tr_opt_null(Incomplete, State),
-    #'ServiceChangeParm'{serviceChangeMethod         = Method2,
-                         serviceChangeAddress        = Addr2,
-                         serviceChangeVersion        = Version2,
-                         serviceChangeProfile        = Profile2,
-                         serviceChangeReason         = Reason2, 
-                         serviceChangeDelay          = Delay2, 
-                         serviceChangeMgcId          = MgcId2, 
-                         timeStamp                   = Time2, 
-			 serviceChangeInfo           = Info2, 
-			 serviceChangeIncompleteFlag = Incomplete2}.
-
-tr_ServiceChangeMethod(Method, _State) ->
-    case Method of
-        failover      -> failover;
-        forced        -> forced;
-        graceful      -> graceful;
-        restart       -> restart;
-        disconnected  -> disconnected;
-        handOff       -> handOff
-    end. %% BUGBUG: extension
-
-tr_opt_ServiceChangeAddress(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_ServiceChangeAddress({Tag, Val}, State) ->
-    Val2 = 
-        case Tag of
-            portNumber -> tr_portNumber(Val, State);
-            ip4Address -> tr_IP4Address(Val, State);
-            ip6Address -> tr_IP6Address(Val, State);
-            domainName -> tr_DomainName(Val, State);
-            deviceName -> tr_PathName(Val, State);
-            mtpAddress -> tr_mtpAddress(Val, State)
-        end,
-    {Tag, Val2}.
-
-tr_opt_serviceChangeVersion(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeVersion(Version, State) ->
-    tr_version(Version, State).
-
-tr_opt_ServiceChangeProfile(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-%% Decode
-tr_opt_ServiceChangeProfile({'ServiceChangeProfile', ProfileName}, State) ->
-    case string:tokens(ProfileName, "/") of
-        [Name0, Version0] ->
-	    Name    = tr_STRING(Name0, State, 1, 64),
-	    Version = tr_version(list_to_integer(Version0), State),
-	    #'ServiceChangeProfile'{profileName = Name, 
-				    version     = Version}
-    end;
-%% Encode
-tr_opt_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = Name0, 
-						    version     = Version0},
-			    State) ->
-    Name        = tr_STRING(Name0, State, 1, 64),
-    Version     = tr_version(Version0, State),
-    ProfileName = lists:flatten(io_lib:format("~s/~w", [Name, Version])),
-    {'ServiceChangeProfile', ProfileName}.
-    
-tr_serviceChangeReason([_] = Reason, State) ->
-    tr_Value(Reason, State).
-
-tr_opt_serviceChangeDelay(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeDelay(Delay, State) ->
-    tr_UINT32(Delay, State).
-
-tr_opt_serviceChangeMgcId(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_serviceChangeMgcId(MgcId, State) ->
-    tr_MId(MgcId, State).
-
-tr_opt_portNumber(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_portNumber(Port, State) ->
-    tr_portNumber(Port, State).
-
-tr_portNumber(Port, State) when is_integer(Port) andalso (Port >= 0) ->
-    tr_UINT16(Port, State).
-
-tr_ServiceChangeResParm(#'ServiceChangeResParm'{serviceChangeMgcId   = MgcId, 
-                                                serviceChangeAddress = Addr, 
-                                                serviceChangeVersion = Version, 
-                                                serviceChangeProfile = Profile,
-						timeStamp            = Time}, 
-                        State) ->
-    #'ServiceChangeResParm'{serviceChangeMgcId   = tr_opt_serviceChangeMgcId(MgcId, State),
-                            serviceChangeAddress = tr_opt_ServiceChangeAddress(Addr, State),
-                            serviceChangeVersion = tr_opt_serviceChangeVersion(Version, State),
-                            serviceChangeProfile = tr_opt_ServiceChangeProfile(Profile, State),
-			    timeStamp            = tr_opt_TimeNotation(Time, State)}.
-
-tr_PackagesDescriptor(Items, State) when is_list(Items) ->
-    [tr_PackagesItem(I, State) || I <- Items].
-
-tr_PackagesItem(#'PackagesItem'{packageName    = Name,
-                                packageVersion = Version},
-                State) ->
-    Constraint = fun(Item) -> tr_Name(Item, State) end,
-    #'PackagesItem'{packageName    = resolve(package, Name, State, Constraint),
-                    packageVersion = tr_UINT16(Version, State)}.
-
-tr_opt_StatisticsDescriptor(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_StatisticsDescriptor(Parms, State) ->
-    tr_StatisticsDescriptor(Parms, State).
-
-tr_StatisticsDescriptor(Parms, State) when is_list(Parms) ->
-    [tr_StatisticsParameter(P, State) || P <- Parms].
-
-tr_StatisticsParameter(#'StatisticsParameter'{statName  = Name,
-                                              statValue = Value},
-                       State) ->
-    Constraint = fun(Item) -> tr_PkgdName(Item, State) end,
-    #'StatisticsParameter'{statName  = resolve(statistics, Name, State, Constraint),
-                           statValue = tr_opt_Value(Value, State)}.
-
-tr_opt_TimeNotation(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_TimeNotation(#'TimeNotation'{date = Date,
-                                    time = Time},
-                    State) ->
-    #'TimeNotation'{date = tr_STRING(Date, State, 8, 8), % "yyyymmdd"
-                    time = tr_STRING(Time, State, 8, 8)}.% "hhmmssss"
-
-%% BUGBUG: Does not verify that string must contain at least one char
-%% BUGBUG: This violation of the is required in order to comply with
-%% BUGBUG: the dd/ce ds parameter that may possibly be empty.
-
-tr_opt_Value(asn1_NOVALUE, _State) ->
-    asn1_NOVALUE;
-tr_opt_Value(Value, State) ->
-    tr_Value(Value, State).
-
-tr_Value(Strings, _State) when is_list(Strings) ->
-    [[Char || Char <- String] || String <- Strings].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%% Encode an octet string, escape } by \ if necessary 
-tr_OCTET_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_QUOTED_STRING(String, _State) when is_list(String) ->
-    verify_count(length(String), 1, infinity),
-    String.
-
-%% The internal format of hex digits is a list of octets
-%% Min and Max means #hexDigits
-%% Leading zeros are prepended in order to fulfill Min
-tr_HEXDIG(Octets, _State, Min, Max) when is_list(Octets) ->
-    verify_count(length(Octets), Min, Max),
-    Octets.
-
-tr_DIGIT(Val, State, Min, Max) ->
-    tr_integer(Val, State, Min, Max).
-
-tr_STRING(String, _State) when is_list(String) ->
-    String.
-
-tr_STRING(String, _State, Min, Max) when is_list(String) ->
-    verify_count(length(String), Min, Max),
-    String.
-
-tr_opt_UINT16(Val, State) ->
-    tr_opt_integer(Val, State, 0, 65535).
-
-tr_UINT16(Val, State) ->
-    tr_integer(Val, State, 0, 65535).
-
-tr_UINT32(Val, State) ->
-    tr_integer(Val, State, 0, 4294967295).
-
-tr_opt_integer(asn1_NOVALUE, _State, _Min, _Max) ->
-    asn1_NOVALUE;
-tr_opt_integer(Int, State, Min, Max) ->
-    tr_integer(Int, State, Min, Max).
-
-tr_integer(Int, _State, Min, Max) ->
-    verify_count(Int, Min, Max),
-    Int.
-
-%% Verify that Count is within the range of Min and Max
-verify_count(Count, Min, Max) ->
-    if
-        is_integer(Count) ->
-            if
-                is_integer(Min) andalso (Count >= Min) ->
-                    if
-                        is_integer(Max) andalso (Count =< Max) ->
-                            Count;
-                        Max =:= infinity ->
-                            Count;
-                        true ->
-                            error({count_too_large, Count, Max})
-                    end;
-                true ->
-                    error({count_too_small, Count, Min})
-            end;
-        true ->
-            error({count_not_an_integer, Count})
-    end.
diff --git a/lib/megaco/src/binary/megaco_per_encoder.erl b/lib/megaco/src/binary/megaco_per_encoder.erl
index 187e37d21b..7a3653468c 100644
--- a/lib/megaco/src/binary/megaco_per_encoder.erl
+++ b/lib/megaco/src/binary/megaco_per_encoder.erl
@@ -45,16 +45,10 @@
 -define(V1_ASN1_MOD,     megaco_per_media_gateway_control_v1).
 -define(V2_ASN1_MOD,     megaco_per_media_gateway_control_v2).
 -define(V3_ASN1_MOD,     megaco_per_media_gateway_control_v3).
--define(PREV3A_ASN1_MOD, megaco_per_media_gateway_control_prev3a).
--define(PREV3B_ASN1_MOD, megaco_per_media_gateway_control_prev3b).
--define(PREV3C_ASN1_MOD, megaco_per_media_gateway_control_prev3c).
 
 -define(V1_TRANS_MOD,     megaco_binary_transformer_v1).
 -define(V2_TRANS_MOD,     megaco_binary_transformer_v2).
 -define(V3_TRANS_MOD,     megaco_binary_transformer_v3).
--define(PREV3A_TRANS_MOD, megaco_binary_transformer_prev3a).
--define(PREV3B_TRANS_MOD, megaco_binary_transformer_prev3b).
--define(PREV3C_TRANS_MOD, megaco_binary_transformer_prev3c).
 
 -define(BIN_LIB, megaco_binary_encoder_lib).
 
@@ -64,18 +58,6 @@
 %% Return {ok, Version} | {error, Reason}
 %%----------------------------------------------------------------------
 
-%% <DEPRECATED>
-version_of([{version3,prev3c}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3C_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-version_of([{version3,prev3b}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3B_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-version_of([{version3,prev3a}|EC], Binary) ->
-    Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?PREV3A_ASN1_MOD],
-    ?BIN_LIB:version_of(EC, Binary, 1, Decoders);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 version_of([{version3,v3}|EC], Binary) ->
     Decoders = [?V1_ASN1_MOD, ?V2_ASN1_MOD, ?V3_ASN1_MOD],
@@ -129,21 +111,6 @@ encode_message(EC, 2, MegaMsg) ->
 
 %% -- Version 3 --
 
-%% <DEPRECATED>
-encode_message([{version3,prev3c}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3C_ASN1_MOD, 
-    TransMod = ?PREV3C_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3b}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3B_ASN1_MOD, 
-    TransMod = ?PREV3B_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-encode_message([{version3,prev3a}|EC], 3, MegaMsg) ->
-    AsnMod   = ?PREV3A_ASN1_MOD, 
-    TransMod = ?PREV3A_TRANS_MOD,
-    ?BIN_LIB:encode_message(EC, MegaMsg, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 encode_message([{version3,v3}|EC], 3, MegaMsg) ->
     AsnMod   = ?V3_ASN1_MOD, 
@@ -291,21 +258,6 @@ decode_message(EC, 2, Binary) ->
 
 %% -- Version 3 --
 
-%% <DEPRECATED>
-decode_message([{version3,prev3c}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3C_ASN1_MOD, 
-    TransMod = ?PREV3C_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, io_list);
-decode_message([{version3,prev3b}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3B_ASN1_MOD, 
-    TransMod = ?PREV3B_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, io_list);
-decode_message([{version3,prev3a}|EC], 3, Binary) ->
-    AsnMod   = ?PREV3A_ASN1_MOD, 
-    TransMod = ?PREV3A_TRANS_MOD, 
-    ?BIN_LIB:decode_message(EC, Binary, AsnMod, TransMod, io_list);
-%% </DEPRECATED>
-
 %% <BACKWARD-COMPAT-CLAUSE>
 decode_message([{version3,v3}|EC], 3, Binary) ->
     AsnMod   = ?V3_ASN1_MOD, 
diff --git a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3a.set.asn b/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3a.set.asn
deleted file mode 100644
index b9ba7ffdb4..0000000000
--- a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3a.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3a.asn
diff --git a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3b.set.asn b/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3b.set.asn
deleted file mode 100644
index 0437bde310..0000000000
--- a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3b.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3b.asn
diff --git a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3c.set.asn b/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3c.set.asn
deleted file mode 100644
index e78055fbad..0000000000
--- a/lib/megaco/src/binary/megaco_per_media_gateway_control_prev3c.set.asn
+++ /dev/null
@@ -1 +0,0 @@
-MEDIA-GATEWAY-CONTROL-prev3c.asn
diff --git a/lib/megaco/src/binary/modules.mk b/lib/megaco/src/binary/modules.mk
index 485f0fe610..e6573748d6 100644
--- a/lib/megaco/src/binary/modules.mk
+++ b/lib/megaco/src/binary/modules.mk
@@ -18,22 +18,6 @@
 # 
 # %CopyrightEnd%
 
-# <DEPRECATED>
-PREV3_MODULES = \
-	megaco_ber_media_gateway_control_prev3a \
-	megaco_ber_media_gateway_control_prev3b \
-	megaco_ber_media_gateway_control_prev3c \
-	megaco_per_media_gateway_control_prev3a \
-	megaco_per_media_gateway_control_prev3b \
-	megaco_per_media_gateway_control_prev3c \
-	megaco_binary_name_resolver_prev3a \
-	megaco_binary_name_resolver_prev3b \
-	megaco_binary_name_resolver_prev3c \
-	megaco_binary_transformer_prev3a   \
-	megaco_binary_transformer_prev3b   \
-	megaco_binary_transformer_prev3c
-# </DEPRECATED>
-
 MODULES = \
 	megaco_binary_encoder \
 	megaco_binary_encoder_lib \
@@ -52,19 +36,13 @@ MODULES = \
 	megaco_binary_term_id_gen \
 	megaco_binary_transformer_v1 \
 	megaco_binary_transformer_v2 \
-	megaco_binary_transformer_v3 \
-	$(PREV3_MODULES)
+	megaco_binary_transformer_v3
 
 INTERNAL_HRL_FILES = 
 
 ASN1_V1_SPEC      = MEDIA-GATEWAY-CONTROL-v1
 ASN1_V2_SPEC      = MEDIA-GATEWAY-CONTROL-v2
 ASN1_V3_SPEC      = MEDIA-GATEWAY-CONTROL-v3
-# <DEPRECATED>
-ASN1_PREV3A_SPEC  = MEDIA-GATEWAY-CONTROL-prev3a
-ASN1_PREV3B_SPEC  = MEDIA-GATEWAY-CONTROL-prev3b
-ASN1_PREV3C_SPEC  = MEDIA-GATEWAY-CONTROL-prev3c
-# </DEPRECATED>
 
 BER_ASN1_V1_SPEC     = megaco_ber_media_gateway_control_v1
 PER_ASN1_V1_SPEC     = megaco_per_media_gateway_control_v1
@@ -75,14 +53,3 @@ PER_ASN1_V2_SPEC     = megaco_per_media_gateway_control_v2
 BER_ASN1_V3_SPEC     = megaco_ber_media_gateway_control_v3
 PER_ASN1_V3_SPEC     = megaco_per_media_gateway_control_v3
 
-# <DEPRECATED>
-BER_ASN1_PREV3A_SPEC = megaco_ber_media_gateway_control_prev3a
-PER_ASN1_PREV3A_SPEC = megaco_per_media_gateway_control_prev3a
-
-BER_ASN1_PREV3B_SPEC = megaco_ber_media_gateway_control_prev3b
-PER_ASN1_PREV3B_SPEC = megaco_per_media_gateway_control_prev3b
-
-BER_ASN1_PREV3C_SPEC = megaco_ber_media_gateway_control_prev3c
-PER_ASN1_PREV3C_SPEC = megaco_per_media_gateway_control_prev3c
-# </DEPRECATED>
-
-- 
2.26.2

openSUSE Build Service is sponsored by