SimotelSimotel Documentation
فارسی

CDR Search

This service is used to retrieve information from the quick search section, and its main difference with Quick Search is the ability to search based on the cuid parameter.

Parameters

ParametersRequired[**]/Logical[*]Defined DataSample DataDescription
conditions->from---
conditions->to---
conditions->cuid---
date_range->from**-2020-06-15 15: 16Retrieve reports from date
date_range->to**-2022-06-22 15: 16Retrieve reports until date
pagination->start-0-
pagination->count-20-
pagination->sorting---
alike**true/falsetrueFind similar items

Sample Invocation

Example Code
PHP
	<?PHP

	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => 'HTTP://192.168.1.100/API/v4/reports/CDR/search',
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_ENCODING => '',
	  CURLOPT_MAXREDIRS => 10,
	  CURLOPT_TIMEOUT => 0,
	  CURLOPT_FOLLOWLOCATION => true,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => 'POST',
	  CURLOPT_POSTFIELDS =>'{
		"conditions":{"from": "562", "to": "09123456789", "cuid":"1624340875.75933"},
		"date_range":{"from":"2020-06-15 15:16","to":"2022-06-22 15:16"},
		"pagination":{"start":0,"count":20,"sorting":{}},
		"alike":"true"
	}',
	  CURLOPT_HTTPHEADER => array(
		'X-APIKEY: SAMPLE_API_KEY',
		'Authorization: Basic c2FkcjpTYWRyQDEyMw==',
		'Content-Type: application/JSON'
	  ),
	));

	$response = curl_exec($curl);

	curl_close($curl);
	echo $response;
?>
JavaScript
	<html>
			<head>
				<script src="/wiki/assets/vendor/jquery/jquery.min.js"></script>
			</head>
			<body>
				<script>
					var settings = {
					  "URL": "HTTP://192.168.1.100/API/v4/reports/CDR/search",
					  "method": "POST",
					  "timeout": 0,
					  "headers": {
						"X-APIKEY": "9UV0BWKRL83PYIH9Gv1fI85d41lO4S932EeX3wHC47sHjMJOMG",
						"Authorization": "Basic c2FkcjpTYWRyQDEyMw==",
						"Content-Type": "application/JSON"
					  },
					  "data": JSON.stringify({
						"conditions": {
						  "from": "562",
						  "to": "09123456789",
						  "cuid": "1624340875.75933"
						},
						"date_range": {
						  "from": "2020-06-15 15:16",
						  "to": "2022-06-22 15:16"
						},
						"pagination": {
						  "start": 0,
						  "count": 20,
						  "sorting": {}
						},
						"alike": "true"
					  }),
					};

					$.ajax(settings).done(function (response) {
					  console.log(response);
					});
				</script>
			</body>
	</html>
cURL
	curl --location --request POST 'HTTP://192.168.1.100/API/v4/reports/CDR/search' \
	--header 'X-APIKEY: SAMPLE_API_KEY' \
	--header 'Authorization: Basic c2FkcjpTYWRyQDEyMw==' \
	--header 'Content-Type: application/JSON' \
	--data-raw '{
		"conditions":{"from": "562", "to": "09123456789", "cuid":"1624340875.75933"},
		"date_range":{"from":"2020-06-15 15:16","to":"2022-06-22 15:16"},
		"pagination":{"start":0,"count":20,"sorting":{}},
		"alike":"true"
	}'
Example Output
{
    "success": 1,
    "message": "",
    "data": {
        "pagination": {
            "start": 0,
            "count": 20,
            "sorting": {
                "starttime": -1
            },
            "total": 1
        },
        "target": "CDR",
        "useGroupBy": false,
        "data": [
            {
                "_id": "60d179d3895b44fe5bbc66e2",
                "type": "outgoing",
                "cuid": "1624340875.75933",
                "clid": "\"\" <09123456789>",
                "src": "562",
                "dst": "09123456789",
                "dcontext": "main_routing",
                "channel": "SIP/center-00009cb6",
                "dstchannel": "",
                "lastapp": "Hangup",
                "lastdata": "",
                "start": "1400-04-01 10:19:04",
                "answer": "2021-06-22 10:19:04",
                "duration": 1,
                "billsec": 54,
                "disposition": "ANSWERED",
                "amaflags": "DOCUMENTATION",
                "accountcode": "",
                "uniqueid": "1624340875.75934",
                "userfield": "",
                "sequence": "54231",
                "comment": "",
                "v": 2,
                "outgoing_point": "center",
                "route": [
                    {
                        "type": "OutgoingRoute",
                        "name": "out31041",
                        "duration": 0.011272,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340875778"
                            }
                        }
                    },
                    {
                        "type": "Switcher",
                        "name": "Switcher",
                        "duration": 0.005508,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340875787"
                            }
                        }
                    },
                    {
                        "type": "Answer",
                        "name": "Answer",
                        "duration": 0.006667,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340875797"
                            }
                        }
                    },
                    {
                        "type": "MixMonitor",
                        "name": "Mix Monitor",
                        "duration": 0.005578,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340875808"
                            }
                        }
                    },
                    {
                        "type": "Trunk",
                        "name": "Center",
                        "duration": 68.601818,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340944416"
                            }
                        }
                    },
                    {
                        "type": "Trunk",
                        "name": "Center",
                        "duration": 0.004539,
                        "date": {
                            "$date": {
                                "$numberLong": "1624340944442"
                            }
                        }
                    }
                ],
                "wait": 14,
                "starttime": "1400-04-01 10:19:06",
                "endtime": {
                    "$date": {
                        "$numberLong": "1624340947977"
                    }
                },
                "record": "20210622_1624340875.75933.mp3",
                "ANSWERED": 1,
                "outgoing": 1,
                "billsec_hhmmss": "00:00:54",
                "wait_hhmmss": "00:00:14",
                "duration_hhmmss": "00:00:01"
            }
        ]
    }
}