code: @Override
      public JsonObject serialize(CallDetailRecordList cdrList, Type type, JsonSerializationContext context) {
  
          JsonObject result = new JsonObject();
  
          JsonArray array = new JsonArray();
          for (CallDetailRecord cdr : cdrList.getCallDetailRecords()) {
              array.add(context.serialize(cdr));
          }
  
          if (total != null && pageSize != null && page != null) {
              result.addProperty("page", page);
              result.addProperty("num_pages", getTotalPages());
              result.addProperty("page_size", pageSize);
              result.addProperty("total", total);
              result.addProperty("start", getFirstIndex());
              result.addProperty("end", getLastIndex(cdrList));
              result.addProperty("uri", pathUri);
              result.addProperty("first_page_uri", getFirstPageUri());
              result.addProperty("previous_page_uri", getPreviousPageUri());
              result.addProperty("next_page_uri", getNextPageUri(cdrList));
              result.addProperty("last_page_uri", getLastPageUri());
          }
  
          result.add("calls", array);
  
          return result;
      }
docs: Issue 110: https://bitbucket.org/telestax/telscale-restcomm/issue/110