summaryrefslogtreecommitdiff
path: root/FS/FS/cdr/gsm_tap3_12.pm
blob: 275e7b35cf0d3b94cf245d3b680aee25a48251b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
package FS::cdr::gsm_tap3_12;
use base qw( FS::cdr );

use strict;
use vars qw( %info %TZ );
use Time::Local;
#use Data::Dumper;

#false laziness w/huawei_softx3000.pm
%TZ = (
  '+0000' => 'XXX-0',
  '+0100' => 'XXX-1',
  '+0200' => 'XXX-2',
  '+0300' => 'XXX-3',
  '+0400' => 'XXX-4',
  '+0500' => 'XXX-5',
  '+0600' => 'XXX-6',
  '+0700' => 'XXX-7',
  '+0800' => 'XXX-8',
  '+0900' => 'XXX-9',
  '+1000' => 'XXX-10',
  '+1100' => 'XXX-11',
  '+1200' => 'XXX-12',
  '-0000' => 'XXX+0',
  '-0100' => 'XXX+1',
  '-0200' => 'XXX+2',
  '-0300' => 'XXX+3',
  '-0400' => 'XXX+4',
  '-0500' => 'XXX+5',
  '-0600' => 'XXX+6',
  '-0700' => 'XXX+7',
  '-0800' => 'XXX+8',
  '-0900' => 'XXX+9',
  '-1000' => 'XXX+10',
  '-1100' => 'XXX+11',
  '-1200' => 'XXX+12',
);

%info = (
  'name'          => 'GSM TAP3 release 12',
  'weight'        => 50,
  'type'          => 'asn.1',
  'import_fields' => [],
  'asn_format'    => {
    'spec'     => _asn_spec(),
    'macro'    => 'TransferBatch', #XXX & skip the Notification ones?
    'header_buffer' => sub {
      my $TransferBatch = shift;

      my $networkInfo = $TransferBatch->{networkInfo};

      my $recEntityInfo = $networkInfo->{recEntityInfo};
      my %recEntity = map { $_->{recEntityCode} => $_->{recEntityId} } @$recEntityInfo;

      my $utcTimeOffsetInfo = $networkInfo->{utcTimeOffsetInfo};
      my %utcTimeOffset = map { $_->{utcTimeOffsetCode} => $_->{utcTimeOffset} } @$utcTimeOffsetInfo;

      { recEntity        => \%recEntity,
        utcTimeOffset    => \%utcTimeOffset,
        tapDecimalPlaces => $TransferBatch->{accountingInfo}{tapDecimalPlaces},
      };
    },
    'arrayref' => sub { shift->{'callEventDetails'}; },
    'map'      => {
      'startdate'          => sub { my($row, $buffer) = @_;
                                    my $callinfo = $row->{mobileOriginatedCall}{basicCallInformation};
                                    my $timestamp = $callinfo->{callEventStartTimeStamp};

                                    my $localTimeStamp = $timestamp->{localTimeStamp};
                                    $localTimeStamp =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/
                                      or die "unparsable timestamp: $localTimeStamp\n"; #. Dumper($callinfo);
                                    my($year, $mon, $day, $hour, $min, $sec) = ($1, $2, $3, $4, $5, $6);

                                    my $utcTimeOffsetCode = $timestamp->{utcTimeOffsetCode};
                                    my $utcTimeOffset = $buffer->{utcTimeOffset}{ $utcTimeOffsetCode };
                                    local($ENV{TZ}) = $TZ{ $utcTimeOffset };

                                    timelocal($sec, $min, $hour, $day, $mon-1, $year);
                                  },
      'duration'           => sub { shift->{mobileOriginatedCall}{basicCallInformation}{totalCallEventDuration} },
      'billsec'            => sub { shift->{mobileOriginatedCall}{basicCallInformation}{totalCallEventDuration} }, #same..
      'src'                => sub { shift->{mobileOriginatedCall}{basicCallInformation}{chargeableSubscriber}{simChargeableSubscriber}{msisdn} },
      'charged_party_imsi' => sub { shift->{mobileOriginatedCall}{basicCallInformation}{chargeableSubscriber}{simChargeableSubscriber}{imsi} },
      'dst'                => sub { shift->{mobileOriginatedCall}{basicCallInformation}{destination}{calledNumber} }, #dialledDigits?
      'carrierid'          => sub { my( $row, $buffer ) = @_;
                                    my $recEntityCode = $row->{mobileOriginatedCall}{locationInformation}{networkLocation}{recEntityCode};
                                    $buffer->{recEntity}{ $recEntityCode };
                                  },
      'userfield'          => sub { shift->{mobileOriginatedCall}{operatorSpecInformation}[0] },
      'servicecode'        => sub { shift->{mobileOriginatedCall}{basicServiceUsedList}[0]{basicService}{serviceCode}{teleServiceCode} },
      'upstream_price'     => sub { my($row, $buffer) = @_;
                                    sprintf('%.'.$buffer->{tapDecimalPlaces}.'f',
                                      $row->{mobileOriginatedCall}{basicServiceUsedList}[0]{chargeInformationList}[0]{chargeDetailList}[0]{charge}
                                      / ( 10 ** $buffer->{tapDecimalPlaces} )
                                    )
                                  },
      'calltypenum'        => sub { shift->{mobileOriginatedCall}{basicServiceUsedList}[0]{chargeInformationList}[0]{callTypeGroup}{callTypelevel1} },
      'quantity'           => sub { shift->{mobileOriginatedCall}{basicServiceUsedList}[0]{chargeInformationList}[0]{chargedUnits} },
      'quantity_able'      => sub { shift->{mobileOriginatedCall}{basicServiceUsedList}[0]{chargeInformationList}[0]{chargeableUnits} },
    },
  },
);

#accepts qsearch parameters as a hash or list of name/value pairs, but not
#old-style qsearch('cdr', { field=>'value' })

use Date::Format;
use FS::Conf;
sub tap3_12_export {
  my %qsearch = ();
  if ( ref($_[0]) eq 'HASH' ) {
    %qsearch = %{ $_[0] };
  } else {
    %qsearch = @_;
  }

  #if these get huge we might need to get a count and do a paged search
  my @cdrs = qsearch({ 'table'=>'cdr', %qsearch, 'order_by'=>'calldate ASC' });

  my $conf = new FS::Conf;

  eval "use Convert::ASN1";
  die $@ if $@;

  my $asn = Convert::ASN1->new;
  $asn->prepare( _asn_spec() ) or die $asn->error;

  my $TransferBatch = $asn->find('TransferBatch') or die $asn->error;

  my %hash = _TransferBatch(); #static information etc.

  my $now = time;
  my $utcTimeOffset = time2str('%z', $now);

  ###
  # accountingInfo
  ###

  #mandatory
  $hash{localCurrency} = $conf->config('currency') || 'USD';

  ###
  # batchControlInfo
  ###

  #optional
  $hash{batchControlInfo}->{fileCreationTimeStamp}   = { 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $now),
                                                         'utcTimeOffset'  => $utcTimeOffset,
                                                       };

  #The timestamp used to select calls for transfer.  All call records available prior to the timestamp are transferred.
  # This gives an indication to the HPMN as to how ‘up-to-date’ the information is.
  $hash{batchControlInfo}->{transferCutOffTimeStamp} = { 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $cdrs[-1]->calldate_unix ),
                                                         'utcTimeOffset'  => $utcTimeOffset,
                                                       };

  #The date and time at which the file was made available to the Recipient PMN.
  # Physically this will normally be the timestamp when the file transfer
  # commenced to the Recipient PMN, i.e. start of push, however on some systems
  # this will be the timestamp when the file was made available to be pulled.
  $hash{batchControlInfo}->{fileAvailableTimeStamp}  = { 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $now),
                                                          'utcTimeOffset'  => $utcTimeOffset,
                                                        };

  # A unique identifier used to determine the network which is the Sender of the data.
  # The full list of codes in use is given in TADIG PRD TD.13: PMN Naming Conventions.
  $hash{batchControlInfo}->{sender} = $conf->config('cdr-gsm_tap3-sender') || 'ZZZZZ'; #reserved: Y*, ZO-ZZ

  #XXX customer or agent field of some sort
  # A unique identifier used to determine which network the data is being sent to,
  #  i.e. the Recipient.
  # Derivation: GSM Association PRD TD.13: PMN Naming Conventions.
  $hash{batchControlInfo}->{recipient} = 'GNQHT';

  #XXX
  #A unique reference which identifies each TAP Data Interchange sent by one PMN to another, specific, PMN.
  # The sequence commences at 1 and is incremented by one for each subsequent TAP Data Interchange sent by the Sender PMN to a particular Recipient PMN.
  # Separate sequence numbering must be used for Test Data and Chargeable Data.  Having reached the maximum value (99999) the number must recycle to 1.
  $hash{batchControlInfo}->{fileSequenceNumber} = '00178';

  ###
  # networkInfo
  ###

  $hash{networkInfo}->{utcTimeOffsetInfo}[0]{utcTimeOffset} = $utcTimeOffset;

  #XXX recording entity IDs, referenced by recEntityCode
  #$hash->{networkInfo}->{recEntityInfo}[0]{recEntityId} = '340010100';
  #$hash->{networkInfo}->{recEntityInfo}[1]{recEntityId} = '240556000000';

  ###
  # auditControlInfo
  ###

  #mandatory
  $hash{auditControlInfo}->{callEventDetailsCount} = scalar(@cdrs);

  #these two are optional
  $hash{auditControlInfo}->{earliestCallTimeStamp} = { 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $cdrs[0]->calldate_unix),
                                                       'utcTimeOffset'  => $utcTimeOffset,
                                                     };
  $hash{auditControlInfo}->{latestCallTimeStamp}   = { 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $cdrs[-1]->calldate_unix),
                                                       'utcTimeOffset'  => $utcTimeOffset,
                                                     };

  #mandatory
  my $totalCharge = 0;
  $totalCharge += $_->rated_price foreach @cdrs;
  $hash{totalCharge} = sprintf('%.5f', $totalCharge);

  ###
  # callEventDetails
  ###

  $hash{callEventDetails} = [ map tap3_12_export_cdr($_), @cdrs ];

  ###

  $TransferBatch->encode( \%hash );

}

sub _TransferBatch {

  #accounting related information
  'accountingInfo'   => {
                          #mandatory
                          #'localCurrency'          => 'USD',
                          'tapDecimalPlaces'       => 5,
                          'currencyConversionInfo' => [
                                                        {
                                                          'numberOfDecimalPlaces' => 5,
                                                          'exchangeRate'          => 152549, #XXX ??? "exchange rate +VAT" ?
                                                          'exchangeRateCode'      => 1
                                                        }
                                                      ],
                          #optional: may conditionally include taxation and discounting tables, and, optionally, TAP currency
                        },

  'batchControlInfo' => {
                          #mandatory
                          'specificationVersionNumber' => 3,
                          'releaseVersionNumber'       => 12,

                          #'sender' => 'MDGTM',
                          #'recipient' => 'GNQHT',
                          #'fileSequenceNumber' => '00178',

                          #'transferCutOffTimeStamp' => {
                          #                               'localTimeStamp' => '20121230050222',
                          #                               'utcTimeOffset' => '+0300'
                          #                             },
                          #'fileAvailableTimeStamp' => {
                          #                              'localTimeStamp' => '20121230035052',
                          #                              'utcTimeOffset' => '+0100'
                          #                            }

                          #optional
                          #'fileCreationTimeStamp' => {
                          #                             'localTimeStamp' => '20121230050222',
                          #                             'utcTimeOffset' => '+0300'
                          #                           },

                          #optional: file type indicator which will only be present where the file represents test data
                          #optional: RAP File Sequence Number (used where the batch has previously been returned with a fatal error and is now being resubmitted) (not fileSequenceNumber?)

                          #optional: beyond the scope of TAP and has been bilaterally agreed
                          #'operatorSpecInformation' => [
                          #                               '', # '|File proc MTH LUXMA: 1285348027|' Operator Specific Information
                          #                                   # probably just leave out
                          #                             ],
     

                        },

  #Network Information is a group of related information which pertains to the Sender PMN
  'networkInfo'      => {
                          #must be present where Recording Entity Codes are present within the TAP file
                          'recEntityInfo'     => [
                                                   {
                                                     'recEntityCode' => 1,
                                                     'recEntityType' => 1, #MSC
                                                     #'recEntityId'   => '340010100',
                                                   },
                                                   {
                                                     'recEntityCode' => 2,
                                                     'recEntityType' => 2, #SMSC
                                                     #'recEntityId'   => '240556000000',
                                                   },
                                                 ],
                          #mandatory
                          'utcTimeOffsetInfo' => [
                                                   {
                                                     'utcTimeOffsetCode' => 1,
                                                     #'utcTimeOffset'     => '+0300',
                                                   }
                                                 ]
                        },

  #identifies the end of the Transfer Batch
  'auditControlInfo' => {
                          #mandatory
                          #'callEventDetailsCount' => 4,
                          'totalTaxValue'         => 0,
                          'totalDiscountValue'    => 0,
                          #'totalCharge'           => 50474,

                          #these two are optional
                          #'earliestCallTimeStamp' => {
                          #                             'localTimeStamp' => '20121229102501',
                          #                             'utcTimeOffset' => '+0300'
                          #                           },
                          #'latestCallTimeStamp'   => {
                          #                             'localTimeStamp' => '20121229102807',
                          #                             'utcTimeOffset' => '+0300'
                          #                           }
                          #optional: beyond the scope of TAP and has been bilaterally agreed
                          #'operatorSpecInformation' => [
                          #                               '',
                          #                             ],
                        },
}

sub tap3_12_export_cdr {
  my $self = shift;

  #one of Mobile Originated Call, Mobile Terminated Call, Mobile Session, Messaging Event, Supplementary Service Event, Service Centre Usage, GPRS Call, Content Transaction or Location Service
  # Each occurrence must have no more than one of these present

  { #either tele or bearer service usage originated by the mobile subscription (others?)
    'mobileOriginatedCall' => {

      #identifies the Network Location, which includes the MSC responsible for handling
      # the call and, where appropriate, the Geographical Location of the mobile
      'locationInformation' => {
                                 'networkLocation' => {
                                                        'recEntityCode' => $self->carrierid, #XXX Recording Entity (per 2.5, from "Reference Tables")
                                                      }
                               },

      #Operator Specific Information: beyond the scope of TAP and has been bilaterally agreed
      'operatorSpecInformation' => [
                                     $self->userfield, ##'|Seq: 178 Loc: 1|'
                                   ],

      #The type of service used together with all related charging information
      'basicServiceUsedList' => [
                                  {
                                    #identifies the actual Basic Service used
                                    'basicService' => {
                                                        #one of Teleservice Code or Bearer Service Code as determined by the service type used
                                                        'serviceCode' => {
                                                                           #XXX
                                                                           #00 All teleservices
                                                                           #10 All Speech transmission services
                                                                           #11 Telephony
                                                                           #12 Emergency calls
                                                                           #20 All SMS Services
                                                                           #21 Short Message MT/PP
                                                                           #22 Short Message MO/PP
                                                                           #60 All Fax Services
                                                                           #61 Facsimile Group 3 & alternative speech
                                                                           #62 Automatic Facsimile Group 3
                                                                           #63 Automatic Facsimile Group 4
                                                                           #70 All data teleservices (compound)
                                                                           #80 All teleservices except SMS (compound)
                                                                           #90 All voice group call services
                                                                           #91 Voice group call
                                                                           #92 Voice broadcast call
                                                                           'teleServiceCode' => $self->servicecode, #'11'

                                                                           #Bearer Service Code
                                                                           # Must be present within group Service Code where the type of service used
                                                                           #  was a bearer service. Must not be present when the type of service used
                                                                           #  was a tele service and, therefore, Teleservice Code is present.
                                                                           # Group Bearer Codes, identifiable by the description ‘All’, should only
                                                                           #  be used where details of the specific services affected are not
                                                                           #  available from the network.
                                                                           #00 All Bearer Services
                                                                           #20 All Data Circuit Asynchronous Services
                                                                           #21 Duplex Asynch. 300bps data circuit
                                                                           #22 Duplex Asynch. 1200bps data circuit
                                                                           #23 Duplex Asynch. 1200/75bps data circuit
                                                                           #24 Duplex Asynch. 2400bps data circuit
                                                                           #25 Duplex Asynch. 4800bps data circuit
                                                                           #26 Duplex Asynch. 9600bps data circuit
                                                                           #27 General Data Circuit Asynchronous Service
                                                                           #30 All Data Circuit Synchronous Services
                                                                           #32 Duplex Synch. 1200bps data circuit
                                                                           #34 Duplex Synch. 2400bps data circuit
                                                                           #35 Duplex Synch. 4800bps data circuit
                                                                           #36 Duplex Synch. 9600bps data circuit
                                                                           #37 General Data Circuit Synchronous Service
                                                                           #40 All Dedicated PAD Access Services
                                                                           #41 Duplex Asynch. 300bps PAD access
                                                                           #42 Duplex Asynch. 1200bps PAD access
                                                                           #43 Duplex Asynch. 1200/75bps PAD access
                                                                           #44 Duplex Asynch. 2400bps PAD access
                                                                           #45 Duplex Asynch. 4800bps PAD access
                                                                           #46 Duplex Asynch. 9600bps PAD access
                                                                           #47 General PAD Access Service
                                                                           #50 All Dedicated Packet Access Services
                                                                           #54 Duplex Synch. 2400bps PAD access
                                                                           #55 Duplex Synch. 4800bps PAD access
                                                                           #56 Duplex Synch. 9600bps PAD access
                                                                           #57 General Packet Access Service
                                                                           #60 All Alternat Speech/Asynchronous Services
                                                                           #70 All Alternate Speech/Synchronous Services
                                                                           #80 All Speech followed by Data Asynchronous Services
                                                                           #90 All Speech followed by Data Synchronous Services
                                                                           #A0 All Data Circuit Asynchronous Services (compound)
                                                                           #B0 All Data Circuit Synchronous Services (compound)
                                                                           #C0 All Asynchronous Services (compound)
                                                                         }
                                                        #conditionally also contain the following for UMTS: Transparency Indicator, Fixed Network User
                                                        # Rate, User Protocol Indicator, Guaranteed Bit Rate and Maximum Bit Rate
                                                      },

                                    #Charge information is provided for all chargeable elements except within Messaging Event and Mobile Session call events
                                    # must contain Charged Item and at least one occurrence of Charge Detail
                                    'chargeInformationList' => [
                                                                 {
                                                                   #XXX
                                                                   #mandatory
                                                                   # the charging principle applied and the unitisation of Chargeable Units.  It
                                                                   #  is not intended to identify the service used.
                                                                   #A: Call set up attempt
                                                                   #C: Content
                                                                   #D: Duration based charge
                                                                   #E: Event based charge
                                                                   #F: Fixed (one-off) charge
                                                                   #L: Calendar (for example daily usage charge)
                                                                   #V: Volume (outgoing) based charge
                                                                   #W: Volume (incoming) based charge
                                                                   #X: Volume (total volume) based charge
                                                                   #(?? fields to be used as a basis for the calculation of the correct Charge
                                                                   #  A: Chargeable Units (if present)
                                                                   #  D,V,W,X: Chargeable Units
                                                                   #  C: Depends on the content
                                                                   #  E: Not Applicable
                                                                   #  F: Not Applicable
                                                                   #  L: Call Event Start Timestamp)
                                                                   'chargedItem' => 'D',

                                                                   # the IOT used by the VPMN to price the call
                                                                   'callTypeGroup' => {

                                                                                        #The highest category call type in respect of the destination of the call
                                                                                        #0: Unknown/Not Applicable
                                                                                        #1: National
                                                                                        #2: International
                                                                                        #10: HGGSN/HP-GW
                                                                                        #11: VGGSN/VP-GW
                                                                                        #12: Other GGSN/Other P-GW
                                                                                        #100: WLAN
                                                                                        'callTypeLevel1' => $self->calltypenum,

                                                                                        #the sub category of Call Type Level 1
                                                                                        #0: Unknown/Not Applicable
                                                                                        #1: Mobile
                                                                                        #2: PSTN
                                                                                        #3: Non Geographic
                                                                                        #4: Premium Rate
                                                                                        #5: Satellite destination
                                                                                        #6: Forwarded call
                                                                                        #7: Non forwarded call
                                                                                        #10: Broadband
                                                                                        #11: Narrowband
                                                                                        #12: Conversational
                                                                                        #13: Streaming
                                                                                        #14: Interactive
                                                                                        #15: Background
                                                                                        'callTypeLevel2' => 0,

                                                                                        #the sub category of Call Type Level 2
                                                                                        'callTypeLevel3' => 0,
                                                                                      },

                                                                   #mandatory, at least one occurence must be present
                                                                   #A repeating group detailing the Charge and/or charge element
                                                                   # Note that, where a Charge has been levied, even where that Charge is zero,
                                                                   #  there must be one occurance, and only one, with a Charge Type of '00'
                                                                   'chargeDetailList' => [
                                                                                           {
                                                                                             #mandatory
                                                                                             # after discounts have been deducted but before any tax is added
                                                                                             'charge'          => $self->rated_price * 100000, #XXX numberOfDecimalPlaces 

                                                                                             #mandatory
                                                                                             # the type of charge represented
                                                                                             #00: Total charge for Charge Information (the invoiceable value)
                                                                                             #01: Airtime charge
                                                                                             #02: reserved
                                                                                             #03: Toll charge
                                                                                             #04: Directory assistance
                                                                                             #05–20: reserved
                                                                                             #21: VPMN surcharge
                                                                                             #50: Total charge for Charge Information according to the published IOT
                                                                                             #  Note that the use of value 50 is only for use by bilateral agreement, use without
                                                                                             #   bilateral agreement can be treated as per reserved values, that is ‘out of range’
                                                                                             #69–99: reserved
                                                                                             'chargeType'      => '00',

                                                                                             #conditional
                                                                                             # the number of units which are chargeable within the Charge Detail, this may not
                                                                                             # correspond to the number of rounded units charged.
                                                                                             # The item Charged Item defines what the units represent.
                                                                                             'chargeableUnits' => $self->quantity_able,

                                                                                             #optional
                                                                                             # the rounded number of units which are actually charged for
                                                                                             'chargedUnits'    => $self->quantity,
                                                                                           }
                                                                                         ],
                                                                   'exchangeRateCode' => 1, #from header
                                                                 }
                                                               ]
                                  }
                                ],

      #MO Basic Call Information provides the basic detail of who made the call and where to in respect of mobile originated traffic.
      'basicCallInformation' => {
                                  #mandatory
                                  # the identification of the chargeable subscriber.
                                  #  The group must contain either the IMSI or the MIN of the Chargeable Subscriber, but not both.
                                  'chargeableSubscriber' => {
                                                              'simChargeableSubscriber' => {
                                                                                             'msisdn' => $self->charged_party, #src
                                                                                             'imsi'   => $self->charged_party_imsi,
                                                                                           }
                                                            },
                                  # the start of the call event
                                  'callEventStartTimeStamp' => {
                                                                 'localTimeStamp' => time2str('%Y%m%d%H%M%S', $self->startdate),
                                                                 'utcTimeOffsetCode' => 1
                                                               },

                                  # the actual total duration of a call event as a number of seconds
                                  'totalCallEventDuration' => $self->duration,

                                  #conditional
                                  # the number dialled by the subscriber (Called Number)
                                  #  or the SMSC Address in case of SMS usage or in cases involving supplementary services
                                  #   such as call forwarding or transfer etc., the number to which the call is routed
                                  'destination' => {
                                                     #the international representation of the destination
                                                     'calledNumber' => $self->dst,

                                                     #the actual digits as dialled by the subscriber, i.e. unmodified, in establishing a call
                                                     # This will contain ‘+’ and ‘#’ where appropriate.
                                                     #'dialledDigits' => '322221350'
                                                   },
                                }
    }
  };

}

sub _asn_spec {
  <<'END';
--
--
-- The following ASN.1 specification defines the abstract syntax for 
--
--        Data Record Format Version 03 
--                           Release 12
--
-- The specification is structured as follows:
--   (1) structure of the Tap batch
--   (2) definition of the individual Tap ‘records’ 
--   (3) Tap data items and groups of data items used within (2)
--   (4) Common, non-Tap data types
--   (5) Tap data items for content charging
--
-- It is mainly a translation from the logical structure
-- diagrams. Where appropriate, names used within the 
-- logical structure diagrams have been shortened.
-- For repeating data items the name as used within the logical
-- structure have been extended by adding ‘list’ or ‘table’
-- (in some instances).
--


-- TAP-0312  DEFINITIONS IMPLICIT TAGS  ::= 

-- BEGIN 

--
-- Structure of a Tap batch 
--

DataInterChange ::= CHOICE 
{
    transferBatch TransferBatch, 
    notification  Notification,
...
}

-- Batch Control Information must always, both logically and physically,
-- be the first group/item within Transfer Batch – this ensures that the
-- TAP release version can be readily identified.  Any new groups/items
-- required may be inserted at any point after Batch Control Information

TransferBatch ::= [APPLICATION 1] SEQUENCE
{
    batchControlInfo       BatchControlInfo            OPTIONAL, -- *m.m.
    accountingInfo         AccountingInfo              OPTIONAL,
    networkInfo            NetworkInfo                 OPTIONAL, -- *m.m.
    messageDescriptionInfo MessageDescriptionInfoList  OPTIONAL,
    callEventDetails       CallEventDetailList         OPTIONAL, -- *m.m.
    auditControlInfo       AuditControlInfo            OPTIONAL, -- *m.m.
...
}

Notification ::= [APPLICATION 2] SEQUENCE
{
    sender                     Sender                     OPTIONAL, -- *m.m.
    recipient               	 Recipient                  OPTIONAL, -- *m.m.
    fileSequenceNumber      	 FileSequenceNumber         OPTIONAL, -- *m.m.
    rapFileSequenceNumber   	 RapFileSequenceNumber      OPTIONAL,
    fileCreationTimeStamp   	 FileCreationTimeStamp      OPTIONAL,
    fileAvailableTimeStamp  	 FileAvailableTimeStamp     OPTIONAL, -- *m.m.
    transferCutOffTimeStamp 	 TransferCutOffTimeStamp    OPTIONAL, -- *m.m.
    specificationVersionNumber SpecificationVersionNumber OPTIONAL, -- *m.m.
    releaseVersionNumber    	 ReleaseVersionNumber       OPTIONAL, -- *m.m.
    fileTypeIndicator       	 FileTypeIndicator          OPTIONAL,
    operatorSpecInformation 	 OperatorSpecInfoList       OPTIONAL,
...
}

CallEventDetailList ::=  [APPLICATION 3] SEQUENCE OF CallEventDetail

CallEventDetail ::= CHOICE
{
    mobileOriginatedCall   MobileOriginatedCall,
    mobileTerminatedCall   MobileTerminatedCall,
    supplServiceEvent      SupplServiceEvent,
    serviceCentreUsage     ServiceCentreUsage,
    gprsCall               GprsCall,
    contentTransaction     ContentTransaction,
    locationService        LocationService,
    messagingEvent         MessagingEvent,
    mobileSession          MobileSession,
...
}

--
-- Structure of the individual Tap records
--

BatchControlInfo ::= [APPLICATION 4] SEQUENCE
{
    sender                 	 Sender				OPTIONAL, -- *m.m.
    recipient              	 Recipient				OPTIONAL, -- *m.m.
    fileSequenceNumber     	 FileSequenceNumber		OPTIONAL, -- *m.m.
    fileCreationTimeStamp  	 FileCreationTimeStamp		OPTIONAL,
    transferCutOffTimeStamp 	 TransferCutOffTimeStamp	OPTIONAL, -- *m.m.
    fileAvailableTimeStamp  	 FileAvailableTimeStamp		OPTIONAL, -- *m.m.
    specificationVersionNumber SpecificationVersionNumber	OPTIONAL, -- *m.m.
    releaseVersionNumber    	 ReleaseVersionNumber		OPTIONAL, -- *m.m.
    fileTypeIndicator       	 FileTypeIndicator		OPTIONAL,
    rapFileSequenceNumber   	 RapFileSequenceNumber		OPTIONAL,
    operatorSpecInformation 	 OperatorSpecInfoList		OPTIONAL,
...
}

AccountingInfo ::= [APPLICATION 5] SEQUENCE
{
    taxation                  TaxationList           OPTIONAL,
    discounting               DiscountingList        OPTIONAL,
    localCurrency             LocalCurrency          OPTIONAL, -- *m.m.
    tapCurrency               TapCurrency            OPTIONAL,
    currencyConversionInfo    CurrencyConversionList OPTIONAL,
    tapDecimalPlaces          TapDecimalPlaces       OPTIONAL, -- *m.m.
...
}

NetworkInfo ::= [APPLICATION 6] SEQUENCE
{
    utcTimeOffsetInfo         UtcTimeOffsetInfoList OPTIONAL, -- *m.m.
    recEntityInfo             RecEntityInfoList     OPTIONAL,
...
}

MessageDescriptionInfoList ::= [APPLICATION 8] SEQUENCE OF MessageDescriptionInformation

MobileOriginatedCall ::= [APPLICATION 9] SEQUENCE
{
    basicCallInformation    MoBasicCallInformation    OPTIONAL, -- *m.m.
    locationInformation     LocationInformation       OPTIONAL, -- *m.m.
    equipmentIdentifier     ImeiOrEsn                 OPTIONAL,
    basicServiceUsedList    BasicServiceUsedList      OPTIONAL, -- *m.m.
    supplServiceCode        SupplServiceCode          OPTIONAL,
    thirdPartyInformation   ThirdPartyInformation     OPTIONAL,
    camelServiceUsed        CamelServiceUsed          OPTIONAL,
    operatorSpecInformation OperatorSpecInfoList      OPTIONAL,
...
}    

MobileTerminatedCall ::= [APPLICATION 10] SEQUENCE
{
    basicCallInformation    MtBasicCallInformation    OPTIONAL, -- *m.m.
    locationInformation     LocationInformation       OPTIONAL, -- *m.m.
    equipmentIdentifier     ImeiOrEsn                 OPTIONAL,
    basicServiceUsedList    BasicServiceUsedList      OPTIONAL, -- *m.m.
    camelServiceUsed        CamelServiceUsed          OPTIONAL,
    operatorSpecInformation OperatorSpecInfoList      OPTIONAL,
...
}    


SupplServiceEvent ::= [APPLICATION 11] SEQUENCE
{
    chargeableSubscriber      ChargeableSubscriber    OPTIONAL, -- *m.m.
    rapFileSequenceNumber     RapFileSequenceNumber   OPTIONAL,
    locationInformation       LocationInformation     OPTIONAL, -- *m.m.
    equipmentIdentifier       ImeiOrEsn               OPTIONAL,
    supplServiceUsed          SupplServiceUsed        OPTIONAL, -- *m.m.
    operatorSpecInformation   OperatorSpecInfoList    OPTIONAL,
...
}


ServiceCentreUsage ::= [APPLICATION 12] SEQUENCE
{
    basicInformation          ScuBasicInformation     OPTIONAL, -- *m.m.
    rapFileSequenceNumber     RapFileSequenceNumber   OPTIONAL,
    servingNetwork            ServingNetwork          OPTIONAL,
    recEntityCode             RecEntityCode           OPTIONAL, -- *m.m.
    chargeInformation         ChargeInformation       OPTIONAL, -- *m.m.
    scuChargeType             ScuChargeType           OPTIONAL, -- *m.m.
    scuTimeStamps             ScuTimeStamps           OPTIONAL, -- *m.m.
    operatorSpecInformation   OperatorSpecInfoList    OPTIONAL,
...
}

GprsCall ::= [APPLICATION 14] SEQUENCE
{
    gprsBasicCallInformation  GprsBasicCallInformation  OPTIONAL, -- *m.m.
    gprsLocationInformation   GprsLocationInformation   OPTIONAL, -- *m.m.
    equipmentIdentifier       ImeiOrEsn                 OPTIONAL,
    gprsServiceUsed           GprsServiceUsed           OPTIONAL, -- *m.m.
    camelServiceUsed          CamelServiceUsed          OPTIONAL,
    operatorSpecInformation   OperatorSpecInfoList      OPTIONAL,
...
}

ContentTransaction ::= [APPLICATION 17] SEQUENCE
{
 contentTransactionBasicInfo ContentTransactionBasicInfo OPTIONAL, -- *m.m.
 chargedPartyInformation     ChargedPartyInformation     OPTIONAL, -- *m.m.
 servingPartiesInformation   ServingPartiesInformation   OPTIONAL, -- *m.m.
 contentServiceUsed          ContentServiceUsedList      OPTIONAL, -- *m.m.
 operatorSpecInformation     OperatorSpecInfoList        OPTIONAL,
...
}

LocationService ::= [APPLICATION 297] SEQUENCE
{
    rapFileSequenceNumber	  RapFileSequenceNumber       OPTIONAL,
    recEntityCode			  RecEntityCode               OPTIONAL, -- *m.m.
    callReference			  CallReference               OPTIONAL,
    trackingCustomerInformation TrackingCustomerInformation OPTIONAL,
    lCSSPInformation         	  LCSSPInformation            OPTIONAL,
    trackedCustomerInformation  TrackedCustomerInformation  OPTIONAL,
    locationServiceUsage	  LocationServiceUsage        OPTIONAL, -- *m.m.
    operatorSpecInformation	  OperatorSpecInfoList        OPTIONAL,
...
}

MessagingEvent ::= [APPLICATION 433] SEQUENCE
{
    messagingEventService	MessagingEventService     OPTIONAL, -- *m.m.
    chargedParty              ChargedParty              OPTIONAL, -- *m.m.
    rapFileSequenceNumber	RapFileSequenceNumber     OPTIONAL,
    simToolkitIndicator		SimToolkitIndicator	  OPTIONAL,
    geographicalLocation	GeographicalLocation      OPTIONAL,
    eventReference            EventReference		  OPTIONAL, -- *m.m.

    recEntityCodeList  		RecEntityCodeList 	  OPTIONAL, -- *m.m.  
    networkElementList		NetworkElementList	  OPTIONAL,
    locationArea              LocationArea  		  OPTIONAL,
    cellId          		CellId    			  OPTIONAL,    
    serviceStartTimestamp	ServiceStartTimestamp	  OPTIONAL, -- *m.m.
    nonChargedParty		NonChargedParty		  OPTIONAL,
    exchangeRateCode		ExchangeRateCode		  OPTIONAL,
    callTypeGroup			CallTypeGroup		  OPTIONAL, -- *m.m.
    charge				Charge			  OPTIONAL, -- *m.m.
    taxInformationList		TaxInformationList	  OPTIONAL,
    operatorSpecInformation   OperatorSpecInfoList      OPTIONAL,
...
}

MobileSession ::= [APPLICATION 434] SEQUENCE
{
    mobileSessionService	MobileSessionService      OPTIONAL, -- *m.m.
    chargedParty              ChargedParty              OPTIONAL, -- *m.m.
    rapFileSequenceNumber	RapFileSequenceNumber     OPTIONAL,
    simToolkitIndicator		SimToolkitIndicator	  OPTIONAL,
    geographicalLocation	GeographicalLocation      OPTIONAL,
    locationArea              LocationArea  		  OPTIONAL,
    cellId          		CellId    			  OPTIONAL,
    eventReference            EventReference		  OPTIONAL, -- *m.m.

    recEntityCodeList  		RecEntityCodeList 	  OPTIONAL, -- *m.m.
    serviceStartTimestamp	ServiceStartTimestamp	  OPTIONAL, -- *m.m.
    causeForTerm              CauseForTerm	        OPTIONAL,
    totalCallEventDuration	TotalCallEventDuration	  OPTIONAL, -- *m.m.
    nonChargedParty		NonChargedParty		  OPTIONAL,
    sessionChargeInfoList     SessionChargeInfoList     OPTIONAL, -- *m.m.
    operatorSpecInformation   OperatorSpecInfoList      OPTIONAL,
...
}

AuditControlInfo ::= [APPLICATION 15] SEQUENCE
{
    earliestCallTimeStamp    	  EarliestCallTimeStamp       OPTIONAL,
    latestCallTimeStamp      	  LatestCallTimeStamp         OPTIONAL,
    totalCharge              	  TotalCharge                 OPTIONAL, -- *m.m.
    totalChargeRefund        	  TotalChargeRefund           OPTIONAL,
    totalTaxRefund           	  TotalTaxRefund              OPTIONAL,
    totalTaxValue 		  TotalTaxValue               OPTIONAL, -- *m.m.
    totalDiscountValue		  TotalDiscountValue          OPTIONAL, -- *m.m.
    totalDiscountRefund		  TotalDiscountRefund         OPTIONAL,
    totalAdvisedChargeValueList TotalAdvisedChargeValueList OPTIONAL,
    callEventDetailsCount	  CallEventDetailsCount       OPTIONAL, -- *m.m.
    operatorSpecInformation	  OperatorSpecInfoList        OPTIONAL,
...
}


-- 
-- Tap data items and groups of data items
--

AccessPointNameNI ::= [APPLICATION 261] AsciiString --(SIZE(1..63))

AccessPointNameOI ::= [APPLICATION 262] AsciiString --(SIZE(1..37))

ActualDeliveryTimeStamp ::= [APPLICATION 302] DateTime

AddressStringDigits ::= BCDString

AdvisedCharge ::= [APPLICATION 349] Charge
 
AdvisedChargeCurrency ::= [APPLICATION 348] Currency
 
AdvisedChargeInformation ::= [APPLICATION 351] SEQUENCE
{
    paidIndicator         PaidIndicator         OPTIONAL,
    paymentMethod         PaymentMethod         OPTIONAL,
    advisedChargeCurrency AdvisedChargeCurrency OPTIONAL,
    advisedCharge         AdvisedCharge         OPTIONAL, -- *m.m.
    commission            Commission            OPTIONAL,
...
}
 
AgeOfLocation ::= [APPLICATION 396] INTEGER

BasicService ::= [APPLICATION 36] SEQUENCE
{
    serviceCode                 BasicServiceCode       OPTIONAL, -- *m.m.
    transparencyIndicator       TransparencyIndicator  OPTIONAL,
    fnur                        Fnur                   OPTIONAL,
    userProtocolIndicator       UserProtocolIndicator  OPTIONAL,
    guaranteedBitRate           GuaranteedBitRate      OPTIONAL,
    maximumBitRate              MaximumBitRate         OPTIONAL,
...
}

BasicServiceCode ::= [APPLICATION 426] CHOICE 
{
    teleServiceCode      TeleServiceCode,
    bearerServiceCode    BearerServiceCode,
...
}

BasicServiceCodeList ::= [APPLICATION 37] SEQUENCE OF BasicServiceCode

BasicServiceUsed ::= [APPLICATION 39] SEQUENCE
{
    basicService                BasicService          OPTIONAL, -- *m.m.
    chargingTimeStamp           ChargingTimeStamp     OPTIONAL,
    chargeInformationList       ChargeInformationList OPTIONAL, -- *m.m.
    hSCSDIndicator              HSCSDIndicator        OPTIONAL,
...
}

BasicServiceUsedList ::= [APPLICATION 38] SEQUENCE OF BasicServiceUsed

BearerServiceCode ::= [APPLICATION 40] HexString --(SIZE(2))

EventReference ::= [APPLICATION 435]  AsciiString


CalledNumber ::= [APPLICATION 407] AddressStringDigits

CalledPlace ::= [APPLICATION 42] AsciiString

CalledRegion ::= [APPLICATION 46] AsciiString

CallEventDetailsCount ::= [APPLICATION 43] INTEGER 

CallEventStartTimeStamp ::= [APPLICATION 44] DateTime

CallingNumber ::= [APPLICATION 405] AddressStringDigits

CallOriginator ::= [APPLICATION 41]  SEQUENCE
{
    callingNumber               CallingNumber		OPTIONAL,
    clirIndicator               ClirIndicator         OPTIONAL,
    sMSOriginator               SMSOriginator         OPTIONAL,
...
}

CallReference ::= [APPLICATION 45] OCTET STRING --(SIZE(1..8))

CallTypeGroup ::= [APPLICATION 258] SEQUENCE
{
    callTypeLevel1      CallTypeLevel1           OPTIONAL, -- *m.m.
    callTypeLevel2      CallTypeLevel2           OPTIONAL, -- *m.m.
    callTypeLevel3      CallTypeLevel3           OPTIONAL, -- *m.m.
...
}

CallTypeLevel1 ::= [APPLICATION 259] INTEGER

CallTypeLevel2 ::= [APPLICATION 255] INTEGER

CallTypeLevel3 ::= [APPLICATION 256] INTEGER

CamelDestinationNumber ::= [APPLICATION 404] AddressStringDigits

CamelInvocationFee ::= [APPLICATION 422] AbsoluteAmount

CamelServiceKey ::= [APPLICATION 55] INTEGER

CamelServiceLevel ::= [APPLICATION 56] INTEGER

CamelServiceUsed ::= [APPLICATION 57] SEQUENCE
{
    camelServiceLevel         CamelServiceLevel          	OPTIONAL,
    camelServiceKey           CamelServiceKey            	OPTIONAL, -- *m.m.
    defaultCallHandling       DefaultCallHandlingIndicator	OPTIONAL,
    exchangeRateCode          ExchangeRateCode 			OPTIONAL,
    taxInformation            TaxInformationList           	OPTIONAL,
    discountInformation       DiscountInformation          	OPTIONAL,
    camelInvocationFee        CamelInvocationFee           	OPTIONAL,
    threeGcamelDestination    ThreeGcamelDestination       	OPTIONAL,
    cseInformation            CseInformation               	OPTIONAL,
...
}

CauseForTerm ::= [APPLICATION 58] INTEGER

CellId ::= [APPLICATION 59] INTEGER 

Charge ::= [APPLICATION 62] AbsoluteAmount

ChargeableSubscriber ::= [APPLICATION 427] CHOICE 
{
    simChargeableSubscriber SimChargeableSubscriber,
    minChargeableSubscriber MinChargeableSubscriber,
...
}

ChargeableUnits ::= [APPLICATION 65]  INTEGER

ChargeDetail ::= [APPLICATION 63] SEQUENCE
{
    chargeType              ChargeType         		OPTIONAL, -- *m.m.
    charge                  Charge             		OPTIONAL, -- *m.m.
    chargeableUnits         ChargeableUnits    		OPTIONAL,
    chargedUnits            ChargedUnits       		OPTIONAL,
    chargeDetailTimeStamp   ChargeDetailTimeStamp	OPTIONAL,
...
}

ChargeDetailList ::= [APPLICATION 64] SEQUENCE OF ChargeDetail

ChargeDetailTimeStamp ::= [APPLICATION 410] ChargingTimeStamp

ChargedItem ::= [APPLICATION 66]  AsciiString --(SIZE(1))

ChargedParty ::= [APPLICATION 436] SEQUENCE
{
    imsi     			Imsi 			  	OPTIONAL, -- *m.m.
    msisdn				Msisdn              	OPTIONAL,         
    publicUserId			PublicUserId	  	OPTIONAL,
    homeBid				HomeBid		  	OPTIONAL,
    homeLocationDescription	HomeLocationDescription OPTIONAL,
    imei				Imei		   		OPTIONAL,
...
}

ChargedPartyEquipment ::= [APPLICATION 323] SEQUENCE
{
    equipmentIdType EquipmentIdType OPTIONAL, -- *m.m.
    equipmentId     EquipmentId     OPTIONAL, -- *m.m.
...
}
 
ChargedPartyHomeIdentification ::= [APPLICATION 313] SEQUENCE
{
    homeIdType     HomeIdType     OPTIONAL, -- *m.m.
    homeIdentifier HomeIdentifier OPTIONAL, -- *m.m.
...
}

ChargedPartyHomeIdList ::= [APPLICATION 314] SEQUENCE OF
                                             ChargedPartyHomeIdentification

ChargedPartyIdentification ::= [APPLICATION 309] SEQUENCE
{
    chargedPartyIdType         ChargedPartyIdType         OPTIONAL, -- *m.m.
    chargedPartyIdentifier     ChargedPartyIdentifier     OPTIONAL, -- *m.m.
...
}

ChargedPartyIdentifier ::= [APPLICATION 287] AsciiString

ChargedPartyIdList ::= [APPLICATION 310] SEQUENCE OF ChargedPartyIdentification

ChargedPartyIdType ::= [APPLICATION 305] INTEGER

ChargedPartyInformation ::= [APPLICATION 324] SEQUENCE
{
    chargedPartyIdList       ChargedPartyIdList        OPTIONAL, -- *m.m.
    chargedPartyHomeIdList   ChargedPartyHomeIdList    OPTIONAL,
    chargedPartyLocationList ChargedPartyLocationList  OPTIONAL,
    chargedPartyEquipment    ChargedPartyEquipment     OPTIONAL,
...
}
 
ChargedPartyLocation ::= [APPLICATION 320] SEQUENCE
{
    locationIdType     LocationIdType     OPTIONAL, -- *m.m.
    locationIdentifier LocationIdentifier OPTIONAL, -- *m.m.
...
}
 
ChargedPartyLocationList ::= [APPLICATION 321] SEQUENCE OF ChargedPartyLocation
 
ChargedPartyStatus ::= [APPLICATION 67] INTEGER 

ChargedUnits ::= [APPLICATION 68]  INTEGER 

ChargeInformation ::= [APPLICATION 69] SEQUENCE
{
    chargedItem         ChargedItem         OPTIONAL, -- *m.m.
    exchangeRateCode    ExchangeRateCode    OPTIONAL,
    callTypeGroup       CallTypeGroup       OPTIONAL,
    chargeDetailList    ChargeDetailList    OPTIONAL, -- *m.m.
    taxInformation      TaxInformationList  OPTIONAL,
    discountInformation DiscountInformation OPTIONAL,
...
}

ChargeInformationList ::= [APPLICATION 70] SEQUENCE OF ChargeInformation

ChargeRefundIndicator ::= [APPLICATION 344] INTEGER
 
ChargeType ::= [APPLICATION 71] NumberString --(SIZE(2..3))

ChargingId ::= [APPLICATION 72] INTEGER

ChargingPoint ::= [APPLICATION 73]  AsciiString --(SIZE(1))

ChargingTimeStamp ::= [APPLICATION 74]  DateTime

ClirIndicator ::= [APPLICATION 75] INTEGER

Commission ::= [APPLICATION 350] Charge
 
CompletionTimeStamp ::= [APPLICATION 76] DateTime

ContentChargingPoint ::= [APPLICATION 345] INTEGER
 
ContentProvider ::= [APPLICATION 327] SEQUENCE
{
    contentProviderIdType     ContentProviderIdType     OPTIONAL, -- *m.m.
    contentProviderIdentifier ContentProviderIdentifier OPTIONAL, -- *m.m.
...
}
 
ContentProviderIdentifier ::= [APPLICATION 292] AsciiString

ContentProviderIdList ::= [APPLICATION 328] SEQUENCE OF ContentProvider

ContentProviderIdType ::= [APPLICATION 291] INTEGER

ContentProviderName ::= [APPLICATION 334] AsciiString
 
ContentServiceUsed ::= [APPLICATION 352] SEQUENCE
{
    contentTransactionCode       ContentTransactionCode       OPTIONAL, -- *m.m.
    contentTransactionType       ContentTransactionType       OPTIONAL, -- *m.m.
    objectType                   ObjectType                   OPTIONAL,
    transactionDescriptionSupp   TransactionDescriptionSupp   OPTIONAL,
    transactionShortDescription  TransactionShortDescription  OPTIONAL, -- *m.m.
    transactionDetailDescription TransactionDetailDescription OPTIONAL,
    transactionIdentifier   	   TransactionIdentifier        OPTIONAL, -- *m.m.
    transactionAuthCode          TransactionAuthCode          OPTIONAL,
    dataVolumeIncoming           DataVolumeIncoming           OPTIONAL,
    dataVolumeOutgoing           DataVolumeOutgoing           OPTIONAL,
    totalDataVolume              TotalDataVolume              OPTIONAL,
    chargeRefundIndicator        ChargeRefundIndicator        OPTIONAL,
    contentChargingPoint         ContentChargingPoint         OPTIONAL,
    chargeInformationList        ChargeInformationList        OPTIONAL,
    advisedChargeInformation     AdvisedChargeInformation     OPTIONAL,
...
}

ContentServiceUsedList ::= [APPLICATION 285] SEQUENCE OF ContentServiceUsed
 
ContentTransactionBasicInfo ::= [APPLICATION 304] SEQUENCE
{
    rapFileSequenceNumber      RapFileSequenceNumber      OPTIONAL,
    orderPlacedTimeStamp       OrderPlacedTimeStamp       OPTIONAL,
    requestedDeliveryTimeStamp RequestedDeliveryTimeStamp OPTIONAL,
    actualDeliveryTimeStamp    ActualDeliveryTimeStamp    OPTIONAL,
    totalTransactionDuration   TotalTransactionDuration   OPTIONAL,
    transactionStatus          TransactionStatus          OPTIONAL,
...
}

ContentTransactionCode ::= [APPLICATION 336] INTEGER
 
ContentTransactionType ::= [APPLICATION 337] INTEGER
 
CseInformation ::= [APPLICATION 79] OCTET STRING --(SIZE(1..40))

CurrencyConversion ::= [APPLICATION 106] SEQUENCE
{
    exchangeRateCode      ExchangeRateCode      OPTIONAL, -- *m.m.
    numberOfDecimalPlaces NumberOfDecimalPlaces OPTIONAL, -- *m.m.
    exchangeRate          ExchangeRate          OPTIONAL, -- *m.m.
...
}

CurrencyConversionList ::= [APPLICATION 80] SEQUENCE OF CurrencyConversion

CustomerIdentifier ::= [APPLICATION 364] AsciiString

CustomerIdType ::= [APPLICATION 363] INTEGER

DataVolume ::= INTEGER 

DataVolumeIncoming ::= [APPLICATION 250] DataVolume

DataVolumeOutgoing ::= [APPLICATION 251] DataVolume

--
--  The following datatypes are used to denote timestamps.
--  Each timestamp consists of a local timestamp and a
--  corresponding UTC time offset. 
--  Except for the timestamps used within the Batch Control 
--  Information and the Audit Control Information 
--  the UTC time offset is identified by a code referencing
--  the UtcTimeOffsetInfo.
--  
 
--
-- We start with the “short” datatype referencing the 
-- UtcTimeOffsetInfo.
-- 

DateTime ::= SEQUENCE 
{
     -- 
     -- Local timestamps are noted in the format
     --
     --     CCYYMMDDhhmmss
     --
     -- where CC  =  century  (‘19’, ‘20’,...)
     --       YY  =  year     (‘00’ – ‘99’)
     --       MM  =  month    (‘01’, ‘02’, ... , ‘12’)
     --       DD  =  day      (‘01’, ‘02’, ... , ‘31’)
     --       hh  =  hour     (‘00’, ‘01’, ... , ‘23’)
     --       mm  =  minutes  (‘00’, ‘01’, ... , ‘59’)
     --       ss  =  seconds  (‘00’, ‘01’, ... , ‘59’)
     -- 
    localTimeStamp     LocalTimeStamp    OPTIONAL, -- *m.m.
    utcTimeOffsetCode  UtcTimeOffsetCode OPTIONAL, -- *m.m.
...
}

--
-- The following version is the “long” datatype
-- containing the UTC time offset directly. 
--

DateTimeLong ::= SEQUENCE 
{
    localTimeStamp     LocalTimeStamp OPTIONAL, -- *m.m.
    utcTimeOffset      UtcTimeOffset  OPTIONAL, -- *m.m.
...
}

DefaultCallHandlingIndicator ::= [APPLICATION 87] INTEGER

DepositTimeStamp ::= [APPLICATION 88] DateTime

Destination ::= [APPLICATION 89] SEQUENCE
{
    calledNumber                CalledNumber  		OPTIONAL,
    dialledDigits               DialledDigits         OPTIONAL,
    calledPlace                 CalledPlace           OPTIONAL,
    calledRegion                CalledRegion          OPTIONAL,
    sMSDestinationNumber        SMSDestinationNumber  OPTIONAL,
...
}

DestinationNetwork ::= [APPLICATION 90] NetworkId 

DialledDigits ::= [APPLICATION 279] AsciiString

Discount ::= [APPLICATION 412] DiscountValue

DiscountableAmount ::= [APPLICATION 423] AbsoluteAmount

DiscountApplied ::= [APPLICATION 428] CHOICE 
{
    fixedDiscountValue    FixedDiscountValue, 
    discountRate          DiscountRate,
...
}

DiscountCode ::= [APPLICATION 91] INTEGER

DiscountInformation ::= [APPLICATION 96] SEQUENCE
{
    discountCode        DiscountCode		OPTIONAL, -- *m.m.
    discount            Discount      		OPTIONAL,
    discountableAmount  DiscountableAmount	OPTIONAL,
...
}

Discounting ::= [APPLICATION 94] SEQUENCE
{
    discountCode    DiscountCode    OPTIONAL, -- *m.m.
    discountApplied DiscountApplied OPTIONAL, -- *m.m.
...
}

DiscountingList ::= [APPLICATION 95]  SEQUENCE OF Discounting

DiscountRate ::= [APPLICATION 92] PercentageRate

DiscountValue ::= AbsoluteAmount

DistanceChargeBandCode ::= [APPLICATION 98] AsciiString --(SIZE(1))

EarliestCallTimeStamp ::= [APPLICATION 101] DateTimeLong

ElementId ::= [APPLICATION 437] AsciiString

ElementType ::= [APPLICATION 438] INTEGER

EquipmentId ::= [APPLICATION 290] AsciiString

EquipmentIdType ::= [APPLICATION 322] INTEGER

Esn ::= [APPLICATION 103] NumberString

ExchangeRate ::= [APPLICATION 104] INTEGER

ExchangeRateCode ::= [APPLICATION 105] Code

FileAvailableTimeStamp ::= [APPLICATION 107] DateTimeLong

FileCreationTimeStamp ::= [APPLICATION 108] DateTimeLong

FileSequenceNumber ::= [APPLICATION 109] NumberString --(SIZE(5))

FileTypeIndicator ::= [APPLICATION 110] AsciiString --(SIZE(1))

FixedDiscountValue ::= [APPLICATION 411] DiscountValue

Fnur ::= [APPLICATION 111] INTEGER

GeographicalLocation ::= [APPLICATION 113]  SEQUENCE
{
    servingNetwork              ServingNetwork       		OPTIONAL,
    servingBid                  ServingBid           		OPTIONAL,
    servingLocationDescription  ServingLocationDescription  OPTIONAL,
...
}

GprsBasicCallInformation ::= [APPLICATION 114] SEQUENCE
{
    gprsChargeableSubscriber    GprsChargeableSubscriber OPTIONAL, -- *m.m.
    rapFileSequenceNumber       RapFileSequenceNumber    OPTIONAL,
    gprsDestination             GprsDestination          OPTIONAL, -- *m.m.
    callEventStartTimeStamp     CallEventStartTimeStamp  OPTIONAL, -- *m.m.
    totalCallEventDuration      TotalCallEventDuration   OPTIONAL, -- *m.m.
    causeForTerm                CauseForTerm             OPTIONAL,
    partialTypeIndicator        PartialTypeIndicator     OPTIONAL,
    pDPContextStartTimestamp    PDPContextStartTimestamp OPTIONAL,
    networkInitPDPContext       NetworkInitPDPContext    OPTIONAL,
    chargingId                  ChargingId               OPTIONAL, -- *m.m.
...
}

GprsChargeableSubscriber ::= [APPLICATION 115] SEQUENCE
{
    chargeableSubscriber        ChargeableSubscriber    OPTIONAL,
    pdpAddress                  PdpAddress              OPTIONAL,
    networkAccessIdentifier     NetworkAccessIdentifier OPTIONAL,
...
}

GprsDestination ::= [APPLICATION 116] SEQUENCE
{
    accessPointNameNI           AccessPointNameNI      OPTIONAL, -- *m.m.
    accessPointNameOI           AccessPointNameOI      OPTIONAL,
...
}

GprsLocationInformation ::= [APPLICATION 117] SEQUENCE
{
    gprsNetworkLocation         GprsNetworkLocation     OPTIONAL, -- *m.m.
    homeLocationInformation     HomeLocationInformation OPTIONAL,
    geographicalLocation        GeographicalLocation    OPTIONAL, 
...
} 

GprsNetworkLocation ::= [APPLICATION 118] SEQUENCE
{
    recEntity                   RecEntityCodeList OPTIONAL, -- *m.m.
    locationArea                LocationArea      OPTIONAL,
    cellId                      CellId            OPTIONAL,
...
}

GprsServiceUsed ::= [APPLICATION 121]  SEQUENCE
{
    iMSSignallingContext        IMSSignallingContext  OPTIONAL,
    dataVolumeIncoming          DataVolumeIncoming    OPTIONAL, -- *m.m.
    dataVolumeOutgoing          DataVolumeOutgoing    OPTIONAL, -- *m.m.
    chargeInformationList       ChargeInformationList OPTIONAL, -- *m.m.
...
}

GsmChargeableSubscriber ::= [APPLICATION 286] SEQUENCE
{
    imsi     Imsi   OPTIONAL,
    msisdn   Msisdn OPTIONAL,
...
}

GuaranteedBitRate ::= [APPLICATION 420] OCTET STRING --(SIZE (1))

HomeBid ::= [APPLICATION 122]  Bid

HomeIdentifier ::= [APPLICATION 288] AsciiString

HomeIdType ::= [APPLICATION 311] INTEGER

HomeLocationDescription ::= [APPLICATION 413] LocationDescription

HomeLocationInformation ::= [APPLICATION 123] SEQUENCE
{
    homeBid                     HomeBid             		OPTIONAL, -- *m.m.
    homeLocationDescription     HomeLocationDescription	OPTIONAL, -- *m.m.
...
}

HorizontalAccuracyDelivered ::= [APPLICATION 392] INTEGER

HorizontalAccuracyRequested ::= [APPLICATION 385] INTEGER

HSCSDIndicator ::= [APPLICATION 424] AsciiString --(SIZE(1))

Imei ::= [APPLICATION 128] BCDString --(SIZE(7..8))

ImeiOrEsn ::= [APPLICATION 429] CHOICE 
{
    imei  Imei,
    esn   Esn,
...
} 

Imsi ::= [APPLICATION 129] BCDString --(SIZE(3..8))

IMSSignallingContext ::= [APPLICATION 418] INTEGER

InternetServiceProvider ::= [APPLICATION 329] SEQUENCE
{
    ispIdType        IspIdType        OPTIONAL, -- *m.m.
    ispIdentifier    IspIdentifier    OPTIONAL, -- *m.m.
...
}
 
InternetServiceProviderIdList ::= [APPLICATION 330] SEQUENCE OF InternetServiceProvider

IspIdentifier ::= [APPLICATION 294] AsciiString
 
IspIdType ::= [APPLICATION 293] INTEGER

ISPList ::= [APPLICATION 378] SEQUENCE OF InternetServiceProvider

NetworkIdType ::= [APPLICATION 331] INTEGER

NetworkIdentifier ::= [APPLICATION 295] AsciiString

Network ::= [APPLICATION 332] SEQUENCE
{
    networkIdType     NetworkIdType     OPTIONAL, -- *m.m.
    networkIdentifier NetworkIdentifier OPTIONAL, -- *m.m.
...
}
 
NetworkList ::= [APPLICATION 333] SEQUENCE OF Network
 
LatestCallTimeStamp ::= [APPLICATION 133] DateTimeLong

LCSQosDelivered ::= [APPLICATION 390] SEQUENCE
{
    lCSTransactionStatus          LCSTransactionStatus        OPTIONAL,
    horizontalAccuracyDelivered   HorizontalAccuracyDelivered OPTIONAL,
    verticalAccuracyDelivered     VerticalAccuracyDelivered   OPTIONAL,
    responseTime                  ResponseTime                OPTIONAL,
    positioningMethod             PositioningMethod           OPTIONAL,
    trackingPeriod                TrackingPeriod              OPTIONAL,
    trackingFrequency             TrackingFrequency           OPTIONAL,
    ageOfLocation                 AgeOfLocation               OPTIONAL,
...
}

LCSQosRequested ::= [APPLICATION 383] SEQUENCE
{
    lCSRequestTimestamp           LCSRequestTimestamp         OPTIONAL, -- *m.m.
    horizontalAccuracyRequested   HorizontalAccuracyRequested OPTIONAL,
    verticalAccuracyRequested     VerticalAccuracyRequested   OPTIONAL,
    responseTimeCategory          ResponseTimeCategory        OPTIONAL,
    trackingPeriod                TrackingPeriod              OPTIONAL,
    trackingFrequency             TrackingFrequency           OPTIONAL,
...
}

LCSRequestTimestamp ::= [APPLICATION 384] DateTime

LCSSPIdentification ::= [APPLICATION 375] SEQUENCE
{
 contentProviderIdType         ContentProviderIdType     OPTIONAL, -- *m.m.
 contentProviderIdentifier     ContentProviderIdentifier OPTIONAL, -- *m.m.
...
}

LCSSPIdentificationList ::= [APPLICATION 374] SEQUENCE OF LCSSPIdentification

LCSSPInformation ::= [APPLICATION 373] SEQUENCE
{
    lCSSPIdentificationList       LCSSPIdentificationList OPTIONAL, -- *m.m.
    iSPList                       ISPList                 OPTIONAL,
    networkList                   NetworkList             OPTIONAL,
...
}

LCSTransactionStatus ::= [APPLICATION 391] INTEGER

LocalCurrency ::= [APPLICATION 135] Currency

LocalTimeStamp ::= [APPLICATION 16] NumberString --(SIZE(14))

LocationArea ::= [APPLICATION 136] INTEGER 

LocationDescription ::= AsciiString

LocationIdentifier ::= [APPLICATION 289] AsciiString

LocationIdType ::= [APPLICATION 315] INTEGER

LocationInformation ::= [APPLICATION 138]  SEQUENCE
{
    networkLocation             NetworkLocation         OPTIONAL, -- *m.m.
    homeLocationInformation     HomeLocationInformation OPTIONAL,
    geographicalLocation        GeographicalLocation    OPTIONAL,
...
} 

LocationServiceUsage ::= [APPLICATION 382] SEQUENCE
{
    lCSQosRequested               LCSQosRequested       OPTIONAL, -- *m.m.
    lCSQosDelivered               LCSQosDelivered       OPTIONAL,
    chargingTimeStamp             ChargingTimeStamp     OPTIONAL,
    chargeInformationList         ChargeInformationList OPTIONAL, -- *m.m.
...
}

MaximumBitRate ::= [APPLICATION 421] OCTET STRING --(SIZE (1))

Mdn ::= [APPLICATION 253] NumberString

MessageDescription ::= [APPLICATION 142] AsciiString

MessageDescriptionCode ::= [APPLICATION 141] Code

MessageDescriptionInformation ::= [APPLICATION 143] SEQUENCE
{
    messageDescriptionCode MessageDescriptionCode OPTIONAL, -- *m.m.
    messageDescription     MessageDescription     OPTIONAL, -- *m.m.
...
}

MessageStatus ::= [APPLICATION 144] INTEGER

MessageType ::= [APPLICATION 145] INTEGER

MessagingEventService ::= [APPLICATION 439] INTEGER

Min ::= [APPLICATION 146] NumberString --(SIZE(2..15)) 

MinChargeableSubscriber ::= [APPLICATION 254] SEQUENCE
{
    min     Min    OPTIONAL, -- *m.m.
    mdn     Mdn    OPTIONAL,
...
}

MoBasicCallInformation ::= [APPLICATION 147] SEQUENCE
{
    chargeableSubscriber        ChargeableSubscriber    OPTIONAL, -- *m.m.
    rapFileSequenceNumber       RapFileSequenceNumber   OPTIONAL,
    destination                 Destination             OPTIONAL,
    destinationNetwork          DestinationNetwork      OPTIONAL,
    callEventStartTimeStamp     CallEventStartTimeStamp OPTIONAL, -- *m.m.
    totalCallEventDuration      TotalCallEventDuration  OPTIONAL, -- *m.m.
    simToolkitIndicator         SimToolkitIndicator     OPTIONAL,
    causeForTerm                CauseForTerm            OPTIONAL,
...
}

MobileSessionService ::= [APPLICATION 440] INTEGER      

Msisdn ::= [APPLICATION 152] BCDString --(SIZE(1..9))

MtBasicCallInformation ::= [APPLICATION 153] SEQUENCE
{
    chargeableSubscriber        ChargeableSubscriber    OPTIONAL, -- *m.m.
    rapFileSequenceNumber       RapFileSequenceNumber   OPTIONAL,
    callOriginator              CallOriginator          OPTIONAL,
    originatingNetwork          OriginatingNetwork      OPTIONAL,
    callEventStartTimeStamp     CallEventStartTimeStamp OPTIONAL, -- *m.m.
    totalCallEventDuration      TotalCallEventDuration  OPTIONAL, -- *m.m.
    simToolkitIndicator         SimToolkitIndicator     OPTIONAL,
    causeForTerm                CauseForTerm            OPTIONAL,
...
}

NetworkAccessIdentifier ::= [APPLICATION 417] AsciiString

NetworkElement ::= [APPLICATION 441]  SEQUENCE
{
elementType             ElementType  OPTIONAL, -- *m.m.
elementId               ElementId    OPTIONAL, -- *m.m.
...
}

NetworkElementList ::= [APPLICATION 442] SEQUENCE OF NetworkElement

NetworkId ::= AsciiString --(SIZE(1..6))

NetworkInitPDPContext ::= [APPLICATION 245] INTEGER

NetworkLocation ::= [APPLICATION 156]  SEQUENCE
{
    recEntityCode               RecEntityCode OPTIONAL, -- *m.m.
    callReference               CallReference OPTIONAL,
    locationArea                LocationArea  OPTIONAL,
    cellId                      CellId        OPTIONAL,
...
}

NonChargedNumber ::= [APPLICATION 402] AsciiString

NonChargedParty ::= [APPLICATION 443]  SEQUENCE
{
    nonChargedPartyNumber       NonChargedPartyNumber	 OPTIONAL,
    nonChargedPublicUserId      NonChargedPublicUserId OPTIONAL,
...
}

NonChargedPartyNumber ::= [APPLICATION 444] AddressStringDigits

NonChargedPublicUserId ::= [APPLICATION 445] AsciiString 

NumberOfDecimalPlaces ::= [APPLICATION 159] INTEGER

ObjectType ::= [APPLICATION 281] INTEGER

OperatorSpecInfoList ::= [APPLICATION 162] SEQUENCE OF OperatorSpecInformation

OperatorSpecInformation ::= [APPLICATION 163] AsciiString

OrderPlacedTimeStamp ::= [APPLICATION 300] DateTime

OriginatingNetwork ::= [APPLICATION 164] NetworkId 

PacketDataProtocolAddress ::= [APPLICATION 165] AsciiString 

PaidIndicator ::= [APPLICATION 346] INTEGER
 
PartialTypeIndicator ::=  [APPLICATION 166] AsciiString --(SIZE(1))

PaymentMethod ::= [APPLICATION 347] INTEGER

PdpAddress ::= [APPLICATION 167] PacketDataProtocolAddress

PDPContextStartTimestamp ::= [APPLICATION 260] DateTime

PlmnId ::= [APPLICATION 169] AsciiString --(SIZE(5))

PositioningMethod ::= [APPLICATION 395] INTEGER

PriorityCode ::= [APPLICATION 170] INTEGER

PublicUserId ::= [APPLICATION 446] AsciiString 

RapFileSequenceNumber ::= [APPLICATION 181]  FileSequenceNumber

RecEntityCode ::= [APPLICATION 184] Code

RecEntityCodeList ::= [APPLICATION 185] SEQUENCE OF RecEntityCode

RecEntityId ::= [APPLICATION 400] AsciiString

RecEntityInfoList ::= [APPLICATION 188] SEQUENCE OF RecEntityInformation

RecEntityInformation ::= [APPLICATION 183] SEQUENCE
{
    recEntityCode  RecEntityCode OPTIONAL, -- *m.m.
    recEntityType  RecEntityType OPTIONAL, -- *m.m.
    recEntityId    RecEntityId   OPTIONAL, -- *m.m.
...
}
 
RecEntityType ::= [APPLICATION 186] INTEGER

Recipient ::= [APPLICATION 182]  PlmnId

ReleaseVersionNumber ::= [APPLICATION 189] INTEGER

RequestedDeliveryTimeStamp ::= [APPLICATION 301] DateTime

ResponseTime ::= [APPLICATION 394] INTEGER

ResponseTimeCategory ::= [APPLICATION 387] INTEGER

ScuBasicInformation ::= [APPLICATION 191] SEQUENCE
{
    chargeableSubscriber      ScuChargeableSubscriber    OPTIONAL, -- *m.m.
    chargedPartyStatus        ChargedPartyStatus         OPTIONAL, -- *m.m.
    nonChargedNumber          NonChargedNumber           OPTIONAL, -- *m.m.
    clirIndicator             ClirIndicator              OPTIONAL,
    originatingNetwork        OriginatingNetwork         OPTIONAL,
    destinationNetwork        DestinationNetwork         OPTIONAL,
...
}

ScuChargeType ::= [APPLICATION 192]  SEQUENCE
{
    messageStatus               MessageStatus          OPTIONAL, -- *m.m.
    priorityCode                PriorityCode           OPTIONAL, -- *m.m.
    distanceChargeBandCode      DistanceChargeBandCode OPTIONAL,
    messageType                 MessageType            OPTIONAL, -- *m.m.
    messageDescriptionCode      MessageDescriptionCode OPTIONAL, -- *m.m.
...
}

ScuTimeStamps ::= [APPLICATION 193]  SEQUENCE
{
    depositTimeStamp            DepositTimeStamp    OPTIONAL, -- *m.m.
    completionTimeStamp         CompletionTimeStamp OPTIONAL, -- *m.m.
    chargingPoint               ChargingPoint       OPTIONAL, -- *m.m.
...
}

ScuChargeableSubscriber ::= [APPLICATION 430] CHOICE 
{
    gsmChargeableSubscriber    GsmChargeableSubscriber,
    minChargeableSubscriber    MinChargeableSubscriber,
...
}

Sender ::= [APPLICATION 196]  PlmnId

ServiceStartTimestamp ::= [APPLICATION 447] DateTime

ServingBid ::= [APPLICATION 198]  Bid

ServingLocationDescription ::= [APPLICATION 414] LocationDescription

ServingNetwork ::= [APPLICATION 195]  AsciiString

ServingPartiesInformation ::= [APPLICATION 335] SEQUENCE
{
  contentProviderName           ContentProviderName           OPTIONAL, -- *m.m.
  contentProviderIdList         ContentProviderIdList         OPTIONAL,
  internetServiceProviderIdList InternetServiceProviderIdList OPTIONAL,
  networkList                   NetworkList                   OPTIONAL,
...
}

SessionChargeInfoList ::= [APPLICATION 448] SEQUENCE OF SessionChargeInformation

SessionChargeInformation ::= [APPLICATION 449] SEQUENCE
{
chargedItem			ChargedItem 		 OPTIONAL, -- *m.m.    
exchangeRateCode		ExchangeRateCode         OPTIONAL,
    	callTypeGroup		CallTypeGroup		 OPTIONAL, -- *m.m.
    	chargeDetailList        ChargeDetailList         OPTIONAL, -- *m.m.
    	taxInformationList	TaxInformationList	 OPTIONAL,
...
}         
 
SimChargeableSubscriber ::= [APPLICATION 199] SEQUENCE
{
    imsi     Imsi   OPTIONAL, -- *m.m.
    msisdn   Msisdn OPTIONAL,
...
}

SimToolkitIndicator ::= [APPLICATION 200] AsciiString --(SIZE(1)) 

SMSDestinationNumber ::= [APPLICATION 419] AsciiString

SMSOriginator ::= [APPLICATION 425] AsciiString

SpecificationVersionNumber  ::= [APPLICATION 201] INTEGER

SsParameters ::= [APPLICATION 204] AsciiString --(SIZE(1..40))

SupplServiceActionCode ::= [APPLICATION 208] INTEGER

SupplServiceCode ::= [APPLICATION 209] HexString --(SIZE(2))

SupplServiceUsed ::= [APPLICATION 206] SEQUENCE
{
    supplServiceCode       SupplServiceCode       OPTIONAL, -- *m.m.
    supplServiceActionCode SupplServiceActionCode OPTIONAL, -- *m.m.
    ssParameters           SsParameters           OPTIONAL,
    chargingTimeStamp      ChargingTimeStamp      OPTIONAL,
    chargeInformation      ChargeInformation      OPTIONAL,
    basicServiceCodeList   BasicServiceCodeList   OPTIONAL,
...
}

TapCurrency ::= [APPLICATION 210] Currency

TapDecimalPlaces ::= [APPLICATION 244] INTEGER

TaxableAmount ::= [APPLICATION 398] AbsoluteAmount

Taxation ::= [APPLICATION 216] SEQUENCE
{
    taxCode      TaxCode      OPTIONAL, -- *m.m.
    taxType      TaxType      OPTIONAL, -- *m.m.
    taxRate      TaxRate      OPTIONAL,
    chargeType   ChargeType   OPTIONAL,
    taxIndicator TaxIndicator OPTIONAL,
...
}

TaxationList ::= [APPLICATION 211]  SEQUENCE OF Taxation

TaxCode ::= [APPLICATION 212] INTEGER

TaxIndicator ::= [APPLICATION 432] AsciiString --(SIZE(1))

TaxInformation ::= [APPLICATION 213] SEQUENCE
{
    taxCode          TaxCode       OPTIONAL, -- *m.m.
    taxValue         TaxValue      OPTIONAL, -- *m.m.
    taxableAmount    TaxableAmount OPTIONAL,
...
}

TaxInformationList ::= [APPLICATION 214]  SEQUENCE OF TaxInformation

-- The TaxRate item is of a fixed length to ensure that the full 5 
-- decimal places is provided.

TaxRate ::= [APPLICATION 215] NumberString --(SIZE(7))

TaxType ::= [APPLICATION 217] AsciiString --(SIZE(2))

TaxValue ::= [APPLICATION 397] AbsoluteAmount

TeleServiceCode ::= [APPLICATION 218] HexString --(SIZE(2))

ThirdPartyInformation ::= [APPLICATION 219]  SEQUENCE
{
    thirdPartyNumber            ThirdPartyNumber 	OPTIONAL,
    clirIndicator               ClirIndicator         OPTIONAL,
...
}

ThirdPartyNumber ::= [APPLICATION 403] AddressStringDigits

ThreeGcamelDestination ::= [APPLICATION 431] CHOICE
{
    camelDestinationNumber    CamelDestinationNumber,
    gprsDestination           GprsDestination,
...
}

TotalAdvisedCharge ::= [APPLICATION 356] AbsoluteAmount
 
TotalAdvisedChargeRefund ::= [APPLICATION 357] AbsoluteAmount
 
TotalAdvisedChargeValue ::= [APPLICATION 360] SEQUENCE
{
    advisedChargeCurrency    AdvisedChargeCurrency    OPTIONAL,
    totalAdvisedCharge       TotalAdvisedCharge       OPTIONAL, -- *m.m.
    totalAdvisedChargeRefund TotalAdvisedChargeRefund OPTIONAL,
    totalCommission          TotalCommission          OPTIONAL,
    totalCommissionRefund    TotalCommissionRefund    OPTIONAL,
...
}
 
TotalAdvisedChargeValueList ::= [APPLICATION 361] SEQUENCE OF TotalAdvisedChargeValue

TotalCallEventDuration ::= [APPLICATION 223] INTEGER 

TotalCharge ::= [APPLICATION 415] AbsoluteAmount

TotalChargeRefund ::= [APPLICATION 355] AbsoluteAmount
 
TotalCommission ::= [APPLICATION 358] AbsoluteAmount
 
TotalCommissionRefund ::= [APPLICATION 359] AbsoluteAmount
 
TotalDataVolume ::= [APPLICATION 343] DataVolume
 
TotalDiscountRefund ::= [APPLICATION 354] AbsoluteAmount
 
TotalDiscountValue ::= [APPLICATION 225] AbsoluteAmount

TotalTaxRefund ::= [APPLICATION 353] AbsoluteAmount
 
TotalTaxValue ::= [APPLICATION 226] AbsoluteAmount

TotalTransactionDuration ::= [APPLICATION 416] TotalCallEventDuration

TrackedCustomerEquipment ::= [APPLICATION 381] SEQUENCE
{
    equipmentIdType               EquipmentIdType OPTIONAL, -- *m.m.
    equipmentId                   EquipmentId     OPTIONAL, -- *m.m.
...
}

TrackedCustomerHomeId ::= [APPLICATION 377] SEQUENCE
{
    homeIdType                    HomeIdType     OPTIONAL, -- *m.m.
    homeIdentifier                HomeIdentifier OPTIONAL, -- *m.m.
...
}

TrackedCustomerHomeIdList ::= [APPLICATION 376] SEQUENCE OF TrackedCustomerHomeId

TrackedCustomerIdentification ::= [APPLICATION 372] SEQUENCE
{
    customerIdType                CustomerIdType     OPTIONAL, -- *m.m.
    customerIdentifier            CustomerIdentifier OPTIONAL, -- *m.m.
...
}

TrackedCustomerIdList ::= [APPLICATION 370] SEQUENCE OF TrackedCustomerIdentification

TrackedCustomerInformation ::= [APPLICATION 367] SEQUENCE
{
    trackedCustomerIdList         TrackedCustomerIdList     OPTIONAL, -- *m.m.
    trackedCustomerHomeIdList     TrackedCustomerHomeIdList OPTIONAL,
    trackedCustomerLocList        TrackedCustomerLocList    OPTIONAL,
    trackedCustomerEquipment      TrackedCustomerEquipment  OPTIONAL,
...
}

TrackedCustomerLocation ::= [APPLICATION 380] SEQUENCE
{
    locationIdType                LocationIdType     OPTIONAL, -- *m.m.
    locationIdentifier            LocationIdentifier OPTIONAL, -- *m.m.
...
}

TrackedCustomerLocList ::= [APPLICATION 379] SEQUENCE OF TrackedCustomerLocation

TrackingCustomerEquipment ::= [APPLICATION 371] SEQUENCE
{
    equipmentIdType               EquipmentIdType OPTIONAL, -- *m.m.
    equipmentId                   EquipmentId     OPTIONAL, -- *m.m.
...
}

TrackingCustomerHomeId ::= [APPLICATION 366] SEQUENCE
{
    homeIdType                    HomeIdType     OPTIONAL, -- *m.m.
    homeIdentifier                HomeIdentifier OPTIONAL, -- *m.m.
...
}

TrackingCustomerHomeIdList ::= [APPLICATION 365] SEQUENCE OF TrackingCustomerHomeId

TrackingCustomerIdentification ::= [APPLICATION 362] SEQUENCE
{
    customerIdType                CustomerIdType     OPTIONAL, -- *m.m.
    customerIdentifier            CustomerIdentifier OPTIONAL, -- *m.m.
...
}

TrackingCustomerIdList ::= [APPLICATION 299] SEQUENCE OF TrackingCustomerIdentification

TrackingCustomerInformation ::= [APPLICATION 298] SEQUENCE
{
    trackingCustomerIdList        TrackingCustomerIdList     OPTIONAL, -- *m.m.
    trackingCustomerHomeIdList    TrackingCustomerHomeIdList OPTIONAL,
    trackingCustomerLocList       TrackingCustomerLocList    OPTIONAL,
    trackingCustomerEquipment     TrackingCustomerEquipment  OPTIONAL,
...
}

TrackingCustomerLocation ::= [APPLICATION 369] SEQUENCE
{
    locationIdType                LocationIdType     OPTIONAL, -- *m.m.
    locationIdentifier            LocationIdentifier OPTIONAL, -- *m.m.
...
}

TrackingCustomerLocList ::= [APPLICATION 368] SEQUENCE OF TrackingCustomerLocation

TrackingFrequency ::= [APPLICATION 389] INTEGER

TrackingPeriod ::= [APPLICATION 388] INTEGER

TransactionAuthCode ::= [APPLICATION 342] AsciiString
 
TransactionDescriptionSupp ::= [APPLICATION 338] INTEGER
 
TransactionDetailDescription ::= [APPLICATION 339] AsciiString

TransactionIdentifier ::= [APPLICATION 341] AsciiString
 
TransactionShortDescription ::= [APPLICATION 340] AsciiString
 
TransactionStatus ::= [APPLICATION 303] INTEGER

TransferCutOffTimeStamp ::= [APPLICATION 227] DateTimeLong

TransparencyIndicator ::= [APPLICATION 228] INTEGER

UserProtocolIndicator ::= [APPLICATION 280] INTEGER

UtcTimeOffset ::= [APPLICATION 231] AsciiString --(SIZE(5))

UtcTimeOffsetCode ::= [APPLICATION 232] Code

UtcTimeOffsetInfo ::= [APPLICATION 233] SEQUENCE
{
    utcTimeOffsetCode   UtcTimeOffsetCode OPTIONAL, -- *m.m.
    utcTimeOffset       UtcTimeOffset     OPTIONAL, -- *m.m.
...
}

UtcTimeOffsetInfoList ::= [APPLICATION 234]  SEQUENCE OF UtcTimeOffsetInfo

VerticalAccuracyDelivered ::= [APPLICATION 393] INTEGER

VerticalAccuracyRequested ::= [APPLICATION 386] INTEGER


--
-- Tagged common data types
--

--
-- The AbsoluteAmount data type is used to 
-- encode absolute revenue amounts.
-- The accuracy of all absolute amount values is defined
-- by the value of TapDecimalPlaces within the group
-- AccountingInfo for the entire TAP batch.
-- Note, that only amounts greater than or equal to zero are allowed.
-- The decimal number representing the amount is 
-- derived from the encoded integer 
-- value by division by 10^TapDecimalPlaces.
-- for example for TapDecimalPlaces = 3 the following values
-- will be derived:
--       0   represents    0.000
--      12   represents    0.012
--    1234   represents    1.234
-- for TapDecimalPlaces = 5 the following values will be
-- derived:
--       0   represents    0.00000
--    1234   represents    0.01234
--  123456   represents    1.23456
-- This data type is used to encode (total) 
-- charges, (total) discount values and 
-- (total) tax values. 
-- 
AbsoluteAmount ::= INTEGER 

Bid ::=  AsciiString --(SIZE(5))

Code ::= INTEGER

--
-- Non-tagged common data types
--
--
-- Recommended common data types to be used for file encoding:
--
-- The following definitions should be used for TAP file creation instead of
-- the default specifications (OCTET STRING)
--
--    AsciiString ::= VisibleString
--
--    Currency ::= VisibleString
--
--    HexString ::= VisibleString
--
--    NumberString ::= NumericString
--
--    AsciiString contains visible ISO 646 characters.
--    Leading and trailing spaces must be discarded during processing.
--    An AsciiString cannot contain only spaces.

AsciiString ::= OCTET STRING

--
-- The BCDString data type (Binary Coded Decimal String) is used to represent
-- several digits from 0 through 9, a, b, c, d, e.
-- Two digits are encoded per octet.  The four leftmost bits of the octet represent
-- the first digit while the four remaining bits represent the following digit.  
-- A single f must be used as a filler when the total number of digits to be 
-- encoded is odd.
-- No other filler is allowed.

BCDString ::= OCTET STRING


--
-- The currency codes from ISO 4217
-- are used to identify a currency 
--
Currency ::= OCTET STRING

--
-- HexString contains ISO 646 characters from 0 through 9, A, B, C, D, E, F.
--

HexString ::= OCTET STRING

--
-- NumberString contains ISO 646 characters from 0 through 9.
--

NumberString ::= OCTET STRING


--
-- The PercentageRate data type is used to
-- encode percentage rates with an accuracy of 2 decimal places. 
-- This data type is used to encode discount rates.
-- The decimal number representing the percentage
-- rate is obtained by dividing the integer value by 100
-- Examples:
--
--     1500  represents  15.00 percent
--     1     represents   0.01 percent
--
PercentageRate ::= INTEGER 


-- END
END
}

1;