| 32916 |
amit.gupta |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 33581 |
ranu |
3 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 33595 |
ranu |
4 |
import com.spice.profitmandi.dao.repository.cs.AgentRecordingRepository;
|
| 32929 |
amit.gupta |
5 |
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
|
|
|
6 |
import com.spice.profitmandi.service.integrations.smartping.model.CallDetailModel;
|
| 32916 |
amit.gupta |
7 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
|
|
8 |
import org.apache.logging.log4j.LogManager;
|
|
|
9 |
import org.apache.logging.log4j.Logger;
|
|
|
10 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 33581 |
ranu |
11 |
import org.springframework.http.MediaType;
|
|
|
12 |
import org.springframework.http.ResponseEntity;
|
| 32916 |
amit.gupta |
13 |
import org.springframework.stereotype.Controller;
|
|
|
14 |
import org.springframework.ui.Model;
|
| 33591 |
ranu |
15 |
import org.springframework.web.bind.annotation.ModelAttribute;
|
| 32916 |
amit.gupta |
16 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
17 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
18 |
|
|
|
19 |
import javax.servlet.http.HttpServletRequest;
|
|
|
20 |
import javax.transaction.Transactional;
|
|
|
21 |
|
|
|
22 |
@Controller
|
|
|
23 |
@Transactional(rollbackOn = Throwable.class)
|
|
|
24 |
public class WebHookController {
|
|
|
25 |
|
|
|
26 |
@Autowired
|
|
|
27 |
MVCResponseSender mvcResponseSender;
|
|
|
28 |
|
| 33581 |
ranu |
29 |
@Autowired
|
|
|
30 |
private ResponseSender<?> responseSender;
|
|
|
31 |
|
| 32916 |
amit.gupta |
32 |
private static final Logger LOGGER = LogManager.getLogger(WebHookController.class);
|
|
|
33 |
|
| 32919 |
amit.gupta |
34 |
@Autowired
|
| 32929 |
amit.gupta |
35 |
SmartPingService smartPingService;
|
| 32916 |
amit.gupta |
36 |
|
| 33595 |
ranu |
37 |
@Autowired
|
|
|
38 |
AgentRecordingRepository agentRecordingRepository;
|
|
|
39 |
|
| 33581 |
ranu |
40 |
// @RequestMapping(value = "/click2call/report-handler", method = RequestMethod.POST)
|
|
|
41 |
// public String click2callReportHandlerPost(HttpServletRequest request, Model model, @RequestParam(name = "push_report") String callDetailString) throws Exception {
|
|
|
42 |
//
|
|
|
43 |
// smartPingService.createAgentRecording(callDetailString);
|
|
|
44 |
// model.addAttribute("response1", mvcResponseSender.createResponseString("GODBLESSYOU"));
|
|
|
45 |
// return "response";
|
|
|
46 |
// }
|
| 32917 |
amit.gupta |
47 |
|
| 33590 |
ranu |
48 |
@RequestMapping(value = "/click2call/report-handler", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
| 33591 |
ranu |
49 |
public ResponseEntity<?> click2callReportHandlerPost(HttpServletRequest request, Model model, @ModelAttribute CallDetailModel callDetail) throws Exception {
|
| 33581 |
ranu |
50 |
LOGGER.info("first event call detail {}", callDetail);
|
| 33595 |
ranu |
51 |
smartPingService.updateAgentRecording(callDetail);
|
| 33581 |
ranu |
52 |
|
|
|
53 |
return responseSender.ok(true);
|
| 32917 |
amit.gupta |
54 |
}
|
| 33581 |
ranu |
55 |
|
|
|
56 |
|
| 33590 |
ranu |
57 |
@RequestMapping(value = "/click2call/report-handler/recording-url", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
| 33591 |
ranu |
58 |
public ResponseEntity<?> click2callReportHandlerUpdateRecordingUrlPost(HttpServletRequest request, Model model, @ModelAttribute CallDetailModel callDetail) throws Exception {
|
| 33581 |
ranu |
59 |
LOGGER.info("update call detail {}", callDetail);
|
| 33586 |
ranu |
60 |
smartPingService.updateAgentRecordingUrl(callDetail);
|
| 33581 |
ranu |
61 |
return responseSender.ok(true);
|
|
|
62 |
}
|
| 32916 |
amit.gupta |
63 |
}
|