///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2023 Ericsson Telecom AB
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
//
//  File:               MobileL3_CC_Types.ttcn
//  Rev:                R2A
//  Prodnr:             CNL 113 832
//  Contact:            http://ttcn.ericsson.se
//  Reference:          3GPP TS 24.008 v13.4.0


module  MobileL3_CC_Types
{

import from General_Types           all;
import from MobileL3_CommonIE_Types all;

//============================================================================
// 24.008/ 10.5.4 Call control information elements
//============================================================================

// 10.5.4.1 Extensions of codesets
//--

// 10.5.4.2 Locking shift procedure
//--

// 10.5.4.3 Non-locking shift procedure
//--

// 10.5.4.4 Auxiliary states
type record AuxiliaryStates_TLV
{
  OCT1  elementIdentifier, //24'O
  LIN1  lengthIndicator,
  BIT2  mPTYAuxiliaryState,
  BIT2  holdAuxState,
  BIT3  spare_3,
  BIT1  ext //'1'B
} with { variant (lengthIndicator) "LENGTHTO(mPTYAuxiliaryState,holdAuxState,
                                             spare_3,ext)"};

type record AuxiliaryStates_LV
{
  LIN1  lengthIndicator,
  BIT2  mPTYAuxState,
  BIT2  holdAuxiliaryState,
  BIT3  spare_3,
  BIT1  ext //'1'B
}with { variant (lengthIndicator) "LENGTHTO(mPTYAuxState,holdAuxiliaryState,
                                            spare_3,ext)"};
         
//24.008/ 10.5.4.4a Backup Bearer Capacity (BBC)
type record BBC_octet3
{
  BIT3  informationTransferCapability,  //     '000'speech  B
                                        //     '001'B UDI
                                        //     '010'B 3.audio  1kHz
                                        //     '101'oITC B (see octet 5a)
                                        //     '110'B speech  auxiliary
                                        //     '111'B reserved
  BIT1  transferMode, //    '0'B mode  circuit
                      //    '1'B packet  mode
  BIT1  codingStandard, //   '0'B GSM/PCS coding  standardized
                        //   '1'B  reserved
  BIT2  radioChannelRequirement, // '01'B MSC/VLR to MS;
        // '00'B MS (supports) towards MSC/VLR rate dual (half preferred)
        // '01'B MS (supports) towards MSC/VLR full only  rate
                           // '10'B rate  dual  (half preferred)
                           // '11'B rate  dual  (full preferred)
  BIT1 extension_octet_3
     //'0'B or '1'B (THe RAW encoder will overwrite this bit)
} with { variant "EXTENSION_BIT (yes)"};

// "type record BC_octet4" is the same as "type record BC_octet4"

type record BBC_octet5
{
  BIT3  signallingAccessProtocol, //        '001'B I.440/450
        //        '010'B X.21
        //        '011'B X.28 dedicated PID, ind. NUI
        //        '100'B X.28 dedicated PID, uni. NUI
        //        '101'B X.28 PID  non_dedicated
        //        '110'B X.32
  BIT2  rateAdaptation, //     '00'B no adaptation  rate  (RA)
        //     '01'B V.110/X.30 adaptation  rate
        //     '10'B CCITT X.31 flag stuffing
        //     '11'B RA  other  (see octet 5a)
  BIT2  accessId, //  '00'B identifier  octet
  BIT1  extension_octet_5, // '0'B or '1'B (if no octet 5A following)

  //octet 5a
  BIT3  spare2_3  optional, // B'...._000
  BIT2  otherRateAdaptation  optional, // B'.._00.._ V.interworking  120
  BIT2  otherInformationTransferCapability optional,
                              // B'_00...._ interworking RDI
  BIT1  extension_octet_5a  optional // '1'B 
} with { variant "EXTENSION_BIT (yes)"};

// BBC_octet6, BBC_octet7 not required

type record BackupBearerCapacity
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,      
  // the following octet fields representing an octet group
  BBC_octet3 octet3,  // 1-
  BC_octet4  octet4 optional, //1 octet; opt. by def, but always fill in!!!
  BBC_octet5 octet5 optional, //1-2 octets
  BC_octet6  octet6 optional, //1-8 octets
  BC_octet7  octet7 optional  //1 octet
} with { variant (lengthIndicator) "LENGTHTO(octet3,octet4,octet5,octet6,
                                             octet7)"};

// 10.5.4.5 Bearer Capacity
type record BC_octet7
{
  BIT5  userInformationLayer2Protocol, //octet 7:
                                      // '00110'B  rec. X.25, level link
                                      // '01000'B  ISO 6429
                                      // '01001'B  X.75 (teletex)
                                      // '01010'B  profile  Videotext
                                      // '01011'B  FAX group 3
                                      // '01100'COPnoF1Ct  B
                                      // '01101'B  X.75 (CAPI)
  BIT2  layer2Id, // '10'B  identifier  octet
  BIT1  extension_octet_7  // '1'B
} with { variant "EXTENSION_BIT (yes)"};

type record BC_octet6
{
  BIT1  synchronous_asynchronous, //              '0'synchronous  B
             //              '1'B asynchronous
  BIT4  userInformationLayer1Protocol, // '0000'B default layer protocol 1
  BIT2  layer1Id, //       '01'B identifier  octet
  BIT1  extension_octet_6, // '0'B (octet 6a following) or '1'B

  // OCTET 6a:
  BIT4  userRate optional, //     '0001'B  0.kbps  3  (X.1 and V.110)
                           //      '0010'B  1.kbps  2  (X.1 and V.110)
                           //      '0011'B  2.kbps  4  (X.1 and V.110)
                           //      '0100'B  4.kbps  8  (X.1 and V.110)
                           //      '0101'B  9.kbps  6  (X.1 and V.110)
                           //      '0110'B  12.0 transparent  kbps
                           //      '0111'B  1.2 kbps/75bps asymmetric
  BIT1  numberDataBits optional, //    '0'B bits  7  (data)
                                 //    '1'B bits  8  (data)
  BIT1  negotiation optional, // '0'B inband negotiation possible not
  BIT1  numberStopBits optional, // '0'B bit 1
                                 //   '1'B 2 bits
  BIT1  extension_octet_6a optional, //   '0'B or '1'B

  // OCTET 6b:
  BIT3  parity optional, //      '000'odd  B  (number)
                         //       '010'even  B
                         //       '011'B  none
                         //       '100'B  forced 0  to
                         //       '101'B  forced to 1
  BIT1  nicOnRX optional,   //     '0'B  no data accepted clock  with
                            //     '1'B       data accepted with clock
  BIT1  nicOnTX optional,   //     '0'B  no data required clock  with
                            //     '1'B       data required with clock
  BIT2  intermediateRate optional, //  '00'reserved  B
                                   //  '01'B  reserved
                                   //  '10'B  kbps  8
                                   //  '11'B 16 kbps
  BIT1  extension_octet_6b optional, // '0'B or '1'B

  // OCTET 6c:
  BIT5  modemType optional, //      '00000'none  B
     //      '00001'B  V.21
     //      '00010'B  V.22
     //      '00011'B  V.22bis
     //      '00100'B  V.23
     //      '00101'B  V.26ter
     //      '00110'B  V.32
     //      '00111'B  modem for interfaces  undefined
     //      '01000'B  autobauding type 1
     //      '11111'B  V.42
  BIT2  connectionElement optional, //   '00'transparent  B  (T)
                                    //   '01'non_transparent  B  (NT)
                                    //   '10'B  both,  preferred  T
                                    //   '11'B  both, NT preferred
  BIT1  extension_octet_6c optional,//'0'B or '1'B no octet following 6d

  // OCTET 6d:
  BIT5  fixedNetworkUserRate  optional, //  '00000'B  FNUR applicable not
                      //     '00001'B   9.kbps  6  (X.1 and V.110)
                      //     '00010'B  14.kbps  4  (X.1 and V.110)
                      //     '00011'B  19.kbps  2  (X.1 and V.110)
                      //     '00100'B  28.kbps  8  (X.1 and V.110)
                      //     '00101'B  38.kbps  4  (X.1 and V.110)
                      //     '00110'B  48.kbps  0  (X.1 and V.110)
                      //     '00111'B  56.kbps  0  (X.1 and V.110)
                      //     '01000'B  64.0 transparent  kbps
  BIT2  otherModemType  optional, //'00'B  no other modem specified  type
                                  // '11'B  V.34
  BIT1  extension_octet_6d optional,//'0'B or '1'B no octet following 6e

  // OCTET 6e:
  BIT3  maxNumberOfTrafficChannels  optional, //         '000'B  TCH  1
                                 //         '001'B  2 TCH
                                 //         '010'B  TCH  3
                                 //         '011'B  4 TCH
                                 //         '100'B  TCH  5
                                 //         '110'B  6 TCH
                                 //         '101'B  TCH  7
                                 //         '111'B  8 TCH
  BIT4  acceptableChannelCodings  optional,//'0'B TCH/F4.8 not acceptable
                                     // '1'B  TCH/F4.8      acceptable
                                     // '0'B  TCH/F9.6  not acceptable
                                     // '1'B  TCH/F9.6      acceptable
                                     // '0'spare  B
                                     // '0'B  TCH/F14.4 not acceptable
                                     // '1'B  TCH/F14.acceptable  4
  BIT1 extension_octet_6e optional,//'0'B or '1'B _ no octet following 6d

  // OCTET 6f:
  BIT4 wantedAirInterfaceUserRate optional,
                                 //octet 6f (MS to MSC/VLR only):
                                 // '0000'B  WAIUR applicable  not
                                 // '0001'B   9.6 kbps
                                 // '0010'B  14.kbps  4
                                 // '0011'B  19.2 kbps
                                 // '0100'B  19.kbps  2
                                 // '0101'B  28.8 kbps
                                 // '0110'B  38.kbps  4
                                 // '0111'B  43.2 kbps
                                 // '1000'B  57.kbps  6
                                 // '1001'B  38.4 kbps
                                 // '1010'B  38.kbps  4
                                 // '1011'B  38.4 kbps
                                 // '1101'B  38.kbps  4
  BIT3  uimi optional,        //  '000'B  user initiated mod. allowed  not
                     //       '001'B  UIMI allowed upto 1 TCH/F
                     //       '010'B  UIMI allowed upto 2 TCH/F
                     //       '011'B  UIMI allowed upto 3 TCH/F
                     //       '100'B  UIMI allowed upto 4 TCH/F
  BIT1  extension_octet_6f optional,// '0'B or '1'B _ no octet following 6f

  BIT2  spare optional, //'00'B
  BIT2  asymetryIndication optional, // spare
  BIT3  acceptableChannelCodingsExt optional, // spare, set to 0
  BIT1  extension_octet_6g optional // '1'B;               
} with { variant "EXTENSION_BIT (yes)"};

type record BC_octet5
{
  BIT3  signallingAccessProtocol, //        '001'B I.440/450
        //        '010'B X.21
        //        '011'B X.28 dedicated PID, ind. NUI
        //        '100'B X.28 dedicated PID, uni. NUI
        //        '101'B X.28 PID  non_dedicated
        //        '110'B X.32
  BIT2  rateAdaptation, //     '00'B no adaptation  rate  (RA)
        //     '01'B V.110/X.30 adaptation  rate
        //     '10'B CCITT X.31 flag stuffing
        //     '11'B RA  other  (see octet 5a)
  BIT2  accessId, //  '00'B identifier  octet
  BIT1  extension_octet_5, // '0'B or '1'B (if no octet 5A following)

  BIT3  spare2_3  optional, // B'...._000
  BIT2  otherRateAdaptation  optional, // B'.._00.._ V.interworking  120
  BIT2  otherInformationTransferCapability optional,
                              // B'_00...._ interworking RDI
  BIT1  extension_octet_5a  optional, // B'x......_

  BIT1  spare3_1  optional, // B'......_0
  BIT1  inbandNegotiation  optional,
  BIT1  assignor_assignee  optional,
  BIT1  lli  optional,
  BIT1  mode  optional,
  BIT1  multiframe  optional,
  BIT1  hdrNohdr  optional,
  BIT1  extension_octet_5b  optional // B'x......_
} with { variant "EXTENSION_BIT (yes)"};

type record BC_octet4
{
  BIT1  establishment, //            '0'demand  B
  BIT1  nirr, //          '0'B no associated  meaning
         //         '1'B data 4.8, FR, NT, 6.0
  BIT1  configuration, //        '0'B point point  to
  BIT1  duplexMode, //      '0'B duplex  half
          //     '1'B full duplex
  BIT2  structure, //   '00'B service data integrity  unit
         //   '11'B unstructured
  BIT1  compression, //  '0'B no DC possible/allowed
         //  '1'B    DC possible/allowed
  BIT1  extension_octet_4 // '1'B
} with { variant "EXTENSION_BIT (yes)"};

type record Speech_AuxiliarySpeech
{
   BIT4  speechVersionIndication, //octet 3a (speech MS to MSC/VLR):
        // B'....0000 speech full rate 1  version
        // B'....0010 speech full rate version 2
        // B'....0100 speech full rate 3  version
        // B'....0001 speech half rate version 1
        // B'....0011 speech half rate 2  version
        // B'....0101 speech half rate version 3
  BIT1  spare1_1, // B'..00....
  BIT1  cTM_or_Spare, // CTM text telephony supported '1'B, not supported '0'B, or spare
  BIT1  coding, // B'_0...... extension octet  ITC
       // B'_1...... other extension octet
  BIT1  extension_octet_3a_3b   // B'x......_
} with { variant "EXTENSION_BIT (yes)"};

type set of Speech_AuxiliarySpeech Speech_AuxiliarySpeech_List with { variant "EXTENSION_BIT (yes)"};
 
type record BC_octet3
{
  BIT3  informationTransferCapability,  //     '000'speech  B
                                        //     '001'B UDI
                                        //     '010'B 3.audio  1kHz
                                        //     '101'oITC B (see octet 5a)
                                        //     '110'B speech  auxiliary
                                        //     '111'B reserved
  BIT1  transferMode, //    '0'B mode  circuit
                      //    '1'B packet  mode
  BIT1  codingStandard, //   '0'B GSM/PCS coding  standardized
                        //   '1'B  reserved
  BIT2  radioChannelRequirement, // '01'B MSC/VLR to MS;
        // '00'B MS (supports) towards MSC/VLR rate dual (half preferred)
        // '01'B MS (supports) towards MSC/VLR full only  rate
                           // '10'B rate  dual  (half preferred)
                           // '11'B rate  dual  (full preferred)
  BIT1 extension_octet_3,
     //'0'B or '1'B (THe RAW encoder will overwrite this bit)
  Speech_AuxiliarySpeech_List  speech_aux_3a_3b     optional                
} with { variant "EXTENSION_BIT (yes)"};

type record BearerCapability_TLV
{
  OCT1  elementIdentifier, // '04'O
  LIN1  lengthIndicator,   // 1..12
  // the following octet fields representing an octet group
  BC_octet3 octet3,  // 1-
  BC_octet4 octet4 optional,  // 1 octet
  BC_octet5 octet5 optional,  // 1-3 octets
  BC_octet6 octet6 optional,  // 1-8 octets
  BC_octet7 octet7 optional   // 1 octet
} with { variant (lengthIndicator) "LENGTHTO (octet3, octet4, octet5, octet6,
                 octet7)"};

type record BearerCapability_LV
{
  LIN1  lengthIndicator,   // 1..12
  // the following octet fields representing an octet group
  BC_octet3 octet3,  // 1-
  BC_octet4 octet4 optional,  // 1 octet
  BC_octet5 octet5 optional,  // 1-3 octets
  BC_octet6 octet6 optional,  // 1-8 octets
  BC_octet7 octet7 optional   // 1 octet
} with { variant (lengthIndicator) "LENGTHTO (octet3, octet4, octet5, octet6,
                 octet7)"};

//10.5.4.5a Call Control Capabilities
type record CallControlCapabilities
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,  
  BIT1  dTMF,
  BIT1  pCP,
  BIT1  eNICM,
  BIT1  mcat,
  BIT4  maxNumberOfSupportedBearers,
  BIT4  maxNumberOfSpeechBearers,
  BIT4  spare2   // '0000'B
} with { variant (lengthIndicator) "LENGTHTO (dTMF,pCP,eNICM,mcat,
                                        maxNumberOfSupportedBearers,spare2)" };


//10.5.4.6 Call State
type record CallState_V
{
  BIT6  callStateValue,
  BIT2  codingStd
};
   
type record CallState_TV
{
  OCT1  elementIdentifier,
  BIT6  callStateValue,
  BIT2  codingStd
};         

//24.008/10.5.4.7 Called Party BCD Number
type record CalledPartyBCD_Number
{
  OCT1  elementIdentifier, // '5E'O
  LIN1  lengthIndicator, // 1..15
  BIT4  numberingPlanIdentification, //       '0000'unknown  B
              //       '0001'B ISDN/telephony
              //       '0011'data  B
              //       '0100'B telex
              //       '1000'national  B
              //       '1001'B private
              //       '1111'B reserved extension  for
  BIT3  typeOfNumber, //  '000'unknown  B
              //  '001'B international number
              //  '010'B        number  national
              //  '011'B network specific number
              //  '100'B dedicated access code  short
              //  '101'B reserved
              //  '110'reserved  B
              //  '111'B reserved for extension
  BIT1  ext1,  // '0'B or '1'B
  hexstring   digits    optional
} with { variant (lengthIndicator) "LENGTHTO (numberingPlanIdentification,
                                       typeOfNumber, ext1, digits)";
         variant (digits) "PADDING(yes)";
         variant (digits) "PADDING_PATTERN('1'B)"};

//24.008/10.5.4.8 Called Party SubAddress
type record CalledPartySubAddress
{
  OCT1  elementIdentifier, // H'6D
  LIN1  lengthIndicator, // 0..21
  BIT3  spare1_3                optional, // B'...._000
  BIT1  odd_evenIndicator       optional, 
                        // B'....0.._ even number of digits  address
                        // B'....1.._ odd  number of address digits
  BIT3  typeOfSubAddress        optional, // B'_000.... NSAP
                                    // B'_010.... specified  user
  BIT1  ext1                    optional, // B'1......_
  OCTN  subAddressInformation   optional
} with { variant (lengthIndicator) "LENGTHTO (spare1_3, odd_evenIndicator,
                        typeOfSubAddress, ext1, subAddressInformation)"};


//10.5.4.9 Calling Party BCD Number
type record CallingOrCalled_Number_oct3
{
  BIT4  numberingPlanIdentification, // Applies for type number  of
                               // = 000, 001, 010 and 100
                               // B'....Unknown  0000
                               // B'....0001 ISDN/telephony number plan
                               // B'....0011 data numbering plan
                               // B'....0100 telex numbering plan
                               // B'....1000 national numbering plan
                               // B'....1001 private numbering plan
                               // B'....1111 reserved for extension
  BIT3  typeOfNumber, // B'_000.... Unknown
                               // B'_001.... international number
                               // B'_010.... national number
                               // B'_011.... network specific number
                               // B'_100.... dedicated access, short code
                               // B'_101.... reserved
                               // B'_110.... reserved
                               // B'_111.... reserved for extension
  BIT1  ext1, // B'1......_
  BIT2  screeningIndicator  optional,
      // B'......00 User_provided, not screened
      // B'......01 User_provided, verified and passed
      // B'......10 User_provided, verified and failed
      // B'......11 Network provided
  BIT3  spare1_3  optional, // B'.._000..
  BIT2  presentationIndicator  optional,
      // B'_00 Presentation allowed
      // B'_01 Presentation restricted
      // B'_10 Number not available due to interworking
      // B'_11 Reserved
  BIT1  ext2  optional // B'1......_
} with { variant "EXTENSION_BIT (yes)"};

type record CallingPartyBCD_Number {
  OCT1  elementIdentifier, // '5C'O -table 9.70
  LIN1  lengthIndicator, // 1..12
  CallingOrCalled_Number_oct3   oct3,
  hexstring  digits  optional
} with { variant (lengthIndicator) "LENGTHTO (oct3,digits)";
         variant (digits) "PADDING(yes)";
         variant (digits) "PADDING_PATTERN('1'B)"};

//10.5.4.10 Calling Party SubAddress
type record CallingPartySubAddress
{
  OCT1  elementIdentifier, // H'5D
  LIN1  lengthIndicator, // 0..21
  BIT3  spare1_3  optional, // B'...._000
  BIT1  odd_evenIndicator  optional,
     // B'....0.._ even number of digits  address
     // B'....1.._ odd  number of address digits
  BIT3  typeOfSubAddress  optional, // B'_000.... NSAP
                    // B'_010.... specified  user
  BIT1  ext1  optional, // B'1......_
  OCTN  subAddressInformation  optional
} with { variant (lengthIndicator) "LENGTHTO (spare1_3, odd_evenIndicator,
                typeOfSubAddress, ext1, subAddressInformation)"};

//24.008/10.5.4.11 Cause
//moved into MobileL3_CommonIE_Types

//24.008/10.5.4.11a/b
type record CLIR
{
  OCT1  elementIdentifier
};

//24.008/10.5.4.12 Congestion level
type record CongestionLevel
{
  BIT4 congestionLevel, // '0000'B receiver ready
                        // '1111'B receiver not ready 
  BIT4 elementIdentifier
};

type BIT4 CongestionLevelV;

//24.008/10.5.4.13 Connected Number
type record ConnectedNumber
{
  OCT1  elementIdentifier, // H'4C
  LIN1  lengthIndicator, // 2..12
  CallingOrCalled_Number_oct3   oct3,
  hexstring    digits  optional
} with { variant (lengthIndicator) "LENGTHTO (oct3,digits)";
         variant (digits) "PADDING(yes)";
         variant (digits) "PADDING_PATTERN('1'B)"};

//****************************************************************************
type record ConnectedSubAddress
{
  OCT1  elementIdentifier, // H'4D
  LIN1  lengthIndicator, // 0..21
  BIT3  spare1_3                optional, // B'...._000
  BIT1  odd_evenIndicator       optional,
    // B'....0.._ even number of digits address
    // B'....1.._ odd  number of address digits
  BIT3  typeOfSubAddress        optional, // B'_000.... NSAP
                      // B'_010.... specified  user
  BIT1  ext1                    optional, // B'1......_
  OCTN  subAddressInformation   optional
} with { variant (lengthIndicator) "LENGTHTO (spare1_3, odd_evenIndicator,
                        typeOfSubAddress, ext1, subAddressInformation)" };

//10.5.4.15 Facility IE (see also 24.080/3.6
// moved to Mobile_L3_CommonIE_Types , because it is used by SS and CC
 
// 10.5.4.16 HighLayerCompatibility
type record HLC_octet3
{
  BIT2  presentationMethod, 
  BIT3  interpretation,
  BIT2  codingStandard,
  BIT1  extension_octet_3 //  '1'B  octet4 should follow
} with { variant "EXTENSION_BIT (yes)"};

type record HLC_octet4
{
  BIT7 highLayerCharId,
  BIT1 extension_octet_4,
  //octet4a:
  BIT7 extendedHighLayerCharId optional,
  BIT1 extension_octet_4a      optional // '1'B
} with { variant "EXTENSION_BIT (yes)"};

type record HighLayerCompatibility
{
  OCT1        elementIdentifier, // H'7D
  LIN1        lengthIndicator, // 0..3
  HLC_octet3  octet3 optional, 
  HLC_octet4  octet4 optional // if octet3 used, octet4 should use, see 10.5.4.16.1
  //replaced this: octetstring  highLayerCompatibilityContents  length(1..3) optional
} with { variant (lengthIndicator) "LENGTHTO (octet3, octet4)"};

//10.5.4.17 Keypad Facility
type record KeypadFacility
{
  OCT1  elementIdentifier, //
  BIT7  keypadInformation, //IA5 char
  BIT1  spare_1
};

//10.5.4.18 Low Layer Compatibility
// see also ITU Q.931
type record LowLayerCompatibility
{
  OCT1         elementIdentifier, // H'7C
  LIN1         lengthIndicator,   // 0..13
  octetstring  lowLayerCompatibilityContents  length(2..16) optional

//commented out to simplify the type
/*  BIT5  informationTransferCapability  optional,
  BIT2  codingStandard  optional,
  BIT1  ext1  optional, // B'x........
  BIT6  spare1_6  optional, // B'..0000000
  BIT1  negotiationIndicator  optional,
  BIT1  ext2  optional, // B'x........
  BIT5  informationTransferRate  optional,
  BIT2  transferMode  optional,
  BIT1  ext3  optional, // B'x........
  BIT2  establishment  optional,
  BIT2  configuration  optional,
  BIT3  structure  optional,
  BIT1  ext4  optional, // B'x........
  BIT5  informationTransferRateDestOrig  optional,
  BIT2  symetry  optional,
  BIT1  ext5  optional, // B'x........
  BIT5  userInformationLayer1Protocol  optional,
  BIT2  layer1Identity  optional,
  BIT1  ext6  optional, // B'x........
  BIT5  userRate  optional,
  BIT1  negotiation  optional,
  BIT1  synchronous_asynchronous  optional,
  BIT1  ext7  optional, // B'x........
  BIT1  spare2_1  optional, // B'........0
  BIT1  flowControlOnRX  optional,
  BIT1  flowControlOnTX  optional,
  BIT1  nicOnRX  optional,
  BIT1  nicOnTX  optional,
  BIT2  intermediateRate  optional,
  BIT1  ext8  optional, // B'x........
  BIT1  spare3_1  optional, // B'........0
  BIT1  inband_outbandNegotiation  optional,
  BIT1  assignor_assignee  optional,
  BIT1  lliNegotiation  optional,
  BIT1  mode  optional,
  BIT1  multiFrameSupport  optional,
  BIT1  hdrNohdr  optional,
  BIT1  ext9  optional, // B'x........
  BIT3  parity  optional,
  BIT2  numberDataBits  optional,
  BIT2  numberStopBits  optional,
  BIT1  ext10  optional, // B'x........
  BIT6  modemType  optional,
  BIT1  duplexMode  optional,
  BIT1  ext11  optional, // B'x........
  BIT5  userInformationLayer2Protocol  optional,
  BIT2  layer2Id  optional,
  BIT1  ext12  optional, // B'x........
  BIT5  userInformationLayer3Protocol  optional,
  BIT2  layer3Id  optional,
  BIT1  ext13  optional, // B'x........
  BIT7  optionalLayer3ProtocolInformation  optional,
  BIT1  ext14  optional  // B'x........
*/
} with { variant (lengthIndicator) "LENGTHTO (lowLayerCompatibilityContents)"};

//10.5.4.19 More Data
/*
type record MoreData
{
  OCT1  elementIdentifier //'A0'O
};
*/

//10.5.4.20 NotificationIndicator
type record NotificationIndicator
{
//  OCT1  elementIdentifier,
  OCT1  notificationDescription // '80'O : user suspended
                                // '81'O : user resumed
                                // '82'O : bearer change
};

//10.5.4.21 Progress Indicator
type record ProgressIndicator_LV
{
  LIN1  lengthIndicator, // '02'O
  BIT4  location,          // '0000'user  B
              // '0001'B private network, local user
              // '0010'B public  network, user  local
              // '0100'B public  network, remote user
              // '0101'B private network, user  remote
              // '1010'B Network beyond interworking pt.
  BIT1  spare1_1, //      '0'B
  BIT2  codingStandard, //  '00'B coding according Q.931
      //  '01'B reserved for standards  other
      //  '10'B National standard
      //  '11'B standard  other
  BIT1  ext1, // '1'B
  BIT7  progressDescription, //'0000001'B call is not end_to_end PLMN/ISDN
     //  '0000010'B destination address is not PLMN/ISDN
     //  '0000011'B origination address is not PLMN/ISDN
     //  '0000100'B call has returned to the PLMN/ISDN
     //  '0001000'B inband info available PLMN/ISDN
     //  '0100000'B call is end_to_end PLMN/ISDN
  BIT1  ext2  // '1'B
} with { variant (lengthIndicator) "LENGTHTO (location, spare1_1,
                                              codingStandard, ext1, 
                                              progressDescription, ext2)"};

type record  ProgressIndicator_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator, // '02'O
  BIT4  location,          // '0000'user  B
              // '0001'B private network, local user
              // '0010'B public  network, user  local
              // '0100'B public  network, remote user
              // '0101'B private network, user  remote
              // '1010'B Network beyond interworking pt.
  BIT1  spare1_1, //      '0'B
  BIT2  codingStandard, //  '00'B coding according Q.931
      //  '01'B reserved for standards  other
      //  '10'B National standard
      //  '11'B standard  other
  BIT1  ext1, // '1'B
  BIT7  progressDescription, //'0000001'B call is not end_to_end PLMN/ISDN
     //  '0000010'B destination address is not PLMN/ISDN
     //  '0000011'B origination address is not PLMN/ISDN
     //  '0000100'B call has returned to the PLMN/ISDN
     //  '0001000'B inband info available PLMN/ISDN
     //  '0100000'B call is end_to_end PLMN/ISDN
  BIT1  ext2  // '1'B
  // removed by ethbaat:ProgressIndicator_LV  progressIndicator_LV
} with { variant (lengthIndicator) "LENGTHTO (location, spare1_1,
                                              codingStandard, ext1, 
                                              progressDescription, ext2)"};

//24.008/10.5.4.21a Recall Type
type record RecallType
{
  OCT1  elementIdentifier,
  BIT3  recallType,
  BIT5  spare_5
}; 

//24.008/10.5.4.21b Redirecting party BCD number
type record RedirectingPartyBCDNumberTLV
{
  OCT1                         elementIdentifier,
  LIN1                         lengthIndicator,
  CallingOrCalled_Number_oct3  oct3,  
  hexstring                    digits  optional
} with { variant (lengthIndicator) "LENGTHTO (oct3,digits)";
         variant (digits) "PADDING(yes)";
         variant (digits) "PADDING_PATTERN('1'B)"
          
};

//24.008/10.5.4.21c Redirecting party Subaddress
type record RedirectingPartySubaddressTLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  BIT3  spare1_3  optional, // B'...._000
  BIT1  odd_evenIndicator  optional,
     // B'....0.._ even number of digits  address
     // B'....1.._ odd  number of address digits
  BIT3  typeOfSubAddress  optional, // B'_000.... NSAP
                    // B'_010.... specified  user
  BIT1  ext1  optional, // B'1......_
  OCTN  subAddressInformation  optional
} with { variant (lengthIndicator) "LENGTHTO (spare1_3, odd_evenIndicator,
                typeOfSubAddress, ext1, subAddressInformation)"};  

//24.008/10.5.4.22 Repeat Indicator
type record RepeatIndicator
{
  BIT4  RepeatIndication,
  BIT4  elementIdentifier        
};

//10.5.4.22a Reverse Call Setup Direction
type record ReverseCallSetupDirection
{
  OCT1  elementIdentifier
}; 

//10.5.4.22b Setup Contatiner CCBS
type record SetupContatinerCCBS
{
  OCT1  elementIdentifier, 
  LIN1  lengthIndicator, 
  OCTN  setupMessage
} with { variant (lengthIndicator) "LENGTHTO (setupMessage)"}; 

type record SetupContatinerCCBS_LV
{ 
  LIN1  lengthIndicator, 
  OCTN  setupMessage      
} with { variant (lengthIndicator) "LENGTHTO (setupMessage)"}; 

//10.5.4.23 Signal
type record ML3_Signal
{
  OCT1  elementIdentifier, // H'34
  OCT1  signalValue   // B'00000000  0. Dial tone on
                      // B'00000001  1. Ring back on  tone
                      // B'00000010  2. Intercept tone on
                      // B'00000011  3. Network congestion on  tone
                      // B'00000100  4. Busy tone on
                      // B'00000101  5. Confirm on  tone
                      // B'00000110  6. Answer tone on
                      // B'00000111  7. Call waiting on  tone
                      // B'00001001  9. Off_hook warning tone on
                      // B'00111111 63. off  Tones
                      // B'01001111 79. Alerting off
};

//10.5.4.24 SS Version Indicator
//moved to MobileL3_CommonIE_Types

//10.5.4.25 User-user
type record User_user_LV
{
  LIN1 lengthIndicator,
  OCT1  user_userProtocolDiscriminator,
  octetstring user_userInformation length(0..129) //transparent
} with { variant (lengthIndicator) "LENGTHTO(user_userInformation)" };

type record User_user_TLV
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  OCT1  user_userProtocolDiscriminator,
  octetstring user_userInformation length(0..128) //transparent
} with { variant (lengthIndicator) "LENGTHTO(user_userInformation)" };

type record User_userShort
{
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  OCT1  user_userProtocolDiscriminator,
  octetstring user_userInformation length(0..32)
} with { variant (lengthIndicator) "LENGTHTO(user_userInformation)" };

//10.5.4.26 Alerting Pattern
type record  AlertingPattern
{
  OCT1  elementIdentifier, //'19'O  
  LIN1  lengthIndicator,
  BIT4  alertingPattern_FIELD,
  BIT4  spare
} with { variant (lengthIndicator) "LENGTHTO (alertingPattern_FIELD,spare )"}; 

//10.5.4.27 Allowed Actions
type record AllowedActions
{
  OCT1  elementIdentifier, //'19'O  
  LIN1  lengthIndicator,
  BIT7  spare_7,
  BIT1  ccbsActivation //'0'B activation is not possible
                       //'1'B activation is possible
} with { variant (lengthIndicator) "LENGTHTO (spare_7,ccbsActivation)"};

//10.5.4.28 Stream Identifier
type record StreamIdentifier
{
  OCT1     elementIdentifier, // '2D'O
  integer  lengthf, // '01'O
  OCT1     streamIdentifierValue  // value 0..255
} with { variant (lengthf) "LENGTHTO (streamIdentifierValue)"};

// 24.008/10.5.4.29 Network Call Control Capabilities
type record NetworkCallControlCapabilities
{
  OCT1  elementIdentifier, //'2F'O
  LIN1  lengthIndicator,  
  BIT1  mcs, // multicall support '0'B: no support
            //                   '1'B :support
  BIT7  spare
} with { variant (lengthIndicator) "LENGTHTO (mcs,spare)"};

//10.5.4.30 CauseofNoCli
type record CauseofNoCli
{
  OCT1  elementIdentifier,  //'3A'O
  LIN1  lengthIndicator,
  OCT1  causeofNoCli_FIELD  
} with { variant (lengthIndicator) "LENGTHTO (causeofNoCli_FIELD)"};

//10.5.4.31 Immediate Modification Indicator
// VOID

// 10.5.4.33 Service Category (TLV)
type record ServiceCategory
{
  OCT1      elementIdentifier,
  LIN1      lengthIndicator,
  BIT7      emergencyServiceCategory,
  BIT1      spare_1
} with { variant (lengthIndicator) "LENGTHTO( emergencyServiceCategory, spare_1 )"}; 

// 10.5.4.34 REDIAL (T)
type Type2 Redial;
 
//10.5.4.35 Network Initiated Service Upgrade Indicator
type record NetworkInitiatedServiceUpgradeIndicator
{
  OCT1  elementIdentifier
}; 

//============================================================================
// 20.008/9.3 Messages for circuit-switched call control (CC)
//============================================================================

// 9.3.1.1 Alerting (NW->MS)
//****************************************************************************
type record PDU_ML3_Alerting_NW_MS
{
  BIT6  messageType, //     '000001'Alerting  B
  BIT2  nsd,
  Facility_TLV          facility            optional,
  ProgressIndicator_TLV progressIndicator   optional,
  User_user_TLV         user_user           optional
} with { variant "TAG (
                facility,           elementIdentifier = '1C'O;
                progressIndicator,  elementIdentifier = '1E'O;
                user_user,          elementIdentifier = '7E'O ) "}

// 9.3.1.2 Alerting (MS->NW)
//****************************************************************************
type record PDU_ML3_Alerting_MS_NW
{
  BIT6  messageType, // B'..000001 (Alerting)
  BIT2  nsd,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional,
  SS_VersionIndicator   ss_VersionIndicator optional
} with { variant "TAG (
                facility,            elementIdentifier = '1C'O;
                user_user,           elementIdentifier = '7E'O;
                ss_VersionIndicator, elementIdentifier = '7F'O ) "};
                
// 9.3.2 Call confirmed (MS->NW)
//****************************************************************************
type record PDU_ML3_CallConfirmed
{
  BIT6  messageType, //    '001000'CallConfirmed  B
  BIT2  nsd,
  RepeatIndicator       repeatIndicator     optional, // successive selection:
                                              //only present also  if
                                              //BC1&BC2 are present
                                              // H'circular  D1
                                              // H'D3 sequential
  BearerCapability_TLV  bearerCapability1   optional,
  BearerCapability_TLV  bearerCapability2   optional,
  ML3_Cause_TLV         cause               optional,
  CallControlCapabilities cC_Capabilities   optional,
  StreamIdentifier      streamIdentifier    optional,
  SupportedCodecList    supportedCodecs     optional
} with { variant "TAG (
                repeatIndicator,   elementIdentifier = '1101'B;
                bearerCapability1, elementIdentifier = '04'O;
                bearerCapability2, elementIdentifier = '04'O;
                cause,             elementIdentifier = '08'O;
                cC_Capabilities,   elementIdentifier = '15'O;
                streamIdentifier,  elementIdentifier = '2D'O;) "};

// 9.3.3 Call Proceeding (NW->MS) 
//****************************************************************************
type record PDU_ML3_CallProceeding
{
  BIT6  messageType, //   '000010'CallProceeding  B
  BIT2  nsd,
  RepeatIndicator       repeatIndicator     optional, //successive selection:
                                              //only present also  if
                                              //BC1&BC2 are present
                                              // H'circular  D1
                                              // H'D3 sequential
  BearerCapability_TLV  bearerCapability1   optional,
  BearerCapability_TLV  bearerCapability2   optional,
  Facility_TLV          facility            optional,
  ProgressIndicator_TLV progressIndicator   optional,
  PriorityLevel_ML3     priorityGranted     optional,
  NetworkCallControlCapabilities  networkCCCapabilities optional //10.5.4.29
} with { variant "TAG (
                repeatIndicator,   elementIdentifier = '1101'B;
                bearerCapability1, elementIdentifier = '04'O;
                bearerCapability2, elementIdentifier = '04'O;
                facility,          elementIdentifier = '1C'O;
                progressIndicator, elementIdentifier = '1E'O;
                priorityGranted,   elementIdentifier = '1000'B;
                networkCCCapabilities,  elementIdentifier = '2F'O;) "};

// 9.3.4 Congestion Control (NW->MS) 
//****************************************************************************
type record PDU_ML3_CongestionControl
{
  BIT6  messageType, //   '111001'B CongestionControl
  BIT2  nsd,
  CongestionLevelV      congestionLevel,
  BIT4                  spare_4, 
  ML3_Cause_TLV         cause               optional
 } with { variant "TAG ( cause, elementIdentifier = '08'O )"};


// 9.3.5 Connect
//**************************************************************************** 
// 9.3.5.1 Connect (NW->MS)
type record PDU_ML3_Connect_NW_MS
{
  BIT6  messageType, // '000111'B (Connect)
  BIT2  nsd,
  Facility_TLV          facility            optional,
  ProgressIndicator_TLV progressIndicator   optional,
  ConnectedNumber       connectedNumber     optional,
  ConnectedSubAddress   connectedSubAddress optional,
  User_user_TLV         user_user           optional
} with { variant "TAG (
                facility,            elementIdentifier = '1C'O;
                progressIndicator,   elementIdentifier = '1E'O;
                connectedNumber,     elementIdentifier = '4C'O;
                connectedSubAddress, elementIdentifier = '4D'O;
                user_user,           elementIdentifier = '7E'O ) "};

// 9.3.5.2 Connect (MS->NW)

type record PDU_ML3_Connect_MS_NW 
{
  BIT6  messageType, // '000111'B (Connect)
  BIT2  nsd,
  Facility_TLV          facility            optional,
  ConnectedSubAddress   connectedSubAddress optional,
  User_user_TLV         user_user           optional,
  SS_VersionIndicator   ss_VersionIndicator optional,
  StreamIdentifier      streamIdentifier    optional
} with { variant "TAG (
                facility,              elementIdentifier = '1C'O;
                connectedSubAddress,   elementIdentifier = '4D'O;
                user_user,             elementIdentifier = '7E'O;
                ss_VersionIndicator,   elementIdentifier = '7F'O;
                streamIdentifier,      elementIdentifier = '2D'O ) "};
                
// 9.3.6 Connect Ack (NW->MS) (MS->NW)
//****************************************************************************                      
type record PDU_ML3_ConnectAck
{
  BIT6  messageType, // '001111'B (ConnectAck)
  BIT2  nsd
};

// 9.3.7 Disconnect
//****************************************************************************  
// 9.3.7.1 Disconnect (NW-MS)
type record PDU_ML3_Disconnect_NW_MS
{
  BIT6  messageType, //   '100101'B  (Disconnect)
  BIT2  nsd,
  ML3_Cause_LV          cause,
  Facility_TLV          facility            optional,
  ProgressIndicator_TLV progressIndicator   optional,
  User_user_TLV         user_user           optional,
  AllowedActions        allowedActions      optional
} with { variant "TAG (
                facility,           elementIdentifier = '1C'O;
                progressIndicator,  elementIdentifier = '1E'O;
                user_user,          elementIdentifier = '7E'O;
                allowedActions,     elementIdentifier = '7B'O ) "};

// 9.3.7.2 Disconnect (MS->NW)
type record PDU_ML3_Disconnect_MS_NW
{
  BIT6  messageType,  //    '100101'B (Disconnect)
  BIT2  nsd,
  ML3_Cause_LV          cause,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional,
  SS_VersionIndicator   ss_VersionIndicator optional
} with { variant "TAG (
                facility,             elementIdentifier = '1C'O;
                user_user,            elementIdentifier = '7E'O;
                ss_VersionIndicator,  elementIdentifier = '7F'O ) "};

// 9.3.8 Emergency Setup (MS->NW )
//****************************************************************************  
type record PDU_ML3_EmergencySetup
{
  BIT6  messageType,  // '001110'B
  BIT2  nsd, 
  BearerCapability_TLV  bearerCapability    optional,
  StreamIdentifier      streamIdentifier    optional,
  SupportedCodecList    supportedCodecs     optional,
  ServiceCategory       emergencyCategory   optional
} with { variant "TAG ( 
     bearerCapability,  elementIdentifier = '04'O;
     streamIdentifier,  elementIdentifier = '2D'O; 
     emergencyCategory, elementIdentifier = '2E'O; ) "};
     
// 9.3.9.1 (NW->MS) and 9.3.9.2 (MS->NW) Facility (CallControl!!!)
//****************************************************************************
type record PDU_ML3_Facility
{
  BIT6  messageType, // facilityIEI
  BIT2  nsd,
  Facility_LV           facility, //10.5.4.15
  SS_VersionIndicator   ss_version          optional // only for MS->NW
} with { variant "TAG (  ss_version,  elementIdentifier = '7F'O ) "};  

//9.3.10 Hold (MS->NW)
//****************************************************************************
type record PDU_ML3_Hold
{
  BIT6  messageType,    //    '011000'Hold  B
  BIT2  nsd
};

//9.3.11 Hold Acknowledge (NW->MS)
//****************************************************************************
type record PDU_ML3_HoldAcknowledge
{
  BIT6  messageType,    //   '011001'B   Acknowledge  Hold
  BIT2  nsd
};

//9.3.12 Hold Reject (NW->MS)
//****************************************************************************
type record PDU_ML3_HoldReject
{
  BIT6  messageType, //'011010'B
  BIT2  nsd,
  ML3_Cause_LV          cause
};

//9.3.13 Modify (MS->NW) (NW->MS)
//****************************************************************************
type record PDU_ML3_Modify
{
  BIT6  messageType, //'010111'B
  BIT2  nsd,
  BearerCapability_LV       bearerCapability,
  LowLayerCompatibility     lowLayerCompatibility     optional,
  HighLayerCompatibility    highLayerCompatibility    optional,
  ReverseCallSetupDirection reverseCallSetupDirection optional,
  NetworkInitiatedServiceUpgradeIndicator  networkInitiatedServiceUpgradeIndicator  optional 
} with { variant "TAG (
      lowLayerCompatibility,     elementIdentifier = '7C'O;
      highLayerCompatibility,    elementIdentifier = '7D'O;
      reverseCallSetupDirection, elementIdentifier = 'A3'O;
      networkInitiatedServiceUpgradeIndicator,     elementIdentifier = 'A4'O ) "};  

//9.3.14 Modify Complete (MS->NW) (NW->MS)
//****************************************************************************
type record PDU_ML3_ModifyComplete
{
  BIT6  messageType, //'011111'B
  BIT2  nsd,
  BearerCapability_LV       bearerCapability,
  LowLayerCompatibility     lowLayerCompatibility     optional,
  HighLayerCompatibility    highLayerCompatibility    optional,
  ReverseCallSetupDirection reverseCallSetupDirection optional
} with { variant "TAG (
      lowLayerCompatibility,     elementIdentifier = '7C'O;
      highLayerCompatibility,    elementIdentifier = '7D'O;
      reverseCallSetupDirection, elementIdentifier = 'A3'O;) "}; 
      
//9.3.15 Modify Reject (MS->NW) (NW->MS)
//****************************************************************************
type record PDU_ML3_ModifyReject
{
  BIT6  messageType, //'010011'B
  BIT2  nsd,
  BearerCapability_LV     bearerCapability,
  ML3_Cause_LV            cause,
  LowLayerCompatibility   lowLayerCompatibility     optional,
  HighLayerCompatibility  highLayerCompatibility    optional
} with { variant "TAG (
      lowLayerCompatibility,     elementIdentifier = '7C'O;
      highLayerCompatibility,    elementIdentifier = '7D'O;) "}; 

//9.3.16 Notify (MS->NW) (NW->MS)
//****************************************************************************
type record PDU_ML3_Notify
{
  BIT6  messageType, //'111110'B
  BIT2  nsd,
  NotificationIndicator notificationIndicator
};
    
// 9.3.17 Progress (NW->MS)
//****************************************************************************
type record PDU_ML3_Progress
{
  BIT6  messageType,    //  '000011'Progress  B
  BIT2  nsd,
  ProgressIndicator_LV  progressIndicator,
  User_user_TLV         user_user             optional      
} with { variant "TAG (user_user, elementIdentifier = '7E'O; ) "};

// 9.3.17a CC Establishment (NW->MS)
//****************************************************************************
type record PDU_ML3_CC_Establishment
{
  BIT6  messageType,    //  '000100'
  BIT2  nsd,
  SetupContatinerCCBS_LV  container  
}

// 9.3.17b CC Establishment Confirmed (MS->NW)
//****************************************************************************
type record PDU_ML3_CC_EstablishmentConf
{
  BIT6  messageType,    //  'CC_EstablishmentConf'
  BIT2  nsd,
  RepeatIndicator       repeatIndicator     optional,
  BearerCapability_TLV  bearerCapability1,
  BearerCapability_TLV  bearerCapability2   optional,    
  ML3_Cause_TLV         cause               optional,
  SupportedCodecList    supportedCodecs     optional
} with { variant "TAG (
                repeatIndicator,    elementIdentifier = '1101'B;
                bearerCapability2,  elementIdentifier = '04'O;
                cause,              elementIdentifier = '08'O; ) "};

// 9.3.18.1 Release (NW->MS)
//****************************************************************************
type record PDU_ML3_Release_NW_MS 
{
  BIT6  messageType, //    '101101'Release  B
  BIT2  nsd,
  ML3_Cause_TLV         cause               optional,
  ML3_Cause_TLV         secondCause         optional,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional
} with { variant "TAG (
                cause,        elementIdentifier = '08'O;
                secondCause,  elementIdentifier = '08'O;
                facility,     elementIdentifier = '1C'O;
                user_user,    elementIdentifier = '7E'O ) "};

// 9.3.18.2 Release (MS->NW)
//****************************************************************************
type record PDU_ML3_Release_MS_NW
{
  BIT6  messageType, //    '101101'Release  B
  BIT2  nsd,
  ML3_Cause_TLV         cause               optional,
  ML3_Cause_TLV         secondCause         optional,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional,
  SS_VersionIndicator   ss_VersionIndicator optional
} with { variant "TAG (
                cause,                elementIdentifier = '08'O;
                secondCause,          elementIdentifier = '08'O;
                facility,             elementIdentifier = '1C'O;
                user_user,            elementIdentifier = '7E'O;
                ss_VersionIndicator,  elementIdentifier = '7F'O ) "};

// 9.3.18a Recall (CCBS) (NW->MS)
//****************************************************************************
type record PDU_ML3_Recall
{
  BIT6  messageType, //    '001011'Recall    
  BIT2  nsd,
  RecallType            recallType,
  Facility_LV           facility
};

// 9.3.19.1 Release Complete (NW->MS)
//****************************************************************************
type record PDU_ML3_ReleaseComplete_NW_MS
{
  BIT6  messageType, //    '101010'B ReleaseComplete  
  BIT2  nsd,
  ML3_Cause_TLV         cause               optional,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional
} with { variant "TAG (
                cause,      elementIdentifier = '08'O;
                facility,   elementIdentifier = '1C'O ;
                user_user,  elementIdentifier = '7E'O ) "};

// 9.3.19.2 Release Complete (MS->NW)
//****************************************************************************
type record PDU_ML3_ReleaseComplete_MS_NW
{
  BIT6  messageType, //   '101010'B  (ReleaseComplete)
  BIT2  nsd,
  ML3_Cause_TLV         cause               optional,
  Facility_TLV          facility            optional,
  User_user_TLV         user_user           optional,
  SS_VersionIndicator   ss_VersionIndicator optional
} with { variant "TAG (
                cause,                elementIdentifier = '08'O;
                facility,             elementIdentifier = '1C'O;
                user_user,            elementIdentifier = '7E'O;
                ss_VersionIndicator,  elementIdentifier = '7F'O ) "};

//9.3.20 Retrieve (MS->NW)
//****************************************************************************
type record PDU_ML3_Retrieve
{
  BIT6  messageType, //'011100'B
  BIT2  nsd
};

//9.3.21 Retrieve Acknowledge (NW->MS)
//****************************************************************************
type record PDU_ML3_RetrieveAck
{
  BIT6  messageType, //'011101'B
  BIT2  nsd
};

//9.3.22 Retrieve Reject (NW->MS)
//****************************************************************************
type record PDU_ML3_RetrieveRej
{
  BIT6  messageType, //'011110'B
  BIT2  nsd,
  ML3_Cause_LV cause
};

// 9.3.23.1  Setup NW->MS 
//****************************************************************************
type record PDU_ML3_Setup_NW_MS
{
  BIT6  messageType,   // '000101'B  (Setup)
  BIT2  nsd,
  RepeatIndicator       bcRepeatIndicator       optional, // successive selection:
                                                 // only present also  if
                                                 // BC1&BC2 are present
                                                 // H'circular  D1
                                                 // H'D3 sequential
  BearerCapability_TLV  bearerCapability1        optional,
  BearerCapability_TLV  bearerCapability2        optional,
  Facility_TLV          facility                 optional,
  ProgressIndicator_TLV progressIndicator        optional,
  ML3_Signal            signal                   optional,
  CallingPartyBCD_Number callingPartyBCD_Number  optional,
  CallingPartySubAddress callingPartySubAddress  optional,
  CalledPartyBCD_Number calledPartyBCD_Number    optional,
  CalledPartySubAddress calledPartySubAddress    optional,
  RedirectingPartyBCDNumberTLV   redirectingPartyBCDNumber   optional,
  RedirectingPartySubaddressTLV  redirectingPartySubaddress  optional,
  RepeatIndicator       llc_RepeatIndicator      optional, // H'circular  D1
                                                            // H'D3 sequential
  LowLayerCompatibility lowLayerCompatibility1   optional,
  LowLayerCompatibility lowLayerCompatibility2   optional,
  RepeatIndicator       hlc_RepeatIndicator      optional, // H'circular  D1
                                                            // H'D3 sequential
  HighLayerCompatibility highLayerCompatibility1 optional,
  HighLayerCompatibility highLayerCompatibility2 optional,
  User_userShort        user_user                optional,
  PriorityLevel_ML3     priority                 optional,
  AlertingPattern       alert                    optional, //10.5.4.26
  NetworkCallControlCapabilities  networkCCCapabilities optional, //10.5.4.29
  CauseofNoCli          causeofNoCli             optional, //10.5.4.30
  BackupBearerCapacity  backupBearerCapacity     optional  //10.5.4.4a
} with { variant "TAG (
                bcRepeatIndicator,        elementIdentifier = '1101'B;
                bearerCapability1,        elementIdentifier = '04'O;
                bearerCapability2,        elementIdentifier = '04'O;
                facility,                 elementIdentifier = '1C'O;
                progressIndicator,        elementIdentifier = '1E'O;
                signal,                   elementIdentifier = '34'O;
                callingPartyBCD_Number,   elementIdentifier = '5C'O;
                callingPartySubAddress,   elementIdentifier = '5D'O;
                calledPartyBCD_Number,    elementIdentifier = '5E'O;
                calledPartySubAddress,    elementIdentifier = '6D'O;
                redirectingPartyBCDNumber,   elementIdentifier = '74'O;               
                redirectingPartySubaddress,  elementIdentifier = '75'O; 
                llc_RepeatIndicator,      elementIdentifier = '1101'B;
                lowLayerCompatibility1,   elementIdentifier = '7C'O;
                lowLayerCompatibility2,   elementIdentifier = '7C'O;
                hlc_RepeatIndicator,      elementIdentifier = '1101'B;
                highLayerCompatibility1,  elementIdentifier = '7D'O;
                highLayerCompatibility2,  elementIdentifier = '7D'O;
                user_user,                elementIdentifier = '7E'O;
                priority,                 elementIdentifier = '1000'B;
                alert,                    elementIdentifier = '19'O;
                networkCCCapabilities,    elementIdentifier = '2F'O;
                causeofNoCli,             elementIdentifier = '3A'O;
                backupBearerCapacity,     elementIdentifier = '41'O ) "}; 
                
// 9.3.23.2 Setup MS->NW
//****************************************************************************
type record PDU_ML3_Setup_MS_NW
{
  BIT6  messageType,   //     '000101'B  (Setup)
  BIT2  nsd,
  RepeatIndicator         bcRepeatIndicator       optional, // successive selection:
                                                 // only present also  if
                                                 // BC1&BC2 are present
                                                 // H'circular  D1
                                                 // H'D3 sequential
  BearerCapability_TLV    bearerCapability1,        //mandatory!!
  BearerCapability_TLV    bearerCapability2       optional,
  Facility_TLV            facility                optional,
  CallingPartySubAddress  callingPartySubAddress  optional,
  CalledPartyBCD_Number   calledPartyBCD_Number,  //mandatory!!
  CalledPartySubAddress   calledPartySubAddress   optional,
  RepeatIndicator         llc_RepeatIndicator     optional, // H'circular  D1
                        // H'D3 sequential
  LowLayerCompatibility   lowLayerCompatibility1  optional,
  LowLayerCompatibility   lowLayerCompatibility2  optional,
  RepeatIndicator         hlc_RepeatIndicator     optional, // H'circular  D1
                          // H'D3 sequential
  HighLayerCompatibility  highLayerCompatibility1 optional,
  HighLayerCompatibility  highLayerCompatibility2 optional,
  User_userShort          user_user               optional,
  SS_VersionIndicator     ss_VersionIndicator     optional,
  CLIR                    clir_Suppression        optional, // H'A1
  CLIR                    clir_Invocation         optional, // H'A2
  CallControlCapabilities cC_Capabilities         optional,
  Facility_TLV            facility_ccbs1          optional,
  Facility_TLV            facility_ccbs2          optional,
  StreamIdentifier        streamIdentifier        optional,
  SupportedCodecList      supportedCodecs         optional,
  Redial                  redial                  optional
} with { variant "TAG (
                bcRepeatIndicator,        elementIdentifier = '1101'B;
                //bearerCapability1,        elementIdentifier = '04'O;
                bearerCapability2,        elementIdentifier = '04'O;
                facility,                 elementIdentifier = '1C'O;
                callingPartySubAddress,   elementIdentifier = '5D'O;
                //calledPartyBCD_Number,    elementIdentifier = '5E'O;
                calledPartySubAddress,    elementIdentifier = '6D'O;
                llc_RepeatIndicator,      elementIdentifier = '1101'B;
                lowLayerCompatibility1,   elementIdentifier = '7C'O;
                lowLayerCompatibility2,   elementIdentifier = '7C'O;
                hlc_RepeatIndicator,      elementIdentifier = '1101'B;
                highLayerCompatibility1,  elementIdentifier = '7D'O;
                highLayerCompatibility2,  elementIdentifier = '7D'O;
                user_user,                elementIdentifier = '7E'O;
                ss_VersionIndicator,      elementIdentifier = '7F'O;
                clir_Suppression,         elementIdentifier = 'A1'O;
                clir_Invocation,          elementIdentifier = 'A2'O;
                cC_Capabilities,          elementIdentifier = '15'O;
                facility_ccbs1,           elementIdentifier = '1D'O;
                facility_ccbs2,           elementIdentifier = '1B'O;
                streamIdentifier,         elementIdentifier = '2D'O;
                redial,                   elementIdentifier = 'A3'O; ) "};

//9.3.23a StartCC  (MS->NW)
//****************************************************************************
type record PDU_ML3_StartCC
{
  BIT6  messageType, //''B;
  BIT2  nsd,
  CallControlCapabilities cC_Capabilities optional
} with { variant "TAG (cC_Capabilities, elementIdentifier = '15'O;) "};

// 9.3.24  Start DTMF (MS->NW)
//****************************************************************************
type record PDU_ML3_StartDTMF
{
  BIT6  messageType, //'110101'B;
  BIT2  nsd,
  KeypadFacility        keypadFacility  
};

// 9.3.25  Start DTMF Acknowledge (NW->MS)
//****************************************************************************
type record PDU_ML3_StartDTMFAck
{
  BIT6  messageType, //'110110'B;
  BIT2  nsd,
  KeypadFacility        keypadFacility  
};

// 9.3.26  Start DTMF Reject (NW->MS)
//****************************************************************************
type record PDU_ML3_StartDTMFRej
{
  BIT6  messageType, //'110111'B;
  BIT2  nsd,
  ML3_Cause_LV          cause    
};

// 9.3.27  Status (NW->MS) (MS->NW)
//****************************************************************************
type record PDU_ML3_Status
{
  BIT6  messageType, //'111101'B;   
  BIT2  nsd,
  ML3_Cause_LV          cause,
  CallState_V           callState,
  AuxiliaryStates_TLV   auxiliaryStates optional //'24'O
} with { variant "TAG (auxiliaryStates,elementIdentifier ='24'O ) " };

// 9.3.28  Status enquiry (NW->MS) (MS->NW)
//****************************************************************************
type record PDU_ML3_StatusEnquiry
{
  BIT6  messageType, //'110100'B;   
  BIT2  nsd
};

// 9.3.29 Stop DTMF (MS->NW)
//****************************************************************************
type record PDU_ML3_StopDTMF
{
  BIT6  messageType, //'110001'B;   
  BIT2  nsd
};

// 9.3.30 Stop DTMF Ack (NW->MS)
//****************************************************************************
type record PDU_ML3_StopDTMFAck
{
  BIT6  messageType, //'110010'B;   
  BIT2  nsd
};

// 9.3.31.1   User Information 
//****************************************************************************
type record PDU_ML3_UserInformation
{
  BIT6  messageType, //'010000'B;
  BIT2  nsd,
  User_user_LV          user_user,
  OCT1                  moreData optional 
};


// **************************************************************************
// *  9.3 Call Control Messages (MS->MSC)
//  * Ref:(24.008/Table 9.54 (order) and Table 10.3(messageType values) )
// **************************************************************************
type union PDU_ML3_CC_MS_NW
{
  PDU_ML3_Alerting_MS_NW           alerting_MS_NW, //Call establishment
  PDU_ML3_CallConfirmed            callConfirmed,
  PDU_ML3_Connect_MS_NW            connect_MS_NW,
  PDU_ML3_ConnectAck               connectAck,
  PDU_ML3_EmergencySetup           emergencySetup, 
  PDU_ML3_CC_EstablishmentConf     cc_EstablishmentConf, 
  PDU_ML3_StartCC                  startCC,
  PDU_ML3_Setup_MS_NW              setup_MS_NW,

  PDU_ML3_Modify                   modify,         //call information phase msg
  PDU_ML3_ModifyComplete           modifyComplete,
  PDU_ML3_ModifyReject             modifyReject,
  PDU_ML3_UserInformation          userInformation,

  PDU_ML3_Disconnect_MS_NW         disconnect_MS_NW,//call clearing
  PDU_ML3_Release_MS_NW            release_MS_NW,
  PDU_ML3_ReleaseComplete_MS_NW    releaseComplete_MS_NW,

  PDU_ML3_Facility                 facility,//for Suppl.Service contr.
  PDU_ML3_Hold                     hold,
  PDU_ML3_Retrieve                 retrieve, 

  PDU_ML3_Notify                   notify,//misc
  PDU_ML3_StartDTMF                startDTMF,
  PDU_ML3_Status                   status,
  PDU_ML3_StatusEnquiry            statusEnquiry,
  PDU_ML3_StopDTMF                 stopDTMF
} with { variant "TAG (
                alerting_MS_NW,         messageType ='000001'B;//call establish
                callConfirmed,          messageType ='001000'B;
                connect_MS_NW,          messageType ='000111'B;
                connectAck,             messageType ='001111'B;
                emergencySetup,         messageType ='001110'B;
                cc_EstablishmentConf,   messageType ='000110'B; 
                startCC,                messageType ='001001'B;          
                setup_MS_NW,            messageType ='000101'B;

                modify,                 messageType ='010111'B;//call inf.ph.msg
                modifyComplete,         messageType ='011111'B;
                modifyReject,           messageType ='010011'B;
                userInformation,        messageType ='010000'B;

                disconnect_MS_NW,       messageType ='100101'B;//call clearing
                release_MS_NW,          messageType ='101101'B;                
                releaseComplete_MS_NW,  messageType ='101010'B;
                                
                facility,               messageType ='111010'B;//messages for SS
                hold,                   messageType ='011000'B;
                retrieve,               messageType ='011100'B;                                                  

                notify,                 messageType ='111110'B; //misc    
                startDTMF,              messageType ='110101'B;
                status,                 messageType ='111101'B;
                statusEnquiry,          messageType ='110100'B;
                stopDTMF,               messageType ='110001'B;
          )" };

// ***************************************************************************
// *   9.3 Call Control Messages MSC -> MS (24.008/Table 9.54 and Table 10.3)
// ***************************************************************************
type union PDU_ML3_CC_NW_MS
{
  PDU_ML3_Alerting_NW_MS           alerting_NW_MS, //call establish
  PDU_ML3_CallConfirmed            callConfirmed,
  PDU_ML3_CallProceeding           callProceeding,
  PDU_ML3_Connect_NW_MS            connect_NW_MS,
  PDU_ML3_ConnectAck               connectAck,
  PDU_ML3_Progress                 progress,
  PDU_ML3_CC_Establishment         cc_Establishment, 
  //PDU_ML3_Recall                   recall,    
  PDU_ML3_Setup_NW_MS              setup_NW_MS,

  PDU_ML3_Modify                   modify,         //call information phase msg
  PDU_ML3_ModifyComplete           modifyComplete,
  PDU_ML3_ModifyReject             modifyReject,
  PDU_ML3_UserInformation          userInformation,

  PDU_ML3_Disconnect_NW_MS         disconnect_NW_MS,
  PDU_ML3_Release_NW_MS            release_NW_MS,
  PDU_ML3_ReleaseComplete_NW_MS    releaseComplete_NW_MS,

  PDU_ML3_Facility                 facility, //for Suppl.Service contr.
  PDU_ML3_HoldAcknowledge          holdAcknowledge,
  PDU_ML3_HoldReject               holdReject,
  PDU_ML3_RetrieveAck              retrieveAck,
  PDU_ML3_RetrieveRej              retrieveRej,

  PDU_ML3_CongestionControl        congestionControl, //misc
  PDU_ML3_Notify                   notify,
  PDU_ML3_StartDTMFAck             startDTMFAck,
  PDU_ML3_StartDTMFRej             startDTMFRej,
  PDU_ML3_Status                   status,
  PDU_ML3_StatusEnquiry            statusEnquiry,
  PDU_ML3_StopDTMFAck              stopDTMFAck
} with { variant "TAG (
                alerting_NW_MS,         messageType ='000001'B;//Call establishment
                callConfirmed,          messageType ='001000'B;
                callProceeding,         messageType ='000010'B;
                connect_NW_MS,          messageType ='000111'B;
                connectAck,             messageType ='001111'B;
                progress,               messageType ='000011'B;
                cc_Establishment,       messageType ='000100'B;
                //recall,                 messageType ='001011'B;                  
                setup_NW_MS,            messageType ='000101'B;

                modify,                 messageType ='010111'B;//call inf.ph.msg
                modifyComplete,         messageType ='011111'B;
                modifyReject,           messageType ='010011'B;
                userInformation,        messageType ='010000'B;

                disconnect_NW_MS,       messageType ='100101'B;//call clearing
                release_NW_MS,          messageType ='101101'B;             
                releaseComplete_NW_MS,  messageType ='101010'B;
                
                facility,               messageType ='111010'B;//for SS contr.
                holdAcknowledge,        messageType ='011001'B;
                holdReject,             messageType ='011010'B;
                retrieveAck,            messageType ='011101'B;
                retrieveRej,            messageType ='011110'B;
                
                congestionControl,      messageType ='111001'B;//misc
                notify,                 messageType ='111110'B;               
                startDTMFAck,           messageType ='110110'B;
                startDTMFRej,           messageType ='110111'B;
                status,                 messageType ='111101'B;
                statusEnquiry,          messageType ='110100'B;
                stopDTMFAck,            messageType ='110010'B;
              )"
};

}//end of module
with {
extension "version R2A"
encode "RAW"
}

