1 package evel_javalibrary.att.com;
\r
3 /**************************************************************************//**
\r
5 * Evel Voice Quality event class
\r
7 * This file implements the Evel TVoice Quality event event class which is intended to provide a
\r
8 * simple wrapper around the complexity of AT&T's Vendor Event Listener API so
\r
9 * that VNFs can use it to send Voice Quality event reports.
\r
13 * Unless otherwise specified, all software contained herein is
\r
14 * Licensed under the Apache License, Version 2.0 (the "License");
\r
15 * you may not use this file except in compliance with the License.
\r
16 * You may obtain a copy of the License at
\r
17 * http://www.apache.org/licenses/LICENSE-2.0
\r
19 * Unless required by applicable law or agreed to in writing, software
\r
20 * distributed under the License is distributed on an "AS IS" BASIS,
\r
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
22 * See the License for the specific language governing permissions and
\r
23 * limitations under the License.
\r
24 *****************************************************************************/
\r
27 import java.text.MessageFormat;
\r
28 import java.util.ArrayList;
\r
30 import javax.json.Json;
\r
31 import javax.json.JsonArrayBuilder;
\r
32 import javax.json.JsonObject;
\r
33 import javax.json.JsonObjectBuilder;
\r
35 import org.apache.log4j.Logger;
\r
36 import org.slf4j.helpers.MessageFormatter;
\r
40 public class EvelVoiceQuality extends EvelHeader {
\r
42 int major_version = 1;
\r
43 int minor_version = 1;
\r
45 /**************************************************************************//**
\r
46 * Vendor VNF Name fields.
\r
47 * JSON equivalent field: vendorVnfNameFields
\r
48 *****************************************************************************/
\r
49 public class VENDOR_VNFNAME_FIELD {
\r
51 EvelOptionString vfmodule;
\r
52 EvelOptionString vnfname;
\r
55 /**************************************************************************//**
\r
56 * Service Event endpoint description
\r
57 * JSON equivalent field: endpointDesc
\r
58 *****************************************************************************/
\r
59 public enum EVEL_SERVICE_ENDPOINT_DESC {
\r
60 EVEL_SERVICE_ENDPOINT_CALLEE,
\r
61 EVEL_SERVICE_ENDPOINT_CALLER,
\r
62 EVEL_MAX_SERVICE_ENDPOINT_DESC
\r
65 /**************************************************************************//**
\r
66 * End of Call Voice Quality Metrices
\r
67 * JSON equivalent field: endOfCallVqmSummaries
\r
68 *****************************************************************************/
\r
69 public class END_OF_CALL_VOICE_QUALITY_METRICS {
\r
70 /***************************************************************************/
\r
71 /* Mandatory fields */
\r
72 /***************************************************************************/
\r
73 String adjacencyName;
\r
74 String endpointDescription;
\r
76 /***************************************************************************/
\r
77 /* Optional fields */
\r
78 /***************************************************************************/
\r
79 EvelOptionDouble endpointJitter;
\r
80 EvelOptionDouble endpointRtpOctetsDiscarded;
\r
81 EvelOptionDouble endpointRtpOctetsReceived;
\r
82 EvelOptionDouble endpointRtpOctetsSent;
\r
83 EvelOptionDouble endpointRtpPacketsDiscarded;
\r
84 EvelOptionDouble endpointRtpPacketsReceived;
\r
85 EvelOptionDouble endpointRtpPacketsSent;
\r
86 EvelOptionDouble localJitter;
\r
87 EvelOptionDouble localRtpOctetsDiscarded;
\r
88 EvelOptionDouble localRtpOctetsReceived;
\r
89 EvelOptionDouble localRtpOctetsSent;
\r
90 EvelOptionDouble localRtpPacketsDiscarded;
\r
91 EvelOptionDouble localRtpPacketsReceived;
\r
92 EvelOptionDouble localRtpPacketsSent;
\r
93 EvelOptionDouble mosCqe;
\r
94 EvelOptionDouble packetsLost;
\r
95 EvelOptionDouble packetLossPercent;
\r
96 EvelOptionDouble rFactor;
\r
97 EvelOptionDouble roundTripDelay;
\r
100 /***************************************************************************/
\r
101 /* Mandatory fields */
\r
102 /***************************************************************************/
\r
103 VENDOR_VNFNAME_FIELD vnfname_field;
\r
104 String calleeSideCodec;
\r
105 String callerSideCodec;
\r
107 String midCallRtcp;
\r
109 /***************************************************************************/
\r
110 /* Optional fields */
\r
111 /***************************************************************************/
\r
112 ArrayList<String[]> additional_info;
\r
113 END_OF_CALL_VOICE_QUALITY_METRICS endOfCallVqmSummaries;
\r
114 EvelOptionString evphoneNumber;
\r
116 /***************************************************************************/
\r
117 /* Optional fields */
\r
118 /***************************************************************************/
\r
120 private static final Logger LOGGER = Logger.getLogger( EvelVoiceQuality.class.getName() );
\r
123 /**************************************************************************//**
\r
124 * Create a new Voice Quality event.
\r
126 * @note The mandatory fields on the Voice Quality must be supplied to this
\r
127 * factory function and are immutable once set. Optional fields have
\r
128 * explicit setter functions, but again values may only be set once so
\r
129 * that the event has immutable properties.
\r
131 * @param calleeSideCodec callee codec for voice call
\r
132 * @param callerSideCodec caller codec
\r
133 * @param corlator Correlator
\r
134 * @param midCallRtcp Midcall RTCP value
\r
135 * @param vendr_name Vendor name
\r
137 * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the
\r
138 * event is not used (i.e. posted) it must be released using
\r
139 * ::evel_free_event.
\r
140 * @retval null Failed to create the event.
\r
141 *****************************************************************************/
\r
142 public EvelVoiceQuality(String evname, String evid,
\r
143 String calleeSideCodc,
\r
144 String callerSideCodc, String corlator,
\r
145 String midCllRtcp, String vendr_name)
\r
147 super(evname,evid);
\r
151 /***************************************************************************/
\r
152 /* Check preconditions. */
\r
153 /***************************************************************************/
\r
154 assert(vendr_name != null);
\r
155 assert(calleeSideCodc != null);
\r
156 assert(callerSideCodc != null);
\r
157 assert(midCllRtcp != null);
\r
158 assert(corlator != null);
\r
161 /***************************************************************************/
\r
162 /* Allocate the measurement. */
\r
163 /***************************************************************************/
\r
164 LOGGER.debug("New Voice Quality vendor "+vendr_name+" correlator"+corlator+"calleeSideCodec"+calleeSideCodc+"callerSideCodec"+callerSideCodc+"midCallRtcp"+midCllRtcp);
\r
166 /***************************************************************************/
\r
167 /* Initialize the header & the measurement fields. */
\r
168 /***************************************************************************/
\r
169 event_domain = EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY;
\r
170 correlator = corlator;
\r
171 calleeSideCodec = calleeSideCodc;
\r
172 callerSideCodec = callerSideCodc;
\r
173 midCallRtcp = midCllRtcp;
\r
175 vnfname_field = new VENDOR_VNFNAME_FIELD();
\r
176 vnfname_field.vendorname = vendr_name;
\r
177 vnfname_field.vfmodule = new EvelOptionString();
\r
178 vnfname_field.vnfname = new EvelOptionString();
\r
180 /***************************************************************************/
\r
181 /* Optional fields. */
\r
182 /***************************************************************************/
\r
183 additional_info = null;
\r
184 endOfCallVqmSummaries = null;
\r
185 evphoneNumber = new EvelOptionString();
\r
190 /**************************************************************************//**
\r
191 * Add an additional value name/value pair to the Voice Quality.
\r
193 * The name and value are null delimited ASCII strings. The library takes
\r
194 * a copy so the caller does not have to preserve values after the function
\r
197 * @param name ASCIIZ string with the attribute's name. The caller
\r
198 * does not need to preserve the value once the function
\r
200 * @param value ASCIIZ string with the attribute's value. The caller
\r
201 * does not need to preserve the value once the function
\r
203 *****************************************************************************/
\r
204 public void evel_voice_quality_addl_info_add(String name, String value)
\r
206 String[] addl_info = null;
\r
209 /***************************************************************************/
\r
210 /* Check preconditions. */
\r
211 /***************************************************************************/
\r
212 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
213 assert(name != null);
\r
214 assert(value != null);
\r
216 if( additional_info == null )
\r
218 additional_info = new ArrayList<String[]>();
\r
221 LOGGER.debug(MessageFormat.format("Adding name={0} value={1}", name, value));
\r
222 addl_info = new String[2];
\r
223 assert(addl_info != null);
\r
224 addl_info[0] = name;
\r
225 addl_info[1] = value;
\r
227 additional_info.add(addl_info);
\r
233 /**************************************************************************//**
\r
234 * Set the Callee side codec for Call for domain Voice Quality
\r
236 * @note The property is treated as immutable: it is only valid to call
\r
237 * the setter once. However, we don't assert if the caller tries to
\r
238 * overwrite, just ignoring the update instead.
\r
241 * @param calleeCodecForCall The Callee Side Codec to be set. ASCIIZ
\r
242 * string. The caller does not need to
\r
243 * preserve the value once the function
\r
245 *****************************************************************************/
\r
246 public void evel_voice_quality_callee_codec_set(String calleeCodecForCall) {
\r
249 /***************************************************************************/
\r
250 /* Check preconditions. */
\r
251 /***************************************************************************/
\r
252 assert(calleeCodecForCall != null);
\r
253 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
254 LOGGER.debug("Setting Correlator "+calleeCodecForCall);
\r
256 calleeSideCodec = calleeCodecForCall;
\r
261 /**************************************************************************//**
\r
262 * Set the Caller side codec for Call for domain Voice Quality
\r
264 * @note The property is treated as immutable: it is only valid to call
\r
265 * the setter once. However, we don't assert if the caller tries to
\r
266 * overwrite, just ignoring the update instead.
\r
269 * @param callerCodecForCall The Caller Side Codec to be set. ASCIIZ
\r
270 * string. The caller does not need to
\r
271 * preserve the value once the function
\r
273 *****************************************************************************/
\r
274 public void evel_voice_quality_caller_codec_set(String callerCodecForCall) {
\r
277 /***************************************************************************/
\r
278 /* Check preconditions. */
\r
279 /***************************************************************************/
\r
280 assert(callerCodecForCall != null);
\r
281 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
282 LOGGER.debug("Setting CallerCodecForCall "+callerCodecForCall);
\r
284 callerSideCodec = callerCodecForCall;
\r
289 /**************************************************************************//**
\r
290 * Set the correlator for domain Voice Quality
\r
292 * @note The property is treated as immutable: it is only valid to call
\r
293 * the setter once. However, we don't assert if the caller tries to
\r
294 * overwrite, just ignoring the update instead.
\r
297 * @param correlator The correlator value to be set. ASCIIZ
\r
298 * string. The caller does not need to
\r
299 * preserve the value once the function
\r
301 *****************************************************************************/
\r
302 public void evel_voice_quality_correlator_set(String vCorrelator) {
\r
305 /***************************************************************************/
\r
306 /* Check preconditions. */
\r
307 /***************************************************************************/
\r
308 assert(vCorrelator != null);
\r
309 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
310 LOGGER.debug("Setting Correlator "+vCorrelator);
\r
312 correlator = vCorrelator;
\r
317 /**************************************************************************//**
\r
318 * Set the RTCP Call Data for domain Voice Quality
\r
320 * @note The property is treated as immutable: it is only valid to call
\r
321 * the setter once. However, we don't assert if the caller tries to
\r
322 * overwrite, just ignoring the update instead.
\r
325 * @param rtcpCallData The RTCP Call Data to be set. ASCIIZ
\r
326 * string. The caller does not need to
\r
327 * preserve the value once the function
\r
329 *****************************************************************************/
\r
330 public void evel_voice_quality_rtcp_data_set(String rtcpCallData) {
\r
333 /***************************************************************************/
\r
334 /* Check preconditions. */
\r
335 /***************************************************************************/
\r
336 assert(rtcpCallData != null);
\r
337 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
338 LOGGER.debug("Setting RTCP Data "+rtcpCallData);
\r
340 midCallRtcp = rtcpCallData;
\r
345 /**************************************************************************//**
\r
346 * Set the Vendor VNF Name fields for domain Voice Quality
\r
348 * @note The property is treated as immutable: it is only valid to call
\r
349 * the setter once. However, we don't assert if the caller tries to
\r
350 * overwrite, just ignoring the update instead.
\r
353 * @param modulename The Vendor, VNF and VfModule names to be set.
\r
354 * ASCIIZ string. The caller does not need to
\r
355 * preserve the value once the function
\r
357 *****************************************************************************/
\r
358 public void evel_voice_quality_vnfmodule_name_set(String module_name) {
\r
361 /***************************************************************************/
\r
362 /* Check preconditions. */
\r
363 /***************************************************************************/
\r
364 assert(module_name != null);
\r
365 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
366 LOGGER.debug("Setting VoiceQuality Module Name "+module_name);
\r
368 vnfname_field.vfmodule.SetValue(module_name);
\r
373 /**************************************************************************//**
\r
374 * Set the Vendor VNF Name fields for domain Voice Quality
\r
376 * @note The property is treated as immutable: it is only valid to call
\r
377 * the setter once. However, we don't assert if the caller tries to
\r
378 * overwrite, just ignoring the update instead.
\r
381 * @param modulename The Vendor, VNF and VfModule names to be set.
\r
382 * ASCIIZ string. The caller does not need to
\r
383 * preserve the value once the function
\r
385 *****************************************************************************/
\r
386 public void evel_voice_quality_vnfname_set(String vnfname) {
\r
389 /***************************************************************************/
\r
390 /* Check preconditions. */
\r
391 /***************************************************************************/
\r
392 assert(vnfname != null);
\r
393 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
394 LOGGER.debug("Setting VoiceQuality VNF Name "+vnfname);
\r
396 vnfname_field.vnfname.SetValue(vnfname);
\r
402 /**************************************************************************//**
\r
403 * Set the Phone Number associated with the Correlator for domain Voice Quality
\r
405 * @note The property is treated as immutable: it is only valid to call
\r
406 * the setter once. However, we don't assert if the caller tries to
\r
407 * overwrite, just ignoring the update instead.
\r
410 * @param calleeCodecForCall The Phone Number to be set. ASCIIZ
\r
411 * string. The caller does not need to
\r
412 * preserve the value once the function
\r
414 *****************************************************************************/
\r
415 public void evel_voice_quality_phone_number_set(String phoneNumber) {
\r
418 /***************************************************************************/
\r
419 /* Check preconditions. */
\r
420 /***************************************************************************/
\r
421 assert(phoneNumber != null);
\r
422 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
424 evphoneNumber.SetValuePr(phoneNumber,"Phone_Number");
\r
429 /**************************************************************************//**
\r
430 * Add an End of Call Voice Quality Metrices
\r
432 * The adjacencyName and endpointDescription is null delimited ASCII string.
\r
433 * The library takes a copy so the caller does not have to preserve values
\r
434 * after the function returns.
\r
436 * @param voiceQuality Pointer to the measurement.
\r
437 * @param adjacencyName Adjacency name
\r
438 * @param endpointDescription Enumeration: ‘Caller’, ‘Callee’.
\r
439 * @param endpointJitter Endpoint jitter
\r
440 * @param endpointRtpOctetsDiscarded Endpoint RTP octets discarded.
\r
441 * @param endpointRtpOctetsReceived Endpoint RTP octets received.
\r
442 * @param endpointRtpOctetsSent Endpoint RTP octets sent
\r
443 * @param endpointRtpPacketsDiscarded Endpoint RTP packets discarded.
\r
444 * @param endpointRtpPacketsReceived Endpoint RTP packets received.
\r
445 * @param endpointRtpPacketsSent Endpoint RTP packets sent.
\r
446 * @param localJitter Local jitter.
\r
447 * @param localRtpOctetsDiscarded Local RTP octets discarded.
\r
448 * @param localRtpOctetsReceived Local RTP octets received.
\r
449 * @param localRtpOctetsSent Local RTP octets sent.
\r
450 * @param localRtpPacketsDiscarded Local RTP packets discarded.
\r
451 * @param localRtpPacketsReceived Local RTP packets received.
\r
452 * @param localRtpPacketsSent Local RTP packets sent.
\r
453 * @param mosCqe Decimal range from 1 to 5
\r
454 * (1 decimal place)
\r
455 * @param packetsLost No Packets lost
\r
456 * @param packetLossPercent Calculated percentage packet loss
\r
457 * @param rFactor rFactor from 0 to 100
\r
458 * @param roundTripDelay Round trip delay in milliseconds
\r
459 *****************************************************************************/
\r
460 public void evel_voice_quality_end_metrics_set(
\r
461 String adjacencyName, String endpointDescr,
\r
462 double endpointJitter,
\r
463 double endpointRtpOctetsDiscarded,
\r
464 double endpointRtpOctetsReceived,
\r
465 double endpointRtpOctetsSent,
\r
466 double endpointRtpPacketsDiscarded,
\r
467 double endpointRtpPacketsReceived,
\r
468 double endpointRtpPacketsSent,
\r
469 double localJitter,
\r
470 double localRtpOctetsDiscarded,
\r
471 double localRtpOctetsReceived,
\r
472 double localRtpOctetsSent,
\r
473 double localRtpPacketsDiscarded,
\r
474 double localRtpPacketsReceived,
\r
475 double localRtpPacketsSent,
\r
477 double packetsLost,
\r
478 double packetLossPercent,
\r
480 double roundTripDelay) {
\r
482 END_OF_CALL_VOICE_QUALITY_METRICS vQMetrices = null;
\r
485 /***************************************************************************/
\r
486 /* Check assumptions. */
\r
487 /***************************************************************************/
\r
488 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
489 assert(adjacencyName != null);
\r
490 assert(mosCqe >= 1 && mosCqe <= 5);
\r
491 assert(rFactor >= 0 && rFactor <= 100);
\r
492 assert(endpointDescr != null && (endpointDescr.equals("Caller")||endpointDescr.equals("Callee")) );
\r
494 /***************************************************************************/
\r
495 /* Allocate a container for the value and push onto the list. */
\r
496 /***************************************************************************/
\r
497 LOGGER.debug(MessageFormat.format("Adding adjacencyName={0} endpointDescription={1}", adjacencyName, endpointDescr));
\r
498 vQMetrices = new END_OF_CALL_VOICE_QUALITY_METRICS();
\r
499 assert(vQMetrices != null);
\r
501 vQMetrices.adjacencyName = adjacencyName;
\r
502 vQMetrices.endpointDescription = endpointDescr;
\r
504 vQMetrices.endpointJitter = new EvelOptionDouble();
\r
505 vQMetrices.endpointRtpOctetsDiscarded= new EvelOptionDouble();
\r
506 vQMetrices.endpointRtpOctetsReceived= new EvelOptionDouble();
\r
507 vQMetrices.endpointRtpOctetsSent= new EvelOptionDouble();
\r
508 vQMetrices.endpointRtpPacketsDiscarded= new EvelOptionDouble();
\r
509 vQMetrices.endpointRtpPacketsReceived= new EvelOptionDouble();
\r
510 vQMetrices.endpointRtpPacketsSent= new EvelOptionDouble();
\r
511 vQMetrices.localJitter= new EvelOptionDouble();
\r
512 vQMetrices.localRtpOctetsDiscarded= new EvelOptionDouble();
\r
513 vQMetrices.localRtpOctetsReceived= new EvelOptionDouble();
\r
514 vQMetrices.localRtpOctetsSent= new EvelOptionDouble();
\r
515 vQMetrices.localRtpPacketsDiscarded= new EvelOptionDouble();
\r
516 vQMetrices.localRtpPacketsReceived= new EvelOptionDouble();
\r
517 vQMetrices.localRtpPacketsSent= new EvelOptionDouble();
\r
518 vQMetrices.mosCqe= new EvelOptionDouble();
\r
519 vQMetrices.packetsLost= new EvelOptionDouble();
\r
520 vQMetrices.packetLossPercent= new EvelOptionDouble();
\r
521 vQMetrices.rFactor= new EvelOptionDouble();
\r
522 vQMetrices.roundTripDelay= new EvelOptionDouble();
\r
524 vQMetrices.endpointJitter.SetValuePr(endpointJitter, "Endpoint jitter");
\r
525 vQMetrices.endpointRtpOctetsDiscarded.SetValuePr(endpointRtpOctetsDiscarded, "Endpoint RTP octets discarded");
\r
526 vQMetrices.endpointRtpOctetsReceived.SetValuePr(endpointRtpOctetsReceived, "Endpoint RTP octets received");
\r
527 vQMetrices.endpointRtpOctetsSent.SetValuePr(endpointRtpOctetsSent, "Endpoint RTP octets sent");
\r
528 vQMetrices.endpointRtpPacketsDiscarded.SetValuePr(endpointRtpPacketsDiscarded, "Endpoint RTP packets discarded");
\r
529 vQMetrices.endpointRtpPacketsReceived.SetValuePr(endpointRtpPacketsReceived, "Endpoint RTP packets received");
\r
530 vQMetrices.endpointRtpPacketsSent.SetValuePr(endpointRtpPacketsSent, "Endpoint RTP packets sent");
\r
531 vQMetrices.localJitter.SetValuePr( localJitter, "Local jitter");
\r
532 vQMetrices.localRtpOctetsDiscarded.SetValuePr(localRtpOctetsDiscarded, "Local RTP octets discarded");
\r
533 vQMetrices.localRtpOctetsReceived.SetValuePr(localRtpOctetsReceived, "Local RTP octets received");
\r
534 vQMetrices.localRtpOctetsSent.SetValuePr(localRtpOctetsSent, "Local RTP octets sent");
\r
535 vQMetrices.localRtpPacketsDiscarded.SetValuePr(localRtpPacketsDiscarded, "Local RTP packets discarded");
\r
536 vQMetrices.localRtpPacketsReceived.SetValuePr(localRtpPacketsReceived, "Local RTP packets received");
\r
537 vQMetrices.localRtpPacketsSent.SetValuePr(localRtpPacketsSent, "Local RTP packets sent");
\r
538 vQMetrices.mosCqe.SetValuePr(mosCqe, "Decimal range from 1 to 5 (1 decimal place)");
\r
539 vQMetrices.packetsLost.SetValuePr(packetsLost, "Packets lost");
\r
540 vQMetrices.packetLossPercent.SetValuePr(packetLossPercent, "Calculated percentage packet loss");
\r
541 vQMetrices.rFactor.SetValuePr(rFactor, "rFactor ");
\r
542 vQMetrices.roundTripDelay.SetValuePr(roundTripDelay, "Round trip delay in milliseconds ");
\r
544 endOfCallVqmSummaries = vQMetrices;
\r
549 /**************************************************************************//**
\r
550 * Encode the Voice Quality in JSON according to AT&T's schema
\r
552 * @retvalue JSON object of VoiceQuality body encoding
\r
553 *****************************************************************************/
\r
554 JsonObjectBuilder evelVoiceQualityObject()
\r
557 double version = major_version+(double)minor_version/10;
\r
561 /***************************************************************************/
\r
562 /* Check preconditions. */
\r
563 /***************************************************************************/
\r
564 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
566 /***************************************************************************/
\r
567 /* Mandatory fields. */
\r
568 /***************************************************************************/
\r
570 JsonObjectBuilder vnfnamedobj = Json.createObjectBuilder()
\r
571 .add( "vendorName",vnfname_field.vendorname);
\r
572 vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vfModuleName");
\r
573 vnfname_field.vfmodule.encJsonValue(vnfnamedobj,"vnfName");
\r
575 JsonObjectBuilder evelvq = Json.createObjectBuilder()
\r
576 .add("correlator", correlator)
\r
577 .add("calleeSideCodec", calleeSideCodec)
\r
578 .add("callerSideCodec", callerSideCodec)
\r
579 .add("midCallRtcp", midCallRtcp)
\r
580 .add("voiceQualityFieldsVersion", version)
\r
581 .add("vendorVnfNameFields", vnfnamedobj);
\r
583 /***************************************************************************/
\r
584 /* Optional fields. */
\r
585 /***************************************************************************/
\r
586 evphoneNumber.encJsonValue(evelvq, "phoneNumber");
\r
589 // additional fields
\r
590 if( additional_info != null )
\r
592 JsonArrayBuilder builder = Json.createArrayBuilder();
\r
593 for(int i=0;i<additional_info.size();i++) {
\r
594 String[] addl_info = additional_info.get(i);
\r
595 JsonObject obj = Json.createObjectBuilder()
\r
596 .add("name", addl_info[0])
\r
597 .add("value", addl_info[1]).build();
\r
600 evelvq.add("additionalFields", builder);
\r
604 if( endOfCallVqmSummaries != null )
\r
606 JsonArrayBuilder builder = Json.createArrayBuilder();
\r
608 END_OF_CALL_VOICE_QUALITY_METRICS vQMetrics = endOfCallVqmSummaries;
\r
610 JsonObjectBuilder obj = Json.createObjectBuilder()
\r
611 .add("adjacencyName", vQMetrics.adjacencyName)
\r
612 .add("endpointDescription", vQMetrics.endpointDescription);
\r
614 vQMetrics.endpointJitter.encJsonValue(obj,"endpointJitter");
\r
615 vQMetrics.endpointRtpOctetsDiscarded.encJsonValue(obj,"endpointRtpOctetsDiscarded");
\r
616 vQMetrics.endpointRtpOctetsReceived.encJsonValue(obj,"endpointRtpOctetsReceived");
\r
617 vQMetrics.endpointRtpOctetsSent.encJsonValue(obj,"endpointRtpOctetsSent");
\r
618 vQMetrics.endpointRtpPacketsDiscarded.encJsonValue(obj,"endpointRtpPacketsDiscarded");
\r
619 vQMetrics.endpointRtpPacketsReceived.encJsonValue(obj,"endpointRtpPacketsReceived");
\r
620 vQMetrics.endpointRtpPacketsSent.encJsonValue(obj,"endpointRtpPacketsSent");
\r
621 vQMetrics.localJitter.encJsonValue(obj,"localJitter");
\r
622 vQMetrics.localRtpOctetsDiscarded.encJsonValue(obj,"localRtpOctetsDiscarded");
\r
623 vQMetrics.localRtpOctetsReceived.encJsonValue(obj,"localRtpOctetsReceived");
\r
624 vQMetrics.localRtpOctetsSent.encJsonValue(obj,"localRtpOctetsSent");
\r
625 vQMetrics.localRtpPacketsDiscarded.encJsonValue(obj,"localRtpPacketsDiscarded");
\r
626 vQMetrics.localRtpPacketsReceived.encJsonValue(obj,"localRtpPacketsReceived");
\r
627 vQMetrics.localRtpPacketsSent.encJsonValue(obj,"localRtpPacketsSent");
\r
628 vQMetrics.mosCqe.encJsonValue(obj,"mosCqe");
\r
629 vQMetrics.packetsLost.encJsonValue(obj,"packetsLost");
\r
630 vQMetrics.packetLossPercent.encJsonValue(obj,"packetLossPercent");
\r
631 vQMetrics.rFactor.encJsonValue(obj,"rFactor");
\r
632 vQMetrics.roundTripDelay.encJsonValue(obj,"roundTripDelay");
\r
634 evelvq.add("endOfCallVqmSummaries", obj);
\r
638 /***************************************************************************/
\r
639 /* Although optional, we always generate the version. Note that this */
\r
640 /* closes the object, too. */
\r
641 /***************************************************************************/
\r
648 /**************************************************************************//**
\r
649 * Encode the event as a JSON event object according to AT&T's schema.
\r
650 * retval : String of JSON Voice Quality event message
\r
651 *****************************************************************************/
\r
652 String evel_json_encode_event()
\r
656 assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_VOICE_QUALITY);
\r
658 JsonObject obj = Json.createObjectBuilder()
\r
659 .add("event", Json.createObjectBuilder()
\r
660 .add( "commonEventHeader",eventHeaderObject() )
\r
661 .add( "voiceQualityFields",evelVoiceQualityObject() )
\r
666 return obj.toString();
\r