I have given a query and code snippets that are related to the query. You have to answer the query using those snippets. Query: need of code or query in reply
 snippets: private void setExotelBody(String type, ObjectNode body) {
        body.put("To", "");
        body.put("From", "");
        body.put("CallTo", "");
        body.put("Created", "");
        body.put("CallSid", "");
        body.put("CallFrom", "");
        body.put("Direction", "");
        body.put("disposition", "");
        body.put("CurrentTime", "");
        body.put("DialWhomNumber", "");
        if (type.equals("screenPop")) {
            body.put("", "");
            body.put("Status", "");
            body.put("AgentEmail", "");
        } else if (type.equals("callBack")) {
            body.put("flow_id", "");
            body.put("EndTime", "");
            body.put("CallType", "");
            body.put("tenant_id", "");
            body.put("StartTime", "");
            body.put("ForwardedFrom", "");
            body.put("RecordingUrl", "");
            body.put("DialCallStatus", "");
            body.put("digits", "");
            body.put("is_auto_close", "");
            body.put("DialCallDuration", "");
            body.put("RecordingAvailableBy", "");
        }
    }
@GetMapping("/emailcredential/{id}/{key}")
    public ResponseEntity< ? > getEmailCredentialConfigForId(@PathVariable String id, @PathVariable String key) {
        return new ResponseEntity<>(emailCredentialService.getEmailCredentialConfigForId(id, key, request), HttpStatus.ACCEPTED);
    }
@GetMapping("/line/{id}/{key}")
    public ResponseEntity<?> getLineConfigForId(@PathVariable String id, @PathVariable String key) {
        return new ResponseEntity<>(lineService.getLineConfigForId(id, key, request), HttpStatus.ACCEPTED);
    }
public class CallParameters {

    private static final Logger LOGGER                = LoggerFactory.getLogger(CallParameters.class);

    // screen pop parameter
    public int                  cmId                  = 0;
    public String               dni                   = "";
    public String               udId                  = "";
    public String               ucId                  = "";
    public String               phone                 = "";
    public String               empCode               = "";
    public String               orderId               = "";
    public String               queueKey              = "";
    public String               campaign              = "";
    public String               callType              = "";
    public String               language              = "";
    public String               callDetail            = "";
    public String               callStatus            = "";
    public String               requestType           = "";
    public String               agentStatus           = "";
    public String               ivrCusRegNo           = "";
    public String               disposition           = "";
    public boolean              isSupportCall         = true;
    public boolean              isRequestBody         = false;
    public String               existingTicketId      = "";
    public String               alternativeCampaign   = "";
    public boolean              isNotAddLeadPage      = false;
    public String               customerCode          = "";
    public String               subOrderId            = "";
    public String               categoryId            = "";
    public boolean              isOrderApiTag         = false;
    public int                  csat                  = 0;
    public String               callDuration          = "";
    public String               email                 = "";
    public boolean              isIncludeDidAndType   = false;

    // call back parameter
    public String               endTime               = "";
    public String               duration              = "";
    public String               recording             = "";
    public String               startTime             = "";
    public String               ivrKeyword            = "";
    public boolean              isSalesCall           = false;

    public String               dniParameter          = "dni";
    public String               phoneParameter        = "phone";
    public String               callIdParameter       = "call_id";
    public String               callNoParameter       = "call_no";
    public String               endTimeParameter      = "end_time";
    public String               empCodeParameter      = "emp_code";
    public String               campaignParameter     = "campaign";
    public String               languageParameter     = "language";
    public String               queueKeyParameter     = "queue_key";
    public String               callTypeParameter     = "call_type";
    public String               ticketIdParameter     = "ticket_id";
    public String               startTimeParameter    = "start_time";
    public String               callStatusParameter   = "call_status";
    public String               dispositionParameter  = "disposition";
    public String               recordingParameter    = "call_recording";
    public String               callbackParameter     = "call_back_time";
    public String               ivrCusRegNoParameter  = "ivr_cus_register_no";
    public String               durationParameter     = "total_call_duration";
    public String               callDurParameter      = "call_duration";
    public String               emailParameter        = "email";
    public String               customerCodeParameter = "customer_code";
    public JSONObject           callParameterMapping  = new JSONObject();
    public JSONObject           dialerConfig          = new JSONObject();

    public CallParameters(int cmId, JSONObject dialerConfig, JSONObject callParameterMapping) {
        this.cmId = cmId;
        this.dialerConfig = dialerConfig;
        this.callParameterMapping = callParameterMapping;
        dniParameter = getParameterName(dniParameter);
        phoneParameter = getParameterName(phoneParameter);
        callIdParameter = getParameterName(callIdParameter);
        callNoParameter = getParameterName(callNoParameter);
        empCodeParameter = getParameterName(empCodeParameter);
        endTimeParameter = getParameterName(endTimeParameter);
        callDurParameter = getParameterName(callDurParameter);
        campaignParameter = getParameterName(campaignParameter);
        callTypeParameter = getParameterName(callTypeParameter);
        durationParameter = getParameterName(durationParameter);
        callbackParameter = getParameterName(callbackParameter);
        ticketIdParameter = getParameterName(ticketIdParameter);
        queueKeyParameter = getParameterName(queueKeyParameter);
        startTimeParameter = getParameterName(startTimeParameter);
        recordingParameter = getParameterName(recordingParameter);
        callStatusParameter = getParameterName(callStatusParameter);
        dispositionParameter = getParameterName(dispositionParameter);
        customerCodeParameter = getParameterName(customerCodeParameter);
    }

    public String getParameterName(String parameter) {
        if (callParameterMapping.has(parameter)) {
            parameter = callParameterMapping.getString(parameter);
        }
        return parameter;
    }

    private JSONObject getTicketDialerConfig(String key) {
        JSONObject config = this.dialerConfig != null && this.dialerConfig.has(key) ? this.dialerConfig.getJSONObject(key) : null;
        return config != null && !config.isNullObject() ? config : new JSONObject();
    }

    public JSONObject getTicketDialerConfig() {
        return getTicketDialerConfig("ticket");
    }

    public JSONObject getEnquiryDialerConfig() {
        return getTicketDialerConfig("enquiry");
    }

    public void getParameterFields(HttpServletRequest request, String defaultEmpCode) {
        try {
            dni = CommonUtils.getString(request, dniParameter, "").trim();
            orderId = CommonUtils.getString(request, "order_id", "").trim();
            language = CommonUtils.getString(request, languageParameter, "").trim();
            phone = CommonUtils.getString(request, phoneParameter, "").trim();
            udId = CommonUtils.getString(request, callNoParameter, "").trim();
            ucId = CommonUtils.getString(request, callIdParameter, "").trim();
            empCode = CommonUtils.getString(request, empCodeParameter, "").trim();
            disposition = CommonUtils.getString(request, "disposition", "").trim();
            queueKey = CommonUtils.getString(request, queueKeyParameter, "").trim();
            campaign = CommonUtils.getString(request, campaignParameter, "").trim();
            callType = CommonUtils.getString(request, callTypeParameter, "").trim();
            callType = "1".equals(callType) ? Constant.INBOUND + "" : "2".equals(callType) ? Constant.OUTBOUND + "" : callType;
            agentStatus = CommonUtils.getString(request, "agent_status", "").trim();
            existingTicketId = CommonUtils.getString(request, "ticket_id", "").trim();
            ivrCusRegNo = CommonUtils.getString(request, ivrCusRegNoParameter, "").trim();
            ivrCusRegNo = StringUtilityClass.isNotNullAndNotEmpty(ivrCusRegNo) ? ivrCusRegNo : phone;
            alternativeCampaign = CommonUtils.getString(request, "alternative_campaign", "").trim();
            empCode = "".equals(empCode) ? defaultEmpCode : empCode;

            ivrKeyword = CommonUtils.getString(request, "ivr", "").trim();
            endTime = CommonUtils.getString(request, endTimeParameter, "").trim();
            duration = CommonUtils.getString(request, durationParameter, "0").trim();
            recording = CommonUtils.getString(request, recordingParameter, "").trim();
            startTime = CommonUtils.getString(request, startTimeParameter, "").trim();
            callStatus = CommonUtils.getString(request, callStatusParameter, "").trim();

            customerCode = CommonUtils.getString(request, customerCodeParameter, "").trim();
            subOrderId = CommonUtils.getString(request, "sub_order_id", "").trim();
            categoryId = CommonUtils.getString(request, "category_id", "").trim();
            isOrderApiTag = "1".equals(CommonUtils.getString(request, "is_order_api", ""));
            csat = CommonUtils.getInteger(request, "csat", 0);
            callDuration = CommonUtils.getString(request, callDurParameter, "").trim();
            email = CommonUtils.getString(request, emailParameter, "");
            isIncludeDidAndType = "1".equals(CommonUtils.getString(request, "is_include_did", ""));
        } catch (Exception e) {
            LOGGER.error("Error in getParameterFields", e);
        }
    }

    public void getRequestBodyFields(HttpServletRequest request) {
        try {
            isRequestBody = true;
            JSONObject dataJson = null;
            JSONObject ticketDialerConfig = getTicketDialerConfig();
            JSONObject requestBody = JSONObject.fromObject(getRequestBody(request));
            if (requestBody != null && !requestBody.isNullObject()) {
                if (requestBody.has("myoperator")) {
                    dataJson = requestBody.getJSONObject("myoperator");
                } else if (requestBody.has("content")) {
                    dataJson = requestBody.getJSONObject("content");
                } else {
                    dataJson = requestBody;
                    LOGGER.error("Logging Response Webhook for {} {}", this.cmId, requestBody);
                }
            }
            if (dataJson != null && !dataJson.isNullObject()) {
                String inboundCallTypeValue = "1";
                boolean swapCampaignAndPhoneValue = false;
                if (ticketDialerConfig != null && !ticketDialerConfig.isNullObject()) {
                    swapCampaignAndPhoneValue = ticketDialerConfig.has("swapCampaignAndPhoneOnCallType");
                    inboundCallTypeValue = ticketDialerConfig.has("inboundCallTypeValue") ? ticketDialerConfig.getString("inboundCallTypeValue")
                            : inboundCallTypeValue;
                }
                callDetail = dataJson.toString();
                campaign = CommonUtils.getString(request, campaignParameter, "");
                language = CommonUtils.getString(request, languageParameter, "");
                phone = dataJson.has(phoneParameter) ? dataJson.getString(phoneParameter) : "";
                campaign = StringUtilityClass.isNotNullAndNotEmpty(campaign) ? campaign : dataJson.optString(campaignParameter);
                campaign = StringUtilityClass.isNotNullAndNotEmpty(campaign) ? campaign : "";
                callType = inboundCallTypeValue.equals(dataJson.optString(callTypeParameter)) ? Constant.INBOUND + "" : Constant.OUTBOUND + "";
                if (swapCampaignAndPhoneValue && (Constant.OUTBOUND + "").equals(callType)) {
                    phone = campaign;
                    campaign = dataJson.has(phoneParameter) ? dataJson.getString(phoneParameter) : "";
                }
                queueKey = dataJson.optString(queueKeyParameter);
                ucId = dataJson.has(callIdParameter) ? dataJson.getString(callIdParameter) : "";
                endTime = dataJson.has(endTimeParameter) ? dataJson.getString(endTimeParameter) : "";
                duration = dataJson.has(durationParameter) ? dataJson.getString(durationParameter) : "0";
                callDuration = dataJson.has(callDurParameter) ? dataJson.getString(callDurParameter) : "";
                recording = dataJson.has(recordingParameter) ? dataJson.getString(recordingParameter) : "";
                startTime = dataJson.has(startTimeParameter) ? dataJson.getString(startTimeParameter) : "";
                callStatus = dataJson.has(callStatusParameter) ? dataJson.getString(callStatusParameter) : "";
                ivrCusRegNo = dataJson.has(ivrCusRegNoParameter) ? dataJson.getString(ivrCusRegNoParameter) : "";
                ivrCusRegNo = StringUtilityClass.isNotNullAndNotEmpty(ivrCusRegNo) ? ivrCusRegNo : phone;
                existingTicketId = dataJson.has(ticketIdParameter) ? dataJson.getString(ticketIdParameter) : "client_ref_id";
                boolean isServtel = "servtel".equals(dataJson.optString("vendor"));
                try {
                    Object user = dataJson.has(empCodeParameter) ? dataJson.get(empCodeParameter) : null;
                    if (user != null) {
                        if (user instanceof JSONArray) {
                            JSONArray empCodeArray = (JSONArray) user;
                            if (empCodeArray != null && !empCodeArray.isEmpty()) {
                                if (empCodeArray.opt(0) instanceof JSONObject) {
                                    JSONObject empcodeJSON = empCodeArray.optJSONObject(0);
                                    empCode = empcodeJSON != null ? empcodeJSON.optString("identifier") : "";
                                } else {
                                    empCode = empCodeArray.optString(0);
                                }
                            }
                        } else if (user instanceof JSONObject) {
                            JSONObject empCodeJSON = (JSONObject) user;
                            empCode = empCodeJSON.optString("agent_number");
                        } else if (user instanceof String) {
                            empCode = (String) user;
                        } else if (user instanceof Integer) {
                            empCode = ((Integer) user) + "";
                        }
                    }
                    if (isServtel && StringUtilityClass.isEmptyOrNull(empCode) && dataJson.containsKey("missed_agent")) {
                        JSONArray missedArr = dataJson.optJSONArray("missed_agent");
                        JSONObject misdObj = missedArr != null && missedArr.size() > 0 ? missedArr.optJSONObject(0) : null;
                        empCode = misdObj != null ? misdObj.optString("agent_number") : "";
                    }
                } catch (Exception e) {
                    LOGGER.error("Error reading " + empCodeParameter + " in getRequestBodyFields", e);
                }
            }
        } catch (Exception e) {
            LOGGER.error("Error in getRequestBodyFields", e);
        }
    }

    private String getRequestBody(HttpServletRequest request) {
        try {
            String line = null;
            StringBuffer jb = new StringBuffer();
            BufferedReader reader = request.getReader();
            while ((line = reader.readLine()) != null) {
                jb.append(line);
            }
            return jb.toString();
        } catch (Exception e) {
            LOGGER.error("Error in getRequestBody", e);
        }
        return null;
    }
}
private void setSRKnowlarityBody(String type, ObjectNode body) {
        body.put("end_time", "");
        body.put("timezone", "");
        body.put("call_type", "");
        body.put("callid", "");
        body.put("resource_url", "");
        body.put("caller_id", "");
        body.put("start_time", "");
        body.put("dispnumber", "");
        body.put("call_duration", "");
        body.put("destination", "");
        if ("Support".equals(type)) {
            body.put("extension", "");
            body.put("disposition", "");
            body.put("ticket_id", "");
            body.put("response_type", "json");
        } else {
            body.put("type", "");
            body.put("action", "");
            body.put("extention", "");
            body.put("hangup_cause", "");
        }
    }