<?php  

   session_start();
   error_reporting(0);
   include("db.php");
   include("all_query.php");
   
   
 $json = '{"callID":"TE_Manual_25841_206","resource_url":"http://192.168.1.112/PREDIALERREC/TE_Manual_25841_206.wav","missedFrom":"Agent","campaignID":"Callextremein","destination":"09911225841","end_time":"2022-02-14 21:12:21","callType":"Outbound","call_duration":"0","dispnumber":"NA","start_time":"2022-02-14 21:12:21","caller_id":"agent1","npfID":"null","status":"Failed"}';


	$data  = array();
    $jsonArray = json_decode(file_get_contents('php://input'),true);
	
	
	
	//$jsonArray = json_decode($json,true);
	
	 
	 $DATA = array();
	 
	  
	 if(isset($jsonArray['uniqueid']))
	 {
      $DATA['uniqueid'] = $jsonArray['uniqueid'];
	 }
	 
	 
	 if(isset($jsonArray['callID']))
	 {

	  
      $DATA['callID'] = $jsonArray['callID'];	 
      $DATA['resource_url'] = $jsonArray['resource_url'];	 
      $DATA['missedFrom'] = $jsonArray['missedFrom'];	 
      $DATA['end_time'] = $jsonArray['end_time'];	 
      $DATA['callType'] = $jsonArray['callType'];	 
      $DATA['call_duration'] = $jsonArray['call_duration'];	 
      $DATA['dispnumber'] = $jsonArray['dispnumber'];	 
      $DATA['start_time'] = $jsonArray['start_time'];	 
      $DATA['caller_id'] = $jsonArray['caller_id'];	 
      $DATA['npfID'] = $jsonArray['npfID'];	 
      $DATA['call_status'] = $jsonArray['status'];	 
	 
	 
	 

	        insertTable($conn,'call_reponse',$DATA,'add_submit');
			
			
	  $result = array();
	  
	  $result['status'] = 'success'; 
	  $result['message'] = 'Response added successfully'; 
	  
	  
	  
	 }
	 else
		 
		 {
			 
			 		
			
	  $result = array();
	  
	  $result['status'] = 'falied'; 
	  $result['message'] = 'invalid Data'; 
	  
		 }
			
			
			
	     echo json_encode($result);
			
   


?>