-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
1114 lines (1005 loc) · 87.1 KB
/
main.js
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
import { sleep } from 'k6';
import { SharedArray } from 'k6/data';
import diam from 'k6/x/diameter';
import http from 'k6/http';
import avp from 'k6/x/diameter/avp';
import { cfg } from './configs/config.js';
import { cmd, app, vendor, flag, code, userData } from './common/data.js';
const diamType = diam.DataType();
const client = diam.Client({
// Timeout for each request
requestTimeout: "100ms",
// Flag to enable automatic DWR (Diameter Watchdog Request)
enableWatchdog: false,
// List of authentication application IDs
authApplicationId: [4],
// List of vendor-specific application IDs
vendorSpecificApplicationId: [
{
authApplicationId: 4,
vendorId: 10415,
}
],
capabilityExchange: {
vendorId: 35838,
OriginHost: "epc.mnc020.mcc418.3gppnetwork.org",
},
});
export const options = {
// A boolean specifying whether k6 should reuse TCP connections
noVUConnectionReuse: true,
// A boolean specifying whether k6 should ignore TLS verifications for connections established from code
insecureSkipTLSVerify: true,
// A boolean specifying whether k6 should disable keep-alive connections
noConnectionReuse: true,
// Configure DNS resolution behavior
dns: {
ttl: '5m',
select: 'first',
policy: 'onlyIPv4',
},
// Specify whether response bodies should be discarded
discardResponseBodies: false,
// Specify which System Tags will be in the collected metrics
systemTags: ['error', 'error_code', 'scenario', 'vu', 'iter'],
// Define advanced execution scenarios
scenarios: {
scenario_dataInit: {
exec: "initDataSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '0s',
maxDuration: '10s',
},
scenario_voiceCallingCalledInit: {
exec: "initVoiceCallingCalledSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '15s',
maxDuration: '25s',
},
scenario_videoCallingInit: {
exec: "initVideoCallingSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '20s',
maxDuration: '30s',
},
scenario_dataUpdate: {
exec: "updateDataSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 10,
startTime: '60s',
maxDuration: '600s',
},
scenario_voiceCallingCalledUpdate: {
exec: "updateVoiceCallingCalledSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 10,
startTime: '40s',
maxDuration: '600s',
},
scenario_videoUpdate: {
exec: "updateVideoCallingSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 10,
startTime: '50s',
maxDuration: '600s',
},
scenario_dataTerminate: {
exec: "terminateDataSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '250s',
maxDuration: '630s',
},
scenario_voiceCallingCalledTerminate: {
exec: "terminateVoiceCallingCalledSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '260s',
maxDuration: '632s',
},
scenario_videoCallingTerminate: {
exec: "terminateVideoCallingSession",
executor: 'per-vu-iterations',
vus: cfg[0].get.numberOfAccounts,
iterations: 1,
startTime: '270s',
maxDuration: '682s',
},
},
};
export function setup() {
for (let i = 0; i < cfg[0].get.numberOfAccounts; i++) {
http.post(cfg[0].get.webdis_url, `LPUSH/data_init_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/voice_calling_init_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/voice_called_init_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/video_calling_init_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/data_terminate_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/voice_calling_terminate_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/voice_called_terminate_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/video_calling_terminate_sessionIds/${i}`);
}
for (let iter = 0; iter < cfg[0].get.dataUpdateSenderIterations; iter++) {
for (let i = 0; i < cfg[0].get.numberOfAccounts; i++) {
http.post(cfg[0].get.webdis_url, `LPUSH/data_update_sessionIds/${i}`);
}
}
for (let iter = 0; iter < cfg[0].get.voiceCallingCalledUpdateSenderIterations; iter++) {
for (let i = 0; i < cfg[0].get.numberOfAccounts; i++) {
http.post(cfg[0].get.webdis_url, `LPUSH/voice_calling_update_sessionIds/${i}`);
http.post(cfg[0].get.webdis_url, `LPUSH/voice_called_update_sessionIds/${i}`);
}
}
for (let iter = 0; iter < cfg[0].get.videoUpdateSenderIterations; iter++) {
for (let i = 0; i < cfg[0].get.numberOfAccounts; i++) {
http.post(cfg[0].get.webdis_url, `LPUSH/video_calling_update_sessionIds/${i}`);
}
}
}
export const callingCalled = new SharedArray("an object represents who is calling and who is called", function () {
let objCallingCalled = {};
for (let i = 0; i <= cfg[0].get.numberOfAccounts; i++) {
objCallingCalled[i.toString()] = userData[0].get.zz + (cfg[0].get.numberOfAccounts - i + 1).toString();
}
return [objCallingCalled];
});
export const IMEISVs = new SharedArray("an array containing IMEISV for accounts", function () {
let imeisvs = [];
for (let i = 0; i < cfg[0].get.numberOfAccounts; i++) {
imeisvs.push(parseInt(cfg[0].get.TAC +
Math.floor(Math.random() * (999999 - 111111 + 1) + 111111).toString() +
Math.floor(Math.random() * (98 - 11 + 1) + 11).toString()));
}
return imeisvs;
});
function dataInit(sessionID, phoneNumber) {
let data_init_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
data_init_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
data_init_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_init_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_init_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_init_session_ccr.add(avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Unsigned32(4)))
data_init_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("32251@3gpp.org")))
data_init_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(1)))
data_init_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
data_init_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
data_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumber))
])))
data_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`${userData[0].get.preMiddleFix}${phoneNumber}`))
])))
data_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumber))
])))
data_init_session_ccr.add(avp.New(code[0].get.RequestedAction, 0, flag[0].get.M, diamType.Enumerated(0)))
data_init_session_ccr.add(avp.New(code[0].get.AoCRequestType, vendor[0].get.TGPP, (flag[0].get.V) | (flag[0].get.M), diamType.Enumerated(1)))
data_init_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(0)))
data_init_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.UTF8String("")),
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.CCInputOctets, 0, flag[0].get.M, diamType.Unsigned64(0)),
avp.New(code[0].get.CCOutputOctets, 0, flag[0].get.M, diamType.Unsigned64(0))
])),
avp.New(code[0].get.QoSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.QoSClassIdentifier, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(5)),
avp.New(code[0].get.AllocationRetentionPriority, vendor[0].get.TGPP, flag[0].get.V, diamType.Grouped([
avp.New(code[0].get.PriorityLevel, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1)),
avp.New(code[0].get.PreemptionCapability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1)),
avp.New(code[0].get.PreemptionVulnerability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1))
])),
avp.New(code[0].get.APNAggregateMaxBitrateUL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateUL)),
avp.New(code[0].get.APNAggregateMaxBitrateDL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateDL))
])),
avp.New(code[0].get.TGPPRATType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("06"))
])))
data_init_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.PSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.TGPPChargingId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("0000000a")),
avp.New(code[0].get.TGPPPDPType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.PDPAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("10.46.0.2")),
avp.New(code[0].get.SGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.3")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.CalledStationId, 0, flag[0].get.M, diamType.UTF8String("internet")),
avp.New(code[0].get.TGPPSelectionMode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("0")),
avp.New(code[0].get.TGPPSGSNMCCMNC, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(userData[0].get.prefix)),
avp.New(code[0].get.TGPPNSAPI, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("\\005")),
avp.New(code[0].get.TGPPMSTimeZone, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString(userData[0].get.timeZone)),
avp.New(code[0].get.TGPPUserLocationInfo, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(userData[0].get.userLocationInfo)),
avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
]))
]))
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(data_init_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCallingInit(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_calling_init_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_calling_init_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.DestinationHost, 0, flag[0].get.M, diamType.DiameterIdentity("hssocs.voiceblue.com")))
voice_calling_init_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(2)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_calling_init_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("INVITE")),
avp.New(code[0].get.Expires, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(4294967295)),
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String(`3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b`)),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_calling_init_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_calling_init_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_calling_init_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_calling_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])))
voice_calling_init_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_calling_init_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100)),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_calling_init_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCalledInit(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_called_init_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_called_init_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_called_init_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_init_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_init_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_init_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(2)))
voice_called_init_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_called_init_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled)))
voice_called_init_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_called_init_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("INVITE")),
avp.New(code[0].get.Expires, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(4294967295)),
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
])),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_called_init_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_called_init_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_called_init_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_called_init_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_called_init_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_called_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])))
voice_called_init_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_called_init_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100)),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_called_init_session_ccr);
// console.log(`CCA: ${cca}`)
}
function videoCallingInit(sessionID, phoneNumberCalling, phoneNumberCalled) {
let video_calling_init_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
video_calling_init_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
video_calling_init_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_init_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_init_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_init_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(2)))
video_calling_init_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
video_calling_init_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_init_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
video_calling_init_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("INVITE")),
avp.New(code[0].get.Expires, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(4294967295)),
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String(`3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b`)),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
video_calling_init_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
video_calling_init_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(1)))
video_calling_init_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
video_calling_init_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
video_calling_init_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
video_calling_init_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])))
video_calling_init_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
video_calling_init_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.videoRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1001)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(200)),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(video_calling_init_session_ccr);
// console.log(`CCA: ${cca}`)
}
function dataUpdate(sessionID, phoneNumber) {
let data_update_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
data_update_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
data_update_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_update_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_update_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_update_session_ccr.add(avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Unsigned32(4)))
data_update_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("32251@3gpp.org")))
data_update_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(2)))
data_update_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(1)))
data_update_session_ccr.add(avp.New(code[0].get.DestinationHost, 0, flag[0].get.M, diamType.DiameterIdentity(`CGR-DA.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_update_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
data_update_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`${userData[0].get.preMiddleFix}${phoneNumber}`))
])))
data_update_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumber))
])))
data_update_session_ccr.add(avp.New(code[0].get.RequestedAction, 0, flag[0].get.M, diamType.Enumerated(0)))
data_update_session_ccr.add(avp.New(code[0].get.AoCRequestType, vendor[0].get.TGPP, (flag[0].get.V) | (flag[0].get.M), diamType.Enumerated(1)))
data_update_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.UTF8String("")),
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.ReportingReason, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(3)),
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.CCInputOctets, 0, flag[0].get.M, diamType.Unsigned64(cfg[0].get.downloadedBytes)),
avp.New(code[0].get.CCOutputOctets, 0, flag[0].get.M, diamType.Unsigned64(cfg[0].get.uploadedBytes))
])),
avp.New(code[0].get.QoSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.QoSClassIdentifier, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(9)),
avp.New(code[0].get.AllocationRetentionPriority, vendor[0].get.TGPP, flag[0].get.V, diamType.Grouped([
avp.New(code[0].get.PriorityLevel, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(8)),
avp.New(code[0].get.PreemptionCapability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1)),
avp.New(code[0].get.PreemptionVulnerability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1))
])),
avp.New(code[0].get.APNAggregateMaxBitrateUL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateUL)),
avp.New(code[0].get.APNAggregateMaxBitrateDL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateDL))
])),
avp.New(code[0].get.TGPPRATType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("06"))
])))
data_update_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.PSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.TGPPChargingId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("00000014")),
avp.New(code[0].get.PDPAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("10.46.0.8")),
avp.New(code[0].get.SGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.3")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.CalledStationId, 0, flag[0].get.M, diamType.UTF8String("internet")),
avp.New(code[0].get.TGPPSelectionMode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("0")),
avp.New(code[0].get.TGPPSGSNMCCMNC, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(userData[0].get.prefix)),
avp.New(code[0].get.TGPPNSAPI, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("\\006")),
avp.New(code[0].get.TGPPMSTimeZone, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString(userData[0].get.timeZone)),
avp.New(code[0].get.TGPPUserLocationInfo, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(userData[0].get.userLocationInfo)),
avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID])),
]))
]))
])))
// console.log("this is data_update_session_ccr: ", data_update_session_ccr)
client.connect(cfg[0].get.diamClient)
let cca = client.send(data_update_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCallingUpdate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_calling_update_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_calling_update_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(3)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_calling_update_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String(`3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b`)),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_calling_update_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_calling_update_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(2)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(3)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_calling_update_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_calling_update_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])))
voice_calling_update_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_calling_update_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100)),
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceCallUsedTime))
])),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_calling_update_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCalledUpdate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_called_update_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_called_update_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_called_update_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_update_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_update_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_update_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(3)))
voice_called_update_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_called_update_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled)))
voice_called_update_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_called_update_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy"))
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0))
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String(`3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b`)),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_called_update_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_called_update_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(2)))
voice_called_update_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(2)))
voice_called_update_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_called_update_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_called_update_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])))
voice_called_update_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_called_update_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100)),
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceCallUsedTime))
])),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_called_update_session_ccr);
// console.log(`CCA: ${cca}`)
}
function videoCallingUpdate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let video_calling_update_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
video_calling_update_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
video_calling_update_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_update_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_update_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_update_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(3)))
video_calling_update_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
video_calling_update_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_update_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
video_calling_update_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String("3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b")),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
video_calling_update_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
video_calling_update_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(2)))
video_calling_update_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(1)))
video_calling_update_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
video_calling_update_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
video_calling_update_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])))
video_calling_update_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
video_calling_update_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.RequestedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.videoRequestedTime))
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1001)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(200)),
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.videoUsedTime))
])),
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(video_calling_update_session_ccr);
// console.log(`CCA: ${cca}`)
}
function dataTerminate(sessionID, phoneNumber) {
let data_terminate_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
data_terminate_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
data_terminate_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.DiameterIdentity(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_terminate_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_terminate_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.DiameterIdentity(`epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_terminate_session_ccr.add(avp.New(code[0].get.DestinationHost, 0, flag[0].get.M, diamType.DiameterIdentity(`CGR-DA.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
data_terminate_session_ccr.add(avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Unsigned32(4)))
data_terminate_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("32251@3gpp.org")))
data_terminate_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(3)))
data_terminate_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(1)))
data_terminate_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
data_terminate_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`${userData[0].get.preMiddleFix}${phoneNumber}`))
])))
data_terminate_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumber))
])))
data_terminate_session_ccr.add(avp.New(code[0].get.TerminationCause, 0, flag[0].get.M, diamType.Enumerated(1)))
data_terminate_session_ccr.add(avp.New(code[0].get.RequestedAction, 0, flag[0].get.M, diamType.Enumerated(0)))
data_terminate_session_ccr.add(avp.New(code[0].get.AoCRequestType, vendor[0].get.TGPP, (flag[0].get.V) | (flag[0].get.M), diamType.Enumerated(1)))
data_terminate_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.CCInputOctets, 0, flag[0].get.M, diamType.Unsigned64(cfg[0].get.downloadedBytes)),
avp.New(code[0].get.CCOutputOctets, 0, flag[0].get.M, diamType.Unsigned64(cfg[0].get.uploadedBytes))
])),
avp.New(code[0].get.ReportingReason, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.QoSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.QoSClassIdentifier, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(9)),
avp.New(code[0].get.AllocationRetentionPriority, vendor[0].get.TGPP, flag[0].get.V, diamType.Grouped([
avp.New(code[0].get.PriorityLevel, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(8)),
avp.New(code[0].get.PreemptionCapability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1)),
avp.New(code[0].get.PreemptionVulnerability, vendor[0].get.TGPP, flag[0].get.V, diamType.Enumerated(1))
])),
avp.New(code[0].get.APNAggregateMaxBitrateUL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateUL)),
avp.New(code[0].get.APNAggregateMaxBitrateDL, vendor[0].get.TGPP, flag[0].get.V, diamType.Unsigned32(cfg[0].get.BitrateDL))
])),
avp.New(code[0].get.TGPPRATType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("06")),
])))
data_terminate_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.PSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.TGPPChargingId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString("0000000b")),
avp.New(code[0].get.PDPAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("10.45.0.3")),
avp.New(code[0].get.SGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.3")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.GGSNAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Address("127.0.0.4")),
avp.New(code[0].get.CalledStationId, 0, flag[0].get.M, diamType.UTF8String("internet")),
avp.New(code[0].get.TGPPSelectionMode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("0")),
avp.New(code[0].get.TGPPSGSNMCCMNC, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`${cfg[0].get.MCC}20`)),
avp.New(code[0].get.TGPPNSAPI, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("\\005")),
avp.New(code[0].get.TGPPMSTimeZone, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.OctetString(userData[0].get.timeZone)),
avp.New(code[0].get.TGPPUserLocationInfo, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(userData[0].get.userLocationInfo)),
avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
]))
]))
])))
client.connect(cfg[0].get.diamClient)
let cca = client.send(data_terminate_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCallingTerminate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_calling_terminate_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.UTF8String(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(4)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy"))
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0))
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String(`3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b`)),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(3)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(9)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.voiceCallUsedTime)),
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100))
])))
voice_calling_terminate_session_ccr.add(avp.New(code[0].get.TerminationCause, 0, flag[0].get.M, diamType.Enumerated(1)))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_calling_terminate_session_ccr);
// console.log(`CCA: ${cca}`)
}
function voiceCalledTerminate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let voice_called_terminate_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
voice_called_terminate_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.UTF8String(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(4)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy"))
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(1)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0))
])),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(3)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.CCRequestNumber, 0, flag[0].get.M, diamType.Unsigned32(9)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.EventTimestamp, 0, flag[0].get.M, diamType.Time(new Date(Date.now()))))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.UserEquipmentInfo, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UserEquipmentInfoType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserEquipmentInfoValue, 0, flag[0].get.M, diamType.OctetString(IMEISVs[sessionID]))
])))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(phoneNumberCalled))
])))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.MultipleServicesIndicator, 0, flag[0].get.M, diamType.Enumerated(1)))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.MultipleServicesCreditControl, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.UsedServiceUnit, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.CCTime, 0, flag[0].get.M, diamType.Unsigned32(cfg[0].get.usedTime)),
])),
avp.New(code[0].get.ServiceIdentifier, 0, flag[0].get.M, diamType.Unsigned32(1000)),
avp.New(code[0].get.RatingGroup, 0, flag[0].get.M, diamType.Unsigned32(100))
])))
voice_called_terminate_session_ccr.add(avp.New(code[0].get.TerminationCause, 0, flag[0].get.M, diamType.Enumerated(1)))
client.connect(cfg[0].get.diamClient)
let cca = client.send(voice_called_terminate_session_ccr);
// console.log(`CCA: ${cca}`);
}
function videoCallingTerminate(sessionID, phoneNumberCalling, phoneNumberCalled) {
let video_calling_terminate_session_ccr = diam.newMessage(cmd[0].get.CreditControl, app[0].get.ChargingControl);
video_calling_terminate_session_ccr.add(avp.New(code[0].get.SessionId, 0, flag[0].get.M, diamType.UTF8String(`smf.epc.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org;${sessionID};${sessionID}`)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.OriginHost, 0, flag[0].get.M, diamType.UTF8String(`scscf.ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.OriginRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.DestinationRealm, 0, flag[0].get.M, diamType.UTF8String(`ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordType, 0, flag[0].get.M, diamType.Enumerated(4)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.AccountingRecordNumber, 0, flag[0].get.M, diamType.Unsigned32(0)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.UserName, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.ServiceContextId, 0, flag[0].get.M, diamType.UTF8String("ext.02.001.8.32260@3gpp.org")))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.ServiceInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SubscriptionIdType, 0, flag[0].get.M, diamType.Enumerated(2)),
avp.New(code[0].get.SubscriptionIdData, 0, flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`))
])),
avp.New(code[0].get.IMSInformation, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.EventType, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPMethod, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy")),
avp.New(code[0].get.Event, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("dummy"))
])),
avp.New(code[0].get.RoleOfNode, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.NodeFunctionality, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Enumerated(0)),
avp.New(code[0].get.UserSessionId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String("tTOM6k7fswFpIZDJ3qy90g..@10.46.0.3")),
avp.New(code[0].get.CallingPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`sip:${phoneNumberCalling}@ims.mnc${cfg[0].get.MNC}.mcc${cfg[0].get.MCC}.3gppnetwork.org`)),
avp.New(code[0].get.CalledPartyAddress, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.UTF8String(`tel:${phoneNumberCalled}`)),
avp.New(code[0].get.TrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.OutgoingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0)),
avp.New(code[0].get.IncomingTrunkGroupId, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Unsigned32(0))
])),
avp.New(code[0].get.AccessNetworkInformation, vendor[0].get.TGPP, flag[0].get.V, diamType.UTF8String("3GPP-E-UTRAN-FDD;utran-cell-id-3gpp=${cfg[0].get.MCC}200001000010b")),
avp.New(code[0].get.TimeStamps, vendor[0].get.TGPP, flag[0].get.V | flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.SIPRequestTimestamp, vendor[0].get.TGPP, flag[0].get.V, diamType.Time(new Date(Date.now())))
]))
]))
])))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.VendorSpecificApplicationId, 0, flag[0].get.M, diamType.Grouped([
avp.New(code[0].get.VendorId, 0, flag[0].get.M, diamType.Unsigned32(10415)),
avp.New(code[0].get.AuthApplicationId, 0, flag[0].get.M, diamType.Enumerated(4)),
])))
video_calling_terminate_session_ccr.add(avp.New(code[0].get.CCRequestType, 0, flag[0].get.M, diamType.Enumerated(3)))