summaryrefslogtreecommitdiffstats
path: root/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelVoiceQuality.java
blob: d33abce447ef5973e6c8a386c5d558b33dfc8ed9 (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
package evel_javalibrary.att.com;

/**************************************************************************//**
 * @file
 * Evel Voice Quality event class
 *
  * This file implements the Evel TVoice Quality event event class which is intended to provide a
 * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
 * that VNFs can use it to send Voice Quality event reports.
 *
 * License
 * -------
 * Unless otherwise specified, all software contained herein is
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/


import java.text.MessageFormat;
import java.util.ArrayList;

import javax.json.Json;
import javax.json.JsonArrayBuilder;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;

import org.apache.log4j.Logger;
import org.slf4j.helpers.MessageFormatter;



public class EvelVoiceQuality extends EvelHeader {
	
	int major_version = 1;
	int minor_version = 0;
	
	
	/**************************************************************************//**
	 * Vendor VNF Name fields.
	 * JSON equivalent field: vendorVnfNameFields
	 *****************************************************************************/
	public class VENDOR_VNFNAME_FIELD {
	  String vendorname;
	  EvelOptionString vfmodule;
	  EvelOptionString vnfname;
	}
	  
	/**************************************************************************//**
	 * Service Event endpoint description
	 * JSON equivalent field: endpointDesc
	 *****************************************************************************/
	public enum EVEL_SERVICE_ENDPOINT_DESC {
	  EVEL_SERVICE_ENDPOINT_CALLEE,
	  EVEL_SERVICE_ENDPOINT_CALLER,
	  EVEL_MAX_SERVICE_ENDPOINT_DESC
	}
	
	/**************************************************************************//**
	 * End of Call Voice Quality Metrices
	 * JSON equivalent field: endOfCallVqmSummaries
	 *****************************************************************************/
	public class END_OF_CALL_VOICE_QUALITY_METRICS {
		/***************************************************************************/
		/* Mandatory fields                                                        */
		/***************************************************************************/
		String adjacencyName;
		String endpointDescription;

		/***************************************************************************/
		/* Optional fields                                                         */
		/***************************************************************************/
		EvelOptionDouble endpointJitter;
		EvelOptionDouble endpointRtpOctetsDiscarded;
		EvelOptionDouble endpointRtpOctetsReceived;
		EvelOptionDouble endpointRtpOctetsSent;
		EvelOptionDouble endpointRtpPacketsDiscarded;
		EvelOptionDouble endpointRtpPacketsReceived;
		EvelOptionDouble endpointRtpPacketsSent;
		EvelOptionDouble localJitter;
		EvelOptionDouble localRtpOctetsDiscarded;
		EvelOptionDouble localRtpOctetsReceived;
		EvelOptionDouble localRtpOctetsSent;
		EvelOptionDouble localRtpPacketsDiscarded;
		EvelOptionDouble localRtpPacketsReceived;
		EvelOptionDouble localRtpPacketsSent;
		EvelOptionDouble mosCqe;
		EvelOptionDouble packetsLost;
		EvelOptionDouble packetLossPercent;
		EvelOptionDouble rFactor;
		EvelOptionDouble roundTripDelay;
		
		/*
		 * Ves6.0 Added Fields 15/07/2018
		 */
		
		EvelOptionDouble endpointAverageJitter;
		EvelOptionDouble endpointMaxJitter;
		EvelOptionDouble endpointRtpOctetsLost;
		EvelOptionDouble endpointRtpPacketsLost;
		EvelOptionDouble localAverageJitter;
		EvelOptionDouble localMaxJitter;
		EvelOptionDouble localAverageJitterBufferDelay;
		EvelOptionDouble localMaxJitterBufferDelay;
		EvelOptionDouble localRtpOctetsLost;
		EvelOptionDouble localRtpPacketsLost;
		EvelOptionDouble oneWayDelay;
		

		
	}

	/***************************************************************************/
	  /* Mandatory fields                                                        */
	  /***************************************************************************/
	  VENDOR_VNFNAME_FIELD vnfname_field;
	  String calleeSideCodec;
	  String callerSideCodec;
	  String correlator;
	  String midCallRtcp;

	  /***************************************************************************/
	  /* Optional fields                                                         */
	  /***************************************************************************/
	  ArrayList<String[]> additional_info;
	  END_OF_CALL_VOICE_QUALITY_METRICS endOfCallVqmSummaries;
	  EvelOptionString evphoneNumber;

	/***************************************************************************/
	/* Optional fields                                                         */
	/***************************************************************************/

	  private static final Logger LOGGER = Logger.getLogger( EvelVoiceQuality.class.getName() );


	  /**************************************************************************//**
	   * Create a new Voice Quality event.
	   *
	   * @note    The mandatory fields on the Voice Quality must be supplied to this
	   *          factory function and are immutable once set.  Optional fields have
	   *          explicit setter functions, but again values may only be set once so
	   *          that the event has immutable properties.
	   *
	   * @param   calleeSideCodec    callee codec for voice call
	   * @param   callerSideCodec    caller codec
	   * @param   corlator           Correlator
	   * @param   midCallRtcp        Midcall RTCP value
	   * @param   vendr_name         Vendor name
	   *
	   * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT.  If the
	   *          event is not used (i.e. posted) it must be released using
	   *          ::evel_free_event.
	   * @retval  null  Failed to create the event.
	   *****************************************************************************/
	  public EvelVoiceQuality(String evname, String evid,
			    String calleeSideCodc,
			    String callerSideCodc, String corlator,
			    String midCllRtcp, String vendr_name)
	  {
        super(evname,evid);

	    EVEL_ENTER();

	    /***************************************************************************/
	    /* Check preconditions.                                                    */
	    /***************************************************************************/
	    assert(vendr_name != null);
	    assert(calleeSideCodc != null);
	    assert(callerSideCodc != null);
	    assert(midCllRtcp != null);
	    assert(corlator != null);
	 

	    /***************************************************************************/
	    /* Allocate the measurement.                                               */
	    /***************************************************************************/
	    LOGGER.debug("New Voice Quality vendor "+vendr_name+" correlator"+corlator+"calleeSideCodec"+calleeSideCodc+"callerSideCodec"+callerSideCodc+"midCallRtcp"+midCllRtcp);

	    /***************************************************************************/
	    /* Initialize the header & the measurement fields.                         */
	    /***************************************************************************/
	    event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY;
	    correlator = corlator;
		calleeSideCodec = calleeSideCodc;
		callerSideCodec = callerSideCodc;
		midCallRtcp = midCllRtcp;
		
		vnfname_field = new VENDOR_VNFNAME_FIELD();
		vnfname_field.vendorname = vendr_name;
		vnfname_field.vfmodule = new EvelOptionString();
		vnfname_field.vnfname = new EvelOptionString();

	    /***************************************************************************/
	    /* Optional fields.                                                    */
	    /***************************************************************************/
	    additional_info = null;
	    endOfCallVqmSummaries = null;
	    evphoneNumber = new EvelOptionString();

	    EVEL_EXIT();
	  }
	  
	  /**************************************************************************//**
	   * Add an additional value name/value pair to the Voice Quality.
	   *
	   * The name and value are null delimited ASCII strings.  The library takes
	   * a copy so the caller does not have to preserve values after the function
	   * returns.
	   *
	   * @param name      ASCIIZ string with the attribute's name.  The caller
	   *                  does not need to preserve the value once the function
	   *                  returns.
	   * @param value     ASCIIZ string with the attribute's value.  The caller
	   *                  does not need to preserve the value once the function
	   *                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_addl_info_add(String name, String value)
		{
		  String[] addl_info = null;
		  EVEL_ENTER();

		  /***************************************************************************/
		  /* Check preconditions.                                                    */
		  /***************************************************************************/
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  assert(name != null);
		  assert(value != null);
		  
		  if( additional_info == null )
		  {
			  additional_info = new ArrayList<String[]>();
		  }

		  LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
		  addl_info = new String[2];
		  assert(addl_info != null);
		  addl_info[0] = name;
		  addl_info[1] = value;

		  additional_info.add(addl_info);

		  EVEL_EXIT();
		}
	  
	  
	  /**************************************************************************//**
	   * Set the Callee side codec for Call for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param calleeCodecForCall        The Callee Side Codec to be set.  ASCIIZ 
	   *                                  string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_callee_codec_set(String calleeCodecForCall) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
		  assert(calleeCodecForCall != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting Correlator "+calleeCodecForCall);

	      calleeSideCodec = calleeCodecForCall;

	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Set the Caller side codec for Call for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param callerCodecForCall        The Caller Side Codec to be set.  ASCIIZ 
	   *                                  string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_caller_codec_set(String callerCodecForCall) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
	      assert(callerCodecForCall != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting CallerCodecForCall "+callerCodecForCall);

	      callerSideCodec = callerCodecForCall;

	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Set the correlator for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param correlator                The correlator value to be set.  ASCIIZ 
	   *                                  string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_correlator_set(String vCorrelator) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
	      assert(vCorrelator != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting Correlator "+vCorrelator);
		  
	      correlator = vCorrelator;

	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Set the RTCP Call Data for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param rtcpCallData              The RTCP Call Data to be set.  ASCIIZ 
	   *                                  string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_rtcp_data_set(String rtcpCallData) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
	      assert(rtcpCallData != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting RTCP Data "+rtcpCallData);

	      midCallRtcp = rtcpCallData;

	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Set the Vendor VNF Name fields for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param modulename                The Vendor, VNF and VfModule names to be set.   
	   *                                  ASCIIZ string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_vnfmodule_name_set(String module_name) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
		  assert(module_name != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting VoiceQuality Module Name "+module_name);
		    
		  vnfname_field.vfmodule.SetValue(module_name);

	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Set the Vendor VNF Name fields for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param modulename                The Vendor, VNF and VfModule names to be set.   
	   *                                  ASCIIZ string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_vnfname_set(String vnfname) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
		  assert(vnfname != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  LOGGER.debug("Setting VoiceQuality VNF Name "+vnfname);
		    
		  vnfname_field.vnfname.SetValue(vnfname);
		  
	      EVEL_EXIT();
	  }
	  

	  /**************************************************************************//**
	   * Set the Phone Number associated with the Correlator for domain Voice Quality
	   *
	   * @note  The property is treated as immutable: it is only valid to call
	   *        the setter once.  However, we don't assert if the caller tries to
	   *        overwrite, just ignoring the update instead.
	   *
	   * 
	   * @param calleeCodecForCall        The Phone Number to be set.  ASCIIZ 
	   *                                  string. The caller does not need to 
	   *                                  preserve the value once the function
	   *                                  returns.
	   *****************************************************************************/
	  public void evel_voice_quality_phone_number_set(String phoneNumber) {
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check preconditions.                                                    */
	      /***************************************************************************/
	      assert(phoneNumber != null);
		  assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
		  
		  evphoneNumber.SetValuePr(phoneNumber,"Phone_Number");
		  
	      EVEL_EXIT();
	  }

	  /**************************************************************************//**
	   * Add an End of Call Voice Quality Metrices

	   * The adjacencyName and endpointDescription is null delimited ASCII string.  
	   * The library takes a copy so the caller does not have to preserve values
	   * after the function returns.
	   *
	   * @param voiceQuality     Pointer to the measurement.
	   * @param adjacencyName                     Adjacency name
	   * @param endpointDescription               Enumeration: ‘Caller’, ‘Callee’.
	   * @param endpointJitter                    Endpoint jitter
	   * @param endpointRtpOctetsDiscarded        Endpoint RTP octets discarded.
	   * @param endpointRtpOctetsReceived         Endpoint RTP octets received.
	   * @param endpointRtpOctetsSent             Endpoint RTP octets sent
	   * @param endpointRtpPacketsDiscarded       Endpoint RTP packets discarded.
	   * @param endpointRtpPacketsReceived        Endpoint RTP packets received.
	   * @param endpointRtpPacketsSent            Endpoint RTP packets sent.
	   * @param localJitter                       Local jitter.
	   * @param localRtpOctetsDiscarded           Local RTP octets discarded.
	   * @param localRtpOctetsReceived            Local RTP octets received.
	   * @param localRtpOctetsSent                Local RTP octets sent.
	   * @param localRtpPacketsDiscarded          Local RTP packets discarded.
	   * @param localRtpPacketsReceived           Local RTP packets received.
	   * @param localRtpPacketsSent               Local RTP packets sent.
	   * @param mosCqe                            Decimal range from 1 to 5
	   *                                          (1 decimal place)
	   * @param packetsLost                       No  Packets lost
	   * @param packetLossPercent                 Calculated percentage packet loss 
	   * @param rFactor                           rFactor from 0 to 100
	   * @param roundTripDelay                    Round trip delay in milliseconds
	   *****************************************************************************/
	  public void evel_voice_quality_end_metrics_set(
	      String adjacencyName, String endpointDescr,
	      //double endpointJitter,
	      double endpointRtpOctetsDiscarded,
	      double endpointRtpOctetsReceived,
	      double endpointRtpOctetsSent,
	      double endpointRtpPacketsDiscarded,
	      double endpointRtpPacketsReceived,
	      double endpointRtpPacketsSent,
	     // double localJitter,
	      double localRtpOctetsDiscarded,
	      double localRtpOctetsReceived,
	      double localRtpOctetsSent,
	      double localRtpPacketsDiscarded,
	      double localRtpPacketsReceived,
	      double localRtpPacketsSent,
	      double mosCqe,
	     // double packetsLost,
	      double packetLossPercent,
	      double rFactor,
	      double roundTripDelay,
	      /*
	      * Ves6.0 AddedFields 15/07/2018
	      */
	      double endpointAverageJitter,
	      double endpointMaxJitter,
	      double endpointRtpOctetsLost,
	      double endpointRtpPacketsLost,
	      double localAverageJitter,
	      double localMaxJitter,
	      double localAverageJitterBufferDelay,
	      double localMaxJitterBufferDelay,
	      double localRtpOctetsLost,
	      double localRtpPacketsLost,
	      double oneWayDelay
	      ) {
	      
	      END_OF_CALL_VOICE_QUALITY_METRICS vQMetrices = null;
	      EVEL_ENTER();

	      /***************************************************************************/
	      /* Check assumptions.                                                      */
	      /***************************************************************************/
	      assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
	      assert(adjacencyName != null);
	      assert(mosCqe >= 0 && mosCqe <= 5);
	      assert(rFactor >= 0 && rFactor <= 100);
	      assert(endpointDescr != null && (endpointDescr.equals("Caller")||endpointDescr.equals("Callee")) );
	      
	      /***************************************************************************/
	      /* Allocate a container for the value and push onto the list.              */
	      /***************************************************************************/
	      LOGGER.debug(MessageFormat.format("Adding adjacencyName={0} endpointDescription={1}", adjacencyName, endpointDescr));
	      vQMetrices = new END_OF_CALL_VOICE_QUALITY_METRICS();
	      assert(vQMetrices != null);

	      vQMetrices.adjacencyName = adjacencyName;
	      vQMetrices.endpointDescription = endpointDescr;
	      
	      vQMetrices.endpointJitter = new EvelOptionDouble();
	      vQMetrices.endpointRtpOctetsDiscarded= new EvelOptionDouble();
	      vQMetrices.endpointRtpOctetsReceived= new EvelOptionDouble();
	      vQMetrices.endpointRtpOctetsSent= new EvelOptionDouble();
	      vQMetrices.endpointRtpPacketsDiscarded= new EvelOptionDouble();
	      vQMetrices.endpointRtpPacketsReceived= new EvelOptionDouble();
	      vQMetrices.endpointRtpPacketsSent= new EvelOptionDouble();
	      vQMetrices.localJitter= new EvelOptionDouble();
	      vQMetrices.localRtpOctetsDiscarded= new EvelOptionDouble();
	      vQMetrices.localRtpOctetsReceived= new EvelOptionDouble();
	      vQMetrices.localRtpOctetsSent= new EvelOptionDouble();
	      vQMetrices.localRtpPacketsDiscarded= new EvelOptionDouble();
	      vQMetrices.localRtpPacketsReceived= new EvelOptionDouble();
	      vQMetrices.localRtpPacketsSent= new EvelOptionDouble();
	      vQMetrices.mosCqe= new EvelOptionDouble();
	      vQMetrices.packetsLost= new EvelOptionDouble();
	      vQMetrices.packetLossPercent= new EvelOptionDouble();
	      vQMetrices.rFactor= new EvelOptionDouble();
	      vQMetrices.roundTripDelay= new EvelOptionDouble();
	      /*
	       * Ves6.0 AddedFields 15/07/2018
	       * */
	      
	      vQMetrices.endpointAverageJitter = new EvelOptionDouble();
	      vQMetrices.endpointMaxJitter = new EvelOptionDouble();
	      vQMetrices.endpointRtpOctetsLost= new EvelOptionDouble();
	      vQMetrices.endpointRtpPacketsLost = new EvelOptionDouble();
	      vQMetrices.localAverageJitter=new EvelOptionDouble();
	      vQMetrices.localMaxJitter=new EvelOptionDouble();
	      vQMetrices.localAverageJitterBufferDelay=new EvelOptionDouble();
	      vQMetrices.localMaxJitterBufferDelay=new EvelOptionDouble();
	      vQMetrices.localRtpOctetsLost=new EvelOptionDouble();
	      vQMetrices.localRtpPacketsLost=new EvelOptionDouble();
	      vQMetrices.oneWayDelay=new EvelOptionDouble();
	      
	      /*
	       * Ves6.0 AddedFields 15/07/2018
	       * */
	      
	      vQMetrices.endpointMaxJitter.SetValuePr(endpointMaxJitter, "EndpointMax jitter");
	      vQMetrices.endpointAverageJitter.SetValuePr(endpointAverageJitter, "Endpoint Average Jitter");
	      vQMetrices.endpointRtpOctetsLost.SetValuePr(endpointRtpOctetsLost, "End point RtpOctets Lost");
	      vQMetrices.endpointRtpPacketsLost.SetValuePr(endpointRtpPacketsLost,"End point Rtp Packets Lost");
	      vQMetrices.localAverageJitter.SetValuePr(localAverageJitter,"Local Average Jitter");
	      vQMetrices.localMaxJitter.SetValuePr(localMaxJitter, "Local Max Jitter");
	      
	      vQMetrices.localAverageJitterBufferDelay.SetValuePr(localAverageJitterBufferDelay, "local Average Jitter Buffer Delay");
	      
	      vQMetrices.localMaxJitterBufferDelay.SetValuePr(localMaxJitterBufferDelay, "Local Max Jitter Buffer Delay");
	      vQMetrices.localRtpOctetsLost.SetValuePr(localRtpOctetsLost, "Local RtpOctets Lost");
	      vQMetrices.localRtpPacketsLost.SetValuePr(localRtpPacketsLost, "Local RtpPackets Lost");
	      vQMetrices.oneWayDelay.SetValuePr(oneWayDelay, "OneWay Delay");
	      

//	      vQMetrices.endpointJitter.SetValuePr(endpointJitter, "Endpoint jitter");
	      vQMetrices.endpointRtpOctetsDiscarded.SetValuePr(endpointRtpOctetsDiscarded, "Endpoint RTP octets discarded");
	      vQMetrices.endpointRtpOctetsReceived.SetValuePr(endpointRtpOctetsReceived, "Endpoint RTP octets received");
	      vQMetrices.endpointRtpOctetsSent.SetValuePr(endpointRtpOctetsSent, "Endpoint RTP octets sent");
	      vQMetrices.endpointRtpPacketsDiscarded.SetValuePr(endpointRtpPacketsDiscarded, "Endpoint RTP packets discarded");
	      vQMetrices.endpointRtpPacketsReceived.SetValuePr(endpointRtpPacketsReceived, "Endpoint RTP packets received");
	      vQMetrices.endpointRtpPacketsSent.SetValuePr(endpointRtpPacketsSent, "Endpoint RTP packets sent");
//	      vQMetrices.localJitter.SetValuePr( localJitter, "Local jitter");
	      vQMetrices.localRtpOctetsDiscarded.SetValuePr(localRtpOctetsDiscarded, "Local RTP octets discarded");
	      vQMetrices.localRtpOctetsReceived.SetValuePr(localRtpOctetsReceived, "Local RTP octets received");
	      vQMetrices.localRtpOctetsSent.SetValuePr(localRtpOctetsSent, "Local RTP octets sent");
	      vQMetrices.localRtpPacketsDiscarded.SetValuePr(localRtpPacketsDiscarded, "Local RTP packets discarded");
	      vQMetrices.localRtpPacketsReceived.SetValuePr(localRtpPacketsReceived, "Local RTP packets received");
	      vQMetrices.localRtpPacketsSent.SetValuePr(localRtpPacketsSent, "Local RTP packets sent");
	      vQMetrices.mosCqe.SetValuePr(mosCqe, "Decimal range from 1 to 5 (1 decimal place)");
//	      vQMetrices.packetsLost.SetValuePr(packetsLost, "Packets lost");
	      vQMetrices.packetLossPercent.SetValuePr(packetLossPercent, "Calculated percentage packet loss");
	      vQMetrices.rFactor.SetValuePr(rFactor, "rFactor ");
	      vQMetrices.roundTripDelay.SetValuePr(roundTripDelay, "Round trip delay in milliseconds ");

	      endOfCallVqmSummaries = vQMetrices;

	      EVEL_EXIT();
	  }

		/**************************************************************************//**
		 * Encode the Voice Quality in JSON according to AT&T's schema
		 *
		 * @retvalue       JSON object of VoiceQuality body encoding
		 *****************************************************************************/
	  JsonObjectBuilder evelVoiceQualityObject()
	  {

	    //double version = major_version+(double)minor_version/10;
		  String version = "4.0";

	    EVEL_ENTER();

	    /***************************************************************************/
	    /* Check preconditions.                                                    */
	    /***************************************************************************/
	    assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);

	    /***************************************************************************/
	    /* Mandatory fields.                                                       */
	    /***************************************************************************/
	    
        JsonObjectBuilder vnfnamedobj =  Json.createObjectBuilder()
                .add( "vendorName",vnfname_field.vendorname);
            vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfModuleName");
            vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"nfName");
	    
	    JsonObjectBuilder evelvq = Json.createObjectBuilder()
	   	                          .add("correlator", correlator)
	   	                          .add("calleeSideCodec", calleeSideCodec)
	   	                          .add("callerSideCodec", callerSideCodec)
                                  .add("midCallRtcp", midCallRtcp)
                                  .add("voiceQualityFieldsVersion", version)
                                  .add("vendorNfNameFields", vnfnamedobj);
	    
	    /***************************************************************************/
	    /* Optional fields.                                                        */
	    /***************************************************************************/
	    evphoneNumber.encJsonValue(evelvq, "phoneNumber");
	    
	    
	    // additional fields
		  if( additional_info != null )
		  {
		    //JsonArrayBuilder builder = Json.createArrayBuilder();
		    JsonObjectBuilder builder = Json.createObjectBuilder();
		    for(int i=0;i<additional_info.size();i++) {
			  String[] addl_info = additional_info.get(i);
//			  JsonObject obj = Json.createObjectBuilder()
//			    	     .add("name", addl_info[0])
//			    	     .add("value", addl_info[1]).build();
			  builder.add(addl_info[0], addl_info[1]);
		    }
			evelvq.add("additionalInformation", builder);
		  }
		  
		  
		  if( endOfCallVqmSummaries != null )
		  {
		    JsonArrayBuilder builder = Json.createArrayBuilder();

			  END_OF_CALL_VOICE_QUALITY_METRICS vQMetrics = endOfCallVqmSummaries;
			  
			  JsonObjectBuilder obj = Json.createObjectBuilder()
					  .add("adjacencyName", vQMetrics.adjacencyName)
					  .add("endpointDescription", vQMetrics.endpointDescription);
					  
			 // vQMetrics.endpointJitter.encJsonValue(obj,"endpointJitter");
			  vQMetrics.endpointRtpOctetsDiscarded.encJsonValue(obj,"endpointRtpOctetsDiscarded");
			  vQMetrics.endpointRtpOctetsReceived.encJsonValue(obj,"endpointRtpOctetsReceived");
			  vQMetrics.endpointRtpOctetsSent.encJsonValue(obj,"endpointRtpOctetsSent");
			  vQMetrics.endpointRtpPacketsDiscarded.encJsonValue(obj,"endpointRtpPacketsDiscarded");			  
			  vQMetrics.endpointRtpPacketsReceived.encJsonValue(obj,"endpointRtpPacketsReceived");
			  vQMetrics.endpointRtpPacketsSent.encJsonValue(obj,"endpointRtpPacketsSent");
			//  vQMetrics.localJitter.encJsonValue(obj,"localJitter");
			  vQMetrics.localRtpOctetsDiscarded.encJsonValue(obj,"localRtpOctetsDiscarded");
			  vQMetrics.localRtpOctetsReceived.encJsonValue(obj,"localRtpOctetsReceived");
			  vQMetrics.localRtpOctetsSent.encJsonValue(obj,"localRtpOctetsSent");
			  vQMetrics.localRtpPacketsDiscarded.encJsonValue(obj,"localRtpPacketsDiscarded");			  
			  vQMetrics.localRtpPacketsReceived.encJsonValue(obj,"localRtpPacketsReceived");
			  vQMetrics.localRtpPacketsSent.encJsonValue(obj,"localRtpPacketsSent");
			  vQMetrics.mosCqe.encJsonValue(obj,"mosCqe");
			 // vQMetrics.packetsLost.encJsonValue(obj,"packetsLost");
			  vQMetrics.packetLossPercent.encJsonValue(obj,"packetLossPercent");
			  vQMetrics.rFactor.encJsonValue(obj,"rFactor");
			  vQMetrics.roundTripDelay.encJsonValue(obj,"roundTripDelay");
			  
			  /*
		       * Ves6.0 AddedFields 15/07/2018
		       * */
			  
			  vQMetrics.endpointAverageJitter.encJsonValue(obj, "endpointAverageJitter");
			  vQMetrics.endpointMaxJitter.encJsonValue(obj, "endpointMaxJitter");
			  vQMetrics.endpointRtpOctetsLost.encJsonValue(obj, "endpointRtpOctetsLost");
			  vQMetrics.endpointRtpPacketsLost.encJsonValue(obj, "endpointRtpPacketsLost");
			  vQMetrics.localAverageJitter.encJsonValue(obj, "localAverageJitter");
			  vQMetrics.localMaxJitter.encJsonValue(obj, "localMaxJitter");
			  
			  vQMetrics.localAverageJitterBufferDelay.encJsonValue(obj, "localAverageJitterBufferDelay");
			  
			  vQMetrics.localMaxJitterBufferDelay.encJsonValue(obj, "localMaxJitterBufferDelay");
			  vQMetrics.localRtpOctetsLost.encJsonValue(obj, "localRtpOctetsLost");
			  vQMetrics.localRtpPacketsLost.encJsonValue(obj, "localRtpPacketsLost");
			  vQMetrics.oneWayDelay.encJsonValue(obj, "oneWayDelay");
			  
			  

			  evelvq.add("endOfCallVqmSummaries", obj);
			  
		  }
	    

	    /***************************************************************************/
	    /* Although optional, we always generate the version.  Note that this      */
	    /* closes the object, too.                                                 */
	    /***************************************************************************/

	    EVEL_EXIT();
	    
	    return evelvq;
	  }
	  
		/**************************************************************************//**
	     * Encode the event as a JSON event object according to AT&T's schema.
	     * retval : String of JSON Voice Quality event message
	     *****************************************************************************/
	  JsonObject evel_json_encode_event()
	  {
		EVEL_ENTER();
		
		assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
	        
	    JsonObject obj = Json.createObjectBuilder()
	    	     .add("event", Json.createObjectBuilder()
		    	         .add( "commonEventHeader",eventHeaderObject() )
		    	         .add( "voiceQualityFields",evelVoiceQualityObject() )
		    	         ).build();

	    EVEL_EXIT();
	    
	    return obj;

	  }
	  
	  JsonObject evel_json_encode_event_batch()
	  {
		EVEL_ENTER();
		
		assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
	        
	    JsonObject obj = Json.createObjectBuilder()
	    	  //   .add("event", Json.createObjectBuilder()
		    	         .add( "commonEventHeader",eventHeaderObject() )
		    	         .add( "voiceQualityFields",evelVoiceQualityObject() )
		    	         .build();

	    EVEL_EXIT();
	    
	    return obj;

	  }


}