HTTP API - Get CDR
POST https://gateway_ip/api/get_cdr
Request Parameters:
Parameter | Type | Description |
Required Parameter | ||
Optional Parameter | ||
port | Array | Port(s) whose CDR is to be queried;
Each port number should be an integer ranging from 0 to 31. |
time_after | String | String like "YYYY-MM-DD HH:MM:SS";
Query the CDRs which are sent after this time. |
time_before | String | String like "YYYY-MM-DD HH:MM:SS";
Query CDRs are sent before this time. |
Response Parameters:
Parameter | Type | Description |
error_code | Integer | Codes that may be returned: 200: Request has been processed 400: Request format is not valid
500: Other errors |
sn | String | SN of the gateway |
cdr | Array | Each CDR will be returned according to the query.
port: port number; start_date: start time of the call; answer_date: answer time of the call; duration: call duration source_number:source number destination_number:destination number direction: call direction which could be gsm->ip, ip->gsm or callback; ip: the source ip of an ip->gsm call codec: it could be:G.711U, G.723.1, G.711A or G.729AB; hangup: the party to hang up the call ; it could be the called party, the calling party or the gateway; gsm_code: the code of the reason why the GSM side hangs up the call; bcch: BCCH used for this call |
Example of Getting CDR:
Request:
curl -k --anyauth -u admin:admin -d '{"port":[2,3]}' -H "Content-Type: application/json" http://gateway_ip/api/get_cdr
Response:
{"error_code":200,"sn":"xxxx-xxxx-xxxx-xxxx","cdr":[{"port":2, "start_date":"2015-07-21 16:35:20","answer_date":"2015-07-21 16:35:31","duration":3,"source_number":"1010","destination_num ber":"6717","direction":"ip->gsm","ip":"172.16.100.136","codec":"G.711U","hangup":"called","gsm_code":16,"bcch":""}]}